:root {
  --bg: #f6f8fb;
  --surface: #ffffff;
  --surface-2: #eef2f7;
  --text: #0f172a;
  --muted: #5b6678;
  --border: #dde3ec;
  --brand: #0b5cff;
  --open: #0f9d58;
  --open-bg: #e6f6ee;
  --closed: #d93025;
  --closed-bg: #fdecea;
  --warn: #b26a00;
  --warn-bg: #fff4e0;
  --up: #0f9d58;
  --down: #d93025;
  --radius: 14px;
  --shadow: 0 1px 2px rgba(15, 23, 42, .06), 0 4px 16px rgba(15, 23, 42, .05);
  --mono: ui-monospace, "SF Mono", "Cascadia Mono", "Roboto Mono", Menlo, Consolas, monospace;
  color-scheme: light dark;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0b1220;
    --surface: #111a2c;
    --surface-2: #17223a;
    --text: #e7ecf5;
    --muted: #98a3b8;
    --border: #24304a;
    --brand: #5b8cff;
    --open: #34d399;
    --open-bg: rgba(52, 211, 153, .12);
    --closed: #f87171;
    --closed-bg: rgba(248, 113, 113, .12);
    --warn: #fbbf24;
    --warn-bg: rgba(251, 191, 36, .12);
    --up: #34d399;
    --down: #f87171;
    --shadow: none;
  }
}
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font: 16px/1.6 system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
}
a { color: var(--brand); text-underline-offset: 2px; }
img { max-width: 100%; height: auto; }
h1, h2, h3 { line-height: 1.25; }
h1 { font-size: clamp(1.6rem, 1.2rem + 2vw, 2.4rem); margin: .6em 0 .4em; }
h2 { font-size: clamp(1.25rem, 1.1rem + .8vw, 1.6rem); margin: 1.8em 0 .6em; }
h3 { font-size: 1.1rem; margin: 1.2em 0 .4em; }
.wrap { width: 100%; max-width: 1180px; margin: 0 auto; padding: 0 16px; }
.skip { position: absolute; left: -999px; }
.skip:focus { left: 16px; top: 8px; background: var(--surface); padding: 8px; z-index: 10; }
.muted, .note { color: var(--muted); }
.note { font-size: .9rem; }
.lede { font-size: 1.1rem; color: var(--muted); max-width: 70ch; }
.prose { max-width: 75ch; }

/* Header */
.site-header { background: var(--surface); border-bottom: 1px solid var(--border); position: sticky; top: 0; z-index: 5; }
.header-row { display: flex; align-items: center; gap: 16px; min-height: 60px; }
.brand { color: var(--text); text-decoration: none; font-size: 1.15rem; letter-spacing: -.01em; display: flex; align-items: center; gap: 8px; white-space: nowrap; }
.brand b { color: var(--brand); }
.brand-dot { width: 10px; height: 10px; border-radius: 50%; background: var(--open); box-shadow: 0 0 0 4px var(--open-bg); }
.site-nav { margin-left: auto; display: flex; align-items: center; gap: 4px; }
.site-nav a { white-space: nowrap; color: var(--text); text-decoration: none; padding: 8px 10px; border-radius: 8px; font-weight: 500; }
.site-nav a:hover, .site-nav a[aria-current] { background: var(--surface-2); }
.bell-toggle { white-space: nowrap; margin-left: 6px; border: 1px solid var(--border); background: var(--surface); color: var(--text); padding: 7px 12px; border-radius: 999px; font: inherit; font-size: .9rem; cursor: pointer; display: inline-flex; gap: 6px; align-items: center; }
.bell-toggle[aria-pressed="true"] { background: var(--open-bg); border-color: var(--open); color: var(--open); }
.nav-toggle { display: none; margin-left: auto; background: none; border: 0; padding: 10px; cursor: pointer; }
.nav-toggle span { display: block; width: 22px; height: 2px; background: var(--text); margin: 5px 0; border-radius: 2px; }
@media (max-width: 1080px) {
  .nav-toggle { display: block; }
  .site-nav { display: none; position: absolute; left: 0; right: 0; top: 60px; background: var(--surface); border-bottom: 1px solid var(--border); flex-direction: column; align-items: stretch; padding: 8px 16px 16px; }
  .site-nav.open { display: flex; }
  .site-nav a { padding: 12px; }
  .bell-toggle { margin: 8px 0 0; justify-content: center; padding: 12px; }
}

.crumbs { font-size: .85rem; color: var(--muted); margin-top: 16px; }
.crumbs a { color: var(--muted); }

