:root {
  --ink: #0b0b0a;
  --ink-soft: #121210;
  --paper: #e9e6dc;
  --paper-muted: #a5a197;
  --paper-faint: #6c6962;
  --line: rgba(233, 230, 220, 0.16);
  --line-strong: rgba(233, 230, 220, 0.34);
  --acid: #d6ff3f;
  --acid-hover: #e3ff7d;
  --accent-rgb: 214, 255, 63;
  --error: #ff806f;
  --display: "Space Grotesk", sans-serif;
  --body: "IBM Plex Sans", sans-serif;
  --mono: "IBM Plex Mono", monospace;
}

html[data-theme="prestige"] {
  --acid: #72b8ff;
  --acid-hover: #a8d3ff;
  --accent-rgb: 114, 184, 255;
}

html[data-theme="oppenheimer"] {
  --acid: #ff7a1a;
  --acid-hover: #ffa25f;
  --accent-rgb: 255, 122, 26;
}

html[data-theme="blade-runner"] {
  --acid: #ed5cff;
  --acid-hover: #f493ff;
  --accent-rgb: 237, 92, 255;
}

html[data-theme="matrix"] {
  --acid: #48f06c;
  --acid-hover: #8cff9f;
  --accent-rgb: 72, 240, 108;
}

html[data-theme="barbie"] {
  --acid: #ff4fa3;
  --acid-hover: #ff8bc3;
  --accent-rgb: 255, 79, 163;
}

html[data-theme="dune"] {
  --acid: #e4b86a;
  --acid-hover: #f2d39c;
  --accent-rgb: 228, 184, 106;
}

html[data-theme="grand-budapest"] {
  --acid: #e68bbd;
  --acid-hover: #f3b3d6;
  --accent-rgb: 230, 139, 189;
}

html[data-theme="mad-max"] {
  --acid: #ffb000;
  --acid-hover: #ffd064;
  --accent-rgb: 255, 176, 0;
}

html[data-theme="spirited-away"] {
  --acid: #55d8c1;
  --acid-hover: #91eadb;
  --accent-rgb: 85, 216, 193;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  color-scheme: dark;
  scroll-behavior: smooth;
}

body {
  min-width: 320px;
  margin: 0;
  color: var(--paper);
  background:
    radial-gradient(circle at 70% 12%, rgba(var(--accent-rgb), 0.055), transparent 30rem),
    linear-gradient(145deg, #0d0d0b 0%, var(--ink) 58%, #080808 100%);
  font-family: var(--body);
  min-height: 100vh;
  overflow-x: hidden;
  isolation: isolate;
}

body::before {
  position: fixed;
  z-index: -1;
  inset: 0;
  content: "";
  pointer-events: none;
  background: radial-gradient(ellipse at center, transparent 25%, rgba(0, 0, 0, 0.46) 100%);
}

button,
input {
  font: inherit;
}

button,
a {
  -webkit-tap-highlight-color: transparent;
}

button {
  color: inherit;
}

[hidden] {
  display: none !important;
}

.ambient-light {
  position: fixed;
  z-index: -1;
  inset: -20%;
  pointer-events: none;
  background:
    radial-gradient(circle at 76% 20%, rgba(var(--accent-rgb), 0.11), transparent 22%),
    radial-gradient(circle at 18% 76%, rgba(var(--accent-rgb), 0.055), transparent 25%);
  filter: blur(42px);
  animation: ambient-drift 18s ease-in-out infinite alternate;
}

.site-header,
main,
.site-footer {
  width: min(100% - 48px, 1240px);
  margin-inline: auto;
}

.site-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 100px;
  border-bottom: 1px solid var(--line);
}

.header-actions {
  display: flex;
  align-items: center;
  gap: clamp(18px, 3vw, 42px);
}

.theme-button {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  padding: 9px 12px;
  border: 1px solid var(--line);
  color: var(--paper-muted);
  background: rgba(11, 11, 10, 0.42);
  font-family: var(--mono);
  font-size: 0.61rem;
  text-transform: lowercase;
  cursor: pointer;
  transition: border-color 180ms ease, color 180ms ease, background 180ms ease;
}

