/* World Clock Overlap — stacked day/night bars + the green "everyone awake" window.
 * One Page Toys tool family, self-contained, theme-aware (light/dark). */

@import url("https://fonts.googleapis.com/css2?family=Archivo:wght@500;600;700;800;900&family=Inter:wght@400;500;600;700&display=swap");

:root{
  --font-display: "Archivo", system-ui, -apple-system, "Segoe UI", sans-serif;
  --font-sans: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --ink: #1a2230;
  --bg: #f6f8fb;
  --surface: #ffffff;
  --surface-2: #eef2f8;
  --muted: #6a7688;
  --line: #e3e9f1;
  --line-strong: #cdd6e3;
  --accent: #2f7ff0;
  --accent-hover: #1f66cf;
  --accent-soft: rgba(47, 127, 240, 0.14);
  --good: #21bd6c;
  --good-soft: rgba(33, 189, 108, 0.16);
  --radius: 18px;
  --radius-sm: 12px;
  --radius-pill: 999px;
  --shadow: 0 2px 8px rgba(20, 32, 52, 0.06);
  --shadow-md: 0 8px 22px rgba(20, 32, 52, 0.10);
  --shadow-lg: 0 16px 40px rgba(20, 32, 52, 0.12);
  --glass: rgba(255, 255, 255, 0.74);
  --name-w: 112px;
  --time-w: 66px;
}
:root[data-theme="dark"]{
  --ink: #e7edf6;
  --bg: #0e1420;
  --surface: #172030;
  --surface-2: #1f2a3c;
  --muted: #93a1b6;
  --line: #232f42;
  --line-strong: #35435c;
  --accent: #5aa0ff;
  --accent-hover: #7cb5ff;
  --accent-soft: rgba(90, 160, 255, 0.18);
  --good: #3ad688;
  --good-soft: rgba(58, 214, 136, 0.18);
  --shadow: 0 2px 10px rgba(0, 0, 0, 0.45);
  --shadow-md: 0 10px 30px -6px rgba(0, 0, 0, 0.5);
  --shadow-lg: 0 18px 48px -10px rgba(0, 0, 0, 0.6);
  --glass: rgba(23, 32, 48, 0.62);
}

*, *::before, *::after{ box-sizing: border-box; }
html, body{ height: 100%; }
body{
  margin: 0; min-height: 100%;
  display: flex; flex-direction: column;
  font-family: var(--font-sans); color: var(--ink);
  background: radial-gradient(64% 46% at 50% 0%, var(--accent-soft), transparent 70%), var(--bg);
  overflow-x: hidden; -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
}

/* ---------- Top bar ---------- */
.topbar{
  position: relative; z-index: 3;
  display: flex; align-items: center; justify-content: space-between;
  gap: 14px; flex-wrap: wrap; padding: 14px clamp(16px, 4vw, 30px);
  border-bottom: 1px solid var(--line);
  background: color-mix(in srgb, var(--bg) 82%, transparent);
  backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
}
.brand{ display: inline-flex; align-items: center; gap: 10px; font-family: var(--font-display); font-weight: 800; font-size: 0.86rem; letter-spacing: 0.16em; text-transform: uppercase; color: var(--ink); text-decoration: none; }
.brand__mark{ width: 1.1em; height: 1.1em; border: 1.5px solid var(--ink); border-radius: 6px; background: linear-gradient(90deg, var(--ink) 0 50%, var(--surface) 50% 100%); }
.topbar__right{ display: inline-flex; align-items: center; gap: 12px; }
.topbar__tag{ font-family: var(--font-display); font-size: 0.72rem; font-weight: 600; letter-spacing: 0.16em; text-transform: uppercase; color: var(--muted); }
.iconbtn{ appearance: none; display: inline-flex; align-items: center; justify-content: center; width: 38px; height: 38px; font-size: 1rem; line-height: 1; border: 1.5px solid var(--line-strong); border-radius: var(--radius-pill); background: var(--surface); color: var(--ink); cursor: pointer; box-shadow: var(--shadow); transition: transform 140ms ease, box-shadow 140ms ease, border-color 140ms ease; }
.iconbtn:hover{ transform: translateY(-2px); box-shadow: var(--shadow-md); border-color: var(--ink); }
.iconbtn:focus-visible{ outline: none; box-shadow: 0 0 0 2px var(--bg), 0 0 0 5px var(--accent-soft); }
.theme-toggle__sun, .theme-toggle__moon, .theme-toggle__auto{ display: none; }
:root[data-theme-mode="system"] .theme-toggle__auto{ display: inline; }
:root[data-theme-mode="light"] .theme-toggle__sun{ display: inline; }
:root[data-theme-mode="dark"] .theme-toggle__moon{ display: inline; }

/* ---------- Stage ---------- */
.stage{ position: relative; z-index: 2; flex: 1 0 auto; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 22px; padding: clamp(20px, 4vw, 44px) 18px clamp(48px, 6vw, 72px); }
.wc{ width: 100%; max-width: 620px; text-align: center; }

.eyebrow{ margin: 0 0 4px; font-family: var(--font-display); font-size: 0.72rem; font-weight: 700; letter-spacing: 0.18em; text-transform: uppercase; color: var(--muted); }
.headline{
  margin: 0 0 26px; font-family: var(--font-display); font-weight: 900;
  font-size: clamp(1.5rem, 6vw, 2.5rem); line-height: 1.05; letter-spacing: -0.02em; color: var(--ink);
}
.headline .none{ color: var(--muted); font-weight: 800; }
.headline b{ color: var(--accent); }

