:root {
  color-scheme: dark;
  --bg: #0c0c0b;
  --panel: #151513;
  --panel-2: #1c1c19;
  --line: rgba(255, 255, 255, 0.12);
  --muted: #a4a49b;
  --text: #f2f1e9;
  --accent: #e9ff5b;
  --accent-dark: #171a07;
  --danger: #ff766e;
  --radius: 24px;
  font-family: Inter, "Segoe UI", system-ui, -apple-system, sans-serif;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body { margin: 0; color: var(--text); background: var(--bg); }
button, input, select { font: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }

.topbar {
  position: sticky; top: 0; z-index: 50; height: 76px; padding: 0 max(24px, calc((100vw - 1440px) / 2));
  display: flex; align-items: center; justify-content: space-between;
  border-bottom: 1px solid var(--line); background: rgba(12, 12, 11, .88); backdrop-filter: blur(18px);
}
.brand { display: flex; align-items: center; gap: 12px; color: inherit; text-decoration: none; }
.brand-mark { width: 42px; height: 42px; display: grid; place-items: center; border-radius: 50%; color: #111;
  font-size: 14px; font-weight: 900; letter-spacing: -.04em; background: var(--accent); }
.brand strong, .brand small { display: block; }
.brand strong { font-size: 16px; }
.brand small { color: var(--muted); font-size: 11px; letter-spacing: .08em; text-transform: uppercase; margin-top: 2px; }
.system-status { color: var(--muted); font-size: 13px; }
.system-status.ready { color: var(--accent); }
.system-status.warning { color: #ffc56b; }
.topbar-tools { display: flex; align-items: center; gap: 16px; }
.user-menu { position: relative; }
.user-menu summary { min-width: 120px; padding: 9px 12px; color: var(--text); list-style: none; border: 1px solid var(--line); border-radius: 10px; cursor: pointer; }
.user-menu summary::-webkit-details-marker { display: none; }
.user-menu > div { position: absolute; right: 0; top: calc(100% + 8px); width: 230px; padding: 7px; display: grid; gap: 4px; border: 1px solid var(--line); border-radius: 12px; background: #181816; box-shadow: 0 18px 60px rgba(0,0,0,.35); }
.user-menu button, .user-menu a { padding: 10px 12px; color: var(--text); font: inherit; text-align: left; text-decoration: none; border: 0; border-radius: 8px; background: transparent; cursor: pointer; }
.user-menu button:hover, .user-menu a:hover { background: #292925; }
.app-nav { position: absolute; left: 50%; display: flex; padding: 4px; border: 1px solid var(--line); border-radius: 12px; background: #11110f; transform: translateX(-50%); }
.app-nav button { min-width: 100px; padding: 8px 15px; color: var(--muted); border: 0; border-radius: 8px; background: transparent; cursor: pointer; }
.app-nav button.active { color: #111; background: var(--accent); font-weight: 750; }

.workspace { width: min(1440px, calc(100% - 48px)); margin: 0 auto 100px; }
.hero { padding: 92px 0 72px; display: grid; grid-template-columns: 1.4fr .6fr; gap: 48px; align-items: end; }
.hero .eyebrow, .hero h1 { grid-column: 1; }
.hero h1 { margin: 0; max-width: 1000px; font-size: clamp(62px, 5.4vw, 118px); line-height: .86; letter-spacing: -.075em; font-weight: 760; }
.hero > p:last-child { grid-column: 2; grid-row: 2; margin: 0 0 8px; color: var(--muted); font-size: 18px; line-height: 1.55; }
.eyebrow { margin: 0 0 10px; color: var(--accent); font-size: 11px; line-height: 1; font-weight: 800; letter-spacing: .16em; text-transform: uppercase; }

.stepper { position: sticky; top: 76px; z-index: 40; display: grid; grid-template-columns: repeat(5, 1fr); margin-bottom: 20px;
  border: 1px solid var(--line); border-radius: 16px; overflow: hidden; background: rgba(21,21,19,.94); backdrop-filter: blur(16px); }
.stepper a { padding: 15px 18px; color: var(--muted); text-decoration: none; font-size: 13px; border-right: 1px solid var(--line); }
.stepper a:last-child { border: 0; }
.stepper span { color: var(--accent); margin-right: 9px; font-size: 10px; font-weight: 800; }

.panel { position: relative; margin: 20px 0; padding: 44px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--panel); scroll-margin-top: 150px; transition: opacity .25s; }
.panel-number { position: absolute; right: 34px; top: 28px; color: rgba(255,255,255,.06); font-size: 92px; line-height: 1; font-weight: 800; letter-spacing: -.08em; }
.disabled-panel { opacity: .42; pointer-events: none; }
.panel-heading { position: relative; z-index: 1; display: grid; grid-template-columns: 1fr 420px; align-items: end; gap: 30px; margin-bottom: 34px; }
.panel-heading h2 { margin: 0; font-size: 42px; letter-spacing: -.045em; }
.panel-heading > p { margin: 0; color: var(--muted); line-height: 1.55; }
.subsection { margin-top: 34px; padding-top: 30px; border-top: 1px solid var(--line); }
.subheading { display: flex; align-items: center; justify-content: space-between; gap: 20px; margin-bottom: 18px; }
.subheading h3 { margin: 0; font-size: 22px; }

.search-form { display: flex; gap: 12px; align-items: end; }
.field { display: flex; min-width: 0; flex-direction: column; gap: 8px; }
.field.grow { flex: 1; }
.field.compact { width: 150px; }
.field > span { color: var(--muted); font-size: 12px; font-weight: 650; }
.field input, .field select { width: 100%; height: 50px; padding: 0 15px; color: var(--text); outline: none;
  border: 1px solid var(--line); border-radius: 12px; background: #0f0f0e; transition: border .15s, box-shadow .15s; }
.field input:focus, .field select:focus { border-color: rgba(233,255,91,.72); box-shadow: 0 0 0 3px rgba(233,255,91,.08); }

.button { min-height: 50px; padding: 0 22px; display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  border: 1px solid transparent; border-radius: 12px; cursor: pointer; text-decoration: none; font-weight: 750; transition: transform .15s, opacity .15s, background .15s; }
.button:hover { transform: translateY(-1px); }
.button:disabled { cursor: wait; opacity: .55; transform: none; }
.button.primary { color: #111; background: var(--accent); }
.button.secondary { color: var(--text); border-color: var(--line); background: #272723; }
.button.ghost { color: var(--text); border-color: var(--line); background: transparent; }
.button.wide { width: 100%; }
.text-button { padding: 4px; color: var(--muted); border: 0; background: none; cursor: pointer; }
.text-button:hover { color: var(--text); }

.inline-message { min-height: 20px; margin-top: 12px; color: var(--muted); font-size: 13px; white-space: pre-wrap; }
.inline-message.error { color: var(--danger); }
.inline-message.success { color: var(--accent); }

.result-grid { display: grid; grid-template-columns: repeat(6, 1fr); gap: 14px; margin-top: 20px; }
.result-card { padding: 0; overflow: hidden; color: inherit; text-align: left; border: 1px solid var(--line); border-radius: 15px; background: var(--panel-2); cursor: pointer; transition: transform .15s, border-color .15s; }
.result-card:hover, .result-card.selected { transform: translateY(-3px); border-color: var(--accent); }
.result-card img, .result-poster-empty { display: block; width: 100%; aspect-ratio: 2 / 3; object-fit: cover; background: #292925; }
.result-card div { padding: 13px; }
.result-card strong { display: block; font-size: 14px; line-height: 1.2; }
.result-card small { display: block; margin-top: 6px; color: var(--muted); }

.art-toolbar { display: flex; justify-content: space-between; align-items: end; margin-bottom: 16px; }
.art-toolbar-actions { display: flex; align-items: end; gap: 12px; }
.custom-background-button { position: relative; min-height: 50px; overflow: hidden; }
.custom-background-button input { position: absolute; inset: 0; opacity: 0; cursor: pointer; }
.segmented { display: inline-flex; padding: 4px; border-radius: 12px; background: #0f0f0e; }
.segmented button { padding: 10px 17px; color: var(--muted); border: 0; border-radius: 9px; background: transparent; cursor: pointer; }
.segmented button.active { color: #111; background: var(--accent); }
.image-gallery { max-height: 680px; padding-right: 6px; display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; overflow: auto; }
.image-choice, .logo-choice { position: relative; padding: 0; overflow: hidden; border: 2px solid transparent; border-radius: 13px; background: #242420; cursor: pointer; }
.image-choice img { display: block; width: 100%; aspect-ratio: 16 / 9; object-fit: cover; }
.image-choice.poster img { object-position: center 25%; }
.image-choice.selected, .logo-choice.selected { border-color: var(--accent); box-shadow: 0 0 0 2px var(--accent-dark); }
.image-choice span { position: absolute; right: 8px; bottom: 8px; padding: 4px 7px; font-size: 10px; border-radius: 7px; background: rgba(0,0,0,.7); }
.image-choice.custom::before { content: "Свой файл"; position: absolute; left: 8px; top: 8px; z-index: 1; padding: 5px 8px; color: #111; font-size: 10px; font-weight: 750; border-radius: 7px; background: var(--accent); }
.logo-gallery { display: flex; gap: 10px; overflow-x: auto; }
.logo-choice { flex: 0 0 220px; height: 110px; display: grid; place-items: center; padding: 16px; }
.logo-choice img { max-width: 100%; max-height: 100%; object-fit: contain; }

.form-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; }
.span-2 { grid-column: span 2; }
.ratings-grid { display: grid; grid-template-columns: repeat(5, 1fr); gap: 14px; margin-top: 14px; }
.rating-field input { font-size: 24px; font-weight: 700; }
.rating-source-link { color: inherit; text-decoration: none; }
.rating-source-link:hover { color: var(--accent); }
.source-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; margin-top: 22px; padding-top: 22px; border-top: 1px solid var(--line); }
.action-row { display: flex; align-items: center; gap: 16px; margin-top: 18px; }

.poster-layout { display: grid; grid-template-columns: 1fr 270px; gap: 24px; align-items: start; }
.poster-preview { position: relative; overflow: hidden; aspect-ratio: 16 / 9; display: grid; place-items: center; border: 1px solid var(--line); border-radius: 18px; background: #090909; }
.poster-preview img { width: 100%; height: 100%; object-fit: contain; }
.placeholder { color: #60605a; }
.poster-controls { display: flex; flex-direction: column; gap: 12px; }

.audio-layout { display: grid; grid-template-columns: .72fr 1.28fr; gap: 18px; }
.audio-card { min-height: 280px; padding: 24px; border: 1px solid var(--line); border-radius: 18px; background: #10100f; }
.upload-button, .upload-zone { position: relative; overflow: hidden; cursor: pointer; }
.upload-button { min-height: 48px; margin-top: 14px; display: grid; place-items: center; color: var(--text); border: 1px dashed rgba(255,255,255,.25); border-radius: 12px; }
.sample-player { width: 100%; height: 42px; margin-top: 14px; }
.upload-zone { min-height: 90px; display: grid; place-items: center; align-content: center; gap: 4px; border: 1px dashed rgba(255,255,255,.25); border-radius: 14px; }
.upload-zone small { color: var(--muted); }
.upload-button input, .upload-zone input { position: absolute; inset: 0; opacity: 0; cursor: pointer; }
.counter { min-width: 34px; height: 34px; display: grid; place-items: center; color: #111; border-radius: 50%; background: var(--accent); font-weight: 800; }
.parts-list { margin: 16px 0 0; padding: 0; list-style: none; display: flex; flex-direction: column; gap: 8px; }
.part-item { min-height: 46px; padding: 8px 9px 8px 13px; display: flex; align-items: center; gap: 10px; border-radius: 10px; background: #22221f; }
.part-index { color: var(--accent); font-size: 11px; font-weight: 800; }
.part-name { min-width: 0; flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 13px; }
.part-actions { display: flex; gap: 4px; }
.part-actions button { width: 30px; height: 30px; padding: 0; color: var(--muted); border: 0; border-radius: 7px; background: #30302c; cursor: pointer; }
.part-actions button:hover { color: var(--text); }
.build-row { display: flex; align-items: center; gap: 18px; margin-top: 22px; }
.video-result { margin-top: 22px; display: grid; grid-template-columns: 1fr auto; gap: 16px; align-items: end; }
.video-result video { width: 100%; max-height: 600px; border-radius: 16px; background: #000; }

.toast { position: fixed; right: 24px; bottom: 24px; z-index: 100; max-width: 420px; padding: 14px 18px; opacity: 0;
  pointer-events: none; border: 1px solid var(--line); border-radius: 12px; background: #292925; transform: translateY(10px); transition: .2s; }
.toast.visible { opacity: 1; transform: translateY(0); }
.hidden { display: none !important; }

.login-page { min-height: 100vh; background: radial-gradient(circle at 15% 15%, rgba(233,255,91,.08), transparent 36%), var(--bg); }
.login-shell { min-height: 100vh; padding: 28px; display: grid; place-items: center; }
.login-card { width: min(460px, 100%); padding: 42px; border: 1px solid var(--line); border-radius: 26px; background: rgba(21,21,19,.96); box-shadow: 0 34px 100px rgba(0,0,0,.35); }
.login-brand { margin-bottom: 52px; }
.login-card h1 { margin: 0; font-size: clamp(44px, 8vw, 70px); line-height: .92; letter-spacing: -.065em; }
.login-intro { margin: 20px 0 30px; color: var(--muted); line-height: 1.5; }
.login-form { display: grid; gap: 17px; }
.browser-challenge-overlay { position: fixed; inset: 0; z-index: 1000; padding: 20px; display: grid; place-items: center; background: rgba(0,0,0,.84); }
.browser-challenge-dialog { width: min(1180px, 100%); height: min(850px, calc(100vh - 40px)); padding: 24px; display: grid; grid-template-rows: auto auto minmax(0, 1fr) auto; border: 1px solid var(--line); border-radius: 22px; background: var(--panel); }
.browser-challenge-heading { display: flex; align-items: start; justify-content: space-between; gap: 20px; }
.browser-challenge-heading h2 { margin: 0; }
.browser-challenge-dialog > p { color: var(--muted); }
.browser-challenge-dialog iframe { width: 100%; height: 100%; border: 1px solid var(--line); border-radius: 14px; background: #050505; }

.releases-hero h1 { max-width: 1100px; }
.releases-panel { scroll-margin-top: 100px; }
.release-filters { display: grid; grid-template-columns: repeat(5, minmax(120px, 1fr)) auto; gap: 12px; align-items: end; }
.release-type-field { min-height: 50px; display: flex; flex-wrap: wrap; align-items: center; gap: 8px 14px; }
.release-type-field > span { flex-basis: 100%; color: var(--muted); font-size: 12px; font-weight: 650; }
.release-type-field label { display: flex; align-items: center; gap: 6px; font-size: 13px; }
.release-type-field input { accent-color: var(--accent); }
.media-switch { width: fit-content; margin: -8px 0 24px; border: 1px solid var(--line); }
.media-switch button { min-width: 130px; }
.media-switch button span { margin-left: 5px; opacity: .68; font-size: 10px; }
.release-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 14px; margin-top: 22px; }
.release-card { min-width: 0; overflow: hidden; display: flex; flex-direction: column; border: 1px solid var(--line); border-radius: 15px; background: #10100f; }
.release-poster { width: 100%; aspect-ratio: 2 / 3; display: block; overflow: hidden; background: #242420; }
.release-poster img { display: block; width: 100%; height: 100%; object-fit: contain; }
.release-card-body { min-width: 0; padding: 14px; display: flex; flex-direction: column; gap: 11px; }
.release-card-body .button.wide { margin-top: auto; }
.release-card h3, .library-card h3 { margin: 0; font-size: 17px; line-height: 1.15; }
.release-card p, .library-card p { margin: 4px 0 0; color: var(--muted); font-size: 12px; }
.release-score { color: var(--text); font-size: 13px; font-weight: 700; }
.release-score span { color: var(--muted); font-size: 11px; font-weight: 400; }
.release-badges { display: flex; flex-wrap: wrap; gap: 6px; }
.release-badge { padding: 6px 8px; display: inline-flex; flex-direction: column; gap: 2px; color: #d9d9d1; font-size: 10px; line-height: 1.15; border: 1px solid var(--line); border-radius: 8px; background: #252521; }
.release-badge b { color: var(--accent); font-size: 10px; }
.release-badge.digital b { color: #77dfff; }
.release-badge.muted { color: var(--muted); }
.release-note { max-width: 180px; color: var(--muted); font-size: 9px; line-height: 1.2; }
.release-genres { margin-top: 7px !important; color: #c9c9bf !important; font-size: 11px !important; }
.catalog-label { width: fit-content; padding: 5px 8px; color: #ffcc7a; font-size: 10px; border: 1px solid rgba(255,204,122,.3); border-radius: 999px; background: rgba(255,204,122,.06); }

.library-toolbar { display: grid; grid-template-columns: 1fr 220px auto auto; gap: 12px; align-items: end; }
.library-search-block { margin-bottom: 28px; padding-bottom: 28px; border-bottom: 1px solid var(--line); }
.library-search-block .subheading { align-items: end; }
.library-search-block .subheading > p { margin: 0; color: var(--muted); font-size: 13px; }
.quick-search-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 14px; margin-top: 20px; }
.quick-search-card { min-width: 0; overflow: hidden; border: 1px solid var(--line); border-radius: 15px; background: var(--panel-2); }
.quick-search-card > a { display: block; }
.quick-search-card img, .quick-search-poster-empty { display: block; width: 100%; aspect-ratio: 2 / 3; object-fit: contain; background: #292925; }
.quick-search-card-body { padding: 14px; display: flex; flex-direction: column; gap: 11px; }
.quick-search-card-body strong, .quick-search-card-body small { display: block; }
.quick-search-card-body strong { color: var(--text); font-size: 15px; line-height: 1.2; }
.quick-search-card-body small { min-height: 32px; color: var(--muted); font-size: 11px; }
.quick-search-card-body a { text-decoration: none; }
.quick-search-card-body .button { min-height: 40px; padding: 0 10px; font-size: 12px; }
.quick-search-score { display: flex; align-items: baseline; gap: 6px; font-size: 12px; }
.quick-search-score b { color: var(--accent); font-size: 17px; }
.quick-search-score span { margin-left: auto; color: var(--muted); font-size: 10px; }
.quick-search-details { margin: 0; display: grid; gap: 7px; }
.quick-search-details div { display: grid; grid-template-columns: 55px 1fr; gap: 8px; }
.quick-search-details dt { color: var(--muted); font-size: 10px; }
.quick-search-details dd { margin: 0; color: #d9d9d1; font-size: 11px; line-height: 1.35; }
.quick-search-ratings { padding-top: 2px; }
.quick-search-release-block { padding-top: 10px; border-top: 1px solid var(--line); }
.quick-search-section-label { display: block; margin-bottom: 7px; color: var(--muted); font-size: 10px; }
.quick-search-release-block .release-note { max-width: none; }
.quick-search-actions { margin-top: auto; display: grid; gap: 7px; }
.library-list { display: flex; flex-direction: column; gap: 14px; margin-top: 20px; }
.library-card { overflow: hidden; border: 1px solid var(--line); border-radius: 17px; background: #10100f; }
.library-summary { padding: 20px; display: grid; grid-template-columns: 170px 1fr; gap: 22px; align-items: start; }
.library-cover { width: 100%; aspect-ratio: 2 / 3; display: block; overflow: hidden; border: 1px solid var(--line); border-radius: 12px; background: #242420; }
.library-cover img { display: block; width: 100%; height: 100%; object-fit: contain; }
.library-summary-content { min-width: 0; display: flex; flex-direction: column; gap: 14px; }
.library-title-details { max-width: 760px; }
.library-title-details div { grid-template-columns: 62px 1fr; }
.library-vote-count { margin-top: -7px; color: var(--muted); font-size: 10px; }
.latest-season-badge { flex: 0 0 auto; padding: 7px 10px; color: #111; border-radius: 9px; background: var(--accent); font-size: 12px; font-weight: 850; }
.series-seasons { max-width: 760px; overflow: hidden; border: 1px solid var(--line); border-radius: 12px; background: rgba(255,255,255,.018); }
.series-seasons-heading { padding: 10px 12px; display: flex; justify-content: space-between; border-bottom: 1px solid var(--line); font-size: 11px; }
.series-seasons-heading span { color: var(--muted); }
.series-season-row { min-height: 38px; padding: 8px 12px; display: grid; grid-template-columns: 46px minmax(120px, .7fr) 1fr; gap: 10px; align-items: center; border-bottom: 1px solid rgba(255,255,255,.07); font-size: 11px; }
.series-season-row:last-child { border-bottom: 0; }
.series-season-row b { color: var(--accent); }
.series-season-row span, .series-season-row time { color: var(--muted); }
.series-seasons details summary { padding: 9px 12px; color: var(--muted); font-size: 11px; cursor: pointer; }
.series-seasons details[open] summary { border-bottom: 1px solid var(--line); }
.series-seasons-empty { padding: 14px; color: var(--muted); border: 1px dashed var(--line); border-radius: 12px; font-size: 12px; }
.library-status-field { max-width: 300px; }
.series-studio-season { display: flex; align-items: center; gap: 8px; color: var(--muted); font-size: 11px; }
.series-studio-season select { height: 42px; padding: 0 12px; color: var(--text); border: 1px solid var(--line); border-radius: 10px; background: #20201d; }
.library-main { min-width: 0; padding: 20px; display: flex; flex-direction: column; gap: 14px; border-top: 1px solid var(--line); background: rgba(255,255,255,.015); }
.library-title { display: flex; justify-content: space-between; gap: 15px; }
.priority-dot { width: 12px; height: 12px; flex: 0 0 auto; border-radius: 50%; background: #484842; }
.priority-dot.p1 { background: #9eb260; }
.priority-dot.p2 { background: #ffc56b; }
.priority-dot.p3 { background: #ff766e; box-shadow: 0 0 18px rgba(255,118,110,.45); }
.library-fields { display: grid; grid-template-columns: 1fr 170px 190px; gap: 10px; }
.library-fields.series-manual-date { grid-template-columns: minmax(240px, 1fr) auto; }
.library-fields .field input, .library-fields .field select { height: 42px; }
.compact-notes, .notes-input { width: 100%; padding: 13px 15px; color: var(--text); outline: none; resize: vertical; border: 1px solid var(--line); border-radius: 12px; background: #0f0f0e; font: inherit; }
.compact-notes:focus, .notes-input:focus { border-color: rgba(233,255,91,.72); box-shadow: 0 0 0 3px rgba(233,255,91,.08); }
.library-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.library-actions .button { min-height: 42px; padding: 0 15px; font-size: 12px; }
.text-button.danger { margin-left: auto; color: var(--danger); }
.empty-state { padding: 45px 20px; color: var(--muted); text-align: center; border: 1px dashed var(--line); border-radius: 15px; }

.import-list { display: flex; flex-direction: column; gap: 8px; margin-top: 20px; }
.import-row { min-height: 66px; padding: 10px 12px 10px 16px; display: grid; grid-template-columns: minmax(180px, .7fr) 1fr auto; align-items: center; gap: 12px; border: 1px solid var(--line); border-radius: 12px; background: #10100f; }
.import-row strong, .import-row small { display: block; }
.import-row small { margin-top: 4px; color: var(--muted); }
.import-row select { height: 42px; padding: 0 12px; color: var(--text); border: 1px solid var(--line); border-radius: 9px; background: #20201d; }
.import-row .button { min-height: 42px; }

@media (max-width: 1000px) {
  .hero { grid-template-columns: 1fr; }
  .hero > p:last-child { grid-column: 1; grid-row: auto; max-width: 600px; }
  .panel-heading { grid-template-columns: 1fr; }
  .result-grid { grid-template-columns: repeat(3, 1fr); }
  .image-gallery { grid-template-columns: repeat(2, 1fr); }
  .poster-layout, .audio-layout { grid-template-columns: 1fr; }
  .poster-controls { display: grid; grid-template-columns: 1fr 1fr; }
  .release-filters { grid-template-columns: repeat(3, 1fr); }
  .quick-search-grid { grid-template-columns: repeat(3, 1fr); }
}

@media (max-width: 680px) {
  .workspace { width: min(100% - 24px, 1440px); }
  .topbar { padding: 0 12px; }
  .system-status { display: none; }
  .topbar-tools { gap: 8px; }
  .user-menu summary { min-width: 0; max-width: 100px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .app-nav { position: static; margin-left: auto; transform: none; }
  .app-nav button { min-width: auto; }
  .hero { padding: 64px 4px 42px; }
  .hero h1 { font-size: 56px; }
  .stepper { grid-template-columns: repeat(5, 1fr); }
  .stepper a { padding: 12px 6px; text-align: center; font-size: 0; }
  .stepper span { margin: 0; font-size: 11px; }
  .panel { padding: 24px 18px; }
  .panel-number { display: none; }
  .panel-heading h2 { font-size: 32px; }
  .search-form { align-items: stretch; flex-direction: column; }
  .art-toolbar, .art-toolbar-actions { align-items: stretch; flex-direction: column; }
  .art-toolbar { gap: 12px; }
  .art-toolbar-actions .field.compact { width: 100%; }
  .field.compact { width: 100%; }
  .result-grid { grid-template-columns: repeat(2, 1fr); }
  .form-grid, .ratings-grid, .source-grid { grid-template-columns: 1fr 1fr; }
  .span-2 { grid-column: span 2; }
  .poster-controls { grid-template-columns: 1fr; }
  .video-result { grid-template-columns: 1fr; }
  .release-filters, .library-toolbar, .library-fields { grid-template-columns: 1fr; }
  .library-fields.series-manual-date { grid-template-columns: 1fr; }
  .media-switch { width: 100%; }
  .media-switch button { min-width: 0; flex: 1; }
  .series-season-row { grid-template-columns: 42px 1fr; }
  .series-season-row time { grid-column: 2; }
  .release-grid { grid-template-columns: 1fr; }
  .quick-search-grid { grid-template-columns: 1fr; }
  .library-summary { padding: 16px; grid-template-columns: 1fr; gap: 16px; }
  .library-cover { width: min(190px, 70vw); justify-self: center; }
  .library-main { padding: 14px; }
  .import-row { grid-template-columns: 1fr; }
  .login-shell { padding: 14px; }
  .login-card { padding: 28px 22px; }
  .browser-challenge-overlay { padding: 0; }
  .browser-challenge-dialog { width: 100%; height: 100vh; padding: 12px; border: 0; border-radius: 0; }
}
.manual-release-fields {
  align-items: end;
}

.manual-date-button {
  min-height: 44px;
}

.title-link {
  color: inherit;
  text-decoration: none;
}

.title-link:hover {
  color: var(--accent);
}

.tmdb-link {
  width: fit-content;
  color: var(--muted);
  font-size: 12px;
  text-decoration: none;
}

.tmdb-link:hover {
  color: var(--accent);
}

.library-ratings {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
}

.rating-chip {
  min-width: 76px;
  padding: 7px 9px;
  display: inline-flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
  color: var(--text);
  border: 1px solid var(--line);
  border-radius: 9px;
  background: #20201d;
  font-size: 11px;
  text-decoration: none;
}

.rating-chip span { color: var(--muted); }
.rating-chip b { font-size: 13px; }
.rating-chip.tmdb b { color: var(--accent); }
.rating-chip.imdb b { color: #f5c518; }
.rating-chip.rt b { color: #ff766e; }
.rating-chip.kp b { color: #ffb34d; }
.rating-chip:not(.unavailable):hover { border-color: var(--accent); }
.rating-chip.unavailable { opacity: 0.55; }
.rating-chip.manual { box-shadow: inset 0 0 0 1px rgba(233, 255, 91, 0.35); }

.rating-link-tools { display: grid; gap: 10px; }
.rating-link-tools > .text-button { width: fit-content; }
.rating-link-editor {
  padding: 14px;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.025);
}
.rating-link-editor.hidden { display: none; }
.rating-link-actions {
  grid-column: 1 / -1;
  display: flex;
  gap: 8px;
}

@media (max-width: 680px) {
  .rating-link-editor { grid-template-columns: 1fr; }
}