.theme-button:hover {
  border-color: var(--line-strong);
  color: var(--paper);
  background: rgba(var(--accent-rgb), 0.07);
}

.theme-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--acid);
  box-shadow: 0 0 12px rgba(var(--accent-rgb), 0.75);
}

.wordmark {
  display: inline-flex;
  gap: 11px;
  align-items: center;
  color: var(--paper);
  font-family: var(--mono);
  font-size: 0.82rem;
  text-decoration: none;
  text-transform: lowercase;
}

.wordmark-mark {
  width: 13px;
  height: 13px;
  border: 1px solid var(--paper);
  border-radius: 50%;
  box-shadow: inset 4px 0 0 var(--acid);
}

.header-note,
.eyebrow,
.section-index,
.privacy-note,
.result-stamp,
.verdict-label,
.field-hint,
label,
.site-footer,
.download-status {
  font-family: var(--mono);
  text-transform: lowercase;
}

.header-note {
  margin: 0;
  color: var(--paper-faint);
  font-size: 0.68rem;
}

main {
  padding-bottom: 120px;
}

.intro {
  position: relative;
  padding: clamp(80px, 12vw, 164px) 0 clamp(72px, 10vw, 132px);
}

.intro::after {
  position: absolute;
  right: 4%;
  bottom: 20%;
  width: clamp(110px, 17vw, 220px);
  aspect-ratio: 1;
  border: 1px solid var(--line);
  border-radius: 50%;
  content: "";
  box-shadow:
    0 0 0 28px rgba(233, 230, 220, 0.015),
    0 0 0 56px rgba(233, 230, 220, 0.01);
}

.eyebrow {
  margin: 0 0 28px;
  color: var(--acid);
  font-size: clamp(0.64rem, 1vw, 0.74rem);
  letter-spacing: 0.04em;
}

h1,
h2 {
  margin: 0;
  font-family: var(--display);
  font-weight: 500;
  letter-spacing: -0.055em;
}

h1 {
  position: relative;
  z-index: 1;
  max-width: 900px;
  font-size: clamp(4.3rem, 11.5vw, 10rem);
  line-height: 0.82;
}

.lede {
  width: min(100%, 450px);
  margin: 52px 0 0 clamp(0px, 19vw, 230px);
  color: var(--paper-muted);
  font-size: clamp(1rem, 1.6vw, 1.2rem);
  line-height: 1.58;
}

.entry-card {
  position: relative;
  padding: clamp(26px, 5vw, 62px);
  border: 1px solid var(--line);
  background: rgba(16, 16, 14, 0.72);
  box-shadow: 0 38px 100px rgba(0, 0, 0, 0.22);
  backdrop-filter: blur(10px);
}

.entry-heading-row,
.result-meta,
.result-actions {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 24px;
}

.section-index {
  margin: 0 0 14px;
  color: var(--acid);
  font-size: 0.64rem;
  letter-spacing: 0.05em;
}

.entry-heading-row h2 {
  font-size: clamp(2rem, 4vw, 3.5rem);
}

.privacy-note,
.result-stamp {
  color: var(--paper-faint);
  font-size: 0.64rem;
}

.mode-tabs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  margin-top: clamp(42px, 6vw, 72px);
  border-bottom: 1px solid var(--line);
}

.mode-tab {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 2px;
  border: 0;
  color: var(--paper-faint);
  background: none;
  font-family: var(--mono);
  font-size: 0.73rem;
  text-align: left;
  text-transform: lowercase;
  cursor: pointer;
}

.mode-tab:first-child {
  padding-right: 32px;
}

.mode-tab:last-child {
  padding-left: 32px;
}

.mode-tab span {
  color: var(--acid);
  font-size: 0.56rem;
}

.mode-tab::after {
  position: absolute;
  right: 0;
  bottom: -1px;
  left: 0;
  height: 1px;
  content: "";
  background: transparent;
  transition: background 180ms ease;
}

