:root {
  color-scheme: dark;
  --bg: #0b1020;
  --bg-soft: rgba(12, 18, 38, 0.7);
  --panel: rgba(15, 23, 45, 0.82);
  --panel-border: rgba(148, 163, 184, 0.18);
  --text: #f4f7fb;
  --muted: #aab6cf;
  --accent: #ffb703;
  --accent-2: #7dd3fc;
  --danger: #fb7185;
  --shadow: 0 24px 80px rgba(0, 0, 0, 0.35);
  font-family: "Inter", "Zen Kaku Gothic New", "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--text);
  background:
    radial-gradient(circle at top left, rgba(255, 183, 3, 0.22), transparent 26%),
    radial-gradient(circle at 85% 15%, rgba(125, 211, 252, 0.18), transparent 24%),
    linear-gradient(180deg, #060816 0%, #0b1020 48%, #0f172a 100%);
}

button,
input,
select,
textarea {
  font: inherit;
}

button {
  cursor: pointer;
}

.backdrop {
  position: fixed;
  inset: 0;
  pointer-events: none;
  background-image: linear-gradient(rgba(255, 255, 255, 0.02) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.02) 1px, transparent 1px);
  background-size: 48px 48px;
  mask-image: linear-gradient(180deg, rgba(0, 0, 0, 0.9), transparent 90%);
}

.app-shell {
  width: min(1120px, calc(100vw - 32px));
  margin: 0 auto;
  padding: 36px 0 36px;
}

.hero {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 20px;
  align-items: end;
  margin-bottom: 22px;
}

.eyebrow {
  margin: 0 0 10px;
  color: var(--accent);
  letter-spacing: 0.24em;
  text-transform: uppercase;
  font-size: 0.78rem;
  font-weight: 700;
}

h1,
h2,
h3 {
  margin: 0;
  font-family: "Zen Kaku Gothic New", "Inter", "Segoe UI", sans-serif;
}

h1 {
  font-family: "Zen Kaku Gothic New", "Inter", "Segoe UI", sans-serif;
  font-size: clamp(2.8rem, 5vw, 5rem);
  line-height: 1;
  letter-spacing: 0.08em;
}

.lead {
  margin: 16px 0 0;
  max-width: 60ch;
  color: var(--muted);
  line-height: 1.8;
}

.hero-card,
.panel,
.watch-form {
  border: 1px solid var(--panel-border);
  background: var(--panel);
  backdrop-filter: blur(18px);
  box-shadow: var(--shadow);
}

.hero-card {
  display: grid;
  gap: 14px;
  min-width: 260px;
  padding: 18px;
  border-radius: 24px;
}

.hero-card div {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 24px;
}

.hero-card span,
.panel-header p,
.sort-note,
.composer-copy p,
.watch-title,
.movie-meta,
.movie-note,
.movie-empty {
  color: var(--muted);
}

.hero-card strong {
  font-size: 1.6rem;
}

.tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 16px;
}

.tab-button,
.primary-button,
.secondary-button,
.ghost-button {
  border: 1px solid transparent;
  border-radius: 999px;
  padding: 0.88rem 1.2rem;
  transition: transform 160ms ease, background-color 160ms ease, border-color 160ms ease, color 160ms ease;
}

.tab-button {
  background: rgba(148, 163, 184, 0.12);
  color: var(--text);
}

.tab-button.is-active {
  background: linear-gradient(135deg, rgba(255, 183, 3, 0.18), rgba(125, 211, 252, 0.15));
  border-color: rgba(255, 183, 3, 0.4);
}

.primary-button {
  background: linear-gradient(135deg, #ffb703, #fb8500);
  color: #111827;
  font-weight: 700;
}

.secondary-button,
.ghost-button {
  background: rgba(148, 163, 184, 0.12);
  color: var(--text);
  border-color: rgba(148, 163, 184, 0.15);
}

.tab-button:hover,
.primary-button:hover,
.secondary-button:hover,
.ghost-button:hover {
  transform: translateY(-1px);
}

.panel {
  display: none;
  padding: 20px;
  border-radius: 28px;
  margin-bottom: 16px;
}

.panel.is-active {
  display: block;
}

.panel-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  margin-bottom: 16px;
}

.panel-header h2 {
  font-size: 1.55rem;
}

.panel-header p {
  margin: 8px 0 0;
  line-height: 1.7;
}

.panel-header.compact {
  align-items: end;
}

.filter-chip {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  border-radius: 999px;
  border: 1px solid rgba(148, 163, 184, 0.18);
  background: rgba(15, 23, 42, 0.56);
}

.filter-chip span {
  color: var(--muted);
  font-size: 0.9rem;
}

