/*
 * World Clock styles
 *
 * Conventions borrowed from Apple's Human Interface Guidelines and Google's
 * Material Design 3:
 *   - every control has a hit area of at least 44 x 44 px (HIG 44 pt, Material 48 dp)
 *   - spacing sits on a 4 / 8 px grid
 *   - text is never smaller than 11 px and body text meets WCAG AA contrast (4.5:1)
 *   - colour is never the only signal: day and night also get a sun or moon icon
 *   - semantic colour tokens with separate light and dark values
 *   - hover and pressed "state layers", visible keyboard focus, reduced-motion support
 */

/* ---------- Tokens ---------- */
:root {
  color-scheme: light;

  --bg: #f2f2f7;
  --surface: #ffffff;
  --fill: rgba(118, 118, 128, .12);
  --fill-strong: rgba(118, 118, 128, .22);
  --raised: #ffffff;
  --ink: #1c1c1e;
  --ink-2: #55565e;
  --ink-3: #74757e;
  --line: rgba(60, 60, 67, .16);
  --accent: #0b6bde;
  --on-accent: #ffffff;
  --accent-soft: rgba(11, 107, 222, .12);
  --live: #188038;

  /* Dial */
  --face-day: #ffffff;
  --face-night: #e1e5f0;
  --rim: #c8ccd6;

  /* Day and night: warm and light for day, cool and dark for night */
  --day-bg: #fff3cc;
  --day-ink: #463300;
  --day-icon: #d07c00;
  --day-face: #ffffff;
  --night-bg: #2b3263;
  --night-ink: #eef0ff;
  --night-icon: #c3cbff;
  --night-face: #161b3d;
  --day-mark: #c77700;      /* icons drawn on a neutral surface */
  --night-mark: #4a54b5;
  --chip-edge: rgba(0, 0, 0, .14);

  /* One colour per city */
  --city-blue: #007aff;
  --city-orange: #e8730a;
  --city-green: #1f9d45;
  --city-purple: #a550d9;
  --city-pink: #eb2f6c;
  --city-teal: #0b98ad;
  --city-indigo: #5856d6;
  --city-brown: #a0774a;
  --city-lime: #6f9414;
  --city-slate: #64748f;

  --shadow-1: 0 1px 2px rgba(0, 0, 0, .04), 0 2px 10px rgba(0, 0, 0, .05);
  --shadow-3: 0 2px 6px rgba(0, 0, 0, .08), 0 16px 48px rgba(0, 0, 0, .2);
  --r-s: 8px;
  --r-m: 12px;
  --r-l: 16px;
  --r-xl: 24px;
  --ease: cubic-bezier(.2, 0, 0, 1);
  --font: system-ui, -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --bg: #000000;
    --surface: #1c1c1e;
    --fill: rgba(118, 118, 128, .24);
    --fill-strong: rgba(118, 118, 128, .4);
    --raised: #636366;
    --ink: #f5f5f7;
    --ink-2: #aeaeb6;
    --ink-3: #8e8e96;
    --line: rgba(84, 84, 88, .65);
    --accent: #4c9dff;
    --on-accent: #001f4d;
    --accent-soft: rgba(76, 157, 255, .2);
    --live: #30d158;
    --face-day: #2c313f;
    --face-night: #0e1016;
    --rim: #3a3d48;
    --day-bg: #f7e9b9;
    --day-ink: #3a2c00;
    --day-icon: #b56b00;
    --day-face: #fffdf5;
    --night-bg: #252c5c;
    --night-ink: #e6e9ff;
    --night-icon: #b3bcff;
    --night-face: #0c1030;
    --day-mark: #ffc94d;
    --night-mark: #a9b3ff;
    --chip-edge: rgba(255, 255, 255, .2);
    --city-blue: #4c9dff;
    --city-orange: #ff9f0a;
    --city-green: #30d158;
    --city-purple: #c77dff;
    --city-pink: #ff5c8d;
    --city-teal: #40c8e0;
    --city-indigo: #8482ff;
    --city-brown: #c9a27a;
    --city-lime: #a8d046;
    --city-slate: #9fb0cc;
    --shadow-1: 0 0 0 1px rgba(255, 255, 255, .04);
    --shadow-3: 0 0 0 1px rgba(255, 255, 255, .08), 0 16px 48px rgba(0, 0, 0, .6);
  }
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #000000;
  --surface: #1c1c1e;
  --fill: rgba(118, 118, 128, .24);
  --fill-strong: rgba(118, 118, 128, .4);
  --raised: #636366;
  --ink: #f5f5f7;
  --ink-2: #aeaeb6;
  --ink-3: #8e8e96;
  --line: rgba(84, 84, 88, .65);
  --accent: #4c9dff;
  --on-accent: #001f4d;
  --accent-soft: rgba(76, 157, 255, .2);
  --live: #30d158;
  --face-day: #2c313f;
  --face-night: #0e1016;
  --rim: #3a3d48;
  --day-bg: #f7e9b9;
  --day-ink: #3a2c00;
  --day-icon: #b56b00;
  --day-face: #fffdf5;
  --night-bg: #252c5c;
  --night-ink: #e6e9ff;
  --night-icon: #b3bcff;
  --night-face: #0c1030;
  --day-mark: #ffc94d;
  --night-mark: #a9b3ff;
  --chip-edge: rgba(255, 255, 255, .2);
  --city-blue: #4c9dff;
  --city-orange: #ff9f0a;
  --city-green: #30d158;
  --city-purple: #c77dff;
  --city-pink: #ff5c8d;
  --city-teal: #40c8e0;
  --city-indigo: #8482ff;
  --city-brown: #c9a27a;
  --city-lime: #a8d046;
  --city-slate: #9fb0cc;
  --shadow-1: 0 0 0 1px rgba(255, 255, 255, .04);
  --shadow-3: 0 0 0 1px rgba(255, 255, 255, .08), 0 16px 48px rgba(0, 0, 0, .6);
}

