/* ===================================================
   주말 타이머 — Session-inspired Dark Minimal Design
   =================================================== */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800;900&display=swap');

:root {
  /* Core palette */
  --bg-primary: #0A0A0B;
  --bg-secondary: #111113;
  --bg-card: #18181B;
  --bg-card-hover: #1E1E22;
  --bg-elevated: #222226;
  --tabbar-bg: rgba(10, 10, 11, 0.92);

  /* Text */
  --text-primary: #F4F4F5;
  --text-secondary: #A1A1AA;
  --text-tertiary: #71717A;
  --text-muted: #52525B;

  /* Accent */
  --accent-red: #EF4444;
  --accent-red-soft: rgba(239, 68, 68, 0.15);
  --accent-red-glow: rgba(239, 68, 68, 0.08);
  --accent-orange: #F59E0B;
  --accent-orange-soft: rgba(245, 158, 11, 0.15);
  --accent-green: #22C55E;
  --accent-green-soft: rgba(34, 197, 94, 0.12);
  --accent-blue: #3B82F6;
  --accent-blue-soft: rgba(59, 130, 246, 0.12);

  /* Borders */
  --border-subtle: rgba(255, 255, 255, 0.06);
  --border-medium: rgba(255, 255, 255, 0.1);

  /* Shadows */
  --shadow-glow-red: 0 0 60px rgba(239, 68, 68, 0.08);
  --shadow-card: 0 1px 3px rgba(0, 0, 0, 0.4);

  /* Radius */
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --radius-xl: 20px;
  --radius-pill: 999px;

  /* Timer ring */
  --timer-size: 280px;
  --ring-stroke: 4px;
}

html[data-theme="light"] {
  color-scheme: light;
}

html[data-theme="light"] {
  --bg-primary: #F3F5F7;
  --bg-secondary: #F8FAFC;
  --bg-card: #FCFDFE;
  --bg-card-hover: #EEF2F6;
  --bg-elevated: #EDF1F5;
  --tabbar-bg: rgba(243, 245, 247, 0.92);
  --text-primary: #1F2937;
  --text-secondary: #5B6675;
  --text-tertiary: #8792A2;
  --text-muted: #A3ADBA;
  --border-subtle: rgba(31, 41, 55, 0.08);
  --border-medium: rgba(31, 41, 55, 0.14);
  --accent-red-soft: rgba(239, 68, 68, 0.12);
  --accent-red-glow: rgba(239, 68, 68, 0.06);
  --accent-orange-soft: rgba(245, 158, 11, 0.12);
  --accent-blue-soft: rgba(59, 130, 246, 0.1);
}

/* ─── Reset ─── */
* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  color-scheme: dark;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overscroll-behavior-y: contain;
}

body {
  min-height: 100vh;
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  font-size: 15px;
  line-height: 1.5;
  color: var(--text-primary);
  background: var(--bg-primary);
  transition: background 0.25s ease, color 0.25s ease;
  -webkit-tap-highlight-color: transparent;
}

button,
input {
  font: inherit;
  color: inherit;
}

button {
  border: 0;
  cursor: pointer;
  background: transparent;
}

input {
  width: 100%;
  border: 0;
  outline: 0;
  background: transparent;
}

input::placeholder {
  color: var(--text-muted);
}

[hidden] {
  display: none !important;
}

/* ─── Page Shell ─── */
.page-shell {
  width: min(100%, 420px);
  margin: 0 auto;
  padding: 16px 20px 110px;
  position: relative;
}

/* ─── Top Bar ─── */
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 0;
  margin-bottom: 8px;
}

.topbar h1 {
  font-size: 1.1rem;
  font-weight: 700;
  letter-spacing: -0.01em;
}

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

