/* Kendama365 · "Feather" theme (inspired by Duolingo's design language) */

@font-face {
  font-family: "Nunito";
  src: url("/fonts/nunito-latin.woff2") format("woff2");
  font-weight: 500 900;
  font-style: normal;
  font-display: swap;
}

:root {
  /* Surfaces */
  --bg: #ffffff;
  --surface: #ffffff;
  --surface-2: #f7f7f7;
  --line: #e5e5e5;
  --text: #4b4b4b;
  --strong: #3c3c3c;
  --muted: #777777;
  --faint: #afafaf;

  /* Feather palette */
  --red: #ff4b4b;      --red-dark: #ea2b2b;      --red-soft: #ffdfe0;
  --green: #58cc02;    --green-dark: #58a700;    --green-soft: #d7ffb8;
  --blue: #1cb0f6;     --blue-dark: #1899d6;     --blue-soft: #ddf4ff;   --blue-line: #84d8ff;
  --orange: #ff9600;   --orange-dark: #e08600;   --orange-soft: #fff0d5;
  --gold: #ffc800;     --gold-dark: #e5a500;     --gold-soft: #fff5d3;

  --accent: var(--red);
  --accent-dark: var(--red-dark);

  /* Mastery */
  --lvl-learning: var(--faint);
  --lvl-landed: var(--blue);
  --lvl-solid: var(--green);
  --lvl-mastered: var(--gold);

  /* Heatmap */
  --hm-0: #efefef;
  --hm-1: #ffe1b3;
  --hm-2: #ffc061;
  --hm-3: #ff9600;
  --hm-4: #ea6a00;

  --radius: 16px;
  --radius-sm: 12px;
  --border: 2px solid var(--line);
  --tabbar-h: 70px;
  --topbar-h: 60px;
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --font: "Nunito", ui-rounded, "SF Pro Rounded", system-ui, -apple-system, "Segoe UI", sans-serif;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #131f24;
    --surface: #131f24;
    --surface-2: #1b2b33;
    --line: #37464f;
    --text: #dce6ec;
    --strong: #f1f7fb;
    --muted: #8fa3ad;
    --faint: #52656d;
    --red-soft: rgba(255, 75, 75, .16);
    --green-soft: rgba(88, 204, 2, .16);
    --blue-soft: rgba(28, 176, 246, .14);
    --blue-line: #1899d6;
    --orange-soft: rgba(255, 150, 0, .16);
    --gold-soft: rgba(255, 200, 0, .14);
    --hm-0: #1f2f37;
    --hm-1: #5a3a10;
    --hm-2: #9a5a00;
    --hm-3: #e08600;
    --hm-4: #ffb020;
    color-scheme: dark;
  }
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  min-height: 100dvh;
  background: var(--bg);
  color: var(--text);
  font: 600 16px/1.5 var(--font);
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
  padding-top: calc(var(--topbar-h) + var(--safe-top));
  padding-bottom: calc(var(--tabbar-h) + var(--safe-bottom) + 20px);
}

a { color: inherit; }
img { max-width: 100%; display: block; }
svg { width: 24px; height: 24px; flex: none; }
button, input { font: inherit; color: inherit; }
button { cursor: pointer; }
:focus-visible { outline: 3px solid var(--blue-line); outline-offset: 2px; border-radius: 10px; }
main:focus { outline: none; }

.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.muted { color: var(--muted); }
.small { font-size: .88rem; }
.center { text-align: center; }
.noscript { padding: 2rem; text-align: center; }

#view { max-width: 560px; margin: 0 auto; padding: 14px 20px 28px; }

/* ---------- Pressable 3D surface (the Feather signature) ---------- */

.press {
  border: var(--border);
  border-bottom-width: 4px;
  transition: transform .08s ease, border-bottom-width .08s ease, margin .08s ease;
}

/* ---------- Top bar & tab bar ---------- */

