/* ============================================================
   FitPose — Apple-style workout PWA
   ============================================================ */

:root {
  --bg: #000000;
  --card: rgba(255, 255, 255, 0.08);
  --card-strong: rgba(28, 28, 30, 0.92);
  --card-border: rgba(255, 255, 255, 0.12);
  --text: #f5f5f7;
  --text-dim: rgba(235, 235, 245, 0.6);
  --text-faint: rgba(235, 235, 245, 0.35);
  --accent: #a4ed2f;
  --accent-soft: rgba(164, 237, 47, 0.16);
  --accent-glow: rgba(164, 237, 47, 0.55);
  --danger: #ff453a;
  --move: #ff2d55;
  --exercise: #a4ed2f;
  --stand: #38c6ff;
  --radius: 20px;
  --radius-sm: 14px;
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --tabbar-h: 84px;
  --font: -apple-system, BlinkMacSystemFont, "SF Pro Display", "SF Pro Text",
    "Helvetica Neue", "Segoe UI", Roboto, Arial, sans-serif;
}

* { box-sizing: border-box; margin: 0; padding: 0; -webkit-tap-highlight-color: transparent; }

html, body { height: 100%; }

body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  overflow: hidden;
  overscroll-behavior: none;
  -webkit-font-smoothing: antialiased;
  user-select: none;
  touch-action: manipulation;
}

button { font-family: inherit; cursor: pointer; border: none; background: none; color: inherit; }

/* ---------- app frame ---------- */

