:root {
  --bg: #16181d;
  --bg2: #1d2027;
  --card: #23272f;
  --card2: #2b3039;
  --line: #353b46;
  --text: #eef1f6;
  --muted: #9aa3b2;
  --accent: #ff6a3d;
  --accent2: #ff9a6b;
  --blue: #4d9bff;
  --good: #3ccf8e;
  --bad: #ff5d6c;
  --radius: 16px;
  --nav-h: 64px;
  color-scheme: dark;
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; }
body {
  background: radial-gradient(1200px 600px at 50% -200px, #2a2f39 0%, var(--bg) 60%) fixed, var(--bg);
  color: var(--text);
  font: 15px/1.5 system-ui, -apple-system, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  min-height: 100vh;
}
body.noscroll { overflow: hidden; }
body.has-nav main { padding-bottom: calc(var(--nav-h) + 24px + env(safe-area-inset-bottom)); }
a { color: var(--blue); text-decoration: none; }
h1 { font-size: 26px; line-height: 1.2; margin: 8px 0 12px; letter-spacing: -.3px; }
h2 { font-size: 21px; margin: 4px 0 8px; }
h3 { font-size: 17px; margin: 4px 0 8px; }
h4 { font-size: 15px; margin: 14px 0 8px; }
h3.section { margin: 22px 0 10px; }
h4.mini { margin: 8px 0 4px; color: var(--muted); font-weight: 600; font-size: 13px; }
p { margin: 6px 0; }
ul, ol { padding-left: 20px; margin: 6px 0; }
li { margin: 4px 0; }
small { font-size: 12.5px; }
.muted { color: var(--muted); }
.center { text-align: center; }
.accent { color: var(--accent); }
.link { font-size: 14px; }

header#header {
  position: sticky; top: 0; z-index: 20;
  display: flex; justify-content: space-between; align-items: center;
  padding: calc(10px + env(safe-area-inset-top)) 16px 10px;
  background: rgba(22, 24, 29, .86); backdrop-filter: blur(12px);
  border-bottom: 1px solid rgba(255,255,255,.04);
}
.brand { display: flex; align-items: center; gap: 8px; color: var(--text); font-weight: 800; letter-spacing: 2px; }
.logo { display: grid; place-items: center; width: 30px; height: 30px; border-radius: 9px; background: var(--accent); color: #fff; font-weight: 900; letter-spacing: 0; box-shadow: 0 0 18px rgba(255,106,61,.45); }
.avatar { display: grid; place-items: center; width: 34px; height: 34px; border-radius: 50%; background: var(--card2); color: var(--text); font-weight: 700; border: 1px solid var(--line); }
.avatar.big { width: 56px; height: 56px; font-size: 22px; background: linear-gradient(135deg, var(--accent), #c2410c); border: 0; }

main { max-width: 720px; margin: 0 auto; padding: 12px 16px 32px; }

nav#nav {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 20;
  display: none; justify-content: space-around;
  height: calc(var(--nav-h) + env(safe-area-inset-bottom)); padding-bottom: env(safe-area-inset-bottom);
  background: rgba(22, 24, 29, .94); backdrop-filter: blur(14px); border-top: 1px solid var(--line);
}
body.has-nav nav#nav { display: flex; }
nav#nav a { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; color: var(--muted); font-size: 11px; }
nav#nav a svg { width: 24px; height: 24px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
nav#nav a.on { color: var(--accent); }

.card { display: block; background: var(--card); border: 1px solid rgba(255,255,255,.05); border-radius: var(--radius); padding: 16px; margin: 12px 0; color: var(--text); }
.card.narrow { max-width: 420px; margin: 24px auto; }
.card.warn { border-color: rgba(255, 170, 60, .35); background: #2b2620; }
.card.tip { border-color: rgba(77, 155, 255, .3); background: #1f2633; }
.card.err { border-color: var(--bad); }
.callout { display: flex; flex-direction: column; gap: 2px; border-color: rgba(255,106,61,.4); background: linear-gradient(135deg, #3a2a25, var(--card)); }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  min-height: 44px; padding: 10px 18px; border-radius: 12px; border: 1px solid var(--line);
  background: var(--card2); color: var(--text); font: inherit; font-weight: 600; cursor: pointer; text-align: center;
}
.btn:disabled { opacity: .55; cursor: default; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; box-shadow: 0 6px 20px rgba(255,106,61,.25); }
.btn.danger { background: #3a1f24; border-color: var(--bad); color: #ffb3bb; }
.btn.ghost { background: transparent; }
.btn.small { min-height: 34px; padding: 6px 12px; font-size: 13.5px; border-radius: 10px; }
.btn.block { display: flex; width: 100%; margin-top: 12px; }
.btn.on { border-color: var(--accent); color: var(--accent2); }
.icon-btn { background: none; border: 0; color: var(--muted); font-size: 16px; cursor: pointer; padding: 4px 8px; }

.row { display: flex; gap: 10px; align-items: center; margin: 8px 0; }
.row.wrap { flex-wrap: wrap; }
.row.between { justify-content: space-between; }
.row.end { justify-content: flex-end; }
.row.center { justify-content: center; flex-wrap: wrap; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
@media (max-width: 380px) { .grid2 { grid-template-columns: 1fr; } }

.field { display: flex; flex-direction: column; gap: 4px; margin: 10px 0; }
.field > span { font-size: 13px; color: var(--muted); font-weight: 600; }
.field small { color: var(--muted); }
.pw-wrap { position: relative; display: flex; }
.pw-wrap input { flex: 1; min-width: 0; padding-right: 50px; }
.eye { position: absolute; right: 4px; top: 50%; transform: translateY(-50%); width: 44px; height: 44px; display: grid; place-items: center; background: none; border: 0; border-radius: 10px; color: var(--muted); cursor: pointer; }
.eye svg { width: 22px; height: 22px; fill: currentColor; }
.eye.on, .eye:hover { color: var(--text, #fff); }
input, select, textarea {
  width: 100%; min-height: 44px; padding: 10px 12px; border-radius: 12px; border: 1px solid var(--line);
  background: var(--bg2); color: var(--text); font: inherit; font-size: 16px;
}
input:focus, select:focus, textarea:focus { outline: 2px solid rgba(255,106,61,.5); border-color: var(--accent); }
.check { display: flex; gap: 8px; align-items: flex-start; margin: 10px 0; }
.check input { width: 20px; min-height: 20px; height: 20px; flex: none; margin-top: 2px; accent-color: var(--accent); }
.search { margin-bottom: 6px; }
.meter { height: 6px; background: var(--bg2); border-radius: 4px; overflow: hidden; }
.meter i { display: block; height: 100%; width: 0; background: var(--bad); transition: width .2s; }
.meter[data-s="2"] i { background: #f5b942; }
.meter[data-s="3"] i, .meter[data-s="4"] i { background: var(--good); }
.code { font: 600 18px/1.6 ui-monospace, Menlo, Consolas, monospace; letter-spacing: 1px; background: var(--bg2); border: 1px dashed var(--accent); padding: 12px; border-radius: 12px; word-break: break-all; text-align: center; color: var(--accent2); user-select: all; }
.note { background: var(--bg2); padding: 10px 12px; border-radius: 12px; color: var(--muted); }

.tabs { display: flex; gap: 6px; overflow-x: auto; margin: 4px 0 10px; scrollbar-width: none; }
.tabs a { flex: none; padding: 8px 14px; border-radius: 999px; background: var(--card); color: var(--muted); font-weight: 600; font-size: 14px; }
.tabs a.on { background: var(--accent); color: #fff; }
.chips { display: flex; gap: 6px; overflow-x: auto; padding: 4px 0; scrollbar-width: none; }
.chip { flex: none; padding: 7px 12px; border-radius: 999px; border: 1px solid var(--line); background: var(--card); color: var(--muted); font: inherit; font-size: 13px; cursor: pointer; }
.chip.on { border-color: var(--accent); color: var(--accent2); background: #3a2a25; }
.seg { display: flex; flex-wrap: wrap; gap: 6px; margin: 10px 0; }
.seg button { flex: 1; min-height: 40px; border-radius: 10px; border: 1px solid var(--line); background: var(--card2); color: var(--muted); font: inherit; font-size: 13.5px; cursor: pointer; }
.seg button.on { border-color: var(--accent); color: #fff; background: #4a2c22; }
.tag { display: inline-block; padding: 2px 8px; border-radius: 999px; background: var(--card2); color: var(--muted); font-size: 12px; }
.tag[data-level="Nên có"] { color: var(--good); }
.tag[data-level="Cần thiết"] { color: var(--accent2); }
.tags { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; margin: 4px 0; }

.loading { display: grid; place-items: center; min-height: 40vh; }
.spinner { width: 34px; height: 34px; border-radius: 50%; border: 3px solid var(--line); border-top-color: var(--accent); animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

.toast { position: fixed; left: 50%; bottom: calc(var(--nav-h) + 20px + env(safe-area-inset-bottom)); transform: translate(-50%, 30px); opacity: 0; pointer-events: none; z-index: 100; background: #2f343e; color: var(--text); padding: 12px 16px; border-radius: 12px; box-shadow: 0 10px 30px rgba(0,0,0,.4); max-width: calc(100vw - 32px); transition: .25s; }
.toast.show { opacity: 1; transform: translate(-50%, 0); }
.toast.err { background: #4a1f26; }
.toast.ok { background: #1d3a2e; }
.modal-back { position: fixed; inset: 0; z-index: 90; background: rgba(0,0,0,.6); display: grid; place-items: center; padding: 16px; }
.modal { width: 100%; max-width: 440px; max-height: 90vh; overflow: auto; background: var(--card); border-radius: 18px; padding: 18px; border: 1px solid var(--line); }

/* landing */
.hero { text-align: center; padding: 18px 0 6px; }
.hero h1 { font-size: 34px; text-transform: uppercase; letter-spacing: .5px; line-height: 1.15; }
.hero .lead { color: var(--muted); max-width: 520px; margin: 0 auto 14px; }
.hero .row { justify-content: center; }
.hero-media img { display: block; width: 100%; height: auto; aspect-ratio: 16/9; object-fit: cover; border-radius: 20px; margin-bottom: 14px; box-shadow: 0 12px 40px rgba(0,0,0,.45); }
.goals { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; margin: 18px 0; }
.goal-chip { display: flex; gap: 6px; padding: 8px 14px; background: var(--card); border-radius: 999px; border: 1px solid var(--line); font-weight: 600; font-size: 14px; }
.features { display: grid; gap: 10px; }
.feature { display: flex; gap: 14px; background: var(--card); border-radius: var(--radius); padding: 14px; }
.feature h3 { margin: 0 0 2px; font-size: 16px; }
.feature p { margin: 0; color: var(--muted); font-size: 14px; }
.ficon { font-size: 26px; width: 44px; height: 44px; display: grid; place-items: center; background: var(--bg2); border-radius: 12px; flex: none; }

/* wizard */
.wizard { max-width: 560px; margin: 12px auto; }
.progress-dots { display: flex; gap: 6px; margin-bottom: 10px; }
.progress-dots i { flex: 1; height: 4px; border-radius: 2px; background: var(--line); }
.progress-dots i.on { background: var(--accent); }
.choices { display: grid; gap: 8px; }
.choices.inline { grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); }
.choice { display: flex; flex-direction: column; align-items: flex-start; gap: 2px; padding: 12px 14px; border-radius: 14px; border: 1px solid var(--line); background: var(--bg2); color: var(--text); font: inherit; text-align: left; cursor: pointer; }
.choice .ci { font-size: 22px; }
.choice small { color: var(--muted); }
.choice.on { border-color: var(--accent); background: #3a2a25; box-shadow: 0 0 0 1px var(--accent) inset; }
.days { display: flex; gap: 6px; }
.day { flex: 1; min-height: 44px; border-radius: 12px; border: 1px solid var(--line); background: var(--bg2); color: var(--muted); font: inherit; font-weight: 700; cursor: pointer; }
.day.on { background: var(--accent); border-color: var(--accent); color: #fff; }
.pose-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
@media (max-width: 480px) { .pose-grid { grid-template-columns: 1fr; } }
.pose { background: var(--bg2); border: 1px dashed var(--line); border-radius: 14px; padding: 12px; display: flex; flex-direction: column; gap: 4px; }
.pose.done { border-style: solid; border-color: var(--good); }
.pose .row { flex-wrap: wrap; gap: 6px; }

/* home */
.greet h1 { margin-bottom: 0; }
.kicker { color: var(--accent2); font-size: 12.5px; font-weight: 700; text-transform: uppercase; letter-spacing: .6px; }
.today { background: linear-gradient(160deg, #3a2a25 0%, var(--card) 55%); border-color: rgba(255,106,61,.3); }
.today.rest { background: linear-gradient(160deg, #1f2c27 0%, var(--card) 55%); border-color: rgba(60,207,142,.25); }
.ex-strip { display: flex; gap: 6px; overflow-x: auto; margin: 10px 0; scrollbar-width: none; }
.ex-pill { flex: none; padding: 6px 10px; background: rgba(0,0,0,.25); border-radius: 999px; color: var(--text); font-size: 13px; }
.done-badge { margin-top: 10px; padding: 12px; text-align: center; border-radius: 12px; background: #1d3a2e; color: var(--good); font-weight: 700; }
.stats { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; margin: 12px 0; }
@media (min-width: 560px) { .stats { grid-template-columns: repeat(4, 1fr); } }
.stat { background: var(--card); border-radius: 14px; padding: 12px; display: flex; flex-direction: column; border: 1px solid rgba(255,255,255,.05); }
.stat small { color: var(--muted); }
.stat b { font-size: 20px; }
.stat span { font-size: 12.5px; color: var(--muted); }
.stat .good { color: var(--good); }
.stat .bad { color: var(--bad); }
.bar { height: 10px; border-radius: 6px; background: var(--bg2); overflow: hidden; margin: 8px 0; }
.bar i { display: block; height: 100%; background: linear-gradient(90deg, var(--accent), var(--accent2)); border-radius: 6px; }
.bar.thin { height: 4px; margin: 6px 0 10px; }
.inline-form { display: flex; gap: 8px; margin-top: 8px; }
.inline-form input { flex: 1; }
.macro-row { display: flex; justify-content: space-between; gap: 6px; text-align: center; }
.macro { display: flex; flex-direction: column; flex: 1; background: var(--bg2); border-radius: 12px; padding: 8px 4px; }
.macro b { font-size: 18px; color: var(--accent2); }
.macro small { color: var(--muted); font-size: 11px; }
.macro span { font-size: 12px; }
.macro-row.big .macro b { font-size: 22px; }
.nut-mini h3 { color: var(--text); }

.chart { width: 100%; height: auto; display: block; margin: 6px 0; }
.chart .grid { stroke: var(--line); stroke-width: 1; }
.chart .axis { fill: var(--muted); font-size: 10px; }
.chart .line { fill: none; stroke: var(--accent); stroke-width: 2.4; stroke-linejoin: round; }
.chart .area { fill: rgba(255,106,61,.12); }
.chart .dot { fill: var(--accent2); }
.chart .target { stroke: var(--good); stroke-dasharray: 5 5; stroke-width: 1.5; }

/* plan */
.session .kicker { margin-bottom: -4px; }
.ex-list { padding-left: 22px; }
.ex-list li { margin: 8px 0; }
.ex-list a, .ex-list li { color: var(--text); }
.ex-list b { display: block; font-weight: 600; }
.ex-list small { color: var(--muted); display: block; }
.meal ul { list-style: none; padding: 0; }
.meal li { display: flex; justify-content: space-between; gap: 8px; padding: 6px 0; border-bottom: 1px solid var(--line); }
.meal li:last-child { border: 0; }
.meal li small { color: var(--accent2); white-space: nowrap; }
.supp h4 { margin: 0; }
.timeline { list-style: none; padding: 0; border-left: 2px solid var(--line); margin-left: 8px; }
.timeline li { position: relative; padding: 4px 0 16px 18px; }
.timeline li::before { content: ''; position: absolute; left: -8px; top: 8px; width: 14px; height: 14px; border-radius: 50%; background: var(--card2); border: 2px solid var(--line); }
.timeline li.past::before { background: var(--accent); border-color: var(--accent); }

/* library */
.ex-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; margin-top: 12px; }
@media (min-width: 600px) { .ex-grid { grid-template-columns: repeat(3, 1fr); } }
.ex-card { display: flex; flex-direction: column; background: var(--card); border-radius: 14px; overflow: hidden; color: var(--text); border: 1px solid rgba(255,255,255,.05); }
.thumb { aspect-ratio: 4/5; background: linear-gradient(#3a3f47, #1b1e23); }
.thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.ex-meta { padding: 10px; display: flex; flex-direction: column; gap: 2px; }
.ex-meta small { color: var(--muted); }
.back { display: inline-block; margin: 4px 0 8px; font-size: 14px; }

.stage { position: relative; aspect-ratio: 9/16; max-height: 72vh; max-width: calc(72vh * 9 / 16); width: 100%; margin: 0 auto; border-radius: 20px; overflow: hidden; background: linear-gradient(#454b55, #1b1e23); box-shadow: 0 10px 40px rgba(0,0,0,.4); }
.stage.compact { aspect-ratio: 9/16; max-height: 52vh; max-width: calc(52vh * 9 / 16); }
.canvas-box, .stage-video { position: absolute; inset: 0; width: 100%; height: 100%; }
.stage-video { object-fit: contain; background: #111317; }
.canvas-box canvas { display: block; touch-action: none; }
.stage-title { position: absolute; top: 14px; left: 0; right: 0; text-align: center; font: 900 26px/1 Impact, 'Arial Black', system-ui, sans-serif; letter-spacing: 1px; color: #fff; text-shadow: 0 0 12px rgba(77,155,255,.9), 0 0 2px #4d9bff; pointer-events: none; padding: 0 12px; }
.stage.compact .stage-title { font-size: 18px; }
.stage-cue { position: absolute; left: 12px; right: 12px; bottom: 56px; text-align: center; color: #fff; font-weight: 600; text-shadow: 0 1px 6px #000; pointer-events: none; }
.stage-cue:empty { display: none; }
.stage-controls { position: absolute; left: 8px; right: 8px; bottom: 8px; display: flex; gap: 6px; justify-content: center; flex-wrap: wrap; }
.ctl { min-height: 34px; min-width: 40px; padding: 6px 10px; border-radius: 10px; border: 1px solid rgba(255,255,255,.15); background: rgba(20,22,27,.7); color: #fff; font: inherit; font-size: 13px; cursor: pointer; backdrop-filter: blur(6px); }
.muscle-legend { display: flex; flex-wrap: wrap; gap: 6px; margin: 12px 0 0; }
.mchip { padding: 4px 10px; border-radius: 999px; font-size: 13px; font-weight: 600; }
.mchip.hot { background: rgba(255,90,44,.18); color: #ff8a5c; border: 1px solid rgba(255,90,44,.5); }
.mchip.warm { background: rgba(255,163,107,.1); color: #ffc49e; border: 1px solid rgba(255,163,107,.3); }
.shots { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 10px; }
.shots figure { margin: 0; background: var(--card); border-radius: 14px; overflow: hidden; }
.shots img { width: 100%; aspect-ratio: 3/4; object-fit: cover; display: block; background: linear-gradient(#3a3f47, #1b1e23); }
.shots figcaption { padding: 8px 10px; font-size: 13px; }
.steps li { margin: 8px 0; }

/* workout */
.wo-head { display: flex; justify-content: space-between; align-items: center; }
.wo-info { text-align: center; margin: 10px 0; }
.wo-info h2 { margin-bottom: 0; }
.big-timer { font: 800 56px/1 system-ui, sans-serif; color: var(--accent); margin-top: 6px; font-variant-numeric: tabular-nums; }
.rest-screen { text-align: center; padding: 60px 0; }
.rest-screen .big-timer { font-size: 96px; color: var(--blue); margin: 14px 0; }
.finish { text-align: center; }
.big-emoji { font-size: 64px; }

/* progress */
.result-hero { background: linear-gradient(150deg, #3a2a25, var(--card) 60%); }
.result-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; margin: 10px 0; text-align: center; }
.result-grid b { display: block; font-size: 20px; color: var(--accent2); }
.result-grid small { color: var(--muted); }
@media (max-width: 420px) { .result-grid { grid-template-columns: repeat(2, 1fr); } }
.history { list-style: none; padding: 0; }
.history li { display: flex; flex-direction: column; padding: 8px 0; border-bottom: 1px solid var(--line); }
.history small { color: var(--muted); }
table.log { width: 100%; border-collapse: collapse; font-size: 14px; }
table.log th { text-align: left; color: var(--muted); font-weight: 600; padding: 6px 4px; border-bottom: 1px solid var(--line); }
table.log td { padding: 6px 4px; border-bottom: 1px solid var(--line); }
.photo-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; }
@media (min-width: 600px) { .photo-grid { grid-template-columns: repeat(3, 1fr); } }
.photo { position: relative; margin: 0; background: var(--card); border-radius: 14px; overflow: hidden; }
.photo img { width: 100%; aspect-ratio: 9/16; object-fit: cover; display: block; background: var(--bg2); }
.photo figcaption { padding: 8px 10px; display: flex; flex-direction: column; }
.photo .del { position: absolute; top: 6px; right: 6px; background: rgba(0,0,0,.55); border-radius: 10px; }
.compare { position: relative; width: 100%; max-width: 420px; margin: 10px auto; aspect-ratio: 9/16; border-radius: 18px; overflow: hidden; background: var(--bg2); user-select: none; }
.compare > img, .cmp-after img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.cmp-after { position: absolute; inset: 0; }
.cmp-line { position: absolute; top: 0; bottom: 0; width: 3px; margin-left: -1.5px; background: #fff; box-shadow: 0 0 12px var(--blue); pointer-events: none; }
.cmp-range { position: absolute; inset: 0; width: 100%; height: 100%; opacity: 0; cursor: ew-resize; margin: 0; }
.compare .lbl { position: absolute; top: 10px; padding: 3px 8px; border-radius: 8px; background: rgba(0,0,0,.55); font-size: 12px; font-weight: 800; letter-spacing: 1px; pointer-events: none; }
.compare .lbl.l { left: 10px; }
.compare .lbl.r { right: 10px; color: var(--accent2); }

/* community */
.feed { display: grid; gap: 10px; }
.pcard { color: var(--text); }
.pcard p { color: var(--muted); font-size: 14px; }
.pair { display: grid; grid-template-columns: 1fr 1fr; gap: 4px; margin: -4px -4px 10px; }
.pair img, .pair div { width: 100%; aspect-ratio: 3/4; object-fit: cover; border-radius: 10px; background: var(--bg2); }
.cheer-count { color: var(--accent2); font-weight: 700; }
.profile-head { display: flex; gap: 14px; align-items: center; }
.profile-head h1 { margin: 0; }
img.single { width: 100%; max-width: 420px; display: block; margin: 10px auto; border-radius: 18px; }

/* camera & editor */
.fullscreen { position: fixed; inset: 0; z-index: 80; background: #0b0c0f; display: flex; flex-direction: column; padding: env(safe-area-inset-top) 0 env(safe-area-inset-bottom); overflow: auto; }
.cam-stage { position: relative; flex: 1; min-height: 0; display: grid; place-items: center; overflow: hidden; }
.cam-stage video { width: 100%; height: 100%; object-fit: cover; background: #000; }
.cam-stage video.mirror { transform: scaleX(-1); }
.cam-stage .guide { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; }
.guide path { fill: none; stroke: rgba(77,155,255,.85); stroke-width: .5; stroke-dasharray: 2 1.2; vector-effect: non-scaling-stroke; }
.countdown { position: absolute; font: 900 120px/1 system-ui; color: #fff; text-shadow: 0 0 30px var(--accent); }
.cam-tip { text-align: center; color: var(--muted); padding: 8px 16px; margin: 0; font-size: 14px; }
.cam-bar { display: flex; align-items: center; justify-content: space-around; padding: 10px; gap: 6px; }
.cam-bar .btn { min-height: 40px; padding: 6px 10px; font-size: 13px; }
.shutter { width: 70px; height: 70px; border-radius: 50%; border: 5px solid #fff; background: var(--accent); cursor: pointer; flex: none; }
.editor { padding: calc(12px + env(safe-area-inset-top)) 16px calc(16px + env(safe-area-inset-bottom)); }
.edit-head p { color: var(--muted); font-size: 13.5px; }
.edit-stage { position: relative; margin: 8px auto; max-width: 420px; width: 100%; }
.edit-canvas { width: 100%; height: auto; display: block; border-radius: 14px; }
.mask-box { position: absolute; border: 2px dashed var(--accent); border-radius: 50%; touch-action: none; cursor: move; box-shadow: 0 0 0 2px rgba(0,0,0,.4); }
.mask-resize { position: absolute; right: -10px; bottom: -10px; width: 26px; height: 26px; border-radius: 50%; background: var(--accent); border: 3px solid #fff; cursor: nwse-resize; }
.editor .row.end { max-width: 420px; margin: 10px auto; width: 100%; }
.editor .seg { max-width: 420px; margin: 10px auto; width: 100%; }
.danger-zone { border-color: rgba(255,93,108,.3); }

/* Trang khích lệ chụp ảnh cơ thể */
.photo-why { display: grid; gap: 14px; }
.why-hero { text-align: center; padding: 18px 12px; border-radius: 16px; background: radial-gradient(circle at 50% 0%, rgba(255,106,61,.28), transparent 70%), var(--card2); }
.why-icon { font-size: 40px; }
.why-big { margin: 6px 0 2px; font-weight: 900; font-size: 20px; letter-spacing: .5px; color: var(--accent); }
.why-sub { margin: 0; font-weight: 800; font-size: 16px; text-transform: uppercase; }
.why-tl { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; position: relative; }
.why-tl::before { content: ''; position: absolute; left: 12%; right: 12%; top: 14px; height: 2px; background: linear-gradient(90deg, var(--accent), var(--good)); }
.tl-step { position: relative; display: grid; justify-items: center; gap: 2px; text-align: center; padding-top: 30px; }
.tl-step::before { content: ''; position: absolute; top: 7px; width: 16px; height: 16px; border-radius: 50%; background: var(--accent); box-shadow: 0 0 0 4px rgba(255,106,61,.25); }
.tl-step:last-child::before { background: var(--good); box-shadow: 0 0 0 4px rgba(60,207,142,.25); }
.tl-step b { font-size: 13px; }
.tl-step small { color: var(--muted); font-size: 12px; }
.why-list { margin: 0; padding-left: 18px; display: grid; gap: 6px; }

/* Cài app (PWA) */
.install-card { display: flex; align-items: center; gap: 12px; margin: 16px 0; padding: 14px; border-radius: 16px; background: linear-gradient(135deg, rgba(255,106,61,.18), rgba(77,155,255,.12)); border: 1px solid var(--line); }
.install-card > div:nth-child(2) { flex: 1; display: grid; gap: 2px; }
.install-card small { color: var(--muted); }
.install-ico img, .install-bar img { width: 44px; height: 44px; border-radius: 11px; display: block; }
.install-bar { position: fixed; left: 10px; right: 10px; bottom: calc(10px + env(safe-area-inset-bottom)); z-index: 70; display: flex; align-items: center; gap: 10px; padding: 10px 10px 10px 12px; border-radius: 16px; background: #2b3039; border: 1px solid var(--line); box-shadow: 0 10px 30px rgba(0,0,0,.45); max-width: 520px; margin: 0 auto; }
body.has-nav .install-bar { bottom: calc(var(--nav-h) + 10px + env(safe-area-inset-bottom)); }
.install-bar > div { flex: 1; display: grid; min-width: 0; }
.install-bar small { color: var(--muted); font-size: 12px; }
.install-x { background: none; border: 0; color: var(--muted); font-size: 24px; width: 36px; height: 36px; cursor: pointer; }
.inst-steps { list-style: none; padding: 0; margin: 12px 0; display: grid; gap: 10px; }
.inst-step { display: flex; gap: 10px; align-items: flex-start; }
.inst-n { flex: none; width: 26px; height: 26px; border-radius: 50%; background: var(--accent); color: #fff; font-weight: 800; display: grid; place-items: center; font-size: 14px; }
.share-ico { width: 18px; height: 18px; fill: var(--blue); vertical-align: -3px; }

/* Popup tải app */
.pop-back { position: fixed; inset: 0; z-index: 90; background: rgba(5,6,9,.78); backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px); display: grid; place-items: center; padding: 16px; animation: popfade .25s ease; }
.install-pop { position: relative; width: 100%; max-width: 420px; max-height: calc(100vh - 32px); overflow: auto; text-align: center; padding: 28px 22px 18px; border-radius: 24px; background: radial-gradient(circle at 50% -10%, rgba(255,106,61,.45), transparent 60%), #1f232b; border: 1px solid rgba(255,106,61,.4); box-shadow: 0 25px 70px rgba(0,0,0,.6), 0 0 40px rgba(255,106,61,.18); animation: popin .3s cubic-bezier(.2,1.2,.4,1); }
.pop-x { position: absolute; top: 8px; right: 8px; width: 40px; height: 40px; border: 0; background: none; color: var(--muted); font-size: 28px; cursor: pointer; }
.pop-logo { width: 76px; height: 76px; border-radius: 20px; box-shadow: 0 8px 30px rgba(255,106,61,.45); }
.pop-title { margin: 14px 0 6px; font-size: 28px; line-height: 1.15; font-weight: 900; letter-spacing: .3px; }
.pop-title span { color: var(--accent); }
.pop-sub { margin: 0 0 16px; font-size: 15px; font-weight: 800; text-transform: uppercase; letter-spacing: .5px; color: #ffd2c0; }
.pop-perks { list-style: none; margin: 0 0 18px; padding: 0; display: grid; gap: 10px; text-align: left; }
.pop-perks li { display: flex; gap: 12px; align-items: flex-start; padding: 10px 12px; border-radius: 14px; background: rgba(255,255,255,.04); }
.pp-ico { font-size: 22px; line-height: 1.2; }
.pop-perks b { display: block; font-size: 14px; }
.pop-perks small { color: var(--muted); font-size: 12.5px; }
.pop-cta { width: 100%; font-size: 19px; font-weight: 900; padding: 16px; border-radius: 16px; letter-spacing: .5px; box-shadow: 0 10px 30px rgba(255,106,61,.45); }
.pop-later { margin-top: 10px; width: 100%; padding: 10px; border: 0; background: none; color: var(--muted); font-size: 14px; cursor: pointer; }
@keyframes popin { from { transform: translateY(20px) scale(.94); opacity: 0; } to { transform: none; opacity: 1; } }
@keyframes popfade { from { opacity: 0; } to { opacity: 1; } }

/* ===== Làm đẹp chuẩn app + hiệu ứng động lực ===== */
body { background: radial-gradient(1200px 600px at 50% -200px, rgba(255,106,61,.10), transparent 60%), var(--bg); background-attachment: fixed; }
#view > * { animation: viewin .28s ease both; }
@keyframes viewin { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
.btn { transition: transform .12s ease, box-shadow .2s ease, background .2s ease; -webkit-tap-highlight-color: transparent; }
.btn:active:not(:disabled) { transform: scale(.97); }
.btn.primary { background: linear-gradient(135deg, #ff7a45, #ff4f5e); border-color: transparent; box-shadow: 0 8px 24px rgba(255,90,70,.35); }
.btn.primary:hover:not(:disabled) { box-shadow: 0 10px 30px rgba(255,90,70,.5); }
.card { transition: transform .15s ease, border-color .2s ease; }
a.card:active, .ex-card:active { transform: scale(.985); }
.ex-card { transition: transform .15s ease, box-shadow .2s ease; }
.ex-card:hover { box-shadow: 0 10px 30px rgba(0,0,0,.35); }
nav#nav { backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px); }
nav#nav a { transition: color .2s ease, transform .15s ease; }
nav#nav a.on svg { filter: drop-shadow(0 0 8px rgba(255,106,61,.7)); }
nav#nav a.on span { font-weight: 700; }

/* Màn hình tập */
.wo-head { position: sticky; top: calc(env(safe-area-inset-top) + 58px); z-index: 5; padding: 6px 0; background: linear-gradient(var(--bg) 70%, transparent); }
.btn.stop { background: rgba(255,93,108,.14); border-color: rgba(255,93,108,.45); color: #ffb3bb; font-weight: 700; }
.wo-head .ring-wrap { width: 54px; height: 54px; }
.wo-head .ring-label b { font-size: 12px; }
.wo-head .ring-label small { font-size: 9px; }
.cta { min-height: 58px; font-size: 18px; font-weight: 800; letter-spacing: .3px; border-radius: 16px; animation: ctaglow 2.4s ease-in-out infinite; }
@keyframes ctaglow { 0%,100% { box-shadow: 0 8px 24px rgba(255,90,70,.35); } 50% { box-shadow: 0 8px 34px rgba(255,90,70,.65); } }
.guide-btn { margin-top: 10px; background: rgba(77,155,255,.12); border-color: rgba(77,155,255,.4); color: #b9d7ff; font-weight: 600; white-space: normal; line-height: 1.3; }
.big-timer { background: linear-gradient(180deg, #ffb08a, var(--accent) 60%, #ff4f5e); -webkit-background-clip: text; background-clip: text; color: transparent; font-size: 64px; }
.big-timer.pop { animation: pop .35s cubic-bezier(.2,1.6,.4,1); }
@keyframes pop { from { transform: scale(.6); opacity: 0; } to { transform: none; opacity: 1; } }
.rest-screen .big-timer { background: linear-gradient(180deg, #9fd0ff, var(--blue)); -webkit-background-clip: text; background-clip: text; color: transparent; }
.quote { font-size: 17px; font-weight: 700; color: #ffd9cc; max-width: 320px; margin: 0 auto 10px; }
.finish { padding: 26px 18px; background: radial-gradient(circle at 50% 0%, rgba(255,106,61,.3), transparent 65%), var(--card); }
.finish .ring-wrap { width: 150px; height: 150px; margin: 10px auto; }
.finish .ring-label b { font-size: 30px; }
.big-emoji { font-size: 64px; animation: pop .5s cubic-bezier(.2,1.6,.4,1); }

/* Vòng tiến độ */
.ring-wrap { position: relative; width: 120px; height: 120px; }
.ring { width: 100%; height: 100%; transform: rotate(-90deg); }
.ring-bg { fill: none; stroke: rgba(255,255,255,.08); stroke-width: 10; }
.ring-fg { fill: none; stroke: url(#ringgrad); stroke: var(--accent); stroke-width: 10; stroke-linecap: round; transition: stroke-dashoffset .6s ease; filter: drop-shadow(0 0 6px rgba(255,106,61,.6)); }
.ring-label { position: absolute; inset: 0; display: grid; place-content: center; text-align: center; line-height: 1.1; }
.ring-label small { color: var(--muted); font-size: 11px; }

/* Hiệu ứng */
.fx-confetti { position: fixed; inset: 0; width: 100vw; height: 100vh; pointer-events: none; z-index: 200; }
.fx-flash { position: fixed; left: 50%; top: 42%; transform: translate(-50%, -50%); z-index: 150; pointer-events: none; padding: 12px 22px; border-radius: 999px; font-weight: 900; font-size: 22px; color: #fff; background: linear-gradient(135deg, #ff7a45, #ff4f5e); box-shadow: 0 10px 40px rgba(255,90,70,.6); animation: flashup 1.2s ease forwards; }
@keyframes flashup { 0% { opacity: 0; transform: translate(-50%, -30%) scale(.7); } 20% { opacity: 1; transform: translate(-50%, -50%) scale(1.08); } 70% { opacity: 1; transform: translate(-50%, -60%) scale(1); } 100% { opacity: 0; transform: translate(-50%, -90%) scale(.95); } }

/* Bảng trượt từ dưới lên (hướng dẫn) */
.sheet-back { position: fixed; inset: 0; z-index: 95; background: rgba(0,0,0,.6); display: flex; align-items: flex-end; justify-content: center; animation: popfade .2s ease; }
.sheet { width: 100%; max-width: 640px; max-height: 86vh; overflow: auto; background: var(--card); border-radius: 22px 22px 0 0; padding: 10px 18px calc(18px + env(safe-area-inset-bottom)); border-top: 1px solid var(--line); animation: sheetup .28s cubic-bezier(.2,1,.3,1); }
@keyframes sheetup { from { transform: translateY(100%); } to { transform: none; } }
.sheet-grip { width: 44px; height: 5px; border-radius: 3px; background: var(--line); margin: 0 auto 10px; }
.guide-sec { margin: 12px 0; }
.guide-sec h4 { margin: 0 0 6px; }
.guide-sec.tip { background: rgba(60,207,142,.08); border-radius: 12px; padding: 10px 12px; }
.guide-sec.warn { background: rgba(255,93,108,.08); border-radius: 12px; padding: 10px 12px; }

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

/* ===== Bài tập riêng, ghi kết quả, nhóm ===== */
.stat-row { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; text-align: center; }
.stat-row > div { background: rgba(255,255,255,.04); border-radius: 14px; padding: 10px 6px; display: grid; gap: 2px; }
.stat-row b { font-size: 22px; font-weight: 900; background: linear-gradient(180deg, #fff, #ffb08a); -webkit-background-clip: text; background-clip: text; color: transparent; }
.stat-row small { color: var(--muted); font-size: 12px; }
.hist { list-style: none; padding: 0; margin: 10px 0 0; display: grid; gap: 2px; }
.hist li { display: flex; align-items: center; gap: 10px; padding: 10px 4px; border-bottom: 1px solid rgba(255,255,255,.05); }
.hist li > div { flex: 1; display: grid; gap: 2px; min-width: 0; }
.hist li small { color: var(--muted); overflow-wrap: anywhere; }
.hist .tag { justify-self: start; }
.hist-total { font-weight: 800; color: var(--accent2); white-space: nowrap; }
.tag.ok { background: rgba(60,207,142,.15); color: #8fe8bf; }
.badge { display: inline-block; padding: 4px 10px; border-radius: 999px; font-size: 12.5px; font-weight: 700; }
.badge.gold { background: linear-gradient(135deg, #ffd166, #ff9f43); color: #3a2400; box-shadow: 0 4px 14px rgba(255,180,60,.35); }
.danger-text { color: #ff8b97 !important; }
.muted-card { background: rgba(255,255,255,.03); border-style: dashed; border-color: var(--line); }
.small-print { font-size: 12.5px; text-align: center; }
.log-btn { margin: 12px 0 4px; background: linear-gradient(135deg, rgba(255,106,61,.18), rgba(255,79,94,.12)); border-color: rgba(255,106,61,.5); color: #ffd2c0; font-weight: 700; }

.my-box { margin: 6px 0 14px; padding: 14px; border-radius: 18px; background: linear-gradient(135deg, rgba(255,106,61,.16), rgba(199,125,255,.10)); border: 1px solid rgba(255,106,61,.3); }
.my-box h3 { margin: 0; }
.my-scroll { display: flex; gap: 10px; overflow-x: auto; padding: 10px 2px 4px; scroll-snap-type: x mandatory; }
.my-card { flex: none; width: 168px; scroll-snap-align: start; display: grid; gap: 4px; padding: 12px; border-radius: 16px; background: var(--card); border: 1px solid var(--line); color: var(--text); }
.my-card small { color: var(--muted); font-size: 12px; overflow-wrap: anywhere; }
.my-ico { font-size: 28px; }
.my-hero { text-align: center; padding: 18px 14px; margin: 8px 0 14px; border-radius: 22px; background: radial-gradient(circle at 50% 0%, rgba(255,106,61,.35), transparent 70%), var(--card); border: 1px solid rgba(255,106,61,.25); }
.my-hero .my-ico { font-size: 44px; }
.my-hero h1 { margin: 6px 0; }
.plan-preview { margin: 10px 0; padding: 10px 12px; border-radius: 12px; background: rgba(255,255,255,.04); overflow-wrap: anywhere; }
.ladder { display: flex; flex-wrap: wrap; gap: 6px; justify-content: center; margin: 10px 0; }
.ladder span { min-width: 30px; padding: 4px 8px; border-radius: 10px; background: rgba(255,255,255,.06); color: var(--muted); font-weight: 700; font-size: 13px; text-align: center; }
.ladder span.done { background: linear-gradient(135deg, rgba(60,207,142,.35), rgba(60,207,142,.15)); color: #c8f5df; }
.ladder span.now { background: linear-gradient(135deg, #ff7a45, #ff4f5e); color: #fff; transform: scale(1.12); box-shadow: 0 4px 16px rgba(255,90,70,.5); }
.ladder.small { justify-content: flex-start; }
.ladder.small span { min-width: 24px; padding: 2px 6px; font-size: 12px; }
.adj { gap: 14px; align-items: center; margin: 6px 0 12px; }
.adj .btn { min-width: 64px; font-weight: 800; }

.set-list { display: grid; gap: 6px; margin: 8px 0; }
.set-row { display: flex; align-items: center; gap: 6px; }
.set-n { width: 62px; font-size: 13px; color: var(--muted); }
.set-in { width: 74px; text-align: center; font-weight: 800; font-size: 17px; }
.set-row .x { margin-left: auto; }
.total-line { font-size: 15px; }
.share-groups { margin-top: 10px; padding: 10px 12px; border-radius: 12px; background: rgba(77,155,255,.08); }

.group-entry { display: flex; align-items: center; gap: 12px; background: linear-gradient(135deg, rgba(77,155,255,.18), rgba(199,125,255,.12)); border: 1px solid rgba(77,155,255,.35); }
.group-entry > div { flex: 1; display: grid; gap: 2px; }
.group-entry small { color: var(--muted); }
.ge-ico { font-size: 30px; }
.chev { font-size: 26px; color: var(--muted); }
.group-card { display: flex; align-items: center; gap: 12px; }
.group-card > div { flex: 1; display: grid; gap: 2px; }
.g-ava { width: 46px; height: 46px; border-radius: 14px; display: grid; place-items: center; font-weight: 900; font-size: 20px; color: #fff; background: linear-gradient(135deg, #4d9bff, #c77dff); box-shadow: 0 6px 18px rgba(120,120,255,.35); }
.g-ava.big { width: 72px; height: 72px; font-size: 32px; border-radius: 22px; margin: 0 auto; }
.group-hero { text-align: center; padding: 18px 14px; margin: 8px 0 14px; border-radius: 22px; background: radial-gradient(circle at 50% 0%, rgba(77,155,255,.3), transparent 70%), var(--card); }
.group-hero h1 { margin: 10px 0 4px; }
.code-pill { display: inline-flex; align-items: center; gap: 10px; margin-top: 8px; padding: 8px 8px 8px 14px; border-radius: 999px; background: rgba(255,255,255,.06); border: 1px dashed var(--line); }
.code-pill b { font-size: 20px; letter-spacing: 3px; font-variant-numeric: tabular-nums; }
.code-pill small { color: var(--muted); }
.board { background: linear-gradient(160deg, rgba(255,209,102,.12), var(--card) 55%); }
.rank { list-style: none; padding: 0; margin: 8px 0; display: grid; gap: 6px; }
.rank li { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-radius: 14px; background: rgba(255,255,255,.04); }
.rank li.me { background: rgba(255,106,61,.14); border: 1px solid rgba(255,106,61,.35); }
.rank li b { flex: 1; }
.medal { width: 28px; text-align: center; font-size: 20px; font-weight: 800; }
.pts { font-weight: 900; color: #ffd166; }
.post .post-ex { margin: 6px 0 2px; }
.post-total { font-weight: 900; color: var(--accent2); }

/* ===== Font Anton (tự host trong vendor/fonts, giấy phép OFL) + quy tắc khoảng cách chữ ===== */
@font-face { font-family: 'Anton'; font-style: normal; font-weight: 400; font-display: swap; src: url(../vendor/fonts/anton-vietnamese.woff2) format('woff2'); unicode-range: U+0102-0103, U+0110-0111, U+0128-0129, U+0168-0169, U+01A0-01A1, U+01AF-01B0, U+0300-0301, U+0303-0304, U+0308-0309, U+0323, U+0329, U+1EA0-1EF9, U+20AB; }
@font-face { font-family: 'Anton'; font-style: normal; font-weight: 400; font-display: swap; src: url(../vendor/fonts/anton-latin-ext.woff2) format('woff2'); unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C4, U+2113, U+2C60-2C7F, U+A720-A7FF; }
@font-face { font-family: 'Anton'; font-style: normal; font-weight: 400; font-display: swap; src: url(../vendor/fonts/anton-latin.woff2) format('woff2'); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
:root { --display: 'Anton', Impact, 'Arial Narrow', system-ui, sans-serif; }

/* Quy tắc chung: không để chữ dính, không rớt chữ lẻ, không cắt chữ giữa từ */
body { overflow-wrap: break-word; word-break: normal; hyphens: none; }
p, li, small, .muted { text-wrap: pretty; }
h1, h2, h3, .pop-title, .hero h1 { text-wrap: balance; }

/* Anton cho tiêu đề, số lớn, nút chính. Anton chỉ có 1 độ đậm: không ép bold giả.
   Dòng cao ≥1.25 để dấu tiếng Việt chồng (Ể, Ặ, Ữ…) không bị cắt, giãn chữ .03em để chữ không dính. */
h1, h2, h3, .hero h1, .pop-title, .pop-cta, .cta, .btn.primary, .stage-title, .big-timer,
.ring-label b, .stat b, .stat-row b, .result-grid b, .why-big, .logo, .brand, .g-ava,
.macro-row.big .macro b, .medal, .post-total, .pts, .fx-flash, .hist-total, .code-pill b {
  font-family: var(--display); font-weight: 400; font-synthesis: none;
  letter-spacing: .03em; line-height: 1.25;
}
h1 { font-size: 30px; text-transform: uppercase; margin: 10px 0 14px; }
h2 { font-size: 24px; text-transform: uppercase; }
h3 { font-size: 19px; letter-spacing: .04em; }
.hero h1 { font-size: 38px; letter-spacing: .03em; line-height: 1.2; }
.pop-title { font-size: 32px; line-height: 1.2; }
.pop-cta { font-size: 21px; letter-spacing: .06em; }
.cta, .btn.primary { letter-spacing: .07em; text-transform: uppercase; font-size: 16px; }
.cta { font-size: 19px; }
.btn.primary.small { font-size: 14px; letter-spacing: .06em; }
.stage-title { font-size: 28px; line-height: 1.2; letter-spacing: .05em; }
.big-timer { font-size: 72px; line-height: 1.15; letter-spacing: .02em; padding-top: 4px; }
.ring-label b { line-height: 1.15; }
.finish .ring-label b { font-size: 34px; }
.stat-row b, .stat b { font-size: 24px; padding-top: 2px; }
.brand { letter-spacing: .12em; font-size: 18px; }
.logo { font-size: 18px; letter-spacing: 0; }
.code-pill b { letter-spacing: .18em; }
.kicker { letter-spacing: .08em; }
/* Nút: chữ dài thì xuống dòng gọn chứ không tràn/cắt */
.btn { white-space: normal; text-align: center; line-height: 1.25; }

/* Menu tài khoản */
button.avatar { cursor: pointer; font: inherit; font-weight: 700; padding: 0; }
.acct-head { display: flex; align-items: center; gap: 12px; margin: 4px 0 14px; }
.acct-head b { font-size: 17px; overflow-wrap: anywhere; }
.acct-item { display: flex; align-items: center; gap: 12px; width: 100%; min-height: 54px; padding: 12px 14px; margin: 8px 0; border-radius: 14px; border: 1px solid var(--line); background: var(--card2); color: var(--text); font: inherit; font-size: 16px; font-weight: 600; text-align: left; cursor: pointer; }
.acct-item:active { transform: scale(.98); }
.acct-item.danger { color: #ffb3bb; border-color: rgba(255,93,108,.45); background: rgba(255,93,108,.1); }
.acct-ico { font-size: 20px; width: 26px; text-align: center; }
.acct-tip { margin: 12px 0 2px; text-align: center; color: var(--muted); font-size: 13px; }

/* Hỏi tên gọi */
.nick-card { border-color: rgba(255,106,61,.4); }
.nick-card b { display: block; margin-bottom: 10px; font-size: 16px; }
.nick-row { display: flex; gap: 8px; }
.nick-row input { flex: 1; min-width: 0; }
.acct-head small { display: block; margin-top: 2px; }

/* ===================== THIẾT KẾ 2.0 (kiểu app quốc tế, tối + cam đỏ) ===================== */
:root { --bg: #111317; --bg2: #181b20; --card: #1c1f25; --card2: #252931; --line: #2e333c; --radius: 22px; --grad: linear-gradient(135deg, #ff7a45, #ff4f5e); --nav-h: 72px; }
body { background: radial-gradient(900px 500px at 85% -120px, rgba(255,90,70,.16), transparent 60%), var(--bg); }
.card { border-radius: var(--radius); background: var(--card); border: 1px solid rgba(255,255,255,.06); box-shadow: 0 10px 30px rgba(0,0,0,.25); }

/* Icon vector */
.ico { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; flex: none; }
.btn .ico { width: 18px; height: 18px; }
.ic-circle { width: 42px; height: 42px; border-radius: 50%; display: grid; place-items: center; flex: none; color: var(--accent2); background: rgba(255,106,61,.12); border: 1px solid rgba(255,106,61,.25); }
.ic-circle .ico { width: 20px; height: 20px; }
.chev-ico { color: var(--muted); width: 18px; height: 18px; margin-left: auto; }

/* Thanh menu nổi + nút giữa */
nav#nav { left: 12px; right: 12px; bottom: calc(10px + env(safe-area-inset-bottom)); height: var(--nav-h); padding: 0 6px; border-radius: 26px; border: 1px solid rgba(255,255,255,.08); background: rgba(28,31,37,.92); box-shadow: 0 12px 40px rgba(0,0,0,.5); align-items: center; max-width: 560px; margin: 0 auto; }
body.has-nav main { padding-bottom: calc(var(--nav-h) + 40px + env(safe-area-inset-bottom)); }
nav#nav a { font-size: 11px; gap: 4px; }
nav#nav a svg { width: 23px; height: 23px; stroke-width: 1.9; }
nav#nav a.on { color: var(--accent); }
nav#nav a.on span { font-weight: 700; }
.nav-fab { flex: none; width: 60px; height: 60px; margin-top: -30px; border-radius: 50%; border: 4px solid var(--bg); background: var(--grad); color: #fff; display: grid; place-items: center; cursor: pointer; box-shadow: 0 10px 28px rgba(255,80,70,.55); transition: transform .15s ease; }
.nav-fab .ico { width: 28px; height: 28px; stroke-width: 2.6; }
.nav-fab:active { transform: scale(.92); }

/* Bảng tác vụ nhanh */
.sheet-kicker { margin: 2px 0 8px; color: var(--muted); font-size: 12px; font-weight: 700; letter-spacing: .14em; text-transform: uppercase; }
.quick-item { display: flex; align-items: center; gap: 14px; padding: 12px; margin: 6px 0; border-radius: 16px; background: var(--card2); color: var(--text); border: 1px solid rgba(255,255,255,.05); }
.quick-item:active { transform: scale(.98); }
.qi-ico { width: 44px; height: 44px; border-radius: 14px; display: grid; place-items: center; background: var(--grad); color: #fff; flex: none; }
.qi-ico .ico { width: 22px; height: 22px; }
.quick-item b { display: block; font-size: 15.5px; }
.quick-item small { color: var(--muted); font-size: 13px; }
.qi-chev { color: var(--muted); margin-left: auto; }
.acct-ico { color: var(--accent2); display: grid; place-items: center; }
.acct-item.danger .acct-ico { color: #ffb3bb; }

/* Trang chủ */
.greet { margin: 6px 0 14px; }
.greet .hello { margin: 0; color: var(--muted); font-size: 15px; }
.greet h1 { margin: 0 0 4px; font-size: 36px; text-transform: none; letter-spacing: .02em; }
.today-hero { position: relative; overflow: hidden; border-radius: 26px; min-height: 250px; margin: 12px 0; display: flex; align-items: flex-end; background: #222; box-shadow: 0 16px 40px rgba(0,0,0,.45); border: 1px solid rgba(255,255,255,.07); }
.today-hero .hero-bg { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; object-position: center 30%; }
.today-hero::after { content: ''; position: absolute; inset: 0; background: linear-gradient(180deg, rgba(10,11,14,.05) 0%, rgba(10,11,14,.55) 45%, rgba(10,11,14,.96) 100%); }
.th-body { position: relative; z-index: 1; padding: 18px; width: 100%; }
.th-body h2 { font-size: 30px; margin: 8px 0 6px; line-height: 1.15; }
.th-body p { margin: 0 0 4px; color: #d5d9e0; }
.pill { display: inline-flex; align-items: center; gap: 6px; padding: 6px 12px; border-radius: 999px; background: rgba(255,106,61,.2); color: #ffc2a8; font-size: 12.5px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; backdrop-filter: blur(6px); }
.pill .ico { width: 14px; height: 14px; }
.today-hero.rest .pill { background: rgba(60,207,142,.18); color: #9ff0c9; }
.meta-row { display: flex; gap: 16px; color: #d5d9e0; font-size: 14px; margin-bottom: 12px; }
.meta-row span { display: inline-flex; align-items: center; gap: 6px; }
.meta-row .ico { width: 16px; height: 16px; color: var(--accent2); }
.today-hero .cta { margin-top: 4px; }
.done-badge { display: flex; align-items: center; justify-content: center; gap: 8px; }

.week-card { display: flex; align-items: center; gap: 14px; }
.wk-ring { width: 128px; flex: none; }
.wk-ring .ring-label b { font-size: 26px; }
.wk-ring .ring-label small { font-size: 10.5px; }
.wk-stats { flex: 1; display: grid; gap: 10px; min-width: 0; }
.mini-stat { display: flex; align-items: center; gap: 10px; }
.mini-stat .ic-circle { width: 36px; height: 36px; }
.mini-stat .ic-circle .ico { width: 17px; height: 17px; }
.mini-stat small { display: block; color: var(--muted); font-size: 12px; }
.mini-stat b { font-family: var(--display); font-weight: 400; font-size: 21px; letter-spacing: .03em; line-height: 1.2; color: var(--accent2); }
.mini-stat b em { font-style: normal; font-family: system-ui, sans-serif; font-size: 12px; color: var(--muted); letter-spacing: 0; }
.mini-stat span { display: block; font-size: 12px; color: var(--muted); }
.mini-stat .good { color: var(--good); }
.mini-stat .bad { color: var(--bad); }

.sec-head { display: flex; align-items: center; justify-content: space-between; margin: 22px 2px 10px; }
.sec-head.in { margin: 0 0 8px; }
.sec-head h3 { margin: 0; }
.sec-head a { display: inline-flex; align-items: center; gap: 2px; color: var(--accent2); font-size: 14px; font-weight: 600; }
.sec-head a .ico { width: 16px; height: 16px; }

.week-strip { display: grid; grid-template-columns: repeat(7, 1fr); gap: 6px; }
.week-strip .day { display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 10px 0; border-radius: 16px; background: var(--card); border: 1px solid rgba(255,255,255,.05); color: var(--muted); }
.week-strip .day small { font-size: 12px; font-weight: 600; }
.week-strip .day i { width: 26px; height: 26px; border-radius: 50%; display: grid; place-items: center; font-style: normal; background: var(--bg2); }
.week-strip .day.has i { background: rgba(255,106,61,.16); box-shadow: inset 0 0 0 1.5px rgba(255,106,61,.5); }
.week-strip .day.done i { background: var(--grad); color: #fff; box-shadow: none; }
.week-strip .day i .ico { width: 14px; height: 14px; stroke-width: 3; }
.week-strip .day.today { border-color: var(--accent); color: var(--text); background: linear-gradient(180deg, rgba(255,106,61,.14), var(--card)); }

.ex-list { display: grid; gap: 8px; }
.ex-row { display: flex; align-items: center; gap: 12px; padding: 8px 12px 8px 8px; border-radius: 18px; background: var(--card); color: var(--text); border: 1px solid rgba(255,255,255,.05); }
.ex-row img { width: 64px; height: 64px; border-radius: 14px; object-fit: cover; background: var(--bg2); flex: none; }
.ex-row b { display: block; font-size: 15px; line-height: 1.3; }
.ex-row small { color: var(--accent2); font-size: 13px; font-weight: 600; }
.ex-row:active { transform: scale(.98); }

.icon-callout { flex-direction: row; align-items: center; gap: 12px; }
.icon-callout b { display: block; }
.icon-callout small { color: var(--muted); }
.small-print { font-size: 13px; }

/* Trang chào */
.goal-chip { display: inline-flex; align-items: center; gap: 8px; }
.goal-chip .ico { width: 16px; height: 16px; color: var(--accent2); }
.ficon { color: var(--accent2); background: rgba(255,106,61,.12); border: 1px solid rgba(255,106,61,.22); border-radius: 14px; }
.ficon .ico { width: 22px; height: 22px; }
.feature { border: 1px solid rgba(255,255,255,.06); border-radius: 20px; align-items: center; }

/* Quên mật khẩu */
.opt-card { display: flex; flex-direction: column; gap: 2px; border-color: rgba(60,207,142,.35); }
.warn-card { border-color: rgba(255,170,60,.4); background: #2a241d; padding: 12px; }
.warn-card b { display: block; margin-bottom: 2px; }
.narrow { max-width: 440px; margin-left: auto; margin-right: auto; }
.spinner.small { width: 22px; height: 22px; }

/* Thư viện: thẻ nhóm cơ */
.focus-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; margin: 6px 0 16px; }
.focus-card { position: relative; overflow: hidden; aspect-ratio: 4/3; border-radius: 20px; border: 1px solid rgba(255,255,255,.07); background: linear-gradient(135deg, #2a2f39, #1a1d22); padding: 0; cursor: pointer; color: #fff; text-align: left; }
.focus-card img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; transition: transform .3s ease; }
.focus-card::after { content: ''; position: absolute; inset: 0; background: linear-gradient(180deg, transparent 40%, rgba(0,0,0,.85)); }
.focus-card span { position: absolute; left: 12px; bottom: 10px; z-index: 1; font-family: var(--display); font-size: 20px; letter-spacing: .05em; line-height: 1.2; text-transform: uppercase; }
.focus-card:active img { transform: scale(1.05); }
@media (min-width: 560px) { .focus-grid { grid-template-columns: repeat(3, 1fr); } }
