/* ── Reset & base ── */
*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

:root {
  --bg: #000;
  --bg1: #0e0e0e;
  --bg2: #1c1c1e;
  --bg3: #2c2c2e;
  --bg4: #3a3a3c;
  --sep: #38383a;
  --text: #fff;
  --text2: #ebebf5cc;
  --text3: #ebebf599;
  --text4: #ebebf54d;
  --accent: #ff9f0a;
  --accent2: #30d158;
  --accent3: #0a84ff;
  --danger: #ff453a;
  --tab-h: 84px;
  --radius: 14px;
  --font: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
}

html,
body {
  height: 100%;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  -webkit-font-smoothing: antialiased;
  overscroll-behavior: none;
}

body {
  display: flex;
  flex-direction: column;
  min-height: 100dvh;
}

/* ── Page title (single h1 for SEO; tab bar shows the visible label) ── */
.page-title {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* ── App shell ── */
#app {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  max-width: 480px;
  width: 100%;
  margin: 0 auto;
  position: relative;
}

/* ── Panels ── */
.panel {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  display: none;
  flex-direction: column;
  padding: 0 0 calc(var(--tab-h) + 12px);
  scrollbar-width: none;
}
.panel::-webkit-scrollbar {
  display: none;
}
.panel.active {
  display: flex;
}

/* ── Tab bar ── */
#tab-bar {
  position: fixed;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 100%;
  max-width: 480px;
  height: var(--tab-h);
  background: rgba(28, 28, 30, 0.92);
  backdrop-filter: blur(20px) saturate(180%);
  -webkit-backdrop-filter: blur(20px) saturate(180%);
  border-top: 1px solid var(--sep);
  display: flex;
  align-items: flex-start;
  padding-top: 10px;
  z-index: 100;
}

.tab-btn {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  background: none;
  border: none;
  cursor: pointer;
  padding: 6px 4px;
  color: var(--text3);
  font-family: var(--font);
  font-size: clamp(9px, 2.4vw, 11px);
  font-weight: 500;
  letter-spacing: 0.02em;
  transition: color 0.15s;
  min-height: 44px;
  min-width: 44px;
  border-radius: 8px;
}
.tab-btn:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}
.tab-btn .tab-icon {
  font-size: clamp(20px, 5vw, 24px);
  line-height: 1;
}
.tab-btn.active {
  color: var(--accent);
}

/* ── Section header ── */
.section-title {
  font-size: clamp(26px, 7vw, 34px);
  font-weight: 700;
  color: var(--text);
  padding: 20px 20px 8px;
  letter-spacing: -0.5px;
}

/* ══════════════════════════════════════════
   CLOCK TAB
══════════════════════════════════════════ */
#clock-panel {
  padding-top: 0;
}

.clock-hero {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: clamp(28px, 8vw, 48px) 20px clamp(16px, 4vw, 24px);
}

.clock-time {
  font-size: clamp(68px, 20vw, 96px);
  font-weight: 200;
  letter-spacing: -4px;
  line-height: 1;
  color: var(--text);
  font-variant-numeric: tabular-nums;
  transition: opacity 0.1s;
}

.clock-ampm {
  font-size: clamp(18px, 5vw, 26px);
  font-weight: 300;
  color: var(--text2);
  margin-top: 6px;
  letter-spacing: 1px;
}

.clock-date {
  font-size: clamp(15px, 4vw, 18px);
  font-weight: 400;
  color: var(--text3);
  margin-top: 10px;
  letter-spacing: 0.2px;
}

.clock-controls {
  display: flex;
  gap: 10px;
  margin-top: 16px;
}

/* ── Clock face mode selector ── */
.face-mode-btns {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 6px;
  margin-top: 14px;
  max-width: 100%;
}
.face-btn {
  background: var(--bg3);
  border: none;
  border-radius: 20px;
  color: var(--text3);
  font-family: var(--font);
  font-size: clamp(11px, 3vw, 13px);
  font-weight: 500;
  padding: 7px 14px;
  cursor: pointer;
  min-height: 36px;
  transition: background 0.15s, color 0.15s;
}
.face-btn:hover {
  background: var(--bg4);
  color: var(--text2);
}
.face-btn:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}
.face-btn.active {
  background: var(--bg4);
  color: var(--text);
}

