:root {
  --bg: #0f0f0f;
  --surface: #1c1c1e;
  --surface2: #2c2c2e;
  --surface3: #3a3a3c;
  --accent: #FF6B35;
  --accent-bg: rgba(255, 107, 53, 0.13);
  --text: #f5f5f7;
  --text2: #8e8e93;
  --text3: #48484a;
  --danger: #ff453a;
  --border: #38383a;
  --r: 14px;
}

*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  -webkit-tap-highlight-color: transparent;
  -webkit-touch-callout: none;
}

html, body {
  height: 100%;
  overscroll-behavior: none;
}

/* ── Auth screen ── */
#auth-screen {
  min-height: 100dvh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: var(--bg);
}
.auth-card {
  width: 100%;
  max-width: 360px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.auth-card h2 {
  font-size: 24px;
  font-weight: 700;
  margin-bottom: 4px;
}
.auth-input {
  width: 100%;
  background: var(--surface);
  border: 1.5px solid var(--surface3);
  border-radius: var(--r);
  color: var(--text);
  font-size: 16px;
  padding: 12px 14px;
  box-sizing: border-box;
  outline: none;
}
.auth-input:focus { border-color: var(--accent); }
.auth-error {
  color: #ff453a;
  font-size: 14px;
}

body {
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, 'SF Pro Text', 'Helvetica Neue', sans-serif;
  font-size: 16px;
  line-height: 1.4;
  -webkit-font-smoothing: antialiased;
}

/* ── Layout ── */
#app {
  display: flex;
  flex-direction: column;
  height: 100dvh;
}

/* ── Header ── */
.app-header {
  padding: calc(max(env(safe-area-inset-top), 12px) + 8px) 20px 14px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
}

.app-header h1 {
  font-size: 26px;
  font-weight: 700;
  letter-spacing: -0.5px;
}

.header-date {
  color: var(--text2);
  font-size: 13px;
  padding-bottom: 2px;
}

/* ── Tabs ── */
.tab-content {
  flex: 1;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior-y: contain;
}

.tab-bar {
  display: flex;
  background: rgba(18, 18, 20, 0.92);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-top: 1px solid var(--border);
  padding-bottom: env(safe-area-inset-bottom);
  flex-shrink: 0;
}

.tab-btn {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  padding: 10px 0;
  background: none;
  border: none;
  color: var(--text3);
  font-size: 10px;
  font-weight: 500;
  letter-spacing: 0.2px;
  cursor: pointer;
  transition: color 0.15s;
}

.tab-btn.active { color: var(--accent); }
.tab-btn svg { width: 24px; height: 24px; }

/* ── Content ── */
.pad { padding: 18px 16px 32px; }

/* ── Empty state ── */
/* ── Readiness card ── */
#readiness-card {
  background: var(--surface);
  border-radius: var(--r);
  padding: 16px;
  margin-bottom: 16px;
}
.readiness-row {
  display: flex;
  align-items: center;
  gap: 16px;
}
.readiness-ring-wrap {
  position: relative;
  width: 72px;
  height: 72px;
  flex-shrink: 0;
}
.readiness-ring { width: 72px; height: 72px; transform: rotate(-90deg); }
.ring-bg   { stroke: var(--surface2); }
.ring-fill { stroke: #4ecdc4; transition: stroke-dasharray 0.6s ease, stroke 0.4s ease; }
.readiness-score {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  font-weight: 700;
}
.readiness-info { flex: 1; min-width: 0; }
.readiness-zone { font-size: 15px; font-weight: 700; margin-bottom: 2px; }
.readiness-msg  { font-size: 13px; color: var(--text2); line-height: 1.4; margin-bottom: 4px; }
.readiness-meta { font-size: 11px; color: var(--text3); }

.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  padding: 56px 24px 32px;
  gap: 12px;
}

.empty-state .hero-icon { font-size: 60px; line-height: 1; margin-bottom: 4px; }
.empty-state h2 { font-size: 22px; font-weight: 600; }
.empty-state p { color: var(--text2); font-size: 15px; max-width: 260px; line-height: 1.5; }

/* ── Buttons ── */
.btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border: none;
  border-radius: var(--r);
  font-size: 17px;
  font-weight: 600;
  cursor: pointer;
  transition: opacity 0.12s, transform 0.1s;
  user-select: none;
  -webkit-user-select: none;
  min-height: 54px;
  padding: 0 24px;
  letter-spacing: -0.2px;
}