/* ---------- Base ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
html:has(dialog[open]) { overflow: hidden; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 400 15px/1.35 var(--font);
  -webkit-font-smoothing: antialiased;
}
button { font: inherit; color: inherit; background: none; border: 0; padding: 0; cursor: pointer; -webkit-tap-highlight-color: transparent; }
ul { list-style: none; margin: 0; padding: 0; }
h1, h2 { margin: 0; }
[hidden] { display: none !important; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

.app { max-width: 1120px; margin: 0 auto; padding: 12px max(24px, env(safe-area-inset-right)) 48px max(24px, env(safe-area-inset-left)); }

/* ---------- Shared controls ---------- */
.icon-btn { position: relative; display: inline-grid; place-items: center; width: 44px; height: 44px; border-radius: 50%; color: var(--ink-2); transition: background .15s var(--ease), color .15s var(--ease); }
.icon-btn:hover { background: var(--fill); color: var(--ink); }
.icon-btn:active { background: var(--fill-strong); }

.btn { position: relative; display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-height: 40px; padding: 0 18px; border-radius: 999px; font-size: 15px; font-weight: 600; white-space: nowrap; transition: filter .15s var(--ease), background .15s var(--ease), transform .1s var(--ease); }
.btn::after { content: ""; position: absolute; inset: -2px 0; }          /* 44 px hit area */
.btn:active { transform: scale(.97); }
.btn.filled { background: var(--accent); color: var(--on-accent); }
.btn.filled:hover { filter: brightness(1.08); }
.btn.tonal { background: var(--accent-soft); color: var(--accent); padding-left: 14px; }
.btn.tonal:hover { background: color-mix(in srgb, var(--accent) 20%, transparent); }
.btn.text { color: var(--accent); padding: 0 12px; margin-right: -12px; }
.btn.text:hover { background: var(--accent-soft); }