.filter-chip select {
  color: var(--text);
  background: rgba(15, 23, 42, 0.95);
  border: 1px solid rgba(148, 163, 184, 0.22);
  border-radius: 999px;
  padding: 0.35rem 0.75rem;
  outline: 0;
}

.filter-chip select option {
  color: #f8fafc;
  background: #0f172a;
}

.movie-list,
.ranking-list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: grid;
  gap: 12px;
}

.movie-card {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  gap: 14px;
  align-items: start;
  border-radius: 20px;
  padding: 14px 16px;
  border: 1px solid rgba(148, 163, 184, 0.14);
  background: rgba(2, 6, 23, 0.24);
}

.movie-card.is-dragging {
  opacity: 0.5;
}

.movie-card.is-drop-target {
  outline: 2px solid rgba(255, 183, 3, 0.7);
  outline-offset: 2px;
}

.drag-handle {
  width: 38px;
  height: 38px;
  border: 1px solid rgba(148, 163, 184, 0.18);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.04);
  color: var(--muted);
  display: grid;
  place-items: center;
  font-size: 1.2rem;
}

.movie-main {
  min-width: 0;
}

.movie-title {
  margin: 0;
  font-size: 1.05rem;
  line-height: 1.5;
}

.movie-meta {
  margin-top: 6px;
  font-size: 0.92rem;
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
}

.movie-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: flex-end;
  align-items: flex-start;
}

.icon-button {
  border: 1px solid rgba(148, 163, 184, 0.18);
  border-radius: 999px;
  background: rgba(15, 23, 42, 0.4);
  color: var(--text);
  padding: 0.72rem 0.95rem;
}

.icon-button:disabled {
  cursor: not-allowed;
  color: rgba(170, 182, 207, 0.6);
  border-color: rgba(148, 163, 184, 0.1);
  background: rgba(100, 116, 139, 0.2);
}

.icon-button.danger {
  color: #fecdd3;
  border-color: rgba(251, 113, 133, 0.3);
}

.action-menu-wrap {
  position: relative;
  display: inline-flex;
  flex-direction: row;
  align-items: stretch;
  gap: 8px;
}

.action-toggle {
  width: 40px;
  padding-left: 0;
  padding-right: 0;
}

.action-menu {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  z-index: 3;
  display: none;
  min-width: 200px;
  padding: 8px;
  border-radius: 18px;
  border: 1px solid rgba(148, 163, 184, 0.18);
  background: rgba(8, 12, 28, 0.98);
  box-shadow: 0 18px 40px rgba(0, 0, 0, 0.35);
}

.action-menu-wrap.is-open .action-menu {
  display: grid;
  gap: 6px;
}

.action-menu-item {
  border: 0;
  border-radius: 14px;
  padding: 0.78rem 0.92rem;
  background: rgba(148, 163, 184, 0.1);
  color: var(--text);
  text-align: left;
}

.action-menu-item.danger {
  color: #ffe4e6;
  border: 1px solid rgba(251, 113, 133, 0.45);
  background: rgba(190, 24, 93, 0.28);
}

.movie-notes-panel {
  display: grid;
  gap: 10px;
  padding: 14px 16px 4px;
  border-top: 1px solid rgba(148, 163, 184, 0.12);
}

.movie-notes-panel[hidden] {
  display: none;
}

.movie-note {
  margin: 0;
  line-height: 1.8;
  white-space: pre-wrap;
}

.ranking-card {
  position: relative;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  gap: 16px;
  align-items: center;
  border-radius: 22px;
  padding: 16px;
  border: 1px solid rgba(148, 163, 184, 0.14);
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.05), rgba(255, 255, 255, 0.02));
}

.ranking-badge {
  width: 58px;
  max-width: 58px;
  min-width: 58px;
  height: 58px;
  border-radius: 18px;
  display: grid;
  place-items: center;
  font-size: 1.2rem;
  font-weight: 800;
  color: #111827;
  background: linear-gradient(135deg, #ffb703, #fde68a);
}

.ranking-score {
  font-size: 1.45rem;
  font-weight: 800;
}

.composer-inner {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1.4fr) auto;
  gap: 16px;
  align-items: end;
}

.composer-copy {
  align-self: start;
}

.composer-inline {
  margin-top: 20px;
  padding-top: 18px;
  border-top: 1px solid rgba(148, 163, 184, 0.14);
}

.composer-copy p,
.composer-title {
  margin: 0;
}

.composer-title {
  font-size: 1.25rem;
  font-weight: 700;
  margin-bottom: 8px;
}

.composer-field {
  display: grid;
  gap: 8px;
}

.composer-field span,
.watch-form label span {
  font-size: 0.92rem;
  color: var(--muted);
}

