:root {
    --navy: #00263d;
    --navy-2: #00324d;
    --panel: #003d5c;
    --line: #0078b8;
    --ford: #0078b8;
    --ink: #e8eef7;
    --muted: #8ab4c8;
    --amber: #f84010;
    --gold: #ffc94a;
    --danger: #d64545;
    --ok: #43b849;
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
    margin: 0;
    color: var(--ink);
    background:
        radial-gradient(1200px 500px at 80% -10%, rgba(26, 115, 199, 0.18), transparent 50%),
        var(--navy);
    font-family: "IBM Plex Sans", sans-serif;
}

h1, h2, .brand-ford, .brand-oto {
    font-family: "Barlow Condensed", sans-serif;
    letter-spacing: 0.04em;
    margin: 0;
}

a { color: inherit; }

.shell {
    min-height: 100%;
    display: grid;
    grid-template-columns: 260px 1fr;
}

.rail {
    background: linear-gradient(180deg, #00324d, #00263d);
    border-right: 1px solid var(--line);
    padding: 28px 20px;
    display: flex;
    flex-direction: column;
    gap: 28px;
}

.brand-block { display: flex; flex-wrap: wrap; gap: 6px; align-items: baseline; }
.brand-ford { font-size: 34px; font-weight: 800; color: #0078b8; }
.brand-oto { font-size: 34px; font-weight: 700; color: #f84010; }
.brand-block em {
    width: 100%;
    font-style: normal;
    color: var(--amber);
    font-family: "IBM Plex Mono", monospace;
    font-size: 12px;
    letter-spacing: 0.18em;
    text-transform: uppercase;
}

.rail nav { display: flex; flex-direction: column; gap: 6px; }
.rail nav a {
    text-decoration: none;
    padding: 10px 12px;
    border: 1px solid transparent;
    color: var(--muted);
}
.rail nav a.active, .rail nav a:hover {
    color: white;
    background: rgba(26, 115, 199, 0.16);
    border-color: var(--line);
}

.logout-form button, button {
    font: inherit;
    cursor: pointer;
}

.logout-form {
    margin-top: auto;
}
.logout-form button {
    width: 100%;
    margin-top: auto;
    background: transparent;
    color: var(--muted);
    border: 1px solid var(--line);
    padding: 10px;
}

.workspace { min-width: 0; }
.hazard {
    height: 10px;
    background: repeating-linear-gradient(
        -45deg,
        #111 0 12px,
        var(--amber) 12px 24px
    );
}
.workspace-body { padding: 32px 40px 60px; }

.page-head {
    display: flex;
    justify-content: space-between;
    align-items: end;
    margin-bottom: 28px;
    gap: 16px;
}
.eyebrow {
    margin: 0 0 6px;
    text-transform: uppercase;
    letter-spacing: 0.2em;
    font-size: 11px;
    color: var(--amber);
    font-family: "IBM Plex Mono", monospace;
}
h1 { font-size: 46px; font-weight: 800; }

.metrics {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 16px;
    margin-bottom: 24px;
}
.metrics article {
    background: var(--panel);
    border: 1px solid var(--line);
    padding: 18px 20px;
}
.metrics span, .metrics em { color: var(--muted); font-size: 12px; }
.metrics strong {
    display: block;
    font-family: "IBM Plex Mono", monospace;
    font-size: 42px;
    line-height: 1.1;
    margin: 8px 0 4px;
}
.metrics .live strong { color: var(--ok); }
.metrics .offline strong { color: var(--danger); }

.split { display: grid; grid-template-columns: 1.2fr 0.8fr; gap: 16px; }
.panel {
    background: var(--panel);
    border: 1px solid var(--line);
    padding: 20px;
}
.panel header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 16px; }
.panel h2 { font-size: 22px; }

.bars, .feed { list-style: none; margin: 0; padding: 0; display: grid; gap: 14px; }
.bar-meta { display: flex; gap: 10px; align-items: center; margin-bottom: 6px; }
.bar-meta i, .feed i, .swatch {
    width: 12px; height: 12px; display: inline-block; border-radius: 99px;
}
.bar-meta span, .bar-meta small { margin-left: auto; color: var(--muted); font-family: "IBM Plex Mono", monospace; font-size: 12px; }
.bar-meta small { margin-left: 10px; }
.bar { height: 8px; background: #0a1a30; }
.bar span { display: block; height: 100%; }

.feed li { display: flex; gap: 12px; align-items: center; }
.feed small { display: block; color: var(--muted); }

.grid {
    width: 100%;
    border-collapse: collapse;
    background: var(--panel);
    border: 1px solid var(--line);
}
.grid th, .grid td {
    text-align: left;
    padding: 12px 14px;
    border-bottom: 1px solid rgba(31, 77, 122, 0.6);
}
.grid th { color: var(--muted); font-weight: 500; font-size: 12px; letter-spacing: 0.08em; text-transform: uppercase; }
.actions { display: flex; gap: 8px; }

.chance-row td { background: rgba(31, 77, 122, 0.12); }
.chance-flags { display: flex; gap: 18px; margin-bottom: 10px; font-size: 13px; }
.chance-table { max-width: 520px; margin: 0; }
.chance-table td, .chance-table th { padding: 8px 12px; }

button.primary, button.ghost, button.danger, .spin-btn {
    border: 1px solid var(--line);
    padding: 10px 14px;
    color: white;
}
button.primary { background: var(--ford); border-color: var(--ford); }
button.ghost { background: transparent; }
button.danger { background: transparent; color: #ff9b9b; border-color: #6a2b2b; }
.spin-btn {
    background: var(--amber);
    border-color: var(--amber);
    color: #1a1000;
    font-family: "Barlow Condensed", sans-serif;
    font-size: 32px;
    font-weight: 800;
    letter-spacing: 0.08em;
    padding: 18px 28px;
}

.drawer, .form-grid, .remote {
    margin-top: 20px;
    display: grid;
    gap: 12px;
    max-width: 520px;
}
.form-grid { max-width: 720px; grid-template-columns: 1fr 1fr; }
.form-grid .row-actions, .form-grid .flash, .form-grid .full, .form-grid header { grid-column: 1 / -1; }
.rules-panel { margin: 0 0 20px; }
.logos-panel { max-width: 760px; margin-bottom: 20px; display: grid; gap: 16px; }
.logos-panel header span { color: var(--muted); font-size: 13px; }
.kiosk-preview {
    background: #fff;
    min-height: 96px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 28px;
    padding: 18px 40px;
}
.kiosk-preview img { max-height: 56px; max-width: 42%; object-fit: contain; }
.preview-ford { font-family: "Barlow Condensed", sans-serif; font-size: 36px; color: #1c4b8f; }
.preview-oto { font-family: "Barlow Condensed", sans-serif; font-size: 36px; color: #8a9bb0; }
.logo-slots { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.logo-card {
    border: 1px dashed var(--line);
    padding: 16px;
    display: grid;
    gap: 10px;
    justify-items: start;
    min-height: 180px;
}
.logo-card p { margin: 0; text-transform: uppercase; letter-spacing: 0.12em; font-size: 11px; color: var(--amber); font-family: "IBM Plex Mono", monospace; }
.logo-card img { max-height: 72px; max-width: 100%; object-fit: contain; background: #fff; padding: 8px; }
.logo-card em { color: var(--muted); font-style: normal; }
.file-btn {
    position: relative;
    overflow: hidden;
    background: var(--ford);
    color: #fff;
    padding: 8px 12px;
    cursor: pointer;
    display: inline-block;
}
.file-btn input { position: absolute; inset: 0; opacity: 0; cursor: pointer; }
label { display: grid; gap: 6px; color: var(--muted); font-size: 13px; }
input, select {
    background: #071428;
    border: 1px solid var(--line);
    color: white;
    padding: 10px 12px;
    font: inherit;
}
.check { display: flex; align-items: center; gap: 8px; }
.row-actions { display: flex; gap: 8px; }
.flash { color: #b7f0c0; }
.empty { color: var(--muted); }
.error { color: #ff9b9b; }

.login-stage {
    min-height: 100vh;
    display: grid;
    place-items: center;
    background:
        repeating-linear-gradient(-45deg, transparent 0 18px, rgba(248, 64, 16, 0.08) 18px 20px),
        radial-gradient(800px 400px at 50% 0%, rgba(0, 120, 184, 0.25), var(--navy));
}
.login-card {
    width: min(420px, 92vw);
    background: var(--panel);
    border: 1px solid var(--line);
    padding: 36px 32px;
    display: grid;
    gap: 14px;
}
.login-card h1 { font-size: 54px; }
.lede { margin: 0 0 10px; color: var(--muted); }
.login-card form { display: grid; gap: 12px; }
.login-card button { background: var(--ford); color: white; border: 0; padding: 12px; font-weight: 600; }
.hint { color: var(--muted); font-size: 12px; }

.remote { max-width: 640px; }
.kiosk-status { display: flex; gap: 10px; align-items: baseline; }
.kiosk-status strong { font-size: 48px; font-family: "IBM Plex Mono", monospace; }

#blazor-error-ui {
    display: none;
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    padding: 12px 16px;
    background: #4a1c1c;
}
#blazor-error-ui.show { display: block; }

.play-stage {
    min-height: 100vh;
    display: grid;
    justify-items: center;
    align-content: start;
    gap: 18px;
    padding: 28px 16px 60px;
    text-align: center;
    background:
        repeating-linear-gradient(-45deg, transparent 0 18px, rgba(248, 64, 16, 0.08) 18px 20px),
        radial-gradient(900px 500px at 50% 0%, rgba(0, 120, 184, 0.25), var(--navy));
}
.play-head { display: flex; gap: 18px; align-items: center; justify-content: center; }
.play-head img { max-height: 56px; max-width: 180px; object-fit: contain; }
.play-title { font-size: 34px; line-height: 1.15; }
.play-title span { display: block; color: var(--amber); }

.wheel-shell {
    position: relative;
    width: min(420px, 86vw);
    aspect-ratio: 1;
    margin: 10px 0;
}
.wheel-pointer {
    position: absolute;
    top: -6px;
    left: 50%;
    transform: translateX(-50%);
    width: 0;
    height: 0;
    border-left: 16px solid transparent;
    border-right: 16px solid transparent;
    border-top: 26px solid var(--amber);
    z-index: 3;
}
.wheel {
    width: 100%;
    height: 100%;
    border-radius: 50%;
    border: 6px solid var(--ford);
    transition: transform 4.5s cubic-bezier(0.14, 0.83, 0.2, 1);
    box-shadow: 0 0 0 6px rgba(0, 38, 61, 0.6);
}
.wheel svg { width: 100%; height: 100%; display: block; }
.wheel text {
    fill: white;
    font-family: "Barlow Condensed", sans-serif;
    font-size: 15px;
    font-weight: 700;
}
.wheel-hub {
    position: absolute;
    top: 50%;
    left: 50%;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: var(--amber);
    border: 3px solid var(--navy);
    transform: translate(-50%, -50%);
    z-index: 3;
}

.play-panel {
    min-height: 96px;
    width: min(460px, 92vw);
    display: grid;
    gap: 14px;
    justify-items: center;
    background: var(--panel);
    border: 1px solid var(--line);
    padding: 26px 28px;
    box-shadow: 0 18px 40px -20px rgba(0, 0, 0, 0.6);
}
.play-hint { margin: 0; color: var(--muted); font-family: "IBM Plex Mono", monospace; font-size: 13px; letter-spacing: 0.04em; }
.play-hint-spinning {
    color: var(--amber);
    text-transform: uppercase;
    letter-spacing: 0.2em;
    animation: pulse-hint 1s ease-in-out infinite;
}
@keyframes pulse-hint {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.45; }
}
.play-form { display: grid; gap: 8px; width: 100%; }
.play-form-label {
    justify-self: start;
    color: var(--amber);
    font-family: "IBM Plex Mono", monospace;
    font-size: 11px;
    letter-spacing: 0.2em;
    text-transform: uppercase;
}
.play-form-row { display: flex; gap: 10px; }
.play-form input {
    flex: 1;
    min-width: 0;
    text-align: center;
    font-size: 17px;
    letter-spacing: 0.06em;
    background: #071428;
    border: 1px solid var(--line);
}
.play-form input:focus {
    outline: none;
    border-color: var(--amber);
    box-shadow: 0 0 0 3px rgba(248, 64, 16, 0.22);
}
.play-form input::placeholder { color: #4d7188; font-size: 13px; letter-spacing: 0.02em; }
.spin-btn:disabled { opacity: 0.45; cursor: not-allowed; }
.play-result h2 { font-size: 40px; color: var(--amber); }
.play-result-label { margin: 0; color: var(--muted); text-transform: uppercase; letter-spacing: 0.2em; font-size: 12px; }
.play-active-name {
    margin: 0 0 4px;
    color: var(--gold);
    font-weight: 700;
    font-size: 20px;
    letter-spacing: 0.02em;
}

.winners-rail {
    position: fixed;
    left: 24px;
    top: 50%;
    transform: translateY(-50%);
    width: 220px;
    max-height: 70vh;
    overflow: hidden;
    background: var(--panel);
    border: 1px solid var(--line);
    padding: 16px 18px;
}
.winners-rail h2 {
    margin: 0 0 12px;
    font-size: 13px;
    color: var(--muted);
    text-transform: uppercase;
    letter-spacing: 0.16em;
    font-family: "IBM Plex Mono", monospace;
    font-weight: 500;
}
.winners-rail ol {
    list-style: none;
    margin: 0;
    padding: 0;
    display: grid;
    gap: 10px;
}
.winners-rail li {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    padding-bottom: 10px;
    border-bottom: 1px solid rgba(31, 77, 122, 0.5);
}
.winners-rail li:last-child { border-bottom: 0; padding-bottom: 0; }
.winners-rail i { width: 10px; height: 10px; margin-top: 4px; flex: none; border-radius: 99px; }
.winner-info { display: grid; gap: 2px; min-width: 0; }
.winner-name { font-weight: 600; font-size: 14px; }
.winner-code {
    margin-left: 6px;
    color: var(--muted);
    font-family: "IBM Plex Mono", monospace;
    font-weight: 400;
    font-size: 11px;
}
.winner-prize {
    color: var(--muted);
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

@media (max-width: 1200px) {
    .winners-rail { display: none; }
}

.marquee {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    height: 36px;
    background: var(--ford);
    overflow: hidden;
    z-index: 4;
}
.marquee-track {
    display: flex;
    width: max-content;
    height: 100%;
    animation: marquee-scroll 22s linear infinite;
}
.marquee-track span {
    display: flex;
    align-items: center;
    white-space: nowrap;
    color: white;
    font-weight: 700;
    font-family: "Barlow Condensed", sans-serif;
    letter-spacing: 0.04em;
    font-size: 16px;
    padding-right: 0;
}
@keyframes marquee-scroll {
    from { transform: translateX(0); }
    to { transform: translateX(-50%); }
}

.confetti {
    position: fixed;
    inset: 0;
    overflow: hidden;
    pointer-events: none;
    z-index: 5;
}
.confetti span {
    position: absolute;
    top: -20px;
    width: 8px;
    height: 14px;
    animation: confetti-fall 2.6s linear infinite;
}
@keyframes confetti-fall {
    to { transform: translateY(110vh) rotate(360deg); }
}

@media (max-width: 980px) {
    .shell { grid-template-columns: 1fr; }
    .metrics, .split, .form-grid, .logo-slots { grid-template-columns: 1fr; }
    .rail { border-right: 0; border-bottom: 1px solid var(--line); }
}
@media (max-width: 1400px) {
    .metrics { grid-template-columns: repeat(3, 1fr); }
}
