:root {
  --bg: #f7f4ec;
  --ink: #1f1d19;
  --muted: #686257;
  --panel: rgba(255, 255, 255, 0.82);
  --line: rgba(31, 29, 25, 0.12);
  --accent: #0f766e;
  --accent-2: #d97706;
  --glow: rgba(15, 118, 110, 0.25);
  --toggle-bg: rgba(15, 118, 110, 0.1);
  --control-bg: #ffffff;
  --control-text: #1f1d19;
  --bg-grad-a: rgba(217, 119, 6, 0.12);
  --bg-grad-b: rgba(15, 118, 110, 0.12);
  --bg-grad-c: #ece8de;
  --bg-grad-d: #f4efe4;
  --bg-grad-e: #f8f5ef;
  --bg-shape-a: rgba(217, 119, 6, 0.24);
  --bg-shape-b: rgba(15, 118, 110, 0.2);
}

body[data-theme="mono"] {
  --bg: #050505;
  --ink: #f2f2f2;
  --muted: #b8b8b8;
  --panel: rgba(22, 22, 22, 0.92);
  --line: rgba(255, 255, 255, 0.16);
  --accent: #f2f2f2;
  --accent-2: #c9c9c9;
  --glow: rgba(255, 255, 255, 0.16);
  --toggle-bg: rgba(255, 255, 255, 0.08);
  --control-bg: #111111;
  --control-text: #f2f2f2;
  --bg-grad-a: rgba(255, 255, 255, 0.06);
  --bg-grad-b: rgba(255, 255, 255, 0.04);
  --bg-grad-c: #030303;
  --bg-grad-d: #0b0b0b;
  --bg-grad-e: #141414;
  --bg-shape-a: rgba(255, 255, 255, 0.1);
  --bg-shape-b: rgba(255, 255, 255, 0.08);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: "Manrope", sans-serif;
  color: var(--ink);
  background:
    radial-gradient(circle at 8% 8%, var(--bg-grad-a), transparent 32%),
    radial-gradient(circle at 92% 16%, var(--bg-grad-b), transparent 36%),
    linear-gradient(160deg, var(--bg-grad-e) 0%, var(--bg-grad-d) 54%, var(--bg-grad-c) 100%);
  display: grid;
  place-items: center;
  padding: 20px;
}

.bg-shape {
  position: fixed;
  border-radius: 999px;
  filter: blur(42px);
  z-index: -1;
}

.bg-shape-a {
  width: 320px;
  height: 320px;
  background: var(--bg-shape-a);
  top: -100px;
  left: -80px;
}

.bg-shape-b {
  width: 280px;
  height: 280px;
  background: var(--bg-shape-b);
  right: -70px;
  bottom: -90px;
}

.app {
  width: min(780px, 100%);
  display: grid;
  gap: 16px;
}

.topbar,
.panel {
  border: 1px solid var(--line);
  background: var(--panel);
  backdrop-filter: blur(10px);
  border-radius: 22px;
}

.topbar {
  padding: 18px 20px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
}

.actions {
  display: flex;
  gap: 8px;
  align-items: center;
}

.eyebrow {
  margin: 0 0 4px;
  font-size: 0.76rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
  font-weight: 700;
}

h1 {
  margin: 0;
  font-size: clamp(1.3rem, 2.5vw, 1.8rem);
  letter-spacing: -0.02em;
}

.toggle {
  border: 1px solid var(--line);
  background: var(--toggle-bg);
  color: var(--accent);
  border-radius: 999px;
  padding: 10px 14px;
  font: inherit;
  font-weight: 700;
  cursor: pointer;
  white-space: nowrap;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.toggle:hover {
  transform: translateY(-1px);
  box-shadow: 0 10px 22px var(--glow);
}

.mini-select {
  border: 1px solid var(--line);
  background: var(--control-bg);
  color: var(--control-text);
  border-radius: 999px;
  padding: 10px 12px;
  font: inherit;
  font-weight: 700;
}

.controls {
  padding: 16px 18px;
  display: grid;
  gap: 10px;
}

.control-grid {
  display: grid;
  grid-template-columns: 1.4fr 1fr 1fr;
  gap: 12px;
}

.control-grid > div {
  display: grid;
  gap: 8px;
}

label {
  font-size: 0.9rem;
  color: var(--muted);
  font-weight: 700;
}

select {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 11px 12px;
  background: var(--control-bg);
  color: var(--control-text);
  font: inherit;
}

.clock-panel {
  padding: 22px;
  min-height: 280px;
}

.zone-row {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}

.zone-label,
.offset-label {
  margin: 0;
  font-size: 0.96rem;
  color: var(--muted);
  font-weight: 700;
}

.digital-clock {
  margin-top: 28px;
  display: grid;
  justify-items: center;
  text-align: center;
  animation: rise-in 420ms ease;
}

#timeMain {
  font-family: "Chakra Petch", "Space Grotesk", sans-serif;
  font-size: clamp(3.8rem, 12vw, 7.8rem);
  letter-spacing: 0.06em;
  font-weight: 700;
  color: var(--ink);
  text-shadow: 0 7px 24px rgba(15, 118, 110, 0.18);
}

.date {
  margin-top: 8px;
  font-size: clamp(0.95rem, 3.5vw, 1.2rem);
  color: var(--muted);
  font-weight: 700;
}

.analog {
  margin: 28px auto 0;
  width: min(320px, 78vw);
  aspect-ratio: 1;
  border-radius: 50%;
  position: relative;
  transition: all 0.28s ease;
  animation: rise-in 420ms ease;
}

.dial {
  position: absolute;
  inset: 16px;
  border-radius: 50%;
}

.numbers {
  position: absolute;
  inset: 0;
}

