:root {
  color-scheme: dark;
  --bg: #050505;
  --panel: #0d0d0d;
  --panel-raised: #121212;
  --line: #292929;
  --text: #f5f5f5;
  --muted: #858585;
  --quiet: #555;
  --header-height: 70px;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-synthesis: none;
}

* { box-sizing: border-box; }
html { background: var(--bg); }
body { margin: 0; min-width: 280px; min-height: 100vh; background: var(--bg); color: var(--text); }
button, input, select { color: inherit; font: inherit; }
button, select { cursor: pointer; }
a { color: inherit; text-decoration: none; }
[hidden] { display: none !important; }

.site-header {
  position: relative;
  z-index: 10;
  display: flex;
  align-items: center;
  height: var(--header-height);
  gap: 32px;
  padding: 0 4vw;
  border-bottom: 1px solid var(--line);
  background: rgba(5, 5, 5, .88);
  backdrop-filter: blur(10px);
}

.brand { font-size: 18px; font-weight: 800; letter-spacing: -.06em; }
.brand span { color: var(--muted); font-weight: 300; }
nav { display: flex; gap: 24px; margin-left: auto; }
nav a { color: var(--muted); font-size: 13px; transition: color 160ms ease; }
nav a:hover, nav a[aria-current="page"] { color: var(--text); }