/* ── Analog clock face ── */
.analog-face {
  width: clamp(200px, 55vw, 260px);
  height: clamp(200px, 55vw, 260px);
  display: none;
  margin: 0 auto;
}
.analog-face circle.bg {
  fill: var(--bg2);
}
.analog-face circle.rim {
  fill: none;
  stroke: var(--sep);
  stroke-width: 2;
}
.analog-face .tick-major {
  stroke: var(--text3);
  stroke-width: 2.5;
  stroke-linecap: round;
}
.analog-face .tick-minor {
  stroke: var(--bg4);
  stroke-width: 1.5;
  stroke-linecap: round;
}
.analog-face .hand-hour {
  stroke: var(--text);
  stroke-width: 5;
  stroke-linecap: round;
  transition: transform 0.3s cubic-bezier(0.4, 2.2, 0.6, 1);
}
.analog-face .hand-min {
  stroke: var(--text);
  stroke-width: 3.5;
  stroke-linecap: round;
  transition: transform 0.3s cubic-bezier(0.4, 2.2, 0.6, 1);
}
.analog-face .hand-sec {
  stroke: var(--accent);
  stroke-width: 2;
  stroke-linecap: round;
}
.analog-face .hand-sec-tail {
  stroke: var(--accent);
  stroke-width: 2;
  stroke-linecap: round;
}
.analog-face .center-dot {
  fill: var(--accent);
}
@media (prefers-reduced-motion: reduce) {
  .analog-face .hand-hour,
  .analog-face .hand-min {
    transition: none;
  }
}

/* ── Flip clock face ── */
.flip-face {
  display: none;
  gap: clamp(6px, 2vw, 12px);
  align-items: center;
  justify-content: center;
  padding: 8px 0;
}
.flip-sep {
  font-size: clamp(36px, 10vw, 56px);
  font-weight: 200;
  color: var(--text3);
  line-height: 1;
  margin-bottom: 6px;
  user-select: none;
}
.flip-group {
  display: flex;
  gap: 4px;
}
.flip-digit {
  position: relative;
  width: clamp(40px, 11vw, 56px);
  height: clamp(64px, 18vw, 88px);
  border-radius: 8px;
  overflow: hidden;
  background: var(--bg2);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.6);
}
.flip-digit::after {
  content: '';
  position: absolute;
  left: 0;
  right: 0;
  top: 50%;
  height: 1px;
  background: rgba(0, 0, 0, 0.5);
  z-index: 3;
}
.flip-top,
.flip-bottom {
  position: absolute;
  left: 0;
  right: 0;
  height: 50%;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  overflow: hidden;
  background: var(--bg2);
}
.flip-top {
  top: 0;
  align-items: flex-end;
  border-radius: 8px 8px 0 0;
}
.flip-bottom {
  bottom: 0;
  align-items: flex-start;
  border-radius: 0 0 8px 8px;
  background: var(--bg3);
}
.flip-top span,
.flip-bottom span {
  font-size: clamp(46px, 13vw, 70px);
  font-weight: 200;
  color: var(--text);
  line-height: 1;
  font-variant-numeric: tabular-nums;
  display: block;
  transform: translateY(50%);
}
.flip-bottom span {
  transform: translateY(-50%);
}
.flip-digit.flipping .flip-top-fold {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 50%;
  background: var(--bg2);
  border-radius: 8px 8px 0 0;
  transform-origin: bottom center;
  animation: flipTop 0.25s ease-in forwards;
  z-index: 2;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  overflow: hidden;
}
.flip-digit.flipping .flip-top-fold span {
  font-size: clamp(46px, 13vw, 70px);
  font-weight: 200;
  color: var(--text);
  line-height: 1;
  transform: translateY(50%);
}
.flip-digit.flipping .flip-bottom-fold {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 50%;
  background: var(--bg3);
  border-radius: 0 0 8px 8px;
  transform-origin: top center;
  animation: flipBottom 0.25s ease-out 0.12s forwards;
  z-index: 2;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  overflow: hidden;
  transform: rotateX(90deg);
}
.flip-digit.flipping .flip-bottom-fold span {
  font-size: clamp(46px, 13vw, 70px);
  font-weight: 200;
  color: var(--text);
  line-height: 1;
  transform: translateY(-50%);
}
@keyframes flipTop {
  from {
    transform: rotateX(0deg);
  }
  to {
    transform: rotateX(-90deg);
  }
}
@keyframes flipBottom {
  from {
    transform: rotateX(90deg);
  }
  to {
    transform: rotateX(0deg);
  }
}
@media (prefers-reduced-motion: reduce) {
  .flip-digit.flipping .flip-top-fold,
  .flip-digit.flipping .flip-bottom-fold {
    animation: none;
  }
}

