/* ==========================================================================
   Clockella — theme
   Light look: soft blue-grey canvas, white cards,
   heavy Inter numerals and an animated blue light in the middle of cards.
   ========================================================================== */

:root {
  --bg: #EEF2F8;
  --bg-top: #F3F6FB;
  --card: #FFFFFF;
  --card-2: #F7F9FC;
  --ink: #0B1324;
  --ink-2: #172033;
  --muted: #5A6780;
  --muted-2: #8A96AB;
  --line: #D5DCE8;
  --line-2: #E2E8F2;
  --chip: #F1F4F9;
  --accent: #2563EB;
  --accent-ink: #1D4ED8;
  --accent-soft: #EAF1FF;
  --glow: 59, 130, 246;
  --ok: #10B981;
  --ok-soft: rgba(16, 185, 129, .16);
  --warn: #F59E0B;
  --danger: #E11D48;
  --radius: 28px;
  --radius-sm: 14px;
  --shadow: 0 1px 2px rgba(15, 23, 42, .04), 0 22px 60px -30px rgba(15, 23, 42, .28);
  --shadow-sm: 0 1px 2px rgba(15, 23, 42, .05), 0 8px 24px -14px rgba(15, 23, 42, .22);
  --font: 'Inter', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  --clock-font: var(--font);
  color-scheme: light;
}