textarea,
input,
select {
  width: 100%;
  border-radius: 18px;
  border: 1px solid rgba(148, 163, 184, 0.18);
  background: rgba(15, 23, 42, 0.82);
  color: var(--text);
}

textarea,
input {
  padding: 0.9rem 1rem;
}

textarea {
  resize: vertical;
  min-height: 104px;
}

.composer-actions {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

textarea::placeholder {
  white-space: pre-line;
  color: rgba(170, 182, 207, 0.7);
}

.watch-notes {
  display: grid;
  gap: 10px;
  padding: 16px;
  border-radius: 20px;
  border: 1px solid rgba(148, 163, 184, 0.14);
  background: rgba(2, 6, 23, 0.18);
}

.watch-notes-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: baseline;
  color: var(--muted);
  font-size: 0.9rem;
}

.watch-notes textarea {
  min-height: 84px;
}

.watch-dialog {
  border: none;
  padding: 0;
  background: transparent;
}

.watch-dialog::backdrop {
  background: rgba(2, 6, 23, 0.72);
  backdrop-filter: blur(4px);
}

.watch-form {
  width: min(440px, calc(100vw - 32px));
  margin: auto;
  border-radius: 28px;
  padding: 22px;
  display: grid;
  gap: 14px;
}

.watch-form h3 {
  font-size: 1.5rem;
}

.watch-form label {
  display: grid;
  gap: 8px;
}

.watch-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin: 6px 0 0;
  padding: 0;
}

.watch-actions::part(*) {
  display: none;
}

.movie-empty {
  padding: 18px;
  border-radius: 18px;
  border: 1px dashed rgba(148, 163, 184, 0.25);
  background: rgba(15, 23, 42, 0.38);
}

@media (max-width: 920px) {
  html {
    font-size: 14px;
  }

  .hero,
  .composer-inner,
  .panel-header {
    grid-template-columns: 1fr;
  }

  .panel-header {
    display: grid;
    grid-template-columns: 1fr;
    align-items: start;
  }

  .movie-card {
    grid-template-columns: minmax(0, 1fr) auto;
  }

  #watchedList .movie-card {
    grid-template-columns: 1fr;
    gap: 10px;
  }

  #watchedList .movie-main {
    grid-column: 1;
  }

  #watchedList .movie-actions {
    grid-column: 1;
    justify-content: flex-start;
  }

  #wantedList .movie-card {
    grid-template-columns: 38px minmax(0, 1fr);
    align-items: start;
    gap: 10px;
  }

  #wantedList .movie-main {
    margin-top: 2px;
  }

  #wantedList .movie-meta {
    margin-top: 2px;
  }

  #wantedList .movie-actions {
    grid-column: 1 / -1;
    justify-content: flex-end;
  }

  .hero {
    align-items: start;
  }

  .hero-card {
    min-width: 0;
  }

  .movie-actions,
  .composer-actions {
    justify-content: flex-start;
    align-items: center;
  }

  .composer-actions {
    flex-direction: row;
    flex-wrap: nowrap;
  }

  .composer-actions .primary-button,
  .composer-actions .secondary-button,
  .movie-actions .icon-button,
  .action-menu-item {
    width: auto;
    min-width: 116px;
    max-width: 116px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  .action-toggle {
    min-width: 40px;
    max-width: 40px;
  }

  #watchedList .movie-actions > .icon-button {
    min-width: 72px !important;
    max-width: 72px !important;
    padding-left: 0.7rem;
    padding-right: 0.7rem;
  }

  #watchedList .movie-actions .action-toggle {
    min-width: 32px !important;
    max-width: 32px !important;
    padding-left: 0;
    padding-right: 0;
  }

  .movie-actions {
    flex-wrap: nowrap;
    gap: 6px;
  }

  .composer-actions .primary-button,
  .composer-actions .secondary-button {
    min-width: 0;
    max-width: none;
  }

  .action-menu {
    left: 0;
    right: auto;
    min-width: 220px;
    max-width: calc(100vw - 64px);
  }

  .action-menu-item {
    min-width: 0;
    max-width: none;
    white-space: normal;
    overflow: visible;
    text-overflow: clip;
  }

  .filter-chip {
    width: 100%;
    justify-content: space-between;
    display: flex;
  }

  .filter-chip select {
    flex: 1;
    min-width: 0;
  }

  .panel-header.compact {
    align-items: start;
  }

  .ranking-card {
    grid-template-columns: auto minmax(0, 1fr) auto;
    gap: 10px;
    align-items: center;
  }

  .ranking-badge {
    width: 44px;
    min-width: 44px;
    max-width: 44px;
    height: 44px;
    border-radius: 12px;
    font-size: 1rem;
    justify-self: start;
  }

  .ranking-score {
    font-size: 1.2rem;
  }
}