.topbar {
  position: fixed; inset: 0 0 auto 0; z-index: 20;
  height: calc(var(--topbar-h) + var(--safe-top));
  padding: var(--safe-top) 16px 0;
  display: flex; align-items: center; justify-content: space-between;
  background: var(--bg);
  border-bottom: var(--border);
}
.brand { display: flex; align-items: center; gap: 9px; text-decoration: none; font-weight: 900; font-size: 1.15rem; color: var(--strong); }
.brand b { color: var(--accent); font-weight: 900; }
.topbar__right { display: flex; align-items: center; gap: 8px; }

.streak {
  display: inline-flex; align-items: center; gap: 4px;
  height: 38px; padding: 0 12px; border-radius: 12px;
  border: var(--border); border-bottom-width: 3px;
  text-decoration: none; font-weight: 900; font-size: 1rem; font-variant-numeric: tabular-nums;
  color: var(--faint); background: var(--surface);
}
.streak svg { width: 18px; height: 18px; }
.streak--on { color: var(--orange); }

.iconbtn {
  display: inline-grid; place-items: center;
  width: 40px; height: 40px; border-radius: 12px;
  color: var(--muted); text-decoration: none; background: var(--surface);
  border: var(--border); border-bottom-width: 3px;
}
.iconbtn:hover { color: var(--strong); }
.iconbtn:active { transform: translateY(1px); border-bottom-width: 2px; }
.iconbtn svg { width: 20px; height: 20px; }

.tabbar {
  position: fixed; inset: auto 0 0 0; z-index: 20;
  height: calc(var(--tabbar-h) + var(--safe-bottom));
  padding: 8px 10px calc(8px + var(--safe-bottom));
  display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px;
  background: var(--bg);
  border-top: var(--border);
}
.tabbar a {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 1px;
  border-radius: 14px; border: 2px solid transparent;
  text-decoration: none; color: var(--muted);
  font-size: .72rem; font-weight: 900; letter-spacing: .03em; text-transform: uppercase;
}
.tabbar a.active { background: var(--blue-soft); border-color: var(--blue-line); color: var(--blue); }
.tabbar svg { width: 24px; height: 24px; }

body.immersive .topbar,
body.immersive .tabbar { display: none; }
body.immersive { padding: var(--safe-top) 0 var(--safe-bottom); }
body.immersive #view { padding: 0; max-width: 640px; }

/* ---------- Common ---------- */

.page-title { font-size: 1.9rem; line-height: 1.15; font-weight: 900; color: var(--strong); margin: 8px 0 6px; letter-spacing: -.01em; }
.section-title {
  font-size: 1.15rem; font-weight: 900; color: var(--strong);
  margin: 30px 0 12px; display: flex; gap: 8px; align-items: baseline;
}
.lead { font-size: 1.05rem; margin: 0 0 18px; }

.card {
  display: block; background: var(--surface);
  border: var(--border); border-bottom-width: 4px; border-radius: var(--radius);
  padding: 16px 18px; margin: 14px 0;
}
.card__title { font-size: 1.05rem; font-weight: 900; color: var(--strong); margin: 0 0 6px; }
.card p { margin: 0 0 12px; }
.card p:last-child { margin-bottom: 0; }
.card--link { text-decoration: none; transition: transform .08s ease, border-color .12s; }
.card--link:hover { border-color: color-mix(in srgb, var(--line) 50%, var(--muted)); }
.card--link:active { transform: translateY(2px); border-bottom-width: 2px; margin-bottom: 16px; }
.card--danger { border-color: var(--red-soft); }

.pill {
  display: inline-flex; align-items: center;
  font-size: .72rem; font-weight: 900; letter-spacing: .06em; text-transform: uppercase;
  padding: 3px 9px; border-radius: 8px; background: var(--surface-2); color: var(--muted);
  white-space: nowrap;
}
.pill--accent { background: var(--red-soft); color: var(--red-dark); }

