:root {
  --bg: #0b0e1f;
  --text: #1c3a5e;
  --muted: #5f7d9c;
  --accent: #3d86d8;
  --accent-2: #2f74c4;
  --danger: #e2607f;
  --radius: 18px;
  --line: rgba(70, 110, 150, 0.18);
  --card: rgba(255, 255, 255, 0.66);
  --card-strong: rgba(255, 255, 255, 0.86);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", system-ui, sans-serif;
  color: var(--text);
  background: linear-gradient(180deg, #5fa8e0 0%, #85c0ec 45%, #a9d6f5 100%);
  background-attachment: fixed;
  display: flex;
  justify-content: center;
  padding: 40px 20px;
  position: relative;
  overflow-x: hidden;
}

html.mobile body {
  padding: 20px 12px calc(24px + env(safe-area-inset-bottom));
}

.app {
  width: 100%;
  max-width: 960px;
}

/* ---- Header ---- */
.app__header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 24px;
}

html.mobile .app__header {
  flex-direction: column;
}

.brand {
  display: flex;
  align-items: center;
  gap: 16px;
}

.brand__mark {
  border-radius: 16px;
  box-shadow: 0 10px 24px rgba(43, 92, 150, 0.35);
  flex-shrink: 0;
}

.icon-btn {
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.55);
  border-radius: 999px;
  width: 32px;
  height: 32px;
  font-size: 15px;
  line-height: 1;
  cursor: pointer;
  display: grid;
  place-items: center;
  transition: transform 0.12s ease, background 0.12s ease;
}

.icon-btn:hover {
  transform: translateY(-1px);
  background: rgba(255, 255, 255, 0.8);
}

html.dark .icon-btn {
  background: rgba(22, 32, 58, 0.6);
}

html.dark .icon-btn:hover {
  background: rgba(22, 32, 58, 0.85);
}

.app__title {
  margin: 0;
  font-size: 30px;
  font-weight: 700;
}

.app__version {
  font-size: 12px;
  font-weight: 500;
  color: var(--muted);
  vertical-align: middle;
}

.app__subtitle {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 15px;
}

.app__actions {
  display: flex;
  gap: 10px;
  flex-shrink: 0;
}

/* ---- Buttons ---- */
.btn {
  font: inherit;
  border: none;
  border-radius: 12px;
  padding: 10px 18px;
  cursor: pointer;
  font-weight: 600;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.1s ease, opacity 0.15s ease;
}

.btn:active {
  transform: scale(0.97);
}

.btn--primary {
  background: var(--accent);
  color: #fff;
}

.btn--primary:hover {
  background: var(--accent-2);
}

.btn--ghost {
  background: var(--card);
  color: var(--text);
  border: 1px solid var(--line);
}

.btn--danger {
  background: transparent;
  color: var(--danger);
  border: 1px solid rgba(226, 96, 127, 0.4);
}

.btn--small {
  padding: 6px 12px;
  font-size: 13px;
}

.btn--tutorial {
  display: inline-block;
  padding: 8px 16px;
  font-size: 13px;
  background: var(--card);
  color: var(--text);
  border: 1px solid var(--line);
}

.link-btn {
  background: none;
  border: none;
  color: var(--accent);
  font: inherit;
  font-weight: 600;
  cursor: pointer;
  padding: 10px 0 0;
  text-align: left;
}

/* ---- Search bar ---- */
.search-bar {
  display: flex;
  gap: 10px;
  margin-bottom: 14px;
}

html.mobile .search-bar {
  flex-wrap: wrap;
}

.search-bar__input {
  flex: 1;
  font: inherit;
  padding: 11px 16px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: var(--card);
  color: var(--text);
}

/* Fires an animation the moment a browser autofills the field so JS can clear it. */
@keyframes onSearchAutofill {
  from {
    /* no-op */
  }
  to {
    /* no-op */
  }
}

.search-bar__input:-webkit-autofill {
  animation-name: onSearchAutofill;
}

.search-results {
  display: none;
  flex-direction: column;
  gap: 8px;
  background: var(--card-strong);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 10px;
  margin-bottom: 18px;
  max-height: 320px;
  overflow-y: auto;
}

.search-results.open {
  display: flex;
}

.search-result {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px;
  border-radius: 10px;
  cursor: pointer;
}

