/* World Timer — shared page chrome */
:root {
  --bg: #f4f2ee; --fg: #17191d; --muted: #6b6f78; --line: rgba(20, 24, 32, .14); --panel: rgba(255, 255, 255, .72);
  --accent: #1e90ff;
  --mono: 'SF Mono', ui-monospace, 'Menlo', 'Monaco', 'Cascadia Mono', 'Ubuntu Mono', 'Consolas', monospace;
  --sans: 'Avenir Next', 'Helvetica Neue', 'Segoe UI', Roboto, Arial, sans-serif;
  color-scheme: light dark;
}
@media (prefers-color-scheme: dark) {
  :root { --bg: #0e1014; --fg: #eceef1; --muted: #8b909a; --line: rgba(255, 255, 255, .14); --panel: rgba(24, 27, 33, .72); }
}
:root[data-theme="dark"] { --bg: #0e1014; --fg: #eceef1; --muted: #8b909a; --line: rgba(255, 255, 255, .14); --panel: rgba(24, 27, 33, .72); color-scheme: dark; }
* { box-sizing: border-box; }
html { height: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--fg); font-family: var(--mono); line-height: 1.5;
  display: flex; flex-direction: column; align-items: center; min-height: 100vh; min-height: 100dvh;
  -webkit-font-smoothing: antialiased; overflow-x: hidden;
}
main { flex: 1; width: 100%; display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 10px 12px 4px; }
main > * { flex-shrink: 0; }      /* if a short window cannot hold everything, the page scrolls instead of overlapping */

/* the watch */
.wt { position: relative; width: min(94vw, calc(100dvh - var(--chrome, 225px)), 880px); min-width: 280px; aspect-ratio: 1; touch-action: none; user-select: none; -webkit-user-select: none; }
.wt-svg { display: block; width: 100%; height: 100%; overflow: visible; }
.wt-city { cursor: pointer; outline: none; }
.wt-city text { transition: fill .15s; }
.wt-city:hover text, .wt-city:focus-visible text { fill: #fff; }
.wt-city.home text { fill: var(--accent); font-weight: 700; }
.wt-city.wt-pip circle:last-child { transition: r .15s; }
.wt-city.wt-pip:hover circle:last-child, .wt-city.wt-pip:focus-visible circle:last-child { r: 5.5px; }
.wt-city.wt-pip.home circle:last-child { fill: var(--accent); r: 5px; }
.wt-city:focus-visible .wt-hit { stroke: var(--accent); stroke-width: 2; }
.wt-ring24 { cursor: grab; }
.wt.dragging, .wt.dragging * { cursor: grabbing !important; }
.wt-pusher { cursor: pointer; outline: none; }
.wt-pusher > g { transition: transform .08s ease-out; }
.wt-pusher.down > g, .wt-pusher:active > g { transform: translateY(7px); }
.wt-crown.down > g, .wt-crown:active > g { transform: translateX(-7px); }
.wt-pusher:focus-visible rect { stroke: var(--accent); stroke-width: 3; }
.wt-num { pointer-events: none; }
.wt-dial, .wt-map, .wt-hands, .wt-over, .wt-sub { cursor: pointer; }

.wt-tip {
  position: absolute; z-index: 5; transform: translate(-50%, 6px); opacity: 0; pointer-events: none; transition: opacity .12s, transform .12s;
  background: rgba(18, 20, 24, .95); color: #fff; border: 1px solid rgba(255, 255, 255, .16); border-radius: 8px; padding: 9px 13px 10px;
  font: 11px/1.45 var(--mono); min-width: 132px; max-width: 220px; box-shadow: 0 8px 24px rgba(0, 0, 0, .35);
}
.wt-tip.on { opacity: 1; transform: translate(-50%, 0); }
.wt-tip b { display: block; color: var(--accent); font-weight: 600; letter-spacing: .04em; border-bottom: 1px solid rgba(255, 255, 255, .15); padding-bottom: 5px; margin-bottom: 5px; }
.wt-tip span { display: block; }
.wt-tip .t { font-size: 15px; font-weight: 600; font-variant-numeric: tabular-nums; }
.wt-tip .d { color: #a5a9b1; }
.wt-tip .o { color: #c9ccd2; margin-top: 5px; }

/* readout under the watch */
.readout { text-align: center; margin-top: 2px; min-height: 92px; }
.readout .time { font-size: clamp(1.35rem, 4.2vw, 1.8rem); font-weight: 600; font-variant-numeric: tabular-nums; letter-spacing: .02em; }
.readout .date { font-size: .84rem; color: var(--muted); }
.readout .zone { font-size: .74rem; color: var(--muted); }
.readout .zone b { color: var(--fg); font-weight: 600; }
.chips { display: flex; gap: 8px; justify-content: center; flex-wrap: wrap; margin-top: 8px; }
.chip, button.chip {
  font: 600 .7rem/1 var(--mono); letter-spacing: .06em; text-transform: uppercase; color: var(--fg); background: var(--panel);
  border: 1px solid var(--line); border-radius: 999px; padding: 7px 12px; cursor: pointer; transition: background .15s, border-color .15s, color .15s;
}
.chip:hover { border-color: var(--accent); }
.chip:focus-visible, .wt-nav a:focus-visible, input:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.chip[aria-pressed="true"], .chip.on { background: var(--accent); border-color: var(--accent); color: #fff; }
.chip[hidden] { display: none; }
kbd { font: inherit; border: 1px solid var(--line); border-bottom-width: 2px; border-radius: 4px; padding: 0 4px; }
.hint { font-size: .68rem; color: var(--muted); text-align: center; margin: 8px 12px 0; max-width: 640px; }

/* city search */
.search { position: fixed; inset: 0; z-index: 20; display: none; align-items: flex-start; justify-content: center; padding-top: 16vh; background: rgba(8, 10, 14, .45); backdrop-filter: blur(3px); }
.search.on { display: flex; }
.search .box { width: min(92vw, 380px); background: var(--bg); border: 1px solid var(--line); border-radius: 12px; box-shadow: 0 20px 60px rgba(0, 0, 0, .4); overflow: hidden; }
.search input { width: 100%; border: 0; border-bottom: 1px solid var(--line); background: transparent; color: var(--fg); font: 1rem var(--mono); padding: 14px 16px; outline: none; }
.search ul { list-style: none; margin: 0; padding: 4px; max-height: 44vh; overflow: auto; }
.search li { display: flex; justify-content: space-between; gap: 12px; padding: 8px 12px; border-radius: 7px; font-size: .82rem; cursor: pointer; }
.search li span { color: var(--muted); font-variant-numeric: tabular-nums; }
.search li[aria-selected="true"] { background: var(--accent); color: #fff; }
.search li[aria-selected="true"] span { color: rgba(255, 255, 255, .85); }

/* variant nav */
.wt-nav { display: flex; flex-wrap: wrap; justify-content: center; gap: 2px 4px; padding: 10px 10px 14px; width: 100%; }
.wt-nav a { font: 600 .68rem/1 var(--mono); letter-spacing: .08em; text-transform: uppercase; color: var(--muted); text-decoration: none; padding: 7px 10px; border-radius: 999px; transition: color .15s, background .15s; }
.wt-nav a:hover { color: var(--fg); }
.wt-nav a[aria-current="page"] { color: var(--fg); background: var(--line); }

@media (prefers-reduced-motion: reduce) { .wt-tip, .wt-pusher > g { transition: none; } }
@media (hover: none) { .hint .kb { display: none; } }

/* a host page can force the light palette even when the system prefers dark */
:root[data-theme="light"] { --bg: #f4f2ee; --fg: #17191d; --muted: #6b6f78; --line: rgba(20, 24, 32, .14); --panel: rgba(255, 255, 255, .72); color-scheme: light; }

/* embed mode (?embed inside an iframe): see js/core.js */
html.embed, html.embed body { height: auto; min-height: 0; }
html.embed body { overflow: hidden; }
html.embed:not(.embed-dark) { color-scheme: normal; }      /* same scheme as a plain host page, or the iframe would turn opaque */
html.embed:not(.embed-dark) body { background: transparent; }
html.embed main { flex: none; padding: 6px 8px 12px; }
html.embed .wt { width: min(94vw, 560px); touch-action: pan-y; }
html.embed .hint, html.embed .wt-nav { display: none; }
html.embed .readout { min-height: 0; }