.theme-switch {
  position: relative;
  display: inline-flex;
  align-items: center;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

.theme-switch input {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
  pointer-events: none;
}

.theme-switch__track {
  width: 46px;
  height: 28px;
  padding: 2px;
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  transition: background 0.2s ease, border-color 0.2s ease,
    box-shadow 0.2s ease;
}

.theme-switch__thumb {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: linear-gradient(180deg, #1f2937 0%, #0f172a 100%);
  box-shadow: 0 4px 10px rgba(15, 23, 42, 0.28);
  transition: transform 0.2s ease, background 0.2s ease, box-shadow 0.2s ease;
}

.theme-switch input:checked + .theme-switch__track {
  background: rgba(245, 158, 11, 0.12);
  border-color: rgba(245, 158, 11, 0.28);
}

.theme-switch input:checked + .theme-switch__track .theme-switch__thumb {
  transform: translateX(18px);
  background: linear-gradient(180deg, #fef3c7 0%, #fbbf24 100%);
  box-shadow: 0 4px 10px rgba(245, 158, 11, 0.28);
}

.theme-switch input:focus-visible + .theme-switch__track {
  box-shadow: 0 0 0 3px rgba(245, 158, 11, 0.18);
}

/* ─── Eyebrow ─── */
.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-tertiary);
}

.eyebrow--blue {
  color: var(--accent-blue);
}

.eyebrow--orange {
  color: var(--accent-orange);
}

/* ─── Content Shell ─── */
.content-shell {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.panel {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

/* ─── Hero Card ─── */
.hero-card {
  padding: 20px;
  border-radius: var(--radius-lg);
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
}

.hero-card--muted {
  background: var(--bg-secondary);
}

.hero-card h2 {
  margin: 8px 0 0;
  font-size: 1.15rem;
  font-weight: 700;
  line-height: 1.35;
  letter-spacing: -0.02em;
}

.hero-copy {
  margin: 10px 0 0;
  font-size: 0.85rem;
  line-height: 1.6;
  color: var(--text-secondary);
}

.install-banner {
  display: flex;
  flex-direction: column;
  gap: 14px;
  padding: 18px;
  border-radius: var(--radius-lg);
  background:
    linear-gradient(180deg, rgba(59, 130, 246, 0.08), transparent 120px),
    var(--bg-card);
  border: 1px solid rgba(59, 130, 246, 0.18);
}

.install-banner__copy strong {
  display: block;
  margin-top: 6px;
  font-size: 0.98rem;
  font-weight: 700;
}

.install-banner__copy p:last-child {
  margin-top: 8px;
  font-size: 0.82rem;
  line-height: 1.55;
  color: var(--text-secondary);
}

.install-banner__actions {
  display: flex;
  gap: 8px;
}

.plan-card {
  padding: 18px;
  border-radius: var(--radius-lg);
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.plan-card__header,
.plan-card__meta {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.plan-card__header strong {
  display: block;
  margin-top: 4px;
  font-size: 0.98rem;
  font-weight: 700;
}

.plan-chip {
  min-width: 60px;
  padding: 8px 12px;
  border-radius: var(--radius-pill);
  background: var(--bg-elevated);
  border: 1px solid var(--border-subtle);
  text-align: center;
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--text-primary);
}

.plan-card__meta > div {
  flex: 1;
  padding: 12px 14px;
  border-radius: var(--radius-md);
  background: var(--bg-secondary);
  border: 1px solid var(--border-subtle);
}

.plan-card__meta span {
  display: block;
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-muted);
}

.plan-card__meta strong {
  display: block;
  margin-top: 6px;
  font-size: 0.95rem;
  font-weight: 700;
  line-height: 1.35;
}

/* ─── Timer Stage ─── */
.timer-stage {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 32px 20px;
  border-radius: var(--radius-xl);
  background: var(--bg-secondary);
  border: 1px solid var(--border-subtle);
  overflow: hidden;
}

.timer-stage::before {
  content: "";
  position: absolute;
  inset: 0;
  background: radial-gradient(
    circle at 50% 45%,
    var(--accent-red-glow) 0%,
    transparent 60%
  );
  pointer-events: none;
  opacity: 0;
  transition: opacity 1.2s ease;
}

.timer-stage.timer-stage--running::before {
  opacity: 1;
}

.timer-halo {
  position: absolute;
  width: calc(var(--timer-size) + 48px);
  height: calc(var(--timer-size) + 48px);
  border-radius: 50%;
  background: radial-gradient(
    circle,
    rgba(255, 255, 255, 0.015) 0%,
    transparent 70%
  );
  pointer-events: none;
}

.timer-core {
  position: relative;
  z-index: 1;
  width: var(--timer-size);
  height: var(--timer-size);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
}

.timer-stage-action {
  position: absolute;
  top: 50%;
  right: 14px;
  z-index: 2;
  width: 36px;
  height: 36px;
  padding: 0;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border-subtle);
  color: var(--text-secondary);
  transform: translateY(-50%);
  transition: background 0.2s ease, color 0.2s ease, border-color 0.2s ease,
    transform 0.2s ease;
}

.timer-stage-action:hover {
  background: var(--bg-card);
  color: var(--text-primary);
  border-color: var(--border-medium);
}

.timer-stage-action:active {
  transform: translateY(-50%) scale(0.96);
}

.timer-stage-action[aria-pressed="true"] {
  background: var(--bg-card);
  color: var(--text-primary);
  border-color: var(--border-medium);
}

.timer-stage-action__icon {
  width: 15px;
  height: 15px;
  flex: none;
}

/* Circular ring decorator */
.timer-core::before {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: 50%;
  border: var(--ring-stroke) solid var(--border-subtle);
  pointer-events: none;
}

.timer-core::after {
  content: "";
  position: absolute;
  inset: -1px;
  border-radius: 50%;
  border: 2px solid transparent;
  border-top-color: var(--accent-red);
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.6s ease;
}

.timer-stage--running .timer-core::after {
  opacity: 1;
  animation: timer-ring-spin 4s linear infinite;
}

.timer-stage--paused .timer-core::after {
  opacity: 0.4;
  border-top-color: var(--accent-orange);
}

@keyframes timer-ring-spin {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}

/* Timer ring — tick marks */
.timer-ring-svg {
  position: absolute;
  inset: -6px;
  width: calc(100% + 12px);
  height: calc(100% + 12px);
  pointer-events: none;
}

.status-badge {
  display: inline-flex;
  padding: 5px 12px;
  border-radius: var(--radius-pill);
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  color: var(--text-tertiary);
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  transition: all 0.3s ease;
}

.status-badge[data-state="running"] {
  color: var(--accent-red);
  background: var(--accent-red-soft);
  border-color: rgba(239, 68, 68, 0.2);
}

.status-badge[data-state="paused"] {
  color: var(--accent-orange);
  background: var(--accent-orange-soft);
  border-color: rgba(245, 158, 11, 0.2);
}

.timer-label-caption {
  margin: 14px 0 4px;
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-muted);
}

.timer-label-input {
  max-width: 200px;
  margin-bottom: 8px;
  padding: 8px 14px;
  border-radius: var(--radius-pill);
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  text-align: center;
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--text-primary);
  transition: border-color 0.3s ease;
}