.mode-tab.is-active {
  color: var(--paper);
}

.mode-tab.is-active::after {
  background: var(--paper);
}

.mode-panel {
  padding-top: clamp(42px, 7vw, 82px);
}

label {
  display: block;
  margin-bottom: 12px;
  color: var(--paper-muted);
  font-size: 0.65rem;
}

.input-action-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 14px;
}

.text-field {
  display: flex;
  align-items: center;
  min-height: 64px;
  border-bottom: 1px solid var(--line-strong);
  transition: border-color 180ms ease;
}

.text-field:focus-within {
  border-color: var(--acid);
}

.text-field > span {
  color: var(--paper-faint);
  font-family: var(--mono);
  font-size: 0.95rem;
}

input {
  width: 100%;
  border: 0;
  outline: 0;
  color: var(--paper);
  background: transparent;
  font-family: var(--body);
  font-size: clamp(1.05rem, 2vw, 1.32rem);
}

.has-prefix input {
  padding: 16px 12px;
}

input::placeholder {
  color: #535149;
}

.primary-button,
.secondary-button,
.text-button {
  border: 0;
  font-family: var(--mono);
  font-size: 0.7rem;
  text-transform: lowercase;
  cursor: pointer;
}

.primary-button {
  display: inline-flex;
  min-width: 186px;
  min-height: 64px;
  align-items: center;
  justify-content: space-between;
  gap: 28px;
  padding: 0 20px;
  color: #0b0b09;
  background: var(--acid);
  transition: transform 180ms ease, background 180ms ease;
}

.primary-button:hover {
  background: var(--acid-hover);
  transform: translateY(-2px);
}

.primary-button:disabled {
  cursor: wait;
  opacity: 0.55;
  transform: none;
}

.secondary-button {
  display: inline-flex;
  min-width: 205px;
  min-height: 64px;
  align-items: center;
  justify-content: space-between;
  gap: 28px;
  padding: 0 20px;
  border: 1px solid var(--line-strong);
  color: var(--paper);
  background: rgba(var(--accent-rgb), 0.055);
  transition: border-color 180ms ease, background 180ms ease, color 180ms ease;
}

.secondary-button:hover:not(:disabled) {
  border-color: var(--acid);
  background: rgba(var(--accent-rgb), 0.11);
}

.secondary-button:disabled {
  color: var(--paper-faint);
  cursor: not-allowed;
  opacity: 0.72;
}

.button-arrow {
  font-size: 1.05rem;
}

.field-hint {
  margin: 16px 0 0;
  color: var(--paper-faint);
  font-size: 0.57rem;
}

fieldset {
  min-width: 0;
  margin: 0;
  padding: 0;
  border: 0;
}

.manual-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 30px 46px;
}

.numbered-field {
  display: grid;
  grid-template-columns: 32px 1fr;
  align-items: center;
  margin: 0;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--line-strong);
}

.numbered-field:focus-within {
  border-color: var(--acid);
}

.numbered-field span {
  color: var(--paper-faint);
  font-family: var(--mono);
  font-size: 0.58rem;
}

.numbered-field input {
  padding: 12px 0;
}

.film-field {
  position: relative;
}

.film-suggestions {
  position: absolute;
  z-index: 2;
  top: calc(100% - 12px);
  right: 0;
  left: 32px;
  overflow: hidden;
  border: 1px solid var(--line-strong);
  background: #171715;
  box-shadow: 0 18px 34px rgba(0, 0, 0, 0.3);
}

.film-suggestion {
  display: flex;
  width: 100%;
  align-items: baseline;
  justify-content: space-between;
  gap: 16px;
  padding: 12px 14px;
  border: 0;
  border-bottom: 1px solid var(--line);
  color: var(--paper);
  background: transparent;
  font-family: var(--mono);
  font-size: 0.68rem;
  text-align: left;
  text-transform: lowercase;
  cursor: pointer;
}

