:root {
  --bg: #0e1014;
  --bg2: #15181f;
  --card: #1b1f28;
  --card2: #232835;
  --line: #2b313e;
  --text: #f2f0ea;
  --muted: #9aa3b2;
  --dim: #6b7382;
  --amber: #f5b942;
  --amber2: #ffd37a;
  --mint: #5fd3a6;
  --coral: #ff6b6b;
  --sky: #6cb4ff;
  --violet: #b48cff;
  --radius: 18px;
  --nav-h: 68px;
  --font: 'Manrope', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; background: var(--bg); color: var(--text); font-family: var(--font); -webkit-font-smoothing: antialiased; }
body { min-height: 100vh; }
button { font-family: inherit; }
a { color: var(--amber2); }

.app { max-width: 560px; margin: 0 auto; padding: 0 18px calc(var(--nav-h) + 24px); min-height: 100vh; position: relative; }
@media (min-width: 900px) { .app { max-width: 640px; } }

/* Top bar */
.topbar { display: flex; align-items: center; justify-content: space-between; padding: 18px 0 8px; position: sticky; top: 0; background: linear-gradient(var(--bg) 70%, transparent); z-index: 5; }
.brand { display: flex; align-items: center; gap: 10px; font-weight: 800; letter-spacing: .3px; font-size: 18px; }
.brand .logo { width: 30px; height: 30px; border-radius: 9px; background: linear-gradient(135deg, var(--amber), #ff8a5c); display: grid; place-items: center; color: #1a1205; font-weight: 900; font-size: 15px; }
.streak { display: flex; align-items: center; gap: 6px; background: var(--card); border: 1px solid var(--line); padding: 7px 12px; border-radius: 999px; font-weight: 700; font-size: 13px; color: var(--amber2); }
.iconbtn { background: var(--card); border: 1px solid var(--line); color: var(--text); width: 38px; height: 38px; border-radius: 12px; display: grid; place-items: center; cursor: pointer; font-size: 16px; }
.iconbtn:hover { background: var(--card2); }

/* Headings */
h1 { font-size: 26px; font-weight: 800; margin: 14px 0 6px; letter-spacing: -.3px; line-height: 1.2; }
h2 { font-size: 18px; font-weight: 800; margin: 22px 0 10px; }
h3 { font-size: 15px; font-weight: 800; margin: 0 0 6px; }
.sub { color: var(--muted); font-size: 14px; margin: 0 0 14px; line-height: 1.5; }
.eyebrow { font-size: 11px; letter-spacing: 1.4px; text-transform: uppercase; color: var(--amber); font-weight: 800; margin-bottom: 6px; }

/* Cards */
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; margin-bottom: 12px; }
.card.soft { background: var(--bg2); }
.card.accent { background: linear-gradient(140deg, #2a2210, #1b1f28 60%); border-color: #4a3b14; }
.row { display: flex; align-items: center; gap: 12px; }
.row.between { justify-content: space-between; }
.grow { flex: 1; min-width: 0; }
.stack > * + * { margin-top: 10px; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.grid3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.muted { color: var(--muted); } .dim { color: var(--dim); } .small { font-size: 12.5px; } .tiny { font-size: 11px; }
.bold { font-weight: 800; }
.pill { display: inline-block; font-size: 11px; font-weight: 700; padding: 3px 9px; border-radius: 999px; background: var(--card2); color: var(--muted); border: 1px solid var(--line); }
.pill.amber { color: var(--amber2); border-color: #4a3b14; background: #2a2210; }
.pill.mint { color: var(--mint); border-color: #1d4a3a; background: #0f2a22; }
.pill.coral { color: var(--coral); border-color: #4a1d1d; background: #2a1010; }
.divider { height: 1px; background: var(--line); margin: 14px 0; }

/* Plan items */
.plan-item { display: flex; align-items: center; gap: 14px; padding: 14px; background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); margin-bottom: 10px; cursor: pointer; transition: transform .12s, background .12s; }
.plan-item:hover { background: var(--card2); transform: translateY(-1px); }
.plan-item.done { opacity: .62; }
.plan-item .ico { width: 46px; height: 46px; border-radius: 14px; display: grid; place-items: center; font-size: 22px; background: var(--card2); flex-shrink: 0; }
.plan-item .ico.amber { background: #2a2210; } .plan-item .ico.mint { background: #0f2a22; } .plan-item .ico.sky { background: #0f1f33; } .plan-item .ico.violet { background: #1f1733; } .plan-item .ico.coral { background: #2a1010; }
.plan-item .t { font-weight: 800; font-size: 15px; }
.plan-item .d { color: var(--muted); font-size: 12.5px; margin-top: 2px; }
.check { width: 26px; height: 26px; border-radius: 50%; border: 2px solid var(--line); display: grid; place-items: center; font-size: 13px; color: var(--bg); flex-shrink: 0; }
.check.on { background: var(--mint); border-color: var(--mint); }

/* Buttons */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; padding: 13px 18px; border-radius: 14px; border: 1px solid var(--line); background: var(--card2); color: var(--text); font-weight: 800; font-size: 14.5px; cursor: pointer; transition: transform .1s, filter .1s; white-space: nowrap; }
.btn:hover { filter: brightness(1.1); } .btn:active { transform: scale(.98); }
.btn.primary { background: var(--amber); color: #1a1205; border-color: var(--amber); }
.btn.mint { background: var(--mint); color: #062018; border-color: var(--mint); }
.btn.danger { background: #3a1818; color: var(--coral); border-color: #5a2424; }
.btn.ghost { background: transparent; }
.btn.block { width: 100%; }
.btn.sm { padding: 8px 12px; font-size: 13px; border-radius: 10px; }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btnrow { display: flex; gap: 10px; flex-wrap: wrap; }
.btnrow .btn { flex: 1; }

/* Record button */
.recwrap { display: flex; flex-direction: column; align-items: center; gap: 10px; padding: 14px 0 6px; }
.recbtn { width: 92px; height: 92px; border-radius: 50%; border: none; background: var(--amber); color: #1a1205; font-size: 30px; cursor: pointer; display: grid; place-items: center; box-shadow: 0 0 0 0 rgba(245,185,66,.5); transition: transform .12s; position: relative; }
.recbtn:active { transform: scale(.96); }
.recbtn.live { background: var(--coral); color: #fff; animation: pulse 1.4s infinite; }
@keyframes pulse { 0% { box-shadow: 0 0 0 0 rgba(255,107,107,.55); } 70% { box-shadow: 0 0 0 22px rgba(255,107,107,0); } 100% { box-shadow: 0 0 0 0 rgba(255,107,107,0); } }
.reclabel { font-size: 13px; color: var(--muted); font-weight: 700; }
.timer { font-variant-numeric: tabular-nums; font-weight: 800; font-size: 22px; }

/* Meters */
.meter { height: 10px; background: var(--bg2); border-radius: 999px; overflow: hidden; border: 1px solid var(--line); }
.meter > i { display: block; height: 100%; background: var(--amber); border-radius: 999px; transition: width .08s linear; }
.meter.mint > i { background: var(--mint); }
.meter.sky > i { background: var(--sky); }
.scorebar { margin: 8px 0; }
.scorebar .row { font-size: 13px; font-weight: 700; margin-bottom: 5px; }

/* Score ring */
.ring { width: 96px; height: 96px; border-radius: 50%; display: grid; place-items: center; position: relative; background: conic-gradient(var(--amber) calc(var(--p) * 1%), var(--bg2) 0); flex-shrink: 0; }
.ring::after { content: ''; position: absolute; inset: 9px; border-radius: 50%; background: var(--card); }
.ring span { position: relative; z-index: 1; font-weight: 900; font-size: 26px; }
.ring.mint { background: conic-gradient(var(--mint) calc(var(--p) * 1%), var(--bg2) 0); }
.ring.sm { width: 64px; height: 64px; } .ring.sm::after { inset: 6px; } .ring.sm span { font-size: 17px; }

/* Stats */
.stat { background: var(--bg2); border: 1px solid var(--line); border-radius: 14px; padding: 10px 12px; }
.stat .v { font-weight: 900; font-size: 20px; letter-spacing: -.3px; }
.stat .k { color: var(--muted); font-size: 11.5px; font-weight: 700; text-transform: uppercase; letter-spacing: .6px; margin-top: 2px; }

/* Canvas */
canvas.viz { width: 100%; height: 150px; display: block; border-radius: 12px; background: var(--bg2); border: 1px solid var(--line); }
canvas.viz.tall { height: 200px; }
canvas.spark { width: 100%; height: 56px; display: block; }

/* Twister words */
.words { line-height: 1.9; font-size: 21px; font-weight: 800; letter-spacing: -.2px; }
.words .w { padding: 1px 4px; border-radius: 6px; }
.words .w.ok { color: var(--mint); }
.words .w.miss { color: var(--coral); background: #2a1010; cursor: pointer; text-decoration: underline dotted; }
.words .w.miss:hover { filter: brightness(1.15); }
.hint { background: var(--bg2); border: 1px solid var(--line); border-radius: 14px; padding: 12px 14px; margin-top: 10px; }
.hint .syll { font-size: 20px; font-weight: 900; letter-spacing: 1px; }
.hint .ipa { color: var(--sky); font-family: 'Charis SIL', 'Doulos SIL', 'Gentium', serif; font-size: 15px; margin-left: 8px; }

/* Breathing */
.breath { display: grid; place-items: center; height: 300px; position: relative; }
.breath .orb { width: 120px; height: 120px; border-radius: 50%; background: radial-gradient(circle at 35% 35%, var(--amber2), var(--amber) 50%, #b07a12); box-shadow: 0 0 60px rgba(245,185,66,.35); transition: transform 1s linear; display: grid; place-items: center; }
.breath .phase { position: absolute; bottom: 22px; left: 0; right: 0; text-align: center; font-weight: 800; font-size: 18px; }
.breath .count { font-size: 32px; font-weight: 900; color: #1a1205; }

/* Chat (roleplay) */
.chat { display: flex; flex-direction: column; gap: 10px; margin: 12px 0; }
.bubble { max-width: 88%; padding: 11px 14px; border-radius: 16px; font-size: 14.5px; line-height: 1.5; }
.bubble.them { background: var(--card2); border: 1px solid var(--line); align-self: flex-start; border-bottom-left-radius: 6px; }
.bubble.me { background: #2a2210; border: 1px solid #4a3b14; align-self: flex-end; border-bottom-right-radius: 6px; }
.bubble .who { font-size: 11px; font-weight: 800; letter-spacing: .8px; text-transform: uppercase; color: var(--muted); margin-bottom: 4px; }
.bubble.me .who { color: var(--amber); }
.bubble .m { font-size: 11px; color: var(--dim); margin-top: 6px; }
.typing { display: inline-flex; gap: 4px; } .typing i { width: 6px; height: 6px; border-radius: 50%; background: var(--muted); animation: blink 1.2s infinite; } .typing i:nth-child(2) { animation-delay: .2s; } .typing i:nth-child(3) { animation-delay: .4s; }
@keyframes blink { 0%, 80%, 100% { opacity: .2; } 40% { opacity: 1; } }

/* Lists */
.list-item { display: flex; align-items: center; gap: 12px; padding: 12px 0; border-bottom: 1px solid var(--line); cursor: pointer; }
.list-item:last-child { border-bottom: none; }
.list-item .ico { width: 40px; height: 40px; border-radius: 12px; background: var(--card2); display: grid; place-items: center; font-size: 20px; flex-shrink: 0; }
ul.clean { list-style: none; padding: 0; margin: 0; } ul.clean li { padding: 6px 0 6px 18px; position: relative; font-size: 14px; line-height: 1.5; }
ul.clean li::before { content: ''; position: absolute; left: 2px; top: 13px; width: 7px; height: 7px; border-radius: 50%; background: var(--amber); }
ul.clean.mint li::before { background: var(--mint); } ul.clean.coral li::before { background: var(--coral); }
blockquote { margin: 8px 0; padding: 10px 14px; border-left: 3px solid var(--amber); background: var(--bg2); border-radius: 0 12px 12px 0; font-size: 14px; line-height: 1.5; }

/* Form */
label.f { display: block; font-size: 12.5px; font-weight: 800; color: var(--muted); margin: 12px 0 6px; text-transform: uppercase; letter-spacing: .6px; }
input, select, textarea { width: 100%; background: var(--bg2); border: 1px solid var(--line); color: var(--text); border-radius: 12px; padding: 12px 13px; font-size: 14.5px; font-family: inherit; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--amber); }
textarea { min-height: 90px; resize: vertical; }

/* Calendar */
.cal { display: grid; grid-template-columns: repeat(14, 1fr); gap: 5px; }
.cal i { aspect-ratio: 1; border-radius: 5px; background: var(--bg2); border: 1px solid var(--line); display: block; }
.cal i.on { background: var(--amber); border-color: var(--amber); }
.cal i.today { outline: 2px solid var(--sky); }

/* Bottom nav */
.nav { position: fixed; bottom: 0; left: 0; right: 0; height: var(--nav-h); background: rgba(14,16,20,.92); backdrop-filter: blur(12px); border-top: 1px solid var(--line); z-index: 10; }
.nav .in { max-width: 560px; margin: 0 auto; display: grid; grid-template-columns: repeat(5, 1fr); height: 100%; }
@media (min-width: 900px) { .nav .in { max-width: 640px; } }
.nav button { background: none; border: none; color: var(--dim); font-size: 11px; font-weight: 800; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px; cursor: pointer; padding-bottom: env(safe-area-inset-bottom); }
.nav button .i { font-size: 20px; }
.nav button.on { color: var(--amber2); }

/* Toast + modal */
.toast { position: fixed; left: 50%; bottom: calc(var(--nav-h) + 14px); transform: translateX(-50%); background: var(--card2); border: 1px solid var(--line); color: var(--text); padding: 11px 16px; border-radius: 12px; font-size: 13.5px; font-weight: 700; z-index: 50; box-shadow: 0 10px 30px rgba(0,0,0,.4); max-width: 90vw; }
.modal-bg { position: fixed; inset: 0; background: rgba(0,0,0,.6); z-index: 40; display: grid; place-items: end center; }
.modal { background: var(--card); border: 1px solid var(--line); border-radius: 22px 22px 0 0; padding: 20px 18px 28px; width: 100%; max-width: 560px; max-height: 85vh; overflow: auto; }
@media (min-width: 900px) { .modal-bg { place-items: center; } .modal { border-radius: 22px; max-width: 520px; } }

.back { background: none; border: none; color: var(--muted); font-weight: 800; font-size: 14px; cursor: pointer; padding: 6px 0; display: inline-flex; gap: 6px; align-items: center; }
.back:hover { color: var(--text); }
.notice { background: #2a2210; border: 1px solid #4a3b14; color: var(--amber2); border-radius: 12px; padding: 10px 12px; font-size: 13px; line-height: 1.5; }
.notice.red { background: #2a1010; border-color: #4a1d1d; color: var(--coral); }
.fade { animation: fade .25s ease; } @keyframes fade { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
.center { text-align: center; }
.big { font-size: 44px; font-weight: 900; letter-spacing: -1px; line-height: 1; }
.lesson-body { font-size: 16px; line-height: 1.7; }
.sharecard { background: linear-gradient(145deg, #2a2210, #15181f 70%); border: 1px solid #4a3b14; border-radius: 20px; padding: 20px; }
