:root {
  --bg: #ffffff;
  --text: #17202b;
  --muted: #566274;
  --line: #dde3ea;
  --accent: #1457d4;
  --accent-text: #ffffff;
  --panel: #f4f6f9;
  --warn: #b45309;
  --done: #b42318;
  --ad-bg: #fafbfc;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0f1319; --text: #e7ebf1; --muted: #9aa5b5; --line: #2a323d; --accent: #6ea0ff;
    --accent-text: #0b1220; --panel: #171d26; --warn: #f5a524; --done: #ff7b72; --ad-bg: #141920;
  }
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--text); font: 16px/1.65 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif; }
a { color: var(--accent); }
.wrap { max-width: 760px; margin: 0 auto; padding: 0 16px; }
.site-header { border-bottom: 1px solid var(--line); }
.site-header .wrap { display: flex; align-items: center; justify-content: space-between; padding-top: 14px; padding-bottom: 14px; }
.brand { font-weight: 700; font-size: 18px; color: var(--text); text-decoration: none; }
.nav a { margin-left: 14px; font-size: 14px; color: var(--muted); text-decoration: none; }
h1 { font-size: 28px; line-height: 1.3; margin: 26px 0 6px; }
h2 { font-size: 21px; margin: 38px 0 10px; }
h3 { font-size: 17px; margin: 20px 0 6px; }
.lead { color: var(--muted); margin: 0 0 18px; }

