/* ─── Reset & Base ────────────────────────────────────────────────────────── */
*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

:root {
  --bg: #0a0c14;
  --surface: rgba(255, 255, 255, 0.04);
  --surface-hover: rgba(255, 255, 255, 0.08);
  --border: rgba(255, 255, 255, 0.08);
  --text: #e8eaf0;
  --text-muted: #6b7280;
  --accent: #7c6bff;
  --accent-2: #ff6b9d;
  --green: #22d3a5;
  --green-glow: rgba(34, 211, 165, 0.25);
  --orange: #fb923c;
  --radius-card: 24px;
  --radius-btn: 14px;
  --shadow-card: 0 20px 60px rgba(0, 0, 0, 0.5);
  --font-mono: "JetBrains Mono", monospace;
  --font-sans: "Inter", sans-serif;
  --transition: 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

html {
  font-size: 16px;
}

body {
  min-height: 100vh;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-sans);
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
  position: relative;
}

/* ─── Background Orbs ─────────────────────────────────────────────────────── */
.bg-orb {
  position: fixed;
  border-radius: 50%;
  filter: blur(80px);
  opacity: 0.18;
  pointer-events: none;
  animation: orb-drift 12s ease-in-out infinite alternate;
}
.orb-1 {
  width: 500px;
  height: 500px;
  background: var(--accent);
  top: -150px;
  left: -150px;
  animation-delay: 0s;
}
.orb-2 {
  width: 400px;
  height: 400px;
  background: var(--accent-2);
  bottom: -100px;
  right: -100px;
  animation-delay: -4s;
}
.orb-3 {
  width: 300px;
  height: 300px;
  background: var(--green);
  top: 40%;
  left: 50%;
  transform: translate(-50%, -50%);
  animation-delay: -8s;
  opacity: 0.08;
}

@keyframes orb-drift {
  from {
    transform: translate(0, 0) scale(1);
  }
  to {
    transform: translate(30px, 20px) scale(1.05);
  }
}
.orb-3 {
  animation-name: orb-drift-center;
}
@keyframes orb-drift-center {
  from {
    transform: translate(-50%, -50%) scale(1);
  }
  to {
    transform: translate(calc(-50% + 20px), calc(-50% + 15px)) scale(1.08);
  }
}

/* ─── Layout ──────────────────────────────────────────────────────────────── */
main {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 40px 20px 60px;
  gap: 40px;
  position: relative;
  z-index: 1;
}

/* ─── Header ──────────────────────────────────────────────────────────────── */
.site-header {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 20px;
  width: 100%;
  max-width: 760px;
}

.logo {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 1.6rem;
  letter-spacing: -0.02em;
}
.logo-icon {
  font-size: 1.8rem;
}
.logo-text {
  color: var(--text-muted);
  font-weight: 300;
}
.logo-text strong {
  color: var(--text);
  font-weight: 700;
}

/* ─── Both-completed Banner ───────────────────────────────────────────────── */
.both-badge {
  display: flex;
  align-items: center;
  gap: 10px;
  background: linear-gradient(
    135deg,
    rgba(34, 211, 165, 0.15),
    rgba(124, 107, 255, 0.15)
  );
  border: 1px solid rgba(34, 211, 165, 0.35);
  border-radius: 50px;
  padding: 10px 24px;
  font-weight: 600;
  font-size: 0.95rem;
  color: var(--green);
  opacity: 0;
  transform: translateY(-8px);
  transition:
    opacity var(--transition),
    transform var(--transition);
  pointer-events: none;
  white-space: nowrap;
}
.both-badge.visible {
  opacity: 1;
  transform: translateY(0);
  pointer-events: auto;
}
.both-badge__icon {
  font-size: 1.2rem;
}

/* ─── Timers Grid ─────────────────────────────────────────────────────────── */
.timers-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 28px;
  width: 100%;
  max-width: 760px;
}

