/* ============ Tokens ============ */
:root {
  --bg: #f5f3ec;
  --surface: #ffffff;
  --surface-2: #faf8f2;
  --ink: #16150f;
  --ink-2: #3b3a33;
  --muted: #6d6b62;
  --line: #e7e3d7;
  --brand: #ffc800;
  --brand-2: #ffdb4d;
  --brand-ink: #141206;
  --ok: #1f9d55;
  --bad: #d64545;
  --shadow: 0 1px 2px rgba(20, 18, 8, .06), 0 6px 20px rgba(20, 18, 8, .06);
  --shadow-lg: 0 10px 40px rgba(20, 18, 8, .16);
  --radius: 16px;
  --paper: #fffdf5;
  --paper-ink: #1d1b14;
  --paper-muted: #6a6656;
  --paper-dot: #e9e3cf;
  --side: 268px;
  --top: 64px;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #11110e; --surface: #1b1a16; --surface-2: #22211c; --ink: #f3f1e8; --ink-2: #d8d5c8;
    --muted: #a19e90; --line: #2f2d26; --shadow: 0 1px 2px rgba(0,0,0,.4), 0 6px 20px rgba(0,0,0,.3);
    --paper: #fbf7e9; color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #11110e; --surface: #1b1a16; --surface-2: #22211c; --ink: #f3f1e8; --ink-2: #d8d5c8;
  --muted: #a19e90; --line: #2f2d26; --shadow: 0 1px 2px rgba(0,0,0,.4), 0 6px 20px rgba(0,0,0,.3);
  --paper: #fbf7e9; color-scheme: dark;
}

/* ============ Base ============ */
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--ink);
  font: 16px/1.55 "Nunito", system-ui, -apple-system, "Segoe UI", sans-serif;
  -webkit-font-smoothing: antialiased;
}
a { color: inherit; text-decoration: none; }
button { font: inherit; color: inherit; }
h1, h2, h3, h4 { font-family: "Poppins", system-ui, sans-serif; line-height: 1.2; margin: 0; letter-spacing: -.01em; }
mark { background: linear-gradient(transparent 55%, rgba(255, 200, 0, .55) 55%); color: inherit; padding: 0 1px; }
:focus-visible { outline: 3px solid var(--brand); outline-offset: 2px; border-radius: 6px; }
[hidden] { display: none !important; }

/* ============ Shell ============ */
.topbar {
  position: fixed; inset: 0 0 auto 0; height: var(--top); z-index: 40;
  display: flex; align-items: center; gap: 14px; padding: 0 18px;
  background: color-mix(in srgb, var(--surface) 88%, transparent);
  backdrop-filter: saturate(1.4) blur(12px); border-bottom: 1px solid var(--line);
}
.brand { display: flex; align-items: center; gap: 10px; font-family: "Poppins"; font-weight: 700; white-space: nowrap; }
.brand-mark { width: 36px; height: 36px; border-radius: 11px; background: var(--brand); color: var(--brand-ink); display: grid; place-items: center; font-weight: 800; font-size: 15px; box-shadow: inset 0 -3px 0 rgba(0,0,0,.12); }
.brand-text b { font-weight: 800; }
.search { flex: 1; min-width: 0; max-width: 520px; margin-left: auto; display: flex; align-items: center; gap: 8px; background: var(--surface-2); border: 1px solid var(--line); border-radius: 999px; padding: 0 14px; height: 42px; }
.search input { border: 0; background: transparent; outline: 0; flex: 1; font: inherit; color: var(--ink); min-width: 0; width: 100%; }
.icon-btn { width: 42px; height: 42px; display: grid; place-items: center; border-radius: 12px; border: 1px solid var(--line); background: var(--surface); cursor: pointer; font-size: 18px; flex: none; }
.icon-btn:hover { background: var(--surface-2); }

