:root {
  --bg: #120a0d;
  --bg2: #1b1014;
  --card: #21141a;
  --card2: #2a1a21;
  --line: rgba(255, 255, 255, .07);
  --text: #fbeff0;
  --muted: #b39aa1;
  --red: #ec3b2c;
  --red2: #ff6b55;
  --green: #4cd18a;
  --blue: #5aa9ff;
  --amber: #ffb547;
  --radius: 20px;
  --tabh: 68px;
  --safe-b: env(safe-area-inset-bottom, 0px);
  --safe-t: env(safe-area-inset-top, 0px);
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; height: 100%; background: var(--bg); color: var(--text); }
body {
  font: 15px/1.45 system-ui, -apple-system, "Segoe UI", Roboto, "Noto Sans", sans-serif;
  background: radial-gradient(120% 60% at 50% -10%, #3a1218 0%, var(--bg) 60%) fixed;
  overscroll-behavior-y: none;
  -webkit-font-smoothing: antialiased;
}
button, input, select { font: inherit; color: inherit; }
button { cursor: pointer; border: 0; background: none; touch-action: manipulation; }
[hidden] { display: none !important; }
.muted { color: var(--muted); }
.mini { font-size: 12.5px; }
.row { display: flex; align-items: center; }
.row.gap { gap: 10px; }
.row.between { justify-content: space-between; gap: 10px; }
.row.center { justify-content: center; }
.row.wrap { flex-wrap: wrap; }

/* ---------- top bar ---------- */
.topbar {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; justify-content: space-between;
  padding: calc(10px + var(--safe-t)) 18px 10px;
  background: linear-gradient(var(--bg) 60%, transparent);
}
.brand { display: flex; align-items: center; gap: 8px; font-weight: 800; letter-spacing: .2px; font-size: 17px; }
.top-right { display: flex; align-items: center; gap: 10px; }
.net-dot { width: 9px; height: 9px; border-radius: 50%; background: #666; box-shadow: 0 0 0 3px rgba(255,255,255,.05); }
.net-dot.ok { background: var(--green); }
.net-dot.off { background: var(--amber); }
.chip { padding: 4px 10px; border-radius: 99px; background: var(--card2); font-size: 13px; }
.chip-fire b { color: var(--amber); }

/* ---------- views ---------- */
#views { padding: 4px 14px calc(var(--tabh) + var(--safe-b) + 24px); max-width: 560px; margin: 0 auto; }
.view { display: none; animation: fadeIn .28s ease; }
.view.active { display: block; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

.card {
  background: linear-gradient(180deg, var(--card), var(--bg2));
  border: 1px solid var(--line); border-radius: var(--radius);
  padding: 14px 16px; margin: 12px 0;
  box-shadow: 0 10px 30px rgba(0,0,0,.25);
}
.card-h { display: flex; align-items: center; justify-content: space-between; gap: 8px; font-weight: 700; margin-bottom: 10px; }
.card-h b { font-variant-numeric: tabular-nums; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.grid2 .card { margin: 0; }

.btn {
  min-height: 46px; padding: 0 18px; border-radius: 14px;
  background: var(--card2); border: 1px solid var(--line); font-weight: 700;
  transition: transform .12s ease, background .2s, opacity .2s;
}
.btn:active { transform: scale(.96); }
.btn:disabled { opacity: .45; }
.btn.small { min-height: 38px; padding: 0 14px; font-size: 14px; border-radius: 12px; }
.btn.primary { background: linear-gradient(135deg, var(--red2), var(--red)); border: 0; color: #fff; box-shadow: 0 8px 22px rgba(236, 59, 44, .35); }
.btn.danger { background: #3a1a1e; color: #ff8e83; border-color: rgba(255,120,110,.25); }
.btn.danger-ghost { color: #ff8e83; }
.btn.ghost { background: transparent; }
.btn.big { min-height: 58px; font-size: 17px; border-radius: 18px; flex: 1; }
.badge { font-size: 12px; padding: 3px 10px; border-radius: 99px; background: var(--card2); color: var(--muted); font-weight: 600; }
.badge.ok { background: rgba(76, 209, 138, .15); color: var(--green); }
.badge.warn { background: rgba(255, 181, 71, .15); color: var(--amber); }

.seg { display: flex; background: var(--card); border: 1px solid var(--line); border-radius: 14px; padding: 4px; gap: 4px; margin: 10px auto; max-width: 360px; }
.seg button { flex: 1; min-height: 40px; border-radius: 10px; font-weight: 700; color: var(--muted); transition: background .2s, color .2s; }
.seg button.on { background: var(--card2); color: var(--text); box-shadow: inset 0 0 0 1px rgba(236,59,44,.5); }

.bar { height: 8px; border-radius: 99px; background: rgba(255,255,255,.07); overflow: hidden; margin: 8px 0 6px; }
.bar i { display: block; height: 100%; width: 0; border-radius: inherit; background: linear-gradient(90deg, var(--red2), var(--red)); transition: width .6s cubic-bezier(.2,.8,.2,1); }

/* ---------- desktop live card ---------- */
.desktop-card { display: flex; align-items: center; gap: 12px; padding: 10px 14px; }
.dc-left { position: relative; width: 44px; height: 44px; flex: none; }
.dc-ring { width: 44px; height: 44px; transform: rotate(-90deg); }
.dc-track { fill: none; stroke: rgba(255,255,255,.08); stroke-width: 4; }
.dc-prog { fill: none; stroke: var(--red); stroke-width: 4; stroke-linecap: round; stroke-dasharray: 119.4; stroke-dashoffset: 119.4; transition: stroke-dashoffset 1s linear; }
.desktop-card.brk .dc-prog { stroke: var(--green); }
.desktop-card.idle .dc-prog { stroke: #777; }
.dc-ico { position: absolute; inset: 0; display: grid; place-items: center; font-size: 18px; }
.dc-mid { flex: 1; min-width: 0; }
.dc-title { font-weight: 700; font-size: 14px; }
.dc-sub { color: var(--muted); font-size: 12.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.dc-time { font-size: 22px; font-weight: 800; font-variant-numeric: tabular-nums; }

/* ---------- tomato timer ---------- */
.timer-wrap { text-align: center; padding-top: 4px; }
.phase-chip { display: inline-block; padding: 6px 14px; border-radius: 99px; font-weight: 700; font-size: 13.5px; background: rgba(236,59,44,.15); color: var(--red2); transition: all .3s; }
.timer-wrap[data-phase="short"] .phase-chip, .timer-wrap[data-phase="long"] .phase-chip { background: rgba(76,209,138,.15); color: var(--green); }
.tomato-timer { position: relative; width: min(78vw, 330px); aspect-ratio: 1; margin: 8px auto 4px; }
.ring { position: absolute; inset: 0; width: 100%; height: 100%; transform: rotate(-90deg); }
.ring-track { fill: none; stroke: rgba(255,255,255,.06); stroke-width: 12; }
.ring-prog { fill: none; stroke: url(#ringGrad); stroke-width: 12; stroke-linecap: round; stroke-dasharray: 854.5; stroke-dashoffset: 0; transition: stroke-dashoffset .5s linear; filter: drop-shadow(0 0 8px rgba(236,59,44,.45)); }
.timer-wrap[data-phase="short"] .ring-prog, .timer-wrap[data-phase="long"] .ring-prog { stroke: url(#ringGradBreak); filter: drop-shadow(0 0 8px rgba(76,209,138,.4)); }
.tomato-img { position: absolute; left: 17%; top: 14%; width: 66%; height: 66%; filter: drop-shadow(0 18px 30px rgba(0,0,0,.45)); transition: transform .4s; }
.timer-wrap.running .tomato-img { animation: breathe 4s ease-in-out infinite; }
.timer-wrap[data-phase="short"] .tomato-img, .timer-wrap[data-phase="long"] .tomato-img { filter: drop-shadow(0 18px 30px rgba(0,0,0,.45)) saturate(.75) brightness(.9); }
@keyframes breathe { 0%,100% { transform: scale(1); } 50% { transform: scale(1.035); } }
.countdown { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; padding-top: 14%; pointer-events: none; }
.time { font-size: clamp(46px, 15vw, 64px); font-weight: 800; letter-spacing: -1px; font-variant-numeric: tabular-nums; text-shadow: 0 3px 14px rgba(0,0,0,.55); }
.cycle-dots { display: flex; gap: 6px; margin-top: 2px; }
.cycle-dots i { width: 9px; height: 9px; border-radius: 50%; background: rgba(255,255,255,.35); }
.cycle-dots i.done { background: #fff; box-shadow: 0 0 8px rgba(255,255,255,.6); }
.task-input { width: 100%; max-width: 360px; margin: 8px auto 0; display: block; text-align: center; padding: 12px 14px; border-radius: 14px; border: 1px solid var(--line); background: rgba(255,255,255,.04); outline: none; }
.task-input:focus { border-color: rgba(236,59,44,.6); }
.controls { display: flex; align-items: center; justify-content: center; gap: 22px; margin: 8px 0 4px; }
.ctl { width: 58px; height: 58px; border-radius: 50%; font-size: 22px; background: var(--card2); border: 1px solid var(--line); transition: transform .12s; }
.ctl:active { transform: scale(.92); }
.ctl.main { width: 84px; height: 84px; font-size: 30px; color: #fff; background: linear-gradient(135deg, var(--red2), var(--red)); border: 0; box-shadow: 0 12px 30px rgba(236,59,44,.45); }
.timer-wrap[data-phase="short"] .ctl.main, .timer-wrap[data-phase="long"] .ctl.main { background: linear-gradient(135deg, #6fe39b, #1fa86f); box-shadow: 0 12px 30px rgba(31,168,111,.4); }
.run-controls { gap: 10px; }

/* ---------- break card & exercises ---------- */
.break-card { border-color: rgba(76,209,138,.3); background: linear-gradient(180deg, #13241c, var(--bg2)); }
.break-head { display: flex; justify-content: space-between; gap: 10px; align-items: flex-start; }
.break-title { font-weight: 800; font-size: 16px; }
.break-sub { color: var(--muted); font-size: 13px; }
.ex-list { display: grid; gap: 10px; margin-top: 12px; }
.ex-group { font-size: 12px; text-transform: uppercase; letter-spacing: .8px; color: var(--green); font-weight: 800; margin-top: 4px; }
.ex { display: flex; gap: 12px; align-items: center; background: rgba(255,255,255,.04); border-radius: 14px; padding: 10px; }
.ex-art { width: 64px; height: 64px; flex: none; border-radius: 14px; background: #0f1a15; display: grid; place-items: center; overflow: hidden; }
.ex-art svg { width: 56px; height: 56px; }
.ex b { display: block; font-size: 14.5px; }
.ex span { color: var(--muted); font-size: 13px; }
.fig { stroke: #bff5d5; stroke-width: 3.2; stroke-linecap: round; fill: none; }
.fig-fill { fill: #bff5d5; }
.a-eyes { animation: eyes 3s ease-in-out infinite; }
@keyframes eyes { 0%,100% { transform: translateX(0); } 25% { transform: translateX(-4px); } 75% { transform: translateX(4px); } }
.a-neck { transform-origin: 28px 30px; animation: neck 3s ease-in-out infinite; }
@keyframes neck { 0%,100% { transform: rotate(0); } 25% { transform: rotate(-22deg); } 75% { transform: rotate(22deg); } }
.a-shrug { animation: shrug 1.6s ease-in-out infinite; }
@keyframes shrug { 0%,100% { transform: translateY(0); } 50% { transform: translateY(-5px); } }
.a-walk { animation: walk 2.4s linear infinite; }
@keyframes walk { from { transform: translateX(-14px); } to { transform: translateX(14px); } }
.a-legL { transform-origin: 28px 36px; animation: legs .6s ease-in-out infinite alternate; }
.a-legR { transform-origin: 28px 36px; animation: legs .6s ease-in-out infinite alternate-reverse; }
@keyframes legs { from { transform: rotate(-20deg); } to { transform: rotate(20deg); } }
.a-squat { animation: squat 2s ease-in-out infinite; transform-origin: 28px 52px; }
@keyframes squat { 0%,100% { transform: scaleY(1); } 50% { transform: scaleY(.72); } }
.a-bend { transform-origin: 28px 34px; animation: bend 3s ease-in-out infinite; }
@keyframes bend { 0%,100% { transform: rotate(0); } 50% { transform: rotate(-35deg); } }
.a-blink { animation: blink 3s infinite; transform-origin: center; }
@keyframes blink { 0%,92%,100% { transform: scaleY(1); } 95% { transform: scaleY(.1); } }

/* ---------- goal & water ---------- */
.goal-tomatoes { display: flex; flex-wrap: wrap; gap: 3px; min-height: 22px; }
.goal-tomatoes img { width: 20px; height: 20px; transition: transform .3s, opacity .3s; }
.goal-tomatoes img.off { opacity: .18; filter: grayscale(1); }
.goal-tomatoes img.pop { animation: pop .5s ease; }
@keyframes pop { 0% { transform: scale(.3); } 70% { transform: scale(1.3); } 100% { transform: scale(1); } }
.cups { display: flex; flex-wrap: wrap; gap: 4px; min-height: 26px; margin-bottom: 8px; }
.cup { width: 16px; height: 22px; border: 2px solid rgba(90,169,255,.5); border-top: 0; border-radius: 0 0 5px 5px; position: relative; overflow: hidden; }
.cup.full::after { content: ""; position: absolute; left: 0; right: 0; bottom: 0; height: 80%; background: linear-gradient(#7cc0ff, #2f86ff); animation: fill .5s ease; }
@keyframes fill { from { height: 0; } }
.water-btn { flex: 1; background: linear-gradient(135deg, #5aa9ff, #2f6dff); border: 0; color: #fff; }

/* ---------- bars chart ---------- */
.legend { display: flex; align-items: center; gap: 6px; font-size: 11.5px; font-weight: 500; color: var(--muted); }
.legend i { width: 10px; height: 10px; border-radius: 3px; display: inline-block; }
.lg-d { background: var(--red); }
.lg-p { background: var(--amber); }
.bars { display: flex; align-items: flex-end; gap: 8px; height: 140px; padding-top: 16px; }
.bcol { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: flex-end; height: 100%; gap: 4px; min-width: 0; }
.bstack { width: 100%; max-width: 34px; display: flex; flex-direction: column-reverse; border-radius: 8px; overflow: hidden; background: rgba(255,255,255,.04); position: relative; transition: height .6s cubic-bezier(.2,.8,.2,1); min-height: 3px; }
.bstack i { display: block; width: 100%; }
.bstack .d { background: linear-gradient(var(--red2), var(--red)); }
.bstack .p { background: linear-gradient(#ffd27a, var(--amber)); }
.bstack .f { background: linear-gradient(#ff9a7a, #e5532a); }
.bstack .w { background: linear-gradient(#6fe39b, #1fa86f); }
.bval { font-size: 11px; font-weight: 700; color: var(--text); }
.blbl { font-size: 11px; color: var(--muted); }
.bcol.today .blbl { color: var(--text); font-weight: 800; }
.bcol.hit .bval::after { content: " ✓"; color: var(--green); }

/* ---------- run ---------- */
.map-wrap { position: relative; height: 34vh; min-height: 220px; border-radius: var(--radius); overflow: hidden; border: 1px solid var(--line); margin-top: 6px; background: #1a1418; }
#map { position: absolute; inset: 0; }
.gps-badge { position: absolute; z-index: 500; left: 10px; top: 10px; padding: 5px 10px; border-radius: 99px; background: rgba(18,10,13,.85); font-size: 12.5px; font-weight: 600; backdrop-filter: blur(6px); }
.gps-badge.ok { color: var(--green); }
.gps-badge.weak { color: var(--amber); }
.run-big { display: flex; align-items: flex-end; justify-content: space-between; padding: 14px 6px 4px; }
.run-dist { font-size: 64px; font-weight: 900; letter-spacing: -2px; line-height: 1; font-variant-numeric: tabular-nums; }
.run-dist small { font-size: 18px; letter-spacing: 0; margin-left: 6px; color: var(--muted); font-weight: 700; }
.run-time { font-size: 34px; font-weight: 800; font-variant-numeric: tabular-nums; }
.stats3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin: 12px 0; }
.stat { background: var(--card); border: 1px solid var(--line); border-radius: 16px; padding: 12px 8px; text-align: center; }
.stat b { display: block; font-size: 22px; font-variant-numeric: tabular-nums; }
.stat span { font-size: 11.5px; color: var(--muted); }
.switch-row { display: flex; align-items: center; justify-content: space-between; min-height: 46px; gap: 10px; cursor: pointer; }
.switch-row input { display: none; }
.switch { width: 50px; height: 30px; border-radius: 99px; background: #3a2a30; position: relative; flex: none; transition: background .2s; }
.switch::after { content: ""; position: absolute; left: 3px; top: 3px; width: 24px; height: 24px; border-radius: 50%; background: #fff; transition: transform .22s cubic-bezier(.3,1.4,.6,1); }
.switch-row input:checked + .switch { background: var(--red); }
.switch-row input:checked + .switch::after { transform: translateX(20px); }
.int-cfg { display: flex; flex-wrap: wrap; gap: 10px 14px; padding: 6px 0; }
.int-cfg label, .lbl { display: flex; align-items: center; gap: 8px; color: var(--muted); font-size: 14px; min-height: 44px; }
.int-cfg input, .lbl input[type=number], .lbl input[type=time], .lbl select, .inp {
  width: 74px; min-height: 40px; padding: 6px 10px; border-radius: 10px; border: 1px solid var(--line); background: rgba(255,255,255,.05); color: var(--text); text-align: center; outline: none;
}
.lbl input[type=time] { width: 110px; }
.lbl select { width: 100px; }
.inp { flex: 1; width: auto; text-align: left; }
.lbl.slider { gap: 12px; }
.lbl.slider input { flex: 1; accent-color: var(--red); }
.int-now { display: flex; align-items: baseline; gap: 12px; justify-content: center; padding: 8px 0 2px; }
.int-now span { font-weight: 800; font-size: 18px; }
.int-now b { font-size: 40px; font-variant-numeric: tabular-nums; }
.int-now.walk span { color: var(--blue); }
.int-now.run span { color: var(--red2); }
.splits { display: grid; gap: 6px; }
.split { display: grid; grid-template-columns: 54px 1fr 70px; align-items: center; gap: 10px; font-size: 14px; }
.split .sbar { height: 8px; border-radius: 99px; background: linear-gradient(90deg, var(--red2), var(--red)); }
.split b { text-align: right; font-variant-numeric: tabular-nums; }

/* ---------- rope ---------- */
.rope-stage { text-align: center; padding: 18px 10px 14px; border-radius: 26px; margin: 10px 0; background: radial-gradient(90% 90% at 50% 0%, #3b1a20, var(--card)); border: 1px solid var(--line); transition: background .4s; }
.rope-stage[data-state="work"] { background: radial-gradient(90% 90% at 50% 0%, #5a1a1c, var(--card)); }
.rope-stage[data-state="rest"] { background: radial-gradient(90% 90% at 50% 0%, #133528, var(--card)); }
.rope-stage[data-state="prep"] { background: radial-gradient(90% 90% at 50% 0%, #3d3015, var(--card)); }
.rope-phase { font-weight: 800; color: var(--muted); letter-spacing: .5px; }
.rope-count { font-size: clamp(80px, 30vw, 128px); font-weight: 900; line-height: 1.05; font-variant-numeric: tabular-nums; letter-spacing: -3px; }
.rope-count.bump { animation: bump .18s ease; }
@keyframes bump { 50% { transform: scale(1.06); } }
.rope-sub { color: var(--muted); font-variant-numeric: tabular-nums; }
.target-bar { max-width: 280px; margin: 12px auto 4px; }
.tap-pad { width: 100%; min-height: 120px; border-radius: 24px; background: repeating-linear-gradient(135deg, #2a1a21 0 14px, #26171d 14px 28px); border: 2px dashed rgba(236,59,44,.35); font-size: 18px; font-weight: 800; color: var(--red2); margin: 4px 0 12px; user-select: none; -webkit-user-select: none; transition: transform .08s; }
.tap-pad:active { transform: scale(.98); background: #3a1a21; }

/* ---------- stats ---------- */
.hero-stat { display: flex; align-items: center; justify-content: space-between; background: linear-gradient(135deg, #4a1518, #22121a); }
.hs-streak { display: flex; align-items: baseline; gap: 8px; }
.hs-streak span { font-size: 30px; }
.hs-streak b { font-size: 44px; font-weight: 900; color: var(--amber); }
.hs-streak small { color: var(--muted); }
.hs-today { color: var(--muted); font-weight: 600; text-align: right; }
.tiles { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.tile { background: var(--card); border: 1px solid var(--line); border-radius: 18px; padding: 14px; display: flex; flex-direction: column; gap: 2px; }
.tile span { font-size: 22px; }
.tile b { font-size: 28px; font-weight: 900; font-variant-numeric: tabular-nums; }
.tile small { color: var(--muted); font-size: 12.5px; }
.hist { display: grid; gap: 8px; }
.hitem { display: flex; align-items: center; gap: 12px; padding: 10px; border-radius: 14px; background: rgba(255,255,255,.035); }
.hitem .hico { width: 42px; height: 42px; border-radius: 12px; display: grid; place-items: center; font-size: 22px; background: var(--card2); flex: none; }
.hitem .hmain { flex: 1; min-width: 0; }
.hitem .hmain b { display: block; }
.hitem .hmain small { color: var(--muted); }
.hitem .hval { font-weight: 800; text-align: right; font-variant-numeric: tabular-nums; }

/* ---------- settings ---------- */
.days { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 6px; }
.days button { width: 42px; height: 42px; border-radius: 12px; background: var(--card2); color: var(--muted); font-weight: 700; font-size: 13px; border: 1px solid var(--line); }
.days button.on { background: rgba(236,59,44,.2); color: var(--red2); border-color: rgba(236,59,44,.5); }
.ios-hint { background: rgba(90,169,255,.1); border: 1px solid rgba(90,169,255,.25); color: #cfe4ff; padding: 10px 12px; border-radius: 12px; font-size: 13.5px; margin-bottom: 10px; }
.ios-share { display: inline-block; transform: rotate(-90deg); }
.foot { text-align: center; padding: 10px 0; }
#pairCard p { margin: 0 0 10px; font-size: 14px; }
#pairYes .btn { margin: 4px 6px 0 0; }

/* ---------- tab bar ---------- */
.tabbar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 30;
  display: flex; justify-content: space-around;
  height: calc(var(--tabh) + var(--safe-b)); padding-bottom: var(--safe-b);
  background: rgba(20, 11, 14, .88); backdrop-filter: blur(16px); -webkit-backdrop-filter: blur(16px);
  border-top: 1px solid var(--line);
}
.tabbar button { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; color: var(--muted); position: relative; transition: color .2s; }
.tabbar button span { font-size: 23px; transition: transform .25s cubic-bezier(.3,1.5,.6,1); filter: grayscale(.6); }
.tabbar button small { font-size: 11px; font-weight: 600; }
.tabbar button.on { color: var(--text); }
.tabbar button.on span { transform: translateY(-2px) scale(1.12); filter: none; }
.tabbar button.on::before { content: ""; position: absolute; top: 0; width: 28px; height: 3px; border-radius: 0 0 3px 3px; background: var(--red); }

/* ---------- overlays ---------- */
.overlay { position: fixed; inset: 0; z-index: 60; display: grid; place-items: center; background: rgba(8, 4, 6, .82); backdrop-filter: blur(8px); padding: 20px; animation: fadeIn .25s; }
.pair-box, .cele-box { width: min(420px, 100%); background: var(--card); border: 1px solid var(--line); border-radius: 26px; padding: 24px; text-align: center; }
.pair-box h2 { font-size: 24px; margin: 10px 0 14px; line-height: 1.25; }
.qr { background: #fff; border-radius: 18px; padding: 14px; display: inline-block; margin-bottom: 12px; }
.qr svg, .qr img { display: block; width: min(260px, 64vw); height: auto; }
.cele-emoji { font-size: 72px; animation: pop .6s ease; }
.cele-box h2 { margin: 8px 0 4px; }
#confetti { position: fixed; inset: 0; width: 100%; height: 100%; pointer-events: none; z-index: 70; }
.toast {
  position: fixed; left: 50%; bottom: calc(var(--tabh) + var(--safe-b) + 14px); transform: translateX(-50%);
  z-index: 80; background: #2f1d24; border: 1px solid rgba(255,255,255,.1); color: var(--text);
  padding: 12px 18px; border-radius: 14px; font-weight: 600; max-width: 90vw; text-align: center;
  box-shadow: 0 12px 34px rgba(0,0,0,.45); animation: toastIn .3s cubic-bezier(.2,1.3,.5,1);
}
@keyframes toastIn { from { opacity: 0; transform: translate(-50%, 16px); } }

/* Leaflet dark tweak */
.leaflet-container { background: #1a1418; }
.leaflet-tile-pane { filter: brightness(.82) contrast(1.05) saturate(.85); }

@media (min-width: 700px) {
  .tabbar { left: 50%; right: auto; width: 560px; transform: translateX(-50%); border-radius: 20px 20px 0 0; border: 1px solid var(--line); }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .001ms !important; transition-duration: .001ms !important; }
}
.barea { flex: 1; width: 100%; display: flex; align-items: flex-end; justify-content: center; min-height: 0; }
.barea .bstack { width: 100%; }

/* ---------- soundscapes ---------- */
.card-sound { padding: 12px 14px; margin-top: 14px; }
.seg-snd button { font-size: 13px; min-height: 36px; padding: 0 4px; }
.sound-vol-row { margin-top: 8px; align-items: center; justify-content: space-between; }
.sound-vol-row input[type="range"] { flex: 1; max-width: 240px; accent-color: var(--red2); }

/* ---------- breathing guide ---------- */
.breath-box { background: rgba(255,255,255,.03); border: 1px solid var(--line); border-radius: 16px; padding: 14px; margin-bottom: 14px; text-align: center; }
.breath-head { margin-bottom: 12px; font-weight: 700; font-size: 14.5px; }
.seg-mini { margin: 0; max-width: 140px; padding: 2px; }
.seg-mini button { min-height: 28px; font-size: 11.5px; padding: 0 8px; border-radius: 8px; }
.breath-visual { display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 8px 0; }
.breath-circle {
  width: 120px; height: 120px; border-radius: 50%;
  background: radial-gradient(circle, rgba(76,209,138,.35) 0%, rgba(34,176,125,.1) 70%, transparent 100%);
  border: 2px solid var(--green);
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  margin: 10px auto;
  box-shadow: 0 0 25px rgba(76,209,138,.25);
  transition: transform 1s ease-in-out, box-shadow 1s ease-in-out, border-color 1s ease;
}
.breath-circle.inhale { transform: scale(1.35); box-shadow: 0 0 40px rgba(76,209,138,.55); border-color: #8be35f; }
.breath-circle.hold { transform: scale(1.35); box-shadow: 0 0 35px rgba(255,181,71,.5); border-color: var(--amber); }
.breath-circle.exhale { transform: scale(0.85); box-shadow: 0 0 15px rgba(90,169,255,.3); border-color: var(--blue); }
.breath-circle.rest { transform: scale(0.85); box-shadow: 0 0 10px rgba(255,255,255,.1); border-color: var(--muted); }
.breath-count { font-size: 32px; font-weight: 900; line-height: 1; font-variant-numeric: tabular-nums; }
.breath-sub { font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: .5px; margin-top: 4px; color: #fff; }
.breath-tip { font-size: 13.5px; font-weight: 600; color: var(--text); min-height: 20px; margin-top: 6px; }

/* ---------- chips & sliders ---------- */
.w100 { width: 100%; }
.chips-row { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 8px; }
.chips-row button {
  min-height: 32px; padding: 0 12px; border-radius: 99px;
  background: var(--card2); border: 1px solid var(--line);
  font-size: 13px; font-weight: 700; color: var(--muted);
  transition: all .15s ease;
}
.chips-row button.on {
  background: rgba(236,59,44,.2); color: var(--red2); border-color: rgba(236,59,44,.5);
}
.metro-cfg { margin-top: 10px; padding-top: 10px; border-top: 1px solid var(--line); }
.metro-cfg input[type="range"] { width: 100%; margin: 8px 0; accent-color: var(--red); }

/* ---------- sensor visualizer ---------- */
.sensor-vis { margin-top: 10px; padding: 8px 10px; background: rgba(0,0,0,.2); border-radius: 12px; border: 1px solid var(--line); }
.vis-track { position: relative; height: 10px; border-radius: 99px; background: rgba(255,255,255,.07); overflow: hidden; margin-top: 6px; }
.vis-bar { display: block; height: 100%; width: 0%; background: var(--blue); border-radius: inherit; transition: width .06s linear, background .15s; }
.vis-bar.over { background: var(--green); box-shadow: 0 0 10px var(--green); }
.vis-thr { position: absolute; top: 0; bottom: 0; width: 3px; background: var(--amber); z-index: 2; }

/* ---------- history gpx button ---------- */
.btn-gpx { font-size: 11px; padding: 2px 8px; border-radius: 8px; background: rgba(90,169,255,.15); color: var(--blue); border: 1px solid rgba(90,169,255,.3); margin-top: 4px; display: inline-block; }
.btn-gpx:active { transform: scale(.95); }

