/*
 * 12·24 Clock — anoqr.com/12-24-hour-clock
 *
 * Geist and Geist Mono are by Vercel, under the SIL Open Font License 1.1.
 * Only the Latin subset is shipped; it is all the page draws.
 */

@font-face {
  font-family: 'Geist';
  src: url('/12-24-hour-clock/fonts/geist.woff2') format('woff2');
  font-weight: 100 900;
  font-display: swap;
}
@font-face {
  font-family: 'Geist Mono';
  src: url('/12-24-hour-clock/fonts/geist-mono.woff2') format('woff2');
  font-weight: 100 900;
  font-display: swap;
}

:root {
  color-scheme: dark;
  --bg: #07080c;
  --bg-2: #0d1019;
  --fg: #f3f5fb;
  --fg-2: rgba(236, 240, 252, 0.8);
  --muted: rgba(226, 232, 250, 0.52);
  --faint: rgba(226, 232, 250, 0.3);
  --line: rgba(226, 232, 250, 0.1);
  --glass: rgba(255, 255, 255, 0.045);
  --glass-2: rgba(255, 255, 255, 0.08);
  --seg-on: rgba(255, 255, 255, 0.13);
  --sheet: rgba(16, 19, 29, 0.92);
  --c12: #7df9ff;
  --c24: #b09cff;
  --day: #ffcf70;
  --night: #6b7bff;
  --danger: #ff7a8e;
  --on-accent: #06070b;
  --face-1: rgba(255, 255, 255, 0.07);
  --face-2: rgba(255, 255, 255, 0.015);
  --tick: rgba(226, 232, 250, 0.2);
  --tick-major: rgba(226, 232, 250, 0.62);
  --shadow: 0 30px 80px -20px rgba(0, 0, 0, 0.7);
  --glow-1: rgba(64, 214, 255, 0.16);
  --glow-2: rgba(150, 110, 255, 0.16);
  --ui: 'Geist', ui-sans-serif, system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  --mono: 'Geist Mono', ui-monospace, 'SF Mono', Consolas, monospace;
}

@media (prefers-color-scheme: light) {
  :root {
    color-scheme: light;
    --bg: #eef1f6;
    --bg-2: #ffffff;
    --fg: #0b0e15;
    --fg-2: rgba(11, 14, 21, 0.78);
    --muted: rgba(11, 14, 21, 0.55);
    --faint: rgba(11, 14, 21, 0.32);
    --line: rgba(11, 14, 21, 0.1);
    --glass: rgba(255, 255, 255, 0.6);
    --glass-2: rgba(255, 255, 255, 0.9);
    --seg-on: #ffffff;
    --sheet: rgba(250, 251, 253, 0.94);
    --c12: #0a9bb8;
    --c24: #7b4dff;
    --day: #e6a019;
    --night: #4f5de0;
    --danger: #e0294a;
    --on-accent: #ffffff;
    --face-1: rgba(255, 255, 255, 0.95);
    --face-2: rgba(255, 255, 255, 0.55);
    --tick: rgba(11, 14, 21, 0.18);
    --tick-major: rgba(11, 14, 21, 0.6);
    --shadow: 0 30px 70px -24px rgba(30, 40, 80, 0.28);
    --glow-1: rgba(10, 170, 210, 0.14);
    --glow-2: rgba(123, 77, 255, 0.12);
  }
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  background: var(--bg);
  color: var(--fg);
  font-family: var(--ui);
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
}

button, input { font: inherit; color: inherit; }
button { cursor: pointer; background: none; border: 0; padding: 0; }
svg { display: block; }
[hidden] { display: none !important; }

/* ── the app frame ─────────────────────────────────────────────────────── */

.app {
  position: relative;
  height: 100vh;
  height: 100svh;
  min-height: 300px;
  display: grid;
  grid-template-rows: auto 1fr auto;
  overflow: hidden;
  isolation: isolate;
  padding: env(safe-area-inset-top) env(safe-area-inset-right) env(safe-area-inset-bottom) env(safe-area-inset-left);
  --dial: min(34vw, 48vh);
  --dial: min(34vw, 48svh);
  --digit: min(5vw, 8.5vh);
  --digit: min(5vw, 8.5svh);
}
.app[data-analog="0"] { --digit: min(8.4vw, 21svh); }
.app[data-digital="0"] { --dial: min(40vw, 64svh); }