.btn:active { opacity: 0.72; transform: scale(0.97); }

.btn-primary      { background: var(--accent); color: #fff; }
.btn-surface      { background: var(--surface); color: var(--text); }
.btn-ghost        { background: transparent; color: var(--accent); min-height: 44px; }
.btn-danger       { background: var(--danger); color: #fff; }
.btn-danger-ghost { background: transparent; color: var(--danger); min-height: 44px; font-size: 15px; }
.btn-full         { width: 100%; }
.btn-sm           { font-size: 15px; min-height: 44px; border-radius: 10px; padding: 0 16px; }

.btn-icon {
  background: none;
  border: none;
  padding: 6px;
  cursor: pointer;
  color: var(--text2);
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 8px;
  min-width: 36px;
  min-height: 36px;
}

.btn-icon:active { background: var(--surface2); }

/* ── Workout banner ── */
.workout-banner {
  background: var(--surface);
  border-radius: var(--r);
  padding: 16px 18px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 8px;
}

/* ── Rest timer ── */
.timer-tabs {
  display: flex;
  gap: 4px;
  background: var(--surface2);
  border-radius: 8px;
  padding: 3px;
  margin-bottom: 10px;
}
.timer-tab {
  flex: 1;
  background: none;
  border: none;
  color: var(--text2);
  font-size: 13px;
  font-weight: 500;
  padding: 5px 0;
  border-radius: 6px;
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
}
.timer-tab.active {
  background: var(--surface);
  color: var(--text);
}
#rest-presets {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 8px 2px;
  margin-top: 16px;
  margin-bottom: 12px;
}
#rest-timer-box {
  margin-top: 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--surface);
  border-radius: var(--r);
  padding: 12px 18px;
  margin-bottom: 12px;
}
#rest-countdown {
  font-size: 28px;
  font-weight: 700;
  letter-spacing: 1px;
  color: var(--accent);
}

.timer-label {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.6px;
  color: var(--text2);
  margin-bottom: 2px;
}

#timer-display {
  font-size: 34px;
  font-weight: 700;
  color: var(--accent);
  letter-spacing: -1.5px;
  font-variant-numeric: tabular-nums;
}

.btn-finish {
  background: var(--danger);
  color: #fff;
  border: none;
  border-radius: 12px;
  font-size: 15px;
  font-weight: 600;
  padding: 12px 22px;
  cursor: pointer;
  min-height: 46px;
}

.btn-finish:active { opacity: 0.8; }

/* ── Exercise card ── */
.exercise-card {
  background: var(--surface);
  border-radius: var(--r);
  margin-bottom: 12px;
  overflow: hidden;
}

.ex-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 13px 14px;
  border-bottom: 1px solid var(--border);
}

.ex-name { font-size: 17px; font-weight: 600; }

.ex-suggest {
  font-size: 12px;
  color: var(--text2);
  margin-top: 3px;
}
.ex-suggest-target {
  color: var(--accent);
  font-weight: 600;
}

/* ── Sets table ── */
.sets-thead {
  display: grid;
  grid-template-columns: 38px 1fr 1fr 2fr 38px;
  gap: 6px;
  padding: 7px 14px;
  font-size: 11px;
  font-weight: 600;
  color: var(--text2);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  border-bottom: 1px solid var(--border);
}

.sets-thead > * { text-align: center; }

.set-row {
  display: grid;
  grid-template-columns: 38px 1fr 1fr 2fr 38px;
  gap: 6px;
  align-items: center;
  padding: 7px 14px;
  border-bottom: 1px solid var(--border);
}

.set-num { font-size: 13px; font-weight: 600; color: var(--text2); text-align: center; }

.set-input {
  background: var(--surface2);
  border: 1.5px solid transparent;
  border-radius: 9px;
  color: var(--text);
  font-size: 16px;
  font-weight: 500;
  padding: 9px 8px;
  text-align: center;
  width: 100%;
  -webkit-appearance: none;
  appearance: none;
}

.set-input:focus { outline: none; border-color: var(--accent); background: var(--surface3); }
.set-input::placeholder { color: var(--text3); }

.set-comment {
  width: 100%;
  background: var(--surface2);
  border: 1.5px solid transparent;
  border-radius: 9px;
  color: var(--text);
  font-size: 13px;
  padding: 6px 10px;
  min-width: 0;
}
.set-comment:focus { outline: none; border-color: var(--accent); background: var(--surface3); }
.set-comment::placeholder { color: var(--text3); }