.search-result:hover {
  background: rgba(61, 134, 216, 0.1);
}

.search-result img {
  width: 40px;
  height: 60px;
  object-fit: cover;
  border-radius: 6px;
  background: var(--line);
}

.search-result__title {
  font-weight: 600;
}

.search-result__year {
  color: var(--muted);
  font-size: 13px;
}

.search-result__type {
  display: inline-block;
  margin-left: 6px;
  padding: 1px 6px;
  border-radius: 999px;
  background: var(--line);
  color: var(--muted);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.04em;
  vertical-align: middle;
}

/* ---- Genre categories ---- */
.category {
  margin-bottom: 24px;
}

.category__title {
  font-size: 15px;
  font-weight: 700;
  margin: 0 0 10px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--line);
}

.empty-state {
  color: var(--muted);
  text-align: center;
  padding: 30px 10px;
}

/* ---- Movie grid / cards ---- */
.movie-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
  gap: 12px;
}

.movie-card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  backdrop-filter: blur(10px);
  transition: transform 0.12s ease;
}

.movie-card:hover {
  transform: translateY(-2px);
}

.movie-card--watched {
  border-color: #3c8f4c;
  box-shadow: 0 0 0 2px rgba(60, 143, 76, 0.55);
}

.movie-card__watched-badge {
  position: absolute;
  top: 6px;
  left: 6px;
  width: 18px;
  height: 18px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
  background: rgba(60, 143, 76, 0.9);
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.35);
}

.movie-card__poster-wrap {
  position: relative;
}

.movie-card__type-badge {
  position: absolute;
  bottom: 6px;
  left: 6px;
  padding: 2px 7px;
  border-radius: 999px;
  background: rgba(30, 41, 59, 0.82);
  color: #fff;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.03em;
  backdrop-filter: blur(4px);
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.35);
}

.movie-card__rt-badge {
  position: absolute;
  top: 6px;
  right: 6px;
  display: inline-flex;
  align-items: center;
  gap: 3px;
  padding: 2px 6px;
  border-radius: 999px;
  font-size: 10px;
  font-weight: 700;
  color: #fff;
  line-height: 1.4;
  backdrop-filter: blur(4px);
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.35);
}

.movie-card__rt-badge--fresh {
  background: rgba(216, 32, 24, 0.88);
}

.movie-card__rt-badge--rotten {
  background: rgba(92, 74, 46, 0.9);
}