/* ── Roman numerals face ── */
.roman-container {
  display: flex;
  align-items: flex-start;
  justify-content: center;
  gap: clamp(10px, 4vw, 28px);
  flex-wrap: wrap;
  padding: 4px 8px;
}
.roman-unit {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
}
.roman-value {
  font-family: 'Cinzel Decorative', 'Palatino Linotype', 'Book Antiqua', serif;
  font-size: clamp(24px, 7vw, 42px);
  font-weight: 700;
  color: var(--accent);
  text-shadow: 0 0 18px rgba(255, 159, 10, 0.35);
  letter-spacing: 0.04em;
  text-align: center;
  min-width: clamp(50px, 14vw, 90px);
  font-variant-numeric: tabular-nums;
}
.roman-label {
  font-family: 'Cinzel Decorative', serif;
  font-size: clamp(8px, 2vw, 11px);
  color: var(--text3);
  letter-spacing: 0.15em;
  text-transform: uppercase;
}
.roman-sep {
  font-size: clamp(24px, 7vw, 40px);
  color: var(--sep);
  align-self: center;
  margin-top: -14px;
  user-select: none;
}
.roman-ampm {
  text-align: center;
  font-family: 'Cinzel Decorative', serif;
  font-size: clamp(13px, 3.5vw, 18px);
  color: var(--text3);
  letter-spacing: 0.2em;
  margin-top: 6px;
}

/* ── Binary clock face ── */
.binary-clock {
  display: flex;
  flex-direction: column;
  gap: clamp(10px, 3vw, 16px);
  background: var(--bg2);
  border: 1px solid var(--sep);
  border-radius: var(--radius);
  padding: clamp(14px, 4vw, 24px) clamp(16px, 5vw, 32px);
}
.binary-row {
  display: flex;
  align-items: center;
  gap: clamp(10px, 3vw, 16px);
}
.binary-row-label {
  font-size: clamp(11px, 3vw, 13px);
  font-weight: 600;
  color: var(--text3);
  width: 14px;
  text-align: center;
  font-variant-numeric: tabular-nums;
}
.binary-dots {
  display: flex;
  gap: clamp(5px, 1.5vw, 8px);
  flex-wrap: nowrap;
}
.bin-dot {
  width: clamp(16px, 4.5vw, 22px);
  height: clamp(16px, 4.5vw, 22px);
  border-radius: 50%;
  background: var(--bg3);
  border: 1px solid var(--sep);
  transition: background 0.1s, box-shadow 0.1s;
  flex-shrink: 0;
}
.bin-dot.on-h {
  background: var(--accent);
  box-shadow: 0 0 8px var(--accent);
}
.bin-dot.on-m {
  background: var(--accent2);
  box-shadow: 0 0 8px var(--accent2);
}
.bin-dot.on-s {
  background: var(--accent3);
  box-shadow: 0 0 8px var(--accent3);
}
.binary-row-val {
  font-size: clamp(12px, 3.2vw, 14px);
  font-weight: 500;
  color: var(--text3);
  font-variant-numeric: tabular-nums;
  width: clamp(20px, 5vw, 26px);
  text-align: right;
}
.binary-ampm {
  text-align: center;
  font-size: clamp(12px, 3vw, 14px);
  color: var(--text3);
  margin-top: 6px;
}
@media (prefers-reduced-motion: reduce) {
  .bin-dot {
    transition: none;
  }
}