.add-set-wrap { padding: 10px 14px; }

/* ── Modal ── */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.55);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  z-index: 200;
  display: flex;
  align-items: flex-end;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.22s;
}

.modal-overlay.open { opacity: 1; pointer-events: all; }

.modal-sheet {
  width: 100%;
  background: var(--surface);
  border-radius: 24px 24px 0 0;
  padding-bottom: max(env(safe-area-inset-bottom), 16px);
  transform: translateY(100%);
  transition: transform 0.3s cubic-bezier(0.32, 0.72, 0, 1);
  max-height: 88dvh;
  display: flex;
  flex-direction: column;
}

.modal-overlay.open .modal-sheet { transform: translateY(0); }

.modal-handle {
  width: 36px;
  height: 5px;
  background: var(--surface3);
  border-radius: 3px;
  margin: 12px auto 4px;
  flex-shrink: 0;
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 18px 14px;
  flex-shrink: 0;
}

.modal-title { font-size: 17px; font-weight: 700; }

.modal-body {
  padding: 0 16px 8px;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  flex: 1;
}
.modal-footer {
  padding: 12px 16px max(env(safe-area-inset-bottom), 16px);
  flex-shrink: 0;
  border-top: 1px solid var(--surface2);
}

/* ── Search ── */
.search-wrap { position: relative; margin-bottom: 14px; }

.search-icon {
  position: absolute;
  left: 13px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text2);
  pointer-events: none;
}

.search-input {
  width: 100%;
  background: var(--surface2);
  border: 1.5px solid var(--border);
  border-radius: 12px;
  color: var(--text);
  font-size: 16px;
  padding: 12px 14px 12px 40px;
  -webkit-appearance: none;
}

.search-input:focus { outline: none; border-color: var(--accent); }
.search-input::placeholder { color: var(--text2); }

/* ── Chips ── */
.chips-label {
  font-size: 12px;
  font-weight: 600;
  color: var(--text2);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 10px;
}

.chips-wrap { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 20px; }

.chip {
  background: var(--surface2);
  border: 1.5px solid var(--border);
  border-radius: 20px;
  color: var(--text);
  font-size: 14px;
  font-weight: 500;
  padding: 8px 14px;
  cursor: pointer;
  transition: background 0.12s, border-color 0.12s, color 0.12s;
  -webkit-user-select: none;
}

.chip:active { opacity: 0.7; }

.chip.sel {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
  font-weight: 600;
}

/* ── History ── */
.history-card {
  background: var(--surface);
  border-radius: var(--r);
  margin-bottom: 10px;
  overflow: hidden;
  cursor: pointer;
}

.hist-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 16px;
}

.hist-date { font-size: 16px; font-weight: 600; }

.hist-meta { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 3px; }
.hist-meta span { font-size: 13px; color: var(--text2); }

.hist-chevron { color: var(--text3); transition: transform 0.2s; flex-shrink: 0; }
.history-card.open .hist-chevron { transform: rotate(180deg); }

.hist-details { display: none; border-top: 1px solid var(--border); padding: 14px 16px; }
.history-card.open .hist-details { display: block; }

.hist-ex { margin-bottom: 12px; }
.hist-ex:last-child { margin-bottom: 0; }
.hist-ex-name { font-size: 14px; font-weight: 600; margin-bottom: 6px; }

.hist-sets { display: flex; flex-wrap: wrap; gap: 6px; }
.hist-set-tag { background: var(--surface2); border-radius: 8px; padding: 4px 9px; font-size: 12px; color: var(--text2); }

.hist-delete-btn {
  background: none;
  border: none;
  padding: 6px;
  border-radius: 8px;
  color: var(--text3);
  cursor: pointer;
  display: flex;
  align-items: center;
  transition: color 0.15s, background 0.15s;
}
.hist-delete-btn:hover { color: #e53e3e; background: rgba(229,62,62,0.1); }

.recently-deleted-section {
  margin-top: 24px;
  border-top: 1px solid var(--border);
  padding-top: 12px;
}
.recently-deleted-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 13px;
  color: var(--text3);
  cursor: pointer;
  padding: 4px 2px;
  user-select: none;
}
.recently-deleted-header svg { transition: transform 0.2s; }

.deleted-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 0;
  border-bottom: 1px solid var(--border);
}
.deleted-card:last-child { border-bottom: none; }
.deleted-card-actions { display: flex; gap: 8px; }

