/* ============================================================
   Light / dark theme — loaded on every page after its own CSS.
   theme.js sets data-theme on <html> from the saved choice or the
   device setting. Page stylesheets use the --t-* tokens below for
   the neutral greys and the bright accent text colours; team colours
   and the coloured clock panels are the same in both themes.
   ============================================================ */

:root {
    color-scheme: dark;
    --t-bg: #0d1117;
    --t-bg2: #161b22;
    --t-bg3: #1c2333;
    --t-bg4: #21262d;
    --t-border: #30363d;
    --t-text: #e6edf3;
    --t-muted: #8b949e;
    --t-faint: #484f58;
    --t-strong: #ffffff;          /* big numbers on neutral panels */
    --t-blue: #388bfd;
    --t-blue2: #4a9bfd;
    --t-blue-text: #7ab8ff;
    --t-green-text: #3fb950;
    --t-red-text: #f85149;
    --t-yellow: #d29922;
    --t-yellow-text: #f0c040;
    --t-purple-text: #a97ef5;
    --t-orange-text: #f5a623;
    --t-amber-text: #f0a030;
}

:root[data-theme="light"] {
    color-scheme: light;
    --t-bg: #f3f5f8;
    --t-bg2: #ffffff;
    --t-bg3: #f6f8fa;
    --t-bg4: #eaeef2;
    --t-border: #d0d7de;
    --t-text: #1f2328;
    --t-muted: #59636e;
    --t-faint: #8c959f;
    --t-strong: #1f2328;
    --t-blue: #0969da;
    --t-blue2: #0550ae;
    --t-blue-text: #0969da;
    --t-green-text: #1a7f37;
    --t-red-text: #cf222e;
    --t-yellow: #9a6700;
    --t-yellow-text: #7d4e00;
    --t-purple-text: #8250df;
    --t-orange-text: #bc4c00;
    --t-amber-text: #9a5b00;
}

/* Softer overlays and shadows on a light page */
:root[data-theme="light"] .modal-overlay { background: rgba(31, 35, 40, .45); }
:root[data-theme="light"] .setup-overlay { background: rgba(31, 35, 40, .35); }
:root[data-theme="light"] .modal { box-shadow: 0 12px 40px rgba(31, 35, 40, .2); }

/* White text sits on the team colour, which JS sets inline once the match loads.
   Until then, give those panels a dark fill so the text stays readable. */
:root[data-theme="light"] .team-panel,
:root[data-theme="light"] .preview-card { background: #424a53; }

/* ---- Theme toggle ---- */
.theme-toggle {
    width: 34px;
    height: 34px;
    flex-shrink: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    border-radius: 8px;
    border: 1px solid var(--t-border);
    background: var(--t-bg3);
    color: var(--t-muted);
    cursor: pointer;
    transition: color .15s, border-color .15s, background .15s;
}
.theme-toggle:hover { color: var(--t-text); border-color: var(--t-muted); }
.theme-toggle svg { width: 18px; height: 18px; }
.theme-toggle .icon-sun { display: none; }
:root[data-theme="light"] .theme-toggle .icon-sun { display: block; }
:root[data-theme="light"] .theme-toggle .icon-moon { display: none; }

/* Pages without a header bar get a floating button */
.theme-toggle.floating {
    position: fixed;
    top: 14px;
    right: 14px;
    z-index: 900;
}

@media print {
    .theme-toggle { display: none !important; }
}