/* ── LED dot-matrix face ── */
.led-housing {
  background: #0a0a0a;
  border: 2px solid #2a2a2a;
  border-radius: 10px;
  padding: clamp(10px, 3vw, 18px) clamp(12px, 4vw, 22px);
  box-shadow: inset 0 2px 10px rgba(0, 0, 0, 0.7), 0 4px 20px rgba(0, 0, 0, 0.5);
  display: inline-flex;
  overflow-x: auto;
  max-width: 100%;
}
.led-grid {
  display: inline-flex;
  gap: clamp(4px, 1.5vw, 8px);
  align-items: center;
  flex-wrap: nowrap;
}
.led-unit-group {
  display: flex;
  flex-direction: column;
  align-items: center;
}
.led-unit-digits {
  display: flex;
  gap: 1px;
}
.led-digit-matrix {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  grid-template-rows: repeat(7, 1fr);
  gap: clamp(1px, 0.4vw, 2px);
}
.ldot {
  width: clamp(3px, 1vw, 5px);
  height: clamp(3px, 1vw, 5px);
  border-radius: 50%;
  background: #1a0a0a;
}
.ldot.on-red {
  background: #ff3333;
  box-shadow: 0 0 4px #ff3333, 0 0 8px rgba(255, 51, 51, 0.5);
}
.ldot.on-grn {
  background: #00ff44;
  box-shadow: 0 0 4px #00ff44, 0 0 8px rgba(0, 255, 68, 0.5);
}
.ldot.on-amb {
  background: #ffaa00;
  box-shadow: 0 0 4px #ffaa00, 0 0 8px rgba(255, 170, 0, 0.5);
}
.led-sep-col {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 0 2px;
  align-self: center;
}
.led-sep-dot {
  width: clamp(3px, 1vw, 5px);
  height: clamp(3px, 1vw, 5px);
  border-radius: 50%;
  background: #ffaa00;
  box-shadow: 0 0 6px #ffaa00;
  animation: ledBlink 1s infinite;
}
@keyframes ledBlink {
  0%,
  100% {
    opacity: 1;
  }
  50% {
    opacity: 0.25;
  }
}
@media (prefers-reduced-motion: reduce) {
  .led-sep-dot {
    animation: none;
  }
}
.led-unit-label {
  font-family: 'Courier New', monospace;
  font-size: clamp(7px, 2vw, 9px);
  color: #555;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-top: 5px;
}
.led-ampm {
  text-align: center;
  font-family: 'Courier New', monospace;
  font-size: clamp(11px, 3vw, 13px);
  color: #555;
  margin-top: 8px;
  letter-spacing: 0.1em;
}

/* ── Words face ── */
.words-phrase {
  font-family: Georgia, 'Times New Roman', serif;
  font-size: clamp(20px, 6vw, 34px);
  font-weight: 400;
  line-height: 1.5;
  color: var(--text);
  text-align: center;
  padding: 8px 16px;
  max-width: 380px;
  margin: 0 auto;
}
.words-phrase .w-num {
  color: var(--accent);
  font-style: italic;
}
.words-phrase .w-unit {
  color: var(--text2);
}
.words-phrase .w-sep {
  color: var(--text3);
}

.pill-btn {
  background: var(--bg3);
  border: none;
  border-radius: 20px;
  color: var(--text2);
  font-family: var(--font);
  font-size: clamp(12px, 3.2vw, 14px);
  font-weight: 500;
  padding: 8px 18px;
  cursor: pointer;
  min-height: 36px;
  transition: background 0.15s, color 0.15s;
}
.pill-btn:hover {
  background: var(--bg4);
}
.pill-btn:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}
.pill-btn.active {
  background: var(--accent);
  color: #000;
}

/* World Clocks */
.world-clocks-section {
  padding: 0 16px;
}

.world-clocks-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
}

.world-clocks-title {
  font-size: clamp(18px, 4.5vw, 22px);
  font-weight: 600;
  color: var(--text);
}

.add-city-btn {
  background: none;
  border: none;
  color: var(--accent);
  font-family: var(--font);
  font-size: clamp(13px, 3.5vw, 15px);
  font-weight: 500;
  cursor: pointer;
  padding: 6px 2px;
  min-height: 44px;
  min-width: 44px;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 4px;
}
.add-city-btn:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  border-radius: 6px;
}

.city-search-container {
  background: var(--bg2);
  border-radius: var(--radius);
  overflow: hidden;
  margin-bottom: 12px;
  border: 1px solid var(--sep);
}

.city-search-input {
  width: 100%;
  background: transparent;
  border: none;
  color: var(--text);
  font-family: var(--font);
  font-size: clamp(14px, 3.8vw, 16px);
  padding: 14px 16px;
  outline: none;
}
.city-search-input::placeholder {
  color: var(--text4);
}

.city-dropdown {
  max-height: 220px;
  overflow-y: auto;
  border-top: 1px solid var(--sep);
  scrollbar-width: none;
}
.city-dropdown::-webkit-scrollbar {
  display: none;
}

.city-option {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  cursor: pointer;
  font-size: clamp(13px, 3.5vw, 15px);
  color: var(--text2);
  transition: background 0.1s;
  min-height: 44px;
  border: none;
  background: none;
  width: 100%;
  text-align: left;
  font-family: var(--font);
}
.city-option:hover,
.city-option:focus-visible {
  background: var(--bg3);
  outline: none;
}

.city-list {
  display: flex;
  flex-direction: column;
  gap: 1px;
}

.city-row {
  background: var(--bg2);
  border-radius: var(--radius);
  display: flex;
  align-items: center;
  padding: 14px 16px;
  gap: 12px;
  min-height: 64px;
}

