:root{
  --navy:#0e3a5d; --navy2:#155080; --gold:#f5c451; --bg:#f4f6f9; --card:#ffffff;
  --ink:#1d2733; --muted:#6b7a8a; --ok:#1e9e5a; --bad:#d64545; --line:#e3e9f0;
}
*{box-sizing:border-box; margin:0; padding:0; -webkit-tap-highlight-color:transparent}
html{font-size:16px}
body{font-family:"Segoe UI",Tahoma,Arial,sans-serif; background:var(--bg); color:var(--ink);
  padding-bottom:64px; line-height:1.7}
#app-header{display:flex; align-items:center; gap:10px; background:linear-gradient(135deg,var(--navy),var(--navy2));
  color:#fff; padding:12px 14px; position:sticky; top:0; z-index:10; box-shadow:0 2px 8px rgba(0,0,0,.2)}
.logo{width:46px; height:46px; border-radius:12px; background:var(--navy); border:2px solid var(--gold);
  color:var(--gold); font-family:Georgia,serif; font-style:italic; font-weight:bold; font-size:24px;
  display:flex; align-items:center; justify-content:center; flex-shrink:0}
.brand h1{font-size:1.05rem; letter-spacing:.5px}
.brand p{font-size:.72rem; color:#cfe0ef}
#streak-badge{margin-inline-start:auto; background:rgba(255,255,255,.14); border-radius:20px;
  padding:4px 12px; font-size:.9rem; font-weight:bold}
main{padding:14px}
.loading{text-align:center; color:var(--muted); padding:40px}

/* tabs */
#tabbar{position:fixed; bottom:0; left:0; right:0; display:flex; background:#fff;
  border-top:1px solid var(--line); z-index:10}
.tab{flex:1; padding:8px 0 6px; background:none; border:none; font-size:1.15rem; color:var(--muted);
  display:flex; flex-direction:column; align-items:center; gap:1px; cursor:pointer}
.tab span{font-size:.68rem}
.tab.active{color:var(--navy); font-weight:bold; border-top:3px solid var(--gold); padding-top:5px}

/* cards & buttons */
.card{background:var(--card); border-radius:14px; padding:14px; margin-bottom:12px;
  box-shadow:0 1px 4px rgba(20,40,60,.08)}
.btn{display:block; width:100%; padding:13px; border:none; border-radius:12px; font-size:1rem;
  font-weight:bold; cursor:pointer; margin-top:10px; font-family:inherit}
