:root {
  --ink: #1B1F24; --ink2: #3A4047; --muted: #5B6168; --line: #E6E8E3; --line2: #D9DCD5;
  --bg: #F3F4F1; --card: #FFFFFF; --bad: #8F3420; --bad-l: #B4472E; --bad-bg: #F7E1DA;
  --gold: #E9B872; --warn-bg: #FBEBC8; --warn: #6B4A08;
  --acc: #0E5C5A; --acc-d: #08403F; --acc-s: #CFE6E4; --acc-t: #E3EFEE;
  --display: 'Bricolage Grotesque', Inter, system-ui, sans-serif;
  --serif: 'Fraunces', Georgia, serif;
  color-scheme: light;
}
body[data-lang="en"] { --acc: #B0246F; --acc-d: #7E1850; --acc-s: #F6D3E5; --acc-t: #FBE6F0; }
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; background: var(--bg); color: var(--ink); font: 16px/1.5 Inter, system-ui, -apple-system, sans-serif; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
h1 { font-family: var(--display); font-weight: 700; font-size: 28px; line-height: 1.15; margin: 0; }
h2 { font-size: 16px; font-weight: 600; margin: 0 0 10px; }
p { margin: 0; }
.mt { margin-top: 4px; }
#app { min-height: 100vh; min-height: 100dvh; }
.screen { max-width: 520px; margin: 0 auto; padding: calc(env(safe-area-inset-top) + 16px) 18px calc(env(safe-area-inset-bottom) + 24px); display: flex; flex-direction: column; gap: 14px; min-height: 100dvh; }
.screen.with-nav { padding-bottom: calc(env(safe-area-inset-bottom) + 96px); min-height: auto; }
.screen.narrow { justify-content: center; text-align: center; align-items: center; }
.center { display: grid; place-items: center; min-height: 100dvh; }
.center-t { text-align: center; }
.center-col { display: flex; flex-direction: column; align-items: center; gap: 6px; text-align: center; }
.spinner { width: 34px; height: 34px; border-radius: 50%; border: 3px solid var(--line2); border-top-color: var(--acc); animation: spin 0.8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.right { text-align: right; }
.grow { flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; }
.row { display: flex; align-items: center; }
.row.gap { gap: 8px; }
.row.between { justify-content: space-between; gap: 10px; }
.top-line { border-top: 1px solid var(--line); padding-top: 10px; margin-top: 10px; }
.err { color: #A3321E; min-height: 18px; font-size: 13px; }
.ok-t { color: var(--acc-d); }
.toast { background: var(--acc-t); color: var(--acc-d); border-radius: 12px; padding: 10px 14px; font-size: 14px; }
.card { background: var(--card); border-radius: 20px; padding: 16px 18px; display: flex; flex-direction: column; gap: 8px; }
.pill { font-size: 12px; font-weight: 600; border-radius: 999px; padding: 4px 10px; background: var(--bg); color: var(--ink2); white-space: nowrap; }
.pill.acc { background: var(--acc-t); color: var(--acc-d); }
.pill.lv { background: var(--warn-bg); color: var(--warn); }
.pill.theo { background: #ECE8F8; color: #4A3D8F; }
.pill.phr { background: #E3EDF8; color: #22507F; }
.pill.ok-p { background: var(--acc-t); color: var(--acc-d); }
.pill.warn { background: var(--warn-bg); color: var(--warn); }
.pill.gold-p { background: #F3E3C7; color: #6E4A1C; }
.chip { display: inline-flex; align-items: center; gap: 6px; background: #fff; border-radius: 999px; padding: 7px 13px; font-size: 14px; font-weight: 600; }
.iconbtn { width: 44px; height: 44px; border-radius: 12px; border: 0; background: #fff; display: inline-flex; align-items: center; justify-content: center; flex-shrink: 0; }
.iconbtn.round { border-radius: 999px; border: 1px solid var(--line2); color: var(--acc); }
.toprow { display: flex; align-items: center; gap: 12px; }
.toprow.end { justify-content: flex-end; }
.btn { min-height: 52px; border-radius: 16px; border: 1px solid var(--line2); background: #fff; font-weight: 600; padding: 8px 14px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; text-align: center; }
.btn small { font-size: 12px; font-weight: 400; opacity: 0.85; }
.btn.primary { background: var(--acc); border-color: var(--acc); color: #fff; }
.btn.light { background: #fff; border: 0; color: var(--acc-d); flex-direction: row; gap: 8px; }
.btn.bad { color: var(--bad); border: 1.5px solid var(--bad-l); }
.btn.bad.solid { background: var(--bad-l); color: #fff; }
.btn.gold { background: var(--gold); border: 0; color: #2A1E17; }
.btn.small-b { min-height: 44px; }
.btn:disabled { opacity: 0.6; }
.two { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.link { background: none; border: 0; color: var(--acc); font-weight: 500; min-height: 44px; }
.input, .select { width: 100%; border: 1px solid var(--line2); border-radius: 12px; padding: 12px 14px; background: #fff; font-size: 16px; }
textarea.input { resize: none; }
.select { width: auto; padding: 8px 10px; }
.check { display: flex; align-items: center; gap: 10px; min-height: 44px; color: var(--ink2); font-size: 14px; }
.check input { width: 20px; height: 20px; accent-color: var(--acc); }

/* pin */
.pin { align-items: center; text-align: center; gap: 12px; padding-top: calc(env(safe-area-inset-top) + 28px); }
.pin .toprow { width: 100%; justify-content: space-between; }
.logo-big { margin-bottom: 4px; }
h1.brand { font-size: 34px; font-weight: 800; }
.dots { display: flex; gap: 18px; margin-top: 8px; }
.dot { width: 16px; height: 16px; border-radius: 999px; border: 2px solid #9AA0A6; }
.dot.on { background: var(--ink); border-color: var(--ink); }
.keypad { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; width: 100%; max-width: 320px; }
.key { height: 62px; border-radius: 999px; border: 0; background: #fff; font-size: 26px; }
.key.ghost { background: transparent; }
.key:active { background: var(--acc-t); }
.icon-circle { width: 64px; height: 64px; border-radius: 999px; background: var(--acc-t); color: var(--acc); display: grid; place-items: center; }
.code { font-family: ui-monospace, monospace; font-size: 24px; letter-spacing: 2px; background: #fff; border-radius: 14px; padding: 16px 20px; user-select: all; -webkit-user-select: all; }

/* main */
.langs { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 4px; background: #fff; border-radius: 14px; padding: 4px; }
.lang { min-height: 44px; border: 0; border-radius: 10px; background: transparent; display: flex; align-items: center; justify-content: center; gap: 8px; font-size: 14px; font-weight: 500; color: var(--ink2); }
.lang .badge { font-size: 11px; font-weight: 600; border-radius: 999px; padding: 2px 7px; display: inline-flex; align-items: center; gap: 3px; }
.lang.es .badge { background: #E3EFEE; color: #08403F; }
.lang.en .badge { background: #FBE6F0; color: #7E1850; }
.lang.on { color: #fff; font-weight: 600; }
.lang.es.on { background: #0E5C5A; }
.lang.en.on { background: #B0246F; }
.lang.on .badge { background: #fff; }
.hello { display: flex; justify-content: space-between; align-items: center; gap: 10px; }
.hero { background: var(--acc); color: #fff; border-radius: 24px; padding: 20px; display: flex; flex-direction: column; gap: 14px; }
.hero-row { display: flex; justify-content: space-between; align-items: flex-end; }
.hero-row > div:first-child { display: flex; flex-direction: column; gap: 4px; }
.soft { color: var(--acc-s); }
.num { font-family: var(--display); font-size: 48px; font-weight: 700; line-height: 1; }
.hero-done { display: flex; gap: 12px; align-items: center; }
.hero-done .big { width: 52px; height: 52px; border-radius: 999px; background: rgba(255,255,255,0.18); display: grid; place-items: center; flex-shrink: 0; }
.hero-done div { display: flex; flex-direction: column; gap: 2px; }
.hero-done span { color: var(--acc-s); font-size: 13px; }
.bars { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 8px; align-items: end; height: 84px; }
.bars.tall { height: 110px; }
.bar { display: flex; flex-direction: column; align-items: center; justify-content: flex-end; gap: 4px; height: 100%; font-size: 12px; }
.bar span { width: 100%; border-radius: 8px; background: var(--acc); }
.bars-l { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 8px; font-size: 11px; color: var(--muted); text-align: center; }
.mixrow { display: flex; align-items: center; gap: 10px; font-size: 14px; }
.mixrow .grow { display: block; }
.sq { width: 10px; height: 10px; border-radius: 3px; flex-shrink: 0; }
.bad-t { color: var(--bad); }
.nav { position: fixed; left: 0; right: 0; bottom: 0; display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); background: #fff; border-top: 1px solid var(--line); padding: 6px 8px calc(env(safe-area-inset-bottom) + 6px); z-index: 5; }
.nav button { border: 0; background: none; min-height: 48px; display: flex; flex-direction: column; align-items: center; gap: 3px; font-size: 11px; color: var(--muted); }
.nav button.on { color: var(--acc-d); font-weight: 600; }

/* session */
.session { gap: 12px; }
.handbar { display: flex; gap: 4px; margin-top: 6px; }
.handbar span { flex: 1; height: 5px; border-radius: 3px; background: var(--line2); }
.handbar span.cur { background: #F2B544; }
.flash { background: #fff; border: 1px solid var(--line); border-radius: 28px; padding: 22px; display: flex; flex-direction: column; gap: 12px; text-align: left; min-height: 380px; width: 100%; animation: flipIn 0.28s ease-out; }
.flash.back { min-height: 0; }
@keyframes flipIn { from { transform: perspective(900px) rotateY(-14deg); opacity: 0.4; } to { transform: none; opacity: 1; } }
.flash-mid { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 10px; text-align: center; }
.word { font-family: var(--display); font-size: 40px; font-weight: 700; line-height: 1.1; overflow-wrap: anywhere; }
.word.pl { font-size: 32px; }
.word.sm { font-size: 30px; }
.hint { display: flex; align-items: center; gap: 6px; font-size: 13px; color: var(--muted); margin-top: 14px; }
.say { background: var(--bg); border-radius: 14px; padding: 11px 14px; font-size: 13px; color: var(--ink2); }
.timer { text-align: center; font-size: 13px; color: var(--muted); }
.timer.late { color: #A3321E; }
.speak-front { align-self: center; }
.tr { font-size: 21px; font-weight: 600; color: var(--acc); margin: 0; }
.sub-h { font-size: 12px; color: var(--muted); border-top: 1px solid var(--line); padding-top: 10px; margin-top: 4px; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chips span { background: var(--bg); border-radius: 999px; padding: 6px 12px; font-size: 13px; }
.table { display: grid; grid-template-columns: minmax(0, 0.9fr) minmax(0, 1.1fr); row-gap: 7px; column-gap: 14px; font-size: 14px; }
.table .hl { color: var(--acc); font-weight: 700; }
.answer-box { display: flex; justify-content: space-between; align-items: center; background: var(--bg); border-radius: 14px; padding: 12px 16px; }
.answer-box b { font-family: var(--display); font-size: 24px; color: var(--acc); }
.ex { display: flex; flex-direction: column; gap: 3px; border-top: 1px solid var(--line); padding-top: 10px; }
.ex i { font-family: var(--serif); font-size: 17px; }
.note { background: var(--bg); border-radius: 14px; padding: 11px 14px; font-size: 13px; color: var(--ink2); }
.timer-s { font-size: 13px; font-weight: 600; color: var(--warn); }
.timer-s.late { color: #A3321E; }
.tbar { height: 4px; border-radius: 2px; background: var(--bg); overflow: hidden; }
.tbar span { display: block; height: 100%; width: 100%; background: #F2B544; transition: width 0.2s linear; }
.sentence { font-family: var(--display); font-size: 23px; font-weight: 500; line-height: 1.3; margin: 0; }
.result { border-radius: 20px; padding: 16px; display: flex; flex-direction: column; gap: 6px; }
.result i { font-family: var(--serif); font-size: 18px; line-height: 1.45; }
.result.good { background: var(--acc-t); color: var(--acc-d); }
.result.badr { background: var(--bad-bg); color: #5E2414; }
.result mark { background: #F2C8BB; color: inherit; border-radius: 4px; padding: 0 2px; }

/* summary + reward */
.stats3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
.stats3 div { background: #fff; border-radius: 18px; padding: 14px; display: flex; flex-direction: column; }
.stats3 b { font-family: var(--display); font-size: 28px; }
.stats3 span { font-size: 12px; color: var(--muted); }
.stats3 .g { background: var(--acc-t); color: var(--acc-d); }
.stats3 .g span { color: var(--acc-d); }
.stats3 .r { background: var(--bad-bg); color: var(--bad); }
.stats3 .r span { color: var(--bad); }
.reward-banner { display: flex; align-items: center; gap: 12px; background: #2A1E17; color: #F5EDE4; border: 0; border-radius: 18px; padding: 14px 16px; text-align: left; }
.reward-banner span { flex: 1; }
.coffee { background: #2A1E17; color: #F5EDE4; min-height: 100dvh; max-width: none; }
.coffee > * { width: 100%; max-width: 520px; margin-left: auto; margin-right: auto; }
.coffee h1 { color: #fff; font-weight: 800; }
.cream-s { color: #CDBBA9; font-size: 14px; }
.ms-row { display: flex; justify-content: space-between; }
.ms { display: flex; flex-direction: column; align-items: center; gap: 5px; }
.ms span { width: 14px; height: 14px; border-radius: 999px; border: 2px solid #6E5A48; }
.ms span.on { background: var(--gold); border-color: var(--gold); }
.ms small { font-size: 11px; color: #A8968A; }
.ms small.cur { color: #fff; font-weight: 600; }
.fact { background: #F7F1E8; color: #2A1E17; border-radius: 24px; padding: 22px; display: flex; flex-direction: column; gap: 12px; }
.fact .topic { font-size: 12px; font-weight: 600; color: #8A5A2B; letter-spacing: 0.5px; }
.fact h2 { font-family: var(--display); font-size: 22px; font-weight: 700; line-height: 1.25; margin: 0; }
.fact p { font-size: 15px; line-height: 1.6; }
.fact .try { background: #EFE3D2; border-radius: 14px; padding: 12px 14px; font-size: 14px; line-height: 1.5; }
.fact .src { font-size: 12px; color: #6E5A48; }

/* box, words, settings */
.lvgrid { display: grid; grid-template-columns: 70px minmax(0, 1fr) 70px; gap: 10px; align-items: center; font-size: 13px; }
.lvk { font-weight: 600; }
.prog { position: relative; height: 7px; border-radius: 4px; background: var(--line); overflow: hidden; }
.prog span { position: absolute; left: 0; top: 0; bottom: 0; background: var(--acc-s); border-radius: 4px; }
.prog span.m { background: var(--acc); }
.factrow { display: flex; align-items: center; gap: 10px; min-height: 52px; border: 0; border-top: 1px solid var(--line); background: none; text-align: left; padding: 6px 0; }
.factrow .grow { display: block; font-size: 14px; }
.fchips { display: flex; gap: 6px; overflow-x: auto; padding-bottom: 2px; }
.fchip { border: 1px solid var(--line2); background: #fff; border-radius: 999px; padding: 8px 14px; font-size: 13px; white-space: nowrap; min-height: 40px; }
.fchip.on { background: var(--acc); border-color: var(--acc); color: #fff; }
.wrow { display: flex; align-items: center; gap: 8px; background: #fff; border-radius: 14px; padding: 10px 14px; margin-bottom: 6px; }
.wrow .grow b { font-weight: 600; }
.srow { display: flex; align-items: center; justify-content: space-between; gap: 10px; min-height: 52px; border-top: 1px solid var(--line); }
.srow input[type=checkbox] { width: 22px; height: 22px; accent-color: var(--acc); }
.slots .srow:first-child { border-top: 0; }
.lrow { display: flex; align-items: center; justify-content: space-between; min-height: 52px; border: 0; border-top: 1px solid var(--line); background: none; width: 100%; text-align: left; padding: 0; font-size: 16px; color: var(--ink); cursor: pointer; }
.lrow:first-of-type { border-top: 0; }
