/**
 * uhr.css — Uhrzeit, Stoppuhr, Timer, Wecker.
 * Ruhiges Single-Stage-Layout. Tokens aus tokens.css.
 * Prinzip: viel Weißraum, große Typografie, feine Linien statt Kästen.
 */

/* ════════════════════════════════════════════
   HERO — Kicker + dezente Ansichts-Umschaltung
   ════════════════════════════════════════════ */
.uhr-hero {
  background: #fff;
  padding: clamp(1.6rem, 3.4vw, 2.6rem) 0 clamp(1rem, 2vw, 1.4rem);
  text-align: center;
}
.uhr-kicker {
  font-family: 'Inter', sans-serif;
  font-size: 0.74rem;
  font-weight: 700;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--pri);
  margin: 0 0 0.9rem;
}

.uhr-modes {
  position: relative;
  display: inline-flex;
  gap: clamp(0.4rem, 2vw, 1.4rem);
  padding-bottom: 0.55rem;
}
.uhr-mode {
  font-family: 'Sora', sans-serif;
  font-weight: 700;
  font-size: clamp(1rem, 2.6vw, 1.35rem);
  letter-spacing: -0.01em;
  color: var(--muted);
  padding: 0.2rem 0.3rem;
  background: none;
  border: none;
  cursor: pointer;
  transition: color 0.25s var(--ease-out);
}
.uhr-mode:hover { color: var(--text2); }
.uhr-mode.is-active { color: var(--text); }
/* Gleitender Aktiv-Strich unter dem gewählten Reiter.
   Nur `transform` wird animiert (scaleX statt width) — das ist robust und
   GPU-beschleunigt; eine width-Transition bleibt in manchen Browsern am
   Startwert 0 hängen. Basisbreite 1px, JS skaliert auf die Tab-Breite. */
.uhr-mode-ink {
  position: absolute;
  bottom: 0;
  left: 0;
  height: 2px;
  width: 1px;
  background: var(--pri);
  border-radius: 2px;
  transform: translateX(0) scaleX(0);
  transform-origin: left center;
  transition: transform 0.4s var(--ease-out);
  pointer-events: none;
}

/* ════════════════════════════════════════════
   STAGE — getönte, oben abgerundete Fläche
   ════════════════════════════════════════════ */
.uhr-stage-section {
  background: var(--bg);
  border-top-left-radius: var(--r3);
  border-top-right-radius: var(--r3);
  padding: clamp(2rem, 5vw, 4rem) 0 clamp(3rem, 7vw, 5.5rem);
  box-shadow: 0 -22px 60px rgba(15, 42, 74, 0.07);
  position: relative;
}
.uhr-stage {
  position: relative;
  min-height: clamp(24rem, 52vh, 34rem);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  font-family: 'Inter', sans-serif;
  color: var(--text);
  -webkit-user-select: none;
  user-select: none;
}

/* Vollbild-Knopf oben rechts */
.uhr-fs {
  position: absolute;
  top: 0;
  right: 0;
  width: 42px;
  height: 42px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 12px;
  color: var(--sub);
  background: transparent;
  border: 1px solid transparent;
  transition: color 0.2s, background 0.2s, border-color 0.2s, transform 0.2s;
}
.uhr-fs:hover {
  color: var(--pri);
  background: var(--card);
  border-color: var(--border);
  transform: translateY(-1px);
}
.uhr-fs .uhr-fs-close { display: none; }

/* ── PANELS ── */
.uhr-panel {
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: clamp(1.4rem, 3vw, 2.2rem);
}
.uhr-panel[hidden] { display: none; }

/* ════════════════════════════════════════════
   DIGITAL-ANZEIGE (Uhr, Stoppuhr, Timer teilen sie)
   ════════════════════════════════════════════ */
