:root {
  color-scheme: dark;
  --surface: #19151b;
  --card: #211c24;
  --text: #f5f2ec;
  --muted: #ada5ae;
  --subtle: #928996;
  --accent: #f6a325;
  --warm: #dcc2a1;
  --line: #ffffff1a;
  --font-ui: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --font-mono: ui-monospace, "SFMono-Regular", Consolas, "Liberation Mono", monospace;
  font-family: var(--font-ui);
  font-synthesis: none;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
* { box-sizing: border-box; }
body, h1, h2, h3, p { margin: 0; }
html { background: var(--surface); scrollbar-color: #514858 var(--surface); scrollbar-width: thin; }
body {
  min-width: 280px;
  min-height: 100vh;
  min-height: 100svh;
  color: var(--text);
  background: radial-gradient(ellipse 700px 500px at 75% -140px, #8b55312b, transparent 82%), radial-gradient(ellipse 500px 550px at -16% 20%, #63446a1a, transparent 84%), var(--surface);
  font-size: 14px;
  line-height: 1.5;
  -webkit-text-size-adjust: 100%;
}
button, a { -webkit-tap-highlight-color: transparent; touch-action: manipulation; }
button { color: inherit; font: inherit; cursor: pointer; }
button:focus-visible, a:focus-visible { outline: 2px solid var(--accent); outline-offset: 5px; }
::selection { color: var(--surface); background: var(--accent); }
code { color: var(--warm); font-family: var(--font-mono); font-size: .9em; }

.page-shell {
  width: min(100%, 1416px);
  margin-inline: auto;
  padding-inline: max(18px, env(safe-area-inset-left)) max(18px, env(safe-area-inset-right));
}
.site-header { display: flex; flex-wrap: nowrap; align-items: center; gap: 8px; min-height: calc(75px + env(safe-area-inset-top)); padding-top: env(safe-area-inset-top); border-bottom: 1px solid var(--line); }
.brand { display: inline-flex; align-items: center; gap: 8px; flex: 0 0 auto; color: var(--text); text-decoration: none; white-space: nowrap; }
.brand span { color: var(--warm); font-family: var(--font-mono); font-size: 10px; font-weight: 600; letter-spacing: .15em; }
.brand-dial { width: 28px; height: 28px; flex: none; color: var(--accent); }
.header-controls { display: flex; align-items: center; gap: 8px; margin-left: auto; flex: 0 0 auto; }
.live-status { display: none; align-items: center; gap: 7px; color: var(--muted); font-size: 12px; white-space: nowrap; }
.live-dot { width: 6px; height: 6px; border-radius: 50%; background: var(--accent); box-shadow: 0 0 0 4px #f6a32518; }
/* Both selectors deliberately share the same geometry, surface and state treatment. */
.format-switch, .mode-switch { display: inline-flex; align-items: stretch; gap: 2px; flex: 0 0 auto; padding: 3px; border: 1px solid #ffffff26; border-radius: 999px; background: #100e14; }
.format-switch button, .mode-switch button { flex: 0 0 50px; width: 50px; min-height: 40px; padding: 7px 3px; border: 0; border-radius: 999px; background: transparent; color: var(--muted); font-size: 12px; font-weight: 600; line-height: 1.3; transition: background .18s, color .18s, box-shadow .18s; }
.format-switch button[aria-pressed="true"], .mode-switch button[aria-pressed="true"] { color: #312039; background: var(--accent); font-weight: 700; box-shadow: 0 2px 14px #f6a32530; }
.mode-switch[hidden] { display: none; }

.hero { display: grid; gap: 17px; padding: 24px 0 27px; }
.eyebrow { display: block; margin-bottom: 9px; color: var(--accent); font-family: var(--font-mono); font-size: 10px; letter-spacing: .15em; }
.hero h1 { font-size: clamp(36px, 10vw, 42px); font-weight: 480; line-height: 1.07; letter-spacing: -.055em; }
.hero h1 br { display: initial; }
.title-dot { color: var(--accent); }
.hero-note { display: block; margin-top: 12px; color: var(--muted); font-size: 13px; }
.local-panel { position: relative; min-width: 0; padding: 18px 20px 19px; border: 1px solid #ffffff26; border-radius: 22px; background: radial-gradient(ellipse 85% 100% at 100% 0%, #a16c3830, transparent 85%), linear-gradient(135deg, #241e23, #201b25); box-shadow: inset 0 1px 0 #ffffff0b; }
.local-heading { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.local-label { color: var(--muted); font-family: var(--font-mono); font-size: 10px; font-weight: 400; letter-spacing: .13em; }
.local-city-label { display: inline-flex; align-items: center; gap: 5px; min-width: 0; color: var(--warm); font-size: 11px; }
.local-city-label svg { flex: none; width: 12px; height: 12px; }
#local-city { overflow-wrap: anywhere; }
.local-clock { display: flex; align-items: center; gap: 12px; margin: 12px 0 12px; font-variant-numeric: tabular-nums lining-nums; white-space: nowrap; }
#local-time { font-size: clamp(62px, 19vw, 78px); font-weight: 350; letter-spacing: -.065em; line-height: .98; }
.local-tail { display: flex; flex-direction: column; justify-content: center; align-items: flex-start; gap: 4px; padding-top: 6px; font-family: var(--font-mono); }
#local-seconds { color: var(--accent); font-size: 22px; font-weight: 400; line-height: 1; }
#local-meridiem { color: var(--muted); font-size: 11px; line-height: 1; letter-spacing: .08em; }
#local-meridiem:empty { display: none; }
.local-date { color: #e0c6a7; font-size: 13px; }
.local-zone-line { display: flex; flex-wrap: wrap; gap: 7px; margin-top: 4px; color: var(--muted); font-family: var(--font-mono); font-size: 11px; line-height: 1.5; }
.local-zone { overflow-wrap: anywhere; }
.zone-separator { color: #69616a; }
#local-offset { color: var(--warm); }

.world-section { border-top: 1px solid var(--line); }
.section-header { display: flex; align-items: baseline; justify-content: space-between; flex-wrap: wrap; gap: 5px 14px; padding: 19px 0 14px; }
.section-heading { display: flex; align-items: baseline; gap: 10px; }
.section-heading h2 { color: var(--warm); font-family: var(--font-mono); font-size: 11px; font-weight: 600; letter-spacing: .13em; text-transform: uppercase; }
.location-count { color: var(--subtle); font-family: var(--font-mono); font-size: 10px; letter-spacing: .02em; text-transform: uppercase; }
.comparison-note { display: none; color: var(--subtle); font-size: 11px; }
.comparison-note span { color: var(--muted); }
.clock-grid { display: grid; grid-template-columns: minmax(0, 1fr); gap: 10px; }
.clock-card {
  --glow: #8a6ab825;
  position: relative;
  isolation: isolate;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  grid-template-areas: "head time" "meta diff" "track track" "caption caption";
  align-items: center;
  column-gap: 10px;
  min-width: 0;
  padding: 18px 18px 15px;
  border: 1px solid #ffffff1b;
  border-radius: 21px;
  background: linear-gradient(135deg, #252026 0%, #211e29 100%);
}
.clock-card[hidden] { display: none; }
.clock-card::before { content: ""; z-index: -1; position: absolute; inset: 0; border-radius: inherit; background: radial-gradient(ellipse 110% 115% at 100% 0, var(--glow), transparent 82%); pointer-events: none; }
.clock-card[data-phase="morning"] { --glow: #e49d3d29; }
.clock-card[data-phase="afternoon"] { --glow: #c8956d28; }
.clock-card[data-phase="evening"] { --glow: #bd718c27; }
.clock-card[data-phase="night"] { --glow: #7466b035; }
.clock-card.is-local { border-color: #eea32ba3; background: linear-gradient(125deg, #261d23, #332621); }
.clock-card.is-local::after { content: ""; position: absolute; top: -1px; left: 18%; right: 18%; height: 1px; background: linear-gradient(90deg, transparent, #f6a325ab, transparent); }
.card-head { grid-area: head; min-width: 0; }
.location-name { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; color: var(--text); font-size: 17px; font-weight: 600; letter-spacing: -.025em; line-height: 1.3; overflow-wrap: anywhere; }
.location-detail { margin-top: 3px; color: var(--muted); font-size: 12px; line-height: 1.4; overflow-wrap: anywhere; }
.local-badge { padding: 2px 9px; border: 0; border-radius: 999px; color: #302034; background: var(--accent); font-family: var(--font-mono); font-size: 10px; font-weight: 700; line-height: 1.5; letter-spacing: .06em; text-transform: uppercase; }
.time-row { grid-area: time; display: flex; align-items: center; justify-self: end; gap: 6px; font-variant-numeric: tabular-nums lining-nums; white-space: nowrap; }
.card-time { color: #f7f4f3; font-size: 40px; font-weight: 350; letter-spacing: -.055em; line-height: 1; }
.card-tail { display: inline-flex; flex-direction: column; align-items: flex-start; gap: 4px; width: 19px; font-family: var(--font-mono); }
.card-seconds { color: var(--accent); font-size: 13px; line-height: 1; }
.card-meridiem { color: var(--muted); font-size: 9px; line-height: 1; }
.card-meridiem:empty { display: none; }
.card-meta { grid-area: meta; display: flex; align-items: baseline; flex-wrap: wrap; gap: 5px 12px; min-width: 0; margin-top: 12px; font-family: var(--font-mono); font-size: 11px; }
.card-date { display: flex; align-items: center; flex-wrap: wrap; gap: 5px; min-width: 0; color: var(--muted); line-height: 1.5; }
.card-relday:empty { display: none; }
.card-relday:not(:empty) { color: var(--warm); font-size: 10px; }
.card-relday:not(:empty)::after { content: "·"; padding-left: 5px; color: var(--subtle); }
.difference { grid-area: diff; justify-self: end; margin-top: 12px; color: var(--warm); font-family: var(--font-mono); font-size: 11px; line-height: 1.5; white-space: nowrap; }
.difference.is-same { color: var(--muted); font-size: 10px; }
.zone-offset { color: var(--warm); font-family: var(--font-mono); font-size: 11px; line-height: 1.5; }
.day-track { grid-area: track; position: relative; height: 4px; margin-top: 16px; border-radius: 6px; background: linear-gradient(90deg, #3c375e 0%, #3c375e 18%, #b57d74 28%, #dac199 37%, #dac199 64%, #ac737b 76%, #3c375e 88%, #3c375e 100%); }
.day-track::after { content: ""; position: absolute; left: 25%; top: -2px; bottom: -2px; width: 50%; border-inline: 1px solid #f5f2ec35; background: linear-gradient(#f5f2ec35, #f5f2ec35) center / 1px 100% no-repeat; }
.day-marker { position: absolute; z-index: 1; left: clamp(0%, calc(var(--progress, 0) * 100%), 100%); top: 50%; width: 12px; height: 12px; transform: translate(-50%, -50%); border: 3px solid #2c222b; border-radius: 50%; background: var(--accent); box-shadow: 0 0 0 3px #f6a32518, 0 0 13px #f6a32565; }
.day-caption { grid-area: caption; display: flex; align-items: center; justify-content: flex-end; gap: 10px; margin-top: 11px; color: var(--muted); font-size: 10px; line-height: 1.3; }
.day-state { display: inline-flex; align-items: center; gap: 4px; }
.phase-icon { width: 11px; height: 11px; flex: none; }
.day-scale { display: none; color: var(--subtle); font-family: var(--font-mono); font-size: 9px; }
.card-error { grid-column: 1 / -1; margin-top: 12px; color: var(--warm); font-size: 12px; }
.empty { grid-column: 1 / -1; padding: 28px; border: 1px dashed var(--line); border-radius: 16px; color: var(--muted); }

.site-footer { display: flex; flex-direction: column; align-items: center; gap: 5px; margin-top: 26px; padding: 21px 0 max(26px, env(safe-area-inset-bottom)); border-top: 1px solid var(--line); color: var(--subtle); font-size: 10px; }
.site-footer p { display: flex; align-items: center; gap: 6px; }
.footer-dot { width: 4px; height: 4px; border-radius: 50%; background: #d8b37b; }
.site-footer p:last-child { font-size: 9px; }
.noscript { position: fixed; inset: auto 18px 18px; padding: 16px; border-radius: 12px; background: var(--accent); color: var(--surface); text-align: center; }

/* Phones: the date line spans the full card width, with room kept for the
   difference on the right, so a Yesterday/Tomorrow tag does not push the
   UTC offset onto a second line. */
@media (max-width: 699px) {
  .card-meta { grid-column: 1 / -1; grid-row: 2; flex-wrap: nowrap; padding-right: 10ch; white-space: nowrap; }
  .card-date { flex-wrap: nowrap; }
}

@media (min-width: 440px) and (max-width: 699px) {
  .page-shell { padding-inline: max(26px, env(safe-area-inset-left)) max(26px, env(safe-area-inset-right)); }
  .local-panel { max-width: 420px; }
  .format-switch button, .mode-switch button { flex-basis: 55px; width: 55px; min-height: 42px; }
  .clock-card { padding: 18px 20px 14px; }
  .card-time { font-size: 44px; }
}
@media (min-width: 700px) {
  .page-shell { padding-inline: max(32px, env(safe-area-inset-left)) max(32px, env(safe-area-inset-right)); }
  .site-header { min-height: calc(86px + env(safe-area-inset-top)); }
  .brand { gap: 12px; }
  .brand span { font-size: 12px; }
  .brand-dial { width: 32px; height: 32px; }
  .live-status { display: inline-flex; }
  .header-controls { gap: 12px; }
  .format-switch, .mode-switch { gap: 3px; }
  .format-switch button, .mode-switch button { flex-basis: 60px; width: 60px; min-height: 44px; font-size: 13px; }
  .hero { grid-template-columns: minmax(0, 1fr) minmax(302px, .85fr); align-items: center; gap: 32px; padding: 34px 0 36px; }
  .eyebrow { display: block; margin-bottom: 14px; font-size: 9px; }
  .hero h1 { font-size: 44px; line-height: 1.04; }
  .hero h1 br { display: initial; }
  .hero-note { display: block; margin-top: 14px; font-size: 12px; }
  .local-panel { padding: 19px 22px 21px; border-radius: 23px; }
  .local-label { font-size: 9px; }
  .local-clock { gap: 11px; margin: 15px 0 13px; }
  #local-time { font-size: 74px; }
  #local-seconds { font-size: 23px; }
  .local-date { font-size: 13px; }
  .local-zone-line { margin-top: 5px; font-size: 10px; }
  .section-header { padding: 24px 0 17px; }
  .section-heading h2 { font-size: 13px; }
  .location-count { font-size: 11px; }
  .comparison-note { display: block; }
  .clock-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 13px; }
  .clock-card { grid-template-areas: "head diff" "time time" "meta meta" "track track" "caption caption"; grid-template-rows: auto 1fr auto auto auto; align-items: start; min-height: 226px; padding: 20px 21px 18px; border-radius: 21px; }
  .location-name { font-size: 17px; }
  .location-detail { font-size: 12px; }
  .difference, .difference.is-same { margin-top: 2px; font-size: 11px; }
  .time-row { justify-self: start; align-self: end; gap: 9px; margin: 13px 0 14px; }
  .card-time { font-size: 55px; }
  .card-tail { width: 20px; padding-top: 3px; }
  .card-seconds { font-size: 15px; }
  .card-meridiem { font-size: 10px; }
  .card-meta { align-items: baseline; justify-content: space-between; gap: 6px 12px; margin-top: 0; }
  .card-date { margin-top: 0; }
  .zone-offset { flex: none; margin-top: 0; font-size: 11px; line-height: 1.5; }
  .day-track { margin-top: 18px; }
  .day-caption { justify-content: space-between; margin-top: 11px; font-size: 10px; }
  .day-scale { display: block; }
  .phase-icon { width: 12px; height: 12px; }
  .site-footer { flex-direction: row; justify-content: space-between; margin-top: 26px; padding-top: 20px; font-size: 11px; }
  .site-footer p:last-child { font-size: 10px; }
}
@media (min-width: 960px) {
  .hero { grid-template-columns: 1fr 390px; padding-block: 38px; }
  .hero h1 { font-size: 52px; }
  .hero-note { font-size: 13px; }
  .eyebrow { font-size: 10px; }
  .local-panel { padding: 24px 26px; }
  .local-label { font-size: 10px; }
  #local-time { font-size: 89px; }
  #local-seconds { font-size: 27px; }
  .local-date { font-size: 14px; }
  .local-zone-line { font-size: 11px; }
  .clock-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
@media (min-width: 1280px) {
  .page-shell { padding-inline: 48px; }
  .clock-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; }
  .hero { grid-template-columns: 1fr 425px; padding-block: 37px; }
  .hero h1 { font-size: 56px; }
  .local-panel { padding: 25px 29px; }
  #local-time { font-size: 100px; }
  .clock-card { min-height: 225px; }
}
@media (max-width: 359px) {
  .page-shell { padding-inline: max(12px, env(safe-area-inset-left)) max(12px, env(safe-area-inset-right)); }
  .brand span { font-size: 9px; letter-spacing: .12em; }
  .brand { gap: 7px; }
  .header-controls, .site-header { gap: 6px; }
  .format-switch button, .mode-switch button { flex-basis: 44px; width: 44px; min-height: 38px; font-size: 11px; }
  .brand-dial { width: 26px; height: 26px; }
  .hero h1 { font-size: 32px; }
  .clock-card { padding-inline: 13px; column-gap: 8px; }
  .card-time { font-size: 35px; }
  .location-name { font-size: 15px; }
  .location-detail { font-size: 10px; }
  .card-date { font-size: 10px; }
  .local-panel { padding-inline: 16px; }
  .clock-card { padding-inline: 14px; }
  .zone-offset { font-size: 10px; }
}
@media (max-width: 310px) {
  .brand span { display: none; }
}
@media (hover: hover) {
  .format-switch button:not([aria-pressed="true"]):hover, .mode-switch button:not([aria-pressed="true"]):hover { color: var(--text); background: #ffffff09; }
  .format-switch button[aria-pressed="true"]:hover, .mode-switch button[aria-pressed="true"]:hover { color: #312039; background: #ffb441; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; scroll-behavior: auto !important; }
}

