/* ============================================================================
   Grammar Cheat Sheets — hub page with a left menu.
   Pairs with /assets/be-shell.css (brand tokens, topbar, footer).
   ========================================================================== */

/* Typography copied from index.html so the page reads as part of the site.
   index.html declares Fredoka for headings in one inline block and then
   overrides it with Inter in a later one, so Inter is what actually renders —
   and its body is 1.0625rem (17px), not the 16px default. */
body { font-family: 'Inter', system-ui, sans-serif; font-size: 1.0625rem; }
h1, h2, h3, h4, h5, h6, .display { font-family: 'Inter', system-ui, sans-serif; }

/* ---------- hero ---------- */
.cs-hero { padding: 34px 0 22px; }
.cs-kicker { display: inline-block; font-size: 0.75rem; font-weight: 800; letter-spacing: .12em;
             text-transform: uppercase; color: var(--purple); background: #f3f0ff;
             border-radius: 999px; padding: 6px 14px; }
.cs-h1 { font-weight: 700; font-size: clamp(1.75rem, 5vw, 2.75rem);
         margin: 12px 0 6px; }
.cs-lead { color: var(--muted); font-size: 1rem; max-width: 62ch; }

/* ---------- two-column layout ---------- */
.cs-layout { display: grid; grid-template-columns: 268px minmax(0, 1fr); gap: 26px;
             align-items: start; padding-bottom: 60px; }
/* minmax(0,1fr) not 1fr — a bare 1fr keeps an automatic minimum, so the wide
   tables would push the column past the viewport and scroll the whole page. */
@media (max-width: 900px) { .cs-layout { grid-template-columns: minmax(0, 1fr); gap: 16px; } }
.cs-side, .cs-main { min-width: 0; }

/* ---------- left menu ---------- */
.cs-side-inner { position: sticky; top: 92px; }
@media (max-width: 900px) { .cs-side-inner { position: static; } }
.cs-side-label { font-size: 0.6875rem; font-weight: 800; letter-spacing: .12em; text-transform: uppercase;
                 color: var(--muted); margin-bottom: 10px; padding-left: 4px; }
.cs-nav { display: grid; gap: 6px; }
.cs-link { display: flex; align-items: center; gap: 11px; padding: 11px 13px; border-radius: 14px;
           text-decoration: none; color: var(--ink); background: var(--card);
           border: 1px solid var(--line); transition: .18s; min-height: 44px; }
.cs-link:hover { border-color: var(--purple-3); transform: translateX(2px); }
.cs-link .ic { font-size: 1.1875rem; flex: none; }
.cs-link .tx { display: flex; flex-direction: column; line-height: 1.25; min-width: 0; }
.cs-link .tx b { font-size: 0.9062rem; font-weight: 700; }
.cs-link .tx small { font-size: 0.7188rem; color: var(--muted); margin-top: 1px; }
.cs-link.is-active { background: linear-gradient(135deg, var(--purple), var(--green)); border-color: transparent;
                     box-shadow: 0 10px 24px -10px rgba(124, 58, 237, .6); }