/* Buttons: 3D, pressing removes the bottom "depth". */
.btn {
  --b: var(--line); --face: var(--surface); --ink: var(--blue);
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 46px; padding: 0 18px; border-radius: 14px;
  background: var(--face); color: var(--ink);
  border: 2px solid var(--b); border-bottom-width: 4px;
  font-weight: 900; font-size: .95rem; letter-spacing: .05em; text-transform: uppercase;
  text-decoration: none; cursor: pointer;
  transition: transform .06s ease, border-bottom-width .06s ease, filter .12s;
}
.btn:hover { filter: brightness(1.04); }
.btn:active { transform: translateY(2px); border-bottom-width: 2px; }
.btn--primary { --face: var(--accent); --b: var(--accent-dark); --ink: #fff; }
.btn--green { --face: var(--green); --b: var(--green-dark); --ink: #fff; }
.btn--ghost { --face: transparent; }
.btn--danger { --ink: var(--red); }
.btn--block { display: flex; width: 100%; }
.btn--big { min-height: 56px; font-size: 1.02rem; border-radius: 16px; margin: 18px 0; }
.btn svg { width: 20px; height: 20px; }
.row { display: flex; flex-wrap: wrap; gap: 10px; }

.linkbtn {
  background: none; border: 0; padding: 4px 2px; color: var(--blue);
  font-weight: 900; text-transform: uppercase; letter-spacing: .05em; font-size: .82rem;
}

.bar { display: block; height: 14px; border-radius: 99px; background: var(--line); overflow: hidden; flex: 1; }
.bar i {
  display: block; height: 100%; border-radius: inherit; background: var(--green);
  box-shadow: inset 0 4px 0 rgba(255,255,255,.28); transition: width .3s ease; min-width: 0;
}
.bar--done i { background: var(--gold); }

/* Mastery badges: distinct shape + color */
.badge { display: inline-flex; align-items: center; gap: 6px; font-size: .85rem; font-weight: 900; white-space: nowrap; }
.badge__icon {
  display: inline-grid; place-items: center;
  width: 28px; height: 28px; border-radius: 10px;
  font-size: .95rem; line-height: 1;
  background: var(--surface-2); color: var(--faint);
}
.badge--learning .badge__icon { color: var(--muted); box-shadow: inset 0 0 0 2px var(--line); background: transparent; }
.badge--landed .badge__icon { color: var(--blue); background: var(--blue-soft); }
.badge--solid .badge__icon { color: var(--green-dark); background: var(--green-soft); }
.badge--mastered .badge__icon { color: #fff; background: var(--gold); box-shadow: inset 0 -3px 0 var(--gold-dark); }
.badge--landed .badge__label { color: var(--blue); }
.badge--solid .badge__label { color: var(--green-dark); }
.badge--mastered .badge__label { color: var(--gold-dark); }
.badge--learning .badge__label, .badge--new .badge__label { color: var(--muted); }
@media (prefers-color-scheme: dark) {
  .badge--solid .badge__icon, .badge--solid .badge__label { color: var(--green); }
  .badge--mastered .badge__label { color: var(--gold); }
}

/* ---------- Day / Today ---------- */

.kicker { display: flex; align-items: center; gap: 10px; font-weight: 800; margin-top: 4px; color: var(--muted); }
.kicker > span:last-child { color: var(--strong); }
.kicker .muted { color: var(--muted); }
.day__title { font-size: 2.15rem; line-height: 1.08; font-weight: 900; color: var(--strong); letter-spacing: -.01em; margin: 8px 0 10px; text-wrap: balance; }
.day__meta { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 12px; margin-bottom: 18px; font-size: .92rem; }
.day__meta .badge { padding: 3px 10px 3px 3px; border-radius: 12px; background: var(--surface-2); }
.day__meta .badge--solid { background: var(--green-soft); }
.day__meta .badge--landed { background: var(--blue-soft); }
.day__meta .badge--mastered { background: var(--gold-soft); }

.video {
  position: relative; width: 100%; max-width: 300px; margin: 0 auto;
  aspect-ratio: 9 / 16; max-height: 46vh;
  border-radius: 18px; overflow: hidden; background: #000;
  border: var(--border); border-bottom-width: 5px;
}
.video iframe, .video__facade { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }
.video__facade { padding: 0; background: #000; }
.video__facade img { width: 100%; height: 100%; object-fit: cover; scale: 1.1; }
.video__play {
  position: absolute; left: 50%; top: 50%; width: 68px; height: 68px; translate: -50% -50%;
  border-radius: 50%; background: var(--red); box-shadow: 0 5px 0 var(--red-dark);
  transition: transform .06s ease, box-shadow .06s ease;
}
.video__facade:active .video__play { transform: translateY(4px); box-shadow: 0 1px 0 var(--red-dark); }
.video__play::after {
  content: ""; position: absolute; left: 27px; top: 21px;
  border-left: 22px solid #fff; border-top: 13px solid transparent; border-bottom: 13px solid transparent;
}
.video--empty { aspect-ratio: auto; max-width: none; max-height: none; background: var(--surface); border-style: dashed; border-bottom-width: 2px; }
.video__empty { padding: 26px 20px; text-align: center; }
.video__empty p { margin: 8px 0 16px; color: var(--muted); }
.video__empty-icon {
  display: inline-grid; place-items: center; width: 52px; height: 52px; border-radius: 16px;
  background: var(--red-soft); color: var(--red); font-size: 1.2rem;
}

.stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin: 0; }
.stats div {
  background: var(--surface); border: var(--border); border-bottom-width: 4px; border-radius: var(--radius-sm);
  padding: 10px 8px; text-align: center;
}
.stats dt { font-size: .68rem; color: var(--muted); font-weight: 900; text-transform: uppercase; letter-spacing: .06em; }
.stats dd { margin: 0; font-size: 1.5rem; font-weight: 900; font-variant-numeric: tabular-nums; line-height: 1.3; }
.stats div:nth-child(1) dd { color: var(--orange); }
.stats div:nth-child(2) dd { color: var(--green); }
.stats div:nth-child(3) dd { color: var(--blue); }

.ladder { list-style: none; padding: 0; margin: 14px 0 0; display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.ladder__step {
  display: flex; flex-direction: column; align-items: center; gap: 2px;
  padding: 10px 6px; border-radius: var(--radius-sm); border: 2px dashed var(--line);
  color: var(--faint); text-align: center;
}
.ladder__icon { font-size: 1.25rem; line-height: 1.2; }
.ladder__label { font-weight: 900; font-size: .88rem; }
.ladder__req { font-size: .72rem; font-weight: 700; }
.ladder__step--done { border-style: solid; border-bottom-width: 4px; border-color: var(--gold); background: var(--gold-soft); color: var(--strong); }
.ladder__step--done .ladder__icon { color: var(--gold-dark); }

.known { margin: 16px 0 0; font-size: .9rem; text-align: center; }

.warmup, .review { display: flex; align-items: center; gap: 14px; margin-top: 22px; }
.warmup > svg, .review > svg { color: var(--faint); margin-left: auto; }
.warmup__ball {
  flex: none; width: 46px; height: 46px; border-radius: 50%; position: relative;
  background: radial-gradient(circle at 35% 30%, #ff9e8f 0 10%, #ff5a47 45%, #c8301f);
  box-shadow: inset 0 -4px 0 rgba(0,0,0,.15);
}
.warmup__ball::after { content: ""; position: absolute; width: 11px; height: 11px; border-radius: 50%; background: #2a0f0a; right: 9px; top: 10px; }
.warmup__body, .review__body { display: flex; flex-direction: column; min-width: 0; flex: 1; gap: 1px; }
.warmup__body strong, .review__body strong { color: var(--strong); font-weight: 900; font-size: 1.05rem; }
.warmup__kicker { font-size: .7rem; font-weight: 900; letter-spacing: .08em; text-transform: uppercase; color: var(--red); }
.warmup .muted, .review .muted { font-size: .85rem; }
.warmup .bar { flex: none; height: 10px; margin-top: 6px; }
.warmup__val { font-weight: 900; font-size: 1.2rem; color: var(--strong); font-variant-numeric: tabular-nums; white-space: nowrap; }
.warmup__val em { font-style: normal; color: var(--muted); font-size: .85rem; }

.daynav { display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 8px; margin-top: 22px; }
.daynav__btn {
  display: inline-flex; align-items: center; gap: 4px;
  min-height: 44px; padding: 0 12px 0 6px; border-radius: 14px;
  border: var(--border); border-bottom-width: 4px;
  text-decoration: none; color: var(--muted); font-weight: 900; justify-self: start;
}
.daynav__btn--next { justify-self: end; padding: 0 6px 0 12px; }
.daynav__btn:active { transform: translateY(2px); border-bottom-width: 2px; }
.daynav__btn svg { width: 20px; height: 20px; }
.daynav__today { font-weight: 900; color: var(--blue); text-decoration: none; font-size: .82rem; text-transform: uppercase; letter-spacing: .05em; }

.locked { text-align: center; padding: 26px 8px 6px; }
.locked__icon {
  display: inline-grid; place-items: center; width: 72px; height: 72px; border-radius: 22px;
  background: var(--surface-2); color: var(--faint); border: var(--border); border-bottom-width: 4px;
}
.locked__icon svg { width: 32px; height: 32px; }

/* ---------- Practice ---------- */

.practice { min-height: calc(100dvh - var(--safe-top) - var(--safe-bottom)); display: flex; flex-direction: column; padding: 10px 16px 16px; }
.practice__top { display: flex; align-items: center; gap: 10px; }
.practice__title { flex: 1; min-width: 0; display: flex; flex-direction: column; line-height: 1.25; }
.practice__title small { color: var(--muted); font-weight: 900; font-size: .72rem; text-transform: uppercase; letter-spacing: .08em; }
.practice__title strong { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-size: 1.1rem; font-weight: 900; color: var(--strong); }
.practice__badge { min-width: 44px; display: grid; place-items: center; }

.practice__stage { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 20px; padding: 12px 0; }
.run { display: flex; flex-direction: column; align-items: center; }
.run__num { font-size: clamp(6rem, 30vw, 10rem); font-weight: 900; line-height: 1; color: var(--strong); font-variant-numeric: tabular-nums; }
.run__label { color: var(--muted); font-weight: 900; text-transform: uppercase; letter-spacing: .08em; font-size: .85rem; }
.run__num.bump { animation: bump .28s ease; color: var(--green); }
.run__num.shake { animation: shake .3s ease; color: var(--red); }

.goal { display: flex; flex-direction: column; align-items: center; gap: 10px; width: 100%; max-width: 340px; }
.goal__label { font-weight: 900; color: var(--muted); }
.goal__label--done { color: var(--gold-dark); }
.goal__dots { display: flex; flex-wrap: wrap; justify-content: center; gap: 7px; }
.goal__dots i { width: 18px; height: 18px; border-radius: 6px; background: var(--line); transition: background .15s, transform .15s; }
.goal__dots i.on { background: var(--green); box-shadow: inset 0 -3px 0 var(--green-dark); transform: scale(1.08); }
.goal .bar { width: 100%; flex: none; }

.stats--compact { width: 100%; max-width: 380px; }
.stats--compact div:nth-child(3) dd { color: var(--red); }

.practice__controls { display: grid; grid-template-columns: 1fr 1.4fr; gap: 12px; height: clamp(150px, 28vh, 230px); padding-bottom: 6px; }
.bigbtn {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px;
  border-radius: 22px; font-size: 1.15rem; font-weight: 900; letter-spacing: .06em; text-transform: uppercase;
  user-select: none; touch-action: manipulation;
  border: 2px solid; border-bottom-width: 8px;
  transition: transform .06s ease, border-bottom-width .06s ease;
}
.bigbtn span { font-size: 2.6rem; line-height: 1; }
.bigbtn:active { transform: translateY(6px); border-bottom-width: 2px; }
.bigbtn--land { background: var(--green); border-color: var(--green-dark); color: #fff; }
.bigbtn--miss { background: var(--surface); border-color: var(--line); color: var(--red); }

.undo {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px; align-self: center;
  margin-top: 12px; min-height: 40px; padding: 0 14px; border-radius: 12px;
  border: 0; background: none; color: var(--muted); font-weight: 900; font-size: .82rem;
  text-transform: uppercase; letter-spacing: .06em;
}
.undo svg { width: 18px; height: 18px; }
.undo:disabled { opacity: .35; cursor: default; }

.practice.celebrate { animation: glow .9s ease; }

.stopwatch {
  width: min(70vw, 290px); aspect-ratio: 1; border-radius: 50%;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px;
  background: var(--surface); border: 3px solid var(--line); border-bottom-width: 10px;
  user-select: none; touch-action: manipulation; transition: transform .06s, border-color .2s, border-bottom-width .06s;
}
.stopwatch:active { transform: translateY(6px); border-bottom-width: 4px; }
.stopwatch__time { font-size: clamp(2.8rem, 14vw, 4.2rem); font-weight: 900; color: var(--strong); font-variant-numeric: tabular-nums; }
.stopwatch__hint { color: var(--muted); font-weight: 900; text-transform: uppercase; letter-spacing: .06em; font-size: .85rem; }
.stopwatch--running { border-color: var(--green); background: var(--green-soft); }
.stopwatch--running .stopwatch__hint { color: var(--green-dark); }

/* ---------- Path ---------- */

.chips { display: flex; gap: 8px; overflow-x: auto; padding: 4px 0 6px; margin: 18px 0 12px; scrollbar-width: none; }
.chip {
  flex: none; min-height: 40px; padding: 0 14px; border-radius: 12px;
  border: var(--border); border-bottom-width: 4px; background: var(--surface);
  font-weight: 900; font-size: .8rem; text-transform: uppercase; letter-spacing: .05em; color: var(--muted);
}
.chip:active { transform: translateY(2px); border-bottom-width: 2px; }
.chip--on { background: var(--blue-soft); border-color: var(--blue-line); color: var(--blue); }

.tricklist { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.trickrow {
  display: flex; align-items: center; gap: 12px;
  min-height: 60px; padding: 8px 12px; border-radius: 16px;
  background: var(--surface); border: var(--border); border-bottom-width: 4px; text-decoration: none;
  scroll-margin: 90px; transition: transform .06s ease;
}
.trickrow:active { transform: translateY(2px); border-bottom-width: 2px; margin-bottom: 2px; }
.trickrow--today { border-color: var(--red); background: var(--red-soft); }
.trickrow__day {
  flex: none; width: 38px; height: 38px; display: grid; place-items: center; border-radius: 12px;
  font-weight: 900; color: var(--muted); background: var(--surface-2); font-variant-numeric: tabular-nums;
}
.trickrow__name { flex: 1; min-width: 0; font-weight: 800; color: var(--strong); line-height: 1.3; }
.trickrow__name .pill { vertical-align: 2px; margin-left: 4px; }
.trickrow--today .pill--accent { background: var(--red); color: #fff; }
.trickrow__video { color: var(--faint); display: grid; }
.trickrow__video svg { width: 18px; height: 18px; }
.trickrow--mastered .trickrow__day { background: var(--gold); color: #fff; box-shadow: inset 0 -3px 0 var(--gold-dark); }
.trickrow--solid .trickrow__day { background: var(--green-soft); color: var(--green-dark); }
.trickrow--landed .trickrow__day { background: var(--blue-soft); color: var(--blue); }
.empty { padding: 24px; text-align: center; }

.comingsoon {
  display: flex; align-items: center; gap: 14px; margin-top: 12px;
  padding: 16px; border-radius: 16px; border: 2px dashed var(--line); color: var(--muted);
}
.comingsoon strong { color: var(--strong); font-weight: 900; }
.comingsoon p { margin: 0; }
.comingsoon__icon { display: grid; place-items: center; width: 44px; height: 44px; border-radius: 14px; background: var(--surface-2); color: var(--faint); }

.mbar { display: flex; height: 16px; border-radius: 99px; overflow: hidden; background: var(--line); margin: 16px 0 12px; gap: 2px; }
.mbar__seg { display: block; min-width: 6px; box-shadow: inset 0 4px 0 rgba(255,255,255,.25); }
.mbar__seg--mastered { background: var(--gold); }
.mbar__seg--solid { background: var(--green); }
.mbar__seg--landed { background: var(--blue); }
.mbar__seg--learning { background: var(--faint); }
.mbar__seg--new { background: transparent; box-shadow: none; }

.legend { list-style: none; padding: 0; margin: 0; display: flex; flex-wrap: wrap; gap: 8px 16px; font-size: .85rem; font-weight: 800; }
.legend li { display: flex; align-items: center; gap: 6px; }
.legend .badge__icon { width: 24px; height: 24px; font-size: .8rem; border-radius: 8px; }
.legend b { font-weight: 900; color: var(--strong); font-variant-numeric: tabular-nums; }

/* ---------- Tama ---------- */

.drills { list-style: none; padding: 0; margin: 18px 0 0; }
.drill { display: flex; flex-direction: column; gap: 6px; margin: 12px 0; }
.drill--today { border-color: var(--red); }
.drill__head { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.drill__head strong { font-size: 1.1rem; font-weight: 900; color: var(--strong); margin-right: auto; }
.drill__summary { font-size: .92rem; }
.drill__foot { display: flex; align-items: center; gap: 12px; margin-top: 6px; }
.drill__best { font-size: .85rem; font-weight: 900; white-space: nowrap; color: var(--strong); }

.backlink {
  display: inline-flex; align-items: center; gap: 2px; margin: 0 0 6px -6px;
  min-height: 40px; padding-right: 10px; color: var(--muted); text-decoration: none;
  font-weight: 900; text-transform: uppercase; letter-spacing: .05em; font-size: .82rem;
}
.backlink:hover { color: var(--strong); }
.backlink svg { width: 20px; height: 20px; }

.goalcard__row { display: flex; justify-content: space-between; gap: 12px; margin-bottom: 10px; }
.goalcard__row b { color: var(--strong); font-weight: 900; }
.steps { list-style: none; counter-reset: step; padding: 0; margin: 0; display: grid; gap: 10px; }
.steps li { counter-increment: step; display: flex; gap: 12px; align-items: flex-start; }
.steps li::before {
  content: counter(step); flex: none; width: 28px; height: 28px; border-radius: 9px; display: grid; place-items: center;
  background: var(--blue-soft); color: var(--blue); font-weight: 900; font-size: .9rem;
}

.scoreform label { display: block; font-weight: 900; color: var(--strong); margin-bottom: 12px; }
.stepper { display: grid; grid-template-columns: 58px 1fr 58px; gap: 10px; }
.stepper input {
  min-height: 58px; border-radius: 14px; border: var(--border); background: var(--surface-2);
  text-align: center; font-size: 1.7rem; font-weight: 900; color: var(--strong); font-variant-numeric: tabular-nums;
  -moz-appearance: textfield; appearance: textfield;
}
.stepper input:focus { outline: none; border-color: var(--blue-line); background: var(--surface); }
.stepper input::-webkit-outer-spin-button,
.stepper input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.stepper__btn {
  border-radius: 14px; border: var(--border); border-bottom-width: 4px; background: var(--surface);
  font-size: 1.6rem; font-weight: 900; color: var(--blue);
}
.stepper__btn:active { transform: translateY(2px); border-bottom-width: 2px; }
.scoreform .btn--big { margin-bottom: 8px; }
.recent { text-align: center; font-variant-numeric: tabular-nums; }
.recent b { color: var(--strong); }
.scoreform .undo { display: flex; margin: 4px auto 0; }

/* ---------- Progress ---------- */

.tiles { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; margin-top: 18px; }
.tile {
  display: flex; flex-direction: column; padding: 14px 16px; border-radius: var(--radius);
  background: var(--surface); border: var(--border); border-bottom-width: 4px;
}
.tile__num { font-size: 2.1rem; font-weight: 900; line-height: 1.1; color: var(--strong); font-variant-numeric: tabular-nums; }
.tile__label { color: var(--muted); font-weight: 900; font-size: .72rem; text-transform: uppercase; letter-spacing: .06em; }
.tile--accent { background: var(--orange-soft); border-color: var(--orange); }
.tile--accent .tile__num { color: var(--orange); }
.tile:nth-child(2) .tile__num { color: var(--red); }
.tile:nth-child(3) .tile__num { color: var(--blue); }
.tile:nth-child(4) .tile__num { color: var(--green); }

.hm { display: flex; gap: 6px; }
.hm__days { display: grid; grid-template-rows: repeat(7, 1fr); gap: 3px; font-size: .62rem; font-weight: 800; color: var(--muted); }
.hm__days span { line-height: 1; display: flex; align-items: center; }
.hm__grid { flex: 1; display: grid; grid-auto-flow: column; grid-template-rows: repeat(7, 1fr); gap: 3px; }
.hm__cell { display: block; aspect-ratio: 1; border-radius: 4px; background: var(--hm-0); }
.hm__cell--1 { background: var(--hm-1); }
.hm__cell--2 { background: var(--hm-2); }
.hm__cell--3 { background: var(--hm-3); }
.hm__cell--4 { background: var(--hm-4); }
.hm__cell--future { background: transparent; }
.hm__cell--today { outline: 2px solid var(--blue); outline-offset: -1px; }
.hm__legend { display: flex; align-items: center; justify-content: flex-end; gap: 3px; font-size: .72rem; font-weight: 800; margin-top: 8px; }
.hm__legend .hm__cell { width: 11px; }

.bests { list-style: none; padding: 0; margin: 0; border-radius: var(--radius); overflow: hidden; border: var(--border); border-bottom-width: 4px; }
.bests li + li { border-top: var(--border); }
.bests a { display: flex; justify-content: space-between; padding: 13px 16px; text-decoration: none; background: var(--surface); font-weight: 800; }
.bests a:hover { background: var(--surface-2); }
.bests b { font-weight: 900; color: var(--strong); font-variant-numeric: tabular-nums; }
.progress > .small { margin-top: 24px; }
.progress a { color: var(--blue); }

/* ---------- Settings ---------- */

.settings .card label.btn { cursor: pointer; }

/* ---------- Toast ---------- */

.toast {
  position: fixed; left: 50%; bottom: calc(var(--tabbar-h) + var(--safe-bottom) + 18px); z-index: 50;
  translate: -50% 20px; opacity: 0;
  padding: 12px 20px; border-radius: 16px; max-width: calc(100vw - 32px);
  background: var(--green-soft); color: var(--green-dark); border: 2px solid var(--green); border-bottom-width: 4px;
  font-weight: 900; text-align: center; pointer-events: none;
  transition: opacity .2s ease, translate .2s ease;
}
@media (prefers-color-scheme: dark) {
  .toast { background: #1d3a12; color: #a5ed6e; }
}
body.immersive .toast { bottom: auto; top: calc(var(--safe-top) + 64px); translate: -50% -20px; }
.toast--in { opacity: 1; translate: -50% 0 !important; }

/* ---------- Motion ---------- */

@keyframes bump { 0% { transform: scale(1); } 40% { transform: scale(1.14); } 100% { transform: scale(1); } }
@keyframes shake { 0%, 100% { transform: translateX(0); } 25% { transform: translateX(-8px); } 75% { transform: translateX(8px); } }
@keyframes glow {
  0% { box-shadow: inset 0 0 0 0 transparent; }
  30% { box-shadow: inset 0 0 0 6px var(--gold), inset 0 0 80px color-mix(in srgb, var(--gold) 30%, transparent); }
  100% { box-shadow: inset 0 0 0 0 transparent; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; scroll-behavior: auto !important; }
}

@media (min-width: 700px) {
  .day__title { font-size: 2.5rem; }
  .tiles { grid-template-columns: repeat(4, 1fr); }
}