@media (orientation: portrait) {
  .app { --dial: min(58vw, 24svh); --digit: min(12vw, 6svh); }
  .app[data-analog="0"] { --digit: min(18vw, 12svh); }
  .app[data-digital="0"] { --dial: min(76vw, 31svh); }
}

.glow {
  position: absolute;
  inset: -20%;
  z-index: -1;
  pointer-events: none;
  background:
    radial-gradient(40% 45% at 22% 28%, var(--glow-1), transparent 70%),
    radial-gradient(42% 48% at 80% 74%, var(--glow-2), transparent 70%);
  animation: drift 40s ease-in-out infinite alternate;
}
@keyframes drift {
  to { transform: translate3d(3%, -2%, 0) rotate(6deg); }
}

/* ── header ────────────────────────────────────────────────────────────── */

.bar {
  grid-row: 1;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px clamp(14px, 3vw, 28px);
  z-index: 5;
  transition: opacity 0.35s ease, transform 0.35s ease;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  color: inherit;
  text-decoration: none;
  flex-shrink: 0;
}
.brand img { border-radius: 8px; }
.brand h1 {
  margin: 0;
  font-size: 15px;
  font-weight: 500;
  letter-spacing: -0.01em;
  white-space: nowrap;
}
.brand h1 span {
  background: linear-gradient(90deg, var(--c12), var(--c24));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  font-weight: 650;
}

.switches {
  display: flex;
  gap: 4px;
  margin: 0 auto;
  padding: 4px;
  border-radius: 999px;
  background: var(--glass);
  border: 1px solid var(--line);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
}
.switches .switch { padding: 6px 12px 6px 7px; border-radius: 999px; }
.switches .switch:hover { background: var(--glass-2); }

.switch {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  font-weight: 500;
  color: var(--fg-2);
}
.switch .track {
  position: relative;
  width: 34px;
  height: 20px;
  border-radius: 999px;
  background: var(--glass-2);
  border: 1px solid var(--line);
  transition: background 0.25s ease, border-color 0.25s ease;
  flex-shrink: 0;
}
.switch .thumb {
  position: absolute;
  top: 2px;
  left: 2px;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: var(--muted);
  transition: transform 0.28s cubic-bezier(0.3, 1.4, 0.5, 1), background 0.25s ease;
}
.switch[aria-checked="true"] { color: var(--fg); }
.switch[aria-checked="true"] .track {
  background: linear-gradient(90deg, var(--c12), var(--c24));
  border-color: transparent;
}
.switch[aria-checked="true"] .thumb { transform: translateX(14px); background: var(--on-accent); }

.actions { display: flex; align-items: center; gap: 6px; flex-shrink: 0; }

.icon-btn {
  position: relative;
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  color: var(--fg-2);
  transition: background 0.2s ease, color 0.2s ease;
}
.icon-btn:hover { background: var(--glass-2); color: var(--fg); }
.icon-btn svg, .pill-btn svg, .primary svg {
  width: 20px;
  height: 20px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.7;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.icon-btn svg .fill { fill: currentColor; stroke: none; }
.icon-btn .dot {
  position: absolute;
  top: 8px;
  right: 8px;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--c12);
  box-shadow: 0 0 0 2px var(--bg);
}

.pill-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 36px;
  padding: 0 14px 0 11px;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 600;
  color: var(--on-accent);
  background: linear-gradient(135deg, var(--c12), var(--c24));
  margin-right: 4px;
}
.pill-btn svg { width: 17px; height: 17px; stroke-width: 2; }

:focus-visible { outline: 2px solid var(--c12); outline-offset: 2px; }

/* ── the clocks ────────────────────────────────────────────────────────── */

.clocks {
  grid-row: 2;
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  justify-items: center;
  min-height: 0;
  padding: 0 4vw;
}
.divider {
  order: 1;
  width: 1px;
  height: 56%;
  background: linear-gradient(transparent, var(--line), transparent);
}
#clock12 { order: 0; --c: var(--c12); }
#clock24 { order: 2; --c: var(--c24); }
.app[data-primary="24"] #clock24 { order: 0; }
.app[data-primary="24"] #clock12 { order: 2; }

@media (orientation: portrait) {
  .clocks { grid-template-columns: 1fr; grid-template-rows: 1fr auto 1fr; padding: 0 16px; }
  .divider { width: 56%; height: 1px; background: linear-gradient(90deg, transparent, var(--line), transparent); }
}

