:root {
  color-scheme: dark;
  --background: #0b0e14;
  --surface: #151b25;
  --text: #f5f7fb;
  --muted: #6b7789;
  --hover: #b3becd;
  --warning: #fb923c;
  --danger: #ff626b;
  --alarm-flash: #c7ddff;
}
[data-theme="light"] {
  color-scheme: light;
  --background: #f8fafc;
  --surface: #eaf0f6;
  --text: #101b2b;
  --muted: #8792a2;
  --hover: #475569;
  --warning: #c2410c;
  --danger: #dc2626;
  --alarm-flash: #334155;
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--background); color: var(--text); font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif; }
body::after { content: ''; position: fixed; inset: 0; z-index: 100; pointer-events: none; background: var(--alarm-flash); opacity: 0; }
body.alarm-active::after { animation: alarm-flash 1s linear 3; }
@keyframes alarm-flash { 0%, 35% { opacity: .28; } 50%, 100% { opacity: 0; } }
@media (prefers-reduced-motion: reduce) {
  body.alarm-active::after { animation: none; opacity: .18; }
}
button, a { font: inherit; -webkit-tap-highlight-color: transparent; touch-action: manipulation; }
button { cursor: pointer; }
button:disabled { cursor: default; opacity: .35; }
button:focus-visible, a:focus-visible { outline: 2px solid var(--hover); outline-offset: 3px; }
[hidden] { display: none !important; }
svg, [data-lucide] { width: 22px; height: 22px; stroke-width: 1.6; flex: none; }
.timer-shell { height: 100svh; min-height: 240px; padding: clamp(12px, 2.5vw, 36px); display: grid; grid-template-rows: auto minmax(0, 1fr) auto; gap: clamp(8px, 2vh, 20px); }
.timer-header, .header-actions { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.icon-button { display: inline-flex; justify-content: center; align-items: center; position: relative; width: 44px; height: 44px; padding: 10px; border: 0; border-radius: 6px; color: var(--muted); background: transparent; text-decoration: none; }
.icon-button:hover:not(:disabled) { color: var(--hover); background: var(--surface); }
[data-tooltip]::before { content: attr(data-tooltip); position: absolute; z-index: 10; bottom: calc(100% + 8px); left: 50%; transform: translateX(-50%); width: max-content; max-width: min(260px, calc(100vw - 32px)); padding: 7px 10px; border-radius: 4px; background: var(--surface); color: var(--text); font-size: 12px; font-weight: 400; line-height: 1.5; text-align: center; white-space: normal; pointer-events: none; visibility: hidden; opacity: 0; }
[data-tooltip]:is(:hover, :focus-visible)::before { visibility: visible; opacity: 1; transition: opacity .12s ease .15s; }
.timer-header [data-tooltip]::before { top: calc(100% + 8px); bottom: auto; left: 0; transform: none; }
.header-actions [data-tooltip]::before { right: 0; left: auto; }
.qa-option[aria-pressed="false"] { opacity: .45; }
.qa-option[aria-pressed="true"]::after { content: ''; position: absolute; width: 3px; height: 3px; border-radius: 50%; bottom: 3px; background: currentColor; }
.timer-stage { display: flex; flex-direction: column; align-items: center; justify-content: center; min-width: 0; min-height: 0; container-type: size; --timer-color: var(--text); }
.timer-stage[data-urgency="warning"] { --timer-color: var(--warning); }
.timer-stage[data-urgency="danger"] { --timer-color: var(--danger); }
.phase-indicator { display: inline-flex; align-items: center; gap: 10px; color: var(--muted); margin-bottom: 10px; font-size: clamp(16px, 1.6vw, 24px); font-weight: 600; line-height: 1.4; }
#phase-icon { display: inline-flex; }
.phase-indicator svg { width: 1em; height: 1em; }
.countdown { color: var(--timer-color); font-family: "Arial", "Helvetica Neue", sans-serif; font-size: clamp(64px, min(34vw, 55svh), 900px); font-size: clamp(64px, min(34vw, 78cqh), 900px); font-weight: 800; line-height: 1; letter-spacing: -.055em; font-variant-numeric: tabular-nums; user-select: none; white-space: nowrap; }
.countdown-separator { position: relative; }
.test-mode { position: absolute; top: 50%; left: 0; width: 100%; min-width: 24px; height: 50%; padding: 0; border: 0; border-radius: 4px; color: inherit; background: transparent; }
.test-mode::before { letter-spacing: normal; }
.timer-footer { display: flex; flex-direction: column; align-items: center; gap: 8px; }
.controls { display: grid; grid-template-columns: 44px 64px 44px; gap: 16px; align-items: center; }
.primary { width: 64px; height: 64px; }
.primary svg { width: 32px; height: 32px; }
#skip-qa[hidden] { display: inline-flex !important; visibility: hidden; }
.notice { margin: 0; font-size: 12px; color: var(--muted); text-align: center; }
.notice:empty { display: none; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }
@media (max-height: 450px) {
  .timer-shell { padding: 8px 16px; gap: 4px; }
  .primary { height: 44px; }
  .primary svg { width: 26px; height: 26px; }
  .phase-indicator { margin-bottom: 6px; font-size: 16px; }
  .phase-indicator svg { width: 16px; height: 16px; }
}