.film-suggestion:last-child { border-bottom: 0; }
.film-suggestion:hover,
.film-suggestion.is-active { background: rgba(var(--accent-rgb), 0.12); color: var(--acid); }
.film-suggestion-year { color: var(--paper-faint); }

.manual-submit {
  margin: 42px 0 0 auto;
}

.form-message {
  margin-top: 24px;
  padding: 14px 16px;
  border-left: 1px solid var(--error);
  color: #d7d3c8;
  background: rgba(255, 128, 111, 0.05);
  font-family: var(--body);
  font-size: 0.9rem;
  line-height: 1.5;
}

.form-message button {
  margin-left: 8px;
  padding: 0;
  border: 0;
  color: var(--acid);
  background: none;
  font-family: var(--mono);
  font-size: 0.68rem;
  text-decoration: underline;
  text-transform: lowercase;
  cursor: pointer;
}

.loading-state {
  display: flex;
  min-height: 222px;
  align-items: center;
  justify-content: center;
  gap: 24px;
  text-align: left;
}

.loading-reel {
  display: grid;
  width: 58px;
  aspect-ratio: 1;
  grid-template-columns: repeat(2, 1fr);
  gap: 9px;
  padding: 9px;
  border: 1px solid var(--line-strong);
  border-radius: 50%;
  animation: spin 2.4s linear infinite;
}

.loading-reel span {
  border: 1px solid var(--paper-faint);
  border-radius: 50%;
}

.loading-state p {
  margin: 0 0 5px;
  font-family: var(--display);
  font-size: 1.2rem;
}

.loading-state > div + div > span {
  color: var(--paper-faint);
  font-family: var(--mono);
  font-size: 0.58rem;
  text-transform: lowercase;
}

.result-section {
  padding-top: clamp(100px, 14vw, 180px);
}

.result-meta {
  margin-bottom: 24px;
}

.result-meta .section-index {
  margin: 0;
}

.result-stamp {
  margin: 0;
}

.result-card {
  display: grid;
  grid-template-columns: minmax(320px, 0.88fr) minmax(360px, 1.12fr);
  min-height: 710px;
  border: 1px solid var(--line);
  background: #10100e;
  box-shadow: 0 45px 120px rgba(0, 0, 0, 0.35);
}

.poster-wall {
  position: relative;
  display: grid;
  min-height: 710px;
  grid-template-columns: repeat(2, 1fr);
  overflow: hidden;
  background: #070706;
}

.poster-wall::after {
  position: absolute;
  inset: 0;
  content: "";
  pointer-events: none;
  background:
    linear-gradient(90deg, transparent 72%, #10100e 100%),
    linear-gradient(0deg, rgba(0, 0, 0, 0.28), transparent 40%);
}

.poster {
  position: relative;
  min-height: 355px;
  overflow: hidden;
  background: #1a1a17;
}

.poster img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  filter: saturate(0.76) contrast(1.06) brightness(0.82);
  transition: filter 300ms ease, transform 700ms cubic-bezier(0.2, 0.7, 0.1, 1);
}

.poster:hover img {
  filter: saturate(0.92) contrast(1.03) brightness(0.95);
  transform: scale(1.025);
}

.poster-fallback {
  display: grid;
  height: 100%;
  place-items: center;
  padding: 24px;
  color: var(--paper-faint);
  background:
    repeating-linear-gradient(135deg, transparent 0 12px, rgba(255, 255, 255, 0.025) 12px 13px),
    #181815;
  font-family: var(--display);
  font-size: 1.3rem;
  text-align: center;
}

.verdict {
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: clamp(42px, 7vw, 92px);
}

.verdict-label {
  margin: 0 0 30px;
  color: var(--acid);
  font-size: 0.64rem;
}

.verdict h2 {
  position: relative;
  max-width: 620px;
  font-size: clamp(3rem, 6.2vw, 6.2rem);
  line-height: 0.94;
}

.verdict h2::before {
  content: "“";
}

.verdict h2::after {
  content: "”";
}