.clock {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: clamp(8px, 2svh, 22px);
  min-width: 0;
}

.clock-head {
  display: flex;
  align-items: center;
  gap: 8px;
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}
.clock-head .fmt {
  color: var(--c);
  padding: 4px 9px;
  border-radius: 999px;
  background: color-mix(in srgb, var(--c) 12%, transparent);
  border: 1px solid color-mix(in srgb, var(--c) 28%, transparent);
}
.clock-head .sys { color: var(--muted); }

.dial { width: var(--dial); height: var(--dial); }
.dial svg { width: 100%; height: 100%; overflow: visible; }
.app[data-analog="0"] .dial { display: none; }
.app[data-digital="0"] .digital { display: none; }

.digital {
  display: flex;
  align-items: baseline;
  font-size: var(--digit);
  font-weight: 220;
  line-height: 1;
  letter-spacing: -0.045em;
  font-variant-numeric: tabular-nums;
  font-feature-settings: 'tnum' 1;
  white-space: nowrap;
}
.digital .hm { color: var(--fg); }
.clock.is-primary .digital .hm {
  background: linear-gradient(180deg, var(--fg) 30%, color-mix(in srgb, var(--fg) 55%, var(--c)));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
.clock:not(.is-primary) .digital .hm { color: var(--fg-2); }
.digital .sec {
  font-size: 0.4em;
  font-weight: 300;
  letter-spacing: -0.02em;
  color: var(--c);
  margin-left: 0.08em;
  min-width: 1.6em;
}
.app[data-seconds="0"] .digital .sec { display: none; }
.digital .ampm {
  align-self: center;
  margin-left: 0.3em;
  padding: 0.28em 0.5em;
  font-family: var(--mono);
  font-size: max(11px, 0.22em);
  font-weight: 500;
  letter-spacing: 0.08em;
  color: var(--fg-2);
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--glass);
}

/* dial parts — drawn by app.js on a -100…100 viewBox */
.face { stroke: var(--line); stroke-width: 0.6; }
.tick { stroke: var(--tick); stroke-width: 0.8; stroke-linecap: round; }
.tick.major { stroke: var(--tick-major); stroke-width: 1.6; }
.num {
  fill: var(--muted);
  font-family: var(--ui);
  font-size: 10.5px;
  font-weight: 350;
  text-anchor: middle;
  dominant-baseline: central;
}
.num.small { font-size: 7.5px; fill: var(--faint); }
.dial-name {
  fill: var(--c);
  font-family: var(--mono);
  font-size: 6.5px;
  letter-spacing: 0.2em;
  text-anchor: middle;
  dominant-baseline: central;
  opacity: 0.85;
}
.arc { fill: none; stroke-width: 2.4; stroke-linecap: round; opacity: 0.55; }
.arc.day { stroke: var(--day); }
.arc.night { stroke: var(--night); }
.hand { stroke-linecap: round; }
.hand.h { stroke: var(--fg); stroke-width: 5; }
.hand.m { stroke: var(--fg); stroke-width: 3; }
.hand.s { stroke: var(--c); stroke-width: 1.2; }
.cap { fill: var(--c); }
.cap-ring { fill: var(--bg); }

/* ── footer ────────────────────────────────────────────────────────────── */

.meta {
  grid-row: 3;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  padding: 10px 16px clamp(14px, 3svh, 30px);
  text-align: center;
}
.meta p { margin: 0; }
.date { font-size: 15px; color: var(--fg-2); letter-spacing: -0.01em; }
.zone { font-family: var(--mono); font-size: 11px; letter-spacing: 0.08em; color: var(--muted); }
.next-alarm {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin-top: 4px;
  padding: 7px 14px;
  border-radius: 999px;
  font-size: 13px;
  color: var(--fg-2);
  background: var(--glass);
  border: 1px solid var(--line);
}
.next-alarm:hover { background: var(--glass-2); }
.next-alarm b { font-weight: 600; color: var(--fg); }

/* ── compact: a small desktop widget window, or a phone on its side ─────── */