.uhr-digital {
  font-family: 'Inter', sans-serif;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  font-feature-settings: 'tnum' 1, 'ss01' 1;
  letter-spacing: -0.02em;
  line-height: 1;
  color: var(--text);
  display: flex;
  align-items: baseline;
  justify-content: center;
}
.uhr-digital .uhr-time {
  font-size: clamp(3rem, 13vw, 8.5rem);
}
.uhr-digital .uhr-frac {
  font-size: clamp(1.4rem, 5vw, 3rem);
  font-weight: 600;
  color: var(--pri3);
  letter-spacing: -0.01em;
  margin-left: 0.08em;
  /* feste Breite reservieren, damit nichts springt (max 4 Zeichen: .000) */
  min-width: 2.4ch;
  text-align: left;
}
.uhr-digital.uhr-big .uhr-time { font-size: clamp(2.8rem, 12vw, 7rem); }
.uhr-digital.uhr-big .uhr-frac { font-size: clamp(1.3rem, 5vw, 2.6rem); }

/* ── ANALOG ── */
.uhr-analog {
  width: clamp(15rem, 42vw, 22rem);
  height: clamp(15rem, 42vw, 22rem);
  overflow: visible;
}
.uhr-analog[hidden] { display: none; }
.uhr-analog .an-face { fill: var(--card); stroke: var(--border2); stroke-width: 1.5; }
.uhr-analog .an-tick { stroke: var(--muted); stroke-width: 1; stroke-linecap: round; }
.uhr-analog .an-tick.big { stroke: var(--text2); stroke-width: 2.4; }
.uhr-analog .an-hand-h { stroke: var(--text); stroke-width: 5; stroke-linecap: round; }
.uhr-analog .an-hand-m { stroke: var(--pri); stroke-width: 3.4; stroke-linecap: round; }
.uhr-analog .an-hand-s { stroke: var(--acc); stroke-width: 1.6; stroke-linecap: round; }
.uhr-analog .an-cap { fill: var(--text); }
.uhr-analog .an-cap-in { fill: var(--acc); }

/* ── WORT ── */
.uhr-wort {
  font-family: 'Sora', sans-serif;
  font-weight: 700;
  font-size: clamp(1.8rem, 6.5vw, 4rem);
  line-height: 1.15;
  letter-spacing: -0.02em;
  text-align: center;
  max-width: 15ch;
  color: var(--text);
}
.uhr-wort[hidden] { display: none; }
.uhr-wort .wt-lead { display: block; font-family: 'Inter', sans-serif; font-weight: 600; font-size: 0.34em; letter-spacing: 0.12em; text-transform: uppercase; color: var(--sub); margin-bottom: 0.5rem; }
.uhr-wort .wt-min { color: var(--pri); }

/* ── META (Datum + Zeitzone) ── */
.uhr-meta {
  display: flex;
  align-items: center;
  gap: 0.7rem;
  font-size: clamp(0.85rem, 2vw, 1rem);
  font-weight: 500;
  color: var(--sub);
}
.uhr-meta .uhr-dot { width: 4px; height: 4px; border-radius: 50%; background: var(--muted); }
.uhr-meta .uhr-tzlabel { color: var(--text2); font-weight: 600; }

/* ════════════════════════════════════════════
   STEUERLEISTE (Segmented Controls + Zeitzone)
   ════════════════════════════════════════════ */
.uhr-controls {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 0.7rem;
  margin-top: 0.2rem;
}
.uhr-seg {
  display: inline-flex;
  background: var(--card2);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 3px;
  gap: 2px;
}
.uhr-seg button {
  font-family: 'Inter', sans-serif;
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--sub);
  padding: 0.42rem 0.9rem;
  border-radius: 999px;
  background: none;
  border: none;
  cursor: pointer;
  white-space: nowrap;
  transition: color 0.2s, background 0.2s, box-shadow 0.2s;
}
.uhr-seg button:hover { color: var(--text2); }
.uhr-seg button.is-active {
  color: var(--pri);
  background: #fff;
  box-shadow: 0 2px 8px rgba(15, 42, 74, 0.08);
}

.uhr-tz {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  padding: 0 0.9rem 0 0.85rem;
  height: 38px;
  background: var(--card2);
  border: 1px solid var(--border);
  border-radius: 999px;
  color: var(--sub);
}
.uhr-tz svg { flex-shrink: 0; }
.uhr-tz select {
  font-family: 'Inter', sans-serif;
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--text2);
  background: none;
  border: none;
  cursor: pointer;
  padding: 0.3rem 0.1rem;
  max-width: 42vw;
}