.app {
  display: flex;
  flex-direction: column;
  height: 100dvh;
  background:
    radial-gradient(120% 90% at 50% 0%, #0a0f13 0%, #020304 55%, #000 100%);
}

.content {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 0 18px calc(var(--tabbar-h) + var(--safe-bottom) + 20px);
  scrollbar-width: none;
}
.content::-webkit-scrollbar { display: none; }

.tab { display: none; animation: fadeIn .28s ease; padding-top: calc(env(safe-area-inset-top, 0px) + 14px); }
.tab.active { display: block; }

@keyframes fadeIn { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
@keyframes pulseGlow {
  0%, 100% { box-shadow: 0 0 0 0 var(--accent-glow); }
  50% { box-shadow: 0 0 22px 3px var(--accent-glow); }
}
@keyframes bootSpin { to { transform: rotate(360deg); } }
@keyframes ringDraw { from { stroke-dashoffset: var(--circ); } }
@keyframes toastIn { from { opacity: 0; transform: translate(-50%, 14px); } to { opacity: 1; transform: translate(-50%, 0); } }
@keyframes chipIn { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
@keyframes countPop { 0% { transform: scale(1.55); } 100% { transform: scale(1); } }
@keyframes pulseRing { 0% { box-shadow: 0 0 0 0 var(--accent-glow); } 100% { box-shadow: 0 0 0 26px transparent; } }

/* ---------- glass ---------- */

.glass {
  background: linear-gradient(160deg, rgba(255,255,255,.1), rgba(255,255,255,.045));
  border: 1px solid var(--card-border);
  backdrop-filter: blur(18px) saturate(160%);
  -webkit-backdrop-filter: blur(18px) saturate(160%);
  border-radius: var(--radius);
  box-shadow: 0 10px 30px rgba(0,0,0,.32), inset 0 1px 0 rgba(255,255,255,.05);
}

/* ---------- home header ---------- */

.home-header { padding: 18px 4px 14px; }
.eyebrow {
  font-size: 12px; font-weight: 700; letter-spacing: .06em;
  text-transform: uppercase; color: var(--text-faint); margin-bottom: 4px;
}
.hello { font-size: 34px; font-weight: 800; letter-spacing: -0.03em; }
.subtitle { color: var(--text-dim); font-size: 15px; margin-top: 4px; }

/* ---------- rings card ---------- */

.rings-card { padding: 24px 20px 18px; margin-bottom: 14px; }
.rings-wrap {
  position: relative; width: 232px; height: 232px; margin: 0 auto;
}
.rings-ring { position: absolute; inset: 0; }
.rings-ring svg { width: 100%; height: 100%; transform: rotate(-90deg); }
.rings-ring circle {
  fill: none; stroke-width: 15; stroke-linecap: round;
  transition: stroke-dashoffset 1s cubic-bezier(.22,1,.36,1);
}
.rings-center {
  position: absolute; inset: 0; display: flex; flex-direction: column;
  align-items: center; justify-content: center; gap: 2px;
}
.rings-value { font-size: 46px; font-weight: 800; letter-spacing: -0.04em; }
.rings-label { font-size: 11px; font-weight: 700; letter-spacing: .16em; color: var(--text-faint); }
.rings-pct {
  margin-top: 4px; font-size: 11px; font-weight: 700; color: var(--accent);
  background: rgba(164,237,47,.12); padding: 3px 10px; border-radius: 99px;
}
.rings-legend { display: flex; justify-content: space-between; margin-top: 18px; }
.legend-item { display: flex; align-items: center; gap: 6px; font-size: 12px; color: var(--text-dim); }
.legend-item strong { color: var(--text); font-weight: 700; }
.dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; }
.dot-move { background: var(--move); }
.dot-exercise { background: var(--exercise); }
.dot-stand { background: var(--stand); }

/* ---------- start card ---------- */

.start-card {
  width: 100%; display: flex; align-items: center; gap: 14px;
  padding: 16px; margin-bottom: 14px; text-align: left;
  transition: transform .15s ease;
}
.start-card:active { transform: scale(.97); }
.start-icon {
  width: 52px; height: 52px; border-radius: 50%; flex: none;
  background: linear-gradient(145deg, var(--accent), #6fd81a);
  color: #081006; display: flex; align-items: center; justify-content: center;
  font-size: 18px; padding-left: 3px;
  box-shadow: 0 6px 20px rgba(164,237,47,.35);
  animation: pulseGlow 2.4s ease-in-out infinite;
}
.start-copy { flex: 1; display: flex; flex-direction: column; gap: 3px; }
.start-copy strong { font-size: 17px; font-weight: 700; }
.start-copy span { font-size: 13px; color: var(--text-dim); line-height: 1.35; }
.chevron { font-size: 26px; color: var(--text-faint); }

/* ---------- goal banner ---------- */

.goal-banner { padding: 16px; margin-bottom: 22px; }
.goal-copy { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 10px; }
.goal-copy strong { font-size: 15px; }
.goal-copy span { font-size: 12px; color: var(--text-dim); }
.goal-progress { height: 6px; background: rgba(255,255,255,.09); border-radius: 99px; overflow: hidden; }
.goal-progress-fill {
  height: 100%; width: 0%; border-radius: 99px;
  background: linear-gradient(90deg, var(--move), var(--exercise));
  transition: width .6s cubic-bezier(.22,1,.36,1);
}

/* ---------- gallery ---------- */

.gallery-section { margin-top: 4px; }
.section-head { display: flex; justify-content: space-between; align-items: center; padding: 0 4px 12px; }
.section-head h2 { font-size: 22px; font-weight: 800; letter-spacing: -0.02em; }
.link-btn { color: var(--accent); font-size: 14px; font-weight: 600; }

.gallery { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; }

.mono {
  display: flex; align-items: center; justify-content: center;
  font-weight: 800; color: #fff; border-radius: 14px;
  letter-spacing: -0.02em; flex: none;
  box-shadow: inset 0 0 0 1px rgba(255,255,255,.12), 0 6px 16px rgba(0,0,0,.25);
}

.ex-card {
  position: relative; overflow: hidden; border-radius: var(--radius);
  min-height: 150px; padding: 14px; display: flex; flex-direction: column;
  justify-content: flex-end; text-align: left;
  border: 1px solid var(--card-border);
  background: linear-gradient(170deg, rgba(255,255,255,.09), rgba(255,255,255,.02));
  transition: transform .15s ease;
}
.ex-card:active { transform: scale(.96); }
.ex-card .ex-tile {
  position: absolute; top: 14px; right: 14px;
  width: 46px; height: 46px; border-radius: 14px; overflow: hidden;
  background: linear-gradient(145deg, #3bcf52, #208d3e);
  box-shadow: 0 4px 14px rgba(0,0,0,.35);
}
.ex-card .ex-tile .work-img,
.ex-card .ex-tile .mono {
  width: 100%; height: 100%; object-fit: cover;
  display: block;
}
.ex-card .ex-tile .mono { font-size: 18px; }
.ex-card strong { font-size: 16px; font-weight: 700; }
.ex-card span { font-size: 12px; color: var(--text-dim); margin-top: 3px; line-height: 1.3; }
.ex-card .ex-best { font-size: 11px; color: var(--text-faint); margin-top: 8px; font-weight: 600; }

/* ---------- tab bar ---------- */

.tabbar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 40;
  height: calc(var(--tabbar-h) + var(--safe-bottom));
  padding: 8px 10px calc(6px + var(--safe-bottom));
  display: flex; justify-content: space-around; align-items: center;
  background: rgba(12, 12, 13, 0.72);
  backdrop-filter: blur(26px) saturate(180%);
  -webkit-backdrop-filter: blur(26px) saturate(180%);
  border-top: 1px solid rgba(255,255,255,.07);
}
.tabbar-item {
  display: flex; flex-direction: column; align-items: center; gap: 4px;
  color: var(--text-faint); font-size: 10px; font-weight: 600;
  letter-spacing: .01em; min-width: 64px; padding: 8px 12px;
  transition: color .2s ease, background .2s ease; border-radius: 16px;
}
.tabbar-item svg { width: 25px; height: 25px; fill: currentColor; }
.tabbar-item.active {
  color: var(--accent);
  background: var(--accent-soft);
  box-shadow: inset 0 0 0 1px rgba(164,237,47,.22);
}

/* ============================================================
   CAMERA / TRACK TAB (full screen)
   ============================================================ */

#tab-track { padding-top: 0; padding-left: 0; padding-right: 0; }

html.in-track { overflow: hidden; }
html.in-track body { overflow: hidden; }
html.in-track .content { position: fixed; inset: 0; overflow: hidden; padding: 0; }
html.in-track .tabbar { z-index: 55; opacity: .35; }
html.in-track .tabbar:hover, html.in-track .tabbar:active { opacity: 1; }
html.in-track .toast { bottom: calc(var(--tabbar-h) + var(--safe-bottom) + 20px); }

.cam-stage {
  position: fixed; inset: 0;
  z-index: 30;
  overflow: hidden;
  background: #050607;
}

#cam {
  position: absolute; inset: 0; width: 100%; height: 100%;
  min-width: 100%; min-height: 100%;
  object-fit: cover;
}
#overlay {
  position: absolute; inset: 0; width: 100%; height: 100%;
}

.cam-shade {
  position: absolute; inset: 0; pointer-events: none;
  background:
    linear-gradient(180deg, rgba(0,0,0,.55) 0%, rgba(0,0,0,.12) 20%, rgba(0,0,0,0) 46%, rgba(0,0,0,0) 60%, rgba(0,0,0,.6) 100%);
}

.chips {
  position: absolute; top: calc(env(safe-area-inset-top, 0px) + 12px); left: 54px; right: 54px;
  z-index: 5;
  display: flex; gap: 8px; overflow-x: auto; padding: 2px 0 6px;
  scrollbar-width: none;
}
.chips::-webkit-scrollbar { display: none; }

.chip {
  flex: none; padding: 8px 15px; font-size: 13px; font-weight: 600;
  border-radius: 99px; color: rgba(235,235,245,.9);
  background: rgba(20,22,25,.62);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border: 1px solid rgba(255,255,255,.14);
  transition: all .18s ease;
  animation: chipIn .3s ease backwards;
  white-space: nowrap;
}
.chip.active {
  color: #081006; background: var(--accent); font-weight: 700;
  box-shadow: 0 4px 18px rgba(164,237,47,.35);
}

/* green circle badge — top left */
.workout-badge {
  position: absolute; top: calc(env(safe-area-inset-top, 0px) + 58px); left: 16px;
  width: 78px; height: 78px; border-radius: 50%;
  background: linear-gradient(145deg, #39d353, #1f9e3d);
  padding: 5px;
  border: 2px solid rgba(255,255,255,.28);
  z-index: 5;
  box-shadow: 0 6px 22px rgba(0,0,0,.5), 0 0 0 6px rgba(0,0,0,.18);
}
.workout-badge img {
  width: 100%; height: 100%; border-radius: 50%;
  object-fit: cover;
  background: linear-gradient(145deg, #3bcf52, #208d3e);
}
.workout-badge.drop { animation: badgeIn .4s cubic-bezier(.2,.9,.3,1.2); }
@keyframes badgeIn { from { transform: scale(.6) translateY(-6px); opacity: 0; } to { transform: none; opacity: 1; } }

/* workout name — top middle */
.track-title {
  position: absolute; top: calc(env(safe-area-inset-top, 0px) + 72px);
  left: 50%; transform: translateX(-50%);
  z-index: 5; text-align: center; pointer-events: none;
  width: calc(100vw - 250px); min-width: 110px; max-width: 340px;
}
.track-title h1 {
  font-size: 20px; font-weight: 800; letter-spacing: -0.02em;
  color: #fff;
  text-shadow: 0 1px 12px rgba(0,0,0,.7);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.track-title span {
  display: block; margin-top: 2px;
  font-size: 11px; font-weight: 600; color: rgba(255,255,255,.7);
  text-shadow: 0 1px 8px rgba(0,0,0,.7);
}

/* set timer — top right */
.track-timer {
  position: absolute; top: calc(env(safe-area-inset-top, 0px) + 58px); right: 16px;
  z-index: 5; text-align: right; pointer-events: none;
  display: flex; flex-direction: column; align-items: flex-end; gap: 6px;
}
.track-timer svg { color: rgba(255,255,255,.85); }
.track-timer > span {
  font-size: 36px; font-weight: 800; font-variant-numeric: tabular-nums;
  letter-spacing: -0.03em; color: #fff;
  text-shadow: 0 1px 12px rgba(0,0,0,.7);
  display: inline-flex; align-items: center; gap: 7px;
}
.track-timer > span.danger { color: #ff9f0a; }
.track-timer-fill {
  width: 92px; height: 5px; border-radius: 99px;
  background: rgba(255,255,255,.22); overflow: hidden;
}
.track-timer-fillbar {
  height: 100%; width: calc(var(--p, 1) * 100%); border-radius: 99px;
  background: var(--accent);
  transition: width .25s linear;
}

.track-back {
  position: absolute; top: calc(env(safe-area-inset-top, 0px) + 12px); left: 12px;
  z-index: 6; width: 38px; height: 38px; border-radius: 50%;
  background: rgba(20,22,25,.62); border: 1px solid rgba(255,255,255,.14);
  color: #fff; display: flex; align-items: center; justify-content: center;
  backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px);
}
.track-back:active { background: rgba(255,255,255,.2); }

.track-pill {
  padding: 6px 11px; border-radius: 99px;
  font-size: 12px; font-weight: 700;
  background: rgba(20,22,25,.62); backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border: 1px solid rgba(255,255,255,.14);
  position: absolute; z-index: 5;
}
.track-pill.tag-mid { bottom: calc(var(--tabbar-h) + var(--safe-bottom) + 10px); left: 50%; transform: translateX(-50%); color: var(--text-dim); }
.track-pill.tag-right { bottom: calc(var(--tabbar-h) + var(--safe-bottom) + 10px); right: 14px; color: var(--text-dim); font-size: 11px; }
.track-pill.tag-mid.tag-live { color: var(--accent); }
.track-pill.tag-mid.tag-live::before {
  content: ""; display: inline-block; width: 8px; height: 8px;
  border-radius: 50%; background: var(--accent); margin-right: 7px;
  animation: pulseRing 1.6s infinite;
}

.hard-pill {
  position: absolute; top: calc(env(safe-area-inset-top, 0px) + 150px); left: 50%;
  transform: translateX(-50%); z-index: 7;
  padding: 9px 18px; border-radius: 99px;
  background: linear-gradient(145deg, var(--accent), #78da38);
  color: #081006; font-size: 14px; font-weight: 800; letter-spacing: .01em;
  box-shadow: 0 6px 22px rgba(164,237,47,.4);
  opacity: 0; pointer-events: none;
  transition: opacity .25s ease, transform .3s cubic-bezier(.2,.9,.3,1.3);
  white-space: nowrap;
}
.hard-pill.show { opacity: 1; transform: translateX(-50%) scale(1); }
.hard-pill:not(.show) { transform: translateX(-50%) scale(.8); }

.cam-overlay {
  position: absolute; left: 12px; right: 12px; bottom: calc(var(--tabbar-h) + var(--safe-bottom) + 34px);
  z-index: 6;
  padding: 12px 14px 10px;
  background: rgba(16,18,21,.58);
  border: 1px solid rgba(255,255,255,.09);
}
.cam-overlay-top { display: flex; justify-content: space-around; align-items: center; gap: 8px; }
.track-rep-block, .track-done-block { text-align: center; min-width: 80px; }
.rep-count {
  font-size: 38px; font-weight: 800; letter-spacing: -0.04em; line-height: 1;
  background: linear-gradient(180deg, #fff, #b9c4ad);
  -webkit-background-clip: text; background-clip: text; color: transparent;
}
.rep-count.pop { animation: countPop .28s ease; }
.rep-cap { font-size: 10px; letter-spacing: .16em; font-weight: 700; color: var(--text-faint); margin-top: 2px; }

.cam-meter { margin-top: 8px; }
.meter-track {
  height: 6px; border-radius: 99px; background: rgba(255,255,255,.12);
  overflow: hidden;
}
.meter-fill {
  height: 100%; width: 0%; border-radius: 99px;
  background: linear-gradient(90deg, #ffd60a, var(--accent));
  transition: width .12s linear;
}
.meter-labels { display: flex; justify-content: space-between; margin-top: 5px; font-size: 10.5px; color: var(--text-dim); }

.set-chips {
  display: flex; gap: 6px; margin-top: 8px; overflow-x: auto;
  scrollbar-width: none; padding: 2px 0;
}
.set-chips::-webkit-scrollbar { display: none; }
.set-chip {
  flex: none; padding: 6px 12px; border-radius: 99px;
  font-size: 11.5px; font-weight: 700;
  color: var(--text-dim);
  background: rgba(255,255,255,.08);
  border: 1px solid rgba(255,255,255,.12);
  transition: all .16s ease;
}
.set-chip.active {
  color: #081006; background: var(--accent); font-weight: 800;
  border-color: transparent;
  box-shadow: 0 4px 16px rgba(164,237,47,.3);
}

.cam-controls {
  display: flex; align-items: center; justify-content: center; gap: 12px; margin-top: 10px;
}
.primary-btn {
  flex: 1; max-width: 420px; padding: 12px; border-radius: 99px; font-size: 15px; font-weight: 700;
  background: linear-gradient(145deg, var(--accent), #78da38);
  color: #081006;
  box-shadow: 0 6px 24px rgba(164,237,47,.3);
  transition: transform .15s ease, filter .2s ease;
}
.primary-btn:active { transform: scale(.97); }
.primary-btn.paused { background: linear-gradient(145deg, #ff9f0a, #ff7a1a); color: #2a1200; }
.primary-btn.loading { filter: grayscale(.6); }
.small { padding: 12px 20px; font-size: 14px; flex: none; }

.cam-aux { display: flex; justify-content: center; gap: 8px; margin-top: 8px; }
.aux-btn {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 6px 12px; border-radius: 99px;
  font-size: 11.5px; font-weight: 700;
  color: var(--text-dim);
  background: rgba(255,255,255,.08);
  border: 1px solid rgba(255,255,255,.12);
  transition: background .15s ease;
}
.aux-btn:active { background: rgba(255,255,255,.18); }

.icon-btn {
  width: 44px; height: 44px; border-radius: 50%; flex: none;
  background: rgba(255,255,255,.1); border: 1px solid rgba(255,255,255,.12);
  color: var(--text); font-size: 18px;
  display: flex; align-items: center; justify-content: center;
  transition: background .15s ease;
}
.icon-btn:active { background: rgba(255,255,255,.2); }

.quality-toast {
  position: absolute; top: calc(env(safe-area-inset-top, 0px) + 205px); left: 50%;
  transform: translateX(-50%);
  z-index: 7; padding: 10px 18px; border-radius: 99px;
  background: rgba(16,18,21,.8); border: 1px solid var(--card-border);
  font-size: 14px; font-weight: 700; opacity: 0;
  transition: opacity .25s ease; pointer-events: none;
  white-space: nowrap;
}
.quality-toast.show { opacity: 1; }

.cam-empty {
  position: absolute; inset: 0; z-index: 8;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 8px; text-align: center; padding: 30px;
  background: rgba(0,0,0,.55);
}
.cam-empty .icon { font-size: 42px; margin-bottom: 6px; }
.cam-empty strong { font-size: 17px; }
.cam-empty span { color: var(--text-dim); font-size: 13px; max-width: 260px; line-height: 1.4; }
.cam-empty .primary-btn { margin-top: 12px; }

.monitor-note {
  position: absolute; top: calc(env(safe-area-inset-top, 0px) + 205px); left: 50%;
  transform: translateX(-50%); z-index: 7;
  font-size: 13px; font-weight: 600; color: rgba(255,255,255,.85);
  background: rgba(16,18,21,.72);
  padding: 9px 16px; border-radius: 99px;
  border: 1px solid var(--card-border);
  text-align: center; white-space: nowrap;
  box-shadow: 0 2px 14px rgba(0,0,0,.4);
}

/* ============================================================
   HISTORY
   ============================================================ */

.stats-row { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin-bottom: 14px; }
.stat { padding: 14px 10px; text-align: center; }
.stat strong { display: block; font-size: 24px; font-weight: 800; letter-spacing: -0.02em; }
.stat span { font-size: 11px; color: var(--text-dim); font-weight: 600; }

.chart-card { padding: 16px 16px 10px; margin-bottom: 18px; }
.chart-head { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 8px; }
.chart-head strong { font-size: 15px; font-weight: 700; }
.chart-head span { font-size: 12px; color: var(--text-dim); }

.history-list { display: flex; flex-direction: column; gap: 10px; }

.session {
  display: flex; align-items: center; gap: 13px; padding: 14px;
  border: 1px solid var(--card-border);
  border-radius: var(--radius);
  background: linear-gradient(160deg, rgba(255,255,255,.09), rgba(255,255,255,.03));
}
.session .session-tile {
  position: relative; width: 50px; height: 50px; flex: none;
  border-radius: 14px; overflow: hidden;
  background: linear-gradient(145deg, #3bcf52, #208d3e);
  box-shadow: 0 4px 14px rgba(0,0,0,.3);
}
.session-tile .work-img,
.session-tile .mono {
  width: 100%; height: 100%; object-fit: cover; display: block;
}
.session-tile .mono { font-size: 16px; }
.session-hard {
  position: absolute; left: -2px; bottom: -2px;
  font-style: normal; font-size: 8px; font-weight: 800;
  color: #081006; background: var(--accent);
  padding: 2px 6px; border-radius: 8px 10px 0 10px;
  letter-spacing: .03em;
}
.session-meta { flex: 1; min-width: 0; }
.session-meta strong { font-size: 15px; font-weight: 700; display: block; }
.session-meta span { font-size: 12px; color: var(--text-dim); }
.session-reps { text-align: right; flex: none; }
.session-reps strong { font-size: 20px; font-weight: 800; }
.session-reps span { display: block; font-size: 10px; letter-spacing: .12em; color: var(--text-faint); font-weight: 700; }

.history-empty { text-align: center; padding: 40px 20px; }
.history-empty .empty-mark { color: var(--accent); margin-bottom: 10px; }
.history-empty svg { display: block; margin: 0 auto; }
.history-empty p { font-size: 16px; font-weight: 700; }
.history-empty span { font-size: 13px; color: var(--text-dim); display: block; margin: 6px 0 16px; }

/* ============================================================
   SETTINGS
   ============================================================ */

.set-group { margin-bottom: 22px; }
.set-group h3 {
  font-size: 13px; font-weight: 700; text-transform: uppercase;
  letter-spacing: .08em; color: var(--text-faint);
  padding: 0 4px 10px;
}
.setting {
  display: flex; align-items: center; justify-content: space-between; gap: 14px;
  padding: 15px 16px; margin-bottom: 9px;
}
.setting > div:first-child { flex: 1; min-width: 0; }
.setting strong { font-size: 15px; font-weight: 600; display: block; }
.setting span { font-size: 12px; color: var(--text-dim); line-height: 1.35; display: block; margin-top: 2px; }

.seg-select {
  flex: none; max-width: 168px;
  background: rgba(255,255,255,.09); color: var(--text);
  border-radius: 12px; padding: 10px 12px; font-size: 13px; font-weight: 600;
  border: 1px solid var(--card-border); outline: none;
  -webkit-appearance: none; appearance: none;
}
.setting select option { background: #1c1c1e; color: var(--text); }

input[type="range"] {
  -webkit-appearance: none; appearance: none; width: 130px; height: 38px;
  background: transparent; outline: none;
}
input[type="range"]::-webkit-slider-runnable-track {
  height: 6px; border-radius: 99px; background: rgba(255,255,255,.12);
}
input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none; margin-top: -8px;
  width: 22px; height: 22px; border-radius: 50%;
  background: var(--accent); border: 3px solid #fff;
  box-shadow: 0 2px 8px rgba(0,0,0,.5);
}
input[type="range"]::-moz-range-track { height: 6px; border-radius: 99px; background: rgba(255,255,255,.12); }
input[type="range"]::-moz-range-thumb { width: 22px; height: 22px; border-radius: 50%; background: var(--accent); border: 3px solid #fff; }

.switch { position: relative; width: 51px; height: 31px; flex: none; }
.switch input { opacity: 0; width: 0; height: 0; }
.slider {
  position: absolute; inset: 0; border-radius: 99px;
  background: rgba(120,120,128,.32); transition: background .25s ease;
}
.slider::before {
  content: ""; position: absolute; left: 2px; top: 2px;
  width: 27px; height: 27px; border-radius: 50%; background: #fff;
  transition: transform .25s cubic-bezier(.3,1.4,.5,1); box-shadow: 0 2px 6px rgba(0,0,0,.4);
}
.switch input:checked + .slider { background: var(--accent); }
.switch input:checked + .slider::before { transform: translateX(20px); }

.danger-btn {
  flex: none; padding: 10px 16px; border-radius: 12px;
  background: rgba(255,69,58,.15); color: var(--danger);
  border: 1px solid rgba(255,69,58,.35); font-weight: 700; font-size: 13px;
}
.danger-btn:active { background: rgba(255,69,58,.3); }

.about {
  display: flex; align-items: center; gap: 14px; padding: 16px; margin-top: 6px;
}
.about-logo { width: 48px; height: 48px; border-radius: 12px; flex: none; }
.about strong { font-size: 15px; display: block; }
.about span { font-size: 12px; color: var(--text-dim); line-height: 1.4; display: block; margin-top: 3px; }

/* ============================================================
   BOOT / TOAST
   ============================================================ */

.boot {
  position: fixed; inset: 0; z-index: 100;
  background: #000;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 18px;
  transition: opacity .5s ease, visibility .5s ease;
}
.boot.hide { opacity: 0; visibility: hidden; pointer-events: none; }
.boot-logo { width: 92px; height: 92px; border-radius: 24px; overflow: hidden; animation: pulseGlow 2s infinite; }
.boot-logo img { width: 100%; height: 100%; object-fit: cover; }
.boot-ring {
  width: 46px; height: 46px; border-radius: 50%;
  border: 4px solid rgba(255,255,255,.12); border-top-color: var(--accent);
  animation: bootSpin .9s linear infinite;
}
.boot-text { font-size: 13px; color: var(--text-dim); }

.toast {
  position: fixed; left: 50%; bottom: calc(var(--tabbar-h) + 24px);
  transform: translateX(-50%); z-index: 90; padding: 12px 20px;
  border-radius: 14px; background: rgba(30,32,36,.92); border: 1px solid var(--card-border);
  color: var(--text); font-size: 14px; font-weight: 600;
  opacity: 0; pointer-events: none; transition: opacity .3s ease;
  max-width: 86vw; text-align: center;
}
.toast.show { opacity: 1; animation: toastIn .3s ease; }

/* ---------- responsive ---------- */

@media (max-width: 360px) {
  .gallery { grid-template-columns: 1fr; }
  .rep-count { font-size: 34px; }
  .rings-wrap { width: 200px; height: 200px; }
}

@media (min-width: 700px) {
  .content { padding-left: max(18px, env(safe-area-inset-left)); padding-right: max(18px, env(safe-area-inset-right)); }
  .gallery { grid-template-columns: repeat(4, 1fr); }
  .cam-stage { max-width: 640px; margin-left: auto; margin-right: auto; }
  .cam-overlay { left: 50%; transform: translateX(-50%); width: 100%; max-width: 640px; }
  .rings-wrap { width: 260px; height: 260px; }
}