.city-row-left {
  flex: 1;
  min-width: 0;
}

.city-name {
  font-size: clamp(14px, 3.8vw, 16px);
  font-weight: 500;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.city-offset {
  font-size: clamp(11px, 3vw, 13px);
  color: var(--text3);
  margin-top: 2px;
}

.city-time {
  font-size: clamp(22px, 6vw, 28px);
  font-weight: 200;
  color: var(--text);
  font-variant-numeric: tabular-nums;
  letter-spacing: -1px;
  flex-shrink: 0;
}

.city-ampm {
  font-size: clamp(11px, 3vw, 13px);
  color: var(--text3);
  font-weight: 400;
  margin-left: 4px;
}

.remove-city-btn {
  background: none;
  border: none;
  color: var(--danger);
  cursor: pointer;
  padding: 6px;
  min-width: 36px;
  min-height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  font-size: 18px;
  line-height: 1;
  transition: background 0.15s;
  flex-shrink: 0;
}
.remove-city-btn:hover {
  background: rgba(255, 69, 58, 0.15);
}
.remove-city-btn:focus-visible {
  outline: 2px solid var(--danger);
  outline-offset: 2px;
}

/* ══════════════════════════════════════════
   STOPWATCH TAB
══════════════════════════════════════════ */
.stopwatch-display {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: clamp(28px, 8vw, 48px) 20px clamp(20px, 5vw, 32px);
}

.sw-time {
  font-size: clamp(62px, 18vw, 88px);
  font-weight: 200;
  letter-spacing: -3px;
  line-height: 1;
  color: var(--text);
  font-variant-numeric: tabular-nums;
}

.sw-time .cs {
  font-size: clamp(36px, 10vw, 52px);
  color: var(--text2);
}

.sw-buttons {
  display: flex;
  gap: 16px;
  margin-top: clamp(24px, 6vw, 40px);
}

.circle-btn {
  width: clamp(72px, 18vw, 84px);
  height: clamp(72px, 18vw, 84px);
  border-radius: 50%;
  border: none;
  cursor: pointer;
  font-family: var(--font);
  font-size: clamp(13px, 3.5vw, 15px);
  font-weight: 600;
  letter-spacing: 0.01em;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.1s, opacity 0.15s;
  -webkit-tap-highlight-color: transparent;
}
.circle-btn:active {
  transform: scale(0.94);
}
.circle-btn:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
}

.btn-start {
  background: rgba(48, 209, 88, 0.2);
  color: var(--accent2);
}
.btn-stop {
  background: rgba(255, 69, 58, 0.2);
  color: var(--danger);
}
.btn-lap {
  background: var(--bg3);
  color: var(--text2);
}
.btn-reset {
  background: var(--bg3);
  color: var(--text2);
}

.lap-list-header {
  display: flex;
  align-items: center;
  padding: 0 20px 8px;
  border-bottom: 1px solid var(--sep);
  font-size: clamp(11px, 3vw, 13px);
  color: var(--text4);
  font-weight: 500;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}
.lap-list-header span:first-child {
  flex: 0 0 48px;
}
.lap-list-header span:nth-child(2) {
  flex: 1;
  text-align: right;
}
.lap-list-header span:last-child {
  flex: 1;
  text-align: right;
}

.lap-list {
  flex: 1;
  overflow-y: auto;
  scrollbar-width: none;
  padding: 0 20px;
}
.lap-list::-webkit-scrollbar {
  display: none;
}

.lap-row {
  display: flex;
  align-items: center;
  padding: 12px 0;
  border-bottom: 1px solid var(--sep);
  font-variant-numeric: tabular-nums;
  animation: fadeIn 0.15s ease;
}
.lap-row:last-child {
  border-bottom: none;
}

@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(-4px);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

.lap-num {
  flex: 0 0 48px;
  font-size: clamp(13px, 3.5vw, 15px);
  color: var(--text3);
  font-weight: 500;
}
.lap-split {
  flex: 1;
  text-align: right;
  font-size: clamp(14px, 3.8vw, 16px);
  color: var(--text);
  font-weight: 400;
}
.lap-total {
  flex: 1;
  text-align: right;
  font-size: clamp(14px, 3.8vw, 16px);
  color: var(--text3);
  font-weight: 300;
}

.lap-row.best .lap-split {
  color: var(--accent2);
}
.lap-row.worst .lap-split {
  color: var(--danger);
}