.btn-primary{background:var(--navy); color:#fff}
.btn-gold{background:var(--gold); color:#3a2c00}
.btn-ghost{background:#eef3f8; color:var(--navy)}
.btn:disabled{opacity:.45; cursor:default}
.play-btn{background:#eef3f8; border:none; border-radius:50%; width:38px; height:38px; font-size:1rem;
  cursor:pointer; flex-shrink:0; color:var(--navy)}
.play-btn:active{background:var(--gold)}
.play-all{background:var(--navy2); color:#fff; border:none; border-radius:10px; padding:8px 14px;
  font-size:.85rem; cursor:pointer; font-family:inherit}

/* level + week map */
.level-band{background:linear-gradient(135deg,var(--navy),var(--navy2)); color:#fff; border-radius:14px;
  padding:12px 14px; margin:14px 0 8px; display:flex; justify-content:space-between; align-items:center}
.level-band .lvl{font-size:1.3rem; font-weight:bold; color:var(--gold)}
.level-band .nm{font-size:.85rem; color:#cfe0ef}
.week-row{display:flex; align-items:center; gap:10px; background:#fff; border-radius:12px; padding:11px 12px;
  margin-bottom:8px; box-shadow:0 1px 3px rgba(20,40,60,.07); cursor:pointer; border:1px solid transparent}
.week-row.locked{opacity:.55; cursor:default}
.week-row .wk-num{width:40px; height:40px; border-radius:10px; background:#eef3f8; color:var(--navy);
  display:flex; align-items:center; justify-content:center; font-weight:bold; flex-shrink:0}
.week-row.done .wk-num{background:var(--ok); color:#fff}
.week-row.current{border-color:var(--gold)}
.week-row .wk-info{flex:1; min-width:0}
.week-row .wk-title{font-weight:bold; font-size:.92rem}
.week-row .wk-sub{font-size:.75rem; color:var(--muted)}
.wk-bar{height:6px; background:#e8eef4; border-radius:4px; margin-top:6px; overflow:hidden}
.wk-bar i{display:block; height:100%; background:var(--ok); border-radius:4px}
.lock-ic{font-size:1.1rem}

/* lesson */
.day-chip{display:inline-block; background:#eef3f8; color:var(--navy); border-radius:20px; padding:3px 12px;
  font-size:.78rem; font-weight:bold; margin-bottom:6px}
.sec-title{display:flex; align-items:center; justify-content:space-between; margin:4px 0 10px}
.sec-title h2{font-size:1rem; color:var(--navy)}
.vrow{display:flex; align-items:center; gap:8px; padding:9px 4px; border-bottom:1px solid var(--line)}
.vrow:last-child{border-bottom:none}
.vrow .en{font-weight:bold; direction:ltr; text-align:left; flex:1; font-size:1rem}
.vrow .tr{color:var(--muted); font-size:.8rem; direction:ltr; text-align:left; width:76px; flex-shrink:0}
.vrow .ar{font-size:.95rem; flex:1}
.srow{display:flex; align-items:center; gap:8px; padding:8px 4px; border-bottom:1px solid var(--line)}
.srow:last-child{border-bottom:none}
.srow .txt{flex:1}
.srow .en{display:block; direction:ltr; text-align:left; font-weight:600}
.srow .ar{display:block; font-size:.85rem; color:var(--muted)}
.grammar-box{background:#fbf6e8; border:1px solid #f0dfae; border-radius:12px; padding:12px}
.grammar-box h3{color:#8a6a00; font-size:.95rem; margin-bottom:6px}
.grammar-box p{font-size:.92rem}
.grammar-box .ex{direction:ltr; text-align:left; background:#fff; border-radius:8px; padding:7px 10px;
  margin-top:8px; font-size:.9rem}
.grammar-box .ex b{color:var(--navy)}
.grammar-box .ex span{display:block; direction:rtl; text-align:right; color:var(--muted); font-size:.8rem}

/* quiz */
.q-progress{height:8px; background:#e8eef4; border-radius:5px; overflow:hidden; margin-bottom:12px}
.q-progress i{display:block; height:100%; background:var(--gold); transition:width .3s}
.q-text{font-size:1.1rem; font-weight:bold; margin-bottom:4px}
.q-sub{font-size:.85rem; color:var(--muted); margin-bottom:12px}
.opt{display:block; width:100%; text-align:start; background:#fff; border:2px solid var(--line);
  border-radius:12px; padding:12px 14px; margin-bottom:8px; font-size:1rem; cursor:pointer; font-family:inherit}
.opt.sel{border-color:var(--navy)}
.opt.correct{border-color:var(--ok); background:#eafaf1}
.opt.wrong{border-color:var(--bad); background:#fdeeee}
.fill-input{width:100%; padding:12px 14px; border:2px solid var(--line); border-radius:12px; font-size:1.05rem;
  direction:ltr; text-align:left; font-family:inherit}
.fill-input:focus{outline:none; border-color:var(--navy)}
.fb{border-radius:12px; padding:12px; margin-top:10px; font-size:.95rem}
.fb.ok{background:#eafaf1; border:1px solid #b8e6cc}
.fb.no{background:#fdeeee; border:1px solid #f2c0c0}
.score-big{font-size:2.6rem; font-weight:bold; color:var(--navy); text-align:center}
.en{direction:ltr}

/* stats */
.stat-grid{display:grid; grid-template-columns:1fr 1fr; gap:10px}
.stat{background:#fff; border-radius:12px; padding:14px; text-align:center; box-shadow:0 1px 3px rgba(20,40,60,.07)}
.stat .num{font-size:1.5rem; font-weight:bold; color:var(--navy)}
.stat .lbl{font-size:.78rem; color:var(--muted)}
#toast{position:fixed; bottom:76px; left:16px; right:16px; background:#222f3d; color:#fff; padding:12px 16px;
  border-radius:12px; text-align:center; z-index:30; font-size:.9rem; box-shadow:0 4px 14px rgba(0,0,0,.3)}
.review-empty{text-align:center; padding:30px 10px; color:var(--muted)}
.review-empty .big{font-size:2.4rem}