.btn-danger { color: #e53e3e !important; }
.btn-danger:hover { background: rgba(229,62,62,0.1) !important; }

.pr-badge {
  display: inline-block;
  margin-left: 8px;
  background: linear-gradient(135deg, #f5a623, #f7c948);
  color: #1a1000;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.5px;
  padding: 2px 7px;
  border-radius: 6px;
  vertical-align: middle;
}

.pr-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: var(--surface2);
  border-radius: 10px;
  padding: 12px 16px;
  margin-bottom: 8px;
  text-align: left;
}
.pr-item-name { font-weight: 600; font-size: 15px; }
.pr-item-val  { font-size: 13px; color: #f7c948; font-weight: 600; }

/* ── Unit toggle ── */
.unit-toggle { display: flex; background: var(--surface); border-radius: 10px; padding: 3px; }

.unit-btn {
  background: none;
  border: none;
  color: var(--text2);
  font-size: 13px;
  font-weight: 600;
  padding: 6px 14px;
  border-radius: 8px;
  cursor: pointer;
}

.unit-btn.active { background: var(--surface3); color: var(--text); }

/* ── Section header ── */
.sec-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 14px; }
.sec-title { font-size: 20px; font-weight: 700; }

/* ── Animation ── */
@keyframes fade-up {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: translateY(0); }
}

.fade-up { animation: fade-up 0.2s ease-out; }

/* ── Ring toggle ── */
.sw-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: 16px;
  width: 120px;
  height: 56px;
  cursor: pointer;
  transition: opacity 0.15s;
}
.sw-btn:active { opacity: 0.75; }

.ring-toggle { color: var(--text2); margin-left: 2px; }
.ring-toggle.ring-off { color: var(--text3); }

/* ── Stop ring button ── */
@keyframes ring-pulse {
  0%, 100% { opacity: 1; }
  50%       { opacity: 0.5; }
}
.ring-stop-btn { animation: ring-pulse 0.75s ease-in-out infinite; }