/* ══════════════════════════════════════════
   TIMER TAB
══════════════════════════════════════════ */
.timer-panel-inner {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: clamp(16px, 4vw, 28px) 20px 0;
}

.timer-presets {
  display: flex;
  gap: 10px;
  margin-bottom: clamp(20px, 5vw, 28px);
}

.preset-btn {
  flex: 1;
  background: var(--bg2);
  border: 1px solid var(--sep);
  border-radius: 12px;
  color: var(--text2);
  font-family: var(--font);
  font-size: clamp(13px, 3.5vw, 15px);
  font-weight: 500;
  padding: 12px 8px;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s, color 0.15s;
  min-height: 48px;
}
.preset-btn:hover {
  background: var(--bg3);
}
.preset-btn:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}
.preset-btn.active {
  background: var(--accent);
  border-color: var(--accent);
  color: #000;
  font-weight: 600;
}

/* Custom input wheels */
.timer-inputs {
  display: flex;
  gap: 6px;
  align-items: center;
  margin-bottom: clamp(20px, 5vw, 28px);
}

.time-unit {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
}

.time-spinner {
  width: clamp(72px, 18vw, 84px);
  height: clamp(56px, 13vw, 64px);
  background: var(--bg2);
  border: 1px solid var(--sep);
  border-radius: 12px;
  color: var(--text);
  font-family: var(--font);
  font-size: clamp(22px, 6vw, 28px);
  font-weight: 300;
  text-align: center;
  padding: 0;
  -moz-appearance: textfield;
  font-variant-numeric: tabular-nums;
  cursor: pointer;
  transition: border-color 0.15s;
}
.time-spinner::-webkit-inner-spin-button,
.time-spinner::-webkit-outer-spin-button {
  -webkit-appearance: none;
}
.time-spinner:focus {
  outline: 2px solid var(--accent);
  border-color: var(--accent);
}
.time-spinner:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.time-label {
  font-size: clamp(10px, 2.8vw, 12px);
  color: var(--text4);
  font-weight: 500;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.time-sep {
  font-size: clamp(24px, 7vw, 32px);
  font-weight: 200;
  color: var(--text3);
  padding-bottom: clamp(16px, 4vw, 24px);
  align-self: flex-end;
}

/* SVG Ring */
.timer-ring-wrap {
  position: relative;
  width: clamp(200px, 54vw, 240px);
  height: clamp(200px, 54vw, 240px);
  margin: 0 auto clamp(20px, 5vw, 28px);
  flex-shrink: 0;
}

.timer-ring-svg {
  width: 100%;
  height: 100%;
  transform: rotate(-90deg);
  overflow: visible;
}

.ring-track {
  fill: none;
  stroke: var(--bg3);
  stroke-width: 8;
}

.ring-progress {
  fill: none;
  stroke: var(--accent);
  stroke-width: 8;
  stroke-linecap: round;
  transition: stroke-dashoffset 0.25s linear, stroke 0.3s;
}

@media (prefers-reduced-motion: reduce) {
  .ring-progress {
    transition: none;
  }
}

.timer-center-text {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  pointer-events: none;
}

.timer-countdown {
  font-size: clamp(36px, 10vw, 48px);
  font-weight: 200;
  color: var(--text);
  font-variant-numeric: tabular-nums;
  letter-spacing: -2px;
}

.timer-status {
  font-size: clamp(11px, 3vw, 13px);
  color: var(--text3);
  font-weight: 500;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  margin-top: 4px;
}

.timer-ring-wrap.flashing .timer-countdown {
  animation: flash 0.5s ease-in-out infinite;
}

@keyframes flash {
  0%,
  100% {
    opacity: 1;
  }
  50% {
    opacity: 0.2;
  }
}

@media (prefers-reduced-motion: reduce) {
  .timer-ring-wrap.flashing .timer-countdown {
    animation: none;
    color: var(--accent);
  }
}

.timer-buttons {
  display: flex;
  gap: 16px;
}

.timer-ring-wrap.flashing .ring-progress {
  stroke: var(--accent2);
}

/* ── Shared empty-state ── */
.empty-hint {
  text-align: center;
  color: var(--text3);
  font-size: clamp(12px, 3.2vw, 14px);
  padding: 24px 20px;
}

/* ── Focus ring global ── */
:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

/* ── Reduced motion ── */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
  }
}

/* ── Responsive tweaks ── */
@media (max-width: 360px) {
  .sw-buttons {
    gap: 12px;
  }
  .timer-inputs {
    gap: 4px;
  }
}