.timer-label-input:focus {
  border-color: var(--border-medium);
}

.time-display {
  font-size: clamp(2.6rem, 12vw, 3.6rem);
  font-weight: 800;
  letter-spacing: -0.04em;
  font-variant-numeric: tabular-nums;
  line-height: 1;
  background: linear-gradient(180deg, var(--text-primary) 40%, var(--text-secondary) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.money-display {
  margin-top: 6px;
  font-size: clamp(1.2rem, 5vw, 1.6rem);
  font-weight: 700;
  color: var(--accent-red);
  letter-spacing: -0.03em;
  font-variant-numeric: tabular-nums;
}

/* ─── Action Row ─── */
.action-row,
.settings-actions,
.sheet-actions,
.records-toolbar,
.draft-meta {
  display: flex;
  gap: 8px;
}

.action-row {
  padding: 0;
}

.action-row button,
.settings-actions button,
.sheet-actions button {
  flex: 1;
}

/* ─── Buttons ─── */
.primary-button,
.secondary-button,
.danger-button,
.ghost-button,
.danger-outline-button {
  min-height: 50px;
  padding: 0 18px;
  border-radius: var(--radius-md);
  font-weight: 700;
  font-size: 0.9rem;
  transition: all 0.2s ease;
  position: relative;
  overflow: hidden;
}

.primary-button--compact,
.ghost-button--compact {
  min-height: 44px;
}

.primary-button {
  color: #fff;
  background: var(--accent-red);
}

.primary-button::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, rgba(255,255,255,0.1) 0%, transparent 100%);
  pointer-events: none;
}

.primary-button:hover {
  background: #DC2626;
  transform: translateY(-1px);
}