.stage { background: var(--panel); border: 1px solid var(--line); border-radius: 0; padding: 22px 16px 18px; text-align: center; margin: 14px 0; }
.clock { font-size: clamp(54px, 18vw, 120px); font-weight: 700; line-height: 1.1; font-variant-numeric: tabular-nums; letter-spacing: 0.02em; margin: 6px 0 4px; word-break: keep-all; }
.stage.is-warn .clock { color: var(--warn); }
.stage[data-phase="break"] .clock { color: #1a7f4b; }
@media (prefers-color-scheme: dark) { .stage[data-phase="break"] .clock { color: #4ade80; } }
.phase-label { font-weight: 700; font-size: 18px; min-height: 1.6em; }
.stage.is-finished .clock { color: var(--done); animation: blink 1s steps(2, start) infinite; }
@media (prefers-reduced-motion: reduce) { .stage.is-finished .clock { animation: none; } }
@keyframes blink { 50% { opacity: .35; } }
.status { min-height: 1.6em; font-weight: 600; color: var(--done); }
.sub-label { color: var(--muted); font-size: 15px; min-height: 1.5em; }
.controls { display: flex; flex-wrap: wrap; gap: 10px; justify-content: center; margin-top: 12px; }
.btn { font: inherit; font-weight: 600; padding: 12px 22px; min-width: 110px; border: 1px solid var(--accent); background: var(--accent); color: var(--accent-text); cursor: pointer; }
.btn.ghost { background: transparent; color: var(--accent); }
.btn:disabled { opacity: .45; cursor: default; }
.btn:focus-visible, input:focus-visible, select:focus-visible, .chip:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; margin: 14px 0 4px; }
.chip { font: inherit; font-size: 15px; padding: 8px 14px; border: 1px solid var(--line); background: var(--bg); color: var(--text); cursor: pointer; }
.chip[aria-pressed="true"] { border-color: var(--accent); background: var(--accent); color: var(--accent-text); }
.fields { display: flex; flex-wrap: wrap; gap: 10px; justify-content: center; align-items: flex-end; margin: 10px 0; }
.field label { display: block; font-size: 13px; color: var(--muted); text-align: left; margin-bottom: 3px; }
.field input, .field select { font: inherit; font-size: 18px; padding: 10px; width: 92px; border: 1px solid var(--line); background: var(--bg); color: var(--text); text-align: center; }
.field select { width: auto; min-width: 150px; text-align: left; }
.field.wide input { width: 190px; }
.hint { font-size: 13px; color: var(--muted); margin: 8px 0 0; }
.error { color: var(--done); font-size: 14px; min-height: 1.3em; }
.disclaimer { font-size: 13px; color: var(--muted); border-left: 3px solid var(--accent); padding-left: 10px; margin: 16px 0 0; text-align: left; }
.warn-box { background: var(--panel); border: 1px solid var(--line); border-left: 4px solid var(--warn); padding: 10px 12px; font-size: 14px; margin: 12px 0; text-align: left; }
.options { display: flex; flex-wrap: wrap; gap: 8px 18px; justify-content: center; margin-top: 10px; }
.check { display: inline-flex; align-items: center; gap: 8px; font-size: 15px; }
.check input { width: 20px; height: 20px; }

.stage.is-fullscreen { display: flex; flex-direction: column; justify-content: center; align-items: center; width: 100%; min-height: 100vh; background: var(--bg); border: 0; }
.stage.is-fullscreen .clock { font-size: clamp(80px, 26vw, 40vh); }
.stage:fullscreen { display: flex; flex-direction: column; justify-content: center; align-items: center; background: var(--bg); }
.stage:fullscreen .clock { font-size: min(26vw, 40vh); }

.laps { width: 100%; max-width: 420px; margin: 14px auto 0; border-collapse: collapse; font-variant-numeric: tabular-nums; font-size: 15px; }
.laps th, .laps td { border-bottom: 1px solid var(--line); padding: 6px 8px; text-align: right; }
.laps th:first-child, .laps td:first-child { text-align: left; }

table.info { width: 100%; border-collapse: collapse; font-size: 15px; margin: 10px 0; }
table.info th, table.info td { border: 1px solid var(--line); padding: 8px 10px; text-align: left; }
table.info th { background: var(--panel); }
details { border-bottom: 1px solid var(--line); padding: 10px 0; }
summary { cursor: pointer; font-weight: 600; }
details p { margin: 8px 0 0; color: var(--muted); }
.related ul { padding-left: 18px; }
.ad-slot { min-height: 0; margin: 30px 0; text-align: center; background: var(--ad-bg); }
.tool-list { list-style: none; padding: 0; margin: 0; }
.tool-list li { border-bottom: 1px solid var(--line); }
.tool-list a { display: block; padding: 16px 0; text-decoration: none; color: var(--text); }
.tool-list strong { display: block; font-size: 19px; color: var(--accent); }
.tool-list span { font-size: 14px; color: var(--muted); }
.notice { font-size: 13px; color: var(--muted); border-left: 3px solid var(--line); padding-left: 10px; margin: 24px 0; }
.site-footer { border-top: 1px solid var(--line); margin-top: 48px; padding: 20px 0 40px; font-size: 13px; color: var(--muted); }
.site-footer a { color: var(--muted); margin-right: 14px; }
.stage.is-critical .clock { color: var(--done); }
.exam-name { font-size: clamp(20px, 5vw, 34px); font-weight: 700; min-height: 1.3em; word-break: break-word; }
.ends { color: var(--muted); font-size: 16px; min-height: 1.5em; }
h2.mini { font-size: 16px; margin: 20px 0 0; color: var(--muted); }
.world { width: 100%; border-collapse: collapse; margin: 10px 0; text-align: left; }
.world td { border-bottom: 1px solid var(--line); padding: 10px 6px; vertical-align: middle; }
.world .wtime { font-size: 22px; font-weight: 700; font-variant-numeric: tabular-nums; white-space: nowrap; }
.world .wtime.night { color: var(--muted); }
.world td:last-child { text-align: right; }
.clock-date { font-size: clamp(18px, 4vw, 28px); color: var(--muted); }

/* Wide tables scroll inside themselves instead of widening the page on small screens */
main table { display: block; max-width: 100%; overflow-x: auto; -webkit-overflow-scrolling: touch; }