/* Hero clock */
main, .hero > div { min-width: 0; }
.hero { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); padding: clamp(16px, 3vw, 32px); margin-top: 20px; display: grid; grid-template-columns: 1.3fr 1fr; gap: 24px; }
@media (max-width: 860px) { .hero { grid-template-columns: minmax(0, 1fr); } }
.hero h1 { margin-top: 0; font-size: clamp(1.4rem, 1.1rem + 1.6vw, 2.1rem); }
.hero-status { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; margin: 8px 0 4px; }
.clock { font-family: var(--mono); font-variant-numeric: tabular-nums; font-size: clamp(2.6rem, 1.6rem + 6vw, 5rem); font-weight: 700; letter-spacing: -.02em; line-height: 1; margin: 12px 0 4px; }
.clock small { font-size: .35em; font-weight: 600; color: var(--muted); margin-left: .3em; letter-spacing: 0; }
.clock-date { color: var(--muted); }
.countdown { font-size: 1.15rem; margin: 14px 0 6px; }
.countdown strong { font-family: var(--mono); font-variant-numeric: tabular-nums; }
.progress { height: 10px; border-radius: 99px; background: var(--surface-2); overflow: hidden; margin: 10px 0 6px; position: relative; }
.progress > span { display: block; height: 100%; width: 0; background: linear-gradient(90deg, var(--open), #22c55e); border-radius: inherit; transition: width .5s linear; }
.progress-labels { display: flex; justify-content: space-between; font-size: .8rem; color: var(--muted); font-family: var(--mono); }
.sync { font-size: .8rem; color: var(--muted); margin-top: 10px; }
.hero-side { display: flex; flex-direction: column; gap: 12px; }
.panel { background: var(--surface-2); border-radius: 12px; padding: 14px 16px; }
.panel h2 { font-size: 1rem; margin: 0 0 8px; }
.panel ul { margin: 0; padding: 0; list-style: none; }
.panel li { display: flex; justify-content: space-between; gap: 8px; padding: 6px 0; border-top: 1px solid var(--border); font-size: .95rem; }
.panel li:first-child { border-top: 0; }

/* Badges */
.badge { display: inline-flex; align-items: center; gap: 8px; padding: 6px 14px; border-radius: 999px; font-weight: 700; font-size: .95rem; letter-spacing: .02em; text-transform: uppercase; }
.badge .dot { width: 9px; height: 9px; border-radius: 50%; background: currentColor; }
.badge-open { color: var(--open); background: var(--open-bg); }
.badge-open .dot { animation: pulse 1.6s infinite; }
.badge-closed { color: var(--closed); background: var(--closed-bg); }
.badge-pre, .badge-post, .badge-lunch { color: var(--warn); background: var(--warn-bg); }
.badge.lg { font-size: 1.2rem; padding: 10px 20px; }
.badge.sm { font-size: .72rem; padding: 3px 9px; gap: 6px; }
.badge.sm .dot { width: 7px; height: 7px; }
@keyframes pulse { 0%, 100% { opacity: 1; } 50% { opacity: .35; } }
@media (prefers-reduced-motion: reduce) { .badge-open .dot { animation: none; } .progress > span { transition: none; } }

.pill { display: inline-block; padding: 2px 10px; border-radius: 999px; font-size: .8rem; font-weight: 600; white-space: nowrap; }
.pill-closed { color: var(--closed); background: var(--closed-bg); }
.pill-early { color: var(--warn); background: var(--warn-bg); }

/* Quotes */
.tickers { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 10px; margin: 20px 0 0; }
.ticker { background: var(--surface); border: 1px solid var(--border); border-radius: 12px; padding: 12px 14px; }
.ticker .sym { font-size: .8rem; color: var(--muted); font-weight: 600; }
.ticker .px { font-family: var(--mono); font-size: 1.2rem; font-weight: 700; font-variant-numeric: tabular-nums; }
.ticker .chg { font-family: var(--mono); font-size: .9rem; font-variant-numeric: tabular-nums; }
.up { color: var(--up); }
.down { color: var(--down); }
.quote-form { display: flex; gap: 8px; margin-top: 12px; }
.quote-form input { flex: 1; min-width: 0; font: inherit; padding: 10px 12px; border-radius: 10px; border: 1px solid var(--border); background: var(--surface); color: var(--text); text-transform: uppercase; }
.quote-form button, .btn { font: inherit; font-weight: 600; padding: 10px 16px; border-radius: 10px; border: 0; background: var(--brand); color: #fff; cursor: pointer; text-decoration: none; display: inline-block; }
.btn-ghost { background: var(--surface-2); color: var(--text); }
.quote-form input::placeholder { text-transform: none; }
.quote-result { margin-top: 10px; min-height: 1.6em; }

/* Cards / board */
.grid { display: grid; gap: 12px; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); }
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px; box-shadow: var(--shadow); }
.card h3 { margin: 0; font-size: 1.05rem; }
.card h3 a { color: var(--text); text-decoration: none; }
.card h3 a:hover { text-decoration: underline; }
.card-top { display: flex; justify-content: space-between; align-items: flex-start; gap: 8px; }
.card .local { font-family: var(--mono); font-size: 1.6rem; font-weight: 700; font-variant-numeric: tabular-nums; margin: 8px 0 2px; }
.card .meta { font-size: .85rem; color: var(--muted); }
.card .next { font-size: .9rem; margin-top: 6px; }
.card .next strong { font-family: var(--mono); font-variant-numeric: tabular-nums; }
.filters { display: flex; flex-wrap: wrap; gap: 8px; margin: 12px 0 16px; }
.filters button { font: inherit; font-size: .9rem; padding: 6px 14px; border-radius: 999px; border: 1px solid var(--border); background: var(--surface); color: var(--text); cursor: pointer; }
.filters button[aria-pressed="true"] { background: var(--text); color: var(--bg); border-color: var(--text); }

/* Timeline */
.timeline { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px; overflow-x: auto; }
.tl-row { display: grid; grid-template-columns: 120px 1fr; align-items: center; gap: 10px; min-width: 560px; height: 30px; }
.tl-name { font-size: .85rem; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tl-track { position: relative; height: 14px; background: var(--surface-2); border-radius: 4px; }
.tl-bar { position: absolute; top: 0; bottom: 0; background: var(--brand); opacity: .75; border-radius: 4px; }
.tl-bar.is-open { background: var(--open); opacity: 1; }
.tl-now { position: absolute; top: -6px; bottom: -6px; width: 2px; background: var(--closed); }
.tl-axis { display: grid; grid-template-columns: 120px 1fr; gap: 10px; min-width: 560px; font-size: .75rem; color: var(--muted); font-family: var(--mono); }
.tl-axis div:last-child { display: flex; justify-content: space-between; }

/* Tables */
.table-wrap { overflow-x: auto; border: 1px solid var(--border); border-radius: 12px; background: var(--surface); }
table { width: 100%; border-collapse: collapse; font-size: .95rem; }
th, td { text-align: left; padding: 11px 14px; border-bottom: 1px solid var(--border); vertical-align: top; }
th { font-size: .8rem; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); background: var(--surface-2); }
tr:last-child td { border-bottom: 0; }
tr.past td { color: var(--muted); }
tr.past td:first-child::after { content: " (passed)"; font-size: .8em; }
td time { white-space: nowrap; }

/* Key takeaways */
.takeaway { background: var(--surface); border: 1px solid var(--border); border-left: 4px solid var(--brand); border-radius: 12px; padding: 14px 18px; margin: 16px 0; }
.takeaway h2 { margin: 0 0 6px; font-size: 1.05rem; }
.takeaway ul { margin: 0; padding-left: 20px; }

.two-col { display: grid; grid-template-columns: minmax(0, 1fr) 320px; gap: 28px; align-items: start; }
@media (max-width: 960px) { .two-col { grid-template-columns: minmax(0, 1fr); } }
.sidebar { position: sticky; top: 76px; display: flex; flex-direction: column; gap: 12px; }
@media (max-width: 960px) { .sidebar { position: static; } }

/* FAQ */
.faq details { background: var(--surface); border: 1px solid var(--border); border-radius: 12px; padding: 0 16px; margin: 8px 0; }
.faq summary { cursor: pointer; padding: 12px 0; list-style: none; display: flex; justify-content: space-between; gap: 12px; }
.faq summary::-webkit-details-marker { display: none; }
.faq summary::after { content: "+"; font-size: 1.3rem; line-height: 1; color: var(--muted); }
.faq details[open] summary::after { content: "–"; }
.faq summary h3 { margin: 0; font-size: 1rem; }
.faq-a { padding-bottom: 12px; }
.faq-a p { margin: 0 0 8px; }

.code { font-family: var(--mono); font-size: .85rem; background: var(--surface-2); border: 1px dashed var(--border); border-radius: 10px; padding: 12px; overflow-x: auto; white-space: pre-wrap; word-break: break-all; }

/* Ads: reserve height to avoid layout shift */
.ad { margin: 24px auto; min-height: 100px; text-align: center; }
.ad-top { min-height: 100px; }
.ad-inline { min-height: 280px; }
.ad-sidebar { min-height: 250px; }
@media (max-width: 600px) { .ad-inline { min-height: 250px; } }

/* Footer */
.site-footer { margin-top: 56px; background: var(--surface); border-top: 1px solid var(--border); padding: 32px 0 16px; font-size: .92rem; }
.footer-grid { display: grid; grid-template-columns: 2fr 1fr 1.2fr 2fr; gap: 24px; }
@media (max-width: 860px) { .footer-grid { grid-template-columns: 1fr 1fr; } }
@media (max-width: 520px) { .footer-grid { grid-template-columns: 1fr; } }
.site-footer h2 { font-size: .95rem; margin: 0 0 8px; }
.site-footer ul { list-style: none; padding: 0; margin: 0; }
.site-footer li { margin: 4px 0; }
.copyright { color: var(--muted); font-size: .85rem; margin-top: 24px; }

.toast { position: fixed; left: 50%; bottom: 20px; transform: translateX(-50%); background: var(--text); color: var(--bg); padding: 10px 18px; border-radius: 999px; font-weight: 600; z-index: 20; box-shadow: 0 8px 24px rgba(0,0,0,.2); }

@media (max-width: 600px) {
  th, td { padding: 9px 10px; font-size: .88rem; }
  td time { white-space: normal; }
  .pill { white-space: normal; }
  .hero { padding: 16px; }
}