.primary-button:active {
  transform: translateY(0) scale(0.98);
}

.secondary-button {
  color: var(--text-primary);
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
}

.secondary-button:hover {
  background: var(--bg-card-hover);
  transform: translateY(-1px);
}

.secondary-button:active {
  transform: translateY(0) scale(0.98);
}

.danger-button {
  color: #fff;
  background: #7F1D1D;
  border: 1px solid rgba(239, 68, 68, 0.2);
}

.danger-button:hover {
  background: #991B1B;
  transform: translateY(-1px);
}

.danger-button:active {
  transform: translateY(0) scale(0.98);
}

.ghost-button {
  min-height: 40px;
  padding: 0 14px;
  border-radius: var(--radius-pill);
  color: var(--text-secondary);
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  font-size: 0.82rem;
}

.ghost-button:hover {
  background: var(--bg-card-hover);
  color: var(--text-primary);
}

.danger-outline-button {
  width: 100%;
  color: var(--accent-red);
  background: var(--accent-red-soft);
  border: 1px solid rgba(239, 68, 68, 0.12);
  font-size: 0.85rem;
}

.danger-outline-button:hover {
  background: rgba(239, 68, 68, 0.2);
}

.primary-button:disabled,
.secondary-button:disabled,
.danger-button:disabled {
  opacity: 0.3;
  cursor: not-allowed;
  transform: none;
}

/* ─── Stats Grid ─── */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 8px;
}

.stats-grid--records {
  grid-template-columns: repeat(3, 1fr);
}

.stat-card {
  padding: 16px;
  border-radius: var(--radius-md);
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
}

.stat-card--wide {
  grid-column: span 2;
}

.stat-label {
  font-size: 0.68rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-muted);
}

.stat-value {
  display: block;
  margin-top: 8px;
  font-size: 1.05rem;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.02em;
}

/* ─── Draft Sheet ─── */
.draft-sheet {
  padding: 20px;
  border-radius: var(--radius-lg);
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
}

.sheet-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
}

.draft-sheet h3 {
  margin: 6px 0 0;
  font-size: 1.05rem;
  font-weight: 700;
}

.sheet-money {
  font-size: 1.2rem;
  font-weight: 800;
  color: var(--accent-red);
  font-variant-numeric: tabular-nums;
}

.draft-meta {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  margin: 14px 0 16px;
  gap: 12px;
}

