:root {
  --nav-h: 40px;
  --root: min(24vw, 42vh);
  --fit: 1;
  --base: calc(var(--root) * var(--fit));
  --bg: #f5f5f5;
  --color: rgba(0, 0, 0, 0.72);
  --body-bg: #fff;
  --body-color: #212529;
  --card: #222;
  --card-ink: #d9d9d9;
  --line: var(--bg);
  --accent: #f5a623;
  --accent-ink: #1b1b1b;
  --radius: 0.45rem;
  --btn-bg: #fff;
  --menu-bg: #fff;
  color-scheme: light;
  font-family: system-ui, -apple-system, "Segoe UI", "Helvetica Neue", Arial, sans-serif;
}

html.dark-mode {
  --bg: #000;
  --color: rgba(255, 255, 255, 0.9);
  --body-bg: #393e46;
  --body-color: #fff;
  --card: #383838;
  --card-ink: whitesmoke;
  --btn-bg: #393e46;
  --menu-bg: #393e46;
  color-scheme: dark;
}

html.theme-flip.hide-seconds {
  --root: min(34vw, 46vh);
}

@media (orientation: landscape) and (max-height: 575px) {
  html.theme-flip.hide-seconds { --root: min(42vw, 62vh); }
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  background: var(--body-bg);
  color: var(--body-color);
  min-height: 100vh;
}
button, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
kbd {
  display: inline-block;
  min-width: 1.4em;
  padding: 0.05em 0.4em;
  border: 1px solid #bbb;
  border-bottom-width: 2px;
  border-radius: 0.3em;
  background: #f7f7f7;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 0.85em;
  text-align: center;
}
html.dark-mode kbd {
  background: #3a3a3a;
  border-color: #555;
}

.topbar {
  height: var(--nav-h);
  display: flex;
  align-items: center;
  padding: 0 0.9rem;
  background: #f8f9fa;
  border-bottom: 1px solid #d3d3d3;
  position: relative;
  z-index: 30;
}
html.dark-mode .topbar {
  background: var(--body-bg);
  border-bottom-color: #a9a9a9;
  color: #fff;
}
.brand { margin: 0; font-size: 0.95rem; font-weight: 650; letter-spacing: -0.01em; }
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

.stage {
  position: relative;
  min-height: calc(100svh - var(--nav-h));
  margin-top: 0;
  background: var(--bg);
  color: var(--color);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}