/* ── Import status ── */
.backend-status {
  border-radius: 10px;
  padding: 10px 14px;
  font-size: 13px;
  margin-bottom: 12px;
  display: flex;
  align-items: center;
  gap: 10px;
}
.backend-status.connecting { background: rgba(108,142,255,0.12); color: #6c8eff; }
.backend-status.waking     { background: rgba(255,159,64,0.12);  color: #ff9f40; }
.backend-status.failed     { background: rgba(255,80,80,0.12);   color: #ff5050; }

.btn-retry {
  background: rgba(255,80,80,0.2);
  border: 1px solid rgba(255,80,80,0.4);
  border-radius: 6px;
  color: #ff5050;
  font-size: 12px;
  font-weight: 600;
  padding: 3px 10px;
  cursor: pointer;
}

.import-status {
  border-radius: 10px;
  padding: 10px 14px;
  font-size: 13px;
  margin-bottom: 12px;
}
.import-status.ok    { background: rgba(78,205,196,0.15); color: #4ecdc4; }
.import-status.error { background: rgba(255,80,80,0.15);  color: #ff5050; }

/* ── Progress / Charts ── */
.chart-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 18px 16px 14px;
  margin-bottom: 16px;
}

.chart-title { font-size: 15px; font-weight: 700; margin-bottom: 2px; }
.chart-subtitle { font-size: 12px; color: var(--text3); margin-bottom: 12px; }

.strength-forecast {
  font-size: 13px;
  padding: 10px 14px;
  border-radius: 10px;
  margin-top: 14px;
  line-height: 1.5;
}
.forecast-up   { background: rgba(78,205,196,0.1);  color: #4ecdc4; }
.forecast-flat { background: rgba(255,193,7,0.1);   color: #ffc107; }
.forecast-down { background: rgba(255,69,58,0.1);   color: var(--danger); }

.exercise-select {
  width: 100%;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 10px;
  color: var(--text);
  font-size: 14px;
  padding: 8px 12px;
  margin-bottom: 14px;
  appearance: none;
  cursor: pointer;
}

/* ── Form Check ── */
.ex-form-check-btn {
  color: var(--accent);
}

.ex-form-check-btn:active { background: var(--accent-bg); }

.modal-fullscreen {
  position: fixed;
  inset: 0;
  background: #000;
  z-index: 300;
  display: none;
  flex-direction: column;
}

.modal-fullscreen.open { display: flex; }

.fc-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: calc(max(env(safe-area-inset-top), 12px) + 6px) 16px 10px;
  background: rgba(0,0,0,0.7);
  flex-shrink: 0;
  z-index: 2;
}

.fc-ex-select {
  background: var(--surface2);
  border: 1.5px solid var(--border);
  border-radius: 10px;
  color: var(--text);
  font-size: 15px;
  font-weight: 600;
  padding: 8px 12px;
  appearance: none;
  cursor: pointer;
  min-width: 160px;
}

.fc-close-btn {
  color: var(--text);
  background: var(--surface2);
  border-radius: 50%;
  width: 38px;
  height: 38px;
}

.fc-angle-hint {
  display: flex;
  align-items: baseline;
  gap: 8px;
  padding: 8px 16px;
  background: rgba(108,142,255,0.12);
  border-bottom: 1px solid rgba(108,142,255,0.2);
  flex-shrink: 0;
}

.fc-hint-view {
  color: #6c8eff;
  font-size: 13px;
  font-weight: 700;
  white-space: nowrap;
  flex-shrink: 0;
}

.fc-hint-tip {
  color: var(--text2);
  font-size: 12px;
  line-height: 1.4;
}

.fc-camera {
  position: relative;
  flex: 1;
  overflow: hidden;
  background: #111;
}

#form-video {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

#form-canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}

.fc-flip-btn {
  position: absolute;
  bottom: 16px;
  right: 16px;
  width: 48px;
  height: 48px;
  border-radius: 50%;
  border: none;
  background: rgba(0,0,0,0.55);
  color: #fff;
  font-size: 22px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 10;
  backdrop-filter: blur(4px);
  transition: background 0.2s, transform 0.2s;
}
.fc-flip-btn:active {
  background: rgba(255,255,255,0.2);
  transform: scale(0.9) rotate(180deg);
}

.fc-status {
  position: absolute;
  top: 16px;
  right: 16px;
  width: 64px;
  height: 64px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 3;
  transition: background 0.25s, box-shadow 0.25s;
}

.fc-status-good {
  background: rgba(48, 209, 88, 0.92);
  color: #fff;
  box-shadow: 0 0 24px rgba(48, 209, 88, 0.6);
  animation: fc-pulse-good 1.6s ease-in-out infinite;
}

.fc-status-bad {
  background: rgba(255, 69, 58, 0.92);
  color: #fff;
  box-shadow: 0 0 24px rgba(255, 69, 58, 0.6);
  animation: fc-pulse-bad 0.7s ease-in-out infinite;
}

@keyframes fc-pulse-good {
  0%, 100% { transform: scale(1);    opacity: 1; }
  50%       { transform: scale(1.08); opacity: 0.9; }
}

@keyframes fc-pulse-bad {
  0%, 100% { transform: scale(1);    opacity: 1; }
  50%       { transform: scale(1.1);  opacity: 0.8; }
}

.fc-no-pose {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text2);
  font-size: 14px;
  background: rgba(0,0,0,0.5);
  z-index: 1;
}

.fc-feedback {
  padding: 14px 16px calc(max(env(safe-area-inset-bottom), 14px) + 4px);
  background: rgba(0,0,0,0.85);
  display: flex;
  flex-direction: column;
  gap: 6px;
  flex-shrink: 0;
  min-height: 80px;
}

.form-issue {
  background: rgba(255,69,58,0.15);
  border: 1px solid rgba(255,69,58,0.4);
  border-radius: 8px;
  color: #ff6b63;
  font-size: 14px;
  font-weight: 500;
  padding: 8px 12px;
}

.form-tip {
  background: rgba(48,209,88,0.12);
  border: 1px solid rgba(48,209,88,0.3);
  border-radius: 8px;
  color: #34c759;
  font-size: 14px;
  font-weight: 500;
  padding: 8px 12px;
}

/* ── Loading overlay ── */
#loading-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  z-index: 500;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s;
}

#loading-overlay.show {
  opacity: 1;
  pointer-events: all;
}

.loading-box {
  background: var(--surface);
  border-radius: 20px;
  padding: 32px 40px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
}

.loading-spinner {
  width: 40px;
  height: 40px;
  border: 3.5px solid var(--surface3);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.75s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

.loading-text {
  font-size: 15px;
  font-weight: 600;
  color: var(--text2);
}

/* ── Misc ── */
::-webkit-scrollbar { display: none; }

input[type=number]::-webkit-inner-spin-button,
input[type=number]::-webkit-outer-spin-button { -webkit-appearance: none; }
input[type=number] { -moz-appearance: textfield; }