/* ─── Timer Card ──────────────────────────────────────────────────────────── */
.timer-card {
  position: relative;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-card);
  padding: 32px 28px 28px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 28px;
  box-shadow: var(--shadow-card);
  backdrop-filter: blur(20px);
  transition:
    border-color var(--transition),
    box-shadow var(--transition);
  overflow: hidden;
}
.timer-card:hover {
  border-color: rgba(255, 255, 255, 0.14);
  box-shadow: 0 24px 80px rgba(0, 0, 0, 0.6);
}
.timer-card.running {
  border-color: rgba(124, 107, 255, 0.4);
  box-shadow:
    var(--shadow-card),
    0 0 40px rgba(124, 107, 255, 0.12);
}
.timer-card.done {
  border-color: rgba(34, 211, 165, 0.4);
  box-shadow:
    var(--shadow-card),
    0 0 40px var(--green-glow);
}

/* ─── Card Header ─────────────────────────────────────────────────────────── */
.timer-card__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
}
.timer-card__title {
  font-size: 1.1rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--text-muted);
}

/* ─── Status Badge ────────────────────────────────────────────────────────── */
.status-badge {
  display: flex;
  align-items: center;
  gap: 7px;
  font-size: 0.8rem;
  font-weight: 500;
  color: var(--text-muted);
  background: rgba(255, 255, 255, 0.05);
  padding: 5px 12px;
  border-radius: 20px;
  border: 1px solid var(--border);
  transition: all var(--transition);
}
.status-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--text-muted);
  transition:
    background var(--transition),
    box-shadow var(--transition);
}

/* Running state */
.status-badge.running {
  color: var(--accent);
  border-color: rgba(124, 107, 255, 0.35);
  background: rgba(124, 107, 255, 0.1);
}
.status-badge.running .status-dot {
  background: var(--accent);
  box-shadow: 0 0 8px var(--accent);
  animation: pulse 1.2s ease-in-out infinite;
}

/* Done state */
.status-badge.done {
  color: var(--green);
  border-color: rgba(34, 211, 165, 0.35);
  background: rgba(34, 211, 165, 0.1);
}
.status-badge.done .status-dot {
  background: var(--green);
  box-shadow: 0 0 8px var(--green);
}

@keyframes pulse {
  0%,
  100% {
    transform: scale(1);
    opacity: 1;
  }
  50% {
    transform: scale(1.4);
    opacity: 0.7;
  }
}

/* ─── Timer Display ───────────────────────────────────────────────────────── */
.timer-display {
  position: relative;
  width: 160px;
  height: 160px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.timer-digits {
  position: absolute;
  font-family: var(--font-mono);
  font-size: 2.1rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  color: var(--text);
  transition: color var(--transition);
  z-index: 1;
}
.timer-card.done .timer-digits {
  color: var(--green);
}

/* Ring SVG */
.timer-ring {
  width: 100%;
  height: 100%;
  transform: rotate(-90deg);
}
.timer-ring__track {
  fill: none;
  stroke: rgba(255, 255, 255, 0.06);
  stroke-width: 8;
}
.timer-ring__progress {
  fill: none;
  stroke: var(--accent);
  stroke-width: 8;
  stroke-linecap: round;
  transition: stroke var(--transition);
  filter: drop-shadow(0 0 6px rgba(124, 107, 255, 0.6));
}
.timer-card.done .timer-ring__progress {
  stroke: var(--green);
  filter: drop-shadow(0 0 8px rgba(34, 211, 165, 0.7));
}

/* ─── Controls ────────────────────────────────────────────────────────────── */
.timer-controls {
  display: flex;
  gap: 12px;
  width: 100%;
}

/* Single-mode: nur 1 Button gleichzeitig, zentriert & volle Breite */
.timer-controls--single {
  justify-content: center;
  position: relative;
  min-height: 50px; /* verhindert Layout-Sprung beim Wechsel */
}
.btn {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 13px 18px;
  border: none;
  border-radius: var(--radius-btn);
  font-family: var(--font-sans);
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--transition);
  letter-spacing: 0.02em;
}

