/* ── Clock / Stopwatch / Timer ── */

/* ── Segment spacing fix ── */
.flip-clock { gap: 4px; }
.fs-digit-group { display: flex; gap: 4px; }


#page-clock { display: flex; flex-direction: column; }

.clock-toolbar {
  align-items: center; display: flex; justify-content: space-between;
  margin-bottom: 20px; flex-wrap: wrap; gap: 12px;
}
.clock-tabs {
  display: flex; background: var(--bg-2); border: 1px solid var(--border);
  border-radius: 50px; padding: 4px; gap: 2px;
}
.clock-tab {
  align-items: center; background: none; border: none; border-radius: 50px;
  color: var(--text-muted); cursor: pointer; display: flex; font-size: 13px;
  font-weight: 600; gap: 6px; padding: 8px 18px; transition: all .2s; white-space: nowrap;
}
.clock-tab svg { width: 14px; height: 14px; }
.clock-tab.active { background: var(--accent); color: #fff; box-shadow: 0 2px 10px var(--accent-glow); }
.clock-panel { width: 100%; }

/* ══ Flip Clock ══ */
.flip-clock-wrap {
  align-items: center; border-radius: var(--radius); display: flex; flex-direction: column;
  justify-content: center; min-height: 280px; padding: 48px 32px; margin-bottom: 16px;
  background: #1a2235; transition: background .5s ease; position: relative; overflow: hidden;
}
body:not(.dark) .flip-clock-wrap {
  background: #1e2b3e;
}
.flip-clock-wrap::after {
  content: ''; position: absolute; inset: 0; pointer-events: none;
  background: radial-gradient(ellipse at 50% 0%, rgba(99,102,241,.2), transparent 60%);
}

.flip-clock {
  align-items: center; display: flex; gap: 6px; position: relative; z-index: 1;
}
.flip-sep {
  color: rgba(255,255,255,.45); font-family: var(--font-mono);
  font-size: 64px; font-weight: 700; line-height: 1; margin: 0 2px;
  padding-bottom: 8px; user-select: none;
}

/* Digit card — single face, no doubling */
.flip-digit {
  align-items: center; background: #253045; border-radius: 12px;
  box-shadow: 0 6px 20px rgba(0,0,0,0.5), inset 0 1px 0 rgba(255,255,255,0.06);
  border: 1px solid rgba(255,255,255,0.07); display: flex; height: 96px; width: 68px;
  justify-content: center; position: relative; overflow: hidden;
}
/* Horizontal divider line (purely decorative) */
.flip-digit::after {
  content: ''; position: absolute; left: 0; right: 0; top: 50%;
  height: 1px; background: rgba(0,0,0,0.4); z-index: 2;
}
.fd-num {
  color: #f1f5f9; font-family: var(--font-mono); font-size: 56px;
  font-weight: 700; line-height: 1; user-select: none;
  text-shadow: 0 2px 8px rgba(0,0,0,0.4);
}

/* Flip animation — scale on Y axis, no doubling */
.flip-digit.flipping { animation: flipDigit .3s ease; }
@keyframes flipDigit {
  0%  { transform: scaleY(1); }
  40% { transform: scaleY(0.05) perspective(200px) rotateX(8deg); }
  60% { transform: scaleY(0.05) perspective(200px) rotateX(-8deg); }
  100%{ transform: scaleY(1); }
}

.clock-date-display {
  color: rgba(255,255,255,.55); font-size: 14px; font-weight: 500;
  letter-spacing: .5px; margin-top: 18px; position: relative; z-index: 1;
}

/* Background picker */
.bg-picker {
  align-items: center; background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius-sm); display: flex; flex-wrap: wrap;
  gap: 12px; padding: 12px 16px;
}
.bg-picker-label { font-size: 13px; font-weight: 600; color: var(--text-muted); white-space: nowrap; }
.bg-swatches { display: flex; gap: 8px; flex-wrap: wrap; }
.bg-swatch {
  border-radius: 50%; cursor: pointer; height: 28px; width: 28px;
  border: 2px solid var(--border-strong); transition: transform .15s, border-color .15s;
  flex-shrink: 0;
}
.bg-swatch:hover { transform: scale(1.15); border-color: var(--accent); }
.bg-swatch.active { border-color: var(--accent); transform: scale(1.12); box-shadow: 0 0 0 3px var(--accent-glow); }