.draft-meta span {
  display: block;
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.draft-meta strong {
  display: block;
  margin-top: 4px;
  font-size: 0.95rem;
  font-weight: 700;
}

/* ─── Fields ─── */
.field,
.toggle-card {
  padding: 14px 16px;
  border-radius: var(--radius-md);
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
}

.field {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.field--compact {
  padding: 0;
  border: 0;
  background: transparent;
}

.field span {
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.field input {
  min-height: 44px;
  padding: 0 14px;
  border-radius: var(--radius-sm);
  background: var(--bg-elevated);
  border: 1px solid var(--border-subtle);
  color: var(--text-primary);
  font-size: 0.9rem;
  transition: border-color 0.3s ease;
}

.field input:focus {
  border-color: var(--border-medium);
}

.field-note {
  font-size: 0.75rem;
  line-height: 1.5;
  color: var(--text-muted);
}

/* ─── Toggle Card ─── */
.toggle-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.toggle-card strong {
  display: block;
  margin-bottom: 4px;
  font-size: 0.9rem;
  font-weight: 700;
}

.toggle-card p {
  margin: 0;
  font-size: 0.78rem;
  color: var(--text-muted);
  line-height: 1.45;
}

.toggle-card input[type="checkbox"] {
  width: 44px;
  height: 24px;
  min-width: 44px;
  appearance: none;
  -webkit-appearance: none;
  border-radius: 12px;
  background: var(--bg-elevated);
  border: 1px solid var(--border-medium);
  position: relative;
  cursor: pointer;
  transition: all 0.3s ease;
}

.toggle-card input[type="checkbox"]::before {
  content: "";
  position: absolute;
  top: 2px;
  left: 2px;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--text-muted);
  transition: all 0.3s ease;
}

.toggle-card input[type="checkbox"]:checked {
  background: var(--accent-red);
  border-color: var(--accent-red);
}

.toggle-card input[type="checkbox"]:checked::before {
  left: 22px;
  background: #fff;
}

/* ─── Preset Row ─── */
.preset-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.preset-chip {
  min-height: 36px;
  padding: 0 14px;
  border-radius: var(--radius-pill);
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  color: var(--text-secondary);
  font-size: 0.82rem;
  font-weight: 700;
  transition: all 0.2s ease;
}

.preset-chip:hover {
  background: var(--bg-card-hover);
  color: var(--text-primary);
  border-color: var(--border-medium);
}

.preset-chip:active {
  transform: scale(0.96);
}

.preset-chip--active {
  background: var(--accent-red-soft);
  border-color: rgba(239, 68, 68, 0.22);
  color: var(--text-primary);
}

/* ─── Settings Form ─── */
.settings-form {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

/* ─── Records ─── */
.records-toolbar {
  align-items: center;
  justify-content: space-between;
}

.records-title {
  font-size: 1rem;
  font-weight: 700;
}

.records-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.records-list article {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 12px;
  padding: 16px;
  border-radius: var(--radius-md);
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  transition: background 0.2s ease;
}

.records-list article:hover {
  background: var(--bg-card-hover);
}

.record-title {
  font-size: 0.92rem;
  font-weight: 700;
}

.records-list time {
  display: block;
  margin-top: 6px;
  font-size: 0.78rem;
  color: var(--text-muted);
  line-height: 1.5;
}

.record-actions {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 8px;
}

.record-loss {
  font-size: 1rem;
  font-weight: 800;
  color: var(--accent-red);
  font-variant-numeric: tabular-nums;
}

.records-amount-label {
  font-size: 0.68rem;
  color: var(--text-muted);
}

.delete-button {
  min-height: 34px;
  padding: 0 12px;
  border-radius: var(--radius-pill);
  background: var(--accent-red-soft);
  border: 1px solid rgba(239, 68, 68, 0.1);
  color: var(--accent-red);
  font-weight: 700;
  font-size: 0.78rem;
  transition: all 0.2s ease;
}

.delete-button:hover {
  background: rgba(239, 68, 68, 0.25);
}

/* ─── Empty Card ─── */
.empty-card {
  padding: 32px 24px;
  border-radius: var(--radius-lg);
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  text-align: center;
}

.empty-card strong {
  display: block;
  margin-top: 8px;
  font-size: 0.95rem;
}

.empty-card p {
  margin: 8px 0 0;
  font-size: 0.82rem;
  color: var(--text-muted);
  line-height: 1.55;
}

/* ─── Tab Bar ─── */
.tabbar {
  position: fixed;
  left: 50%;
  bottom: 0;
  width: min(100%, 420px);
  padding: 8px 12px;
  padding-bottom: max(8px, env(safe-area-inset-bottom));
  transform: translateX(-50%);
  display: flex;
  justify-content: space-between;
  gap: 4px;
  background: var(--tabbar-bg);
  backdrop-filter: blur(24px) saturate(1.4);
  -webkit-backdrop-filter: blur(24px) saturate(1.4);
  border-top: 1px solid var(--border-subtle);
  z-index: 40;
}

.tabbar-button {
  flex: 1;
  min-height: 48px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  color: var(--text-muted);
  font-size: 0.82rem;
  font-weight: 700;
  border-radius: var(--radius-md);
  transition: all 0.25s ease;
  position: relative;
}

.tabbar-button--active {
  color: var(--text-primary);
}

.tabbar-button--active::after {
  content: "";
  position: absolute;
  top: 6px;
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: var(--accent-red);
}

.tabbar-button:hover:not(.tabbar-button--active) {
  color: var(--text-secondary);
}

/* ─── Tab Icons ─── */
.tabbar-button .tab-icon {
  width: 20px;
  height: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* ─── Toast ─── */
.toast {
  position: fixed;
  left: 50%;
  bottom: 80px;
  width: min(calc(100% - 32px), 340px);
  padding: 12px 18px;
  transform: translateX(-50%);
  border-radius: var(--radius-md);
  background: var(--bg-elevated);
  border: 1px solid var(--border-subtle);
  color: var(--text-primary);
  text-align: center;
  font-size: 0.85rem;
  font-weight: 600;
  line-height: 1.45;
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.5);
  z-index: 100;
  animation: toast-in 0.3s ease;
}

.modal-overlay {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  padding: 20px;
  background: rgba(10, 10, 11, 0.56);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  z-index: 120;
}

.modal-card {
  width: min(100%, 420px);
  padding: 22px 20px 20px;
  border-radius: var(--radius-xl);
  background: var(--bg-card);
  border: 1px solid var(--border-medium);
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.28);
}

.modal-card h2 {
  margin-top: 8px;
  font-size: 1.12rem;
  font-weight: 800;
  letter-spacing: -0.03em;
}

.modal-copy {
  margin-top: 10px;
  font-size: 0.84rem;
  line-height: 1.6;
  color: var(--text-secondary);
}

.modal-actions {
  display: flex;
  gap: 8px;
  margin-top: 18px;
}

.modal-actions button {
  flex: 1;
}

@keyframes toast-in {
  from {
    opacity: 0;
    transform: translateX(-50%) translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
  }
}

/* ─── Tick marks on timer ─── */
.tick-ring {
  position: absolute;
  inset: -10px;
  width: calc(100% + 20px);
  height: calc(100% + 20px);
  pointer-events: none;
}

.tick-ring line {
  stroke: var(--border-subtle);
  stroke-width: 1;
  stroke-linecap: round;
}

.tick-ring line:nth-child(5n+1) {
  stroke: var(--text-muted);
  stroke-width: 1.5;
}

body.timer-focus-mode {
  --timer-size: min(78vw, 420px);
}

body.timer-focus-mode .page-shell {
  width: 100%;
  max-width: none;
  padding: 0 20px 120px;
}

body.timer-focus-mode .topbar {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 80;
  width: 100%;
  padding: max(16px, env(safe-area-inset-top)) 20px 0;
  background: linear-gradient(180deg, var(--bg-primary) 0%, rgba(0, 0, 0, 0) 100%);
}

body.timer-focus-mode .topbar-copy {
  opacity: 0;
  pointer-events: none;
}

body.timer-focus-mode .content-shell {
  min-height: 100vh;
}

body.timer-focus-mode #panel-timer {
  min-height: 100vh;
  justify-content: center;
  gap: 18px;
  padding-top: 92px;
}

body.timer-focus-mode .timer-focus-hide,
body.timer-focus-mode #panel-records,
body.timer-focus-mode #panel-settings,
body.timer-focus-mode .tabbar {
  display: none !important;
}

body.timer-focus-mode .timer-stage {
  min-height: calc(100vh - 240px);
  padding: 24px 0 40px;
  background: transparent;
  border-color: transparent;
}

body.timer-focus-mode .timer-stage-action {
  top: 24px;
  right: 20px;
  transform: none;
}

body.timer-focus-mode .timer-halo {
  width: calc(var(--timer-size) + 84px);
  height: calc(var(--timer-size) + 84px);
}

body.timer-focus-mode .action-row {
  position: fixed;
  left: 20px;
  right: 20px;
  bottom: max(20px, calc(env(safe-area-inset-bottom) + 12px));
  z-index: 85;
}

/* ─── Responsive ─── */
@media (max-width: 380px) {
  :root {
    --timer-size: 240px;
  }

  .page-shell {
    padding-inline: 14px;
  }

  .action-row,
  .install-banner__actions,
  .modal-actions,
  .sheet-actions,
  .settings-actions {
    flex-direction: column;
  }

  .stats-grid--records {
    grid-template-columns: repeat(2, 1fr);
  }

  .stat-card--wide {
    grid-column: span 2;
  }
}

@media (min-width: 768px) {
  .page-shell {
    width: min(100%, 480px);
    padding-top: 32px;
  }

  :root {
    --timer-size: 320px;
  }

  .content-shell {
    gap: 20px;
  }
}

/* ─── Smooth transitions for panel switching ─── */
.panel {
  animation: panel-fade-in 0.35s ease;
}

@keyframes panel-fade-in {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* ─── Pulse animation for running timer ─── */
.timer-stage--running .money-display {
  animation: money-pulse 2s ease-in-out infinite;
}

@keyframes money-pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.7; }
}