/* Im Single-Mode: volle Breite, nicht flex:1 */
.timer-controls--single .btn {
  flex: initial;
  width: 100%;
}

/* Einblend-Animation – wird per JS-Klasse einmalig gesetzt */
.btn--appear {
  animation: btn-appear 0.22s cubic-bezier(0.4, 0, 0.2, 1) both;
}

@keyframes btn-appear {
  from {
    opacity: 0;
    transform: translateY(6px) scale(0.96);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}
.btn:not(:disabled):hover {
  transform: translateY(-2px);
}
.btn:not(:disabled):active {
  transform: translateY(0);
}

.btn--start {
  background: linear-gradient(135deg, var(--accent), #a855f7);
  color: #fff;
  box-shadow: 0 4px 20px rgba(124, 107, 255, 0.4);
}
.btn--start:hover {
  box-shadow: 0 8px 30px rgba(124, 107, 255, 0.55);
}

.btn--stop {
  background: linear-gradient(135deg, #f97316, #ef4444);
  color: #fff;
  box-shadow: 0 4px 20px rgba(249, 115, 22, 0.35);
  border: none;
}
.btn--stop:hover {
  box-shadow: 0 8px 30px rgba(249, 115, 22, 0.5);
}

.btn__icon {
  font-size: 0.85rem;
}

/* ─── Completed Overlay ───────────────────────────────────────────────────── */
.completed-overlay {
  position: absolute;
  inset: 0;
  background: linear-gradient(
    135deg,
    rgba(22, 163, 74, 0.12),
    rgba(34, 211, 165, 0.1)
  );
  border-radius: var(--radius-card);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--transition);
  z-index: 5;
}
.timer-card.done .completed-overlay {
  opacity: 1;
}

.completed-check {
  font-size: 3.5rem;
  line-height: 1;
  filter: drop-shadow(0 0 16px var(--green));
  animation: pop-in 0.4s cubic-bezier(0.4, 0, 0.2, 1) both;
}
.completed-text {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--green);
  text-shadow: 0 0 20px var(--green);
  animation: pop-in 0.4s 0.1s cubic-bezier(0.4, 0, 0.2, 1) both;
}
@keyframes pop-in {
  from {
    opacity: 0;
    transform: scale(0.7) translateY(10px);
  }
  to {
    opacity: 1;
    transform: scale(1) translateY(0);
  }
}

/* ─── Streak / Stats Footer ───────────────────────────────────────────────── */
.streak-footer {
  width: 100%;
  max-width: 760px;
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 16px;
}
.streak-card {
  display: flex;
  align-items: center;
  gap: 18px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 20px 36px;
  backdrop-filter: blur(20px);
  box-shadow: var(--shadow-card);
  min-width: 280px;
  justify-content: center;
}
.streak-icon {
  font-size: 2.4rem;
  line-height: 1;
  animation: flame 1.8s ease-in-out infinite alternate;
}
@keyframes flame {
  from {
    transform: scale(1) rotate(-3deg);
  }
  to {
    transform: scale(1.08) rotate(3deg);
  }
}
.streak-info {
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.streak-number {
  font-size: 2.8rem;
  font-weight: 900;
  font-family: var(--font-mono);
  background: linear-gradient(135deg, var(--orange), var(--accent-2));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  line-height: 1;
}
.streak-label {
  font-size: 0.82rem;
  color: var(--text-muted);
  font-weight: 500;
  letter-spacing: 0.03em;
}

/* Countdown-Karte: blaue Akzentfarbe */
.countdown-card .streak-number {
  background: linear-gradient(135deg, #38bdf8, var(--accent));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}
.countdown-card .streak-icon {
  animation: none; /* kein Wackeln beim Kalender */
}

/* ─── Responsive ──────────────────────────────────────────────────────────── */
@media (max-width: 500px) {
  .timer-card {
    padding: 24px 18px 20px;
  }
  .timers-grid {
    grid-template-columns: 1fr;
  }
  .streak-card {
    padding: 16px 24px;
  }
}
