:root {
  --bg: #0b0f17; --bg2: #121826; --card: #161d2c; --line: #243049; --text: #eef2f8; --muted: #93a0b8;
  --accent: #14b8a6; --accent2: #5eead4; --hot: #ff5a3c; --beg: #22c55e; --int: #f59e0b; --adv: #ef4444;
  --floor-a: #1d2638; --floor-b: #111724; --scene-a: #1b2436; --scene-b: #121a29;
  --radius: 18px;
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; background: var(--bg); color: var(--text); font: 15px/1.45 Inter, system-ui, -apple-system, sans-serif; }
body { padding-bottom: calc(76px + env(safe-area-inset-bottom)); min-height: 100vh; }
button { font: inherit; color: inherit; cursor: pointer; border: 0; background: none; }
h1, h2, h3 { margin: 0; letter-spacing: -0.02em; }

.top { position: sticky; top: 0; z-index: 5; padding: calc(12px + env(safe-area-inset-top)) 16px 12px;
  background: linear-gradient(var(--bg) 70%, transparent); }
.brand { display: flex; gap: 10px; align-items: center; max-width: 1100px; margin: 0 auto; }
.brand b { display: block; font-size: 18px; font-weight: 800; }
.brand small { color: var(--muted); font-size: 12px; }
.logo { width: 36px; height: 36px; border-radius: 11px; display: grid; place-items: center; font-weight: 800;
  background: linear-gradient(135deg, var(--accent), #0ea5e9); color: #04201c; }

main { max-width: 1100px; margin: 0 auto; padding: 4px 16px 24px; }
.h { display: flex; justify-content: space-between; align-items: end; margin: 14px 0 12px; gap: 12px; }
.h h2 { font-size: 22px; font-weight: 800; }
.h p { margin: 2px 0 0; color: var(--muted); font-size: 13px; }

.tabs { position: fixed; bottom: 0; left: 0; right: 0; z-index: 10; display: flex; justify-content: center; gap: 4px;
  padding: 8px 10px calc(8px + env(safe-area-inset-bottom)); background: rgba(11, 15, 23, .92);
  backdrop-filter: blur(14px); border-top: 1px solid var(--line); }
.tabs button { flex: 1; max-width: 160px; display: flex; flex-direction: column; align-items: center; gap: 3px;
  font-size: 11.5px; font-weight: 600; color: var(--muted); padding: 6px; border-radius: 12px; }
.tabs svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.tabs button.on { color: var(--accent2); background: rgba(20, 184, 166, .1); }

/* scenes */
.scene { position: relative; background: radial-gradient(120% 90% at 50% 10%, var(--scene-a), var(--scene-b)); overflow: hidden; }
.rf-fig { display: block; width: 100%; height: auto; }
.rf-mus { opacity: 0; transition: opacity .3s; }
.rf-mus.on { opacity: .7; animation: pulse 1.6s ease-in-out infinite; }
@keyframes pulse { 50% { opacity: .4; } }

/* hero */
.hero { border-radius: 24px; padding: 20px; margin: 6px 0 18px; background:
  radial-gradient(90% 120% at 100% 0%, rgba(20,184,166,.35), transparent 60%), linear-gradient(160deg, #18223a, #101624);
  border: 1px solid var(--line); display: grid; gap: 16px; grid-template-columns: 1fr; }
.hero h1 { font-size: 26px; font-weight: 800; line-height: 1.15; }
.hero p { color: var(--muted); margin: 8px 0 0; }
.stats { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.stat { background: rgba(255,255,255,.05); border: 1px solid var(--line); border-radius: 14px; padding: 10px 12px; min-width: 0; }
.stat b { display: block; font-size: 20px; }
.stat span { color: var(--muted); font-size: 12px; }

/* routine cards */
.grid { display: grid; gap: 14px; grid-template-columns: repeat(auto-fill, minmax(min(100%, 300px), 1fr)); }
.rcard { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; text-align: left; display: flex; flex-direction: column; }
.rcard .scene { aspect-ratio: 16 / 9; }
.rcard .scene .rf-fig { position: absolute; inset: 0; height: 100%; }
.rcard .body { padding: 14px 16px 16px; display: grid; gap: 6px; }
.rcard h3 { font-size: 18px; }
.rcard p { margin: 0; color: var(--muted); font-size: 13.5px; }
.row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.btn { background: var(--accent); color: #032521; font-weight: 700; padding: 11px 18px; border-radius: 999px; display: inline-flex; gap: 8px; align-items: center; }
.btn.ghost { background: rgba(255,255,255,.06); color: var(--text); border: 1px solid var(--line); }
.btn.sm { padding: 8px 14px; font-size: 13.5px; }
.btn:active { transform: scale(.97); }

.badge { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; padding: 3px 8px; border-radius: 999px; }
.badge.beginner { color: var(--beg); background: rgba(34,197,94,.12); }
.badge.intermediate { color: var(--int); background: rgba(245,158,11,.12); }
.badge.advanced { color: var(--adv); background: rgba(239,68,68,.12); }
.badge.mixed { color: var(--accent2); background: rgba(20,184,166,.12); }

/* move library */
.filters { display: flex; gap: 8px; overflow-x: auto; padding-bottom: 4px; margin-bottom: 12px; scrollbar-width: none; }
.chip { white-space: nowrap; padding: 8px 14px; border-radius: 999px; border: 1px solid var(--line); background: var(--bg2); color: var(--muted); font-weight: 600; font-size: 13px; }
.chip.on { background: var(--text); color: var(--bg); border-color: var(--text); }
.search { width: 100%; padding: 12px 14px; border-radius: 14px; background: var(--bg2); border: 1px solid var(--line); color: var(--text); font: inherit; margin-bottom: 10px; }
.mgrid { display: grid; gap: 12px; grid-template-columns: repeat(auto-fill, minmax(min(46%, 230px), 1fr)); }
.mcard { background: var(--card); border: 1px solid var(--line); border-radius: 16px; overflow: hidden; text-align: left; display: flex; flex-direction: column; }
.mcard .scene { aspect-ratio: 6 / 5; }
.mcard .meta { padding: 10px 12px 12px; display: grid; gap: 4px; }
.mcard h3 { font-size: 14.5px; line-height: 1.25; }
.mcard small { color: var(--muted); font-size: 12px; }
.num { position: absolute; top: 8px; left: 8px; font-size: 11px; font-weight: 700; color: var(--muted); background: rgba(0,0,0,.35); padding: 2px 7px; border-radius: 999px; }
.mcard .badge { position: absolute; top: 8px; right: 8px; font-size: 9.5px; }
.section-title { font-size: 13px; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); margin: 22px 0 10px; font-weight: 700; }

/* sheet (detail) */
.sheet { position: fixed; inset: 0; z-index: 20; background: rgba(3, 6, 12, .6); backdrop-filter: blur(6px); display: flex; align-items: flex-end; justify-content: center; }
.sheet[hidden] { display: none; }
.panel { background: var(--bg2); width: 100%; max-width: 720px; max-height: 94vh; overflow-y: auto; border-radius: 24px 24px 0 0;
  border: 1px solid var(--line); animation: up .28s ease; padding-bottom: env(safe-area-inset-bottom); }
@media (min-width: 760px) { .sheet { align-items: center; } .panel { border-radius: 24px; max-height: 90vh; } }
@keyframes up { from { transform: translateY(40px); opacity: 0; } }
.panel .scene { aspect-ratio: 6 / 5; max-height: 52vh; }
.panel .scene .rf-fig { height: 100%; width: auto; margin: 0 auto; }
.close { position: absolute; top: 12px; right: 12px; width: 36px; height: 36px; border-radius: 50%; background: rgba(0,0,0,.45); font-size: 20px; line-height: 1; z-index: 2; }
.ctrls { position: absolute; bottom: 10px; left: 10px; right: 10px; display: flex; gap: 6px; justify-content: center; flex-wrap: wrap; }
.ctrls button { background: rgba(0,0,0,.5); border: 1px solid rgba(255,255,255,.12); padding: 6px 11px; border-radius: 999px; font-size: 12px; font-weight: 600; }
.ctrls button.on { background: var(--hot); border-color: var(--hot); color: #fff; }
.pbody { padding: 18px 18px 24px; display: grid; gap: 14px; }
.pbody h2 { font-size: 22px; }
.pbody ol { margin: 0; padding-left: 20px; display: grid; gap: 8px; }
.pbody ol li::marker { color: var(--accent2); font-weight: 700; }
.box { background: var(--card); border: 1px solid var(--line); border-radius: 14px; padding: 12px 14px; }
.box b { display: block; font-size: 12px; text-transform: uppercase; letter-spacing: .07em; margin-bottom: 4px; }
.box.tip b { color: var(--accent2); } .box.warn b { color: var(--int); }
.tags { display: flex; gap: 6px; flex-wrap: wrap; }
.tag { font-size: 12px; padding: 4px 10px; border-radius: 999px; background: rgba(255,59,92,.12); color: #ff8aa0; font-weight: 600; text-transform: capitalize; }
.prog { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.prog button { text-align: left; background: var(--card); border: 1px solid var(--line); border-radius: 14px; padding: 10px 12px; }
.prog small { color: var(--muted); display: block; font-size: 11.5px; }
.list { display: grid; gap: 8px; }
.li { display: flex; gap: 12px; align-items: center; background: var(--card); border: 1px solid var(--line); border-radius: 14px; padding: 8px; text-align: left; }
.li .thumb { width: 72px; flex: none; border-radius: 10px; overflow: hidden; }
.li .thumb .scene { aspect-ratio: 6/5; }
.li small { color: var(--muted); display: block; font-size: 12px; }
.setting { display: flex; justify-content: space-between; align-items: center; gap: 10px; }
.step { display: flex; align-items: center; gap: 4px; background: var(--card); border: 1px solid var(--line); border-radius: 999px; padding: 3px; }
.step button { width: 32px; height: 32px; border-radius: 50%; background: rgba(255,255,255,.06); font-size: 18px; }
.step span { min-width: 56px; text-align: center; font-weight: 700; }

/* player */
.player { position: fixed; inset: 0; z-index: 30; background: #070a10; display: flex; flex-direction: column; }
.player[hidden] { display: none; }
.pl-top { display: flex; justify-content: space-between; align-items: center; padding: calc(12px + env(safe-area-inset-top)) 16px 8px; gap: 10px; }
.pl-top .bar { flex: 1; height: 6px; background: #1c2333; border-radius: 9px; overflow: hidden; }
.pl-top .bar i { display: block; height: 100%; background: linear-gradient(90deg, var(--accent), #0ea5e9); transition: width .4s; }
.pl-scene { flex: 1; min-height: 0; position: relative; display: flex; align-items: center; justify-content: center; }
.pl-scene .scene { width: 100%; height: 100%; display: flex; align-items: center; }
.pl-scene .rf-fig { max-height: 100%; }
.pl-phase { position: absolute; top: 12px; left: 50%; transform: translateX(-50%); font-weight: 800; letter-spacing: .14em; text-transform: uppercase; font-size: 13px; padding: 6px 14px; border-radius: 999px; background: rgba(20,184,166,.18); color: var(--accent2); }
.pl-phase.rest { background: rgba(59,130,246,.18); color: #93c5fd; }
.pl-phase.ready { background: rgba(245,158,11,.18); color: #fcd34d; }
.pl-info { padding: 14px 18px 8px; text-align: center; }
.pl-info h2 { font-size: 24px; }
.pl-info p { margin: 4px 0 0; color: var(--muted); }
.pl-timer { font-size: 64px; font-weight: 800; font-variant-numeric: tabular-nums; text-align: center; line-height: 1; margin: 6px 0; }
.pl-next { text-align: center; color: var(--muted); font-size: 13px; min-height: 20px; }
.pl-ctrl { display: flex; justify-content: center; align-items: center; gap: 18px; padding: 14px 16px calc(18px + env(safe-area-inset-bottom)); }
.round { width: 54px; height: 54px; border-radius: 50%; background: #161d2c; border: 1px solid var(--line); display: grid; place-items: center; }
.round.big { width: 76px; height: 76px; background: var(--accent); color: #032521; border: 0; }
.round svg { width: 24px; height: 24px; fill: currentColor; }
.done-wrap { flex: 1; display: grid; place-items: center; text-align: center; padding: 24px; gap: 14px; align-content: center; }
.done-wrap .big { font-size: 56px; }

/* progress */
.ring { width: 150px; height: 150px; }
.pcard { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; display: flex; gap: 18px; align-items: center; flex-wrap: wrap; }
.week { display: flex; gap: 6px; margin-top: 10px; }
.week div { flex: 1; text-align: center; font-size: 11px; color: var(--muted); }
.week i { display: block; height: 34px; border-radius: 8px; background: #1c2333; margin-bottom: 4px; }
.week i.on { background: linear-gradient(180deg, var(--accent2), var(--accent)); }
.empty { color: var(--muted); text-align: center; padding: 26px; border: 1px dashed var(--line); border-radius: 16px; }
.note { color: var(--muted); font-size: 12.5px; margin-top: 18px; }

.foot { max-width: 1100px; margin: 0 auto; padding: 8px 16px 20px; color: var(--muted); font-size: 12px; text-align: center; }
.foot a { color: var(--muted); }
.doc { max-width: 720px; margin: 0 auto; padding: 24px 16px 60px; }
.doc h1 { font-size: 28px; margin-bottom: 6px; } .doc h2 { font-size: 18px; margin: 22px 0 6px; }
.doc p, .doc li { color: #c9d2e3; } .doc a { color: var(--accent2); }