.sidebar {
  position: fixed; top: var(--top); bottom: 0; left: 0; width: var(--side); z-index: 30;
  overflow-y: auto; padding: 16px 12px 40px; border-right: 1px solid var(--line); background: var(--surface);
}
.sidebar a { display: flex; align-items: center; gap: 10px; padding: 9px 12px; border-radius: 10px; font-weight: 700; color: var(--ink-2); font-size: 15px; }
.sidebar a i { font-style: normal; width: 22px; text-align: center; }
.sidebar a:hover { background: var(--surface-2); }
.sidebar a.active { background: var(--brand); color: var(--brand-ink); }
.sidebar .lvl-dot { width: 30px; height: 22px; border-radius: 7px; font: 800 11px/22px "Poppins"; text-align: center; color: #fff; flex: none; }
.sidebar .lvl-prog { margin-left: auto; font-size: 12px; color: var(--muted); font-weight: 700; }
.sidebar a.active .lvl-prog { color: var(--brand-ink); }
.nav-label { margin: 18px 12px 6px; font: 700 11px/1 "Poppins"; text-transform: uppercase; letter-spacing: .1em; color: var(--muted); }

.view { margin-left: var(--side); padding: calc(var(--top) + 28px) 36px 80px; min-height: 100vh; outline: 0; }
.view > * { max-width: 1240px; margin-left: auto; margin-right: auto; }
.tabbar, .scrim, .only-mobile { display: none; }

@media (max-width: 960px) {
  .view { margin-left: 0; padding: calc(var(--top) + 18px) 16px calc(90px + env(safe-area-inset-bottom)); }
  .only-mobile { display: grid; }
  .sidebar { transform: translateX(-102%); transition: transform .25s ease; box-shadow: var(--shadow-lg); width: 290px; }
  body.menu-open .sidebar { transform: none; }
  body.menu-open .scrim { display: block; position: fixed; inset: 0; background: rgba(0,0,0,.35); z-index: 25; }
  .tabbar {
    display: flex; position: fixed; left: 0; right: 0; bottom: 0; z-index: 35;
    background: var(--surface); border-top: 1px solid var(--line); padding: 6px 6px calc(6px + env(safe-area-inset-bottom));
  }
  .tabbar a { flex: 1; display: flex; flex-direction: column; align-items: center; font-size: 11px; font-weight: 800; color: var(--muted); padding: 4px 0; border-radius: 10px; }
  .tabbar a i { font-style: normal; font-size: 20px; line-height: 1.3; }
  .tabbar a.active { color: var(--ink); background: var(--surface-2); }
  .brand-text { display: none; }
  .topbar { padding: 0 12px; gap: 10px; }
}

/* ============ UI atoms ============ */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 44px; padding: 0 18px;
  border-radius: 12px; border: 1px solid var(--line); background: var(--surface); font-weight: 800; cursor: pointer;
  font-size: 15px; white-space: nowrap; transition: transform .08s ease, background .15s ease;
}
.btn:hover { background: var(--surface-2); }
.btn:active { transform: translateY(1px); }
.btn.primary { background: var(--brand); border-color: #e6b400; color: var(--brand-ink); box-shadow: inset 0 -3px 0 rgba(0,0,0,.12); }
.btn.primary:hover { background: var(--brand-2); }
.btn.dark { background: var(--ink); color: var(--bg); border-color: var(--ink); }
.btn.sm { min-height: 36px; padding: 0 12px; font-size: 14px; border-radius: 10px; }
.btn.on { background: var(--ink); color: var(--bg); border-color: var(--ink); }
.btn[disabled] { opacity: .45; pointer-events: none; }
.chip { display: inline-flex; align-items: center; gap: 6px; padding: 6px 12px; border-radius: 999px; border: 1px solid var(--line); background: var(--surface); font-weight: 800; font-size: 14px; cursor: pointer; white-space: nowrap; }
.chip.on { background: var(--ink); color: var(--bg); border-color: var(--ink); }
.chips { display: flex; gap: 8px; flex-wrap: wrap; }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); }
.eyebrow { font: 800 12px/1 "Poppins"; letter-spacing: .14em; text-transform: uppercase; color: var(--muted); margin: 0 0 10px; }
.lead { color: var(--muted); font-size: 17px; margin: 10px 0 0; max-width: 62ch; }
.sec-title { font-size: 22px; margin: 40px 0 16px; display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap; }
.sec-title small { font: 700 14px "Nunito"; color: var(--muted); }
.bar { height: 8px; border-radius: 99px; background: var(--line); overflow: hidden; }
.bar > span { display: block; height: 100%; border-radius: 99px; background: var(--c, var(--brand)); transition: width .4s ease; }
.crumbs { display: flex; gap: 8px; align-items: center; color: var(--muted); font-weight: 700; font-size: 14px; margin-bottom: 14px; flex-wrap: wrap; }
.crumbs a:hover { color: var(--ink); text-decoration: underline; }
.page-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 20px; flex-wrap: wrap; margin-bottom: 24px; }
.page-head h1 { font-size: clamp(26px, 4vw, 38px); }
.empty { text-align: center; padding: 50px 20px; color: var(--muted); }
.empty b { display: block; font-size: 40px; margin-bottom: 8px; }
.grid { display: grid; gap: 16px; }
.play-btn { width: 38px; height: 38px; border-radius: 50%; border: 0; background: var(--brand); color: var(--brand-ink); cursor: pointer; display: grid; place-items: center; flex: none; font-size: 14px; box-shadow: inset 0 -2px 0 rgba(0,0,0,.12); }
.play-btn.speaking { animation: pulse 1s infinite; }
@keyframes pulse { 0%,100% { box-shadow: 0 0 0 0 rgba(255,200,0,.6); } 50% { box-shadow: 0 0 0 8px rgba(255,200,0,0); } }
.mini-btn { width: 34px; height: 34px; border-radius: 10px; border: 1px solid var(--line); background: var(--surface); cursor: pointer; display: grid; place-items: center; flex: none; font-size: 15px; }
.mini-btn.on { background: var(--brand); border-color: #e6b400; }
.tag { display: inline-block; font: 800 11px/1 "Poppins"; padding: 5px 8px; border-radius: 6px; letter-spacing: .04em; text-transform: uppercase; }

/* ============ Home ============ */
.hero {
  display: grid; grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr); gap: 28px; align-items: center;
  background: radial-gradient(120% 140% at 100% 0%, #fff3bf 0%, transparent 55%), var(--surface);
  border: 1px solid var(--line); border-radius: 24px; padding: 34px; box-shadow: var(--shadow);
}
:root[data-theme="dark"] .hero { background: radial-gradient(120% 140% at 100% 0%, #3a3010 0%, transparent 55%), var(--surface); }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .hero { background: radial-gradient(120% 140% at 100% 0%, #3a3010 0%, transparent 55%), var(--surface); } }
.hero h1 { font-size: clamp(28px, 4.2vw, 44px); font-weight: 800; }
.hero-cta { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 22px; }
.hero-stats { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 20px; align-items: center; }
.ring { position: relative; width: 132px; height: 132px; }
.ring svg { transform: rotate(-90deg); }
.ring b { position: absolute; inset: 0; display: grid; place-items: center; font: 800 26px "Poppins"; }
.ring b small { display: block; font: 700 11px "Nunito"; color: var(--muted); text-align: center; margin-top: -4px; }
.stat-list { display: grid; gap: 10px; }
.stat-list div { display: flex; justify-content: space-between; gap: 12px; font-weight: 700; padding-bottom: 8px; border-bottom: 1px dashed var(--line); }
.stat-list div span { color: var(--muted); }
.stat-list div b { white-space: nowrap; }
@media (max-width: 1240px) { .hero { grid-template-columns: minmax(0, 1fr); } .hero-stats { max-width: 520px; } }
.steps { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; }
.step { padding: 16px; }
.step b { display: inline-grid; place-items: center; width: 28px; height: 28px; border-radius: 50%; background: var(--brand); color: var(--brand-ink); font: 800 14px "Poppins"; margin-bottom: 8px; }
.step h4 { font-size: 15px; margin-bottom: 4px; }
.step p { margin: 0; color: var(--muted); font-size: 14px; }
@media (max-width: 960px) { .hero { grid-template-columns: 1fr; padding: 24px; } .steps { grid-template-columns: 1fr 1fr; } }
@media (max-width: 520px) { .hero-stats { grid-template-columns: 1fr; justify-items: start; } }

.level-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
@media (max-width: 1100px) { .level-grid { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 600px) { .level-grid { grid-template-columns: 1fr; } }
.level-card { display: block; padding: 20px; position: relative; overflow: hidden; transition: transform .15s ease, box-shadow .15s ease; }
.level-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-lg); }
.level-card .lv-badge { display: inline-grid; place-items: center; width: 54px; height: 54px; border-radius: 16px; color: #fff; font: 800 20px "Poppins"; box-shadow: inset 0 -4px 0 rgba(0,0,0,.15); }
.level-card .lv-emoji { position: absolute; right: 16px; top: 12px; font-size: 44px; opacity: .9; }
.level-card h3 { margin: 14px 0 4px; font-size: 19px; }
.level-card p { margin: 0 0 14px; color: var(--muted); font-size: 14px; min-height: 42px; }
.level-card .lv-meta { display: flex; justify-content: space-between; font-weight: 800; font-size: 13px; margin-bottom: 6px; }

.bonus-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 16px; }
.bonus-card { padding: 18px; display: flex; flex-direction: column; gap: 6px; transition: transform .15s ease; }
.bonus-card:hover { transform: translateY(-2px); }
.bonus-card .b-ico { font-size: 34px; }
.bonus-card small { font: 800 11px "Poppins"; color: var(--muted); letter-spacing: .1em; text-transform: uppercase; }
.bonus-card h3 { font-size: 17px; }
.bonus-card p { margin: 0; color: var(--muted); font-size: 14px; }

/* ============ Level page ============ */
.level-hero { border-radius: 24px; padding: 28px; color: #fff; position: relative; overflow: hidden; margin-bottom: 26px; background: var(--c); }
.level-hero::after { content: attr(data-emoji); position: absolute; right: 24px; bottom: -14px; font-size: 120px; opacity: .25; }
.level-hero h1 { font-size: clamp(26px, 4vw, 40px); font-weight: 800; }
.level-hero p { max-width: 60ch; opacity: .95; margin: 8px 0 18px; }
.level-hero .bar { background: rgba(255,255,255,.3); max-width: 420px; }
.level-hero .bar span { background: #fff; }
.level-hero .actions { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 18px; position: relative; z-index: 1; }
.level-hero .btn { border-color: transparent; color: #16150f; }
.group-title { font-size: 18px; margin: 30px 0 12px; display: flex; gap: 10px; align-items: center; }
.group-title::after { content: ""; flex: 1; height: 1px; background: var(--line); }
.map-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 12px; }
.map-tile { display: flex; align-items: center; gap: 12px; padding: 12px 14px; border-radius: 14px; background: var(--surface); border: 1px solid var(--line); transition: border-color .15s, transform .15s; position: relative; }
.map-tile:hover { border-color: var(--c); transform: translateY(-1px); }
.map-tile .t-ico { width: 44px; height: 44px; border-radius: 12px; display: grid; place-items: center; font-size: 22px; background: var(--soft); flex: none; }
.map-tile .t-num { font: 800 11px "Poppins"; color: var(--c); letter-spacing: .06em; }
.map-tile .t-title { font-weight: 800; line-height: 1.25; font-size: 15px; }
.map-tile .t-done { position: absolute; top: 8px; right: 10px; font-size: 13px; }
.map-tile.done { background: color-mix(in srgb, var(--soft) 60%, var(--surface)); }

/* ============ Map page ============ */
.map-toolbar { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin-bottom: 14px; position: sticky; top: calc(var(--top) + 8px); z-index: 20; padding: 8px; background: color-mix(in srgb, var(--bg) 90%, transparent); backdrop-filter: blur(8px); border-radius: 14px; }
.map-toolbar .sp { flex: 1; }
@media (max-width: 960px) { .map-toolbar { position: static; padding: 0; background: none; backdrop-filter: none; } }
.hint { color: var(--muted); font-size: 14px; font-weight: 700; margin: 0 0 12px; }
.study-tips { margin-top: 18px; padding: 18px 20px; }
.study-tips ol { margin: 8px 0 0; padding-left: 20px; color: var(--ink-2); }
.pager { display: flex; justify-content: space-between; gap: 12px; margin-top: 18px; }
.pager a { flex: 1; padding: 14px 16px; }
.pager a small { display: block; color: var(--muted); font-weight: 800; font-size: 12px; }
.pager a b { font-family: "Poppins"; }
.pager a:last-child { text-align: right; }

/* ============ Mind-map sheet (paper) ============ */
.map-sheet {
  --c: #1f9d55;
  position: relative; background-color: var(--paper); color: var(--paper-ink);
  background-image: radial-gradient(var(--paper-dot) 1.1px, transparent 1.2px);
  background-size: 18px 18px; border-radius: 18px; padding: 26px 28px 22px;
  border: 1px solid #e8e1c9; box-shadow: 0 2px 0 #efe8d0, 0 14px 40px rgba(40, 30, 0, .10);
  -webkit-print-color-adjust: exact; print-color-adjust: exact;
}
.map-sheet::before { /* furos de caderno */
  content: ""; position: absolute; left: 30px; right: 30px; top: 9px; height: 8px;
  background: radial-gradient(circle at 4px 4px, #e3dbc0 3px, transparent 3.5px) 0 0 / 26px 8px repeat-x; opacity: .9;
}
.sheet-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; margin: 6px 0 10px; }
.sheet-title { font: 800 clamp(26px, 3.4vw, 40px)/1.05 "Baloo 2", "Poppins", sans-serif; text-transform: uppercase; letter-spacing: .01em; color: #1d1b14; }
.sheet-title .hl { background: linear-gradient(transparent 58%, color-mix(in srgb, var(--c) 30%, transparent) 58%); }
.sheet-sub { font: 700 24px/1.1 "Caveat", cursive; color: var(--c); margin-top: 2px; }
.sheet-meta { display: flex; flex-direction: column; align-items: flex-end; gap: 6px; flex: none; }
.sheet-lvl { background: var(--c); color: #fff; font: 800 12px/1 "Poppins"; padding: 7px 10px; border-radius: 8px; letter-spacing: .06em; }
.sheet-num { font: 700 13px "Poppins"; color: var(--paper-muted); }
.sheet-group { font: 700 12px "Nunito"; color: var(--paper-muted); text-transform: uppercase; letter-spacing: .08em; }

.mm { position: relative; display: grid; grid-template-columns: 1fr minmax(170px, 210px) 1fr; gap: 18px 46px; align-items: center; padding: 8px 0; }
.mm-lines { position: absolute; inset: 0; pointer-events: none; overflow: visible; }
.mm-col { display: flex; flex-direction: column; gap: 16px; position: relative; z-index: 1; }
.mm-center { position: relative; z-index: 2; display: grid; place-items: center; }
.core {
  width: 100%; aspect-ratio: 1; max-width: 210px; border-radius: 50%; display: grid; place-items: center; text-align: center; padding: 18px;
  background: #fff; border: 4px solid var(--c); box-shadow: 0 0 0 8px color-mix(in srgb, var(--c) 14%, transparent), 0 8px 24px rgba(0,0,0,.08);
}
.core .c-ico { font-size: 44px; line-height: 1; }
.core .c-t { font: 800 18px/1.1 "Baloo 2", sans-serif; margin-top: 6px; text-transform: uppercase; color: #1d1b14; }
.core .c-en { font: 700 18px/1 "Caveat", cursive; color: var(--c); margin-top: 4px; }
.node { background: var(--nb); border: 2px solid var(--nc); border-radius: 16px; padding: 12px 14px 10px; box-shadow: 3px 4px 0 color-mix(in srgb, var(--nc) 25%, transparent); }
.node h3 { display: flex; align-items: center; gap: 8px; font: 800 15px/1.2 "Poppins"; color: #1d1b14; margin: 0 0 6px; }
.node h3 .num { width: 24px; height: 24px; border-radius: 50%; background: var(--nc); color: #fff; display: grid; place-items: center; font-size: 12px; flex: none; }
.node ul { list-style: none; margin: 0; padding: 0; display: grid; gap: 3px; }
.it { padding: 4px 6px 4px 22px; border-radius: 8px; position: relative; font-size: 14.5px; line-height: 1.35; }
.it::before { content: "•"; position: absolute; left: 8px; top: 4px; color: var(--nc); font-weight: 900; }
.it .en { font-weight: 800; color: #1d1b14; }
.it .pt { display: block; color: var(--paper-muted); font-size: 13px; font-weight: 600; }
.it.note { color: #4a4636; font-style: italic; font-size: 13.5px; }
.it.say { cursor: pointer; }
.it.say::before { content: "🔈"; font-size: 10px; left: 4px; top: 7px; opacity: .55; }
.it.say:hover { background: rgba(255,255,255,.75); }
.it.say:hover .en { text-decoration: underline dotted 2px; text-underline-offset: 3px; text-decoration-color: var(--nc); }
.it.speaking { background: #fff; box-shadow: 0 0 0 2px var(--nc); }
.it.speaking::before { opacity: 1; }
.sheet-tip { margin-top: 16px; display: flex; gap: 10px; align-items: flex-start; background: #fff4b8; border: 2px dashed #e5c330; border-radius: 12px; padding: 10px 14px; font-size: 14.5px; color: #3a3315; transform: rotate(-.3deg); }
.sheet-tip b { font-family: "Poppins"; white-space: nowrap; }
.sheet-foot { display: flex; justify-content: space-between; margin-top: 10px; font: 700 11px "Poppins"; color: #a39e88; letter-spacing: .06em; text-transform: uppercase; }

/* recall mode */
.recall .it.say:not(.revealed) .en { filter: blur(7px); user-select: none; }
.recall .it.say:not(.revealed)::after { content: "toca para revelar"; position: absolute; left: 22px; top: 5px; font: 700 11px "Nunito"; color: var(--nc); opacity: .9; }
.recall .it.say:not(.revealed) .pt { color: #1d1b14; font-weight: 700; padding-top: 16px; }

/* narrow sheet (mobile) */
.map-sheet.narrow { padding: 20px 14px 16px; border-radius: 14px; }
.map-sheet.narrow .sheet-head { flex-direction: column-reverse; gap: 8px; }
.map-sheet.narrow .sheet-meta { flex-direction: row; align-items: center; }
.map-sheet.narrow .mm { grid-template-columns: 1fr; gap: 14px; padding-left: 14px; }
.map-sheet.narrow .mm::before { content: ""; position: absolute; left: 3px; top: 60px; bottom: 10px; width: 4px; border-radius: 4px; background: color-mix(in srgb, var(--c) 35%, transparent); }
.map-sheet.narrow .mm-lines { display: none; }
.map-sheet.narrow .mm-center { order: -1; justify-items: start; margin-left: -14px; }
.map-sheet.narrow .core { aspect-ratio: auto; max-width: none; border-radius: 16px; display: flex; gap: 12px; text-align: left; padding: 12px 16px; }
.map-sheet.narrow .core .c-ico { font-size: 34px; }
.map-sheet.narrow .core .c-t { margin-top: 0; }
.map-sheet.narrow .mm-col { display: contents; }
.map-sheet.narrow .node { position: relative; }
.map-sheet.narrow .node::before { content: ""; position: absolute; left: -13px; top: 22px; width: 11px; height: 4px; background: var(--nc); border-radius: 2px; }

/* ============ Lists (frases, phrasal, gírias) ============ */
.toolbar { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; margin-bottom: 16px; }
.toolbar .grow { flex: 1; }
.filter-input { height: 42px; border-radius: 12px; border: 1px solid var(--line); background: var(--surface); padding: 0 14px; font: inherit; color: var(--ink); min-width: 220px; }
.cat-scroll { display: flex; gap: 8px; overflow-x: auto; padding-bottom: 6px; margin-bottom: 14px; scrollbar-width: thin; }
.rows { display: grid; gap: 8px; }
.row { display: flex; align-items: center; gap: 12px; padding: 12px 14px; background: var(--surface); border: 1px solid var(--line); border-radius: 14px; }
.row .txt { flex: 1; min-width: 0; }
.row .txt b { display: block; font-size: 16px; }
.row .txt span { color: var(--muted); font-size: 14.5px; }
.row .acts { display: flex; gap: 6px; }
.row.known { background: color-mix(in srgb, var(--ok) 7%, var(--surface)); border-color: color-mix(in srgb, var(--ok) 30%, var(--line)); }
.row .heard { display: block; font-size: 13px; font-weight: 700; margin-top: 4px; }
.row .heard.good { color: var(--ok); } .row .heard.meh { color: #b7791f; } .row .heard.badx { color: var(--bad); }
.cat-head { font-size: 16px; margin: 22px 0 10px; display: flex; gap: 8px; align-items: center; }
.cat-head small { color: var(--muted); font: 700 13px "Nunito"; }

.pv-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(290px, 1fr)); gap: 12px; }
.pv-card { padding: 16px; display: flex; flex-direction: column; gap: 6px; }
.pv-card .pv-top { display: flex; justify-content: space-between; align-items: center; gap: 10px; }
.pv-card h3 { font-size: 19px; }
.pv-card .m { font-weight: 800; color: var(--ink-2); }
.pv-card .ex { background: var(--surface-2); border-radius: 10px; padding: 8px 10px; font-size: 14.5px; cursor: pointer; }
.pv-card .ex i { display: block; color: var(--muted); font-style: normal; font-size: 13.5px; }
.pv-card.known { border-color: color-mix(in srgb, var(--ok) 40%, var(--line)); }

.flash-wrap { max-width: 560px; margin: 10px auto 0; text-align: center; }
.flash { perspective: 1200px; height: 300px; cursor: pointer; margin-bottom: 16px; }
.flash-in { position: relative; width: 100%; height: 100%; transition: transform .5s; transform-style: preserve-3d; }
.flash.flip .flash-in { transform: rotateY(180deg); }
.flash-face { position: absolute; inset: 0; backface-visibility: hidden; border-radius: 22px; display: flex; flex-direction: column; justify-content: center; align-items: center; padding: 24px; gap: 10px; box-shadow: var(--shadow-lg); }
.flash-front { background: var(--brand); color: var(--brand-ink); }
.flash-front h2 { font-size: 40px; font-weight: 800; }
.flash-back { background: var(--surface); border: 1px solid var(--line); transform: rotateY(180deg); }
.flash-back h3 { font-size: 22px; }
.flash-back p { margin: 0; }
.flash-back .muted { color: var(--muted); }
.flash-ctrl { display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; }

/* ============ Library ============ */
.book-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 18px; }
.book { display: flex; flex-direction: column; gap: 8px; }
.cover { aspect-ratio: 3 / 4; border-radius: 6px 14px 14px 6px; position: relative; overflow: hidden; padding: 14px; display: flex; flex-direction: column; justify-content: space-between; color: #fff; box-shadow: inset 6px 0 0 rgba(0,0,0,.15), 0 10px 22px rgba(0,0,0,.15); transition: transform .15s; }
.book:hover .cover { transform: translateY(-3px) rotate(-.6deg); }
.cover .cv-lvl { align-self: flex-start; background: rgba(255,255,255,.92); color: #111; font: 800 11px "Poppins"; padding: 4px 7px; border-radius: 6px; }
.cover .cv-ico { font-size: 52px; text-align: center; filter: drop-shadow(0 4px 6px rgba(0,0,0,.2)); }
.cover .cv-t { font: 800 17px/1.15 "Baloo 2", sans-serif; text-shadow: 0 1px 2px rgba(0,0,0,.25); }
.cover .cv-done { position: absolute; top: 10px; right: 10px; background: #fff; border-radius: 50%; width: 26px; height: 26px; display: grid; place-items: center; font-size: 13px; }
.book .b-meta { font-size: 13px; color: var(--muted); font-weight: 700; }
.book .b-pt { font-weight: 800; font-size: 14.5px; line-height: 1.25; }

.reader { max-width: 760px; margin: 0 auto; }
.reader-head { display: grid; grid-template-columns: 150px 1fr; gap: 22px; align-items: center; margin-bottom: 20px; }
.reader-head .cover { width: 150px; }
.reader-head h1 { font-size: clamp(24px, 3.6vw, 34px); }
.player { position: sticky; top: calc(var(--top) + 8px); z-index: 20; display: flex; gap: 10px; align-items: center; flex-wrap: wrap; padding: 10px 12px; margin-bottom: 20px; }
.player .prog { flex: 1; min-width: 120px; }
.story { font-size: 19px; line-height: 1.8; }
.story p { margin: 0 0 18px; }
.sent { cursor: pointer; border-radius: 6px; padding: 1px 2px; transition: background .2s; }
.sent:hover { background: color-mix(in srgb, var(--brand) 22%, transparent); }
.sent.cur { background: var(--brand); color: var(--brand-ink); }
.sent .tr { display: none; font-size: 15px; color: var(--muted); font-style: italic; }
.show-tr .sent .tr { display: block; margin: 0 0 6px; line-height: 1.5; }
.show-tr .sent { display: block; }
.show-tr .sent.cur .tr { color: #4a3d00; }
.gloss { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 8px; }
.gloss div { padding: 10px 12px; border-radius: 12px; background: var(--surface); border: 1px solid var(--line); cursor: pointer; }
.gloss div b { display: block; }
.gloss div span { color: var(--muted); font-size: 14px; }
@media (max-width: 600px) { .reader-head { grid-template-columns: 96px 1fr; gap: 14px; } .reader-head .cover { width: 96px; padding: 8px; } .reader-head .cover .cv-t { font-size: 11px; } .reader-head .cover .cv-ico { font-size: 30px; } .story { font-size: 17px; } }

/* ============ Rota ============ */
.today { padding: 22px; border: 2px solid var(--brand); }
.today h2 { font-size: 22px; margin-bottom: 4px; }
.task { display: flex; gap: 12px; align-items: flex-start; padding: 12px 0; border-bottom: 1px dashed var(--line); }
.task:last-child { border-bottom: 0; }
.task .tk-ico { width: 40px; height: 40px; border-radius: 12px; background: var(--surface-2); display: grid; place-items: center; font-size: 20px; flex: none; }
.task .tk-body { flex: 1; min-width: 0; }
.task .tk-body small { color: var(--muted); font-weight: 800; font-size: 12px; text-transform: uppercase; letter-spacing: .06em; }
.task .tk-body b { display: block; }
.task .tk-list { display: grid; gap: 4px; margin-top: 6px; }
.task .tk-list div { display: flex; gap: 8px; align-items: center; cursor: pointer; font-size: 15px; }
.task .tk-list div span { color: var(--muted); }
.check { width: 26px; height: 26px; border-radius: 8px; border: 2px solid var(--line); display: grid; place-items: center; cursor: pointer; background: var(--surface); flex: none; font-size: 14px; }
.check.on { background: var(--ok); border-color: var(--ok); color: #fff; }
.days { display: grid; grid-template-columns: repeat(auto-fill, minmax(46px, 1fr)); gap: 6px; }
.day { aspect-ratio: 1; border-radius: 10px; border: 1px solid var(--line); background: var(--surface); display: grid; place-items: center; font: 800 13px "Poppins"; cursor: pointer; position: relative; }
.day.done { background: var(--ok); color: #fff; border-color: var(--ok); }
.day.cur { outline: 3px solid var(--brand); outline-offset: 1px; }
.day.sel { background: var(--ink); color: var(--bg); }
.day .lv { position: absolute; bottom: 2px; font-size: 8px; opacity: .7; }

/* ============ Settings ============ */
.set-list { display: grid; gap: 14px; max-width: 760px; }
.set { padding: 18px 20px; display: flex; justify-content: space-between; gap: 16px; align-items: center; flex-wrap: wrap; }
.set h3 { font-size: 16px; }
.set p { margin: 4px 0 0; color: var(--muted); font-size: 14px; }
.set select, .set textarea { font: inherit; color: var(--ink); background: var(--surface-2); border: 1px solid var(--line); border-radius: 10px; padding: 8px 10px; max-width: 100%; }
.set textarea { width: 100%; min-height: 90px; font-size: 12px; font-family: ui-monospace, monospace; }

/* ============ Search ============ */
.res-sec { margin-bottom: 26px; }
.res-sec h2 { font-size: 18px; margin-bottom: 10px; }
.res-item { display: block; padding: 12px 14px; border-radius: 12px; background: var(--surface); border: 1px solid var(--line); margin-bottom: 8px; }
.res-item small { color: var(--muted); font-weight: 700; }

/* ============ Modal / quiz ============ */
.modal { position: fixed; inset: 0; z-index: 100; background: rgba(10, 10, 6, .55); display: grid; place-items: center; padding: 16px; animation: fade .15s ease; }
@keyframes fade { from { opacity: 0; } }
.modal-box { background: var(--surface); border-radius: 22px; width: min(620px, 100%); max-height: calc(100vh - 32px); overflow: auto; padding: 26px; box-shadow: var(--shadow-lg); position: relative; }
.modal-x { position: absolute; top: 14px; right: 14px; }
.q-prog { display: flex; justify-content: space-between; font-weight: 800; color: var(--muted); font-size: 13px; margin-bottom: 8px; }
.q-ask { font: 700 13px "Poppins"; color: var(--muted); text-transform: uppercase; letter-spacing: .08em; margin: 18px 0 6px; }
.q-text { font: 800 24px/1.25 "Poppins"; margin-bottom: 18px; }
.q-opts { display: grid; gap: 10px; }
.q-opt { text-align: left; padding: 14px 16px; border-radius: 14px; border: 2px solid var(--line); background: var(--surface); cursor: pointer; font-weight: 700; font-size: 16px; }
.q-opt:hover { border-color: var(--ink-2); }
.q-opt.right { border-color: var(--ok); background: color-mix(in srgb, var(--ok) 12%, var(--surface)); }
.q-opt.wrong { border-color: var(--bad); background: color-mix(in srgb, var(--bad) 10%, var(--surface)); }
.q-foot { display: flex; justify-content: flex-end; margin-top: 18px; }
.q-end { text-align: center; }
.q-end .big { font: 800 56px "Poppins"; }

.toast { position: fixed; left: 50%; bottom: 28px; transform: translate(-50%, 30px); opacity: 0; pointer-events: none; z-index: 200; background: var(--ink); color: var(--bg); padding: 12px 18px; border-radius: 12px; font-weight: 800; transition: .25s ease; max-width: calc(100% - 32px); text-align: center; }
.toast.show { opacity: 1; transform: translate(-50%, 0); }
@media (max-width: 960px) { .toast { bottom: 96px; } }

/* ============ Print ============ */
#printstage .map-sheet { padding: 18px 22px 14px; border-radius: 12px; }
#printstage .sheet-head { margin: 4px 0 6px; }
#printstage .sheet-title { font-size: 34px; }
#printstage .sheet-sub { font-size: 21px; }
#printstage .mm { grid-template-columns: 1fr 190px 1fr; gap: 10px 40px; padding: 2px 0; }
#printstage .mm-col { gap: 10px; }
#printstage .node { padding: 8px 12px 7px; border-radius: 12px; box-shadow: none; }
#printstage .node h3 { font-size: 14.5px; margin-bottom: 3px; }
#printstage .node ul { gap: 0; }
#printstage .it { padding: 2px 4px 2px 18px; font-size: 14px; line-height: 1.3; }
#printstage .it::before { left: 6px; top: 2px; }
#printstage .it .pt { font-size: 12.5px; }
#printstage .it.note { font-size: 13px; }
#printstage .core { max-width: 190px; padding: 14px; }
#printstage .core .c-ico { font-size: 38px; }
#printstage .sheet-tip { margin-top: 10px; padding: 7px 12px; font-size: 13.5px; }
#printstage .sheet-foot { margin-top: 6px; }
@media screen { #printstage { position: absolute; left: -20000px; top: 0; width: 1040px; } }
@page { size: A4 landscape; margin: 8mm; }
@page portrait { size: A4 portrait; margin: 8mm; }
@media print {
  body { background: #fff; }
  .app, #modal, #toast { display: none !important; }
  #printstage { position: static; width: auto; }
  #printstage .map-sheet { width: 1040px; box-shadow: none; border: 1px solid #e8e1c9; margin: 0; break-after: page; page-break-after: always; break-inside: avoid; }
  #printstage .map-sheet:last-child { break-after: auto; page-break-after: auto; }
  .it.say::before { content: "•"; font-size: inherit; opacity: 1; left: 6px; top: 2px; }
}