@media (max-height: 460px) {
  .bar {
    position: absolute;
    inset: 0 0 auto 0;
    opacity: 0;
    transform: translateY(-8px);
    pointer-events: none;
    background: linear-gradient(var(--bg) 40%, transparent);
    padding-top: 8px;
    padding-bottom: 16px;
  }
  .app:hover .bar, .app.show-ui .bar, .bar:focus-within {
    opacity: 1;
    transform: none;
    pointer-events: auto;
  }
  .brand h1 { display: none; }
  .switches .switch-label { display: none; }
  .switches .switch { padding: 6px; }
  .zone { display: none; }
  .meta { padding: 4px 12px 10px; gap: 4px; }
  .date { font-size: 12px; }
  .next-alarm { padding: 4px 10px; font-size: 11px; margin-top: 0; }
  .clocks { padding-top: 8px; }
  .clock { gap: 6px; }
  .clock-head { font-size: 9px; }
  .clock-head .fmt { padding: 2px 7px; }
  .app { --dial: min(32vw, 56svh); --digit: min(5.2vw, 11svh); }
  .app[data-analog="0"] { --digit: min(8.4vw, 26svh); }
  .app[data-digital="0"] { --dial: min(40vw, 70svh); }
}

@media (max-width: 560px) and (orientation: landscape), (max-width: 420px) {
  .brand h1 { display: none; }
}
/* A phone held upright: the style switches drop to their own centred row. */
@media (max-width: 640px) and (min-height: 461px) {
  .bar {
    display: grid;
    grid-template-columns: auto 1fr;
    row-gap: 10px;
    padding-top: 10px;
    padding-bottom: 4px;
  }
  .brand { grid-column: 1; grid-row: 1; }
  .actions { grid-column: 2; grid-row: 1; justify-self: end; }
  .switches { grid-column: 1 / -1; grid-row: 2; justify-self: center; margin: 0; }
  .pill-btn span { display: none; }
  .pill-btn { width: 40px; padding: 0; justify-content: center; margin-right: 0; }
}
@media (max-width: 360px) {
  .actions { gap: 0; }
  .icon-btn { width: 36px; }
}

/* ── installed on a desktop, title bar folded into the page ────────────── */

/* The header becomes the title bar: always shown (a drag region swallows the
   hover that would reveal it), draggable, and kept clear of the window's own
   minimise/maximise/close buttons on the right. */
@media (display-mode: window-controls-overlay) {
  .bar {
    position: relative;
    inset: auto;
    opacity: 1;
    transform: none;
    pointer-events: auto;
    background: none;
    min-height: max(env(titlebar-area-height, 36px), 44px);
    padding-top: 2px;
    padding-bottom: 2px;
    padding-right: calc(100vw - env(titlebar-area-x, 0px) - env(titlebar-area-width, 100vw) + 8px);
    -webkit-app-region: drag;
    app-region: drag;
  }
  .bar button, .bar a { -webkit-app-region: no-drag; app-region: no-drag; }
  .brand { pointer-events: none; }
}
@media (display-mode: window-controls-overlay) and (max-height: 460px) {
  .bar { padding-left: 10px; gap: 6px; }
  .icon-btn { width: 32px; height: 32px; }
  .switches { padding: 2px; }
}

/* ── bedside: full screen, screen kept on, controls on tap ─────────────── */

.app.bedside .bar {
  position: absolute;
  inset: 0 0 auto 0;
  opacity: 0;
  pointer-events: none;
  background: linear-gradient(var(--bg) 40%, transparent);
}
.app.bedside.show-ui .bar { opacity: 1; pointer-events: auto; }
.app.bedside { cursor: none; }
.app.bedside.show-ui { cursor: auto; }
.app.bedside .glow { opacity: 0.5; }

/* ── sheets ────────────────────────────────────────────────────────────── */

dialog.sheet {
  width: min(460px, calc(100vw - 24px));
  max-height: min(88svh, 780px);
  padding: 20px 20px 22px;
  border: 1px solid var(--line);
  border-radius: 26px;
  background: var(--sheet);
  color: var(--fg);
  box-shadow: var(--shadow);
  backdrop-filter: blur(24px) saturate(1.3);
  -webkit-backdrop-filter: blur(24px) saturate(1.3);
  overflow: auto;
  overscroll-behavior: contain;
}
dialog.sheet[open] { animation: sheet-in 0.32s cubic-bezier(0.2, 0.9, 0.25, 1); }
dialog.sheet::backdrop {
  background: rgba(3, 4, 8, 0.5);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
}
@keyframes sheet-in {
  from { opacity: 0; transform: translateY(18px) scale(0.98); }
}
@media (max-width: 560px) {
  dialog.sheet {
    margin: auto 0 0;
    width: 100%;
    max-width: 100%;
    border-radius: 26px 26px 0 0;
    border-bottom: 0;
    padding-bottom: calc(22px + env(safe-area-inset-bottom));
  }
}