.seg { display: inline-flex; padding: 2px; border-radius: 10px; background: var(--fill); }
.seg button { position: relative; min-height: 36px; padding: 0 14px; border-radius: 8px; font-size: 14px; font-weight: 600; color: var(--ink); white-space: nowrap; transition: background .2s var(--ease), box-shadow .2s var(--ease); }
.seg button::after { content: ""; position: absolute; inset: -4px 0; }  /* 44 px hit area */
.seg button:hover:not([aria-pressed="true"]) { background: var(--fill); }
.seg button[aria-pressed="true"] { background: var(--raised); box-shadow: 0 1px 3px rgba(0, 0, 0, .14), 0 0 0 .5px rgba(0, 0, 0, .05); }

.switch { display: inline-flex; align-items: center; gap: 10px; min-height: 44px; cursor: pointer; font-size: 15px; font-weight: 500; user-select: none; -webkit-user-select: none; }
.switch input { position: absolute; opacity: 0; width: 1px; height: 1px; pointer-events: none; }
.switch-track { position: relative; flex: none; width: 48px; height: 28px; border-radius: 14px; background: var(--fill-strong); transition: background .2s var(--ease); }
.switch-thumb { position: absolute; top: 2px; left: 2px; width: 24px; height: 24px; border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgba(0, 0, 0, .25); transition: transform .2s var(--ease); }
.switch input:checked + .switch-track { background: var(--accent); }
.switch input:checked + .switch-track .switch-thumb { transform: translateX(20px); }
.switch input:focus-visible + .switch-track { outline: 2px solid var(--accent); outline-offset: 2px; }

/* Day / night badge: colour plus icon */
.sky { flex: none; display: inline-grid; place-items: center; width: 24px; height: 24px; border-radius: 50%; }
.sky svg { display: block; }
.sky.is-day, .is-day > .sky { background: var(--day-bg); color: var(--day-icon); }
.sky.is-night, .is-night > .sky { background: var(--night-bg); color: var(--night-icon); }
.sky .i-day, .sky .i-night { display: none; }
.sky.is-day .i-day, .sky.is-night .i-night { display: block; }

/* ---------- Header ---------- */
.top { display: flex; align-items: center; justify-content: space-between; gap: 16px; min-height: 44px; margin-bottom: 16px; }
.brand { display: flex; align-items: center; gap: 10px; font-size: 20px; line-height: 28px; font-weight: 650; letter-spacing: -.01em; }

.menu-wrap { position: relative; margin-right: -10px; }
.menu { position: absolute; z-index: 20; top: calc(100% + 6px); right: 6px; width: min(292px, calc(100vw - 32px)); padding: 6px 16px; border-radius: var(--r-l); background: var(--surface); box-shadow: var(--shadow-3); animation: pop-in .18s var(--ease); transform-origin: top right; }
.menu-row { padding: 10px 0 12px; }
.menu-row + .menu-row { border-top: 1px solid var(--line); }
.menu-label { display: block; margin-bottom: 8px; color: var(--ink-2); font-size: 13px; font-weight: 500; }
.menu .seg { display: flex; }
.menu .seg button { flex: 1; padding: 0 8px; }
@keyframes pop-in { from { opacity: 0; transform: scale(.96); } }

/* ---------- Layout ---------- */
.layout { display: grid; grid-template-columns: minmax(0, 1fr) 400px; gap: 40px; align-items: start; }
.stage { position: sticky; top: 12px; display: flex; flex-direction: column; align-items: center; min-width: 0; }
.dial-bar { display: flex; align-items: center; justify-content: center; flex-wrap: wrap; gap: 4px 24px; min-height: 44px; margin-bottom: 4px; }
.dial-wrap { width: min(100%, 580px, max(300px, calc(100vh - 262px))); aspect-ratio: 1; }

@media (max-width: 900px) {
  .app { padding: 8px max(16px, env(safe-area-inset-right)) 40px max(16px, env(safe-area-inset-left)); }
  .top { margin-bottom: 4px; }
  .layout { grid-template-columns: minmax(0, 1fr); gap: 24px; }
  .stage { position: static; }
  .dial-wrap { width: min(100%, 480px); }
}

/* ---------- Dial ---------- */
#dial { display: block; width: 100%; height: 100%; overflow: visible; user-select: none; -webkit-user-select: none; }
#dial text { font-family: var(--font); font-variant-numeric: tabular-nums; }