html.theme-comic { --bg: #f4d2b0; --color: #3c342f; }
html.theme-comic.dark-mode { --bg: #241c18; --color: #f3dccb; }
html.theme-digital { --bg: #cfcfcf; --color: #3a3a3a; }
html.theme-digital.dark-mode { --bg: #141414; --color: #d5d5d5; }
html.theme-led,
html.theme-led.dark-mode { --bg: #000; --color: #ff1c12; }
html.theme-plain.dark-mode { --bg: #000; --color: rgba(255, 255, 255, 0.9); }

.views {
  width: 100%;
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 1.5rem 1rem 4.5rem;
}
.view { display: none; }
html.theme-flip .view-flip,
html.theme-plain .view-text,
html.theme-comic .view-text,
html.theme-digital .view-seg,
html.theme-led .view-seg,
html.theme-analog .view-analog,
html.theme-standby .view-standby { display: flex; }

.loading .clock,
.loading .view-text,
.loading .view-seg,
.loading .view-analog,
.loading .view-standby { opacity: 0.3; }

.spinner {
  display: none;
  position: absolute;
  left: 50%;
  top: 46%;
  width: 40px;
  height: 40px;
  margin: -20px 0 0 -20px;
  z-index: 5;
}
.loading .spinner { display: block; }
.spinner span {
  position: absolute;
  left: 18.5px;
  top: 0;
  width: 3px;
  height: 40px;
  transform-origin: 50% 20px;
}
.spinner span::before {
  content: "";
  display: block;
  width: 5px;
  height: 5px;
  margin-left: -1px;
  border-radius: 50%;
  background: #333;
  animation: fade-dot 1.2s infinite ease-in-out both;
}
html.dark-mode .spinner span::before { background: #fff; }
.spinner span { transform: rotate(calc(var(--i) * 30deg)); }
.spinner span::before { animation-delay: calc(var(--i) * 0.1s - 1.2s); }
@keyframes fade-dot {
  0%, 39%, 100% { opacity: 0; }
  40% { opacity: 1; }
}

.fs-exit {
  display: none;
  position: absolute;
  top: max(0.8rem, env(safe-area-inset-top));
  right: max(0.8rem, env(safe-area-inset-right));
  z-index: 40;
  width: 2.4rem;
  height: 2.4rem;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: var(--color);
  padding: 0.35rem;
}
html.is-fullscreen .fs-exit { display: block; }
.fs-exit svg { width: 100%; height: 100%; }

.portrait-hint {
  display: none;
  position: absolute;
  top: 0.6rem;
  left: 0.6rem;
  right: 0.6rem;
  z-index: 25;
  margin: 0;
  padding: 0.55rem 0.8rem;
  text-align: center;
  color: #fff;
  background: #6495ed;
  border-radius: 0.5rem;
  font-size: 0.95rem;
}
.portrait-hint.show { display: block; }

.clock {
  display: none;
  align-items: center;
  justify-content: center;
  direction: ltr;
  user-select: none;
}
html.theme-flip .clock { display: flex; }
.hm {
  position: relative;
  display: flex;
  align-items: center;
}
.clock .card,
.clock .sep,
.clock .edge {
  font-family: Teko, "Arial Narrow", sans-serif;
  font-weight: 500;
  font-size: var(--base);
  height: 1em;
  line-height: 0.78;
}
.clock .sep {
  font-size: calc(var(--base) / 1.35);
  width: 0.22em;
  visibility: hidden;
  overflow: hidden;
}
.card {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  min-width: 1.08em;
  padding: 0.07em 0.03em 0;
  background: var(--card);
  color: var(--card-ink);
  border-radius: 0.1em;
  perspective: 5em;
}
.card i {
  font-style: normal;
  flex: 1 1 0;
  min-width: 0;
  text-align: center;
  transform: translateY(0.04em);
}
.card::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  top: 50%;
  height: 0.012em;
  margin-top: -0.006em;
  background: var(--line);
  z-index: 6;
  pointer-events: none;
}
.card .center { position: absolute; width: 0; height: 0; overflow: visible; }
.card.flap {
  position: absolute;
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
  margin: 0;
  display: flex;
  backface-visibility: hidden;
  z-index: 2;
  pointer-events: none;
}
.card.flap::after { display: none; }
.card.flap.top { clip-path: inset(0 0 50% 0); transform-origin: center bottom; }
.card.flap.bottom { clip-path: inset(50% 0 0 0); transform-origin: center top; }
.card.flap::before {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background: #000;
  opacity: 0;
  z-index: 5;
  pointer-events: none;
}
.card.flap.out { animation: flap-out 0.25s ease-in both; }
.card.flap.in { animation: flap-in 0.25s 0.25s ease-out both; z-index: 3; }
.card.flap.bottom:not(.in) { z-index: 2; }
.card.flap.out::before { animation: flap-dim 0.25s ease-in both; }
.card.flap.bottom:not(.in)::before { animation: flap-dim 0.5s ease-in both; }
@keyframes flap-dim { to { opacity: 0.5; } }
@keyframes flap-out { to { transform: rotateX(-90deg); } }
@keyframes flap-in { from { transform: rotateX(90deg); } }
@media (prefers-reduced-motion: reduce) {
  .card.flap { animation: none !important; display: none !important; }
}

.h12, html.ampm-mode .h24 { display: none; }
html.ampm-mode .h12 { display: flex; }
html.hide-seconds .sec-sep,
html.hide-seconds .card.ss { display: none; }
.edge { position: relative; width: 0; }
.date-str, .clock .ampm {
  display: none;
  position: absolute;
  bottom: 0;
  font-family: system-ui, sans-serif;
  font-size: clamp(15px, calc(var(--base) / 6.5), 32px);
  font-weight: 500;
  line-height: 1;
  white-space: nowrap;
  color: var(--color);
}
html.show-date-mode .date-str {
  display: block;
  right: 0;
  transform: translate(100%, 145%);
}
html.ampm-mode .clock .ampm {
  display: block;
  left: 0;
  transform: translate(-100%, 145%);
}
.h12-txt, html.ampm-mode .h24-txt { display: none; }
html.ampm-mode .h12-txt { display: inline; }

.minute-line {
  display: none;
  position: absolute;
  left: 0;
  right: 0;
  top: 100%;
  height: max(3px, calc(var(--base) * 0.012));
  margin-top: calc(var(--base) * 0.035);
  border-radius: 1em;
  background: rgba(90, 90, 90, 0.28);
  overflow: hidden;
}
html.theme-flip.hide-seconds .minute-line { display: block; }
.minute-line i {
  display: block;
  height: 100%;
  width: 100%;
  background: rgba(70, 70, 70, 0.78);
  transform: scaleX(0);
  transform-origin: left center;
}

.view-text, .view-seg, .view-analog {
  flex-direction: column;
  align-items: center;
  justify-content: center;
  user-select: none;
}
.text-row, .seg-time {
  display: flex;
  align-items: flex-end;
  justify-content: center;
}
.text-time, .seg-time {
  font-size: calc(var(--base) * 0.92);
  line-height: 0.85;
  font-weight: 560;
  letter-spacing: -0.04em;
  font-variant-numeric: tabular-nums;
}
html.theme-plain .text-time { font-family: "Helvetica Neue", Helvetica, Arial, sans-serif; color: #3f3f3f; }
html.theme-plain.dark-mode .text-time { color: #eee; }
html.theme-comic .text-time,
html.theme-comic .t-ampm {
  font-family: Jua, "Apple SD Gothic Neo", sans-serif;
  font-weight: 400;
  letter-spacing: -0.03em;
  color: #3a332e;
}
html.theme-comic.dark-mode .text-time,
html.theme-comic.dark-mode .t-ampm { color: #f6e4d4; }
html.theme-comic .t-ampm { font-family: Gaegu, Jua, cursive; transform: rotate(-8deg); }
.t-c { padding: 0 0.04em; }
.t-s-wrap { font-size: 0.62em; letter-spacing: -0.04em; padding-bottom: 0.08em; }
html.hide-seconds .t-s-wrap { display: none; }
html.hide-seconds .text-time,
html.hide-seconds .seg-time { font-size: calc(var(--base) * 1.15); }
.t-ampm {
  font-size: calc(var(--base) * 0.2);
  line-height: 1;
  margin: 0 0 0.12em 0.18em;
  font-weight: 650;
  letter-spacing: 0;
  display: none;
}
html.ampm-mode .t-ampm { display: block; }
html.theme-led .seg-ampm,
html.theme-digital .seg-ampm {
  font-family: "Helvetica Neue", Helvetica, Arial, sans-serif;
  letter-spacing: 0.04em;
}
html.theme-led .seg-ampm { color: #ff1c12; font-style: italic; }
.subdate {
  display: none;
  margin-top: 0.8rem;
  font-size: clamp(0.95rem, 2.2vw, 1.35rem);
  letter-spacing: 0;
  font-weight: 500;
}
html.show-date-mode .subdate { display: block; }

.seg {
  position: relative;
  display: inline-block;
  width: 0.62em;
  height: 1.15em;
  margin: 0 0.045em;
}
.seg i {
  position: absolute;
  background: currentColor;
  opacity: 0.13;
}
html.theme-led .seg i { opacity: 0.1; }
.seg.a > .a, .seg.b > .b, .seg.c > .c, .seg.d > .d,
.seg.e > .e, .seg.f > .f, .seg.g > .g { opacity: 1; }
.seg .a, .seg .d, .seg .g {
  height: 0.075em;
  left: 0.1em;
  right: 0.1em;
  clip-path: polygon(12% 0, 88% 0, 100% 50%, 88% 100%, 12% 100%, 0 50%);
}
.seg .a { top: 0.04em; }
.seg .g { top: 50%; margin-top: -0.037em; }
.seg .d { bottom: 0.04em; }
.seg .b, .seg .c, .seg .e, .seg .f {
  width: 0.075em;
  clip-path: polygon(50% 0, 100% 12%, 100% 88%, 50% 100%, 0 88%, 0 12%);
}
.seg .f, .seg .b { top: 0.09em; height: calc(50% - 0.12em); }
.seg .e, .seg .c { bottom: 0.09em; height: calc(50% - 0.12em); }
.seg .f, .seg .e { left: 0.04em; }
.seg .b, .seg .c { right: 0.04em; }
.seg-colon {
  display: inline-flex;
  flex-direction: column;
  justify-content: space-evenly;
  width: 0.28em;
  height: 0.85em;
  margin-bottom: 0.12em;
  align-self: center;
}
.seg-colon i {
  width: 0.11em;
  height: 0.11em;
  border-radius: 0.03em;
  background: currentColor;
  display: block;
  margin: 0 auto;
}
.seg-time { color: #3a3a3a; align-items: center; }
html.theme-digital.dark-mode .seg-time { color: #dedede; }
html.theme-led .seg-time { color: #ff160c; filter: drop-shadow(0 0 0.04em rgba(255, 20, 10, 0.35)); }
.g-h, .g-m, .g-s { display: inline-flex; }

.face {
  position: relative;
  width: min(46vh, 52vw, 420px);
  aspect-ratio: 1;
  border-radius: 50%;
  background: #fff;
  border: 0.045em solid #161616;
  box-shadow: inset 0 0 0 0.012em rgba(0, 0, 0, 0.2);
  font-size: min(46vh, 52vw, 420px);
}
html.dark-mode .face {
  background: #1b1b1b;
  border-color: #f2f2f2;
  color: #f3f3f3;
}
.standby-face { font-size: min(34vh, 34vw, 320px); width: min(34vh, 34vw, 320px); }
.tick {
  position: absolute;
  left: 50%;
  bottom: 50%;
  width: 0.006em;
  height: 46%;
  margin-left: -0.003em;
  background: linear-gradient(#161616, #161616) top / 100% 0.028em no-repeat;
  transform-origin: bottom center;
}
html.dark-mode .tick { background: linear-gradient(#f2f2f2, #f2f2f2) top / 100% 0.028em no-repeat; }
.tick.major {
  width: 0.01em;
  margin-left: -0.005em;
  background: linear-gradient(#161616, #161616) top / 100% 0.055em no-repeat;
}
html.dark-mode .tick.major { background: linear-gradient(#f2f2f2, #f2f2f2) top / 100% 0.055em no-repeat; }
.num {
  position: absolute;
  font-family: "Times New Roman", Times, serif;
  font-size: 0.075em;
  line-height: 1;
  transform: translate(-50%, -50%);
  font-weight: 650;
}
.hand {
  position: absolute;
  left: 50%;
  bottom: 50%;
  transform-origin: 50% 100%;
  background: #161616;
  border-radius: 1em;
}
html.dark-mode .hand { background: #f4f4f4; }
.hand.hour { width: 0.018em; height: 24%; margin-left: -0.009em; }
.hand.minute { width: 0.012em; height: 34%; margin-left: -0.006em; }
.hand.second {
  width: 0.006em;
  height: 40%;
  margin-left: -0.003em;
  background: #e10600;
}
.standby-face .hand.second,
.standby-face .cap { background: var(--accent); }
html.hide-seconds .hand.second { display: none; }
.cap {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 0.035em;
  height: 0.035em;
  margin: -0.0175em 0 0 -0.0175em;
  border-radius: 50%;
  background: #e10600;
  z-index: 2;
}
html.hide-seconds .cap { background: #161616; }
html.dark-mode.hide-seconds .cap { background: #f4f4f4; }
.analog-meta { margin-top: 1.1rem; text-align: center; }
.analog-date { font-size: clamp(1rem, 2vw, 1.25rem); }
.analog-tz { margin-top: 0.35rem; font-size: 0.95rem; opacity: 0.75; }

.view-standby { width: min(980px, 100%); }
.standby-shell { width: 100%; display: flex; flex-direction: column; align-items: center; gap: 0.9rem; }
.standby-body {
  width: 100%;
  background: #fff;
  color: #222;
  border-radius: 1.1rem;
  box-shadow: 0 8px 28px rgba(0, 0, 0, 0.06);
  display: flex;
  gap: 0.5rem;
  padding: 1.2rem 1.1rem 0.6rem;
  align-items: center;
}
html.dark-mode .standby-body {
  background: #2a2e34;
  color: #f2f2f2;
  box-shadow: none;
}
.standby-panel { flex: 1; min-width: 0; align-self: stretch; display: flex; flex-direction: column; }
.cal-head { display: flex; align-items: center; gap: 0.2rem; justify-content: center; }
.cal-title { min-width: 8ch; text-align: center; font-size: 1.15rem; }
.icon-btn {
  border: 0;
  background: transparent;
  width: 2rem;
  height: 2rem;
  border-radius: 0.4rem;
  font-size: 1.4rem;
  line-height: 1;
}
.icon-btn:hover { background: rgba(0, 0, 0, 0.06); }
html.dark-mode .icon-btn:hover { background: rgba(255, 255, 255, 0.08); }
.cal-today svg { width: 1.05rem; height: 1.05rem; }
.cal-week, .cal-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  text-align: center;
  gap: 0.15rem;
}
.cal-week { margin-top: 0.4rem; font-size: 0.78rem; opacity: 0.55; }
.cal-grid { margin-top: 0.25rem; min-height: 13.5rem; }
.cal-grid button {
  border: 0;
  background: transparent;
  width: 2.15rem;
  height: 2.15rem;
  justify-self: center;
  border-radius: 50%;
  font-size: 0.92rem;
}
.cal-grid button.today {
  background: var(--accent);
  color: var(--accent-ink);
}
.cal-grid button.out { visibility: hidden; }
.panel-date, .panel-notes { display: none; flex: 1; }
html.tab-date .panel-date,
html.tab-notes .panel-notes { display: block; }
html.tab-date .panel-cal,
html.tab-notes .panel-cal,
html.tab-date .cal-head,
html.tab-notes .cal-head { display: none; }
.panel-cal { display: flex; flex-direction: column; flex: 1; }
html.tab-date .panel-cal,
html.tab-notes .panel-cal { display: none; }
.panel-date {
  font-size: clamp(1.4rem, 3vw, 2rem);
  font-weight: 650;
  letter-spacing: -0.03em;
  padding: 1.5rem 0.4rem;
  text-align: center;
}
.panel-notes {
  width: 100%;
  resize: vertical;
  border: 1px solid rgba(0, 0, 0, 0.12);
  border-radius: 0.6rem;
  padding: 0.7rem 0.8rem;
  background: #fafafa;
  min-height: 11rem;
}
html.dark-mode .panel-notes {
  background: #1d2127;
  border-color: rgba(255, 255, 255, 0.12);
}
.standby-tabs { display: flex; justify-content: center; gap: 0.35rem; margin-top: 0.45rem; }
.standby-tabs button, .btn {
  border: 1px solid #c8c8c8;
  background: var(--btn-bg);
  border-radius: var(--radius);
  padding: 0.28rem 0.7rem;
  font-size: 0.875rem;
  line-height: 1.4;
  box-shadow: 0 1px 0 rgba(0, 0, 0, 0.03);
}
html.dark-mode .standby-tabs button,
html.dark-mode .btn {
  background: transparent;
  color: var(--body-color);
  border-color: var(--body-color);
}
.standby-tabs button[aria-selected="true"] {
  background: #111;
  color: #fff;
  border-color: #111;
}
html.dark-mode .standby-tabs button[aria-selected="true"] {
  background: #fff;
  color: #111;
}
.color-btn { display: inline-flex; align-items: center; gap: 0.35rem; }
.color-btn i {
  width: 0.7rem;
  height: 0.7rem;
  border-radius: 50%;
  background: var(--accent);
  display: inline-block;
}
.controls [hidden] { display: none; }

.controls,
.city-chip,
.fs-exit { transition: opacity 0.25s; }
.controls {
  position: absolute;
  left: 50%;
  bottom: max(0.85rem, env(safe-area-inset-bottom));
  transform: translateX(-50%);
  z-index: 20;
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  justify-content: center;
  width: min(100% - 1rem, 860px);
}
.btn:hover, .standby-tabs button:hover { filter: brightness(0.97); }
.btn:disabled { opacity: 0.55; cursor: default; }
.theme-btn { position: relative; }
.theme-toggle::after {
  content: "";
  display: inline-block;
  margin-left: 0.35em;
  vertical-align: 0.15em;
  border-top: 0.32em solid;
  border-right: 0.28em solid transparent;
  border-left: 0.28em solid transparent;
}
.theme-menu {
  position: absolute;
  z-index: 50;
  left: 0;
  bottom: calc(100% + 0.4rem);
  min-width: 11.5rem;
  margin: 0;
  padding: 0.35rem 0;
  list-style: none;
  background: var(--menu-bg);
  color: var(--body-color);
  border-radius: 0.45rem;
  box-shadow: 0 8px 28px rgba(0, 0, 0, 0.18);
}
.theme-menu button {
  display: block;
  width: 100%;
  text-align: left;
  border: 0;
  background: transparent;
  padding: 0.38rem 0.9rem;
  font-size: 0.95rem;
  border-radius: 0;
  box-shadow: none;
}
.theme-menu button:hover { background: rgba(127, 127, 127, 0.14); }
.theme-menu button.active { background: var(--body-color); color: var(--body-bg); }
.theme-menu .sep button { border-top: 1px dashed currentColor; }

.below { padding: 2.2rem 1.2rem 3rem; }
.help, .gallery { max-width: 740px; margin: 0 auto; }
.gallery h2, .help h2 { font-weight: 650; letter-spacing: -0.03em; }
.help { margin-top: 2rem; }
.help summary { cursor: pointer; font-weight: 650; font-size: 1.1rem; letter-spacing: -0.02em; }
.help h2 { font-size: 1.05rem; margin: 1.3rem 0 0.35rem; }
.help p, .gallery-lead { line-height: 1.65; margin: 0.35rem 0; }
.gallery { margin-top: 2rem; text-align: center; }
.gallery h2 { font-size: 1.45rem; margin-bottom: 0.25rem; }
.gallery-grid {
  margin-top: 1rem;
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.8rem;
}
.g-item {
  width: 220px;
  border: 1px solid #bdbdbd;
  border-radius: 0.6rem;
  padding: 0.45rem 0.45rem 0.7rem;
  background: transparent;
  text-align: center;
}
html.dark-mode .g-item { border-color: #d3d3d3; }
.g-item.current { border: 4px solid #6495ed; padding: 0.28rem 0.28rem 0.55rem; }
html.dark-mode .g-item.current { border-color: #ff8c00; }
.g-preview {
  height: 92px;
  border-radius: 0.35rem;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 0.45rem;
  overflow: hidden;
  font-weight: 700;
}
.g-item b { display: block; margin-bottom: 0.35rem; font-size: 0.92rem; }
.pv-flip { background: #f3f3f3; gap: 4px; }
.pv-flip i {
  font-style: normal;
  font-family: Teko, sans-serif;
  background: #222;
  color: #ddd;
  border-radius: 4px;
  padding: 0 4px 2px;
  font-size: 1.7rem;
  line-height: 0.8;
  position: relative;
}
.pv-flip i::after {
  content: "";
  position: absolute;
  left: 0; right: 0; top: 50%;
  height: 1px;
  background: #f3f3f3;
}
.pv-plain { background: #f5f5f5; color: #444; font-size: 1.7rem; letter-spacing: -0.04em; }
.pv-digital { background: #d0d0d0; color: #333; font-family: "Share Tech Mono", monospace; font-size: 1.45rem; }
.pv-comic { background: #f4d2b0; color: #3a332e; font-family: Jua, sans-serif; font-size: 1.55rem; font-weight: 400; }
.pv-led { background: #000; color: #ff1c12; font-family: "Share Tech Mono", monospace; font-size: 1.55rem; }
.pv-analog, .pv-standby { background: #f7f7f7; }
.mini-clock {
  width: 68px;
  height: 68px;
  border: 3px solid #111;
  border-radius: 50%;
  position: relative;
  background: #fff;
}
.mini-clock::before, .mini-clock::after {
  content: "";
  position: absolute;
  left: 50%;
  bottom: 50%;
  background: #111;
  transform-origin: bottom center;
}
.mini-clock::before { width: 2px; height: 18px; margin-left: -1px; transform: rotate(300deg); }
.mini-clock::after { width: 2px; height: 24px; margin-left: -1px; transform: rotate(40deg); }
.apply {
  border: 1px solid #212529;
  background: transparent;
  border-radius: 0.25rem;
  padding: 0.15rem 0.55rem;
  font-size: 0.8rem;
}
html.dark-mode .apply { border-color: #eee; color: #eee; }
.g-item.current .apply { visibility: hidden; }

html.is-fullscreen .topbar,
html.is-fullscreen .below { display: none; }
html.is-fullscreen .stage {
  position: fixed;
  inset: 0;
  z-index: 50;
  min-height: 100vh;
}
html.is-fullscreen .views { padding-bottom: 1.5rem; }
/* controls fade out in fullscreen until the pointer moves or a control has focus */
html.is-fullscreen:not(.chrome-on) .controls:not(:focus-within),
html.is-fullscreen:not(.chrome-on) .city-chip,
html.is-fullscreen:not(.chrome-on) .fs-exit {
  opacity: 0;
  pointer-events: none;
}

@media (max-width: 800px) {
  .standby-body { flex-direction: column; padding-top: 1rem; }
  .standby-face { width: min(64vw, 260px); font-size: min(64vw, 260px); }
  .date-str, .clock .ampm { font-size: calc(var(--base) / 7); }
}
@media (orientation: landscape) and (max-height: 575px) {
  .controls { top: 0.4rem; bottom: auto; }
  .theme-menu { top: calc(100% + 0.4rem); bottom: auto; }
  html.theme-flip.hide-seconds .minute-line { margin-top: calc(var(--base) * 0.02); }
}

html.theme-analog .analog-date { display: none; }
html.theme-analog.show-date-mode .analog-date { display: block; }
.city-chip {
  border: 0;
  background: transparent;
  color: inherit;
  font-size: 1.05rem;
  font-weight: 650;
  margin-bottom: 0.35rem;
}
.face.style-a-square { border-radius: 1.1rem; }
.face.style-a-solid {
  background: var(--accent);
  border-color: transparent;
  color: var(--accent-ink);
}
.face.style-a-solid .hand,
.face.style-a-solid .cap { background: var(--accent-ink); }
.face.style-a-solid .tick { background: linear-gradient(var(--accent-ink), var(--accent-ink)) top / 100% 0.055em no-repeat; }
.face.style-a-solid .hand.second { background: var(--accent-ink); }
.face.style-a-roman .num { font-family: "Times New Roman", serif; font-size: 0.062em; }
.face.style-a-num .num { font-size: 0.09em; font-family: "Helvetica Neue", Helvetica, Arial, sans-serif; }
.face.style-a-tick .num,
.face.style-a-dot .num,
.face.style-a-solid .num { display: none; }
.tick.dot {
  width: 0.018em;
  height: 46%;
  margin-left: -0.009em;
  background: radial-gradient(circle at 50% 0.012em, currentColor 0.012em, transparent 0.014em);
}
.face.style-a-quarter .tick:not(.major) { display: none; }
html.theme-analog .hand.second,
html.theme-standby[data-face-kind="analog"] .hand.second { display: block; }

.dig, .mini-flip { display: none; }
.face[class*="style-d-"] {
  width: auto;
  height: auto;
  aspect-ratio: auto;
  border: 0;
  background: transparent;
  box-shadow: none;
  font-size: 1rem;
}
.face[class*="style-d-"] .tick,
.face[class*="style-d-"] .num,
.face[class*="style-d-"] .hand,
.face[class*="style-d-"] .cap { display: none; }
.face.style-d-bold .dig,
.face.style-d-tall .dig,
.face.style-d-gradient .dig,
.face.style-d-led .dig,
.face.style-d-comic .dig { display: flex; }
.dig {
  align-items: baseline;
  justify-content: center;
  gap: 0.04em;
  font-size: clamp(3.2rem, 12vw, 7rem);
  font-weight: 760;
  letter-spacing: -0.05em;
  line-height: 0.9;
  font-variant-numeric: tabular-nums;
}
.d-s { font-size: 0.42em; }
.d-ap { font-size: 0.22em; margin-left: 0.2em; font-weight: 650; display: none; }
html.ampm-mode .d-ap { display: inline; }
html.hide-seconds .d-s,
html.hide-seconds .mini-flip .sec-sep,
html.hide-seconds .mini-flip .ss { display: none; }
.face.style-d-tall .dig { font-family: Oswald, "Arial Narrow", sans-serif; font-weight: 500; letter-spacing: -0.03em; }
.face.style-d-gradient .dig {
  background: linear-gradient(100deg, var(--accent), #7c5cff 55%, #111);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
html.dark-mode .face.style-d-gradient .dig {
  background: linear-gradient(100deg, #fff, var(--accent));
  -webkit-background-clip: text;
  background-clip: text;
}
.face.style-d-led .dig {
  font-family: "Share Tech Mono", ui-monospace, monospace;
  color: #ff1a12;
  letter-spacing: 0.04em;
  font-weight: 400;
  text-shadow: 0 0 12px rgba(255, 26, 18, 0.45);
}
.face.style-d-comic .dig { font-family: Jua, sans-serif; font-weight: 400; letter-spacing: -0.03em; }
.face.style-d-flip .mini-flip { display: flex; align-items: center; }
.mini-flip { font-size: clamp(3rem, 10vw, 5.5rem); }
.mini-flip .card {
  font-size: 1em;
  font-family: Teko, sans-serif;
  height: 1em;
  line-height: 0.78;
  min-width: 1.05em;
}
.mini-flip .sep { font-size: 0.7em; width: 0.35em; text-align: center; }

.note-size { display: none; justify-content: flex-end; gap: 0.3rem; margin-top: 0.35rem; }
html.tab-notes .note-size { display: flex; }
.note-size button {
  width: 2rem;
  height: 2rem;
  border-radius: 0.4rem;
  border: 1px solid #ccc;
  background: #fff;
}
html.dark-mode .note-size button { background: transparent; border-color: #ddd; }
.panel-notes { font-size: var(--note-size, 16px); }
html.panel-off .standby-panel { display: none; }
html.panel-off .standby-body { justify-content: center; }
html.panel-off .standby-face:not([class*="style-d-"]) {
  width: min(62vh, 72vw, 540px);
  font-size: min(62vh, 72vw, 540px);
}
html.panel-off .dig { font-size: clamp(4rem, 16vw, 9rem); }
.cal-grid button.weekend { color: #9aa0a6; }
.cal-title { cursor: pointer; }
.panel-date { display: none; flex-direction: column; align-items: center; justify-content: center; gap: 0.15rem; }
html.tab-date .panel-date { display: flex; }
.pd-m, .pd-w { font-size: 1.15rem; font-weight: 650; }
.pd-d { font-size: clamp(3.5rem, 8vw, 5.5rem); font-weight: 720; letter-spacing: -0.04em; line-height: 0.9; }

.sheet {
  position: fixed;
  z-index: 80;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  width: min(640px, calc(100vw - 1.5rem));
  max-height: min(78vh, 720px);
  overflow: auto;
  background: var(--body-bg);
  color: var(--body-color);
  border-radius: 0.9rem;
  box-shadow: 0 18px 60px rgba(0, 0, 0, 0.28);
  padding: 0.8rem 0.9rem 1rem;
}
.sheet-h { display: flex; align-items: center; gap: 0.5rem; margin-bottom: 0.6rem; }
.sheet-h strong { font-size: 1.05rem; }
.zone-q {
  flex: 1;
  border: 1px solid #ccc;
  border-radius: 0.45rem;
  padding: 0.35rem 0.6rem;
  background: transparent;
  color: inherit;
}
.sheet-group { margin: 0.35rem 0 0.7rem; }
.sheet-group h3 { margin: 0 0 0.4rem; font-size: 0.82rem; letter-spacing: 0.04em; opacity: 0.7; }
.tile-row { display: flex; flex-wrap: wrap; gap: 0.4rem; }
.tile {
  border: 1px solid #ccc;
  background: transparent;
  color: inherit;
  border-radius: 0.45rem;
  padding: 0.35rem 0.6rem;
  font-size: 0.86rem;
}
.tile.active { background: var(--body-color); color: var(--body-bg); border-color: var(--body-color); }
.zone-list { display: flex; flex-direction: column; gap: 0.15rem; }
.zone-row {
  display: grid;
  grid-template-columns: 1fr auto auto;
  gap: 0.6rem;
  align-items: center;
  text-align: left;
  border: 0;
  background: transparent;
  color: inherit;
  border-radius: 0.4rem;
  padding: 0.4rem 0.45rem;
}
.zone-row:hover, .zone-row.active { background: rgba(127, 127, 127, 0.14); }
.zone-row small { opacity: 0.65; }
.face-grid { display: flex; flex-wrap: wrap; justify-content: center; gap: 0.45rem; margin: 0.6rem 0 1.2rem; }
.erase-row { text-align: center; margin-top: 0.4rem; }
.stage { translate: var(--nudge-x, 0) var(--nudge-y, 0); }

/* ==========================================================================
   Visual layer — depth, glass and glow. Purely decorative: removing this
   block restores the flat look without affecting behavior.
   ========================================================================== */

/* ambient background: the accent color bleeds in from the top */
.stage {
  background:
    radial-gradient(90% 70% at 50% -10%, color-mix(in srgb, var(--accent) 16%, transparent), transparent 70%),
    radial-gradient(70% 60% at 100% 110%, color-mix(in srgb, var(--accent) 9%, transparent), transparent 70%),
    var(--bg);
}
html.theme-led .stage { background: var(--bg); }

/* views ease in on load and whenever the theme changes */
@keyframes view-in {
  from { opacity: 0; transform: translateY(10px); }
}
.view { animation: view-in 0.55s cubic-bezier(0.2, 0.7, 0.2, 1) both; }
@media (prefers-reduced-motion: reduce) {
  .view { animation: none; }
}

/* flip cards: lit top half, shaded bottom half, soft drop shadow */
.card {
  background:
    linear-gradient(180deg, color-mix(in srgb, var(--card) 86%, #fff) 0%, var(--card) 49.5%,
      color-mix(in srgb, var(--card) 88%, #000) 50.5%, color-mix(in srgb, var(--card) 94%, #000) 100%);
  box-shadow:
    inset 0 0.008em 0 rgba(255, 255, 255, 0.14),
    inset 0 -0.02em 0.04em rgba(0, 0, 0, 0.25),
    0 0.03em 0.05em rgba(0, 0, 0, 0.3),
    0 0.16em 0.4em -0.08em rgba(0, 0, 0, 0.4);
}
.card i { text-shadow: 0 0.01em 0.02em rgba(0, 0, 0, 0.45); }
.card.flap { box-shadow: none; }

/* glass control bar */
.controls {
  width: max-content;
  max-width: calc(100% - 1rem);
  padding: 0.4rem;
  border-radius: 1.4rem;
  border: 1px solid rgba(127, 127, 127, 0.22);
  background: color-mix(in srgb, var(--body-bg) 58%, transparent);
  -webkit-backdrop-filter: blur(16px) saturate(1.5);
  backdrop-filter: blur(16px) saturate(1.5);
  box-shadow: 0 12px 34px -10px rgba(0, 0, 0, 0.28), inset 0 1px 0 rgba(255, 255, 255, 0.35);
}
.controls .btn {
  border-color: transparent;
  background: transparent;
  border-radius: 999px;
  padding: 0.34rem 0.85rem;
  font-weight: 500;
  transition: background-color 0.15s, transform 0.15s, box-shadow 0.15s;
}
.controls .btn:hover { background: rgba(127, 127, 127, 0.16); filter: none; transform: translateY(-1px); }
.controls .btn:active { transform: translateY(0); }
.controls .btn[aria-pressed="true"] {
  background: var(--accent);
  color: var(--accent-ink);
  box-shadow: 0 4px 12px -4px var(--accent);
}
html.dark-mode .controls .btn { color: var(--body-color); }
html.dark-mode .controls .btn[aria-pressed="true"] { color: var(--accent-ink); }
.controls .color-btn i { box-shadow: 0 0 0 2px rgba(255, 255, 255, 0.55); }
.theme-menu { border-radius: 0.9rem; box-shadow: 0 18px 44px -10px rgba(0, 0, 0, 0.35); overflow: hidden; }
.theme-menu button.active { background: var(--accent); color: var(--accent-ink); }

/* topbar */
.topbar {
  background: color-mix(in srgb, var(--body-bg) 80%, transparent);
  -webkit-backdrop-filter: blur(10px);
  backdrop-filter: blur(10px);
}
.brand { letter-spacing: 0.02em; }

/* standby card: frosted glass */
.standby-body {
  border-radius: 1.6rem;
  border: 1px solid rgba(255, 255, 255, 0.65);
  background: linear-gradient(160deg, rgba(255, 255, 255, 0.92), rgba(255, 255, 255, 0.7));
  box-shadow: 0 30px 70px -28px rgba(0, 0, 0, 0.3), inset 0 1px 0 #fff;
}
html.dark-mode .standby-body {
  border-color: rgba(255, 255, 255, 0.09);
  background: linear-gradient(160deg, rgba(58, 64, 74, 0.9), rgba(36, 40, 47, 0.85));
  box-shadow: 0 30px 70px -28px rgba(0, 0, 0, 0.7), inset 0 1px 0 rgba(255, 255, 255, 0.06);
}
.standby-tabs button { border-radius: 999px; padding: 0.28rem 0.9rem; }
.standby-tabs button[aria-selected="true"] { background: var(--accent); color: var(--accent-ink); border-color: transparent; }
html.dark-mode .standby-tabs button[aria-selected="true"] { background: var(--accent); color: var(--accent-ink); }
.cal-grid button.today { box-shadow: 0 6px 14px -5px var(--accent); font-weight: 650; }
.panel-notes { border-radius: 0.9rem; }

/* analog dial: bezel, glass sheen and soft hand shadows */
.face {
  background: radial-gradient(circle at 50% 30%, #ffffff 0%, #f3f3f3 70%, #e9e9e9 100%);
  border-color: #1b1b1b;
  box-shadow:
    inset 0 0 0 0.008em rgba(255, 255, 255, 0.5),
    inset 0 0.02em 0.08em rgba(0, 0, 0, 0.18),
    0 0.03em 0.06em rgba(0, 0, 0, 0.25),
    0 0.14em 0.3em -0.06em rgba(0, 0, 0, 0.35);
}
html.dark-mode .face {
  background: radial-gradient(circle at 50% 30%, #2b2b2b 0%, #1a1a1a 70%, #121212 100%);
  border-color: #ececec;
}
:root .face.style-a-solid {
  background: radial-gradient(circle at 50% 30%, color-mix(in srgb, var(--accent) 88%, #fff), var(--accent) 65%);
  border-color: transparent;
  color: var(--accent-ink);
}
.hand { box-shadow: 0 0.006em 0.012em rgba(0, 0, 0, 0.35); }
.cap { box-shadow: 0 0.004em 0.01em rgba(0, 0, 0, 0.4); }
.city-chip { letter-spacing: 0.02em; }

/* LED glow */
html.theme-led .seg-time {
  filter: drop-shadow(0 0 0.04em rgba(255, 30, 15, 0.75)) drop-shadow(0 0 0.18em rgba(255, 20, 10, 0.35));
}
.face.style-d-led .dig { text-shadow: 0 0 0.12em rgba(255, 26, 18, 0.7), 0 0 0.4em rgba(255, 26, 18, 0.35); }
.face.style-d-gradient .dig { filter: drop-shadow(0 0.04em 0.08em rgba(0, 0, 0, 0.15)); }

/* gallery tiles */
.g-item { border-radius: 0.9rem; transition: transform 0.2s, box-shadow 0.2s; }
.g-item:hover { transform: translateY(-3px); box-shadow: 0 14px 30px -16px rgba(0, 0, 0, 0.4); }
.g-item.current, html.dark-mode .g-item.current { border-color: var(--accent); }
.g-preview { border-radius: 0.6rem; }
.tile { border-radius: 999px; }
.tile.active { background: var(--accent); color: var(--accent-ink); border-color: transparent; }
.apply { border-radius: 999px; padding: 0.2rem 0.8rem; }
.help summary { padding: 0.2rem 0; }

html.theme-led .controls { background: rgba(28, 28, 28, 0.6); border-color: rgba(255, 60, 40, 0.25); }
html.theme-led .controls .btn { color: #ff5a4d; }
.t-ampm { white-space: nowrap; }
:root .face.style-a-solid .tick { background: linear-gradient(var(--accent-ink), var(--accent-ink)) top / 100% 0.055em no-repeat; }
:root .face.style-a-solid .hand,
:root .face.style-a-solid .cap { background: var(--accent-ink); }
