:root {
  --bg: var(--tg-theme-bg-color, #ffffff);
  --fg: var(--tg-theme-text-color, #111111);
  --muted: var(--tg-theme-hint-color, #8a8a8a);
  --card: var(--tg-theme-secondary-bg-color, #f2f2f5);
  --acc: var(--tg-theme-button-color, #2481cc);
  --acc-fg: var(--tg-theme-button-text-color, #ffffff);
  --ok: #2ea44f; --warn: #d4a017; --bad: #e5484d;
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; background: var(--bg); color: var(--fg); }
body { font: 16px/1.45 -apple-system, "Segoe UI", Roboto, sans-serif; padding: 12px 16px 200px; }
.hidden { display: none !important; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.center { text-align: center; }
h2 { margin: 6px 0 4px; font-size: 20px; }

form label { display: block; margin: 12px 0; font-size: 14px; color: var(--muted); }
form input:not([type=checkbox]), form select {
  display: block; width: 100%; margin-top: 4px; padding: 11px 12px; font-size: 16px;
  color: var(--fg); background: var(--card); border: 0; border-radius: 10px;
}
label.check { display: flex; gap: 10px; align-items: flex-start; color: var(--fg); }
label.check input { width: 22px; height: 22px; flex: none; margin-top: 2px; }

button { font: inherit; border: 0; border-radius: 12px; padding: 12px 16px; cursor: pointer; }
button.primary { background: var(--acc); color: var(--acc-fg); font-weight: 600; }
button.big { width: 100%; padding: 15px; font-size: 17px; }
button.ghost { background: transparent; color: var(--muted); }

.tips { padding-left: 20px; margin: 10px 0; font-size: 14px; }
.tips li { margin: 4px 0; }

.topbar { display: flex; gap: 14px; font-size: 14px; margin-bottom: 10px; flex-wrap: wrap; }
.how { background: var(--card); border-radius: 12px; padding: 10px 12px; font-size: 14px; }
.badge { display: inline-block; font-size: 12px; font-weight: 600; padding: 2px 10px;
  border-radius: 999px; background: var(--acc); color: var(--acc-fg); margin-bottom: 4px; }
.text-card { font-size: 23px; line-height: 1.4; font-weight: 500; margin: 16px 0 10px;
  padding: 16px; border-radius: 14px; background: var(--card); overflow-wrap: anywhere; }
.actions-row { display: flex; justify-content: center; margin-top: 6px; }

.result { border-radius: 12px; padding: 12px; margin: 10px 0; }
.result.ok { background: color-mix(in srgb, var(--ok) 15%, transparent); }
.result.bad { background: color-mix(in srgb, var(--bad) 15%, transparent); }
.result ul { margin: 6px 0 0; padding-left: 20px; }

.dock { position: fixed; left: 0; right: 0; bottom: 0; padding: 10px 16px
  calc(12px + env(safe-area-inset-bottom, 0px)); background: var(--bg);
  box-shadow: 0 -4px 16px rgba(0,0,0,.08); }
.timebar { position: relative; height: 10px; border-radius: 5px; background: var(--card); overflow: hidden; }
#timefill { position: absolute; left: 0; top: 0; height: 100%; width: 0; background: var(--acc);
  opacity: .75; transition: width .1s linear; }
#pacewin { position: absolute; top: 0; height: 100%; background: color-mix(in srgb, var(--ok) 45%, transparent); }
#timefill.late { background: var(--bad); }
.dock-row { display: flex; align-items: center; gap: 10px; margin: 8px 0; }
.timer { font-variant-numeric: tabular-nums; min-width: 64px; text-align: right; font-size: 14px; }
.rec { width: 100%; padding: 18px; font-size: 19px; font-weight: 700;
  background: var(--acc); color: var(--acc-fg); }
.rec.on { background: var(--bad); color: #fff; }
.rec:disabled { opacity: .5; }

#toasts { position: fixed; top: 8px; left: 12px; right: 12px; z-index: 9; }
.toast { padding: 10px 12px; border-radius: 10px; margin-bottom: 6px; font-size: 14px;
  background: var(--card); box-shadow: 0 4px 14px rgba(0,0,0,.12); }
.toast.bad { border-left: 4px solid var(--bad); }
.toast.ok { border-left: 4px solid var(--ok); }

textarea { width: 100%; font: inherit; font-size: 19px; line-height: 1.4; padding: 12px;
  border: 2px solid var(--acc); border-radius: 12px; background: var(--card); color: var(--fg); }
.fixnote { font-size: 13px; margin: 10px 0 4px; padding: 8px 10px; border-radius: 10px;
  background: color-mix(in srgb, var(--warn) 14%, transparent); }
.actions-row { gap: 8px; }

/* volume regulator: 4 personal zones, target band, live needle */
.reg { position: relative; flex: 1; height: 34px; border-radius: 8px; background: var(--card); overflow: hidden; }
.reg .zone { position: absolute; top: 0; bottom: 0; border-left: 1px dashed color-mix(in srgb, var(--fg) 25%, transparent);
  font-size: 10px; color: var(--muted); padding: 1px 3px; white-space: nowrap; }
.reg .band { position: absolute; top: 0; bottom: 0; background: color-mix(in srgb, var(--ok) 28%, transparent);
  border-left: 2px solid var(--ok); border-right: 2px solid var(--ok); }
.reg .needle { position: absolute; top: 0; bottom: 0; width: 4px; margin-left: -2px; border-radius: 2px;
  background: var(--fg); transition: left .08s linear; opacity: 0; }
.reg .needle.on { opacity: 1; }
.reg .needle.out { background: var(--bad); }
.reg-hint { min-height: 20px; font-size: 14px; font-weight: 600; text-align: center; margin-bottom: 6px; }
.reg-hint.ok { color: var(--ok); } .reg-hint.bad { color: var(--bad); }
.how-tags { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 4px; }
.badge.vol { background: color-mix(in srgb, var(--acc) 18%, transparent); color: var(--fg); }
.ev { display: inline-block; font-size: 15px; font-weight: 600; padding: 1px 8px; margin: 0 2px;
  border-radius: 999px; background: color-mix(in srgb, var(--warn) 30%, transparent); vertical-align: middle; }
.text-card.event-only .ev { font-size: 24px; padding: 6px 14px; }
.step-badge { font-size: 13px; color: var(--muted); margin-top: 8px; }
.vol-instr { font-size: 22px; font-weight: 700; margin-top: 4px; }
.pace-hint { font-size: 12px; color: var(--muted); text-align: center; margin-top: 3px; }