.sheet-head { display: flex; align-items: center; justify-content: space-between; margin: -4px -8px 12px 0; }
.sheet h2 { margin: 0; font-size: 20px; font-weight: 600; letter-spacing: -0.02em; }
.sheet h3 { margin: 0; font-size: 14px; font-weight: 600; }
.hint { margin: 3px 0 0; font-size: 12.5px; color: var(--muted); }
.note { margin: 16px 0 0; font-size: 12.5px; line-height: 1.55; color: var(--muted); }
.note strong { color: var(--fg-2); font-weight: 600; }

.seg {
  display: inline-flex;
  padding: 3px;
  gap: 2px;
  border-radius: 12px;
  background: var(--glass);
  border: 1px solid var(--line);
}
.seg button {
  padding: 7px 12px;
  border-radius: 9px;
  font-size: 13px;
  font-weight: 500;
  color: var(--muted);
  transition: background 0.2s ease, color 0.2s ease;
}
.seg button[aria-checked="true"] {
  background: var(--seg-on);
  color: var(--fg);
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.18);
}
.seg.vertical { flex-direction: column; }
.seg.vertical button { padding: 9px 12px; }

.primary, .ghost {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  height: 44px;
  padding: 0 18px;
  border-radius: 14px;
  font-size: 14px;
  font-weight: 600;
}
.primary { color: var(--on-accent); background: linear-gradient(135deg, var(--c12), var(--c24)); }
.primary:hover { filter: brightness(1.06); }
.ghost { color: var(--fg); border: 1px solid var(--line); background: var(--glass); }
.ghost:hover { background: var(--glass-2); }
.ghost.small { height: 34px; padding: 0 12px; font-size: 13px; border-radius: 10px; }
.danger { color: var(--danger); }
.wide { width: 100%; margin-top: 12px; }
.big { height: 56px; padding: 0 28px; font-size: 16px; border-radius: 18px; }

/* settings rows */
.setting {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 14px 0;
  border-top: 1px solid var(--line);
}
.setting .inline { display: flex; align-items: center; gap: 8px; }
@media (max-width: 420px) {
  .setting { flex-wrap: wrap; }
}