.icon-button {
  display: grid;
  width: 36px;
  height: 36px;
  place-items: center;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 50%;
  background: #090909;
}
.icon-button:hover, .icon-button.active { border-color: #777; background: #151515; }
.icon-button svg { width: 16px; fill: none; stroke: currentColor; stroke-linecap: square; stroke-width: 1.5; }

.view { min-height: calc(100vh - var(--header-height)); }
.clock-view { display: flex; align-items: center; padding: 7vh 8vw; }
.clock-stage { width: 100%; }
.date, .eyebrow { margin: 0; color: var(--muted); font-size: clamp(10px, 1vw, 13px); letter-spacing: .22em; text-transform: uppercase; }
.date { margin-bottom: 1.5vh; }
.time-row { display: flex; align-items: flex-end; gap: 2vw; }
.clock {
  font-size: clamp(88px, 22vw, 320px);
  font-weight: 200;
  font-variant-numeric: tabular-nums;
  letter-spacing: -.09em;
  line-height: .88;
  white-space: nowrap;
}
.period { margin-bottom: 2.2vw; color: var(--muted); font-size: clamp(16px, 2.5vw, 34px); letter-spacing: .12em; }
.seconds-track { width: 100%; height: 3px; margin: 4vh 0; overflow: hidden; background: #202020; }
.seconds-track i { display: block; width: 100%; height: 100%; transform: scaleX(0); transform-origin: left; background: var(--text); }
.status-line { display: flex; align-items: center; justify-content: space-between; gap: 24px; }
.status-dot { display: inline-block; width: 6px; height: 6px; margin: 0 0 1px 6px; border-radius: 50%; background: #fff; box-shadow: 0 0 7px #fff; }
.zone-label { margin: 0; color: var(--quiet); font-size: 12px; letter-spacing: .08em; text-transform: uppercase; }

.panel-view { width: min(1250px, 100%); margin: auto; padding: 7vh 4vw 12vh; }
.page-heading { display: flex; align-items: center; justify-content: space-between; gap: 24px; margin-bottom: 48px; }
.page-heading .eyebrow { margin-bottom: 12px; }
.page-heading h1 { margin: 0; font-size: clamp(44px, 7vw, 82px); font-weight: 300; letter-spacing: -.065em; line-height: .95; }
.badge { padding: 8px 12px; border: 1px solid #333; border-radius: 999px; color: #777; font-size: 11px; }
.badge.online { border-color: #777; color: #fff; }
.settings-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 20px; }
.panel { padding: 28px; border: 1px solid var(--line); background: var(--panel); }
.panel h2 { margin: 0 0 8px; font-size: 19px; font-weight: 650; letter-spacing: -.025em; }
.panel p { margin: 0; color: var(--muted); font-size: 13px; line-height: 1.6; }
.panel-heading { padding-bottom: 24px; border-bottom: 1px solid var(--line); }
.field-stack { display: grid; gap: 12px; padding-top: 24px; }
.field-stack > label, legend { color: var(--muted); font-size: 10px; letter-spacing: .12em; text-transform: uppercase; }
select { width: 100%; padding: 13px 40px 13px 12px; border: 1px solid #333; border-radius: 2px; outline: none; background: #070707; }
select:focus-visible { border-color: #aaa; }
fieldset { min-width: 0; margin: 10px 0 0; padding: 0; border: 0; }
legend { margin-bottom: 10px; }
.segmented { display: grid; grid-template-columns: 1fr 1fr; gap: 1px; border: 1px solid #333; background: #333; }
.segmented label { position: relative; }
.segmented input { position: absolute; opacity: 0; }
.segmented span { display: block; padding: 12px; background: #080808; color: var(--muted); text-align: center; font-size: 12px; }
.segmented input:checked + span { background: #fff; color: #050505; font-weight: 700; }
.segmented input:focus-visible + span { outline: 2px solid white; outline-offset: -3px; }
.switch-list { display: grid; }
.switch-row { display: flex; align-items: center; justify-content: space-between; gap: 20px; padding: 18px 0; border-bottom: 1px solid var(--line); cursor: pointer; }
.switch-row:last-child { border-bottom: 0; padding-bottom: 0; }
.switch-row strong, .switch-row small { display: block; }
.switch-row strong { margin-bottom: 5px; font-size: 13px; font-weight: 600; }
.switch-row small { color: var(--muted); font-size: 11px; line-height: 1.45; }
.switch-row input { width: 38px; height: 21px; flex: 0 0 auto; appearance: none; border: 1px solid #444; border-radius: 20px; background: #111; transition: 160ms ease; }
.switch-row input::after { display: block; width: 15px; height: 15px; margin: 2px; border-radius: 50%; background: #777; content: ""; transition: transform 160ms ease; }
.switch-row input:checked { border-color: #fff; background: #fff; }
.switch-row input:checked::after { transform: translateX(17px); background: #050505; }
.switch-row input:focus-visible { outline: 2px solid #fff; outline-offset: 2px; }
.summary-panel { display: flex; align-items: center; justify-content: space-between; gap: 24px; margin-top: 20px; }
.summary-panel .eyebrow { margin-bottom: 10px; }
.secondary-button { padding: 12px 17px; border: 1px solid #333; border-radius: 2px; background: #151515; font-size: 12px; font-weight: 700; letter-spacing: .04em; white-space: nowrap; }
.secondary-button:hover { border-color: #666; background: var(--panel-raised); }
.toast { position: fixed; right: 24px; bottom: 24px; z-index: 20; max-width: min(360px, calc(100vw - 48px)); padding: 14px 18px; background: #fff; color: #050505; font-size: 13px; }
.noscript { position: fixed; inset: auto 20px 20px; z-index: 30; padding: 14px; background: white; color: black; text-align: center; }

@media (max-width: 760px) {
  :root { --header-height: 64px; }
  .site-header { gap: 16px; padding: 0 18px; }
  nav { gap: 14px; }
  .clock-view { padding: 5vh 20px; }
  .clock { font-size: 28vw; }
  .seconds-track { margin: 3vh 0; }
  .status-line { align-items: flex-start; flex-direction: column; gap: 10px; }
  .panel-view { padding: 42px 16px 80px; }
  .settings-grid { grid-template-columns: 1fr; }
  .page-heading, .summary-panel { align-items: flex-start; flex-direction: column; }
  .summary-panel .secondary-button { width: 100%; }
}

@media (max-width: 410px) {
  .brand { font-size: 16px; }
  nav a { font-size: 12px; }
  .icon-button { width: 32px; height: 32px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; transition: none !important; }
}

@media (display-mode: fullscreen) {
  .site-header { opacity: .15; transition: opacity 180ms ease; }
  .site-header:hover, .site-header:focus-within { opacity: 1; }
}
