:root {
    color-scheme: dark;
    --ink: #f3f5ef;
    --muted: #9ca59d;
    --panel: #111815;
    --panel-2: #18211d;
    --line: #2c3832;
    --lime: #d8ff3e;
    --lime-ink: #10140c;
    --verified: #55d98d;
    --single: #ffc857;
    --conflict: #ff656d;
    --radius: 18px;
}

* { box-sizing: border-box; }

html { background: #080d0b; }

body {
    min-height: 100vh;
    margin: 0;
    color: var(--ink);
    background:
        radial-gradient(circle at 12% 0%, rgba(216, 255, 62, .09), transparent 26rem),
        #080d0b;
    font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

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

.topbar {
    width: min(1500px, calc(100% - 40px));
    margin: 0 auto;
    padding: 20px 0;
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-bottom: 1px solid var(--line);
}

.brand { display: flex; gap: 12px; align-items: center; color: inherit; text-decoration: none; }
.brand strong, .brand small { display: block; }
.brand strong { font-size: 15px; }
.brand small { margin-top: 2px; color: var(--muted); font-size: 9px; font-weight: 800; letter-spacing: .19em; }
.brand-mark { display: grid; width: 42px; aspect-ratio: 1; place-items: center; background: var(--lime); color: var(--lime-ink); border-radius: 50%; font-size: 13px; font-weight: 950; letter-spacing: -.05em; }

.workspace { width: min(1500px, calc(100% - 40px)); margin: 0 auto; padding: 60px 0 90px; }
.intro { display: grid; grid-template-columns: minmax(0, 1.25fr) minmax(260px, .75fr); align-items: end; gap: 56px; margin-bottom: 48px; }
.intro h1 { max-width: 800px; margin: 0; font-size: clamp(47px, 6.4vw, 98px); line-height: .86; letter-spacing: -.075em; text-transform: uppercase; }
.intro h1 span { color: var(--lime); }
.intro-copy { max-width: 520px; margin: 0; color: #b9c0ba; font-size: 16px; line-height: 1.65; }
.eyebrow { margin: 0 0 12px; color: var(--lime); font-size: 11px; font-weight: 900; letter-spacing: .2em; text-transform: uppercase; }

.control-strip { display: grid; grid-template-columns: minmax(190px, 260px) auto 1fr; gap: 14px; align-items: end; padding: 20px; background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); }
.field { display: grid; gap: 7px; }
.field label, .login-form label { color: #c3cac4; font-size: 11px; font-weight: 800; letter-spacing: .1em; text-transform: uppercase; }
input[type="date"], input[type="text"], input[type="password"], select { width: 100%; min-width: 0; padding: 12px 13px; color: var(--ink); background: #0b110e; border: 1px solid #36433c; border-radius: 9px; outline: 0; }
input:focus { border-color: var(--lime); box-shadow: 0 0 0 3px rgba(216, 255, 62, .12); }
select:focus { border-color: var(--lime); box-shadow: 0 0 0 3px rgba(216, 255, 62, .12); }
.load-status { align-self: center; justify-self: end; color: var(--muted); font-size: 13px; text-align: right; }

.button { min-height: 42px; padding: 10px 16px; border: 1px solid transparent; border-radius: 9px; cursor: pointer; font-weight: 850; transition: transform .15s ease, border-color .15s ease, background .15s ease; }
.button:hover:not(:disabled) { transform: translateY(-1px); }
.button:disabled { cursor: not-allowed; opacity: .42; }
.button--primary { background: var(--lime); color: var(--lime-ink); }
.button--secondary { background: #202b25; border-color: #39473f; color: var(--ink); }
.button--ghost { background: transparent; border-color: var(--line); color: #c4cbc5; }
.button--pack { background: linear-gradient(110deg, var(--lime), #8cffbd); color: var(--lime-ink); box-shadow: 0 8px 28px rgba(216, 255, 62, .12); }
.button--wide { width: 100%; margin-top: 12px; }
.text-button { padding: 3px; background: transparent; border: 0; color: var(--lime); cursor: pointer; font-size: 12px; font-weight: 800; }

.source-summary { margin-top: 14px; padding: 14px 18px; background: rgba(216, 255, 62, .045); border: 1px solid rgba(216, 255, 62, .16); border-radius: 12px; color: #bec7bf; font-size: 13px; line-height: 1.5; }
.source-summary strong { color: var(--ink); }
.source-summary .summary-conflict { color: var(--conflict); }

.competition-filter { margin-top: 14px; padding: 22px; background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); }
.competition-filter__heading { display: flex; align-items: end; justify-content: space-between; gap: 18px; margin-bottom: 16px; }
.competition-filter__heading h2 { margin: 0; font-size: 22px; letter-spacing: -.04em; }
.competition-options { display: flex; flex-wrap: wrap; gap: 9px; }
.competition-option { display: inline-flex; align-items: center; gap: 8px; padding: 10px 13px; color: #b9c2bb; background: #0b110e; border: 1px solid #344139; border-radius: 999px; cursor: pointer; font-size: 12px; font-weight: 800; transition: border-color .15s ease, background .15s ease, color .15s ease; }
.competition-option:hover { border-color: #66746b; }
.competition-option:has(input:checked) { color: var(--lime-ink); background: var(--lime); border-color: var(--lime); }
.competition-option input { width: 15px; height: 15px; margin: 0; accent-color: #10140c; }
.competition-option small { opacity: .7; font-size: 10px; }
.competition-help { margin: 13px 0 0; color: var(--muted); font-size: 12px; }

.studio-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(390px, .82fr); gap: 22px; align-items: start; margin-top: 22px; }
.fixture-panel, .poster-panel { padding: 24px; background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); }
.poster-panel { position: sticky; top: 18px; }
.panel-heading { display: flex; justify-content: space-between; align-items: flex-end; gap: 18px; margin-bottom: 20px; }
.panel-heading h2 { margin: 0; font-size: 25px; letter-spacing: -.045em; }
.compact-actions { display: flex; gap: 12px; }
.page-count { padding: 6px 9px; color: #bfc7c1; background: #202a25; border-radius: 999px; font-size: 11px; font-weight: 800; }
.confidence-legend { display: flex; flex-wrap: wrap; gap: 13px; margin-bottom: 17px; color: var(--muted); font-size: 11px; }
.confidence-legend span { display: inline-flex; align-items: center; gap: 6px; }
.dot { display: inline-block; width: 7px; height: 7px; border-radius: 50%; }
.dot--verified { background: var(--verified); }
.dot--single { background: var(--single); }
.dot--conflict { background: var(--conflict); }

.competition-group + .competition-group { margin-top: 24px; }
.competition-heading { display: flex; align-items: center; gap: 10px; margin: 0 0 9px; color: #aeb7af; font-size: 11px; font-weight: 900; letter-spacing: .13em; text-transform: uppercase; }
.competition-heading::after { height: 1px; flex: 1; background: var(--line); content: ""; }
.fixture-card { display: grid; grid-template-columns: 25px 74px minmax(150px, 1.45fr) minmax(110px, .9fr) 33px; gap: 9px; align-items: start; padding: 12px; background: #0c120f; border: 1px solid #26312c; border-left: 3px solid var(--single); border-radius: 11px; }
.fixture-card + .fixture-card { margin-top: 8px; }
.fixture-card[data-confidence="verified"] { border-left-color: var(--verified); }
.fixture-card[data-confidence="conflict"] { border-left-color: var(--conflict); }
.fixture-card input[type="text"] { padding: 9px 10px; font-size: 13px; }
.fixture-card .time-input { text-align: center; font-weight: 900; }
.fixture-select { display: grid; padding-top: 10px; place-items: center; }
.fixture-select input { width: 16px; height: 16px; accent-color: var(--lime); }
.input-stack { display: grid; gap: 7px; }
.fixture-meta { display: flex; flex-wrap: wrap; gap: 6px; grid-column: 2 / -1; align-items: center; color: var(--muted); font-size: 10px; }
.confidence-chip { padding: 4px 7px; border-radius: 999px; background: rgba(255, 200, 87, .1); color: var(--single); font-weight: 850; text-transform: uppercase; }
.confidence-chip--verified { background: rgba(85, 217, 141, .1); color: var(--verified); }
.confidence-chip--conflict { background: rgba(255, 101, 109, .1); color: var(--conflict); }
.issue-text { color: #c8a2a4; }
.delete-fixture { width: 32px; height: 32px; margin-top: 2px; background: transparent; border: 1px solid #35413b; border-radius: 8px; color: #909a93; cursor: pointer; }
.delete-fixture:hover { border-color: var(--conflict); color: var(--conflict); }
.empty-state { padding: 45px 20px; border: 1px dashed #35413b; border-radius: 12px; color: var(--muted); text-align: center; }

.title-field { margin-bottom: 15px; }
.poster-output-controls { display: grid; grid-template-columns: minmax(0, 1fr) minmax(190px, auto); gap: 10px; align-items: end; margin-bottom: 12px; }
.cover-option { min-height: 43px; display: flex; gap: 10px; align-items: center; padding: 8px 11px; color: #c3cac4; background: #0b110e; border: 1px solid #36433c; border-radius: 9px; cursor: pointer; }
.cover-option input { width: 17px; height: 17px; flex: 0 0 auto; accent-color: var(--lime); }
.cover-option span, .cover-option strong, .cover-option small { display: block; }
.cover-option strong { font-size: 11px; letter-spacing: .02em; }
.cover-option small { margin-top: 2px; color: var(--muted); font-size: 9px; }
.brand-kit { margin-bottom: 12px; background: #0b110e; border: 1px solid #303c35; border-radius: 11px; }
.brand-kit[open] { border-color: #46554c; }
.brand-kit summary { display: flex; align-items: center; justify-content: space-between; padding: 12px 13px; cursor: pointer; list-style: none; }
.brand-kit summary::-webkit-details-marker { display: none; }
.brand-kit summary::after { color: var(--lime); content: "+"; font-size: 20px; font-weight: 500; line-height: 1; }
.brand-kit[open] summary::after { content: "−"; }
.brand-kit summary span, .brand-kit summary strong, .brand-kit summary small { display: block; }
.brand-kit summary strong { font-size: 12px; }
.brand-kit summary small { margin-top: 2px; color: var(--muted); font-size: 10px; font-weight: 500; }
.brand-kit-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; padding: 0 13px 12px; }
.brand-logo-actions { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; padding: 0 13px 13px; }
.brand-logo-actions input[type="file"] { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); clip-path: inset(50%); white-space: nowrap; }
.brand-logo-actions .button { min-height: 36px; padding: 8px 11px; font-size: 11px; }
.upload-button { display: inline-grid; place-items: center; }
#brand-status { min-width: 120px; flex: 1; color: var(--muted); font-size: 10px; text-align: right; }
.poster-colour-controls { display: grid; grid-template-columns: minmax(145px, 1fr) repeat(3, auto); gap: 9px; align-items: end; margin-bottom: 15px; }
.colour-field { display: grid; gap: 7px; color: #c3cac4; font-size: 10px; font-weight: 800; letter-spacing: .08em; text-align: center; text-transform: uppercase; }
.colour-field input[type="color"] { width: 48px; height: 43px; padding: 4px; background: #0b110e; border: 1px solid #36433c; border-radius: 9px; cursor: pointer; }
.colour-field input[type="color"]::-webkit-color-swatch-wrapper { padding: 0; }
.colour-field input[type="color"]::-webkit-color-swatch { border: 0; border-radius: 5px; }
.colour-field input[type="color"]::-moz-color-swatch { border: 0; border-radius: 5px; }
.canvas-shell { min-height: 220px; display: grid; overflow: hidden; padding: 8px; place-items: center; background: #060907; border: 1px solid var(--line); border-radius: 13px; }
canvas { display: block; width: auto; max-width: 100%; max-height: min(74vh, 780px); background: #0a100d; border-radius: 8px; }
.poster-nav { display: grid; grid-template-columns: 1fr auto 1fr; gap: 12px; align-items: center; margin-top: 13px; }
.poster-nav .button:last-child { justify-self: end; }
#page-label { color: var(--muted); font-size: 12px; }
.download-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 10px; }
.button--span { grid-column: 1 / -1; }
.privacy-note { margin: 14px 0 0; color: #7f8b82; font-size: 11px; line-height: 1.5; text-align: center; }

.auth-shell { min-height: 100vh; display: grid; padding: 24px; place-items: center; }
.auth-card { width: min(440px, 100%); padding: 34px; background: var(--panel); border: 1px solid var(--line); border-radius: 22px; box-shadow: 0 35px 100px rgba(0, 0, 0, .45); }
.auth-card .brand-mark { margin-bottom: 28px; }
.auth-card h1 { margin: 0 0 13px; font-size: 38px; letter-spacing: -.06em; }
.auth-card p { color: #b2bab4; line-height: 1.6; }
.auth-card code { color: var(--lime); }
.login-form { display: grid; gap: 9px; margin-top: 25px; }
.login-form .button { margin-top: 8px; }
.muted { color: var(--muted) !important; font-size: 13px; }
.notice { margin: 18px 0; padding: 11px 12px; border-radius: 8px; font-size: 13px; }
.notice--error { background: rgba(255, 101, 109, .1); border: 1px solid rgba(255, 101, 109, .35); color: #ffafb3; }

@media (max-width: 980px) {
    .intro { grid-template-columns: 1fr; gap: 22px; }
    .studio-grid { grid-template-columns: 1fr; }
    .poster-panel { position: static; }
}

@media (max-width: 670px) {
    .topbar, .workspace { width: min(100% - 24px, 1500px); }
    .workspace { padding-top: 40px; }
    .intro h1 { font-size: clamp(42px, 14vw, 68px); }
    .control-strip { grid-template-columns: 1fr; }
    .load-status { justify-self: start; text-align: left; }
    .fixture-panel, .poster-panel { padding: 17px; }
    .competition-filter { padding: 17px; }
    .competition-filter__heading { align-items: start; flex-direction: column; }
    .fixture-card { grid-template-columns: 24px 66px 1fr 32px; }
    .fixture-card .channel-stack { grid-column: 3 / 5; }
    .fixture-meta { grid-column: 2 / -1; }
    .download-actions { grid-template-columns: 1fr; }
    .button--span { grid-column: auto; }
    .poster-output-controls, .brand-kit-grid { grid-template-columns: 1fr; }
    #brand-status { flex-basis: 100%; text-align: left; }
    .poster-colour-controls { grid-template-columns: 1fr repeat(3, auto); }
    .theme-field { grid-column: 1 / -1; }
    .poster-nav .button { padding-inline: 9px; font-size: 12px; }
}
