:root {
  color-scheme: dark;
  --ink: #0b0e17;
  --panel: #111725;
  --panel-raised: #171f30;
  --line: #283247;
  --text: #f1f3f8;
  --muted: #a5afc2;
  --amber: #f2b45d;
  --teal: #57d4c1;
  --red: #ff8f8f;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  min-width: 320px;
  min-height: 100vh;
  color: var(--text);
  background: radial-gradient(ellipse at 78% -8%, #202842 0, transparent 36rem), var(--ink);
}

a { color: inherit; }
button, input, select { font: inherit; }
button, a, input, select { outline-offset: 3px; }
:focus-visible { outline: 2px solid var(--teal); }

.shell { width: min(1180px, calc(100% - 48px)); margin: 0 auto; }
.topbar { min-height: 82px; display: flex; align-items: center; justify-content: space-between; border-bottom: 1px solid #ffffff12; }
.brand { display: inline-flex; align-items: center; gap: 12px; text-decoration: none; font-size: 1.12rem; letter-spacing: -.03em; }
.brand-mark { width: 36px; height: 36px; display: grid; place-items: center; border: 1px solid #f2b45d66; border-radius: 11px; color: var(--amber); font-size: .78rem; font-weight: 800; letter-spacing: .03em; }
.topbar-actions { display: flex; align-items: center; gap: 18px; }
.connection { display: inline-flex; align-items: center; gap: 9px; color: var(--muted); font-size: .86rem; }
.connection-dot { width: 8px; height: 8px; border-radius: 50%; background: #7e899d; }
.quiet-button { padding: 9px 12px; border: 1px solid var(--line); border-radius: 9px; color: var(--muted); background: transparent; cursor: pointer; }
.quiet-button:hover { color: var(--text); border-color: #65738d; }

.main { padding: 56px 0 84px; }
.intro { max-width: 760px; margin-bottom: 30px; }
h1, h2, p { margin-top: 0; }
h1 { margin-bottom: 12px; font-size: clamp(2rem, 4.2vw, 3.45rem); line-height: 1.08; letter-spacing: -.055em; font-weight: 650; }
.intro p { max-width: 660px; margin-bottom: 0; color: var(--muted); font-size: 1.03rem; line-height: 1.65; }

.search-panel { padding: 22px; border: 1px solid #384158; border-radius: 16px; background: linear-gradient(135deg, #171f30, #111725 72%); box-shadow: 0 24px 64px #0003; }
.search-form { display: grid; grid-template-columns: minmax(180px, 1fr) 158px auto; align-items: end; gap: 14px; }
.field { display: grid; gap: 8px; min-width: 0; }
.field label { color: #d6dbea; font-size: .88rem; font-weight: 600; }
.field input, .field select { width: 100%; height: 48px; padding: 0 14px; border: 1px solid #38445b; border-radius: 9px; color: var(--text); background: #0c1220; }
.field input::placeholder { color: #758198; }
.primary-button { min-height: 48px; padding: 0 21px; border: 0; border-radius: 9px; color: #211605; background: var(--amber); font-weight: 750; cursor: pointer; transition: transform .15s ease, filter .15s ease; }
.primary-button:hover { filter: brightness(1.08); transform: translateY(-1px); }
.primary-button:disabled { opacity: .7; cursor: progress; transform: none; }
.search-hint { margin: 15px 2px 0; color: var(--muted); font-size: .84rem; line-height: 1.55; }

.section-head { display: flex; align-items: end; justify-content: space-between; gap: 16px; margin: 52px 0 18px; }
.section-head h2 { margin: 0; font-size: 1.4rem; letter-spacing: -.025em; }
.section-head p { margin: 5px 0 0; color: var(--muted); font-size: .9rem; }
.library-empty { min-height: 206px; display: grid; place-items: center; padding: 28px; border: 1px dashed #374158; border-radius: 14px; text-align: center; background: #11172580; }
.library-empty-inner { max-width: 380px; }
.library-icon { width: 42px; height: 42px; display: grid; place-items: center; margin: 0 auto 14px; border: 1px solid var(--line); border-radius: 13px; color: var(--teal); font-size: 1.25rem; }
.library-empty h3 { margin: 0 0 7px; font-size: 1rem; }
.library-empty p { margin: 0; color: var(--muted); font-size: .9rem; line-height: 1.55; }

.request-head { display: flex; align-items: start; justify-content: space-between; gap: 18px; margin-bottom: 26px; }
.request-head h1 { font-size: clamp(1.8rem, 4vw, 2.6rem); overflow-wrap: anywhere; }
.status-badge { flex: 0 0 auto; padding: 8px 11px; border: 1px solid #3b4961; border-radius: 999px; color: #d7dfef; background: #151e2d; font-size: .82rem; }
.status-badge[data-state="completed"] { color: var(--teal); border-color: #57d4c155; }
.status-badge[data-state="failed"] { color: var(--red); border-color: #ff8f8f55; }
.progress-panel { padding: 24px; border: 1px solid var(--line); border-radius: 16px; background: #111725e8; }
.progress-panel h2 { margin-bottom: 5px; font-size: 1.08rem; }
.progress-message { min-height: 24px; margin: 0 0 22px; color: var(--muted); font-size: .9rem; }
.progress-list { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 0; padding: 0; margin: 0; list-style: none; }
.progress-step { position: relative; min-width: 0; padding: 0 10px 0 0; color: #78849a; }
.progress-step::before { content: ""; position: absolute; z-index: 0; left: 29px; right: 0; top: 14px; height: 2px; background: #333e53; }
.progress-step:last-child::before { display: none; }
.step-number { position: relative; z-index: 1; width: 30px; height: 30px; display: grid; place-items: center; margin-bottom: 11px; border: 1px solid #3b465b; border-radius: 50%; color: #adb8cd; background: #111725; font-size: .74rem; font-weight: 700; }
.progress-step strong { display: block; max-width: 135px; color: inherit; font-size: .8rem; line-height: 1.4; }
.progress-step.is-current { color: var(--text); }
.progress-step.is-current .step-number { color: #081414; border-color: var(--teal); background: var(--teal); box-shadow: 0 0 0 5px #57d4c11c; }
.progress-step.is-current::before { background: linear-gradient(90deg, var(--teal), #333e53 35%); }
.progress-step.is-complete { color: #d0dbeb; }
.progress-step.is-complete .step-number { color: var(--teal); border-color: #57d4c177; }
.step-error { color: var(--red); }
.confirmation-card { margin-top: 24px; padding: 20px; border: 1px solid #f2b45d55; border-radius: 13px; background: #f2b45d0a; }
.confirmation-card h2 { margin-bottom: 10px; }
.confirmation-card p { color: var(--muted); line-height: 1.6; }
.confirmation-card button { margin-top: 8px; }
.movie-option { display: grid; grid-template-columns: 56px 1fr; align-items: center; gap: 14px; padding: 14px 0; border-top: 1px solid var(--line); cursor: pointer; }
.movie-option img { width: 56px; min-height: 78px; object-fit: cover; border-radius: 6px; background: var(--panel-raised); }
.movie-option > span { display: grid; grid-template-columns: 20px 1fr; gap: 5px 9px; color: var(--muted); font-size: .9rem; line-height: 1.5; }
.movie-option input { grid-row: 1 / span 2; align-self: start; margin: 4px 0 0; accent-color: var(--amber); }
.movie-option strong { color: var(--text); }
.movie-option strong span { color: var(--muted); font-weight: 500; }
.back-link { display: inline-block; margin-top: 22px; color: var(--muted); text-decoration-color: #61708a; text-underline-offset: 4px; }
.back-link:hover { color: var(--text); }

.login-wrap { min-height: 100vh; display: grid; place-items: center; padding: 24px; }
.login-card { width: min(420px, 100%); padding: 28px; border: 1px solid var(--line); border-radius: 16px; background: var(--panel); }
.login-card h1 { margin: 20px 0 8px; font-size: 1.8rem; }
.login-card p { color: var(--muted); }
.login-card .field { margin: 20px 0 16px; }
.alert { color: var(--red) !important; }

@media (max-width: 820px) {
  .progress-list { grid-template-columns: 1fr; gap: 0; }
  .progress-step { display: grid; grid-template-columns: 38px 1fr; align-items: center; min-height: 48px; padding: 0; }
  .progress-step::before { top: 30px; bottom: -16px; left: 14px; right: auto; width: 2px; height: auto; background: #333e53; }
  .progress-step.is-current::before { background: linear-gradient(var(--teal), #333e53 35%); }
  .step-number { margin: 0; }
  .progress-step strong { max-width: none; font-size: .9rem; }
}

@media (max-width: 640px) {
  .shell { width: min(100% - 32px, 1180px); }
  .topbar { min-height: 70px; }
  .connection { display: none; }
  .main { padding-top: 38px; }
  .search-panel { padding: 16px; }
  .search-form { grid-template-columns: 1fr; gap: 13px; }
  .primary-button { width: 100%; }
  .section-head { margin-top: 40px; }
  .request-head { display: block; }
  .status-badge { display: inline-block; margin-top: 4px; }
  .progress-panel { padding: 19px 16px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; transition-duration: .01ms !important; }
}