.face { stroke: var(--rim); stroke-width: 1; }
.stop-day { stop-color: var(--face-day); }
.stop-night { stop-color: var(--face-night); }
.tick { stroke: var(--ink-3); stroke-width: 1; opacity: .5; }
.tick.hour { opacity: .95; }
.tick.major { stroke: var(--ink); stroke-width: 1.8; opacity: 1; }
.numeral { fill: var(--ink-2); font-weight: 500; text-anchor: middle; dominant-baseline: central; }
.numeral.major { fill: var(--ink); font-weight: 700; }
.numeral .suffix { font-size: 9px; font-weight: 700; letter-spacing: .03em; }
.glyph { color: var(--ink-3); pointer-events: none; }

.hand, .minute-hand { cursor: grab; touch-action: none; outline: none; }
.hand .hit, .minute-hand .hit { stroke: transparent; stroke-width: 28; stroke-linecap: round; pointer-events: stroke; }
.hand .stroke { stroke: var(--c); stroke-width: 3; stroke-linecap: round; pointer-events: none; transition: stroke-width .12s var(--ease); }
.hand .stroke.striped { stroke-linecap: butt; }
.hand .tip { fill: var(--c); stroke: var(--surface); stroke-width: 2; pointer-events: none; }
.hand.is-active .stroke, .hand:focus-visible .stroke { stroke-width: 4.5; }
.hand.is-active .tip, .hand:focus-visible .tip { r: 5.6px; }

.minute-hand { display: none; }
.face-12 .minute-hand { display: inline; }
.minute-hand .stroke { stroke: var(--ink-2); stroke-width: 1.6; stroke-linecap: round; pointer-events: none; transition: stroke-width .12s var(--ease); }
.minute-hand .tip { fill: var(--surface); stroke: var(--ink-2); stroke-width: 1.6; pointer-events: none; }
.minute-hand.is-active .stroke, .minute-hand:focus-visible .stroke { stroke: var(--ink); stroke-width: 2.6; }
.minute-hand.is-active .tip, .minute-hand:focus-visible .tip { stroke: var(--ink); }

.hub { pointer-events: none; }
.hub-disc { fill: var(--surface); stroke: var(--rim); stroke-width: 1; }
.hub-time { fill: var(--ink); font-weight: 700; text-anchor: middle; letter-spacing: -.01em; }
.hub-time .suffix { font-size: 10.5px; font-weight: 700; fill: var(--ink-2); letter-spacing: .02em; }
.hub-label { fill: var(--ink-2); font-size: 11px; font-weight: 600; text-anchor: middle; }
.hub .i-day circle { fill: var(--day-mark); }
.hub .i-day path { stroke: var(--day-mark); }
.hub .i-night path { fill: var(--night-mark); }

/* Sun and moon glyphs: show the one that matches the nearest .is-day / .is-night */
.i-day circle { fill: var(--day-icon); }
.i-day path { stroke: var(--day-icon); }
.i-night path { fill: var(--night-icon); }
.is-day > .i-night, .is-night > .i-day,
.is-day > .chip-icon > .i-night, .is-night > .chip-icon > .i-day { display: none; }

/* Label chips riding on the hands */
.chip { cursor: grab; touch-action: none; }
.chip-base { fill: var(--surface); filter: drop-shadow(0 1px 2px rgba(0, 0, 0, .22)); }
.chip-bg { fill: var(--day-bg); pointer-events: none; }
.chip-bg.is-night { fill: var(--night-bg); }
.chip-border { fill: none; stroke: var(--chip-edge); stroke-width: 1; pointer-events: none; }
.chip.is-active .chip-border { stroke: var(--ink); stroke-width: 1.5; }
.chip-row { pointer-events: none; }
.chip-row text { fill: var(--day-ink); font-weight: 600; dominant-baseline: central; }
.chip-row.is-night text { fill: var(--night-ink); }
.chip-row .dot { fill: var(--c); stroke: rgba(255, 255, 255, .9); stroke-width: 1; }
body.is-dragging, body.is-dragging .hand, body.is-dragging .minute-hand, body.is-dragging .chip { cursor: grabbing; }