/* ════════════════════════════════════════════
   AKTIONS-KNÖPFE (Stoppuhr/Timer/Wecker)
   ════════════════════════════════════════════ */
.uhr-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
  justify-content: center;
}
.uhr-btn {
  font-family: 'Inter', sans-serif;
  font-size: 0.92rem;
  font-weight: 600;
  padding: 0.7rem 1.6rem;
  border-radius: 999px;
  border: 1px solid var(--border2);
  background: var(--card);
  color: var(--text);
  cursor: pointer;
  transition: background 0.18s var(--ease-out), border-color 0.18s var(--ease-out),
              transform 0.15s var(--ease-out), box-shadow 0.2s var(--ease-out), color 0.18s;
}
.uhr-btn:hover { border-color: var(--pri3); transform: translateY(-1px); box-shadow: 0 6px 16px rgba(15, 42, 74, 0.08); }
.uhr-btn:active { transform: translateY(0) scale(0.97); }
.uhr-btn:disabled { opacity: 0.42; cursor: default; transform: none; box-shadow: none; border-color: var(--border); }
.uhr-btn.primary {
  background: linear-gradient(135deg, var(--pri), var(--pri2));
  color: #fff;
  border-color: transparent;
  box-shadow: 0 6px 18px rgba(26, 106, 170, 0.26);
}
.uhr-btn.primary:hover { box-shadow: 0 10px 26px rgba(26, 106, 170, 0.34); border-color: transparent; }
.uhr-btn.primary:disabled { box-shadow: none; }
.uhr-btn.ghost { background: transparent; border-color: var(--border2); color: var(--text2); }
.uhr-btn.running {
  background: linear-gradient(135deg, var(--warn), #e6952f);
  color: #fff;
  border-color: transparent;
  box-shadow: 0 6px 18px rgba(245, 166, 35, 0.28);
}

/* ── STOPPUHR: Rundenliste ── */
.uhr-laps {
  list-style: none;
  width: min(30rem, 100%);
  margin: 0;
  padding: 0;
  max-height: 12rem;
  overflow-y: auto;
}
.uhr-laps li {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  padding: 0.6rem 0.4rem;
  border-top: 1px solid var(--border);
  font-variant-numeric: tabular-nums;
}
.uhr-laps li:first-child { border-top: none; }
.uhr-laps .lap-nr { color: var(--sub); font-size: 0.85rem; font-weight: 600; }
.uhr-laps .lap-split { color: var(--muted); font-size: 0.82rem; }
.uhr-laps .lap-time { color: var(--text); font-weight: 700; font-size: 0.98rem; }
.uhr-laps li.best .lap-time { color: var(--acc); }
.uhr-laps li.worst .lap-time { color: var(--danger); }

/* ── TIMER: Eingabe ── */
.uhr-timeset { display: flex; flex-direction: column; align-items: center; gap: 1.4rem; }
.uhr-timeinput {
  display: inline-flex;
  align-items: flex-start;
  gap: 0.4rem;
  font-variant-numeric: tabular-nums;
}
.uhr-timeinput em { font-style: normal; font-size: clamp(2.4rem, 9vw, 4.5rem); font-weight: 700; color: var(--muted); line-height: 1; padding-top: 0.1em; }
.uhr-timeinput label { display: flex; flex-direction: column; align-items: center; gap: 0.4rem; }
.uhr-timeinput input {
  width: 2.1ch;
  font-family: 'Inter', sans-serif;
  font-size: clamp(2.8rem, 11vw, 5.5rem);
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  text-align: center;
  color: var(--text);
  background: none;
  border: none;
  border-bottom: 2px solid var(--border2);
  padding: 0 0.1rem 0.2rem;
  transition: border-color 0.2s;
  box-sizing: content-box;
}
.uhr-timeinput input:focus { border-color: var(--pri); }
.uhr-timeinput span { font-size: 0.72rem; font-weight: 700; letter-spacing: 0.1em; text-transform: uppercase; color: var(--muted); }
.uhr-presets { display: flex; flex-wrap: wrap; gap: 0.5rem; justify-content: center; }
.uhr-chip {
  font-family: 'Inter', sans-serif;
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--text2);
  padding: 0.4rem 0.9rem;
  border-radius: 999px;
  background: var(--card);
  border: 1px solid var(--border);
  cursor: pointer;
  transition: border-color 0.18s, color 0.18s, transform 0.15s;
}
.uhr-chip:hover { border-color: var(--pri3); color: var(--pri); transform: translateY(-1px); }

