:root {
  color-scheme: light;
  --ink: #203753;
  --muted: #586e82;
  --paper: #f2f9ff;
  --card: #fff;
  --blue: #227bc0;
  --blue-soft: #eaf4ff;
  --teal: #168775;
  --coral: #d95740;
  --yellow: #ffd45b;
  --line: #dce7ef;
  font-family: ui-rounded, "SF Pro Rounded", "Segoe UI", system-ui, sans-serif;
  -webkit-font-smoothing: antialiased;
}
* { box-sizing: border-box; }
body { margin: 0; min-width: 320px; min-height: 100vh; color: var(--ink); background: var(--paper); }
body[data-theme="girls"] { --ink: #4e365e; --muted: #786184; --paper: #fff5fb; --blue: #8a55b0; --blue-soft: #f5eafa; --teal: #b73d7b; --coral: #c34e5c; --line: #eaddec; }
button, select, input { font: inherit; }
button { color: inherit; touch-action: manipulation; }
button:not(:disabled), select, .switchRow { cursor: pointer; }
:focus-visible { outline: 3px solid var(--blue); outline-offset: 5px; }
[hidden] { display: none !important; }
.srOnly { position: absolute; width: 1px; height: 1px; padding: 0; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0; }
.topbar { width: min(1100px, calc(100% - 48px)); min-height: 96px; margin: auto; display: flex; align-items: center; justify-content: space-between; gap: 20px; }
.brand { display: inline-flex; align-items: center; gap: 12px; color: inherit; text-decoration: none; min-width: 0; }
.brand strong { font-size: 1.25rem; font-weight: 850; letter-spacing: -.035em; }
.brandMark { display: grid; flex: 0 0 46px; width: 46px; height: 46px; place-items: center; border-radius: 16px; transform: rotate(-7deg); background: var(--yellow); }
.brandMark svg { width: 38px; height: 38px; }
.brandMark circle:first-child { fill: white; stroke: var(--ink); stroke-width: 2; }
.brandMark path { fill: none; stroke: var(--ink); stroke-width: 3; stroke-linecap: round; stroke-linejoin: round; }
.brandMark circle:last-child { fill: var(--coral); }
.headerTools { display: flex; gap: 8px; flex-shrink: 0; }
.iconButton, .closeButton { display: grid; width: 46px; height: 46px; place-items: center; border: 1px solid var(--line); border-radius: 16px; background: var(--card); }
.iconButton svg { width: 22px; fill: none; stroke: currentColor; stroke-width: 1.8; }
.appShell { width: min(1080px, calc(100% - 48px)); margin: 0 auto; padding: 16px 0 48px; }
.intro { text-align: center; margin-bottom: 30px; }
.intro h1 { margin: 0; font-size: clamp(1.75rem, 3vw, 2.5rem); letter-spacing: -.04em; font-weight: 850; }
.intro p { margin: 8px 0 0; color: var(--muted); font-size: 1rem; line-height: 1.5; }
.clockWorkspace { display: grid; grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr); align-items: center; gap: 30px; padding: 30px 42px 30px 22px; border: 1px solid var(--line); border-radius: 36px; background: var(--card); box-shadow: 0 16px 48px #20375308; }
.clockPanel, .timePanel { min-width: 0; }
.clockStage { position: relative; width: min(100%, 510px); aspect-ratio: 1; margin: 0 auto 14px; user-select: none; -webkit-user-select: none; }
.clockSvg { display: block; width: 100%; height: 100%; overflow: visible; touch-action: pan-y; }
.clockShadow { fill: #20375310; }
.clockRimOuter { fill: #409edf; stroke: #267cbb; stroke-width: 2; }
.clockRim { fill: #b7e3fa; stroke: #e4f6ff; stroke-width: 5; }
.clockFace { fill: #fff; stroke: #e0edf5; stroke-width: 2; }
body[data-theme="girls"] .clockRimOuter { fill: #d986b6; stroke: #bd6499; }
body[data-theme="girls"] .clockRim { fill: #f4cde5; stroke: #ffedf7; }
body[data-theme="girls"] .clockFace { stroke: #f0e2ee; }
.tick { stroke: #becbd5; stroke-linecap: round; stroke-width: 2; }
.tickMajor { stroke: #536d83; stroke-width: 4; }
.clockNumber { fill: var(--ink); font-size: 34px; font-weight: 800; pointer-events: none; }
.minuteNumber { fill: var(--teal); font-size: 14px; font-weight: 700; pointer-events: none; }
.quarterArc { fill: none; stroke: #ffd45b18; stroke-width: 18; stroke-linecap: round; }
.quarterArc.isActive { stroke: #ffd45b66; }
.dragHand { cursor: grab; touch-action: none; }
.dragHand:active { cursor: grabbing; }
.dragHand.isDragging { filter: drop-shadow(0 3px 4px #20375333); }
.handHitArea { stroke: transparent; stroke-width: 46; stroke-linecap: round; }
.secondHitArea { stroke-width: 24; }
.hourHand, .minuteHand, .secondHand { stroke-linecap: round; }
.handOutline { stroke: white !important; }
.hourHand.handOutline { stroke-width: 23; }
.minuteHand.handOutline { stroke-width: 17; }
.hourHand { stroke: var(--blue); stroke-width: 17; }
.minuteHand { stroke: var(--teal); stroke-width: 11; }
.secondHand { stroke: var(--coral); stroke-width: 4; }
.hourHandle { fill: var(--blue); stroke: white; stroke-width: 3; }
.minuteHandle { fill: var(--teal); stroke: white; stroke-width: 3; }
.secondHandle { fill: var(--coral); stroke: white; stroke-width: 2; }
.clockPinOuter { fill: var(--ink); }
.clockPinMiddle { fill: white; }
.clockPinInner { fill: var(--coral); }
.quarterCallout { position: absolute; top: 12%; left: 50%; transform: translateX(-50%); padding: 8px 12px; border-radius: 20px; color: #684818; background: #fff1bb; font-size: .875rem; font-weight: 750; white-space: nowrap; pointer-events: none; }
.handLegend { display: flex; justify-content: center; flex-wrap: wrap; gap: 18px; color: var(--muted); font-size: .875rem; }
.handLegend > span { display: inline-flex; align-items: center; gap: 7px; }
.handLegend i { display: inline-block; border-radius: 8px; }
.hourDot { width: 15px; height: 7px; background: var(--blue); }
.minuteDot { width: 23px; height: 5px; background: var(--teal); }
.secondDot { width: 25px; height: 3px; background: var(--coral); }
.timePanel { padding-top: 18px; }
.statePill { display: inline-flex; align-items: center; gap: 8px; color: var(--muted); font-size: .875rem; font-weight: 650; }
.statePill i { width: 7px; height: 7px; border-radius: 50%; background: var(--teal); }
.statePill.isCustom i { background: var(--coral); }
.digitalDisplay { display: flex; flex-wrap: wrap; align-items: baseline; gap: 10px; margin-top: 12px; }
.digitalTime { font-size: clamp(2.75rem, 5.5vw, 4.5rem); font-weight: 800; font-variant-numeric: tabular-nums; letter-spacing: -.055em; line-height: 1.15; white-space: nowrap; direction: ltr; }
.periodPill { color: var(--muted); font-size: 1rem; font-weight: 750; }
.writtenTime { display: block; min-height: 2.7em; margin-top: 16px; color: var(--ink); font-size: clamp(1.3rem, 2.3vw, 1.8rem); font-weight: 650; line-height: 1.35; overflow-wrap: anywhere; }
.speakButton { display: inline-flex; min-height: 46px; align-items: center; gap: 9px; padding: 10px 16px; margin-top: 10px; border: 0; border-radius: 24px; color: var(--blue); background: var(--blue-soft); font-weight: 750; }
.speakButton svg { width: 21px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.speakButton.isSpeaking { box-shadow: 0 0 0 3px var(--blue); }
.speakButton:disabled { opacity: .6; cursor: default; }
.primaryActions { display: grid; grid-template-columns: 1fr 1.4fr; gap: 12px; margin-top: 30px; }
.actionButton { display: flex; align-items: center; justify-content: center; gap: 8px; min-height: 56px; padding: 12px; border: 0; border-radius: 18px; font-weight: 750; box-shadow: inset 0 -3px #0000000c; }
.actionButton > span:first-child { font-size: 1.35rem; }
.nowButton { color: white; background: var(--blue); }
.randomButton { color: #533d09; background: var(--yellow); }
.actionButton:active { transform: translateY(2px); box-shadow: none; }
button { transition: background-color .15s, box-shadow .15s; }
.companion { display: flex; align-items: center; justify-content: space-between; gap: 14px; margin-top: 20px; }
.themeMascot { flex: 0 0 76px; width: 76px; height: 76px; background: url('/assets/dino-mascot.png') center / contain no-repeat; }
body[data-theme="girls"] .themeMascot { background-image: url('/assets/unicorn-mascot.png'); }
.timezoneLabel { color: var(--muted); font-size: .875rem; overflow-wrap: anywhere; }
.settingsDialog { width: min(600px, calc(100% - 24px)); max-height: calc(100dvh - 24px); padding: 0; overflow: hidden; border: 1px solid var(--line); border-radius: 28px; color: var(--ink); background: var(--card); box-shadow: 0 30px 90px #20375340; }
.settingsDialog::backdrop { background: #20375366; backdrop-filter: blur(4px); }
.settingsSheet { display: flex; max-height: calc(100dvh - 28px); flex-direction: column; }
.settingsHeader { padding: 20px 24px; display: flex; justify-content: space-between; align-items: center; border-bottom: 1px solid var(--line); }
.settingsHeader h2 { margin: 0; font-size: 1.5rem; }
.closeButton { font-size: 1.8rem; line-height: 1; }
.settingsScroll { padding: 0 24px; overflow-y: auto; }
.settingsSection { padding: 20px 0; border-bottom: 1px solid var(--line); }
.settingsSection:last-child { border-bottom: 0; }
.settingsSection h3 { margin: 0 0 12px; font-size: 1rem; }
.fieldLabel { display: grid; min-width: 0; gap: 6px; color: var(--muted); font-size: .875rem; font-weight: 650; }
.fieldLabel select { width: 100%; min-height: 46px; padding: 10px; border: 1px solid var(--line); border-radius: 12px; color: var(--ink); background: white; font-size: 1rem; }
.twoFields { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.twoFields h3, .fullField { grid-column: 1 / -1; }
.switchGrid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px 24px; }
.switchRow { position: relative; min-height: 52px; display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.switchRow > span { display: grid; gap: 4px; }
.switchRow strong { font-size: .875rem; }
.switchRow small { color: var(--muted); font-size: .875rem; }
.switchRow input { position: absolute; opacity: 0; }
.switchRow i { position: relative; flex: 0 0 42px; width: 42px; height: 25px; border-radius: 99px; background: #b9c6d0; }
.switchRow i::after { content: ""; position: absolute; top: 3px; left: 3px; width: 19px; height: 19px; border-radius: 50%; background: white; transition: transform .15s; }
.switchRow input:checked + i { background: var(--teal); }
.switchRow input:checked + i::after { transform: translateX(17px); }
.switchRow input:focus-visible + i { outline: 3px solid var(--blue); outline-offset: 4px; }
.saveSettings { flex-shrink: 0; min-height: 50px; margin: 18px 24px; border: 0; border-radius: 16px; color: white; background: var(--blue); font-weight: 750; }
@media (max-width: 760px) {
  .topbar { width: calc(100% - 32px); min-height: 78px; }
  .appShell { width: min(560px, calc(100% - 24px)); padding-top: 10px; }
  .intro { margin-bottom: 20px; }
  .intro p { margin-inline: 14px; }
  .clockWorkspace { grid-template-columns: 1fr; gap: 26px; padding: 16px 20px 20px; border-radius: 28px; }
  .clockStage { max-width: 390px; margin-bottom: 8px; }
  .timePanel { padding-top: 0; text-align: center; }
  .digitalDisplay { justify-content: center; margin-top: 8px; }
  .digitalTime { font-size: clamp(2.7rem, 10vw, 4rem); }
  .writtenTime { min-height: 0; margin-top: 10px; font-size: 1.4rem; }
  .speakButton { margin-top: 18px; }
  .primaryActions { margin-top: 24px; }
  .companion { justify-content: center; margin-top: 16px; }
  .themeMascot { flex-basis: 56px; width: 56px; height: 56px; }
}
@media (max-width: 420px) {
  .brand { gap: 8px; }
  .brand strong { font-size: 1rem; }
  .brandMark { flex-basis: 38px; width: 38px; height: 38px; }
  .brandMark svg { width: 32px; }
  .headerTools { gap: 5px; }
  .clockWorkspace { padding-inline: 12px; }
  .handLegend { gap: 12px; }
  .settingsHeader, .settingsScroll { padding-inline: 18px; }
  .twoFields, .switchGrid { grid-template-columns: 1fr; }
  .saveSettings { margin-inline: 18px; }
}
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { transition: none !important; animation: none !important; } }
body.reducedMotion *, body.reducedMotion *::before, body.reducedMotion *::after { transition: none !important; animation: none !important; }
@media (prefers-contrast: more) {
  body { --muted: var(--ink); --line: var(--ink); }
  .tick { stroke: #536d83; }
  .actionButton, .speakButton { border: 1px solid currentColor; }
}