/* Mini 12-hour clocks (on chips and in the list) */
.mini-face { fill: var(--day-face); stroke: var(--c); stroke-width: 2; }
.mini-tick { stroke: var(--day-ink); stroke-width: 1; opacity: .45; }
.mini-hour, .mini-minute { stroke: var(--day-ink); stroke-linecap: round; }
.mini-pin { fill: var(--day-ink); }
.is-night .mini-face { fill: var(--night-face); }
.is-night .mini-tick, .is-night .mini-hour, .is-night .mini-minute { stroke: var(--night-ink); }
.is-night .mini-pin { fill: var(--night-ink); }

/* ---------- Controls under the dial ---------- */
.controls { display: flex; align-items: center; justify-content: center; flex-wrap: wrap; gap: 4px 16px; margin-top: 4px; min-height: 44px; }
.day-nav { display: flex; align-items: center; }
.day-label { min-width: 150px; text-align: center; font-size: 15px; font-weight: 600; font-variant-numeric: tabular-nums; white-space: nowrap; }
.day-label .where { color: var(--ink-2); font-weight: 400; }
.status { display: inline-flex; align-items: center; gap: 8px; color: var(--ink-2); font-size: 14px; font-weight: 500; font-variant-numeric: tabular-nums; white-space: nowrap; }
.status-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--ink-3); }
.status.is-live { color: var(--live); font-weight: 600; }
.status.is-live .status-dot { background: var(--live); animation: pulse 2s ease-out infinite; }
@keyframes pulse {
  0% { box-shadow: 0 0 0 0 color-mix(in srgb, var(--live) 55%, transparent); }
  80%, 100% { box-shadow: 0 0 0 7px transparent; }
}
.hint { margin: 8px 0 0; max-height: 40px; color: var(--ink-2); font-size: 13px; text-align: center; overflow: hidden; transition: opacity .3s, max-height .3s .3s, margin .3s .3s; }
.hint.is-done { opacity: 0; max-height: 0; margin-top: 0; pointer-events: none; }

/* ---------- City list ---------- */
.panel { min-width: 0; }
.panel-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 44px; margin-bottom: 8px; padding-left: 4px; }
.panel-head h2 { font-size: 20px; line-height: 28px; font-weight: 650; letter-spacing: -.01em; }

.cities { --lead: 12px; background: var(--surface); border-radius: var(--r-l); box-shadow: var(--shadow-1); overflow: hidden; }
.cities.has-mini { --lead: 40px; }
.city { position: relative; display: flex; align-items: center; gap: 12px; min-height: 72px; padding: 10px 4px 10px 16px; transition: background .2s var(--ease); }
.city + .city::before { content: ""; position: absolute; top: 0; right: 0; left: calc(16px + var(--lead) + 12px); height: 1px; background: var(--line); }
.city.is-active { background: color-mix(in srgb, var(--c) 9%, var(--surface)); }
.city.flash { animation: flash 1s var(--ease); }
@keyframes flash { 0%, 35% { background: color-mix(in srgb, var(--c) 18%, var(--surface)); } }

.lead { flex: none; display: grid; place-items: center; width: var(--lead); }
.swatch { width: 12px; height: 12px; border-radius: 50%; background: var(--c); }
.mini-svg { display: none; overflow: visible; }
.has-mini .mini-svg { display: block; }
.has-mini .swatch { display: none; }
.city .mini-face { fill: var(--day-bg); stroke-width: 2.5; }
.city.is-night .mini-face { fill: var(--night-bg); }

