:root {
    --blue-950: #031848;
    --blue-900: #05266f;
    --blue-700: #075fd4;
    --blue-500: #08a9f4;
    --cyan: #27d8ff;
    --red: #e4142d;
    --red-dark: #9f0d23;
    --gold: #ffd83d;
    --gold-deep: #e39a00;
    --ink: #17233e;
    --muted: #64708a;
    --surface: #ffffff;
    --page: #f3f7ff;
    --line: #dbe5f4;
    --shadow: 0 18px 50px rgba(4, 33, 94, .13);
}

* { box-sizing: border-box; }
html { min-height: 100%; }
body { margin: 0; min-height: 100vh; font-family: Inter, ui-rounded, "Avenir Next", system-ui, -apple-system, sans-serif; color: var(--ink); background: var(--page); }
button, input, select { font: inherit; }
button, select { cursor: pointer; }
button:focus-visible, input:focus-visible, select:focus-visible, summary:focus-visible { outline: 3px solid rgba(8, 169, 244, .35); outline-offset: 2px; }
.eyebrow { margin: 0 0 7px; color: var(--blue-700); font-size: .72rem; font-weight: 900; letter-spacing: .15em; text-transform: uppercase; }

.login-page { overflow-x: hidden; background: var(--blue-950); }
.login-page::before { content: ""; position: fixed; inset: 0; background: radial-gradient(circle at 15% 12%, rgba(39,216,255,.5), transparent 24%), radial-gradient(circle at 86% 80%, rgba(7,95,212,.9), transparent 38%), repeating-conic-gradient(from 210deg at 30% 50%, rgba(255,255,255,.07) 0deg 9deg, transparent 9deg 22deg), linear-gradient(135deg, #041853 0%, #006de2 56%, #00b8ed 100%); }
.login-shell { position: relative; min-height: 100vh; display: grid; grid-template-columns: minmax(0, 1fr) minmax(360px, 510px); align-items: center; gap: clamp(40px, 7vw, 120px); max-width: 1240px; padding: 70px 42px; margin: auto; }
.login-brand { color: white; display: flex; align-items: center; gap: clamp(26px, 4vw, 54px); }
.login-brand .eyebrow { color: var(--gold); }
.login-brand h1 { margin: 0; font-size: clamp(3rem, 6vw, 5.8rem); line-height: .9; letter-spacing: -.07em; text-shadow: 0 5px 0 rgba(0,32,110,.45); }
.login-brand p:last-child { max-width: 570px; margin: 25px 0 0; color: #d7f5ff; font-size: clamp(1rem, 1.5vw, 1.25rem); line-height: 1.7; }
.login-icon { width: clamp(145px, 18vw, 235px); border-radius: 25%; box-shadow: 0 28px 55px rgba(0,0,0,.35), 0 0 0 4px rgba(255,216,61,.75); transform: rotate(-4deg); }
.login-card { position: relative; padding: 50px 46px 44px; background: linear-gradient(#fff, #f8fbff); border: 4px solid var(--gold); border-radius: 28px; box-shadow: 0 30px 75px rgba(1,14,55,.45), inset 0 0 0 2px #fff; }
.login-card::before { content: ""; position: absolute; top: 15px; right: 18px; left: 18px; height: 6px; border-top: 2px dashed rgba(227,154,0,.5); }
.login-card h2 { margin: 0; color: var(--blue-950); font-size: 2rem; letter-spacing: -.04em; }
.login-help { color: var(--muted); line-height: 1.55; }
.mini-coin { position: absolute; right: 30px; top: 32px; display: grid; place-items: center; width: 48px; height: 48px; color: #9d5200; border: 4px solid #ef9d00; border-radius: 50%; background: radial-gradient(circle at 35% 30%, #fff88d, #ffc20d 55%, #d87800); box-shadow: 0 6px 12px rgba(160,95,0,.25); }
.ticket-notch { position: absolute; top: 47%; width: 28px; height: 56px; background: #0459bd; border-radius: 50%; }
.ticket-notch-left { left: -18px; }
.ticket-notch-right { right: -18px; }
.login-form { display: grid; gap: 17px; margin-top: 30px; }
.login-form label, .filters label { color: var(--ink); font-size: .78rem; font-weight: 800; }
.login-form input { display: block; width: 100%; margin-top: 7px; padding: 14px 15px; color: var(--ink); border: 1px solid #cbd8eb; border-radius: 12px; background: #f9fbff; }
.primary-button { display: flex; justify-content: space-between; align-items: center; margin-top: 8px; padding: 16px 20px; color: #fff; font-weight: 900; border: 0; border-radius: 12px; background: linear-gradient(135deg, var(--red), #ff3b2e); box-shadow: 0 9px 20px rgba(228,20,45,.25); }
.primary-button:hover { transform: translateY(-1px); }
.alert { padding: 12px 14px; color: #8d1020; font-size: .88rem; font-weight: 700; border: 1px solid #ffc2ca; border-radius: 10px; background: #fff0f2; }

.app-shell { min-height: 100vh; display: grid; grid-template-columns: 260px minmax(0, 1fr); }
.sidebar { position: sticky; top: 0; height: 100vh; display: flex; flex-direction: column; padding: 26px 18px 22px; color: white; background: radial-gradient(circle at 20% 3%, rgba(39,216,255,.35), transparent 22%), linear-gradient(170deg, #063b9a, #031848 68%); box-shadow: 8px 0 30px rgba(3,24,72,.12); z-index: 5; }
.sidebar-brand { display: flex; align-items: center; gap: 12px; padding: 0 8px 28px; color: white; text-decoration: none; }
.sidebar-brand img { width: 54px; height: 54px; border: 2px solid var(--gold); border-radius: 15px; box-shadow: 0 8px 16px rgba(0,0,0,.22); }
.sidebar-brand strong, .sidebar-brand small { display: block; }
.sidebar-brand strong { font-size: 1.05rem; }
.sidebar-brand small { margin-top: 2px; color: #9edcff; font-size: .72rem; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; }
.sidebar nav { display: grid; gap: 7px; }
.nav-link { display: flex; align-items: center; gap: 12px; width: 100%; padding: 13px 14px; color: #cfe7ff; font-weight: 750; text-align: left; border: 1px solid transparent; border-radius: 12px; background: transparent; }
.nav-link span { display: grid; place-items: center; width: 27px; height: 27px; color: var(--gold); border: 1px solid rgba(255,216,61,.35); border-radius: 8px; background: rgba(255,216,61,.1); }
.nav-link:hover, .nav-link.is-active { color: white; border-color: rgba(255,255,255,.14); background: linear-gradient(90deg, rgba(8,169,244,.3), rgba(255,255,255,.08)); }
.nav-link.is-active::after { content: ""; width: 5px; height: 24px; margin-left: auto; border-radius: 8px; background: var(--gold); }
.sidebar-footer { margin-top: auto; padding: 18px 10px 0; color: #9edcff; font-size: .76rem; font-weight: 750; border-top: 1px solid rgba(255,255,255,.12); }
.live-dot { display: inline-block; width: 8px; height: 8px; margin-right: 7px; border-radius: 50%; background: #44ef9b; box-shadow: 0 0 0 4px rgba(68,239,155,.12); }
.logout-button { margin-top: 15px; padding: 0; color: white; font-weight: 800; border: 0; background: none; }
.logout-button:hover { color: var(--gold); }

.dashboard { min-width: 0; padding: 36px clamp(22px, 4vw, 58px) 70px; }
.topbar { display: flex; align-items: flex-end; justify-content: space-between; gap: 30px; margin-bottom: 26px; }
.topbar h1 { margin: 0; color: var(--blue-950); font-size: clamp(1.9rem, 3vw, 2.7rem); letter-spacing: -.05em; }
.filters { display: flex; align-items: flex-end; gap: 10px; padding: 10px; border: 1px solid var(--line); border-radius: 15px; background: white; box-shadow: 0 8px 28px rgba(4,33,94,.06); }
.filters label { color: var(--muted); }
.filters input, .filters select { display: block; min-width: 135px; margin-top: 4px; padding: 8px 10px; color: var(--ink); border: 1px solid var(--line); border-radius: 8px; background: #f8fbff; }
.filters select { min-width: 210px; }
.filter-button { padding: 10px 15px; color: white; font-weight: 850; border: 0; border-radius: 9px; background: var(--blue-700); }
.status { display: none; margin-bottom: 18px; padding: 13px 16px; color: var(--blue-900); border: 1px solid #b9dafa; border-radius: 12px; background: #eaf6ff; }
.status.is-visible { display: block; }
.status.is-error { color: #8d1020; border-color: #ffc2ca; background: #fff0f2; }
.panel { display: none; }
.panel.is-active { display: block; animation: panel-in .22s ease-out; }
@keyframes panel-in { from { opacity: 0; transform: translateY(5px); } }

.game-hero { position: relative; overflow: hidden; display: flex; align-items: center; justify-content: space-between; gap: 24px; margin-bottom: 20px; padding: 27px 31px; color: white; border: 2px solid rgba(255,216,61,.55); border-radius: 22px; background: repeating-conic-gradient(from 270deg at 90% 50%, rgba(255,255,255,.08) 0 7deg, transparent 7deg 16deg), linear-gradient(115deg, var(--blue-900), var(--blue-700) 65%, #09aeea); box-shadow: var(--shadow); }
.game-hero::after { content: "★"; position: absolute; right: 4%; top: -28%; color: rgba(255,216,61,.17); font-size: 12rem; transform: rotate(12deg); }
.game-hero h2 { margin: 0 0 6px; font-size: clamp(1.5rem, 3vw, 2.35rem); letter-spacing: -.04em; }
.game-hero p { margin: 0; color: #cceeff; }
.hero-badge { position: relative; z-index: 1; min-width: 190px; padding: 14px 18px; color: var(--blue-950); font-weight: 900; text-align: center; border: 3px solid #e69b00; border-radius: 14px; background: linear-gradient(#fff98a, var(--gold)); box-shadow: 0 8px 18px rgba(0,0,0,.15); }
.stat-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 15px; margin-bottom: 20px; }
.stat-card { position: relative; overflow: hidden; min-height: 135px; padding: 22px; border: 1px solid var(--line); border-radius: 17px; background: var(--surface); box-shadow: 0 10px 30px rgba(4,33,94,.07); }
.stat-card::before { content: ""; position: absolute; inset: 0 auto 0 0; width: 5px; background: var(--accent, var(--blue-500)); }
.stat-card.gold { --accent: var(--gold-deep); }
.stat-card.red { --accent: var(--red); }
.stat-card.green { --accent: #16b978; }
.stat-label { display: block; color: var(--muted); font-size: .76rem; font-weight: 850; letter-spacing: .06em; text-transform: uppercase; }
.stat-value { display: block; margin-top: 12px; color: var(--blue-950); font-size: clamp(1.65rem, 3vw, 2.4rem); font-weight: 950; letter-spacing: -.05em; }
.stat-note { display: block; margin-top: 6px; color: var(--muted); font-size: .72rem; }
.content-card { padding: 24px; border: 1px solid var(--line); border-radius: 18px; background: white; box-shadow: 0 10px 34px rgba(4,33,94,.06); }
.section-heading { display: flex; align-items: flex-end; justify-content: space-between; gap: 20px; margin-bottom: 19px; }
.section-heading h2 { margin: 0; color: var(--blue-950); font-size: 1.45rem; letter-spacing: -.03em; }
.section-note { margin: 0; color: var(--muted); font-size: .86rem; }

.data-table { width: 100%; border-collapse: collapse; }
.data-table th { padding: 11px 12px; color: var(--muted); font-size: .68rem; font-weight: 900; letter-spacing: .08em; text-align: right; text-transform: uppercase; border-bottom: 1px solid var(--line); }
.data-table th:first-child, .data-table td:first-child { text-align: left; }
.data-table td { padding: 13px 12px; font-size: .86rem; text-align: right; border-bottom: 1px solid #edf2f9; }
.data-table tbody tr:last-child td { border-bottom: 0; }
.data-table tbody tr:hover { background: #f8fbff; }
.empty-state { padding: 38px 18px; color: var(--muted); text-align: center; }
.metric-pills { display: flex; flex-wrap: wrap; gap: 9px; }
.metric-pill { padding: 8px 11px; color: var(--blue-900); font-size: .76rem; font-weight: 800; border: 1px solid #cfe2f7; border-radius: 999px; background: #f3f9ff; }
.metric-pill strong { margin-left: 5px; color: var(--ink); }
.daily-details { margin-top: 16px; border-top: 1px solid var(--line); }
.daily-details summary { padding: 15px 0 2px; color: var(--blue-700); font-size: .82rem; font-weight: 900; cursor: pointer; }
.daily-details .data-table { margin-top: 12px; }

.search-box { display: flex; align-items: center; gap: 8px; color: var(--muted); font-size: .75rem; font-weight: 800; }
.search-box input { width: min(300px, 42vw); padding: 10px 12px; border: 1px solid var(--line); border-radius: 10px; }
.table-card { overflow-x: auto; padding: 8px 16px 16px; }
.player-cell { display: flex; align-items: center; gap: 10px; min-width: 180px; }
.avatar-chip { display: grid; place-items: center; flex: 0 0 34px; width: 34px; height: 34px; color: #fff; font-weight: 950; border-radius: 10px; background: linear-gradient(145deg, var(--blue-500), var(--blue-900)); }
.player-cell strong, .player-cell small { display: block; }
.player-cell small { max-width: 180px; overflow: hidden; color: var(--muted); font-size: .66rem; text-overflow: ellipsis; }
.detail-button { padding: 7px 10px; color: var(--blue-700); font-size: .75rem; font-weight: 850; border: 1px solid #bcd9f7; border-radius: 8px; background: #eef7ff; }

.series-summary { margin-bottom: 18px; padding: 22px 24px; color: white; border-radius: 18px; background: linear-gradient(120deg, var(--red-dark), var(--red)); box-shadow: 0 12px 28px rgba(159,13,35,.18); }
.series-summary-header { display: flex; align-items: center; justify-content: space-between; gap: 20px; }
.series-summary h3 { margin: 0 0 5px; font-size: 1.5rem; }
.series-summary p { margin: 0; color: #ffdbe0; font-size: .85rem; }
.series-summary .metric-pills { margin-top: 18px; }
.series-summary .metric-pill { color: white; border-color: rgba(255,255,255,.25); background: rgba(255,255,255,.12); }
.series-summary .metric-pill strong { color: var(--gold); }
.series-summary .daily-details { border-color: rgba(255,255,255,.2); }
.series-summary .daily-details summary { color: var(--gold); }
.series-summary .data-table th, .series-summary .data-table td { color: white; border-color: rgba(255,255,255,.14); }
.series-summary .data-table th { color: #ffdbe0; }
.series-summary .data-table tr:hover { background: rgba(255,255,255,.06); }
.machine-list { display: grid; gap: 14px; }
.machine-card { overflow: hidden; border: 1px solid var(--line); border-radius: 18px; background: white; box-shadow: 0 9px 28px rgba(4,33,94,.06); }
.machine-card > summary { display: flex; align-items: center; gap: 16px; padding: 20px 22px; list-style: none; cursor: pointer; }
.machine-card > summary::-webkit-details-marker { display: none; }
.machine-card > summary::after { content: "+"; margin-left: auto; color: var(--blue-700); font-size: 1.5rem; font-weight: 700; }
.machine-card[open] > summary::after { content: "−"; }
.machine-medallion { display: grid; place-items: center; flex: 0 0 46px; width: 46px; height: 46px; color: #7b4700; font-weight: 950; border: 3px solid #e5a100; border-radius: 50%; background: radial-gradient(circle at 35% 30%, #fff7a0, var(--gold) 65%, #d98100); }
.machine-card.diamond .machine-medallion { color: white; border-color: #49c8ff; border-radius: 13px; background: linear-gradient(145deg, #72e6ff, #0871df); }
.machine-card.bonus { border-color: #d1b5ff; box-shadow: 0 9px 28px rgba(102,49,181,.12); }
.machine-card.bonus .machine-medallion { color: white; border-color: #dec8ff; border-radius: 13px; background: linear-gradient(145deg, #a75eff, #5520a8); }
.machine-title { min-width: 190px; }
.machine-title strong, .machine-title small { display: block; }
.machine-title strong { color: var(--blue-950); }
.machine-title small { margin-top: 3px; color: var(--muted); font-size: .72rem; }
.machine-summary-metrics { margin-left: auto; display: flex; gap: 20px; }
.mini-metric { text-align: right; }
.mini-metric span, .mini-metric strong { display: block; }
.mini-metric span { color: var(--muted); font-size: .65rem; font-weight: 850; text-transform: uppercase; }
.mini-metric strong { margin-top: 3px; color: var(--blue-950); }
.machine-body { padding: 0 22px 22px; border-top: 1px solid var(--line); }
.machine-body > .metric-pills { padding: 17px 0 5px; }
.card-name { font-weight: 850; }
.card-name small { display: block; color: var(--muted); font-weight: 600; }
.card-identity { display: flex; align-items: center; gap: 12px; min-width: 240px; }
.card-thumbnail-button, .card-thumbnail-placeholder { display: grid; place-items: center; flex: 0 0 76px; width: 76px; height: 52px; overflow: hidden; padding: 0; border: 2px solid #d4e1f1; border-radius: 8px; background: #edf4fb; }
.card-thumbnail-button { cursor: zoom-in; }
.card-thumbnail-button:hover, .card-thumbnail-button:focus-visible { border-color: var(--gold-deep); box-shadow: 0 0 0 3px rgba(245,180,0,.2); }
.card-thumbnail-button img { display: block; width: 100%; height: 100%; object-fit: contain; }
.card-thumbnail-placeholder { color: var(--muted); font-size: 1.4rem; }

dialog { width: min(900px, calc(100vw - 32px)); max-height: calc(100vh - 44px); padding: 0; color: var(--ink); border: 2px solid var(--gold); border-radius: 20px; box-shadow: 0 30px 90px rgba(3,24,72,.4); }
dialog::backdrop { background: rgba(3,24,72,.67); backdrop-filter: blur(4px); }
.dialog-header { display: flex; align-items: center; justify-content: space-between; padding: 22px 24px; color: white; background: linear-gradient(110deg, var(--blue-900), var(--blue-700)); }
.dialog-header h2 { margin: 0; }
.dialog-header .eyebrow { color: var(--gold); }
#close-dialog { width: 38px; height: 38px; color: white; font-size: 1.7rem; border: 1px solid rgba(255,255,255,.3); border-radius: 50%; background: rgba(255,255,255,.1); }
#close-card-image { width: 38px; height: 38px; color: white; font-size: 1.7rem; border: 1px solid rgba(255,255,255,.3); border-radius: 50%; background: rgba(255,255,255,.1); }
#dialog-content { overflow: auto; max-height: 65vh; padding: 20px 24px 26px; }
.card-image-dialog { width: min(1100px, calc(100vw - 32px)); }
.card-image-stage { display: grid; place-items: center; overflow: auto; max-height: calc(100vh - 150px); padding: 18px; background: #071b42; }
.card-image-stage img { display: block; max-width: 100%; max-height: calc(100vh - 190px); width: auto; height: auto; border-radius: 10px; box-shadow: 0 18px 55px rgba(0,0,0,.4); }

@media (max-width: 1100px) {
    .stat-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .topbar { align-items: stretch; flex-direction: column; }
    .filters { flex-wrap: wrap; }
    .machine-summary-metrics .mini-metric:nth-child(n+3) { display: none; }
}
@media (max-width: 780px) {
    .login-shell { grid-template-columns: 1fr; padding: 35px 22px; }
    .login-brand { flex-direction: column; align-items: flex-start; }
    .login-icon { width: 125px; }
    .login-card { padding: 46px 28px 34px; }
    .app-shell { display: block; }
    .sidebar { position: static; width: 100%; height: auto; padding: 14px; }
    .sidebar-brand { padding-bottom: 12px; }
    .sidebar nav { grid-template-columns: repeat(3, 1fr); }
    .nav-link { justify-content: center; padding: 10px 5px; font-size: .72rem; text-align: center; }
    .nav-link span, .nav-link::after { display: none; }
    .sidebar-footer { display: none; }
    .dashboard { padding: 24px 15px 50px; }
    .filters { display: grid; grid-template-columns: 1fr 1fr; }
    .filters label:first-child { grid-column: 1 / -1; }
    .filters select, .filters input { width: 100%; min-width: 0; }
    .filter-button { grid-column: 1 / -1; }
    .stat-grid { grid-template-columns: 1fr 1fr; }
    .stat-card { min-height: 115px; padding: 17px; }
    .game-hero { align-items: flex-start; flex-direction: column; }
    .hero-badge { min-width: 0; }
    .section-heading { align-items: flex-start; flex-direction: column; }
    .search-box, .search-box input { width: 100%; }
    .machine-card > summary { align-items: flex-start; flex-wrap: wrap; }
    .machine-summary-metrics { width: 100%; margin-left: 62px; justify-content: flex-start; }
    .mini-metric { text-align: left; }
}
@media (max-width: 480px) {
    .stat-grid { grid-template-columns: 1fr; }
    .login-brand h1 { font-size: 2.8rem; }
    .sidebar nav { gap: 4px; }
    .content-card { padding: 17px; }
    .machine-card > summary, .machine-body { padding-left: 15px; padding-right: 15px; }
}
