/* EngGram — styles (extracted from index.html). */
  :root {
    --bg: #fafaf9;
    --bg-2: #f5f4f1;
    --card: #ffffff;
    --border: #e7e5e4;
    --border-2: #d6d3d1;
    --text: #1c1917;
    --text-2: #44403c;
    --text-3: #78716c;
    --vi: #475569;
    --accent: #0369a1;
    --accent-soft: #e0f2fe;
    --accent-2: #ea580c;
    --accent-2-soft: #ffedd5;
    --gold: #b45309;
    --gold-soft: #fef3c7;
    --success: #15803d;
    --success-soft: #dcfce7;
    --error: #b91c1c;
    --error-soft: #fee2e2;
    --shadow-sm: 0 1px 2px rgba(0,0,0,.04);
    --shadow: 0 4px 12px rgba(0,0,0,.06);
    --shadow-lg: 0 10px 30px rgba(0,0,0,.08);
  }
  * { box-sizing: border-box; }
  html, body { margin:0; padding:0; background: var(--bg); color: var(--text); font-family: 'Inter', system-ui, sans-serif; font-size: 16px; line-height: 1.6; -webkit-font-smoothing: antialiased; }
  a { color: inherit; text-decoration: none; }
  button { font-family: inherit; cursor: pointer; }
  /* ---- Layout ---- */
  .header {
    background: var(--card); border-bottom: 1px solid var(--border);
    position: sticky; top:0; z-index: 50; backdrop-filter: blur(8px);
  }
  .header-inner { max-width: 1200px; margin: 0 auto; padding: 14px 24px; display: flex; align-items: center; gap: 20px; }
  .logo { display: flex; align-items: center; gap: 10px; font-weight: 800; font-size: 18px; }
  .logo-mark { width: 32px; height: 32px; border-radius: 8px; background: linear-gradient(135deg, var(--accent) 0%, #0284c7 100%); color: white; display: grid; place-items: center; font-weight: 800; }
  .stat-pill { background: var(--bg-2); border: 1px solid var(--border); border-radius: 999px; padding: 6px 14px; font-size: 13px; color: var(--text-2); font-weight: 500; }
  .avatar { width: 36px; height: 36px; border-radius: 999px; background: var(--accent); color: white; display: grid; place-items: center; font-weight: 600; font-size: 13px; }
  .main { max-width: 1200px; margin: 0 auto; padding: 28px 24px; display: grid; grid-template-columns: 260px 1fr; gap: 28px; }
  .sidebar { position: sticky; top: 80px; align-self: start; }
  /* Hamburger / drawer — ẩn mặc định trên desktop, bật ở media query mobile */
  .menu-btn { display: none; }
  .drawer-close { display: none; }
  .sidebar-backdrop { display: none; }
  .sidebar-card { background: var(--card); border: 1px solid var(--border); border-radius: 14px; padding: 8px; box-shadow: var(--shadow-sm); }
  .sb-item { display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-radius: 10px; color: var(--text-2); font-size: 14px; font-weight: 500; transition: background .12s; }
  .sb-item:hover { background: var(--bg-2); color: var(--text); }
  .sb-item.active { background: var(--accent-soft); color: var(--accent); font-weight: 600; }
  .sb-icon { width: 26px; text-align: center; }
  .sb-divider { height: 1px; background: var(--border); margin: 8px 4px; }
  /* ---- Cards ---- */
  .card { background: var(--card); border: 1px solid var(--border); border-radius: 16px; box-shadow: var(--shadow-sm); }
  .card-pad { padding: 24px 28px; }
  .card-pad-sm { padding: 18px 20px; }
  /* ---- Typography ---- */
  h1, h2, h3, h4 { font-family: 'Inter', sans-serif; color: var(--text); }
  h1 { font-size: 30px; font-weight: 800; margin: 0 0 8px; letter-spacing: -0.02em; }
  h2 { font-size: 22px; font-weight: 700; margin: 0 0 12px; }
  h3 { font-size: 17px; font-weight: 600; margin: 0 0 8px; }
  .muted { color: var(--text-3); font-size: 14px; }
  .lead { color: var(--text-2); font-size: 16px; }
  /* ---- Example (bilingual) ---- */
  .ex {
    background: var(--bg-2); border-left: 3px solid var(--accent); border-radius: 6px;
    padding: 12px 16px; margin: 12px 0;
  }
  .ex-en {
    font-family: 'Lora', Georgia, serif; font-size: 16px; color: var(--text);
    line-height: 1.55; font-weight: 500;
  }
  .ex-en b { background: var(--gold-soft); padding: 0 3px; border-radius: 3px; color: var(--text); font-weight: 700; }
  .ex-vi {
    font-family: 'Lora', Georgia, serif; font-style: italic; font-size: 15px;
    color: var(--vi); margin-top: 4px;
  }
  .ex-note {
    font-size: 13px; color: var(--text-3); margin-top: 6px;
    padding-top: 6px; border-top: 1px dashed var(--border);
  }
  /* compact example for inline use */
  .ex-mini { padding: 10px 14px; }
  .ex-mini .ex-en { font-size: 15px; }
  .ex-mini .ex-vi { font-size: 14px; }
  /* ---- Rule block ---- */
  .rule { background: var(--card); border: 1px solid var(--border); border-radius: 12px; padding: 18px 22px; margin: 14px 0; }
  .rule-head { display: flex; align-items: center; gap: 10px; margin-bottom: 8px; }
  .rule-num { background: var(--accent); color: white; width: 26px; height: 26px; border-radius: 8px; display: grid; place-items: center; font-weight: 700; font-size: 13px; }
  .rule-title { font-weight: 700; font-size: 16px; color: var(--text); }
  .rule-body { color: var(--text-2); font-size: 15px; }
  /* ---- Callouts ---- */
  .callout { border-radius: 12px; padding: 14px 18px; margin: 14px 0; display: flex; gap: 12px; }
  .callout-icon { font-size: 20px; flex-shrink: 0; }
  .callout-warn { background: var(--gold-soft); border: 1px solid #fcd34d; color: #78350f; }
  .callout-info { background: var(--accent-soft); border: 1px solid #7dd3fc; color: #0c4a6e; }
  .callout-tip { background: var(--success-soft); border: 1px solid #86efac; color: #14532d; }
  .callout-title { font-weight: 700; margin-bottom: 4px; }
  .callout-body { font-size: 14.5px; line-height: 1.55; }
  /* ---- Table ---- */
  .gtable { width: 100%; border-collapse: separate; border-spacing: 0; border: 1px solid var(--border); border-radius: 10px; overflow: hidden; }
  .gtable th, .gtable td { padding: 10px 14px; text-align: left; font-size: 14.5px; border-bottom: 1px solid var(--border); }
  .gtable th { background: var(--bg-2); font-weight: 600; color: var(--text-2); font-size: 13px; text-transform: uppercase; letter-spacing: 0.04em; }
  .gtable tr:last-child td { border-bottom: none; }
  .gtable td.cell-en { font-family: 'Lora', Georgia, serif; }
  .gtable td.cell-vi { color: var(--vi); font-style: italic; font-family: 'Lora', Georgia, serif; }
  /* ---- Buttons ---- */
  .btn {
    display: inline-flex; align-items: center; gap: 8px; padding: 10px 18px; border-radius: 10px;
    font-weight: 600; font-size: 14px; border: 1px solid transparent; transition: all .12s;
  }
  .btn-primary { background: var(--accent); color: white; }
  .btn-primary:hover { background: #075985; }
  .btn-accent { background: var(--accent-2); color: white; }
  .btn-accent:hover { background: #c2410c; }
  .btn-ghost { background: var(--bg-2); color: var(--text-2); border-color: var(--border); }
  .btn-ghost:hover { background: var(--card); border-color: var(--border-2); }
  .btn-lg { padding: 12px 22px; font-size: 15px; border-radius: 12px; }
  /* ---- Badges ---- */
  .badge { display: inline-block; padding: 3px 10px; border-radius: 999px; font-size: 12px; font-weight: 500; }
  .badge-accent { background: var(--accent-soft); color: var(--accent); }
  .badge-orange { background: var(--accent-2-soft); color: var(--accent-2); }
  .badge-gold { background: var(--gold-soft); color: var(--gold); }
  .badge-success { background: var(--success-soft); color: var(--success); }
  /* ---- Hero ---- */
  .hero {
    background: linear-gradient(135deg, #0369a1 0%, #0284c7 100%);
    color: white; border-radius: 18px; padding: 32px 36px; box-shadow: var(--shadow);
    position: relative; overflow: hidden;
  }
  .hero::before {
    content: ''; position: absolute; right: -40px; top: -40px;
    width: 200px; height: 200px; background: rgba(255,255,255,.08); border-radius: 50%;
  }
  .hero h1 { color: white; font-size: 28px; }
  .hero p { color: rgba(255,255,255,.92); margin: 4px 0 0; }
  /* ---- Section grid ---- */
  .sec-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px,1fr)); gap: 14px; margin-top: 20px; }
  .sec-card {
    background: var(--card); border: 1px solid var(--border); border-radius: 14px; padding: 18px;
    transition: all .15s; cursor: pointer; display: block;
  }
  .sec-card:hover { border-color: var(--accent); transform: translateY(-1px); box-shadow: var(--shadow); }
  .sec-card-icon { font-size: 28px; margin-bottom: 8px; }
  .sec-card-no { color: var(--text-3); font-size: 12px; font-weight: 600; letter-spacing: 0.06em; }
  .sec-card-title { font-weight: 700; font-size: 16px; margin: 4px 0 6px; }
  .sec-card-desc { font-size: 13.5px; color: var(--text-3); line-height: 1.5; }
  .sec-card-progress { margin-top: 12px; height: 4px; background: var(--bg-2); border-radius: 999px; overflow: hidden; }
  .sec-card-progress-fill { height: 100%; background: var(--success); border-radius: 999px; }
  /* ---- Practice ---- */
  .practice-wrap { max-width: 720px; margin: 0 auto; }
  .progress-bar { height: 6px; background: var(--bg-2); border-radius: 999px; overflow: hidden; }
  .progress-fill { height: 100%; background: linear-gradient(90deg, var(--accent), var(--accent-2)); transition: width .25s; }
  .q-stem { font-family: 'Lora', Georgia, serif; font-size: 22px; line-height: 1.55; font-weight: 500; }
  .q-stem-vi { font-style: italic; color: var(--vi); font-size: 16px; margin-top: 6px; font-family: 'Lora', Georgia, serif; }
  .opt {
    display: flex; align-items: center; gap: 14px;
    width: 100%; text-align: left; padding: 14px 18px;
    border: 2px solid var(--border); background: var(--card); border-radius: 12px;
    font-size: 15.5px; transition: all .12s; color: var(--text);
  }
  .opt:hover:not(:disabled) { border-color: var(--accent); background: var(--accent-soft); }
  .opt.selected { border-color: var(--accent); background: var(--accent-soft); }
  .opt.correct { border-color: var(--success); background: var(--success-soft); }
  .opt.wrong { border-color: var(--error); background: var(--error-soft); }
  .opt.faded { opacity: .55; }
  .opt-key { width: 30px; height: 30px; border-radius: 8px; background: var(--bg-2); display: grid; place-items: center; font-weight: 700; font-size: 14px; }
  .opt.correct .opt-key { background: var(--success); color: white; }
  .opt.wrong .opt-key { background: var(--error); color: white; }
  .opt.selected:not(.correct):not(.wrong) .opt-key { background: var(--accent); color: white; }
  /* Explanation card */
  .ex-card { background: var(--card); border: 1px solid var(--border); border-radius: 16px; overflow: hidden; box-shadow: var(--shadow); margin-top: 18px; }
  .ex-banner { padding: 14px 22px; font-weight: 700; display: flex; align-items: center; gap: 10px; }
  .ex-banner.ok { background: var(--success-soft); color: var(--success); }
  .ex-banner.no { background: var(--error-soft); color: var(--error); }
  .ex-layer { padding: 18px 22px; border-top: 1px solid var(--border); }
  .ex-layer-head { display: flex; align-items: center; gap: 10px; margin-bottom: 8px; }
  .ex-layer-tag { padding: 2px 10px; border-radius: 999px; font-size: 11px; font-weight: 700; letter-spacing: 0.04em; text-transform: uppercase; }
  .ex-layer-tag.l1 { background: #e0f2fe; color: #0369a1; }
  .ex-layer-tag.l2 { background: #fef3c7; color: #b45309; }
  .ex-layer-tag.l3 { background: #ddd6fe; color: #6d28d9; }
  .ex-layer-tag.l4 { background: #dcfce7; color: #15803d; }
  .ex-layer-title { font-weight: 700; font-size: 15px; }
  .ex-layer-body { color: var(--text-2); font-size: 15px; line-height: 1.65; }
  .ex-layer-body code, .kbd {
    background: #f3f4f6; padding: 2px 7px; border-radius: 5px; font-family: ui-monospace, 'SF Mono', monospace; font-size: 13.5px; color: var(--text); border: 1px solid var(--border);
  }
  /* For Vietnamese inline next to English keyword */
  .vi { color: var(--vi); font-style: italic; }
  /* ---- Quiz inside section ---- */
  .quiz-card { background: linear-gradient(135deg, #fff8eb 0%, #fef3c7 100%); border: 1px solid #fcd34d; border-radius: 14px; padding: 22px; margin-top: 28px; }
  /* ---- Stats radar ---- */
  .radar text { fill: var(--text-2); font-family: Inter; font-size: 11px; }
  /* Misc */
  .row { display: flex; align-items: center; gap: 12px; }
  .row-wrap { display: flex; flex-wrap: wrap; gap: 8px; }
  .spacer { height: 24px; }
  .divider { border: 0; height: 1px; background: var(--border); margin: 20px 0; }
  .crumb { color: var(--text-3); font-size: 13px; margin-bottom: 8px; }
  .crumb a { color: var(--text-3); }
  .crumb a:hover { color: var(--accent); }
  .tag-cloud { display: flex; flex-wrap: wrap; gap: 6px; margin: 8px 0; }
  .tag {
    background: var(--bg-2); border: 1px solid var(--border); padding: 4px 12px; border-radius: 999px;
    font-size: 13px; color: var(--text-2); font-family: 'Lora', Georgia, serif;
  }
  .tag em { color: var(--vi); font-size: 12px; margin-left: 4px; }
  /* small util */
  .center { text-align: center; }
  .right { text-align: right; }
  .grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
  @media (max-width: 640px) { .grid-2 { grid-template-columns: 1fr; } }

  /* ===================== Responsive — Tablet & Mobile ===================== */
  /* ---- Tablet / mobile: sidebar trở thành drawer trượt ---- */
  @media (max-width: 880px) {
    .header-inner { padding: 12px 16px; gap: 12px; }
    .main { grid-template-columns: 1fr; gap: 18px; padding: 20px 16px; }

    /* Nút hamburger */
    .menu-btn {
      display: inline-flex; align-items: center; justify-content: center;
      width: 40px; height: 40px; flex-shrink: 0;
      border: 1px solid var(--border); background: var(--bg-2);
      border-radius: 10px; font-size: 19px; color: var(--text-2);
    }
    .menu-btn:hover { background: var(--card); border-color: var(--border-2); }

    /* Sidebar dạng off-canvas drawer */
    .sidebar {
      position: fixed; top: 0; left: 0; bottom: 0;
      width: 84%; max-width: 312px; z-index: 100;
      background: var(--card); padding: 14px;
      overflow-y: auto; -webkit-overflow-scrolling: touch;
      transform: translateX(-100%); transition: transform .25s ease;
      box-shadow: var(--shadow-lg); border-right: 1px solid var(--border);
    }
    .sidebar.open { transform: translateX(0); }
    .sidebar-card { border: none; box-shadow: none; background: transparent; padding: 0; }

    /* Nút đóng drawer */
    .drawer-close {
      display: flex; align-items: center; justify-content: center; gap: 6px;
      width: 100%; margin-bottom: 10px; padding: 9px 12px;
      border-radius: 10px; border: 1px solid var(--border);
      background: var(--bg-2); font-size: 14px; font-weight: 600; color: var(--text-2);
    }
    .drawer-close:hover { background: var(--card); }

    /* Lớp phủ tối phía sau drawer */
    .sidebar-backdrop {
      display: block; position: fixed; inset: 0;
      background: rgba(0,0,0,.45); z-index: 95;
      opacity: 0; pointer-events: none; transition: opacity .25s;
    }
    .sidebar-backdrop.open { opacity: 1; pointer-events: auto; }
    body.drawer-open { overflow: hidden; }

    /* Vùng chạm rộng hơn trong drawer */
    .sb-item { padding: 12px 12px; font-size: 15px; }
  }

  /* ---- Điện thoại: thu nhỏ chữ, padding, hero ---- */
  @media (max-width: 600px) {
    html, body { font-size: 15px; }
    .logo { font-size: 16px; gap: 8px; }
    .logo-mark { width: 28px; height: 28px; }
    .header-badge { display: none; }
    .stat-pill { padding: 5px 10px; font-size: 12px; }
    .avatar { width: 32px; height: 32px; }

    .main { padding: 16px 12px; gap: 16px; }
    h1 { font-size: 23px; }
    h2 { font-size: 19px; }
    h3 { font-size: 16px; }

    .card-pad { padding: 16px 16px; }
    .card-pad-sm { padding: 14px 14px; }
    .pg-hero { padding: 24px 20px !important; }
    .pg-hero h1 { font-size: 23px !important; }

    .q-stem { font-size: 18px; }
    .q-stem-vi { font-size: 14.5px; }
    .opt { padding: 12px 14px; font-size: 15px; gap: 10px; }
    .opt-key { width: 26px; height: 26px; }

    .btn { padding: 9px 14px; }
    .btn-lg { padding: 11px 16px; font-size: 14px; }

    .rule { padding: 14px 16px; }
    .quiz-card { padding: 16px 16px; }
    .callout { padding: 12px 14px; }
    .ex-banner { padding: 12px 16px; }
    .ex-layer { padding: 14px 16px; }
    .practice-wrap { max-width: 100%; }
  }