[data-accent="emerald"] { --accent: #059669; --accent-ink: #047857; --accent-soft: #E7F7F1; --glow: 16, 185, 129; }
[data-accent="violet"]  { --accent: #7C3AED; --accent-ink: #6D28D9; --accent-soft: #F1EBFF; --glow: 139, 92, 246; }
[data-accent="rose"]    { --accent: #E11D48; --accent-ink: #BE123C; --accent-soft: #FDECEF; --glow: 244, 63, 94; }
[data-accent="amber"]   { --accent: #D97706; --accent-ink: #B45309; --accent-soft: #FEF3E2; --glow: 245, 158, 11; }
[data-accent="slate"]   { --accent: #334155; --accent-ink: #1E293B; --accent-soft: #EEF1F5; --glow: 100, 116, 139; }

[data-font="grotesk"] { --clock-font: 'Space Grotesk', var(--font); }
[data-font="digital"] { --clock-font: 'Orbitron', var(--font); }
[data-font="mono"]    { --clock-font: 'JetBrains Mono', ui-monospace, monospace; }

/* Night mode */
[data-theme="dark"] {
  --bg: #070C18;
  --bg-top: #0A1122;
  --card: #0E1628;
  --card-2: #121C31;
  --ink: #F1F5FB;
  --ink-2: #E2E8F2;
  --muted: #93A0B8;
  --muted-2: #6F7C94;
  --line: #22304D;
  --line-2: #1A2640;
  --chip: #16213A;
  --accent-soft: rgba(var(--glow), .14);
  --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 30px 70px -30px rgba(0, 0, 0, .8);
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, .3), 0 10px 30px -16px rgba(0, 0, 0, .7);
  color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { margin: 0; }
html { background: var(--bg); }
body {
  min-height: 100vh;
  font-family: var(--font);
  color: var(--ink);
  background:
    radial-gradient(900px 520px at 92% -8%, rgba(var(--glow), .13), transparent 62%),
    radial-gradient(700px 420px at -6% 108%, rgba(var(--glow), .07), transparent 60%),
    linear-gradient(180deg, var(--bg-top), var(--bg));
  background-attachment: fixed;
  -webkit-font-smoothing: antialiased;
  font-feature-settings: "cv11", "ss01";
}
a { color: inherit; }
button, input, select, textarea { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }
[hidden] { display: none !important; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.muted { color: var(--muted); }
.tnum { font-variant-numeric: tabular-nums; }

/* -------------------------------------------------------------- layout */
.shell { width: min(1440px, 100%); margin: 0 auto; padding: 26px 32px 40px; }
.stack { display: flex; flex-direction: column; gap: 26px; min-width: 0; }
.split > * { min-width: 0; }
.split { display: grid; grid-template-columns: minmax(0, 1.55fr) minmax(320px, 1fr); gap: 26px; align-items: start; }

/* -------------------------------------------------------------- top bar */
.topbar { display: grid; grid-template-columns: minmax(0, auto) auto auto; justify-content: space-between; align-items: center; gap: 16px; margin-bottom: 26px; }
.brand { display: flex; align-items: center; gap: 13px; text-decoration: none; min-width: 0; }
.logo-mark { display: block; flex: none; width: 56px; height: 56px; border-radius: 13px; box-shadow: 0 10px 24px -10px rgba(15, 26, 64, .55), 0 2px 4px rgba(15, 26, 64, .18); }
.logo-mark svg { display: block; width: 100%; height: 100%; }
.logo-tile svg { width: 28px; height: 28px; color: var(--accent-ink); }
.logo-tile {
  flex: none; width: 56px; height: 56px; border-radius: 16px; display: grid; place-items: center;
  background: var(--card); box-shadow: var(--shadow-sm), inset 0 0 0 1px var(--line-2);
  color: var(--accent-ink); font: italic 900 17px/1 var(--font); letter-spacing: -.02em;
}
.brand-org { display: block; font-size: 11.5px; font-weight: 700; letter-spacing: .16em; text-transform: uppercase; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.brand-title { display: block; font-size: 26px; font-weight: 900; letter-spacing: -.025em; line-height: 1.1; color: var(--ink); }

.pill {
  display: inline-flex; align-items: center; gap: 2px; padding: 6px; border-radius: 999px;
  background: var(--card); box-shadow: var(--shadow-sm), inset 0 0 0 1px var(--line-2);
}
.pill a, .pill button {
  display: inline-flex; align-items: center; gap: 6px; padding: 9px 12px; border-radius: 999px; border: 0;
  background: transparent; font-size: 14px; font-weight: 600; color: var(--ink-2); text-decoration: none; cursor: pointer; white-space: nowrap;
  transition: background .15s, color .15s;
}
.pill a:hover, .pill button:hover { background: var(--chip); }
.pill a.active { background: var(--accent-soft); color: var(--accent-ink); }
[data-theme="dark"] .pill a.active { color: #fff; }
.pill svg { width: 16px; height: 16px; flex: none; }

.top-right { display: flex; align-items: center; justify-content: flex-end; gap: 14px; }
.mini-clock { text-align: right; line-height: 1; }
.mini-clock .t { font: 900 40px/1 var(--clock-font); letter-spacing: -.035em; font-variant-numeric: tabular-nums; }
.mini-clock .s { font-size: 17px; font-weight: 800; color: var(--muted); margin-left: 4px; letter-spacing: 0; }
.mini-clock .ap { font-size: 17px; font-weight: 800; color: var(--accent); margin-left: 3px; letter-spacing: 0; }
.mini-clock .d { display: block; margin-top: 7px; font-size: 13.5px; color: var(--muted); }
.icon-btn {
  width: 44px; height: 44px; border-radius: 50%; display: grid; place-items: center; cursor: pointer;
  background: var(--card); border: 1px solid var(--line); color: var(--ink-2); box-shadow: var(--shadow-sm);
}
.icon-btn:hover { border-color: var(--accent); color: var(--accent); }
.icon-btn svg { width: 19px; height: 19px; }

/* -------------------------------------------------------------- cards + glow */
.card { position: relative; background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); padding: 28px; }
.card.flat { box-shadow: var(--shadow-sm); }
.card-title { margin: 0 0 18px; font-size: 18px; font-weight: 800; letter-spacing: -.01em; }
.glow { overflow: hidden; isolation: isolate; }
.glow::before, .glow::after { content: ""; position: absolute; pointer-events: none; z-index: -1; border-radius: 50%; }
/* wide, soft blue light that drifts slowly */
.glow::before {
  width: min(760px, 86%); aspect-ratio: 1; left: 58%; top: 54%;
  background: radial-gradient(closest-side, rgba(var(--glow), .20), rgba(var(--glow), .09) 46%, rgba(var(--glow), 0) 74%);
  transform: translate(-50%, -50%);
  animation: glow-drift 16s ease-in-out infinite;
}
/* brighter core that breathes */
.glow::after {
  width: min(340px, 44%); aspect-ratio: 1; left: 57%; top: 55%;
  background: radial-gradient(closest-side, rgba(var(--glow), .16), rgba(var(--glow), 0) 72%);
  transform: translate(-50%, -50%);
  animation: glow-breathe 6.5s ease-in-out infinite;
}
[data-theme="dark"] .glow::before { background: radial-gradient(closest-side, rgba(var(--glow), .30), rgba(var(--glow), .12) 46%, rgba(var(--glow), 0) 74%); }
[data-theme="dark"] .glow::after { background: radial-gradient(closest-side, rgba(var(--glow), .26), rgba(var(--glow), 0) 72%); }
@keyframes glow-drift {
  0%   { transform: translate(-50%, -50%) scale(1); }
  25%  { transform: translate(-62%, -44%) scale(1.08); }
  50%  { transform: translate(-46%, -60%) scale(.94); }
  75%  { transform: translate(-38%, -47%) scale(1.06); }
  100% { transform: translate(-50%, -50%) scale(1); }
}
@keyframes glow-breathe {
  0%, 100% { opacity: .45; transform: translate(-50%, -50%) scale(.82); }
  50%      { opacity: 1;   transform: translate(-50%, -50%) scale(1.14); }
}
.no-glow .glow::before, .no-glow .glow::after { display: none; }
@media (prefers-reduced-motion: reduce) { .glow::before, .glow::after { animation: none; } }

/* -------------------------------------------------------------- section label */
.sec { display: flex; align-items: center; gap: 12px; min-height: 30px; flex-wrap: wrap; }
.sec .ico {
  width: 28px; height: 28px; border-radius: 8px; display: grid; place-items: center; flex: none;
  background: var(--card); box-shadow: inset 0 0 0 1px var(--line-2), var(--shadow-sm); color: var(--muted);
}
.sec .ico svg { width: 15px; height: 15px; }
.sec .ico.ok { color: #059669; }
.sec .ico.live { color: #10B981; }
.sec .ico.blue { color: var(--accent); }
.sec h2, .sec .lbl { margin: 0; font-size: 13px; font-weight: 800; letter-spacing: .22em; text-transform: uppercase; color: var(--ink-2); }
.sec .count {
  min-width: 24px; height: 24px; padding: 0 7px; border-radius: 999px; display: inline-grid; place-items: center;
  background: var(--card); box-shadow: inset 0 0 0 1px var(--line-2); font-size: 12px; font-weight: 800;
}
.sec .note { font-size: 14px; color: var(--muted-2); }
.sec .rule { flex: 1; height: 1px; background: var(--line-2); min-width: 40px; }
.sec .end { margin-left: auto; display: flex; gap: 8px; }

/* -------------------------------------------------------------- buttons, chips */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 44px; padding: 0 18px;
  border-radius: 999px; border: 1px solid var(--line); background: var(--card); color: var(--ink-2);
  font: 600 14px var(--font); cursor: pointer; text-decoration: none; white-space: nowrap;
  transition: transform .08s, border-color .15s, background .15s, box-shadow .15s;
}
.btn:hover { border-color: var(--accent); color: var(--accent-ink); }
[data-theme="dark"] .btn:hover { color: #fff; }
.btn:active { transform: translateY(1px); }
.btn svg { width: 17px; height: 17px; flex: none; }
.btn-primary { background: var(--accent); border-color: var(--accent); color: #fff; box-shadow: 0 10px 24px -12px rgba(var(--glow), .9); }
.btn-primary:hover { background: var(--accent-ink); border-color: var(--accent-ink); color: #fff; }
.btn-danger { color: var(--danger); }
.btn-danger:hover { border-color: var(--danger); color: var(--danger); }
.btn-lg { min-height: 54px; padding: 0 26px; font-size: 16px; font-weight: 700; }
.btn-sm { min-height: 34px; padding: 0 13px; font-size: 13px; }
.btn-ghost { border-color: transparent; background: transparent; }
.btn[disabled] { opacity: .45; pointer-events: none; }
.btn-row { display: flex; flex-wrap: wrap; gap: 10px; }

.chip, .tag {
  display: inline-flex; align-items: center; gap: 6px; padding: 6px 15px; border-radius: 999px;
  background: var(--chip); font-size: 14px; font-weight: 700; color: var(--ink-2); white-space: nowrap;
}
.tag-ok { background: var(--ok-soft); color: #047857; }
[data-theme="dark"] .tag-ok { color: #6EE7B7; }

/* -------------------------------------------------------------- big digital clock */
.hero { min-height: 430px; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; padding: 46px 28px; }
.hero .kicker { font-size: 13px; font-weight: 800; letter-spacing: .24em; text-transform: uppercase; color: var(--muted); }
.big-time {
  margin: 14px 0 6px; font: 900 clamp(84px, 14vw, 206px)/.92 var(--clock-font);
  letter-spacing: -.05em; color: var(--ink); font-variant-numeric: tabular-nums; white-space: nowrap;
}
.big-time .ss { font-size: .27em; color: var(--muted); letter-spacing: -.01em; margin-left: .12em; }
.big-time .ap { font-size: .27em; color: var(--accent); letter-spacing: 0; margin-left: .22em; }
[data-font="digital"] .big-time, [data-font="mono"] .big-time { letter-spacing: -.01em; }
.hero .date { font-size: 22px; color: var(--muted); font-weight: 500; }
.hero .sub { margin-top: 6px; font-size: 15px; color: var(--muted-2); }
.hero .btn-row { margin-top: 30px; justify-content: center; }
.hero-flip { margin: 18px 0 10px; display: flex; justify-content: center; }

.readout {
  margin-top: 22px; display: inline-flex; align-items: center; gap: 12px; padding: 10px 18px 10px 12px; border-radius: 999px;
  background: var(--card-2); box-shadow: inset 0 0 0 1px var(--line-2); font-size: 15px; color: var(--muted);
}
.readout .dot { width: 10px; height: 10px; border-radius: 50%; background: var(--muted-2); }
.readout.on .dot { background: var(--ok); box-shadow: 0 0 0 5px var(--ok-soft); }
.readout b { color: var(--ink); font-weight: 800; font-variant-numeric: tabular-nums; }

.sound-banner {
  display: flex; align-items: center; gap: 12px; padding: 12px 16px; border-radius: 16px; margin-bottom: 18px;
  background: #FFF7E8; color: #92400E; font-size: 14px; font-weight: 600; box-shadow: inset 0 0 0 1px #F8D9A8; cursor: pointer;
}
.sound-banner svg { width: 20px; height: 20px; flex: none; }
[data-theme="dark"] .sound-banner { background: rgba(245, 158, 11, .12); color: #FCD34D; box-shadow: inset 0 0 0 1px rgba(245, 158, 11, .3); }

/* -------------------------------------------------------------- presets + lists */
.preset-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(104px, 1fr)); gap: 10px; }
.preset {
  display: block; padding: 13px 10px; text-align: center; border-radius: var(--radius-sm); text-decoration: none;
  background: var(--card-2); box-shadow: inset 0 0 0 1px var(--line-2); font-weight: 800; font-size: 15.5px; color: var(--ink-2);
  font-variant-numeric: tabular-nums; transition: box-shadow .15s, color .15s, transform .08s;
}
.preset small { display: block; font-size: 12px; font-weight: 600; color: var(--muted-2); margin-top: 2px; }
.preset:hover { box-shadow: inset 0 0 0 2px var(--accent); color: var(--accent-ink); }
[data-theme="dark"] .preset:hover { color: #fff; }

.list { display: flex; flex-direction: column; gap: 10px; }
.row-item {
  display: flex; align-items: center; gap: 14px; padding: 14px 16px; border-radius: 18px;
  background: var(--card-2); box-shadow: inset 0 0 0 1px var(--line-2);
}
.row-item .big { font: 900 28px/1 var(--clock-font); letter-spacing: -.03em; font-variant-numeric: tabular-nums; }
.row-item .big small { font-size: 14px; font-weight: 800; color: var(--accent); margin-left: 3px; letter-spacing: 0; }
.row-item .meta { min-width: 0; flex: 1; }
.row-item .meta b { display: block; font-size: 15px; font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.row-item .meta span { display: block; margin-top: 3px; font-size: 13px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.row-item.off { opacity: .6; }
.row-item .acts { display: flex; gap: 6px; }
.empty { padding: 26px 10px; text-align: center; color: var(--muted-2); font-size: 14px; }

/* switch */
.switch { position: relative; width: 48px; height: 28px; flex: none; }
.switch input { position: absolute; inset: 0; opacity: 0; margin: 0; cursor: pointer; z-index: 1; }
.switch span { position: absolute; inset: 0; border-radius: 999px; background: var(--line); transition: background .2s; }
.switch span::after { content: ""; position: absolute; top: 3px; left: 3px; width: 22px; height: 22px; border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgba(0,0,0,.25); transition: transform .2s; }
.switch input:checked + span { background: var(--ok); }
.switch input:checked + span::after { transform: translateX(20px); }
.switch input:focus-visible + span { outline: 2px solid var(--accent); outline-offset: 2px; }

/* -------------------------------------------------------------- forms + modal */
.modal {
  position: fixed; inset: 0; z-index: 60; display: grid; place-items: center; padding: 20px;
  background: rgba(11, 19, 36, .42); backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px);
  opacity: 0; pointer-events: none; transition: opacity .18s;
}
.modal.open { opacity: 1; pointer-events: auto; }
.modal-card {
  width: min(560px, 100%); max-height: calc(100vh - 40px); overflow: auto; border-radius: 26px; background: var(--card);
  box-shadow: 0 40px 90px -30px rgba(11, 19, 36, .55); padding: 28px; transform: translateY(10px) scale(.98); transition: transform .18s;
}
.modal.open .modal-card { transform: none; }
.modal-card.wide { width: min(760px, 100%); }
.modal-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 20px; }
.modal-head h3 { margin: 0; font-size: 22px; font-weight: 900; letter-spacing: -.02em; }
.modal-foot { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 10px; margin-top: 24px; }
.modal-foot .left { margin-right: auto; }

.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.form-grid .full { grid-column: 1 / -1; }
.field { display: flex; flex-direction: column; gap: 7px; }
.field > label, .field > .label { font-size: 13px; font-weight: 700; color: var(--muted); }
.field .hint { font-size: 12.5px; color: var(--muted-2); }
.field .err { font-size: 12.5px; color: var(--danger); font-weight: 600; }
.input, .select, textarea.input {
  width: 100%; min-height: 46px; padding: 0 14px; border-radius: 12px; border: 1px solid var(--line);
  background: var(--card); color: var(--ink); font-size: 15px; transition: border-color .15s, box-shadow .15s;
}
textarea.input { padding: 12px 14px; min-height: 90px; resize: vertical; }
.input:focus, .select:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 4px rgba(var(--glow), .16); }
.select { appearance: none; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1l5 5 5-5' fill='none' stroke='%235A6780' stroke-width='2' stroke-linecap='round'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 14px center; padding-right: 36px; }
.time-pick { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 10px; }
.time-pick .select { font-size: 22px; font-weight: 800; min-height: 58px; text-align: center; font-variant-numeric: tabular-nums; }
.check { display: inline-flex; align-items: center; gap: 10px; font-size: 14.5px; font-weight: 600; cursor: pointer; }
.check input { width: 18px; height: 18px; accent-color: var(--accent); }
.days { display: flex; flex-wrap: wrap; gap: 6px; }
.days label { position: relative; }
.days input { position: absolute; opacity: 0; }
.days span {
  display: grid; place-items: center; width: 46px; height: 40px; border-radius: 12px; cursor: pointer; font-size: 13px; font-weight: 800;
  background: var(--chip); color: var(--muted); transition: background .15s, color .15s;
}
.days input:checked + span { background: var(--accent); color: #fff; }
.days input:focus-visible + span { outline: 2px solid var(--accent); outline-offset: 2px; }
.swatches { display: flex; gap: 10px; flex-wrap: wrap; }
.swatches label { position: relative; }
.swatches input { position: absolute; opacity: 0; }
.swatches span { display: block; width: 34px; height: 34px; border-radius: 50%; cursor: pointer; box-shadow: inset 0 0 0 3px rgba(255,255,255,.7); }
.swatches input:checked + span { outline: 3px solid var(--ink); outline-offset: 2px; }
.seg { display: inline-flex; padding: 4px; border-radius: 12px; background: var(--chip); gap: 4px; }
.seg label { position: relative; }
.seg input { position: absolute; opacity: 0; }
.seg span { display: block; padding: 8px 14px; border-radius: 9px; font-size: 13.5px; font-weight: 700; color: var(--muted); cursor: pointer; }
.seg input:checked + span { background: var(--card); color: var(--ink); box-shadow: var(--shadow-sm); }
.settings-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 18px 22px; }
.settings-grid .full { grid-column: 1 / -1; }
input[type=range] { width: 100%; accent-color: var(--accent); }

/* -------------------------------------------------------------- ringing overlay */
.ring {
  position: fixed; inset: 0; z-index: 80; display: grid; place-items: center; padding: 20px;
  background: radial-gradient(800px 500px at 50% 45%, rgba(var(--glow), .35), rgba(11, 19, 36, .72));
  backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px);
}
.ring-card { width: min(620px, 100%); text-align: center; padding: 46px 32px 34px; }
.ring-bell { width: 84px; height: 84px; margin: 0 auto 10px; border-radius: 50%; display: grid; place-items: center; background: var(--accent-soft); color: var(--accent); animation: ring-shake 1s ease-in-out infinite; }
.ring-bell svg { width: 42px; height: 42px; }
@keyframes ring-shake { 0%,100%{transform:rotate(0)} 10%{transform:rotate(-14deg)} 20%{transform:rotate(12deg)} 30%{transform:rotate(-10deg)} 40%{transform:rotate(8deg)} 50%{transform:rotate(0)} }
.ring-time { font: 900 clamp(64px, 12vw, 120px)/1 var(--clock-font); letter-spacing: -.045em; margin: 12px 0 6px; font-variant-numeric: tabular-nums; }
.ring-title { font-size: 26px; font-weight: 800; letter-spacing: -.01em; }
.ring-sub { margin-top: 6px; color: var(--muted); font-size: 15px; }
.ring-wx { margin-top: 14px; display: inline-flex; align-items: center; gap: 10px; padding: 7px 16px 7px 10px; border-radius: 999px; background: var(--chip); box-shadow: inset 0 0 0 1px var(--line-2); font-size: 14px; font-weight: 700; color: var(--ink-2); }
.ring-wx[hidden] { display: none; }
.ring-wx svg { width: 28px; height: 28px; flex: none; }
.hero-wx { display: inline-flex; align-items: center; gap: 4px; white-space: nowrap; font-weight: 700; }
.hero-wx svg { width: 20px; height: 20px; flex: none; }
.ring .btn-row { justify-content: center; margin-top: 30px; }

/* -------------------------------------------------------------- toast */
.toasts { position: fixed; z-index: 90; left: 50%; bottom: 24px; transform: translateX(-50%); display: flex; flex-direction: column; gap: 8px; align-items: center; pointer-events: none; }
.toast { padding: 12px 18px; border-radius: 14px; background: #0B1324; color: #fff; font-size: 14px; font-weight: 600; box-shadow: 0 16px 40px -16px rgba(0,0,0,.5); animation: toast-in .22s ease-out; pointer-events: auto; max-width: min(560px, 92vw); }
.toast.err { background: #9F1239; }
.toast.ok { background: #065F46; }
@keyframes toast-in { from { opacity: 0; transform: translateY(8px); } }

/* ==========================================================================
   Split-flap clock — "heavy material"
   ========================================================================== */
.clk { display: flex; align-items: flex-start; gap: .2em; font-size: var(--flip-size, 104px); line-height: 1; font-family: Inter, var(--font); font-weight: 900; font-variant-numeric: tabular-nums; }
.clk .grp { display: flex; flex-direction: column; align-items: center; gap: 14px; }
.clk .digits { display: flex; gap: .06em; }
.clk .unit { font-size: clamp(13px, .13em, 22px); font-weight: 500; color: var(--muted); font-family: var(--font); }
.fd { position: relative; width: .76em; height: 1.18em; perspective: 5em; border-radius: .09em; overflow: hidden;
  box-shadow: 0 .025em 0 var(--e1), 0 .05em 0 var(--e2), 0 .07em 0 var(--e3), 0 .13em .17em rgba(9,18,45,.38), 0 .03em .04em rgba(9,18,45,.4); }
.fd .h { position: absolute; left: 0; right: 0; height: 50%; overflow: hidden; color: var(--ink-f); font-style: normal; text-shadow: var(--ts); }
.fd .h b { display: block; height: 1.18em; line-height: 1.18em; text-align: center; font-weight: 900; }
.fd .t, .fd .ft { top: 0; transform-origin: 50% 100%; background: var(--top);
  box-shadow: inset 0 .016em 0 rgba(255,255,255,.22), inset .012em 0 0 rgba(255,255,255,.06), inset -.012em 0 0 rgba(0,0,0,.25), inset 0 -.03em .025em rgba(0,0,0,.5); }
.fd .bo, .fd .fb { bottom: 0; transform-origin: 50% 0; background: var(--bot); box-shadow: inset 0 .03em .03em rgba(0,0,0,.55), inset 0 -.016em 0 rgba(0,0,0,.35); }
.fd .bo b, .fd .fb b { margin-top: -.59em; }
.fd .ft { z-index: 2; transform: rotateX(-90deg); backface-visibility: hidden; -webkit-backface-visibility: hidden; animation-duration: .24s; animation-timing-function: cubic-bezier(.6,0,.95,.4); animation-fill-mode: both; }
.fd .fb { z-index: 3; backface-visibility: hidden; -webkit-backface-visibility: hidden; animation-duration: .38s; animation-delay: .22s; animation-timing-function: linear; animation-fill-mode: both; }
@keyframes ftA { from { transform: rotateX(0); } to { transform: rotateX(-90deg); } }
@keyframes ftB { from { transform: rotateX(0); } to { transform: rotateX(-90deg); } }
@keyframes fbA { 0% { transform: rotateX(90deg); animation-timing-function: cubic-bezier(.5,0,1,.6); } 52% { transform: rotateX(0); } 70% { transform: rotateX(14deg); } 84% { transform: rotateX(0); } 93% { transform: rotateX(4deg); } 100% { transform: rotateX(0); } }
@keyframes fbB { 0% { transform: rotateX(90deg); animation-timing-function: cubic-bezier(.5,0,1,.6); } 52% { transform: rotateX(0); } 70% { transform: rotateX(14deg); } 84% { transform: rotateX(0); } 93% { transform: rotateX(4deg); } 100% { transform: rotateX(0); } }
.fd::after { content: ""; position: absolute; z-index: 4; left: 0; right: 0; top: 50%; height: .03em; margin-top: -.015em; background: linear-gradient(180deg, rgba(0,0,0,.85), rgba(0,0,0,.6) 60%, rgba(255,255,255,.12)); }
.clk .cl { display: flex; flex-direction: column; justify-content: center; gap: .2em; height: 1.18em; }
.clk .cl i { display: block; width: .13em; height: .13em; border-radius: 50%; background: #5A6780; }
.m-s, .m-d { --rv: radial-gradient(circle at 35% 35%, #FFFFFF, #9AA2AD 45%, #4E555F 66%, transparent 72%); --br: repeating-linear-gradient(0deg, rgba(255,255,255,.16) 0 1px, rgba(0,0,0,.05) 1px 2px, transparent 2px 3px); }
.m-s { --top: var(--rv) left .07em top .07em/.09em .09em no-repeat, var(--rv) right .07em top .07em/.09em .09em no-repeat, var(--br), linear-gradient(100deg, rgba(255,255,255,0) 25%, rgba(255,255,255,.5) 48%, rgba(255,255,255,0) 72%), linear-gradient(180deg, #E4E8ED, #BAC1CA);
  --bot: var(--rv) left .07em bottom .07em/.09em .09em no-repeat, var(--rv) right .07em bottom .07em/.09em .09em no-repeat, var(--br), linear-gradient(100deg, rgba(255,255,255,0) 25%, rgba(255,255,255,.3) 48%, rgba(255,255,255,0) 72%), linear-gradient(180deg, #AFB6C0, #8C949F);
  --ink-f: #172033; --ts: 0 .012em 0 rgba(255,255,255,.6), 0 -.008em 0 rgba(0,0,0,.4); --e1: #7D858F; --e2: #636A74; --e3: #4A5059; }
.m-d { --top: var(--rv) left .07em top .07em/.09em .09em no-repeat, var(--rv) right .07em top .07em/.09em .09em no-repeat, var(--br), linear-gradient(100deg, rgba(255,255,255,0) 25%, rgba(255,255,255,.2) 48%, rgba(255,255,255,0) 72%), linear-gradient(180deg, #5E656F, #4A5059);
  --bot: var(--rv) left .07em bottom .07em/.09em .09em no-repeat, var(--rv) right .07em bottom .07em/.09em .09em no-repeat, var(--br), linear-gradient(100deg, rgba(255,255,255,0) 25%, rgba(255,255,255,.12) 48%, rgba(255,255,255,0) 72%), linear-gradient(180deg, #3D434B, #2D3238);
  --ink-f: #F4F6F9; --ts: 0 .02em 0 rgba(0,0,0,.5); --e1: #2A2E34; --e2: #1F2227; --e3: #16181C; }
.m-n { --top: linear-gradient(180deg, #20305C, #18254A); --bot: linear-gradient(180deg, #132043, #0C1632); --ink-f: #FFFFFF; --ts: 0 .02em 0 rgba(0,0,0,.35); --e1: #0B1430; --e2: #091027; --e3: #070C1E; }
[data-theme="dark"] .clk .cl i { background: #93A0B8; }
.clk .ampm { align-self: flex-start; margin: .42em 0 0 .05em; font-size: .3em; font-weight: 900; color: var(--accent); letter-spacing: 0; font-family: var(--font); }

/* ==========================================================================
   Timer card + flip clock page
   ========================================================================== */
.sound-btn { display: flex; align-items: center; gap: 8px; min-height: 44px; padding: 0 16px; border-radius: 99px; border: 1px solid var(--line); background: var(--card); color: #334155; font: 600 14px var(--font); cursor: pointer; }
[data-theme="dark"] .sound-btn { color: var(--ink-2); }
.sound-btn svg { width: 18px; height: 18px; }
.kicker { font-size: 13px; font-weight: 800; letter-spacing: .24em; text-transform: uppercase; color: var(--muted); }

.timer-card { display: flex; flex-direction: column; align-items: center; gap: 28px; padding: 30px 34px 36px; text-align: center; }
.timer-head { width: 100%; display: flex; align-items: center; justify-content: space-between; gap: 16px; min-height: 44px; }
.timer-head .kicker { text-align: left; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.timer-flip .clk { --flip-size: clamp(64px, 8.6vw, 150px); }
.timer-status { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; }
.timer-status span { padding: 6px 15px; border-radius: 99px; background: var(--chip); font-size: 14px; font-weight: 700; color: var(--ink-2); }
.timer-status .state.running { background: var(--ok-soft); color: #047857; }
.timer-status .state.done { background: #FFE4E6; color: #9F1239; }
[data-theme="dark"] .timer-status .state.running { color: #6EE7B7; }

.track { position: relative; width: min(760px, 100%); height: 8px; border-radius: 99px; background: var(--line-2); overflow: hidden; }
.track .fill { position: absolute; left: 0; top: 0; bottom: 0; border-radius: 99px; background: linear-gradient(90deg, #2563EB, #10B981); width: 0; transition: width .6s linear; }
.warn .track .fill { background: linear-gradient(90deg, #2563EB, #F59E0B); }
.danger .track .fill { background: linear-gradient(90deg, #F59E0B, #E11D48); }
.paused .track .fill { transition: none; }

.flip-page { min-height: 560px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 22px; text-align: center; padding: 48px 30px; }
.flip-page .clk { --flip-size: clamp(64px, 9.6vw, 170px); }
.flip-page .btn-row { justify-content: center; margin-top: 10px; }
.is-fullscreen .flip-page { min-height: calc(100vh - 150px); }
.is-fullscreen .flip-page .clk { --flip-size: clamp(80px, 13vw, 260px); }

/* ==========================================================================
   Stopwatch, world clock, countdowns
   ========================================================================== */
.sw-time { font: 900 clamp(70px, 12vw, 176px)/.92 var(--clock-font); letter-spacing: -.05em; font-variant-numeric: tabular-nums; white-space: nowrap; margin: 16px 0 8px; }
.sw-time .cs { font-size: .42em; color: var(--accent); letter-spacing: -.02em; }
.sw-lap-now { font-size: 18px; color: var(--muted); font-weight: 600; font-variant-numeric: tabular-nums; }
.table { width: 100%; border-collapse: separate; border-spacing: 0; font-size: 14.5px; }
.table th { text-align: left; font-size: 12px; font-weight: 800; letter-spacing: .12em; text-transform: uppercase; color: var(--muted); padding: 10px 12px; border-bottom: 1px solid var(--line-2); }
.table td { padding: 12px; border-bottom: 1px solid var(--line-2); font-variant-numeric: tabular-nums; vertical-align: middle; }
.table tr:last-child td { border-bottom: 0; }
.table .best td { color: #047857; font-weight: 700; }
.table .worst td { color: var(--danger); font-weight: 700; }
[data-theme="dark"] .table .best td { color: #6EE7B7; }
.table-wrap { overflow: auto; border-radius: 18px; box-shadow: inset 0 0 0 1px var(--line-2); max-height: 420px; }

.time-hero { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; gap: 30px; min-height: 380px; padding: 40px 48px; }
.time-hero .big-time { margin: 8px 0; text-align: left; }
.facts { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 18px; }

.city-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 16px; }
.city { position: relative; padding: 22px; border-radius: 22px; background: var(--card); box-shadow: var(--shadow-sm); display: flex; gap: 16px; align-items: center; }
.city .info { min-width: 0; flex: 1; }
.city .name { font-size: 16px; font-weight: 800; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.city .country { font-size: 12.5px; color: var(--muted-2); }
.city .t { margin-top: 6px; font: 900 34px/1 var(--clock-font); letter-spacing: -.03em; font-variant-numeric: tabular-nums; }
.city .t small { font-size: 14px; font-weight: 800; color: var(--accent); margin-left: 3px; letter-spacing: 0; }
.city .rel { margin-top: 5px; font-size: 12.5px; color: var(--muted); }
.city .x { position: absolute; top: 10px; right: 10px; width: 30px; height: 30px; border-radius: 50%; border: 0; background: transparent; color: var(--muted-2); cursor: pointer; display: grid; place-items: center; opacity: 0; transition: opacity .15s; }
.city:hover .x, .city .x:focus-visible { opacity: 1; }
.city .x:hover { background: var(--chip); color: var(--danger); }
.city.night { background: linear-gradient(160deg, #101A33, #16264A); color: #EEF3FF; }
.city.night .country, .city.night .rel { color: #9FB0D3; }
.city-search { max-height: 360px; overflow: auto; display: flex; flex-direction: column; gap: 4px; margin-top: 12px; }
.city-search button { display: flex; justify-content: space-between; gap: 10px; padding: 11px 14px; border-radius: 12px; border: 0; background: transparent; text-align: left; cursor: pointer; font-size: 14.5px; }
.city-search button:hover, .city-search button:focus-visible { background: var(--chip); }
.city-search button span { color: var(--muted); font-size: 13px; }

.cd-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 16px; }
.cd { position: relative; display: block; padding: 22px 22px 20px; border-radius: 22px; background: var(--card); box-shadow: var(--shadow-sm); text-decoration: none; overflow: hidden; }
.cd::before { content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 5px; background: var(--c, var(--accent)); }
.cd .ttl { font-size: 16.5px; font-weight: 800; padding-right: 30px; }
.cd .when { margin-top: 3px; font-size: 13px; color: var(--muted); }
.cd .left { margin-top: 14px; display: flex; align-items: baseline; gap: 10px; font-variant-numeric: tabular-nums; }
.cd .left .n { font: 900 46px/1 var(--clock-font); letter-spacing: -.04em; }
.cd .left .u { font-size: 14px; font-weight: 700; color: var(--muted); }
.cd .left .hms { margin-left: auto; font-weight: 800; color: var(--muted); font-size: 15px; }
.cd .x { position: absolute; top: 12px; right: 12px; width: 30px; height: 30px; border-radius: 50%; border: 0; background: transparent; color: var(--muted-2); cursor: pointer; display: grid; place-items: center; }
.cd .x:hover { background: var(--chip); color: var(--danger); }
.cd.past { opacity: .62; }
.c-blue { --c: #2563EB; } .c-emerald { --c: #059669; } .c-violet { --c: #7C3AED; } .c-rose { --c: #E11D48; } .c-amber { --c: #D97706; } .c-slate { --c: #334155; }

.cd-show { min-height: 560px; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; gap: 10px; padding: 50px 30px; }
.cd-show h1 { margin: 6px 0 0; font-size: clamp(40px, 6vw, 84px); font-weight: 900; letter-spacing: -.04em; line-height: 1.02; }
.cd-show .clk { margin: 34px 0 16px; }
.cd-show .done { font-size: 30px; font-weight: 900; color: var(--accent); }

.footer { margin-top: 34px; display: flex; flex-wrap: wrap; justify-content: center; gap: 10px; font-size: 13px; font-weight: 600; color: var(--muted-2); }
.footer a { color: var(--muted); text-decoration: none; }
.footer a:hover { color: var(--accent); }

.center-wrap { min-height: 100vh; display: grid; place-items: center; padding: 20px; }

/* ==========================================================================
   Responsive
   ========================================================================== */
@media (max-width: 1520px) {
  .topbar { grid-template-columns: minmax(0, 1fr) auto; row-gap: 18px; }
  .topbar .pill { grid-column: 1 / -1; grid-row: 2; justify-self: center; overflow-x: auto; max-width: 100%; }
}
@media (max-width: 1180px) {
  .topbar .pill { justify-self: start; }
  .split { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 760px) {
  .shell { padding: 16px 14px 30px; }
  .card { padding: 22px; border-radius: 22px; }
  .brand-title { font-size: 21px; }
  .logo-tile { width: 46px; height: 46px; border-radius: 14px; }
  .logo-mark { width: 46px; height: 46px; border-radius: 11px; }
  .topbar .mini-clock { display: none; }
  .mini-clock .d { display: none; }
  .big-time { font-size: 19vw; }
  .sw-time { font-size: 17vw; }
  .hero { min-height: 0; padding: 34px 18px; }
  .hero .btn-row .btn-lg { min-height: 46px; padding: 0 18px; font-size: 15px; }
  .readout { font-size: 13.5px; }
  .preset-grid { grid-template-columns: repeat(auto-fill, minmax(92px, 1fr)); }
  .cd-show h1 { font-size: 34px; }
  .clk, .timer-flip .clk, .flip-page .clk { --flip-size: 54px; }
  .flip-page { min-height: 0; padding: 34px 16px; }
  .timer-card { padding: 22px 16px 26px; }
  .clk .grp { gap: 8px; }
  .form-grid, .settings-grid { grid-template-columns: 1fr; }
  .time-hero { grid-template-columns: 1fr; padding: 28px; }
}

/* Full screen: hide chrome, let the clock breathe */
.is-fullscreen .topbar .pill, .is-fullscreen .footer { display: none; }

.cd-show .clk { --flip-size: clamp(40px, 9.6vw, 104px); }
.cd-show .clk .grp { gap: 10px; }
.brand { min-width: 0; }

/* Wordmark "ClockElla" beside the logo: the letters drop in one by one on the clock's tick */
.wordmark { display: inline-flex; align-items: baseline; padding-top: .12em; font-size: 31px; font-weight: 900; letter-spacing: -.03em; line-height: 1.1; color: var(--ink); white-space: nowrap; }
.wordmark .wl { display: inline-block; }
/* only on the first page of a visit, and again when the mouse comes over the logo */
.wm-first .wordmark .wl, .wordmark.wm-play .wl { animation: wm-tick .42s cubic-bezier(.2, .9, .3, 1.3) both; animation-delay: calc(var(--i) * 125ms + 120ms); }
.wordmark.wm-play .wl { animation-delay: calc(var(--i) * 70ms); }
.wordmark .wl-e { color: var(--accent); }
[data-theme="dark"] .wordmark .wl-e { color: color-mix(in srgb, var(--accent) 62%, #ffffff); }
@keyframes wm-tick {
  0% { opacity: 0; transform: translateY(-.7em) rotate(-14deg); }
  55% { opacity: 1; transform: translateY(.06em) rotate(4deg); }
  100% { opacity: 1; transform: none; }
}
@media (max-width: 760px) { .wordmark { font-size: 25px; } }
@media (max-width: 430px) { .brand { gap: 10px; } .logo-mark { width: 40px; height: 40px; border-radius: 10px; } .wordmark { font-size: 21px; } }
@media (max-width: 370px) { .wordmark { font-size: 19px; } .logo-mark { width: 36px; height: 36px; } .top-right [data-fullscreen] { display: none; } }
@media (max-width: 340px) { .wordmark { font-size: 16px; } .logo-mark { width: 32px; height: 32px; border-radius: 9px; } .brand { gap: 8px; } }
@media (prefers-reduced-motion: reduce) { .wordmark .wl, .wm-first .wordmark .wl, .wordmark.wm-play .wl { animation: none; } }
.date-line { font-size: 22px; font-weight: 500; color: var(--muted); }

/* ==========================================================================
   Analog clock (watch dial)
   ========================================================================== */
.aclock {
  display: block; width: 100%; aspect-ratio: 1; position: relative;
  --bz1: #FFFFFF; --bz2: #C3CBD7; --bz3: #F3F5F8; --bz4: #8F99A8; --bz5: #E4E8EE;
  --dial-1: #FFFFFF; --dial-2: #E3E9F2;
  --tick: #8E99AB; --index: #0B1324; --num: #0B1324; --lume: #FFFFFF;
  --hand-a: #3A4868; --hand-b: #0B1324; --sec: var(--accent);
  --label: #5A6780; --win-bg: #FFFFFF; --win-fg: #0B1324;
  filter: drop-shadow(0 22px 34px rgba(15, 23, 42, .20)) drop-shadow(0 4px 8px rgba(15, 23, 42, .10));
}
.aclock svg { display: block; width: 100%; height: 100%; overflow: visible; }
.aclock .trk { fill: none; stroke: var(--tick); stroke-width: 1; opacity: .75; }
.aclock .mtk { stroke: var(--tick); stroke-width: 1.7; stroke-linecap: round; }
.aclock .idx { fill: var(--index); }
.aclock .lume { fill: var(--lume); opacity: .9; }
.aclock .num { fill: var(--num); font: 700 28px Inter, system-ui, sans-serif; letter-spacing: -.02em; }
.aclock.roman .num { font: 600 25px 'Times New Roman', Georgia, serif; letter-spacing: .02em; }
.aclock .brand-t { fill: var(--label); font: 800 13px Inter, system-ui, sans-serif; letter-spacing: .34em; text-transform: uppercase; }
.aclock .lbl-t { fill: var(--label); font: 600 10.5px Inter, system-ui, sans-serif; letter-spacing: .2em; opacity: .85; text-transform: uppercase; }
.aclock .win { fill: var(--win-bg); stroke: var(--tick); stroke-width: 1.2; }
.aclock .win-t { fill: var(--win-fg); font: 800 13.5px Inter, system-ui, sans-serif; letter-spacing: .08em; }
.aclock .ha { fill: var(--hand-a); }
.aclock .hb { fill: var(--hand-b); }
.aclock .sec { stroke: var(--sec); stroke-width: 2.4; stroke-linecap: round; }
.aclock .secw, .aclock .secc { fill: var(--sec); }
.aclock .pin { fill: var(--bz3); }
.aclock.mini { filter: drop-shadow(0 8px 14px rgba(15, 23, 42, .22)); }
.aclock.mini .sec { stroke-width: 4; }

[data-theme="dark"] .aclock, .city.night .aclock {
  --bz1: #6A7486; --bz2: #262E3E; --bz3: #8A94A5; --bz4: #161B27; --bz5: #4C5566;
  --dial-1: #1B2742; --dial-2: #080D1A;
  --tick: #50607E; --index: #EEF3FB; --num: #EEF3FB; --lume: #9BE7C4;
  --hand-a: #FFFFFF; --hand-b: #C7D2E4;
  --label: #8FA0BF; --win-bg: #0A1122; --win-fg: #EEF3FB;
  filter: drop-shadow(0 22px 40px rgba(0, 0, 0, .55));
}

/* ==========================================================================
   Word clock — NINE | TWENTY ONE
   ========================================================================== */
.wordclock { display: flex; flex-direction: column; align-items: center; gap: 22px; text-align: center; max-width: 100%; }
.wc-line {
  display: flex; align-items: center; justify-content: center; gap: .3em;
  font: 900 clamp(40px, 6vw, 112px)/1 Inter, var(--font); letter-spacing: -.035em; white-space: nowrap;
}
.wc-h { color: var(--ink); font-weight: 900; display: inline-block; }
.wc-m { color: var(--ink-2); font-weight: 300; letter-spacing: -.025em; display: inline-block; }
.wc-bar { flex: none; width: .075em; height: .86em; border-radius: 99px; background: linear-gradient(180deg, var(--accent), rgba(var(--glow), .35)); }
.wc-s { position: relative; flex: none; align-self: flex-start; width: .5em; height: .5em; margin: .04em 0 0 .08em; line-height: 0; }
.wc-s svg { display: block; width: 100%; height: 100%; transform: rotate(-90deg); }
.wc-s .bg { fill: none; stroke: var(--line-2); stroke-width: 3; }
.wc-s .fg { fill: none; stroke: var(--accent); stroke-width: 3; stroke-linecap: round; transition: stroke-dasharray .35s ease; }
.wc-s b { position: absolute; inset: 0; display: grid; place-items: center; line-height: 1; font-size: .19em; font-weight: 800; letter-spacing: 0; color: var(--accent); font-variant-numeric: tabular-nums; }
.wc-sub { font-size: 14px; font-weight: 800; letter-spacing: .26em; text-transform: uppercase; color: var(--muted); }
.wc-anim { animation: wc-in .55s cubic-bezier(.2, .8, .2, 1); }
@keyframes wc-in { from { opacity: 0; transform: translateY(.16em); filter: blur(8px); } }
@media (prefers-reduced-motion: reduce) { .wc-anim { animation: none; } }

/* ==========================================================================
   Clock page (Flip / Analog / Words / Digital)
   ========================================================================== */
.face-page { gap: 26px; }
.face-stage { width: 100%; display: grid; place-items: center; min-height: 380px; }
.face-stage .face { width: 100%; display: flex; justify-content: center; }
.face-stage .face[hidden] { display: none; }
.face-analog .aclock { width: min(440px, 76vw); }
.face-digital .big-time { margin: 0; }
.is-fullscreen .face-analog .aclock { width: min(72vh, 86vw); }
.is-fullscreen .wc-line { font-size: clamp(48px, 7.4vw, 160px); }
.hero-analog .aclock { width: min(340px, 72vw); margin: 18px auto 10px; }
.hero-words { margin: 30px 0 18px; width: 100%; }
.hero-words .wc-line { font-size: clamp(34px, 4.6vw, 78px); }
.time-hero .aclock { width: 300px; }
.city .aclock { width: 84px; flex: none; }

@media (max-width: 760px) {
  .wc-line { flex-direction: column; gap: .14em; white-space: normal; font-size: 14vw; }
  .wc-bar { width: 1.1em; height: .07em; }
  .wc-s { align-self: center; width: .9em; height: .9em; margin: .1em 0 0; }
  .wc-sub { font-size: 12px; letter-spacing: .18em; }
  .face-stage { min-height: 0; }
  .time-hero .aclock { width: 220px; justify-self: center; }
}

/* ==========================================================================
   Live sky: theme toggle, sunrise / sunset overlay, sun & moon card
   ========================================================================== */
.sky-toggle {
  position: relative; flex: none; width: 74px; height: 40px; padding: 0; border-radius: 999px; overflow: hidden; cursor: pointer;
  border: 1px solid rgba(255, 255, 255, .55); background: #8EC2F4;
  box-shadow: var(--shadow-sm), 0 0 0 1px var(--line), inset 0 1px 0 rgba(255, 255, 255, .35);
  transition: transform .15s, box-shadow .2s;
}
.sky-toggle:hover { transform: translateY(-1px); box-shadow: 0 10px 22px -10px rgba(var(--glow), .7), 0 0 0 1px var(--accent); }
.sky-toggle canvas { display: block; width: 100%; height: 100%; }
[data-theme="dark"] .sky-toggle { border-color: rgba(255, 255, 255, .14); background: #0B1226; }

/* Auto theme: warm light around sunrise / sunset, violet dusk */
html.sky-golden body {
  background:
    radial-gradient(900px 520px at 92% -8%, rgba(255, 158, 84, .24), transparent 62%),
    radial-gradient(700px 420px at -6% 108%, rgba(255, 118, 92, .10), transparent 60%),
    linear-gradient(180deg, #FCF4EC, #F2ECF3);
  background-attachment: fixed;
}
html.sky-golden .glow::before { background: radial-gradient(closest-side, rgba(255, 150, 80, .20), rgba(var(--glow), .08) 46%, rgba(var(--glow), 0) 74%); }
html.sky-dusk body {
  background:
    radial-gradient(900px 520px at 92% -8%, rgba(168, 85, 247, .18), transparent 62%),
    radial-gradient(700px 420px at -6% 108%, rgba(236, 72, 153, .08), transparent 60%),
    linear-gradient(180deg, #0F0C22, #070C18);
  background-attachment: fixed;
}

/* Sun & moon: a 24-hour sun dial, the sun's path across the sky and the moon phase */
.sun-card { padding: 22px 24px 24px; }
.sun-card > .sec { margin-bottom: 18px; }
.sec .ico.sun { color: #F59E0B; }
.sun-card .note b { color: var(--ink); }
.sun-card .note span { font-variant-numeric: tabular-nums; }
.sun-card .sec .btn svg { width: 15px; height: 15px; }
.sun-body { display: grid; grid-template-columns: minmax(300px, 410px) minmax(0, 1fr); gap: 28px; align-items: center; }
.sun-dial { position: relative; width: 100%; max-width: 410px; aspect-ratio: 1; margin: 0 auto; }
.dial-svg { display: block; width: 100%; height: 100%; overflow: visible; }
.dial-face { fill: var(--card-2); stroke: var(--line-2); stroke-width: 1; }
.dial-seg { fill: none; stroke-width: 30; }
.dial-edge { fill: none; stroke: var(--line); stroke-width: 1; opacity: .7; }
.dial-tick { stroke: var(--muted-2); stroke-width: 1.3; stroke-linecap: round; }
.dial-tick.major { stroke: var(--ink-2); stroke-width: 2.2; }
.dial-num { fill: var(--muted); font: 800 12px var(--font, Inter), sans-serif; letter-spacing: .04em; text-anchor: middle; dominant-baseline: central; }
.dial-hz { stroke: #fff; stroke-width: 2.6; stroke-linecap: round; filter: drop-shadow(0 0 2px rgba(0, 0, 0, .35)); }
.dial-noon { fill: #F59E0B; }
.dial-moon-track { fill: none; stroke: var(--line-2); stroke-width: 4; }
.dial-moon { fill: none; stroke: #AEB8D0; stroke-width: 4; stroke-linecap: round; }
[data-theme="dark"] .dial-moon { stroke: #DCE3F5; }
.dial-hand { stroke: var(--ink); stroke-width: 2.4; stroke-linecap: round; }
.dial-sun { stroke: #fff; stroke-width: 3.2; filter: drop-shadow(0 2px 6px rgba(0, 0, 0, .3)); transition: fill 1s; }
.dial-halo { transition: fill 1s, opacity 1s; }
.dial-center { position: absolute; inset: 27%; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; pointer-events: none; }
.dial-center .ph { font-size: 11px; font-weight: 800; letter-spacing: .18em; text-transform: uppercase; color: var(--muted); }
.dial-center .dial-cd { margin-top: 6px; font: 900 40px/1.04 var(--clock-font); letter-spacing: -.035em; font-variant-numeric: tabular-nums; color: var(--ink); white-space: nowrap; }
.dial-center .lbl { margin-top: 4px; font-size: 13px; font-weight: 700; color: var(--ink-2); }
.dial-center .alt { margin-top: 8px; font-size: 12px; font-weight: 700; color: var(--muted-2); font-variant-numeric: tabular-nums; }
.sun-side { display: grid; gap: 14px; min-width: 0; }
.sun-minis { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.mini-panel { display: grid; grid-template-columns: 116px minmax(0, 1fr); gap: 16px; align-items: center; padding: 14px 18px 14px 14px; border-radius: 20px; background: var(--card-2); box-shadow: inset 0 0 0 1px var(--line-2); }
.mini-panel svg { display: block; width: 116px; height: 116px; overflow: visible; }
.mini-panel .k { display: block; font-size: 11px; font-weight: 800; letter-spacing: .16em; text-transform: uppercase; color: var(--muted); }
.mini-panel .v { display: block; margin-top: 5px; font-size: 19px; font-weight: 900; letter-spacing: -.01em; }
.mini-panel .s { display: block; margin-top: 4px; font-size: 12.5px; line-height: 1.5; color: var(--muted-2); font-variant-numeric: tabular-nums; }
.sp-rim { fill: var(--card); stroke: var(--line); stroke-width: 1.2; }
.sp-ring { fill: none; stroke: var(--line-2); stroke-width: 1; stroke-dasharray: 2 3; }
.sp-txt { fill: var(--muted); font: 800 11px var(--font, Inter), sans-serif; text-anchor: middle; dominant-baseline: central; }
.sp-txt.n { fill: #E5484D; }
.sp-ray { stroke: var(--muted-2); stroke-width: 1; stroke-dasharray: 2 3; opacity: .7; }
.sp-path { fill: none; stroke: #F59E0B; stroke-width: 3; stroke-linecap: round; stroke-linejoin: round; opacity: .9; }
.sp-rise { fill: #F59E0B; } .sp-set { fill: #E5487A; }
.sp-sun { fill: #FFD24D; stroke: #fff; stroke-width: 2.4; filter: drop-shadow(0 1px 4px rgba(245, 158, 11, .6)); }
.sp-sun.down { fill: var(--muted-2); filter: none; }
.sp-moon { fill: #CBD3E6; stroke: #fff; stroke-width: 1.6; }
.moon-glow { fill: #F5EFD8; filter: blur(10px); }
[data-theme="dark"] .moon-glow { fill: #FFF6D8; }
.moon-dark { fill: #2A3250; }
[data-theme="dark"] .moon-dark { fill: #1A2138; }
.moon-maria { fill: #B9B4A2; opacity: .45; }
.moon-rim { fill: none; stroke: rgba(255, 255, 255, .5); stroke-width: 1; }
.sun-facts { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
.dial-temp { fill: var(--ink-2); font: 800 11.5px var(--font, Inter), sans-serif; text-anchor: middle; dominant-baseline: central; font-variant-numeric: tabular-nums; opacity: .8; }
.dial-rain { fill: none; stroke: #3B82F6; stroke-width: 5; stroke-linecap: round; }
/* namaz times */
.namaz-card { padding: 22px 24px; }
.namaz-card > .sec { margin-bottom: 16px; flex-wrap: wrap; }
.sec .ico.mosque { color: #10B981; }
.ur-title { margin-left: 8px; font-weight: 800; font-size: .8em; color: var(--muted); }
.namaz-next { font-size: 13.5px; color: var(--muted); white-space: nowrap; }
.namaz-next b { color: var(--ink); }
.namaz-next .nz-cd { color: var(--accent-ink); font-variant-numeric: tabular-nums; }
.namaz-times { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 10px; }
.nz { display: grid; gap: 2px; justify-items: center; padding: 14px 6px; border-radius: 18px; background: var(--card-2); box-shadow: inset 0 0 0 1px var(--line-2); text-align: center; }
.nz .en { font-size: 12px; font-weight: 800; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); }
.nz .ur { font-size: 13px; color: var(--muted-2); }
.nz b { margin-top: 4px; font: 900 19px/1.1 var(--clock-font); letter-spacing: -.02em; font-variant-numeric: tabular-nums; white-space: nowrap; }
.nz.sun { opacity: .7; }
.nz.next { background: var(--accent); box-shadow: 0 10px 24px -12px var(--accent); }
.nz.next .en, .nz.next .ur, .nz.next b { color: #fff; }
.namaz-foot { display: flex; flex-wrap: wrap; align-items: center; gap: 12px 18px; margin-top: 14px; font-size: 13px; color: var(--muted); }
.namaz-foot label { display: inline-flex; align-items: center; gap: 8px; font-weight: 700; max-width: 100%; }
.namaz-foot select { min-width: 0; max-width: 100%; }
.select-sm { padding: 6px 30px 6px 10px; font-size: 13px; min-height: 0; width: auto; }
.namaz-app { margin-left: auto; display: inline-flex; align-items: center; gap: 6px; font-weight: 700; color: var(--accent-ink); text-decoration: none; }
.namaz-app svg { width: 16px; height: 16px; }
.namaz-app.muted { color: var(--muted-2); font-weight: 600; }
@media (max-width: 900px) { .namaz-times { grid-template-columns: repeat(3, minmax(0, 1fr)); } .namaz-app { margin-left: 0; } }

/* weather now + next 24 hours */
.wx-panel { position: relative; display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 18px; align-items: center; padding: 16px 18px 22px; border-radius: 20px; background: var(--card-2); box-shadow: inset 0 0 0 1px var(--line-2); }
.wx-panel[hidden] { display: none; }
.wx-now { display: grid; grid-template-columns: 58px auto; grid-template-rows: auto auto; column-gap: 12px; align-items: center; min-width: 0; }
.wx-ic svg { display: block; width: 58px; height: 58px; }
.wx-main b { display: block; font: 900 34px/1 var(--clock-font); letter-spacing: -.03em; font-variant-numeric: tabular-nums; }
.wx-main span { display: block; margin-top: 3px; font-size: 13.5px; font-weight: 700; color: var(--ink-2); white-space: nowrap; }
.wx-meta { grid-column: 1 / -1; margin-top: 10px; display: grid; gap: 2px; font-size: 12.5px; color: var(--muted-2); font-variant-numeric: tabular-nums; }
.wx-meta .wet { color: #2563EB; font-weight: 700; }
[data-theme="dark"] .wx-meta .wet { color: #7AB0FF; }
.wx-hours { display: grid; grid-template-columns: repeat(8, minmax(52px, 1fr)); gap: 4px; min-width: 0; overflow-x: auto; scrollbar-width: none; }
.wx-h { display: grid; justify-items: center; gap: 4px; padding: 8px 2px; border-radius: 14px; text-align: center; }
.wx-h:first-child { background: var(--card); box-shadow: inset 0 0 0 1px var(--line-2); }
.wx-h .tm { font-size: 11px; font-weight: 800; letter-spacing: .04em; color: var(--muted); white-space: nowrap; }
.wx-h svg { width: 28px; height: 28px; display: block; }
.wx-h b { font-size: 15px; font-weight: 900; font-variant-numeric: tabular-nums; }
.wx-h .pop { font-size: 11px; font-weight: 700; color: var(--muted-2); min-height: 13px; }
.wx-h .pop.hi { color: #2563EB; }
[data-theme="dark"] .wx-h .pop.hi { color: #7AB0FF; }
.wx-credit { position: absolute; right: 14px; bottom: 6px; font-size: 10.5px; color: var(--muted-2); text-decoration: none; opacity: .75; }
.wx-credit:hover { text-decoration: underline; opacity: 1; }
.fact { padding: 13px 15px; border-radius: 16px; background: var(--card-2); box-shadow: inset 0 0 0 1px var(--line-2); }
.fact span { display: block; font-size: 11.5px; font-weight: 800; letter-spacing: .14em; text-transform: uppercase; color: var(--muted); }
.fact b { display: block; margin-top: 5px; font-size: 19px; font-weight: 900; letter-spacing: -.01em; font-variant-numeric: tabular-nums; }
.fact small { display: block; margin-top: 2px; font-size: 12.5px; color: var(--muted-2); }
.city .sun { margin-top: 4px; font-size: 11.5px; color: var(--muted); font-variant-numeric: tabular-nums; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.city.night .sun { color: #9FB0D3; }

@media (max-width: 760px) {
  .sky-toggle { width: 60px; height: 34px; }
}
@media (max-width: 1180px) {
  .sun-body { grid-template-columns: minmax(0, 1fr); }
  .sun-dial { max-width: 380px; }
}
@media (max-width: 900px) {
  .wx-panel { grid-template-columns: minmax(0, 1fr); }
  .wx-hours { grid-template-columns: repeat(8, 56px); }
}
@media (max-width: 640px) {
  .sun-card { padding: 18px 16px 18px; }
  .sun-minis { grid-template-columns: minmax(0, 1fr); }
  .sun-facts { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .dial-center .dial-cd { font-size: 32px; }
}
/* header toggle: a small badge when the theme is held for now (clock) or fixed in Settings (lock) */
.sky-toggle::after {
  content: ''; position: absolute; right: 4px; top: 4px; width: 15px; height: 15px; border-radius: 50%;
  background: var(--accent) center / 9px no-repeat; box-shadow: 0 0 0 1.5px rgba(255, 255, 255, .95), 0 2px 6px rgba(0, 0, 0, .3);
  opacity: 0; transform: scale(.4); transition: opacity .25s, transform .25s; pointer-events: none;
}
.sky-toggle[data-mode="hold"]::after, .sky-toggle[data-mode="manual"]::after { opacity: 1; transform: none; }
.sky-toggle[data-mode="hold"]::after { background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='white' stroke-width='3.4' stroke-linecap='round'%3E%3Cpath d='M12 5v7l4.5 2.5'/%3E%3C/svg%3E"); }
.sky-toggle[data-mode="manual"]::after { background-color: #475569; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='white' stroke-width='2.8' stroke-linecap='round'%3E%3Crect x='5' y='11' width='14' height='10' rx='2'/%3E%3Cpath d='M8 11V8a4 4 0 0 1 8 0v3'/%3E%3C/svg%3E"); }
.hold-note { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 4px; color: var(--accent-ink); font-weight: 700; }
.hold-note[hidden] { display: none; }

/* ==========================================================================
   Live sky behind the page (sunrise / sunset happen here)
   ========================================================================== */
.sky-bg { position: fixed; left: 0; top: 0; width: 100vw; height: 100vh; z-index: -1; display: block; pointer-events: none; }
html.has-sky { --glass: rgba(255, 255, 255, .66); --glass-line: rgba(255, 255, 255, .75); --card-glass: rgba(255, 255, 255, .80); }
html.has-sky[data-theme="dark"] { --glass: rgba(8, 13, 28, .56); --glass-line: rgba(255, 255, 255, .08); --card-glass: rgba(12, 19, 36, .74); }
html.has-sky body { background: transparent; }
html.has-sky .card, html.has-sky .city:not(.night), html.has-sky .cd { background: var(--card-glass); }
html.has-sky .topbar, html.has-sky .footer, html.has-sky .sec-glass {
  background: var(--glass); box-shadow: inset 0 1px 0 var(--glass-line), var(--shadow-sm);
}
html.has-sky .topbar { padding: 12px 16px; border-radius: 24px; }
html.has-sky .footer { padding: 12px 18px; border-radius: 18px; }
html.has-sky .sec-glass { padding: 10px 14px; border-radius: 18px; }
@media (hover: hover) and (pointer: fine) {
  html.has-sky .card, html.has-sky .city, html.has-sky .cd, html.has-sky .topbar, html.has-sky .footer, html.has-sky .sec-glass {
    -webkit-backdrop-filter: blur(18px) saturate(1.25); backdrop-filter: blur(18px) saturate(1.25);
  }
}
@media (max-width: 760px) {
  html.has-sky { --card-glass: rgba(255, 255, 255, .93); }
  html.has-sky[data-theme="dark"] { --card-glass: rgba(12, 19, 36, .9); }
}

/* the page's colours glide over while the sun goes down / comes up */
html.theme-fade, html.theme-fade *, html.theme-fade *::before, html.theme-fade *::after {
  transition: background-color 1.1s ease, color 1.1s ease, border-color 1.1s ease, box-shadow 1.1s ease, fill 1.1s ease !important;
}

.sky-caption {
  position: fixed; left: 24px; bottom: 24px; z-index: 70; display: flex; align-items: center; gap: 12px;
  padding: 12px 20px 12px 14px; border-radius: 18px; color: #fff; pointer-events: none;
  background: rgba(8, 12, 26, .58); box-shadow: 0 18px 40px -18px rgba(0, 0, 0, .55), inset 0 1px 0 rgba(255, 255, 255, .12);
  -webkit-backdrop-filter: blur(12px); backdrop-filter: blur(12px);
  opacity: 0; transform: translateY(12px); transition: opacity .6s ease, transform .6s ease;
}
.sky-caption.show { opacity: 1; transform: none; }
.sky-caption i { width: 34px; height: 34px; border-radius: 50%; flex: none; }
.sky-caption i.set { background: radial-gradient(circle at 50% 70%, #FFD27A, #FF7A33 45%, #B6617A 75%); box-shadow: 0 0 18px rgba(255, 122, 51, .6); }
.sky-caption i.rise { background: radial-gradient(circle at 50% 70%, #FFF1C9, #FFA94D 45%, #F0855A 75%); box-shadow: 0 0 18px rgba(255, 169, 77, .6); }
.sky-caption b { display: block; font-size: 18px; font-weight: 900; letter-spacing: -.01em; }
.sky-caption span { display: block; margin-top: 2px; font-size: 11.5px; font-weight: 800; letter-spacing: .18em; text-transform: uppercase; opacity: .85; }