/* ---------- Chart ---------- */
.chart{
  position: relative; width: 100%; padding: 20px clamp(14px, 3vw, 22px) 16px;
  border: 1px solid var(--line); border-radius: var(--radius);
  background: var(--glass); backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px);
  box-shadow: var(--shadow-lg);
}
.axis{ display: grid; grid-template-columns: var(--name-w) 1fr var(--time-w); margin-bottom: 8px; }
.axis__labels{ grid-column: 2; display: flex; justify-content: space-between; font-family: var(--font-display); font-size: 0.62rem; font-weight: 700; letter-spacing: 0.06em; color: var(--muted); }

.rows{ display: flex; flex-direction: column; gap: 8px; }
.crow{ display: grid; grid-template-columns: var(--name-w) 1fr var(--time-w); align-items: center; gap: 0; }
.crow__name{ display: flex; align-items: center; gap: 5px; padding-right: 8px; min-width: 0; }
.crow__city{ font-family: var(--font-display); font-weight: 800; font-size: 0.82rem; color: var(--ink); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; text-align: left; }
.crow__rm{ flex: 0 0 auto; width: 18px; height: 18px; border: 0; border-radius: 50%; background: transparent; color: var(--muted); font-size: 0.9rem; line-height: 1; cursor: pointer; opacity: 0.4; transition: opacity 140ms ease, background 140ms ease, color 140ms ease; }
.crow:hover .crow__rm, .crow__rm:focus-visible{ opacity: 1; }
.crow--solo .crow__rm{ display: none; }
.crow__rm:hover{ background: var(--accent-soft); color: var(--ink); }
.crow__bar{ height: 30px; border-radius: 8px; overflow: hidden; box-shadow: inset 0 0 0 1px rgba(0,0,0,0.06); position: relative; }
.crow__time{ font-family: var(--font-display); font-weight: 800; font-size: 0.8rem; color: var(--ink); text-align: right; font-variant-numeric: tabular-nums; padding-left: 8px; white-space: nowrap; }
.crow__time small{ display: block; font-size: 0.6rem; font-weight: 700; color: var(--muted); letter-spacing: 0.02em; }

/* overlay: overlap bands + draggable now-line, aligned to the bar column */
.overlay{ position: absolute; left: calc(clamp(14px, 3vw, 22px) + var(--name-w)); right: calc(clamp(14px, 3vw, 22px) + var(--time-w)); top: 34px; bottom: 16px; pointer-events: auto; cursor: ew-resize; touch-action: none; }
.overlap{ position: absolute; top: 0; bottom: 0; background: var(--good-soft); border-left: 1.5px dashed var(--good); border-right: 1.5px dashed var(--good); border-radius: 4px; pointer-events: none; }
.nowline{ position: absolute; top: -6px; bottom: -6px; width: 0; border-left: 2px solid var(--ink); pointer-events: auto; cursor: ew-resize; touch-action: none; }
.nowline__grip{ position: absolute; top: -7px; left: -7px; width: 14px; height: 14px; border-radius: 50%; background: var(--ink); box-shadow: 0 2px 6px rgba(0,0,0,0.3); }
.nowline__lab{ position: absolute; top: -30px; left: 50%; transform: translateX(-50%); font-family: var(--font-display); font-size: 0.62rem; font-weight: 800; letter-spacing: 0.04em; color: var(--surface); background: var(--ink); padding: 2px 7px; border-radius: var(--radius-pill); white-space: nowrap; }

/* ---------- Controls ---------- */
.controls{ margin-top: 22px; display: flex; flex-wrap: wrap; gap: 12px; justify-content: center; align-items: center; }
.addcity{ display: inline-flex; align-items: center; gap: 6px; padding: 0 6px 0 16px; border: 1.5px solid var(--accent); border-radius: var(--radius-pill); background: var(--accent-soft); box-shadow: var(--shadow); cursor: pointer; }
.addcity__plus{ font-family: var(--font-display); font-weight: 900; font-size: 1.2rem; color: var(--accent); line-height: 1; }
.addcity select{ appearance: none; -webkit-appearance: none; border: 0; background: transparent; font-family: var(--font-display); font-size: 0.9rem; font-weight: 700; color: var(--accent); padding: 12px 14px 12px 4px; cursor: pointer; outline: none; }
.addcity select:disabled{ color: var(--muted); }
.addcity:has(select:disabled){ border-color: var(--line-strong); background: var(--surface); }
.addcity:has(select:disabled) .addcity__plus{ color: var(--muted); }
.addcity:focus-within{ box-shadow: 0 0 0 3px var(--accent-soft); }

.btn{ appearance: none; font-family: var(--font-display); font-size: 0.9rem; font-weight: 700; padding: 12px 22px; border-radius: var(--radius-pill); border: 1.5px solid var(--line-strong); background: var(--surface); color: var(--muted); cursor: pointer; box-shadow: var(--shadow); transition: transform 160ms ease, box-shadow 160ms ease, color 160ms ease, border-color 160ms ease; }
.btn--ghost:hover{ transform: translateY(-2px); color: var(--ink); border-color: var(--ink); box-shadow: var(--shadow-md); }
.btn:focus-visible{ outline: none; box-shadow: 0 0 0 2px var(--bg), 0 0 0 5px var(--accent-soft), var(--shadow); }

.backlink{ font-family: var(--font-display); font-size: 0.72rem; font-weight: 600; letter-spacing: 0.16em; text-transform: uppercase; color: var(--muted); text-decoration: none; border-bottom: 1px solid transparent; transition: color 140ms ease, border-color 140ms ease; }
.backlink:hover{ color: var(--ink); border-bottom-color: var(--accent); }

@media (max-width: 460px){
  :root{ --name-w: 74px; --time-w: 56px; }
  .crow__city{ font-size: 0.74rem; }
}
@media (prefers-reduced-motion: reduce){ .btn, .iconbtn, .crow__rm{ transition: none; } }