/* ══ Stopwatch ══ */
.sw-display {
  align-items: center; background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); box-shadow: var(--shadow-sm);
  display: flex; flex-direction: column; justify-content: center;
  margin-bottom: 18px; padding: 36px; text-align: center;
}
.sw-time {
  font-family: var(--font-mono); font-size: 64px; font-weight: 700;
  letter-spacing: -2px; line-height: 1; color: var(--accent);
}
body.dark .sw-time {
  background: linear-gradient(135deg, #c7d2fe, #a78bfa);
  -webkit-background-clip: text; -webkit-text-fill-color: transparent; background-clip: text;
}
.sw-controls { display: flex; gap: 12px; justify-content: center; margin-bottom: 18px; flex-wrap: wrap; }

.laps-wrap { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; }
.laps-table { border-collapse: collapse; width: 100%; }
.laps-table th {
  background: var(--bg-2); border-bottom: 1px solid var(--border); color: var(--text-muted);
  font-size: 12px; font-weight: 600; letter-spacing: .5px; padding: 11px 16px; text-align: left; text-transform: uppercase;
}
.laps-table td { border-bottom: 1px solid var(--border); font-family: var(--font-mono); font-size: 14px; padding: 11px 16px; }
.laps-table tbody tr:last-child td { border-bottom: none; }
.laps-table tbody tr:first-child td { color: var(--accent); font-weight: 600; }

/* ══ Countdown Timer ══ */
.timer-set-row { align-items: center; display: flex; gap: 8px; justify-content: center; margin-bottom: 18px; }
.timer-input {
  background: var(--surface); border: 1px solid var(--border-strong); border-radius: var(--radius-sm);
  color: var(--text); font-family: var(--font-mono); font-size: 30px; font-weight: 700;
  padding: 10px; text-align: center; width: 86px;
}
.timer-input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-glow); }
.timer-sep { font-family: var(--font-mono); font-size: 30px; font-weight: 700; color: var(--text-muted); }
.timer-status { color: var(--text-muted); font-size: 14px; font-weight: 500; margin-top: 8px; }

