
:root{
  --bg:#f4f6f8; --panel:#ffffff; --ink:#111827; --muted:#667085; --line:#e4e7ec;
  --accent:#111827; --soft:#eef1f4; --success:#087a55; --success-bg:#e8f7f0;
  --warn:#9a6700; --warn-bg:#fff7dc; --danger:#b42318; --danger-bg:#fff0ee;
  --radius:20px; --shadow:0 18px 45px rgba(16,24,40,.08);
}
*{box-sizing:border-box}
body{margin:0;font-family:Inter, ui-sans-serif,system-ui,-apple-system,BlinkMacSystemFont,"Segoe UI",sans-serif;background:var(--bg);color:var(--ink)}
button,input,textarea{font:inherit}
button{cursor:pointer}
.app-shell{display:grid;grid-template-columns:248px 1fr;min-height:100vh}
.sidebar{background:#0d1117;color:white;padding:26px 18px;display:flex;flex-direction:column;gap:28px;position:sticky;top:0;height:100vh}
.brand{display:flex;gap:12px;align-items:center;padding:0 8px}
.brand-mark{width:42px;height:42px;border-radius:14px;background:white;color:#111;display:grid;place-items:center;font-weight:900;letter-spacing:-1px}
.brand strong,.brand span{display:block}.brand span{font-size:12px;color:#98a2b3;margin-top:2px}
nav{display:grid;gap:8px}
.nav-btn{border:0;background:transparent;color:#aeb8c6;padding:12px 14px;border-radius:12px;text-align:left;font-weight:700;display:flex;gap:10px;align-items:center}
.nav-btn:hover,.nav-btn.active{background:#1b2330;color:white}
.sidebar-card{margin-top:auto;background:#161d27;border:1px solid #273140;border-radius:18px;padding:16px;display:grid;gap:8px}
.sidebar-card small,.sidebar-card span{color:#98a2b3;font-size:12px}
.mini-progress{height:7px;border-radius:10px;background:#2b3645;overflow:hidden}.mini-progress i{display:block;height:100%;width:0;background:white;border-radius:10px;transition:.3s}
main{padding:34px 42px 60px;min-width:0}
.topbar{display:flex;justify-content:space-between;gap:16px;align-items:center;margin-bottom:28px}
.eyebrow{font-size:11px;font-weight:900;letter-spacing:.14em;color:#7a8493}
h1{font-size:30px;margin:5px 0 0;letter-spacing:-.04em}
.top-actions{display:flex;align-items:center;gap:10px}
.streak{display:flex;align-items:center;gap:6px;background:white;border:1px solid var(--line);padding:9px 12px;border-radius:14px}.streak span{font-size:12px;color:var(--muted)}
.icon-btn{width:42px;height:42px;border-radius:14px;border:1px solid var(--line);background:white}
.grid{display:grid;grid-template-columns:repeat(12,1fr);gap:18px}
.hero{grid-column:span 8;background:linear-gradient(135deg,#111827,#263346);color:white;border-radius:28px;padding:30px;min-height:270px;position:relative;overflow:hidden}
.hero:after{content:"";position:absolute;width:220px;height:220px;border:35px solid rgba(255,255,255,.08);border-radius:50%;right:-45px;top:-70px}
.hero h2{font-size:34px;line-height:1.05;max-width:520px;margin:16px 0 12px;letter-spacing:-.04em}
.hero p{color:#c8d0db;max-width:560px;line-height:1.6}
.badge{display:inline-flex;padding:7px 10px;border-radius:99px;background:rgba(255,255,255,.12);font-size:12px;font-weight:800}
.primary,.secondary,.ghost,.choice{border:0;border-radius:13px;padding:12px 16px;font-weight:800}
.primary{background:#111827;color:white}.hero .primary{background:white;color:#111827;margin-top:10px}
.secondary{background:var(--soft);color:#111827}.ghost{background:transparent;border:1px solid var(--line)}
.stat-card{grid-column:span 4;background:white;border:1px solid var(--line);border-radius:24px;padding:22px;display:flex;flex-direction:column;justify-content:space-between}
.stat-number{font-size:42px;font-weight:900;letter-spacing:-.06em}.stat-label{color:var(--muted)}
.section-head{display:flex;justify-content:space-between;align-items:end;margin:30px 0 14px}.section-head h2{margin:0;font-size:20px}.section-head p{margin:4px 0 0;color:var(--muted);font-size:13px}
.story-grid{display:grid;grid-template-columns:repeat(auto-fit,minmax(240px,1fr));gap:14px}
.story-card{background:white;border:1px solid var(--line);border-radius:20px;padding:18px;transition:.2s;display:grid;gap:12px}
.story-card:hover{transform:translateY(-2px);box-shadow:var(--shadow)}
.story-top{display:flex;justify-content:space-between;gap:8px}.story-index{width:36px;height:36px;border-radius:12px;background:#111827;color:white;display:grid;place-items:center;font-weight:900}
.story-card h3{margin:0;font-size:18px}.story-card p{margin:0;color:var(--muted);font-size:13px;min-height:38px}
.pill{font-size:11px;background:#f2f4f7;border-radius:20px;padding:6px 9px;color:#475467;height:max-content}
.card-footer{display:flex;justify-content:space-between;align-items:center}.done{color:var(--success);font-size:12px;font-weight:800}
.lesson-shell{max-width:980px;margin:auto}
.lesson-head{background:white;border:1px solid var(--line);border-radius:22px;padding:18px 20px;margin-bottom:14px}
.lesson-head-row{display:flex;justify-content:space-between;gap:16px;align-items:center}
.stepper{display:flex;gap:6px;margin-top:14px;overflow:auto;padding-bottom:2px}.step-dot{height:8px;min-width:34px;flex:1;background:#e5e7eb;border-radius:20px}.step-dot.active{background:#111827}.step-dot.done{background:#5e6a78}
.lesson-card{background:white;border:1px solid var(--line);border-radius:24px;padding:26px}
.story-reading{display:grid;gap:13px;margin:20px 0}.story-line{font-size:20px;line-height:1.55;padding:13px 15px;background:#f8fafc;border-radius:14px}
.story-line button{float:right;border:0;background:#e8edf2;border-radius:10px;width:36px;height:36px}
.task-title{font-size:24px;letter-spacing:-.03em;margin:0}.task-sub{color:var(--muted);line-height:1.55}
.prompt-card{background:#f8fafc;border:1px solid #edf0f3;border-radius:18px;padding:20px;margin:18px 0}
.prompt-card .en{font-size:21px;font-weight:800;line-height:1.45}.prompt-card .pt{font-size:18px;line-height:1.45}
textarea,input[type=text]{width:100%;border:1px solid #d0d5dd;background:white;border-radius:14px;padding:14px;outline:none;transition:.2s}
textarea{min-height:100px;resize:vertical}textarea:focus,input[type=text]:focus{border-color:#667085;box-shadow:0 0 0 3px #f0f2f5}
.action-row{display:flex;gap:10px;flex-wrap:wrap;margin-top:14px}
.feedback{margin-top:14px;padding:15px 16px;border-radius:14px;font-size:14px;line-height:1.55}.feedback.ok{background:var(--success-bg);color:#066344}.feedback.warn{background:var(--warn-bg);color:#7a5200}.feedback.bad{background:var(--danger-bg);color:#8f1f17}
.diff{font-family:ui-monospace,SFMono-Regular,Menlo,monospace;background:white;border:1px solid rgba(0,0,0,.08);padding:9px;border-radius:10px;margin-top:8px;color:#111}
.lesson-nav{display:flex;justify-content:space-between;gap:12px;margin-top:18px}
.grammar-block{border:1px solid var(--line);border-radius:18px;padding:18px;margin-top:14px}.pattern{font-family:ui-monospace,SFMono-Regular,Menlo,monospace;background:#111827;color:white;border-radius:12px;padding:11px 13px;display:inline-block;font-weight:800}
.components{display:flex;gap:8px;flex-wrap:wrap;margin:12px 0}.component{padding:9px 10px;background:#f7f8fa;border-radius:10px;border:1px solid #eaecf0}.component b{display:block}.component small{color:var(--muted)}
.review-card{background:white;border:1px solid var(--line);border-radius:22px;padding:22px;max-width:760px;margin:auto}
.review-q{font-size:24px;font-weight:900;line-height:1.35}
.choice-grid{display:grid;gap:10px;margin-top:18px}.choice{text-align:left;background:#f6f7f9;border:1px solid #e6e8ec}.choice:hover{background:#eef1f4}
.rating-row{display:grid;grid-template-columns:repeat(3,1fr);gap:10px;margin-top:16px}.rating{border:1px solid var(--line);padding:13px;border-radius:14px;background:white;font-weight:800}
.rating.hard{background:#fff2f0}.rating.medium{background:#fff8e7}.rating.easy{background:#ecf9f2}
.kpi-grid{display:grid;grid-template-columns:repeat(4,1fr);gap:12px}.kpi{background:white;border:1px solid var(--line);border-radius:18px;padding:18px}.kpi b{font-size:27px;display:block}.kpi span{font-size:12px;color:var(--muted)}
.progress-list{display:grid;gap:10px;margin-top:18px}.progress-row{background:white;border:1px solid var(--line);border-radius:16px;padding:14px;display:grid;grid-template-columns:55px 1fr auto;gap:12px;align-items:center}.bar{height:8px;background:#eef0f3;border-radius:20px;overflow:hidden}.bar i{display:block;height:100%;background:#111827}
.empty{background:white;border:1px dashed #cfd4dc;border-radius:20px;padding:36px;text-align:center;color:var(--muted)}
.toast{position:fixed;right:24px;bottom:24px;background:#111827;color:white;padding:12px 16px;border-radius:12px;box-shadow:var(--shadow);opacity:0;transform:translateY(10px);pointer-events:none;transition:.25s;z-index:30}.toast.show{opacity:1;transform:none}
.modal{position:fixed;inset:0;background:rgba(0,0,0,.45);display:grid;place-items:center;padding:20px;z-index:40}.modal.hidden{display:none}.modal-card{background:white;border-radius:22px;padding:24px;max-width:600px;width:100%;max-height:88vh;overflow:auto;position:relative}.close-modal{position:absolute;right:15px;top:12px;border:0;background:#f1f3f5;border-radius:50%;width:34px;height:34px;font-size:20px}
.mic-panel{padding:16px;border-radius:16px;background:#f8fafc;border:1px solid var(--line);margin:14px 0}.mic-status{font-size:13px;color:var(--muted)}
@media(max-width:900px){.app-shell{grid-template-columns:1fr}.sidebar{position:fixed;z-index:20;bottom:0;top:auto;height:auto;width:100%;padding:8px 10px}.brand,.sidebar-card{display:none}nav{grid-template-columns:repeat(4,1fr)}.nav-btn{justify-content:center}.nav-btn span{display:none}main{padding:24px 16px 92px}.hero,.stat-card{grid-column:span 12}.kpi-grid{grid-template-columns:repeat(2,1fr)}}

.deep-grammar{padding:24px;margin-top:20px}
.grammar-example{font-size:24px;margin:16px 0 12px;letter-spacing:-.02em}
.teacher-note{margin:18px 0;background:#f5f7fa;border-left:4px solid #111827;border-radius:12px;padding:14px 16px}
.teacher-note p,.rule-box p{margin:7px 0 0;line-height:1.65;color:#344054}
.deep-grammar h4{font-size:17px;margin:22px 0 10px}
.component-explanations{display:grid;gap:10px}
.component-detail{display:grid;grid-template-columns:120px 170px 1fr;gap:12px;align-items:start;border:1px solid #e6e9ee;background:white;border-radius:14px;padding:14px}
.component-word{font-size:17px;font-weight:900;background:#111827;color:white;border-radius:9px;padding:8px 10px;text-align:center}
.component-role{font-size:12px;font-weight:800;color:#475467;background:#f1f3f6;border-radius:9px;padding:9px}
.component-detail p{margin:1px 0 0;line-height:1.55;color:#344054}
.rule-box{margin:16px 0;background:#fff8df;border:1px solid #f0df9a;border-radius:14px;padding:15px 16px}
.variation-box{margin:16px 0;background:#f0f7ff;border:1px solid #d7e8fb;border-radius:14px;padding:15px 16px}
.variation-list{display:grid;gap:7px;margin-top:9px;line-height:1.45}
@media(max-width:760px){
 .component-detail{grid-template-columns:1fr}
 .component-word{text-align:left;width:max-content}
 .grammar-example{font-size:21px}
}

.study-sentence{margin:16px 0 12px;border:1px solid #e4e7ec;border-radius:16px;overflow:hidden}
.sentence-en{font-size:23px;font-weight:900;padding:16px 18px 7px;background:white}
.sentence-pt{font-size:15px;color:#667085;padding:0 18px 16px;background:white}
.variation-list{margin-top:12px}
.variation-item{background:white;border:1px solid #d9e7f6;border-radius:12px;padding:12px 14px}
.variation-en{font-size:17px;font-weight:800;color:#101828}
.variation-pt{font-size:14px;color:#667085;margin-top:4px}
.review-context{margin-top:10px;padding-top:10px;border-top:1px solid rgba(0,0,0,.08);line-height:1.55}
.daily-goals{display:grid;gap:12px;margin-top:14px}
.daily-goal{display:flex;gap:11px;align-items:center;background:#f7f8fa;border-radius:14px;padding:12px}
.daily-goal>span{font-size:22px;font-weight:900}
.daily-goal b,.daily-goal small{display:block}
.daily-goal small{color:#667085;margin-top:2px}
.choice.review-option{line-height:1.45}

.story-practice-option,.review-option{
  padding:15px 16px;
  font-size:16px;
  line-height:1.45;
  border:1px solid #dfe3e8;
  background:#fff;
  transition:.15s;
}
.story-practice-option:hover,.review-option:hover{background:#f2f5f8;border-color:#aeb7c2}
.choice-correct{background:#e8f7f0!important;border-color:#6fc29d!important;color:#075e42!important}
.choice-wrong{background:#fff0ee!important;border-color:#e59b94!important;color:#8f1f17!important}
.story-practice-option:disabled,.review-option:disabled{cursor:default;opacity:1}

.review-composition{
  margin-top:9px;
  color:#667085;
  font-size:12px;
  font-weight:800;
  letter-spacing:.02em;
}

.review-card .review-context{
  font-size:13px;
  color:#475467;
  padding-top:8px;
  margin-top:8px;
}
.review-card .feedback .diff{
  font-size:14px;
  line-height:1.4;
}

.mistake-note{
  margin:9px 0 10px;
  padding:10px 12px;
  background:rgba(255,255,255,.72);
  border-radius:10px;
  line-height:1.45;
  font-size:14px;
  color:#7a271a;
}
.feedback.ok .mistake-note{color:#075e42}

.why-box{
  margin-top:10px;
  padding:11px 12px;
  background:rgba(255,255,255,.82);
  border:1px solid rgba(0,0,0,.06);
  border-radius:10px;
  line-height:1.5;
  font-size:14px;
  color:#344054;
}
.feedback.bad .why-box,.feedback.warn .why-box{color:#5f3310}
.feedback.ok .why-box{color:#075e42}

.feedback-step{
  margin-top:12px;
}
.feedback-label{
  display:block;
  font-size:12px;
  font-weight:900;
  text-transform:uppercase;
  letter-spacing:.04em;
  margin-bottom:6px;
  color:#475467;
}
.sentence-review{
  padding:13px 14px;
  border-radius:11px;
  background:#fff;
  border:1px solid rgba(0,0,0,.08);
  font-family:ui-monospace,SFMono-Regular,Menlo,monospace;
  font-size:15px;
  line-height:1.5;
}
.token-wrong{
  background:#ffd9d5;
  color:#9b1c13;
  border:2px solid #d92d20;
  border-radius:6px;
  padding:1px 4px;
  font-weight:900;
  text-decoration:line-through;
}
.token-right{
  background:#d9f6e8;
  color:#067647;
  border:2px solid #12b76a;
  border-radius:6px;
  padding:1px 4px;
  font-weight:900;
}
.feedback-variants{
  display:grid;
  gap:8px;
}
.feedback-variant{
  background:#fff;
  border:1px solid rgba(0,0,0,.08);
  border-radius:10px;
  padding:10px 12px;
  display:grid;
  gap:2px;
}
.feedback-variant b{
  font-size:14px;
}
.feedback-variant span{
  font-size:13px;
  color:#475467;
}
.feedback-variant small{
  font-size:12px;
  color:#667085;
}

.ready-block-banner{margin-top:10px;padding:10px 12px;border-radius:12px;background:#111827;color:#fff;font-size:12px;font-weight:900;letter-spacing:.04em}
.chunk-box{border:1px solid #cfd8e3;background:#f8fbff;border-radius:14px;padding:14px 15px}.chunk-box>b{display:block;font-size:17px;color:#101828}.chunk-box>span{display:block;margin-top:3px;color:#475467;font-size:13px}.chunk-box>p{margin:10px 0 0;line-height:1.55;color:#344054}.ready-transfer{margin-top:14px}
.whole-wrong{display:block;background:#ffd9d5;color:#9b1c13;border:2px solid #d92d20;border-radius:7px;padding:4px 7px;font-weight:900}.whole-right{display:block;background:#d9f6e8;color:#067647;border:2px solid #12b76a;border-radius:7px;padding:4px 7px;font-weight:900}

/* PWA */
.install-btn{border:1px solid var(--line);background:white;color:var(--ink);padding:10px 13px;border-radius:14px;font-weight:800;white-space:nowrap}
.install-btn:hover{background:#f8fafc}
.pwa-hidden{display:none!important}
@media(max-width:700px){.install-btn{font-size:0;padding:10px 12px}.install-btn::first-letter{font-size:18px}}
@media(display-mode:standalone){body{overscroll-behavior-y:none}}