/* alarm list */
.alarm-list { display: flex; flex-direction: column; gap: 8px; }
.alarm-list .empty {
  padding: 22px 12px;
  text-align: center;
  font-size: 14px;
  color: var(--muted);
  border: 1px dashed var(--line);
  border-radius: 18px;
}
.alarm {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 12px 12px 16px;
  border-radius: 18px;
  background: var(--glass);
  border: 1px solid var(--line);
  text-align: left;
  width: 100%;
}
.alarm .when { flex: 1; min-width: 0; cursor: pointer; }
.alarm .t1 { font-size: 26px; font-weight: 300; letter-spacing: -0.03em; font-variant-numeric: tabular-nums; }
.alarm .t1 small { font-size: 12px; font-family: var(--mono); letter-spacing: 0.06em; margin-left: 4px; color: var(--fg-2); }
.alarm .t2 { font-family: var(--mono); font-size: 12px; color: var(--muted); margin-left: 8px; }
.alarm .sub { margin-top: 2px; font-size: 12.5px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.alarm.off .t1, .alarm.off .t2 { opacity: 0.45; }

/* editor */
.editor {
  margin-top: 12px;
  padding: 16px;
  border-radius: 20px;
  background: var(--glass);
  border: 1px solid var(--line);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
}
.time-input { display: flex; align-items: center; gap: 8px; }
.spin { display: flex; flex-direction: column; align-items: center; }
.spin button {
  width: 44px;
  height: 30px;
  display: grid;
  place-items: center;
  border-radius: 10px;
  color: var(--muted);
}
.spin button:hover { background: var(--glass-2); color: var(--fg); }
.spin svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.spin input {
  width: 84px;
  height: 72px;
  text-align: center;
  font-size: 46px;
  font-weight: 250;
  letter-spacing: -0.04em;
  font-variant-numeric: tabular-nums;
  border-radius: 16px;
  border: 1px solid var(--line);
  background: var(--bg-2);
  outline: none;
}
.spin input:focus { border-color: var(--c12); box-shadow: 0 0 0 3px color-mix(in srgb, var(--c12) 25%, transparent); }
.colon { font-size: 40px; font-weight: 250; color: var(--muted); margin-top: -6px; }
.time-input .seg.vertical { margin-left: 6px; }
.equiv { margin: 0; font-size: 14px; color: var(--muted); }
.equiv b { color: var(--fg); font-weight: 600; font-variant-numeric: tabular-nums; }

.quick { display: flex; flex-wrap: wrap; justify-content: center; gap: 6px; }
.quick button {
  padding: 6px 11px;
  border-radius: 999px;
  font-size: 12.5px;
  color: var(--fg-2);
  border: 1px solid var(--line);
}
.quick button:hover { background: var(--glass-2); }

.days { display: flex; gap: 6px; }
.days button {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  font-size: 13px;
  font-weight: 600;
  color: var(--muted);
  border: 1px solid var(--line);
}
.days button[aria-pressed="true"] { color: var(--on-accent); background: linear-gradient(135deg, var(--c12), var(--c24)); border-color: transparent; }
.editor .hint { margin: -4px 0 0; }

.text {
  width: 100%;
  height: 44px;
  padding: 0 14px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: var(--bg-2);
  font-size: 14px;
  outline: none;
}
.text:focus { border-color: var(--c12); }
.row-actions { display: flex; gap: 8px; width: 100%; }
.row-actions .primary { flex: 1; }

/* help */
.help section { padding: 12px 0; border-top: 1px solid var(--line); }
.help h3 { margin-bottom: 6px; }
.help ol { margin: 0; padding-left: 20px; font-size: 13.5px; line-height: 1.6; color: var(--fg-2); }
.help li + li { margin-top: 6px; }
.help section.here h3::after {
  content: 'This device';
  margin-left: 8px;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 500;
  color: var(--on-accent);
  background: linear-gradient(135deg, var(--c12), var(--c24));
}
code, kbd {
  font-family: var(--mono);
  font-size: 0.9em;
  padding: 1px 5px;
  border-radius: 6px;
  background: var(--glass-2);
  border: 1px solid var(--line);
}

/* ── ringing ───────────────────────────────────────────────────────────── */

.ringing {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 24px;
  text-align: center;
  background:
    radial-gradient(60% 50% at 50% 45%, color-mix(in srgb, var(--c12) 22%, transparent), transparent 70%),
    radial-gradient(70% 60% at 50% 60%, color-mix(in srgb, var(--c24) 20%, transparent), transparent 75%),
    var(--bg);
  animation: fade-in 0.4s ease;
}
@keyframes fade-in { from { opacity: 0; } }
.rings { position: absolute; inset: 0; display: grid; place-items: center; pointer-events: none; overflow: hidden; }
.rings span {
  position: absolute;
  width: min(70vw, 70vh);
  aspect-ratio: 1;
  border-radius: 50%;
  border: 1px solid color-mix(in srgb, var(--c12) 50%, transparent);
  animation: ring-out 3s cubic-bezier(0.2, 0.6, 0.4, 1) infinite;
  opacity: 0;
}
.rings span:nth-child(2) { animation-delay: 1s; border-color: color-mix(in srgb, var(--c24) 50%, transparent); }
.rings span:nth-child(3) { animation-delay: 2s; }
@keyframes ring-out {
  from { transform: scale(0.3); opacity: 0.9; }
  to { transform: scale(1.5); opacity: 0; }
}
.ringing p { margin: 0; position: relative; }
.ring-label { font-family: var(--mono); font-size: 13px; letter-spacing: 0.18em; text-transform: uppercase; color: var(--c12); }
.ring-first {
  font-size: min(20vw, 26vh);
  font-weight: 200;
  letter-spacing: -0.05em;
  line-height: 1.05;
  font-variant-numeric: tabular-nums;
}
.ring-second { font-size: min(7vw, 9vh); font-weight: 300; color: var(--muted); font-variant-numeric: tabular-nums; }
.ring-actions { position: relative; display: flex; gap: 12px; margin-top: 28px; flex-wrap: wrap; justify-content: center; }

/* ── toast ─────────────────────────────────────────────────────────────── */

.toast {
  position: fixed;
  left: 50%;
  bottom: calc(24px + env(safe-area-inset-bottom));
  z-index: 60;
  transform: translateX(-50%);
  max-width: calc(100vw - 32px);
  padding: 11px 18px;
  border-radius: 14px;
  font-size: 14px;
  background: var(--sheet);
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  animation: toast-in 0.3s cubic-bezier(0.2, 0.9, 0.25, 1);
}
@keyframes toast-in { from { opacity: 0; transform: translate(-50%, 10px); } }

/* ── below the fold: the explainer, for the browser tab only ───────────── */

.about {
  max-width: 760px;
  margin: 0 auto;
  padding: 72px 20px 96px;
  color: var(--fg-2);
  font-size: 16px;
  line-height: 1.7;
  border-top: 1px solid var(--line);
}
.about h2 { margin: 40px 0 10px; font-size: 22px; font-weight: 600; letter-spacing: -0.02em; color: var(--fg); }
.about h2:first-child { margin-top: 0; }
.about p { margin: 0 0 14px; }
.about a { color: var(--c12); }
.credit { margin-top: 40px !important; font-size: 14px; color: var(--muted); }
.chart {
  display: grid;
  border: 1px solid var(--line);
  border-radius: 16px;
  overflow: hidden;
  font-size: 14px;
  font-variant-numeric: tabular-nums;
}
.chart > div { display: grid; grid-template-columns: 1.4fr 1fr 1.4fr 1fr; }
.chart > div:nth-child(even) { background: var(--glass); }
.chart span { padding: 8px 12px; }
.chart .chart-head { font-family: var(--mono); font-size: 11px; letter-spacing: 0.12em; text-transform: uppercase; color: var(--muted); background: var(--glass-2); }
.noscript { padding: 20px; text-align: center; }

@media (display-mode: standalone), (display-mode: window-controls-overlay), (display-mode: fullscreen), (display-mode: minimal-ui) {
  .about { display: none; }
  html, body { overflow: hidden; overscroll-behavior: none; }
  .brand { pointer-events: none; }
}

/* Inside the Android app: the same, plus its floating window. */
.in-app .about { display: none; }
html.in-app, html.in-app body { overflow: hidden; overscroll-behavior: none; }
.in-app .brand { pointer-events: none; }
.in-app .setting .inline { flex-wrap: wrap; justify-content: flex-end; }
.in-pip .bar, .in-pip .meta, .in-pip .clock-head .sys { display: none !important; }
.in-pip .app { grid-template-rows: 0 1fr 0; --dial: min(30vw, 64svh); --digit: min(6.4vw, 15svh); }
.in-pip .app[data-analog="0"] { --digit: min(10vw, 34svh); }
.in-pip .app[data-digital="0"] { --dial: min(40vw, 80svh); }
.in-pip .clocks { padding: 0 2vw; }
.in-pip .clock { gap: 4px; }
.in-pip .clock-head { font-size: 8px; }

.warn {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: 14px;
  padding: 12px 14px;
  border-radius: 16px;
  font-size: 13px;
  line-height: 1.45;
  color: var(--fg);
  background: color-mix(in srgb, var(--danger) 14%, transparent);
  border: 1px solid color-mix(in srgb, var(--danger) 40%, transparent);
}
.warn p { margin: 0; flex: 1; }

/* ── the floating widget window (Document Picture-in-Picture) ──────────── */

body.pip {
  height: 100vh;
  margin: 0;
  overflow: hidden;
  display: grid;
  place-items: center;
  background: radial-gradient(80% 90% at 20% 20%, var(--glow-1), transparent), radial-gradient(80% 90% at 80% 90%, var(--glow-2), transparent), var(--bg);
  user-select: none;
  -webkit-user-select: none;
}
.mini {
  display: flex;
  align-items: center;
  justify-content: space-evenly;
  width: 100%;
  height: 100%;
  padding: 0 4vw;
}
.mini .clock { gap: 3vh; }
.mini .clock-head { font-size: max(8px, min(2.6vw, 7vh)); }
.mini .digital { font-size: min(10vw, 30vh); }
.mini .dial { width: min(24vw, 50vh); height: min(24vw, 50vh); }
.mini[data-analog="1"][data-digital="1"] .digital { font-size: min(6.6vw, 18vh); }
.mini[data-analog="0"] .dial, .mini[data-digital="0"] .digital { display: none; }
.mini[data-seconds="0"] .digital .sec { display: none; }
.mini .rule { width: 1px; height: 60%; background: var(--line); }

@media (prefers-reduced-motion: reduce) {
  .glow, .rings span { animation: none; }
  dialog.sheet[open], .toast, .ringing { animation: none; }
}