/* Timer-Fortschrittsbalken */
.uhr-timerbar {
  width: min(30rem, 80%);
  height: 4px;
  border-radius: 999px;
  background: var(--border);
  overflow: hidden;
}
.uhr-timerbar[hidden] { display: none; }
.uhr-timerbar span {
  display: block;
  height: 100%;
  width: 100%;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--pri), var(--pri3));
  transform-origin: left center;
  transition: transform 0.25s linear;
}
.uhr-digital.warn .uhr-time { color: var(--danger); }

/* ════════════════════════════════════════════
   WECKER
   ════════════════════════════════════════════ */
.uhr-alarm-add {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
  justify-content: center;
  align-items: center;
}
.uhr-alarm-add input[type="time"],
.uhr-alarm-add input[type="text"] {
  font-family: 'Inter', sans-serif;
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--text);
  background: var(--card);
  border: 1px solid var(--border2);
  border-radius: 12px;
  padding: 0.6rem 0.9rem;
  transition: border-color 0.2s;
}
.uhr-alarm-add input[type="time"] { font-variant-numeric: tabular-nums; }
.uhr-alarm-add input[type="text"] { width: min(16rem, 60vw); }
.uhr-alarm-add input:focus { border-color: var(--pri); }

.uhr-alarms { list-style: none; width: min(30rem, 100%); margin: 0; padding: 0; }
.uhr-alarm {
  display: flex;
  align-items: center;
  gap: 0.9rem;
  padding: 0.9rem 0.3rem;
  border-top: 1px solid var(--border);
}
.uhr-alarm:first-child { border-top: none; }
.uhr-alarm-time { font-size: 1.5rem; font-weight: 700; font-variant-numeric: tabular-nums; color: var(--text); line-height: 1; }
.uhr-alarm.off .uhr-alarm-time { color: var(--muted); }
.uhr-alarm-info { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 0.15rem; }
.uhr-alarm-label { font-size: 0.9rem; font-weight: 600; color: var(--text2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.uhr-alarm-next { font-size: 0.76rem; color: var(--sub); }
.uhr-alarm-del {
  width: 34px; height: 34px; border-radius: 10px;
  display: inline-flex; align-items: center; justify-content: center;
  color: var(--muted); border: 1px solid transparent; background: transparent;
  transition: color 0.2s, background 0.2s, border-color 0.2s;
}
.uhr-alarm-del:hover { color: var(--danger); background: var(--card); border-color: var(--border); }

/* Kleiner Schalter */
.uhr-switch {
  position: relative;
  width: 42px; height: 24px;
  border-radius: 999px;
  background: var(--border2);
  border: none;
  cursor: pointer;
  flex-shrink: 0;
  transition: background 0.22s var(--ease-out);
}
.uhr-switch::after {
  content: '';
  position: absolute;
  top: 2px; left: 2px;
  width: 20px; height: 20px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 1px 3px rgba(0,0,0,0.2);
  transition: transform 0.22s var(--ease-out);
}
.uhr-switch.on { background: var(--acc); }
.uhr-switch.on::after { transform: translateX(18px); }

.uhr-alarm-empty { font-size: 0.88rem; color: var(--sub); text-align: center; max-width: 26rem; margin: 0.4rem auto 0; }
.uhr-alarm-empty[hidden] { display: none; }

/* ════════════════════════════════════════════
   KLINGEL-OVERLAY
   ════════════════════════════════════════════ */
.uhr-ring {
  position: fixed;
  inset: 0;
  z-index: 300;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.4rem;
  background: rgba(15, 42, 74, 0.32);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  animation: uhrRingIn 0.25s var(--ease-out);
}
.uhr-ring[hidden] { display: none; }
@keyframes uhrRingIn { from { opacity: 0; } to { opacity: 1; } }
.uhr-ring-box {
  background: var(--card);
  border-radius: var(--r2);
  box-shadow: var(--shadow3);
  padding: clamp(1.8rem, 5vw, 2.8rem);
  text-align: center;
  max-width: 24rem;
  width: 100%;
}
.uhr-ring-icon {
  width: 66px; height: 66px;
  border-radius: 50%;
  display: inline-flex; align-items: center; justify-content: center;
  color: #fff;
  background: linear-gradient(135deg, var(--pri), var(--pri2));
  margin-bottom: 1.1rem;
  animation: uhrBell 1s ease-in-out infinite;
  transform-origin: 50% 8%;
}
@keyframes uhrBell {
  0%, 100% { transform: rotate(0); }
  25% { transform: rotate(11deg); }
  75% { transform: rotate(-11deg); }
}
.uhr-ring-title { font-family: 'Sora', sans-serif; font-weight: 800; font-size: 1.4rem; color: var(--text); margin: 0 0 0.3rem; }
.uhr-ring-sub { font-size: 0.95rem; color: var(--sub); margin: 0 0 1.4rem; min-height: 1.2em; }
.uhr-ring-actions { display: flex; gap: 0.6rem; justify-content: center; flex-wrap: wrap; }

/* ════════════════════════════════════════════
   GROSSE ANSICHT (Vollbild)
   ════════════════════════════════════════════ */
.uhr-stage-section:fullscreen,
.uhr-stage-section.is-fs {
  background: var(--bg);
  border-radius: 0;
  box-shadow: none;
  padding: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}
/* Fallback-Vollbild (auch ohne Fullscreen-API): deckt das Fenster ab */
.uhr-stage-section.is-fs {
  position: fixed;
  inset: 0;
  z-index: 200;
  overflow: auto;
}
.uhr-stage-section:fullscreen .wrap,
.uhr-stage-section.is-fs .wrap { max-width: none; width: 100%; }
.uhr-stage-section:fullscreen .uhr-stage,
.uhr-stage-section.is-fs .uhr-stage { min-height: 100vh; }

/* Uhr im Vollbild deutlich größer */
.uhr-stage-section:fullscreen .uhr-digital .uhr-time,
.uhr-stage-section.is-fs .uhr-digital .uhr-time { font-size: clamp(4rem, 17vw, 16rem); }
.uhr-stage-section:fullscreen .uhr-digital .uhr-frac,
.uhr-stage-section.is-fs .uhr-digital .uhr-frac { font-size: clamp(1.8rem, 6vw, 5rem); }
.uhr-stage-section:fullscreen .uhr-analog,
.uhr-stage-section.is-fs .uhr-analog { width: min(70vh, 80vw); height: min(70vh, 80vw); }
.uhr-stage-section:fullscreen .uhr-wort,
.uhr-stage-section.is-fs .uhr-wort { font-size: clamp(2.6rem, 9vw, 7rem); max-width: 18ch; }
.uhr-stage-section:fullscreen .uhr-fs .uhr-fs-open,
.uhr-stage-section.is-fs .uhr-fs .uhr-fs-open { display: none; }
.uhr-stage-section:fullscreen .uhr-fs .uhr-fs-close,
.uhr-stage-section.is-fs .uhr-fs .uhr-fs-close { display: block; }

/* Steuerleiste im Vollbild ausblendbar (bei Ruhe) */
.uhr-stage-section.is-fs.idle .uhr-controls,
.uhr-stage-section.is-fs.idle .uhr-meta,
.uhr-stage-section.is-fs.idle .uhr-fs {
  opacity: 0;
  transition: opacity 0.5s ease;
  pointer-events: none;
}
.uhr-stage-section.is-fs .uhr-controls,
.uhr-stage-section.is-fs .uhr-meta,
.uhr-stage-section.is-fs .uhr-fs { transition: opacity 0.3s ease; }

/* ════════════════════════════════════════════
   MOBILE-FEINTUNING
   ════════════════════════════════════════════ */
@media (max-width: 560px) {
  .uhr-modes { gap: 0.7rem; }
  .uhr-controls { gap: 0.5rem; }
  .uhr-seg button { padding: 0.4rem 0.7rem; font-size: 0.78rem; }
  .uhr-alarm-add input[type="text"] { width: 100%; }
  .uhr-btn { padding: 0.65rem 1.3rem; }
}