.result-explanation {
  max-width: 600px;
  margin: 42px 0 0;
  color: var(--paper-muted);
  font-size: clamp(1rem, 1.5vw, 1.16rem);
  line-height: 1.62;
}

.result-film-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 16px;
  margin-top: 46px;
}

.result-film-list span {
  color: var(--paper-faint);
  font-family: var(--mono);
  font-size: 0.57rem;
  text-transform: lowercase;
}

.result-film-list span:not(:last-child)::after {
  margin-left: 16px;
  color: var(--acid);
  content: "/";
}

.correction-button {
  align-self: flex-start;
  margin-top: 18px;
  padding: 4px 0;
  border: 0;
  color: var(--paper-faint);
  background: transparent;
  font-family: var(--mono);
  font-size: 0.55rem;
  text-decoration: underline;
  text-underline-offset: 4px;
  text-transform: lowercase;
  cursor: pointer;
}

.correction-button:hover {
  color: var(--paper);
}

.result-actions {
  justify-content: flex-start;
  margin-top: 28px;
}

.text-button {
  padding: 20px 4px;
  color: var(--paper-muted);
  background: transparent;
  text-decoration: underline;
  text-underline-offset: 5px;
}

.text-button:hover {
  color: var(--paper);
}

.download-status {
  min-height: 1rem;
  margin: 14px 0 0;
  color: var(--paper-faint);
  font-size: 0.58rem;
}

.site-footer {
  display: flex;
  justify-content: space-between;
  gap: 32px;
  padding: 24px 0 40px;
  border-top: 1px solid var(--line);
  color: var(--paper-faint);
  font-size: 0.53rem;
}

.site-footer p {
  margin: 0;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

:focus-visible {
  outline: 2px solid var(--acid);
  outline-offset: 4px;
}

.numbered-field input:focus-visible {
  outline: 0;
}

@keyframes ambient-drift {
  0% { transform: translate3d(-2%, -1%, 0) scale(1); }
  50% { transform: translate3d(2%, 1%, 0) scale(1.04); }
  100% { transform: translate3d(-1%, 3%, 0) scale(1.02); }
}

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

@media (max-width: 800px) {
  .site-header,
  main,
  .site-footer {
    width: min(100% - 32px, 1240px);
  }

  .site-header {
    min-height: 76px;
  }

  .header-note {
    display: none;
  }

  .theme-button {
    padding: 8px 10px;
  }

  .intro {
    padding-top: 88px;
  }

  .intro::after {
    right: -10%;
    bottom: 30%;
  }

  h1 {
    font-size: clamp(4rem, 20vw, 7rem);
  }

  .lede {
    margin-left: 0;
  }

  .input-action-row {
    grid-template-columns: 1fr;
  }

  .input-action-row .primary-button,
  .manual-submit {
    width: 100%;
    margin-top: 18px;
  }

  .manual-grid {
    grid-template-columns: 1fr;
    gap: 22px;
  }

  .result-card {
    grid-template-columns: 1fr;
  }

  .poster-wall {
    min-height: auto;
    aspect-ratio: 1 / 1.22;
  }

  .poster {
    min-height: 0;
  }

  .poster-wall::after {
    background: linear-gradient(0deg, #10100e 0%, transparent 22%);
  }

  .verdict {
    min-height: 540px;
  }

  .site-footer {
    flex-direction: column;
    line-height: 1.6;
  }
}

@media (max-width: 520px) {
  .entry-heading-row {
    align-items: flex-start;
  }

  .privacy-note {
    writing-mode: vertical-rl;
  }

  .mode-tab:first-child {
    padding-right: 12px;
  }

  .mode-tab:last-child {
    padding-left: 12px;
  }

  .mode-tab span {
    display: none;
  }

  .loading-state {
    align-items: flex-start;
    flex-direction: column;
  }

  .result-actions {
    align-items: stretch;
    flex-direction: column;
  }

  .result-actions .primary-button {
    width: 100%;
  }

  .result-actions .secondary-button {
    width: 100%;
  }

  .text-button {
    align-self: flex-start;
  }
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}