.city-main { flex: 1; min-width: 0; }
.city-name { display: flex; align-items: center; gap: 8px; font-size: 17px; line-height: 22px; font-weight: 600; letter-spacing: -.01em; }
.city-name > span:first-child { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tag { flex: none; padding: 1px 6px; border-radius: 6px; background: var(--fill); color: var(--ink-2); font-size: 11px; line-height: 16px; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; }
.city-sub { margin-top: 2px; color: var(--ink-2); font-size: 14px; line-height: 18px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.city-clock { flex: none; display: flex; flex-direction: column; align-items: flex-end; }
.clock-top { display: flex; align-items: center; gap: 8px; }
.time-btn { display: inline-flex; align-items: baseline; gap: 4px; min-height: 36px; padding: 0 6px; margin: 0 -6px; border-radius: var(--r-s); font-variant-numeric: tabular-nums; transition: background .15s var(--ease); }
.time-btn:hover { background: var(--fill); }
.time-btn .digits { font-size: 28px; line-height: 34px; font-weight: 600; letter-spacing: -.02em; }
.time-btn .suffix { font-size: 13px; font-weight: 600; color: var(--ink-2); }
.time-input { display: none; height: 36px; padding: 0 8px; border: 1.5px solid var(--accent); border-radius: var(--r-s); background: var(--surface); color: var(--ink); font: 600 18px var(--font); font-variant-numeric: tabular-nums; }
.time-input:focus { outline: none; box-shadow: 0 0 0 3px var(--accent-soft); }
.city.is-editing .time-btn { display: none; }
.city.is-editing .time-input { display: inline-block; }
.city-date { color: var(--ink-2); font-size: 13px; line-height: 18px; font-variant-numeric: tabular-nums; white-space: nowrap; }
.daytag { margin-left: 6px; padding: 1px 6px; border-radius: 6px; background: var(--accent-soft); color: var(--accent); font-size: 11px; font-weight: 700; }

.remove { flex: none; display: grid; place-items: center; width: 36px; height: 44px; border-radius: var(--r-s); color: var(--ink-3); opacity: 0; transition: opacity .15s, background .15s, color .15s; }
.city:hover .remove, .city:focus-within .remove { opacity: 1; }
.remove:hover { background: var(--fill); color: var(--ink); }
@media (hover: none) { .remove { opacity: 1; } }
.remove-spacer { flex: none; width: 36px; }

.empty-row { padding: 16px 20px 18px calc(16px + var(--lead) + 12px); border-top: 1px solid var(--line); color: var(--ink-2); font-size: 14px; }

.legend { display: flex; flex-wrap: wrap; gap: 6px 20px; margin: 14px 4px 0; color: var(--ink-2); font-size: 13px; }
.legend-item { display: inline-flex; align-items: center; gap: 8px; }
.legend .sky { width: 20px; height: 20px; }
.credit { margin: 10px 4px 0; color: var(--ink-2); font-size: 12px; line-height: 16px; }
.credit a { color: inherit; text-underline-offset: 2px; }

/* ---------- City picker (modal sheet) ---------- */
.sheet { width: min(480px, calc(100vw - 32px)); height: min(720px, calc(100dvh - 48px)); max-width: none; max-height: none; padding: 0; border: 0; border-radius: var(--r-xl); background: var(--surface); color: var(--ink); box-shadow: var(--shadow-3); overflow: hidden; }
.sheet[open] { display: flex; flex-direction: column; animation: sheet-in .26s var(--ease); }
.sheet::backdrop { background: rgba(0, 0, 0, .42); animation: fade-in .2s ease-out; }
@keyframes sheet-in { from { opacity: 0; transform: translateY(14px) scale(.98); } }
@keyframes sheet-up { from { transform: translateY(100%); } }
@keyframes fade-in { from { opacity: 0; } }

.sheet-head { flex: none; padding: 12px 20px 12px; border-bottom: 1px solid var(--line); }
.grabber { display: none; width: 36px; height: 5px; margin: -4px auto 4px; border-radius: 3px; background: var(--fill-strong); }
.sheet-bar { display: flex; align-items: center; justify-content: space-between; min-height: 44px; }
.sheet-bar h2 { font-size: 20px; line-height: 28px; font-weight: 650; letter-spacing: -.01em; }

.field { position: relative; margin-top: 6px; }
.field-icon { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); color: var(--ink-3); pointer-events: none; }
.field input { width: 100%; height: 44px; padding: 0 44px 0 38px; border: 0; border-radius: var(--r-m); background: var(--fill); color: var(--ink); font: inherit; font-size: 16px; }
.field input::placeholder { color: var(--ink-3); }
.field input:focus { outline: 2px solid var(--accent); outline-offset: -1px; }
.field-clear { position: absolute; right: 0; top: 0; display: grid; place-items: center; width: 44px; height: 44px; color: var(--surface); }
.field-clear::before { content: ""; position: absolute; width: 20px; height: 20px; border-radius: 50%; background: var(--ink-3); }
.field-clear svg { position: relative; }

.chips { display: flex; gap: 8px; margin: 12px -20px 0; padding: 0 20px; overflow-x: auto; scrollbar-width: none; }
.chips::-webkit-scrollbar { display: none; }
.chip-btn { position: relative; flex: none; min-height: 32px; padding: 0 14px; border: 1px solid var(--line); border-radius: var(--r-s); color: var(--ink-2); font-size: 14px; font-weight: 500; transition: background .15s var(--ease), color .15s var(--ease), border-color .15s var(--ease); }
.chip-btn::after { content: ""; position: absolute; inset: -6px -2px; }  /* 44 px hit area */
.chip-btn:hover { background: var(--fill); }
.chip-btn[aria-pressed="true"] { background: var(--accent-soft); border-color: transparent; color: var(--accent); font-weight: 600; }

.sheet-body { flex: 1; min-height: 0; overflow-y: auto; overscroll-behavior: contain; outline: none; padding-bottom: max(8px, env(safe-area-inset-bottom)); }
.pick-letter { position: sticky; top: 0; z-index: 1; padding: 6px 20px; background: color-mix(in srgb, var(--surface) 88%, transparent); -webkit-backdrop-filter: blur(10px); backdrop-filter: blur(10px); color: var(--ink-2); font-size: 13px; line-height: 18px; font-weight: 700; }
.pick-item { content-visibility: auto; contain-intrinsic-size: auto 60px; }
.pick { display: flex; align-items: center; gap: 12px; width: 100%; min-height: 60px; padding: 8px 20px; text-align: left; transition: background .12s var(--ease); }
.pick:hover { background: var(--fill); }
.pick:active { background: var(--fill-strong); }
.pick:focus-visible { outline-offset: -2px; }
.pick-main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.pick-name { font-size: 16px; line-height: 22px; font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pick-sub { color: var(--ink-2); font-size: 13.5px; line-height: 18px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pick-time { flex: none; color: var(--ink-2); font-size: 14px; font-variant-numeric: tabular-nums; white-space: nowrap; }
.pick-mark { flex: none; display: grid; place-items: center; width: 26px; height: 26px; border: 1.5px solid var(--ink-3); border-radius: 50%; color: var(--ink-2); transition: background .15s var(--ease), border-color .15s var(--ease); }
.pick-mark .i-check { display: none; }
.pick[aria-pressed="true"] .pick-mark { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }
.pick[aria-pressed="true"] .pick-mark .i-check { display: block; }
.pick[aria-pressed="true"] .pick-mark .i-plus { display: none; }
.picks-note { margin: 0; padding: 28px 24px; color: var(--ink-2); font-size: 15px; text-align: center; }

@media (max-width: 480px) {
  /* Phones: keep the city name readable next to the big time. */
  .city { gap: 10px; padding-left: 12px; padding-right: 2px; }
  .city + .city::before { left: calc(12px + var(--lead) + 10px); }
  .time-btn .digits { font-size: 24px; line-height: 30px; }
  .time-btn .suffix { font-size: 12px; }
  .clock-top { gap: 6px; }
  .clock-top .sky { width: 20px; height: 20px; }
  .remove, .remove-spacer { width: 32px; }
}

@media (max-width: 600px) {
  .sheet { width: 100%; height: 92dvh; margin: auto 0 0; border-radius: 20px 20px 0 0; }
  .sheet[open] { animation: sheet-up .32s var(--ease); }
  .grabber { display: block; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}