.cs-link.is-active .tx b, .cs-link.is-active .tx small { color: #fff; }
.cs-link.is-active .tx small { opacity: .85; }
.cs-link.is-soon { opacity: .58; cursor: default; pointer-events: none; }

.cs-side-note { margin-top: 14px; font-size: 0.7812rem; line-height: 1.6; color: var(--muted);
                background: #f7f5ff; border: 1px dashed var(--purple-3); border-radius: 14px; padding: 12px 14px; }
.cs-side-note b { color: var(--ink); }

/* ---------- the sheet ---------- */
.cs-sheet { background: var(--card); border: 1px solid var(--line); border-radius: 22px;
            padding: 26px 26px 30px; box-shadow: var(--shadow); }
@media (max-width: 560px) { .cs-sheet { padding: 18px 16px 22px; border-radius: 18px; } }
.cs-sheet-head h2 { font-size: clamp(1.3125rem, 3.4vw, 1.6875rem); font-weight: 700; }
.cs-sheet-head p { color: var(--muted); margin-top: 4px; font-size: 0.9375rem; }

.cs-lbl { font-size: 0.6875rem; font-weight: 800; letter-spacing: .11em; text-transform: uppercase;
          color: var(--muted); margin: 24px 0 10px; }

/* ---------- person picker ---------- */
.cs-picker { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; margin-top: 20px; }
@media (max-width: 640px) { .cs-picker { grid-template-columns: 1fr; } }
.cs-pick { text-align: left; background: var(--card); border: 1.5px solid var(--line); border-radius: 16px;
           padding: 13px 15px; cursor: pointer; font-family: inherit; color: var(--ink);
           transition: .18s; min-height: 44px; }
.cs-pick:hover { border-color: var(--purple-3); transform: translateY(-2px); }
.cs-pick b { display: block; font-size: 0.9375rem; font-weight: 700; }
.cs-pick small { display: block; font-size: 0.75rem; color: var(--muted); margin-top: 2px; line-height: 1.35; }
.cs-pick.is-on { border-color: var(--purple); background: #f7f5ff;
                 box-shadow: 0 0 0 3px rgba(124, 58, 237, .12); }

/* ---------- detail panel ---------- */
.cs-panel { margin-top: 14px; border: 1px solid var(--line); border-radius: 18px;
            background: #faf9ff; padding: 18px; animation: csIn .25s ease; }
@keyframes csIn { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
.cs-ptop { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 14px; }
.cs-ptop b { font-size: 0.9688rem; }

.cs-grid2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
@media (max-width: 560px) { .cs-grid2 { grid-template-columns: 1fr; } }
.cs-box { background: var(--card); border: 1px solid var(--line); border-radius: 13px; padding: 11px 13px; }
.cs-box .k { font-size: 0.6875rem; font-weight: 800; letter-spacing: .09em; text-transform: uppercase;
             color: var(--muted); display: block; margin-bottom: 3px; }
.cs-box .v { font-size: 0.9688rem; font-weight: 600; }
.cs-box .v b { color: var(--purple); }

.cs-verb { margin-top: 10px; background: #fff8e6; border: 1px solid #fde9b8; border-radius: 13px;
           padding: 11px 13px; font-size: 0.9062rem; }
.cs-verb b { color: #a16207; }
.cs-hing { margin-top: 10px; font-size: 0.8438rem; color: var(--muted); font-style: italic; }

/* ---------- tables ---------- */
.cs-tblwrap { overflow-x: auto; }
.cs-tbl { width: 100%; border-collapse: collapse; font-size: 0.9062rem;
          border: 1px solid var(--line); border-radius: 14px; overflow: hidden; }
.cs-tbl th { background: #f7f5ff; color: var(--purple); font-weight: 800; text-align: left;
             font-size: 0.7812rem; letter-spacing: .04em; text-transform: uppercase; }
.cs-tbl th, .cs-tbl td { padding: 11px 14px; border-bottom: 1px solid var(--line); vertical-align: top; }
.cs-tbl tbody tr:last-child td { border-bottom: none; }
.cs-tbl tbody tr:hover { background: #fcfbff; }
.cs-mut { color: var(--muted); }

.cs-chip { display: inline-block; padding: 3px 10px; border-radius: 999px; font-size: 0.75rem; font-weight: 800; white-space: nowrap; }
.cs-chip.p1 { background: #ede9fe; color: #6d28d9; }
.cs-chip.p2 { background: #fef3c7; color: #a16207; }
.cs-chip.p3 { background: #fce7f3; color: #be185d; }

/* ---------- trick ---------- */
.cs-trick { margin-top: 24px; background: #f7f5ff; border: 1px solid var(--line); border-radius: 18px; padding: 16px 18px; }
.cs-tricks { display: flex; flex-wrap: wrap; gap: 8px; }
.cs-tk { padding: 8px 13px; border-radius: 12px; font-size: 0.8438rem; background: var(--card); border: 1px solid var(--line); }
.cs-tk.p1 { border-color: #ddd6fe; } .cs-tk.p2 { border-color: #fde68a; } .cs-tk.p3 { border-color: #fbcfe8; }

/* ---------- quick check ---------- */
.cs-quiz { margin-top: 24px; border: 1px solid var(--line); border-radius: 18px; padding: 16px 18px; background: var(--card); }
.cs-q { font-size: 1rem; font-weight: 600; margin-bottom: 12px; }
.cs-q em { font-style: normal; background: #ede9fe; color: #6d28d9; padding: 1px 7px; border-radius: 7px; font-weight: 800; }
.cs-opts { display: flex; flex-wrap: wrap; gap: 8px; }
.cs-opt { padding: 10px 16px; border-radius: 12px; border: 1.5px solid var(--line); background: var(--card);
          font-family: inherit; font-size: 0.875rem; font-weight: 600; color: var(--ink); cursor: pointer;
          min-height: 44px; transition: .15s; }
.cs-opt:hover:not(:disabled) { border-color: var(--purple); }
.cs-opt:disabled { cursor: default; }
.cs-opt.ok { border-color: #059669; background: rgba(5, 150, 105, .1); color: #059669; }
.cs-opt.no { border-color: #dc2626; background: rgba(220, 38, 38, .08); color: #dc2626; }
.cs-v { margin-top: 11px; font-size: 0.9062rem; font-weight: 600; min-height: 1.2em; }
.cs-v .ok { color: #059669; } .cs-v .no { color: #dc2626; }

/* ---------- koi ek vs wahi ---------- */
.cs-split { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
@media (max-width: 560px) { .cs-split { grid-template-columns: minmax(0, 1fr); } }
.cs-half { background: var(--card); border: 1px solid var(--line); border-radius: 14px; padding: 13px 15px; }
.cs-half b { display: block; font-size: 1.1875rem; font-weight: 700; margin: 7px 0 2px; }
.cs-half span:last-child { display: block; font-size: 0.8125rem; color: var(--muted); line-height: 1.5; }

/* ---------- two-step story ---------- */
.cs-story { display: grid; gap: 9px; margin-top: 12px; }
.cs-step { display: flex; gap: 12px; align-items: flex-start; background: #f7f5ff;
           border: 1px solid var(--line); border-radius: 14px; padding: 12px 15px; }
.cs-step .n { flex: none; width: 26px; height: 26px; border-radius: 50%; display: grid; place-items: center;
              background: linear-gradient(135deg, var(--purple), var(--green)); color: #fff;
              font-weight: 800; font-size: 0.8125rem; }
.cs-step b { display: block; font-size: 0.9688rem; }
.cs-step small { display: block; font-size: 0.8125rem; color: var(--muted); margin-top: 3px; line-height: 1.55; }

/* ---------- exceptions ---------- */
.cs-warn { margin-top: 22px; background: #fff8e6; border: 1px solid #fde9b8; border-radius: 16px; padding: 15px 18px; }
.cs-warn b { font-size: 0.9062rem; color: #a16207; }
.cs-warn p { font-size: 0.875rem; margin-top: 6px; line-height: 1.6; }

/* ---------- what's next ---------- */
.cs-next { margin-top: 24px; border-left: 4px solid var(--purple); background: #f7f5ff;
           border-radius: 0 14px 14px 0; padding: 14px 18px; }
.cs-next b { font-size: 0.9062rem; }
.cs-next p { color: var(--muted); font-size: 0.875rem; margin-top: 4px; line-height: 1.65; }

/* ---------- print bar ---------- */
.cs-printbar { display: flex; gap: .5rem; justify-content: flex-end; margin-bottom: .7rem; flex-wrap: wrap; }
.cs-printbtn { min-height: 44px; padding: .5rem 1rem; border-radius: 12px; cursor: pointer;
               font-family: inherit; font-size: .88rem; font-weight: 700;
               border: 1px solid transparent; background: var(--purple); color: #fff; }
.cs-printbtn:hover { background: var(--purple-2); }
.cs-printbtn.ghost { background: var(--card); color: var(--ink); border-color: var(--line); }
.cs-printbtn.ghost:hover { border-color: var(--purple-3); }

/* ============================================================================
   PRINT
   A cheat sheet is something a learner pins to a wall, so printing has to give
   the facts, not the interface. The tables, the mistakes box and the tricks
   carry all the information; the picker, the changing panel and the quiz are
   interactive-only and would print as a single frozen state, so they go.
   ========================================================================== */
/* ============================================================================
   Practice sheet — mixed questions drawn from all ten cheat sheets.
   ========================================================================== */
.pr-top { display: flex; align-items: flex-start; gap: 12px; margin-bottom: 14px; }
.pr-filters { display: flex; flex-wrap: wrap; gap: 7px; flex: 1; min-width: 0; }
.pr-filter { padding: 7px 13px; border-radius: 999px; border: 1.5px solid var(--line);
             background: var(--card); font-family: inherit; font-size: 0.8125rem;
             font-weight: 600; color: var(--ink); cursor: pointer; transition: .15s;
             min-height: 36px; }
.pr-filter:hover { border-color: var(--purple); }
.pr-filter.is-on { background: var(--purple); border-color: var(--purple); color: #fff; }
.pr-restart { flex: none; padding: 7px 13px; border-radius: 999px; border: 1.5px solid var(--line);
              background: var(--card); font-family: inherit; font-size: 0.8125rem; font-weight: 600;
              color: var(--muted); cursor: pointer; min-height: 36px; transition: .15s; }
.pr-restart:hover { border-color: var(--purple); color: var(--purple); }

.pr-bar { height: 7px; border-radius: 999px; background: var(--line); overflow: hidden; }
.pr-bar > span { display: block; height: 100%; width: 0;
                 background: linear-gradient(90deg, #7c3aed, #ec4899);
                 border-radius: 999px; transition: width .3s ease; }
.pr-meta { display: flex; justify-content: space-between; gap: 10px;
           font-size: 0.8125rem; font-weight: 600; color: var(--muted); margin: 8px 2px 16px; }

.pr-card { border: 1px solid var(--line); border-radius: 18px; padding: 18px 20px; background: var(--card); }
.pr-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between;
           gap: 8px; margin-bottom: 12px; }
.pr-type { font-size: 0.6875rem; font-weight: 800; letter-spacing: .1em; text-transform: uppercase;
           color: var(--purple); background: #f3f0ff; border-radius: 999px; padding: 5px 11px; }
.pr-from { font-size: 0.8125rem; font-weight: 600; color: var(--muted); }
.pr-q { font-size: 1.0625rem; font-weight: 600; line-height: 1.55; margin-bottom: 14px; }

.pr-opts { display: flex; flex-wrap: wrap; gap: 9px; }
.pr-opt { padding: 11px 18px; border-radius: 12px; border: 1.5px solid var(--line); background: var(--card);
          font-family: inherit; font-size: 0.9375rem; font-weight: 600; color: var(--ink);
          cursor: pointer; min-height: 44px; transition: .15s; text-align: left; }
.pr-opt.tf { min-width: 116px; text-align: center; }
.pr-opt:hover:not(:disabled) { border-color: var(--purple); }
.pr-opt:disabled { cursor: default; opacity: .75; }
.pr-opt.ok { border-color: #059669; background: rgba(5,150,105,.1); color: #059669; opacity: 1; }
.pr-opt.no { border-color: #dc2626; background: rgba(220,38,38,.08); color: #dc2626; opacity: 1; }

.pr-fb { margin-top: 13px; font-size: 0.9062rem; line-height: 1.6; min-height: 1.2em; }
.pr-fb .ok { color: #059669; font-weight: 700; }
.pr-fb .no { color: #dc2626; font-weight: 700; }
.pr-jump { display: inline-block; margin-top: 8px; padding: 6px 12px; border-radius: 999px;
           border: 1.5px solid var(--line); background: var(--card); font-family: inherit;
           font-size: 0.8125rem; font-weight: 600; color: var(--purple); cursor: pointer; }
.pr-jump:hover { border-color: var(--purple); }

.pr-actions { display: flex; justify-content: flex-end; margin-top: 14px; }
.pr-next { padding: 10px 20px; border-radius: 12px; border: 0;
           background: linear-gradient(135deg, #7c3aed, #ec4899); color: #fff;
           font-family: inherit; font-size: 0.9375rem; font-weight: 700; cursor: pointer;
           min-height: 44px; }
.pr-next:hover { filter: brightness(1.06); }

.pr-done { border: 1px solid var(--line); border-radius: 18px; padding: 26px 20px;
           background: var(--card); text-align: center; }
.pr-done-emoji { font-size: 2.75rem; line-height: 1; }
.pr-done-score { font-size: 1.375rem; margin-top: 10px; }
.pr-done-score b { color: var(--purple); }
.pr-done-msg { color: var(--muted); margin-top: 4px; }
.pr-done-lbl { font-size: 0.75rem; font-weight: 800; letter-spacing: .1em; text-transform: uppercase;
               color: var(--muted); margin-top: 20px; }
.pr-weak { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; margin-top: 10px; }
.pr-done-actions { display: flex; flex-wrap: wrap; gap: 10px; justify-content: center; margin-top: 22px; }
.pr-again, .pr-redo { padding: 11px 20px; border-radius: 12px; font-family: inherit;
                      font-size: 0.9375rem; font-weight: 700; cursor: pointer; min-height: 44px; }
.pr-again { border: 0; background: linear-gradient(135deg, #7c3aed, #ec4899); color: #fff; }
.pr-again:hover { filter: brightness(1.06); }
.pr-redo { border: 1.5px solid var(--line); background: var(--card); color: var(--ink); }
.pr-redo:hover { border-color: var(--purple); color: var(--purple); }

@media (max-width: 560px) {
  .pr-top { flex-direction: column; }
  .pr-restart { align-self: flex-start; }
  .pr-card { padding: 15px 15px; }
  .pr-opt { width: 100%; }
  .pr-opt.tf { width: auto; flex: 1; min-width: 0; }
}

@media print {
  @page { margin: 14mm; }

  /* chrome that means nothing on paper */
  .topbar, .site-footer, .cs-side, .cs-hero, .cs-printbar,
  .cs-picker, .cs-panel, .cs-quiz, .cs-next, .bnav, #mobileMenu { display: none !important; }

  html, body { background: #fff !important; color: #000 !important; font-size: 11pt; }
  .cs-layout { display: block !important; padding: 0 !important; }
  .cs-main { width: 100% !important; }

  /* each sheet starts on its own page when printing the whole set */
  .cs-sheet { box-shadow: none !important; border: 0 !important; padding: 0 !important;
              break-inside: auto; }
  body.cs-printall .cs-sheet + .cs-sheet { break-before: page; }

  .cs-sheet-head h2 { font-size: 16pt; margin-bottom: 2mm; }
  .cs-sheet-head p  { color: #444 !important; }
  .cs-lbl { color: #000 !important; margin: 5mm 0 2mm; }

  /* tables must not split a row across two pages */
  .cs-tblwrap { overflow: visible !important; }
  .cs-tbl { border-color: #999 !important; font-size: 10pt; break-inside: auto; }
  .cs-tbl th { background: #eee !important; color: #000 !important;
               -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  .cs-tbl th, .cs-tbl td { border-color: #ccc !important; }
  .cs-tbl tr { break-inside: avoid; }
  .cs-chip, .cs-tk { border: 1px solid #999 !important; background: #fff !important; color: #000 !important; }

  .cs-warn, .cs-trick, .cs-split, .cs-story, .cs-half, .cs-step {
    border: 1px solid #bbb !important; background: #fff !important; break-inside: avoid; }
  .cs-warn b { color: #000 !important; }

  /* the Practice sheet is interactive — there is nothing useful to put on paper */
  #practice { display: none !important; }

  a[href]::after { content: ""; }      /* no URL clutter after links */
}

/* ============================================================================
   Extras — search, read-aloud, mark-as-learned, practise-this-sheet,
   and the mobile chip rail. See assets/cheat-extras.js.
   ========================================================================== */

/* ---------- search ---------- */
.cs-search { margin-bottom: 12px; }
.cs-search input { width: 100%; padding: 10px 14px; border-radius: 12px; min-height: 44px;
                   border: 1.5px solid var(--line); background: var(--card); color: var(--ink);
                   font-family: inherit; font-size: 0.9375rem; }
.cs-search input:focus { outline: none; border-color: var(--purple); }
.cs-search-none { margin-top: 8px; font-size: 0.8125rem; color: var(--muted); line-height: 1.5; }

/* ---------- read-aloud ---------- */
.cs-spk { margin-left: 8px; width: 26px; height: 26px; border-radius: 50%; cursor: pointer;
          border: 1px solid var(--line); background: var(--card); font-size: 0.75rem; line-height: 1;
          padding: 0; vertical-align: middle; transition: .15s; }
.cs-spk:hover { border-color: var(--purple); transform: scale(1.08); }
.cs-box { position: relative; }
.cs-box .cs-spk { position: absolute; top: 10px; right: 10px; margin: 0; }

/* ---------- mark as learned + practise ---------- */
.cs-sheetbar { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 14px; }
.cs-learn, .cs-practise { padding: 10px 16px; border-radius: 12px; cursor: pointer; min-height: 44px;
                          font-family: inherit; font-size: 0.875rem; font-weight: 700;
                          border: 1.5px solid var(--line); background: var(--card); color: var(--ink);
                          transition: .15s; }
.cs-learn:hover, .cs-practise:hover { border-color: var(--purple); color: var(--purple); }
.cs-learn.is-on { border-color: #059669; background: rgba(5,150,105,.1); color: #059669; }
.cs-learned-count { float: right; font-weight: 700; color: var(--purple); letter-spacing: 0; }
.cs-link.is-learned .tx b::after { content: " ✓"; color: #059669; }

/* ---------- mobile: the menu becomes a horizontal rail ----------
   Stacked, 21 sheets stood 1.4 screens tall before any content appeared. */
@media (max-width: 900px) {
  .cs-nav { display: flex; gap: 8px; overflow-x: auto; padding-bottom: 6px;
            scrollbar-width: none; -webkit-overflow-scrolling: touch; }
  .cs-nav::-webkit-scrollbar { display: none; }
  .cs-link { flex: 0 0 auto; flex-direction: row; align-items: center; gap: 6px;
             padding: 9px 14px; border-radius: 999px; white-space: nowrap; }
  .cs-link .tx { display: inline; }
  .cs-link .tx b { font-size: 0.875rem; }
  .cs-link .tx small { display: none; }     /* the subtitle does not fit a chip */
  .cs-side-note { display: none; }
  .cs-side-inner { padding: 0; background: none; border: 0; box-shadow: none; }
}

@media (prefers-reduced-motion: reduce) {
  .cs-spk, .cs-learn, .cs-practise { transition: none; }
  .cs-spk:hover { transform: none; }
}

@media print {
  .cs-search, .cs-spk, .cs-sheetbar, .cs-learned-count { display: none !important; }
}