.movie-card__poster {
  width: 100%;
  aspect-ratio: 2 / 3;
  object-fit: cover;
  background: linear-gradient(160deg, #cfe3f5, #e8f4fc);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--muted);
  font-size: 13px;
  text-align: center;
}

.movie-card__body {
  padding: 6px 8px 8px;
}

.movie-card__title {
  font-weight: 700;
  font-size: 12px;
  margin: 0 0 2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.movie-card__year {
  color: var(--muted);
  font-size: 11px;
  margin: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* ---- Search-by mode selector ---- */
.search-bar__mode {
  font: inherit;
  padding: 11px 12px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: var(--card);
  color: var(--text);
  cursor: pointer;
}

html.dark .search-bar__mode {
  background: var(--card-strong);
}

/* ---- Matched-person header in search results ---- */
.search-person {
  display: flex;
  align-items: baseline;
  gap: 10px;
  padding: 4px 8px 8px;
  border-bottom: 1px solid var(--line);
  margin-bottom: 4px;
}

.search-person__name {
  font-weight: 700;
}

.search-person__role {
  color: var(--muted);
  font-size: 12px;
}

/* ---- View switcher (Genres / Priority / Watched) ---- */
.view-switch {
  display: inline-flex;
  gap: 2px;
  padding: 3px;
  margin-bottom: 18px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 12px;
}

.view-switch__btn {
  font: inherit;
  font-weight: 600;
  font-size: 13px;
  border: none;
  background: transparent;
  color: var(--muted);
  padding: 7px 16px;
  border-radius: 9px;
  cursor: pointer;
  transition: background 0.12s ease, color 0.12s ease;
}

.view-switch__btn:hover {
  color: var(--text);
}

.view-switch__btn--active {
  background: var(--accent);
  color: #fff;
}

.view-switch__custom {
  display: contents;
}

.view-switch__add {
  font: inherit;
  font-weight: 700;
  font-size: 16px;
  line-height: 1;
  border: 1px dashed var(--line);
  background: transparent;
  color: var(--muted);
  padding: 0 11px;
  margin-left: 2px;
  border-radius: 9px;
  cursor: pointer;
  transition: color 0.12s ease, border-color 0.12s ease;
}

.view-switch__add:hover {
  color: var(--accent);
  border-color: var(--accent);
}

/* ---- Custom tab view ---- */
.custom-tab-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 8px 12px;
  margin-bottom: 12px;
}

.custom-tab-toolbar .list-hint {
  margin: 0;
}

.custom-tab-toolbar__actions {
  display: flex;
  gap: 6px;
}

/* ---- Priority / watched line lists ---- */
.list-hint {
  color: var(--muted);
  font-size: 13px;
  margin: 0 0 10px;
}

.discover-toolbar {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 16px;
}

.discover-toolbar__modes {
  margin-bottom: 0;
}

.discover-status {
  flex: 1;
  color: var(--muted);
  font-size: 13px;
}

.discover-genre__count {
  margin-left: 6px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 500;
}

.discover-row {
  display: flex;
  gap: 12px;
  overflow-x: auto;
  padding-bottom: 8px;
  scroll-snap-type: x proximity;
}

.discover-row .movie-card {
  flex: 0 0 130px;
  scroll-snap-align: start;
}

.discover-more {
  flex: 0 0 100px;
  border: 1px dashed var(--line);
  border-radius: var(--radius);
  background: transparent;
  color: var(--accent-2);
  font-weight: 600;
  cursor: pointer;
}

.discover-more:hover:not(:disabled) {
  background: var(--card);
}

.discover-more:disabled {
  cursor: progress;
  opacity: 0.7;
}

.discover-controls[hidden] {
  display: none;
}

.discover-filters {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 10px;
  margin: -6px 0 16px;
}

.discover-filter {
  display: flex;
  flex-direction: column;
  gap: 3px;
  font-size: 11px;
  font-weight: 600;
  color: var(--muted);
}

.discover-filter__select {
  font: inherit;
  font-size: 13px;
  font-weight: 500;
  padding: 6px 8px;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: var(--card);
  color: var(--text);
  cursor: pointer;
}

html.dark .discover-filter__select {
  background: var(--card-strong);
}

.discover-filters__note {
  margin: -8px 0 16px;
  color: var(--muted);
  font-size: 12px;
}

.line-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.line-item {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  padding: 8px 12px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 12px;
  cursor: pointer;
  backdrop-filter: blur(10px);
  transition: transform 0.1s ease, border-color 0.12s ease, box-shadow 0.12s ease;
}

.line-item:hover {
  transform: translateY(-1px);
  border-color: var(--accent);
}

.line-item--draggable {
  cursor: grab;
}

.line-item.dragging {
  opacity: 0.5;
  cursor: grabbing;
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.25);
}

.line-item__handle {
  color: var(--muted);
  font-size: 18px;
  line-height: 1;
  letter-spacing: -2px;
  cursor: grab;
  user-select: none;
}

.line-item__rank {
  min-width: 22px;
  text-align: center;
  font-weight: 700;
  font-size: 13px;
  color: var(--accent);
}

.line-item__thumb {
  width: 34px;
  height: 51px;
  object-fit: cover;
  border-radius: 6px;
  background: linear-gradient(160deg, #cfe3f5, #e8f4fc);
  flex-shrink: 0;
}

.line-item__thumb--empty {
  border: 1px dashed var(--line);
}

.line-item__main {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
  flex: 1 1 140px;
}

.line-item__title {
  font-weight: 700;
  font-size: 14px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.line-item__sub {
  color: var(--muted);
  font-size: 12px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.line-item__rt {
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  gap: 3px;
  padding: 2px 7px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 700;
  color: #fff;
}

.line-item__rt.is-fresh {
  background: rgba(216, 32, 24, 0.88);
}

.line-item__rt.is-rotten {
  background: rgba(92, 74, 46, 0.9);
}

.line-item__meta {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-left: auto;
  flex-shrink: 0;
}

.line-item__stars {
  flex-shrink: 0;
  color: #f4b41a;
  font-size: 14px;
  letter-spacing: 1px;
}

.line-item__date {
  flex-shrink: 0;
  color: var(--muted);
  font-size: 12px;
  font-variant-numeric: tabular-nums;
}

/* ---- Star rating input (detail modal) ---- */
.star-input {
  display: flex;
  gap: 4px;
  font-size: 24px;
  cursor: pointer;
  color: var(--line);
}

.star-input .star--filled {
  color: #f0b429;
}

/* ---- Forms ---- */
.field {
  display: block;
  margin-bottom: 14px;
}

.field > span {
  display: block;
  font-size: 13px;
  font-weight: 600;
  color: var(--muted);
  margin-bottom: 5px;
}

.field small {
  font-weight: 400;
  color: var(--muted);
}

.field input[type="text"],
.field input[type="number"],
.field input[type="date"],
.field input[type="password"],
.field select,
.field textarea {
  width: 100%;
  font: inherit;
  padding: 9px 12px;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: #fff;
  color: var(--text);
}

.field textarea {
  resize: vertical;
}

.field__input-row {
  display: flex;
  gap: 8px;
}

.field__input-row input {
  flex: 1;
  min-width: 0;
}

.key-test-status {
  margin: 6px 0 0;
  font-size: 12px;
  font-weight: 600;
}

.key-test-status--pending {
  color: var(--muted);
}

.key-test-status--ok {
  color: #2e9e5b;
}

.key-test-status--error {
  color: var(--danger);
}

/* ---- Modals ---- */
.modal {
  position: fixed;
  inset: 0;
  background: rgba(30, 55, 90, 0.45);
  display: none;
  align-items: center;
  justify-content: center;
  padding: 20px;
  overflow-y: auto;
  overscroll-behavior: contain;
  backdrop-filter: blur(4px);
  -webkit-overflow-scrolling: touch;
  z-index: 50;
}

.modal.open {
  display: flex;
}

.modal__card {
  background: #ffffff;
  border: 1px solid rgba(255, 255, 255, 0.8);
  border-radius: var(--radius);
  padding: 26px;
  width: 100%;
  max-width: 380px;
  max-height: calc(100dvh - 40px);
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  box-shadow: 0 24px 60px rgba(40, 70, 110, 0.35);
}

.modal__card--wide {
  max-width: 640px;
}

.modal__card h3 {
  margin: 0 0 18px;
  font-size: 20px;
}

.modal__actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-top: 18px;
}

.modal__actions-right {
  display: flex;
  gap: 10px;
}

.settings-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 0;
  border-bottom: 1px solid var(--line);
}

.settings-row__actions {
  display: flex;
  gap: 8px;
}

/* ---- Encrypted cloud sync ---- */
.cloud-sync {
  padding: 12px 0;
  border-bottom: 1px solid var(--line);
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.cloud-sync__head {
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.cloud-sync__title {
  font-weight: 700;
  font-size: 14px;
}

.cloud-sync__desc {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.45;
}

.cloud-sync__actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.cloud-sync__actions .btn {
  flex: 1 1 150px;
}

.cloud-data-field {
  display: block;
}

.cloud-data-field__label {
  display: block;
  margin-bottom: 6px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.cloud-data-field__input {
  width: 100%;
  min-height: 40px;
  padding: 9px 11px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--card-strong);
  color: var(--text);
  font: inherit;
  font-size: 14px;
}

.cloud-data-field__input::placeholder {
  color: color-mix(in srgb, var(--muted) 78%, transparent);
}

.cloud-data-field__input:focus {
  outline: 2px solid color-mix(in srgb, var(--accent) 70%, transparent);
  outline-offset: 2px;
}

.cloud-phrase-entry {
  display: flex;
  align-items: stretch;
  gap: 8px;
}

.cloud-phrase-entry .cloud-data-field__input {
  min-width: 0;
  flex: 1;
}

.cloud-phrase-entry__toggle {
  min-width: 64px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--card-strong);
  color: var(--text);
  cursor: pointer;
  font: inherit;
  font-size: 13px;
  font-weight: 700;
}

.cloud-phrase-entry__toggle:hover {
  border-color: var(--accent);
}

.cloud-phrase-output {
  margin: 0;
  padding: 10px 12px;
  border: 1px dashed color-mix(in srgb, var(--accent) 50%, var(--line));
  border-radius: 8px;
  background: var(--card);
  color: var(--text);
  font-size: 14px;
  font-weight: 700;
  line-height: 1.45;
  overflow-wrap: anywhere;
}

.cloud-remember-option {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--muted);
  cursor: pointer;
  font-size: 13px;
  font-weight: 600;
}

.cloud-remember-option input {
  width: 16px;
  height: 16px;
  accent-color: var(--accent);
}

.cloud-data-status {
  min-height: 16px;
  margin: 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.4;
}

.cloud-data-status[data-state="success"] {
  color: #2f9f6f;
}

.cloud-data-status[data-state="warn"] {
  color: #b5892a;
}

.cloud-data-status[data-state="error"] {
  color: var(--danger);
}

.theme-picker {
  display: flex;
  gap: 6px;
}

.theme-chip {
  font: inherit;
  font-size: 12px;
  font-weight: 600;
  border: 1px solid var(--line);
  background: #fff;
  color: var(--muted);
  border-radius: 999px;
  padding: 5px 10px;
  cursor: pointer;
}

.theme-chip--active {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
}

.about-modal__card {
  text-align: center;
}

.about-modal__mark {
  border-radius: 18px;
  margin-bottom: 10px;
}

.about-modal__version,
.about-modal__copy {
  color: var(--muted);
  margin: 2px 0;
}

/* ---- Detail modal ---- */
.detail {
  display: flex;
  gap: 18px;
}

html.mobile .detail {
  flex-direction: column;
}

.detail__poster {
  width: 160px;
  flex-shrink: 0;
  border-radius: 10px;
  object-fit: cover;
  background: linear-gradient(160deg, #cfe3f5, #e8f4fc);
}

.detail__body {
  flex: 1;
  min-width: 0;
}

.detail__meta {
  color: var(--muted);
  font-size: 13px;
  margin: 0 0 10px;
}

.detail__overview {
  font-size: 14px;
  line-height: 1.5;
  margin: 0 0 14px;
}

.detail__ratings {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 14px;
}

.rating-chip {
  background: rgba(61, 134, 216, 0.12);
  color: var(--accent-2);
  border-radius: 999px;
  padding: 2px 8px;
  font-size: 11px;
  font-weight: 600;
  white-space: nowrap;
}

.rating-chip--link {
  text-decoration: none;
  cursor: pointer;
}

.rating-chip--link:hover,
.rating-chip--link:focus-visible {
  background: rgba(61, 134, 216, 0.24);
  text-decoration: underline;
}

.watch-providers {
  margin-bottom: 14px;
}

.watch-providers__empty {
  color: var(--muted);
  font-size: 13px;
  margin: 0;
}

.watch-providers__group {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 6px;
}

.watch-providers__label {
  font-size: 12px;
  font-weight: 700;
  color: var(--muted);
  width: 48px;
  flex-shrink: 0;
}

.watch-providers__list {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.watch-provider {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  background: rgba(61, 134, 216, 0.1);
  border-radius: 999px;
  padding: 3px 10px 3px 4px;
  font-size: 12px;
  font-weight: 600;
}

.watch-provider img {
  width: 18px;
  height: 18px;
  border-radius: 4px;
}

.watch-providers__link {
  display: inline-block;
  margin-top: 4px;
  font-size: 12px;
  color: var(--accent-2);
}

.detail__reviews {
  margin-top: 10px;
}

.review {
  border-top: 1px solid var(--line);
  padding: 10px 0;
  font-size: 13px;
}

.review__author {
  font-weight: 700;
  margin-bottom: 3px;
}

.review__content {
  color: var(--muted);
  max-height: 100px;
  overflow-y: auto;
}

/* Sky + drifting cirrus clouds background */
.sky {
  position: fixed;
  inset: 0;
  z-index: -1;
  overflow: hidden;
  pointer-events: none;
}

.cloud {
  position: absolute;
}

.cloud__wisp {
  position: absolute;
  border-radius: 50%;
  /* Thin, feathery filament that fades to nothing at both ends */
  background: linear-gradient(90deg, rgba(255, 255, 255, 0) 0%, rgba(255, 255, 255, 0.45) 22%, rgba(255, 255, 255, 0.92) 50%, rgba(255, 255, 255, 0.45) 78%, rgba(255, 255, 255, 0) 100%);
  filter: blur(3px);
  transform-origin: left center;
}

/* All filaments swept the SAME direction so the cloud reads as parallel
   high-altitude streaks (mare's tails) rather than a crosshatched "X". */
.cloud__wisp--1 {
  width: 100%;
  height: 4.5%;
  top: 8%;
  left: 0;
  transform: rotate(-13deg);
  opacity: 0.85;
}

.cloud__wisp--2 {
  width: 90%;
  height: 4%;
  top: 22%;
  left: 6%;
  transform: rotate(-15deg);
  opacity: 0.72;
}

.cloud__wisp--3 {
  width: 80%;
  height: 3.6%;
  top: 35%;
  left: 11%;
  transform: rotate(-12deg);
  opacity: 0.6;
}

.cloud__wisp--4 {
  width: 68%;
  height: 3.2%;
  top: 49%;
  left: 17%;
  transform: rotate(-16deg);
  opacity: 0.48;
}

.cloud__wisp--5 {
  width: 56%;
  height: 2.8%;
  top: 62%;
  left: 24%;
  transform: rotate(-13deg);
  opacity: 0.37;
}

.cloud__wisp--6 {
  width: 42%;
  height: 2.4%;
  top: 75%;
  left: 31%;
  transform: rotate(-15deg);
  opacity: 0.27;
}

.cloud--1 {
  width: 560px;
  height: 130px;
  top: 6%;
  left: -620px;
  animation: drift 135s linear infinite;
}

.cloud--2 {
  width: 460px;
  height: 110px;
  top: 20%;
  left: -500px;
  opacity: 0.85;
  animation: drift 175s linear infinite;
  animation-delay: -44s;
}

.cloud--3 {
  width: 640px;
  height: 150px;
  top: 34%;
  left: -700px;
  animation: drift 210s linear infinite;
  animation-delay: -112s;
}

.cloud--4 {
  width: 480px;
  height: 115px;
  top: 46%;
  left: -540px;
  opacity: 0.88;
  animation: drift 155s linear infinite;
  animation-delay: -80s;
}

.cloud--5 {
  width: 600px;
  height: 140px;
  top: 58%;
  left: -660px;
  opacity: 0.8;
  animation: drift 190s linear infinite;
  animation-delay: -20s;
}

.cloud--6 {
  width: 420px;
  height: 100px;
  top: 16%;
  left: -460px;
  opacity: 0.7;
  animation: drift 160s linear infinite;
  animation-delay: -130s;
}

.cloud--7 {
  width: 520px;
  height: 120px;
  top: 40%;
  left: -580px;
  opacity: 0.75;
  animation: drift 225s linear infinite;
  animation-delay: -60s;
}

.cloud--8 {
  width: 500px;
  height: 118px;
  top: 10%;
  left: -560px;
  opacity: 0.78;
  animation: drift 200s linear infinite;
  animation-delay: -150s;
}

.cloud--9 {
  width: 580px;
  height: 134px;
  top: 26%;
  left: -640px;
  opacity: 0.72;
  animation: drift 170s linear infinite;
  animation-delay: -95s;
}

.cloud--10 {
  width: 440px;
  height: 104px;
  top: 52%;
  left: -500px;
  opacity: 0.68;
  animation: drift 185s linear infinite;
  animation-delay: -40s;
}

.cloud--11 {
  width: 540px;
  height: 126px;
  top: 4%;
  left: -600px;
  opacity: 0.74;
  animation: drift 165s linear infinite;
  animation-delay: -70s;
}

.cloud--12 {
  width: 480px;
  height: 112px;
  top: 14%;
  left: -540px;
  opacity: 0.7;
  animation: drift 205s linear infinite;
  animation-delay: -18s;
}

.cloud--13 {
  width: 620px;
  height: 144px;
  top: 24%;
  left: -680px;
  opacity: 0.76;
  animation: drift 230s linear infinite;
  animation-delay: -125s;
}

.cloud--14 {
  width: 460px;
  height: 108px;
  top: 32%;
  left: -520px;
  opacity: 0.66;
  animation: drift 150s linear infinite;
  animation-delay: -55s;
}

.cloud--15 {
  width: 580px;
  height: 134px;
  top: 44%;
  left: -640px;
  opacity: 0.72;
  animation: drift 195s linear infinite;
  animation-delay: -102s;
}

.cloud--16 {
  width: 500px;
  height: 118px;
  top: 50%;
  left: -560px;
  opacity: 0.69;
  animation: drift 215s linear infinite;
  animation-delay: -32s;
}

.cloud--17 {
  width: 540px;
  height: 124px;
  top: 62%;
  left: -600px;
  opacity: 0.64;
  animation: drift 178s linear infinite;
  animation-delay: -88s;
}

.cloud--18 {
  width: 420px;
  height: 100px;
  top: 10%;
  left: -480px;
  opacity: 0.6;
  animation: drift 240s linear infinite;
  animation-delay: -145s;
}

@keyframes drift {
  from {
    transform: translateX(0);
  }
  to {
    transform: translateX(calc(100vw + 600px));
  }
}

@media (prefers-reduced-motion: reduce) {
  .cloud {
    animation: none !important;
  }
}

/* Lake backed by rolling grassy hills, shoreline houses, and a foreground bank */
.lake-layer {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 40vh;
  min-height: 240px;
  max-height: 400px;
}

.lake-svg {
  width: 100%;
  height: 100%;
  display: block;
}

.lake-haze {
  fill: #eef4f2;
  opacity: 0.6;
}

html.twilight .lake-haze {
  fill: #ecd3c3;
  opacity: 0.5;
}

html.dark .lake-haze {
  fill: #1c2740;
  opacity: 0.4;
}

.hill--far {
  fill: #83b07d;
  opacity: 0.9;
}

.hill--mid {
  fill: #5f9d5a;
}

.hill--near {
  fill: url(#hillKnollGrad);
}

html.twilight .hill--far {
  fill: #9a9a86;
  opacity: 0.85;
}

html.twilight .hill--mid {
  fill: #6f7558;
}

html.dark .hill--far {
  fill: #1e2f22;
}

html.dark .hill--mid {
  fill: #16241a;
}

html.dark .hill--near {
  fill: url(#hillKnollNightGrad);
}

.hill-knoll-highlight {
  fill: none;
  stroke: #a3c9a8;
  stroke-width: 3;
  stroke-linecap: round;
  opacity: 0.55;
}

html.dark .hill-knoll-highlight {
  stroke: #5f8a63;
  opacity: 0.4;
}

.lh-white {
  fill: #f6f8fb;
}

.lh-red {
  fill: #c92a2a;
}

.lh-dark {
  fill: #1e293b;
}

.lh-base {
  fill: #3a4652;
}

.lh-lantern {
  fill: #fffbe8;
}

.lh-frame {
  fill: none;
  stroke: #1e293b;
  stroke-width: 1.5;
}

.lh-beacon {
  animation: beaconPulse 4.5s ease-in-out infinite;
}

@keyframes beaconPulse {
  0%, 100% { opacity: 0.7; }
  50% { opacity: 1; }
}

@media (prefers-reduced-motion: reduce) {
  .lh-beacon {
    animation: none;
  }
}

.hill-contour path {
  fill: none;
  stroke: #8fca85;
  stroke-width: 1.4;
  stroke-linecap: round;
  opacity: 0.45;
}

html.twilight .hill-contour path {
  stroke: #b7b089;
  opacity: 0.4;
}

html.dark .hill-contour path {
  stroke: #2b4a2f;
  opacity: 0.5;
}

/* Distant stone windmills along the far shoreline */
.windmills {
  opacity: 0.9;
}

.windmill__tower {
  fill: #8a9298;
}

.windmill__cap {
  fill: #2f3a44;
}

.windmill__lattice {
  stroke: #efe0bf;
}

.windmill__hub {
  fill: #3a4652;
}

.windmill__sails {
  transform-box: fill-box;
  transform-origin: center;
  animation: windmillSpin 20s linear infinite;
}

.windmill:nth-child(2) .windmill__sails {
  animation-duration: 26s;
}

.windmill:nth-child(3) .windmill__sails {
  animation-duration: 17s;
}

.windmill:nth-child(4) .windmill__sails {
  animation-duration: 30s;
}

@keyframes windmillSpin {
  to {
    transform: rotate(360deg);
  }
}

html.twilight .windmill__tower {
  fill: #8f8678;
}

html.twilight .windmill__cap {
  fill: #2e2a3e;
}

html.twilight .windmill__lattice {
  stroke: #cdb08c;
}

html.dark .windmills {
  opacity: 0.8;
}

html.dark .windmill__tower {
  fill: #24323f;
}

html.dark .windmill__cap {
  fill: #101a28;
}

html.dark .windmill__lattice {
  stroke: #4a5a6a;
}

html.dark .windmill__hub {
  fill: #101a28;
}

@media (prefers-reduced-motion: reduce) {
  .windmill__sails {
    animation: none;
  }
}

.lake-water {
  fill: url(#lakeDayGrad);
}

html.twilight .lake-water {
  fill: url(#lakeTwilightGrad);
}

html.dark .lake-water {
  fill: url(#lakeNightGrad);
}

/* Starfield: two tiled layers of dots, hidden until dark mode is on */
.stars-layer {
  position: absolute;
  inset: -20% -20%;
  opacity: 0;
  transition: opacity 0.8s ease;
}

.stars {
  position: absolute;
  inset: 0;
  background-repeat: repeat;
}

.stars--sm {
  background-image: radial-gradient(1.5px 1.5px at 20px 30px, #fff, transparent),
    radial-gradient(1.5px 1.5px at 90px 120px, #fff, transparent),
    radial-gradient(1px 1px at 150px 60px, #fff, transparent),
    radial-gradient(1px 1px at 210px 160px, #fff, transparent);
  background-size: 260px 220px;
  opacity: 0.8;
}

.stars--lg {
  background-image: radial-gradient(2px 2px at 60px 80px, #fff, transparent),
    radial-gradient(2px 2px at 180px 40px, #fff, transparent),
    radial-gradient(2px 2px at 240px 180px, #fff, transparent);
  background-size: 300px 260px;
  opacity: 0.6;
}

/* ---- Twilight theme ---- */
html.twilight body {
  background: linear-gradient(180deg, #4a4f8f 0%, #a2628f 55%, #e6a26b 100%);
}

html.twilight .stars-layer {
  opacity: 0.35;
}

html.twilight .cloud__wisp {
  background: linear-gradient(90deg, rgba(255, 214, 200, 0) 0%, rgba(255, 214, 200, 0.85) 45%, rgba(255, 214, 200, 0.85) 55%, rgba(255, 214, 200, 0) 100%);
}

html.twilight .modal__card {
  background: #2a2a46;
  color: #f1f1fb;
}

/* ---- Night / dark theme ---- */
html.dark body {
  background: linear-gradient(180deg, #0b1230 0%, #16254a 55%, #1f3660 100%);
  color: #dfe8f5;
}

html.dark .stars-layer {
  opacity: 1;
}

html.dark .cloud__wisp {
  background: linear-gradient(90deg, rgba(210, 222, 240, 0) 0%, rgba(210, 222, 240, 0.5) 45%, rgba(210, 222, 240, 0.5) 55%, rgba(210, 222, 240, 0) 100%);
}

html.dark {
  --text: #dfe8f5;
  --muted: #92a6c4;
  --card: rgba(22, 32, 58, 0.66);
  --card-strong: rgba(22, 32, 58, 0.86);
  --line: rgba(146, 166, 196, 0.22);
}

html.dark .modal__card {
  background: #121a33;
  color: #dfe8f5;
}

html.dark .field input,
html.dark .field select,
html.dark .field textarea,
html.dark .theme-chip,
html.dark .search-bar__input {
  background: #0f182e;
  color: #dfe8f5;
  border-color: var(--line);
}

html.dark .movie-card__poster {
  background: linear-gradient(160deg, #1b2a4a, #10182c);
}

@media (max-width: 720px) {
  .app__header {
    flex-direction: column;
  }

  .search-bar {
    flex-wrap: wrap;
  }

  .movie-grid {
    grid-template-columns: repeat(auto-fill, minmax(110px, 1fr));
  }

  .detail {
    flex-direction: column;
  }

  .detail__poster {
    width: 120px;
  }

  .view-switch {
    max-width: 100%;
    overflow-x: auto;
  }

  .view-switch__btn {
    padding: 7px 7px;
    font-size: 12px;
    white-space: nowrap;
  }
}