/* ══ FULLSCREEN OVERLAY ══ */
.fs-overlay {
  position: fixed; inset: 0; z-index: 999;
  display: flex; flex-direction: column;
  font-family: var(--font);
}
.fs-background {
  position: absolute; inset: 0;
  background: linear-gradient(135deg,#0d1b2a,#1a2a3a);
  transition: background .4s ease;
  z-index: 0;
}

/* FS Top bar */
.fs-topbar {
  align-items: center; backdrop-filter: blur(12px); background: rgba(0,0,0,.4);
  border-bottom: 1px solid rgba(255,255,255,.1); display: flex;
  justify-content: space-between; padding: 10px 20px;
  position: relative; z-index: 2; flex-wrap: wrap; gap: 10px;
}
.fs-tabs { display: flex; gap: 4px; }
.fs-tab {
  align-items: center; background: none; border: 1px solid rgba(255,255,255,.15);
  border-radius: 50px; color: rgba(255,255,255,.6); cursor: pointer; display: flex;
  font-family: var(--font); font-size: 13px; font-weight: 600; gap: 6px;
  padding: 7px 16px; transition: all .2s;
}
.fs-tab svg { width: 14px; height: 14px; }
.fs-tab:hover { background: rgba(255,255,255,.1); color: #fff; }
.fs-tab.active { background: var(--accent); border-color: var(--accent); color: #fff; box-shadow: 0 2px 12px rgba(99,102,241,.4); }
.fs-topbar-right { display: flex; align-items: center; gap: 12px; }
.fs-close-btn {
  align-items: center; background: rgba(255,255,255,.12); border: 1px solid rgba(255,255,255,.2);
  border-radius: var(--radius-sm); color: rgba(255,255,255,.85); cursor: pointer; display: flex;
  font-family: var(--font); font-size: 13px; font-weight: 600; gap: 7px;
  padding: 8px 14px; transition: all .2s; white-space: nowrap;
}
.fs-close-btn:hover { background: rgba(255,255,255,.2); color: #fff; }
.fs-close-btn svg { width: 14px; height: 14px; }
.fs-esc-hint {
  background: rgba(255,255,255,.15); border-radius: 4px; font-size: 11px;
  padding: 2px 6px; letter-spacing: .3px;
}

/* FS Panels */
.fs-panel {
  align-items: center; display: flex; flex: 1; flex-direction: column;
  justify-content: center; gap: 24px; padding: 28px 24px;
  position: relative; z-index: 1;
}

/* FS: Flip Clock */
.fs-flip-clock {
  align-items: center; display: flex; gap: 16px;
}
.fs-sep {
  color: rgba(255,255,255,.4); font-family: var(--font-mono);
  font-size: 96px; font-weight: 700; line-height: 1;
  padding-bottom: 10px; user-select: none;
}
.fs-flip-digit {
  width: 110px !important; height: 155px !important; border-radius: 16px !important;
  background: rgba(255,255,255,.08) !important;
  border: 1px solid rgba(255,255,255,.12) !important;
}
.fs-flip-digit .fd-num {
  font-size: 90px !important;
}
.fs-date {
  color: rgba(255,255,255,.55); font-size: 17px; font-weight: 500; letter-spacing: .5px;
}

/* FS: Big time display */
.fs-big-time {
  color: #fff; font-family: var(--font-mono); font-size: 100px;
  font-weight: 700; letter-spacing: -4px; line-height: 1;
  text-shadow: 0 4px 24px rgba(0,0,0,.5);
}
.fs-status {
  color: rgba(255,255,255,.6); font-size: 18px; font-weight: 500; letter-spacing: .3px;
}
.fs-controls { display: flex; gap: 14px; flex-wrap: wrap; justify-content: center; }
.fs-controls .btn-large { font-size: 17px; padding: 15px 32px; }
.fs-controls .btn-ghost { border-color: rgba(255,255,255,.25); color: rgba(255,255,255,.8); background: rgba(255,255,255,.08); }
.fs-controls .btn-ghost:hover { background: rgba(255,255,255,.18); color: #fff; border-color: rgba(255,255,255,.4); }

/* FS: Timer inputs */
.fs-timer-inputs { display: flex; align-items: center; gap: 12px; }
.fs-timer-inp {
  background: rgba(255,255,255,.12) !important; border: 1px solid rgba(255,255,255,.2) !important;
  color: #fff !important; font-size: 36px !important; width: 100px !important;
  text-align: center; border-radius: 12px !important;
}
.fs-timer-inp::placeholder { color: rgba(255,255,255,.3); }

/* FS: Laps table */
.fs-laps-wrap {
  max-height: 180px; overflow-y: auto; background: rgba(255,255,255,.07);
  border: 1px solid rgba(255,255,255,.12); border-radius: 10px;
  width: min(500px, 90vw);
}
.fs-laps-wrap .laps-table th { background: rgba(255,255,255,.08); color: rgba(255,255,255,.6); }
.fs-laps-wrap .laps-table td { color: rgba(255,255,255,.85); border-color: rgba(255,255,255,.07); }

@media (max-width: 640px) {
  .flip-digit { width: 50px; height: 72px; border-radius: 8px; }
  .fd-num { font-size: 38px; }
  .flip-sep { font-size: 46px; }
  .sw-time { font-size: 44px; }
  .timer-input { font-size: 22px; width: 72px; }
  .fs-big-time { font-size: 56px; }
  .fs-flip-digit { width: 70px !important; height: 100px !important; }
  .fs-flip-digit .fd-num { font-size: 58px !important; }
  .fs-sep { font-size: 60px; }
}