.num {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 2.4rem;
  height: 2.4rem;
  margin: -1.2rem;
  display: grid;
  place-items: center;
  font-family: "Space Grotesk", sans-serif;
  font-size: 0.98rem;
  font-weight: 800;
  color: #2b2720;
  transform: rotate(calc(var(--i) * 30deg)) translateY(-128px)
    rotate(calc(var(--i) * -30deg));
}

.hand {
  position: absolute;
  left: 50%;
  bottom: 50%;
  transform-origin: 50% 100%;
  border-radius: 999px;
  translate: -50% 0;
  box-shadow: 0 2px 8px rgba(31, 29, 25, 0.2);
}

.hand.hour {
  width: 7px;
  height: 68px;
  background: #1f2937;
}

.hand.minute {
  width: 5px;
  height: 94px;
  background: #4b5563;
}

.hand.second {
  width: 3px;
  height: 108px;
  background: #dc2626;
}

.center-dot {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: #111827;
  translate: -50% -50%;
  box-shadow: 0 0 0 3px #f8f5ef;
}

#analogClock[data-style="classic"] {
  background: radial-gradient(circle at center, #fff 0%, #f8f5ef 100%);
  border: 10px solid #e5ded1;
  box-shadow:
    inset 0 0 0 2px rgba(31, 29, 25, 0.08),
    0 12px 36px rgba(31, 29, 25, 0.14);
}

#analogClock[data-style="classic"] .dial {
  border: 1px solid rgba(31, 29, 25, 0.12);
}

#analogClock[data-style="minimal"] {
  background: #ffffff;
  border: 2px solid #9ca3af;
  box-shadow: none;
}

#analogClock[data-style="minimal"] .dial {
  border: none;
}

#analogClock[data-style="minimal"] .num {
  color: #6b7280;
  font-size: 0.84rem;
  font-weight: 700;
  transform: rotate(calc(var(--i) * 30deg)) translateY(-118px)
    rotate(calc(var(--i) * -30deg));
}

#analogClock[data-style="minimal"] .hand {
  box-shadow: none;
}

#analogClock[data-style="minimal"] .hand.hour {
  width: 6px;
  height: 60px;
  background: #111827;
}

#analogClock[data-style="minimal"] .hand.minute {
  width: 3px;
  height: 90px;
  background: #111827;
}

#analogClock[data-style="minimal"] .hand.second {
  width: 2px;
  height: 104px;
  background: #2563eb;
}

#analogClock[data-style="minimal"] .center-dot {
  width: 8px;
  height: 8px;
  background: #111827;
  box-shadow: none;
}

#analogClock[data-style="contrast"] {
  background: radial-gradient(circle at center, #1f1f1f 0%, #050505 100%);
  border: 12px solid #020202;
  box-shadow:
    inset 0 0 0 2px rgba(255, 255, 255, 0.12),
    0 14px 40px rgba(0, 0, 0, 0.45);
}

#analogClock[data-style="contrast"] .dial {
  border: 2px solid rgba(255, 255, 255, 0.2);
}

#analogClock[data-style="contrast"] .num {
  color: #f3f4f6;
  font-size: 1.06rem;
  font-weight: 700;
  text-shadow: 0 1px 8px rgba(255, 255, 255, 0.16);
}

#analogClock[data-style="contrast"] .hand.hour {
  background: #f9fafb;
}

#analogClock[data-style="contrast"] .hand.minute {
  background: #d1d5db;
}

#analogClock[data-style="contrast"] .hand.second {
  background: #ef4444;
}

#analogClock[data-style="contrast"] .center-dot {
  background: #f9fafb;
  box-shadow: 0 0 0 3px #111;
}

body[data-theme="mono"] #analogClock[data-style="classic"] {
  background: radial-gradient(circle at center, #1b1b1b 0%, #080808 100%);
  border-color: #303030;
}

body[data-theme="mono"] #analogClock[data-style="classic"] .dial {
  border-color: rgba(255, 255, 255, 0.18);
}

body[data-theme="mono"] #analogClock[data-style="classic"] .num,
body[data-theme="mono"] #analogClock[data-style="minimal"] .num {
  color: #e5e7eb;
}

body[data-theme="mono"] #analogClock[data-style="classic"] .hand.hour,
body[data-theme="mono"] #analogClock[data-style="classic"] .hand.minute,
body[data-theme="mono"] #analogClock[data-style="minimal"] .hand.hour,
body[data-theme="mono"] #analogClock[data-style="minimal"] .hand.minute {
  background: #f3f4f6;
}

body[data-theme="mono"] #analogClock[data-style="minimal"] {
  background: #101010;
  border-color: #4b5563;
}

body[data-theme="mono"] #analogClock[data-style="minimal"] .center-dot,
body[data-theme="mono"] #analogClock[data-style="classic"] .center-dot {
  background: #f3f4f6;
  box-shadow: 0 0 0 2px #111;
}

.hidden {
  display: none;
}

.ad-slot {
  padding: 12px;
  min-height: 116px;
  display: grid;
  place-items: center;
  overflow: hidden;
}

.ad-slot .adsbygoogle {
  display: block;
  width: 100%;
  min-height: 100px;
}

@keyframes rise-in {
  from {
    opacity: 0;
    transform: translateY(6px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@media (max-width: 640px) {
  body {
    padding: 14px;
  }

  .topbar {
    padding: 16px;
    align-items: flex-start;
    flex-direction: column;
  }

  .actions {
    width: 100%;
    flex-direction: column;
    align-items: stretch;
  }

  .toggle {
    width: 100%;
  }

  .mini-select {
    width: 100%;
  }

  .control-grid {
    grid-template-columns: 1fr;
  }

  .clock-panel {
    padding: 18px 16px;
  }
}
