/* Kanjimo — new design, Study / Grammar screen (v2 build,
   2026-11-16). Classes are .gr- prefixed; colours come from the
   design tokens in styles.css. The grammar gold and warning
   washes exist only on the design boards (grammar #B98A1D on
   #FAF3E0, warn #B97E14 on #FDF6E0) and have no styles.css
   token yet, so they are scoped here until the shell adds them. */
.gr{
  --gr-gold:#b98a1d;
  --gr-gold-wash:#faf3e0;
  --gr-warn:#b97e14;
  --gr-warn-wash:#fdf6e0;
  max-width:720px;
  margin:0 auto;
}

/* ---------- session bar ---------- */
.gr-session{display:flex;align-items:center;gap:12px;margin-bottom:10px}
.gr-session-btn{flex:none;width:44px;height:44px;display:grid;place-items:center;
  text-decoration:none;color:var(--muted);font-size:1.125rem;font-weight:700;
  border-radius:var(--r-md)}
.gr-session-btn:hover{color:var(--ink);background:var(--lav-1)}
.gr-session-title{flex:1;text-align:center;color:var(--muted);font-weight:600;font-size:.875rem}
.gr-session-count{flex:none;font-weight:600;font-size:.875rem;min-width:96px;text-align:right}
.gr-progress{height:5px;border-radius:999px;background:var(--lav-2);overflow:hidden;margin-bottom:22px}
.gr-progress i{display:block;height:100%;background:var(--violet);border-radius:999px}

/* ---------- meta row ---------- */
.gr-meta{display:flex;align-items:center;gap:10px;flex-wrap:wrap;margin-bottom:16px}
.gr-chip{display:inline-block;font-size:.6875rem;font-weight:800;letter-spacing:.09em;
  text-transform:uppercase;border-radius:999px;padding:6px 12px}
.gr-chip-level{background:var(--gr-gold-wash);color:var(--gr-gold)}
.gr-chip-new{background:var(--lime);color:var(--violet-deep)}
.gr-chip-studied{background:var(--gr-gold-wash);color:var(--gr-gold)}
.gr-lesson{color:var(--muted);font-size:.8125rem;font-weight:600}
.gr-status{color:var(--muted);font-size:.8125rem;margin-left:auto;text-align:right}

/* ---------- cards and section labels ---------- */
.gr-card{background:var(--white);border:1px solid var(--lav-2);border-radius:var(--r-lg);padding:26px}
.gr-sec-label{color:var(--gr-gold);font-size:.6875rem;font-weight:800;letter-spacing:.09em;
  text-transform:uppercase;margin:0 0 12px}
.gr-sec-label-lav{color:var(--lav)}
.gr-sec-label-warn{color:var(--gr-warn)}

/* ---------- hero ---------- */
.gr-hero{margin-bottom:20px;display:flex;gap:32px;padding:24px 32px}
.gr-hero-main{flex:1;min-width:0}
.gr-hero-side{flex:0 0 428px;display:flex;flex-direction:column;justify-content:center;gap:10px}
.gr-form{font-family:var(--jp);font-size:clamp(1.625rem,6vw,2.625rem);font-weight:700;
  line-height:1.3;margin:0 0 8px}
.gr-romaji{color:var(--muted);font-size:.9375rem;margin:0 0 14px}
.gr-gloss{color:var(--violet);font-size:1.5rem;font-weight:800;letter-spacing:-.01em;margin:0}
.gr-what{line-height:1.5;margin:0;font-size:.875rem;color:var(--muted)}
.gr-when-text{line-height:1.5;margin:0;font-size:.875rem;color:var(--muted)}

/* ---------- formation + speech ---------- */
.gr-cols{display:grid;gap:16px;margin-bottom:20px}
.gr-cols .gr-card{padding:20px 24px;border-radius:20px}
.gr-built{font-family:var(--jp);font-weight:600;font-size:.9375rem;line-height:1.5;margin:0 0 20px}
.gr-built-row{display:flex;flex-direction:column;align-items:stretch;gap:6px;padding:0 0 14px}
.gr-built-row:last-child{padding-bottom:0}
.gr-built-group{color:var(--muted);font-size:.75rem;font-weight:600;line-height:1.4;overflow-wrap:anywhere}
.gr-built-ex{background:var(--gr-gold-wash);border-radius:10px;padding:8px 12px;
  font-family:var(--jp);font-size:.875rem;font-weight:500;line-height:1.45;overflow-wrap:anywhere}

/* ---------- book-style apparatus blocks ---------- */
.gr-block-text{font-size:.875rem;line-height:1.55;margin:0 0 12px}
.gr-block-text:last-child{margin-bottom:0}
.gr-sense-meaning{font-weight:700;font-size:.9375rem;line-height:1.45;margin:0 0 10px}
.gr-cond-list{margin:0;padding-left:20px}
.gr-cond-item{font-size:.875rem;line-height:1.55;margin:0 0 12px}
.gr-cond-item:last-child{margin-bottom:0}
.gr-pair-row{display:flex;align-items:baseline;gap:8px;flex-wrap:wrap;margin:0 0 8px}
.gr-pair-word{font-family:var(--jp);font-weight:600;font-size:.875rem}
.gr-pair-kind{color:var(--muted);font-size:.75rem;font-weight:600}
.gr-similar-card{background:var(--lav-1);border-radius:12px;padding:14px 16px;margin:0 0 12px}
.gr-similar-card:last-child{margin-bottom:0}
.gr-similar-form{font-family:var(--jp);color:var(--violet);font-weight:700;font-size:1rem;margin:0 0 8px;line-height:1.35}
.gr-similar-diff{font-size:.875rem;line-height:1.55;margin:0;overflow-wrap:anywhere}
.gr-slot-label{display:inline-block;background:var(--gr-gold-wash);color:var(--gr-gold);
  font-size:.75rem;font-weight:700;line-height:1.4;border-radius:999px;
  padding:6px 12px;margin:0 0 10px;overflow-wrap:anywhere}
.gr-speech{background:var(--violet-deep);border:0;color:var(--white)}
.gr-speech-form{font-family:var(--jp);font-size:1.875rem;font-weight:700;margin:0 0 10px}
.gr-speech-text{color:var(--lav-1);font-size:.875rem;line-height:1.5;margin:0 0 18px}
.gr-speech-ex{background:var(--violet);border-radius:12px;padding:10px 16px;
  font-family:var(--jp);font-size:.9375rem;font-weight:500}
.gr-speech-en{font-family:var(--sans);color:var(--lav-1);font-size:.75rem;font-weight:400}

/* ---------- examples ---------- */
.gr-examples-label{margin:26px 0 12px}
.gr-ex{display:flex;align-items:flex-start;gap:14px;padding:12px 24px;margin-bottom:12px;border-radius:16px}
.gr-ex-main{flex:1;min-width:0}
.gr-ex-ja{font-family:var(--jp);font-size:1.0625rem;font-weight:500;margin:0 0 4px;line-height:1.3}
.gr-ex-kana{font-family:var(--jp);color:var(--muted);font-size:.75rem;margin:0 0 2px;line-height:1.3}
.gr-ex-romaji{color:var(--muted);font-size:.75rem;margin:0 0 4px;line-height:1.3}
.gr-ex-romaji{color:var(--muted);font-size:.75rem;margin:0 0 2px;line-height:1.3}
.gr-ex-say{color:var(--violet-deep);font-size:.75rem;font-weight:800;margin:0 0 2px;line-height:1.3}
.gr-ex-en{color:var(--muted);font-size:.8125rem;margin:0;line-height:1.35}
.gr-ex-tag{flex:none}
.gr-listen{flex:none;border:0;cursor:pointer;background:var(--lav-1);color:var(--violet);
  font-family:var(--sans);font-weight:700;font-size:.75rem;border-radius:12px;
  min-width:72px;min-height:44px;padding:10px 8px}

/* ---------- watch out + remember ---------- */
.gr-notes{display:grid;gap:20px;margin:20px 0}
.gr-note{border-radius:16px;padding:20px 22px}
.gr-note-warn{background:var(--gr-warn-wash)}
.gr-note-remember{background:var(--lav-1)}
.gr-note .gr-sec-label{margin-bottom:10px}
.gr-note-text{font-size:.875rem;line-height:1.65;margin:0}

/* ---------- tomorrow + actions ---------- */
.gr-tomorrow{background:var(--white);border:1px solid var(--lav-2);border-radius:12px;
  padding:12px 16px;text-align:center;font-weight:600;font-size:.875rem;margin:0 0 26px}
.gr-actions{display:flex;align-items:center;gap:16px;flex-wrap:wrap}
.gr-prev{display:inline-flex;align-items:center;justify-content:center;background:var(--white);
  border:1px solid var(--lav-2);border-radius:16px;color:var(--ink);text-decoration:none;
  font-weight:700;font-size:.9375rem;min-height:56px;padding:14px 26px;width:180px}
.gr-dots{flex:1;text-align:center;color:var(--violet);font-size:.8125rem;letter-spacing:.15em}
.gr-practice{display:inline-flex;align-items:center;justify-content:center;background:var(--violet);
  color:var(--white);text-decoration:none;font-weight:800;font-size:1rem;border-radius:16px;
  min-height:56px;padding:14px 34px;box-shadow:0 4px 0 var(--violet-deep)}
.gr-practice:active{transform:translateY(2px);box-shadow:0 2px 0 var(--violet-deep)}

@media (min-width:900px){
  .gr-cols{grid-template-columns:540px 1fr}
  .gr-cols.gr-apparatus{grid-template-columns:1fr 1fr}
  .gr-notes{grid-template-columns:1fr 1fr}
}
@media (max-width:899px){
  .gr-hero{flex-direction:column;gap:16px}
  .gr-hero-side{flex:1}
}
@media (max-width:899px){
  .gr-dots{display:none}
  .gr-practice{flex:1}
}

/* Board alignment, phones: the session bar collapses to the
   board's single centred line ("Grammar · Item 3 of 12"), the
   meta row keeps chips + short lesson at right with no status
   line, a lone note card spans the row, and the tomorrow strip
   is plain centred text. */
.gr-session-title-m{display:none}
.gr-lesson-short{display:none}
.gr-notes > :only-child{grid-column:1 / -1}
@media (max-width:899px){
  .gr-session-title{display:none}
  .gr-session-count{display:none}
  .gr-session-title-m{display:block;flex:1;text-align:center;font-weight:700;font-size:.9375rem;color:var(--ink)}
  .gr-lesson{display:none}
  .gr-lesson-short{display:block;margin-left:auto;color:var(--muted);font-size:.8125rem;font-weight:600}
  .gr-status{display:none}
  .gr-tomorrow{background:none;border:0;padding:4px 0}
  .gr-prev{width:auto;padding:14px 18px;white-space:nowrap}
  .gr-practice{white-space:nowrap;padding:14px 12px;font-size:.9375rem}
}

/* ---- the one-card layout (2026-11-18 redesign) ---- */
.gr-one{display:flex;flex-direction:column;gap:14px}
.gr-main-card{flex:1;min-height:0;display:flex;flex-direction:column;padding:20px}
.gr-segs{display:flex;gap:2px;border:1px solid var(--lav-2);border-radius:16px;padding:4px;flex:none}
.gr-seg{flex:1;display:flex;flex-direction:column;align-items:center;gap:1px;
  background:none;border:0;border-radius:12px;padding:7px 0 6px;cursor:pointer;
  color:var(--muted);font-family:var(--sans);min-height:52px}
.gr-seg-glyph{font-family:var(--jp);font-size:1.25rem;font-weight:700;line-height:1.15}
.gr-seg-label{font-size:.6875rem;font-weight:700;letter-spacing:.03em}
.gr-seg-on{background:var(--lav-1);color:var(--violet)}
.gr-seg-body{flex:1;min-height:0;overflow-y:auto;margin-top:12px;overscroll-behavior:contain;
  -webkit-mask-image:linear-gradient(to bottom,#000 calc(100% - 16px),transparent);
  mask-image:linear-gradient(to bottom,#000 calc(100% - 16px),transparent)}
.gr-seg-body[hidden]{display:none}
.gr-hero-in{display:flex;gap:32px;flex-wrap:wrap}
.gr-inner-card{border:1px solid var(--lav-2);border-radius:20px;padding:20px 24px}
.gr-ex-in{background:var(--paper);border:1px solid var(--lav-2)}

@media (min-width:900px){
  .gr-seg-body{min-height:400px}
  /* Desktop one-card bound: see kanji.css — the column is capped
     at the viewport the shell leaves so the segment body scrolls
     inside the card at short landscape heights (at 1210x834 the
     uncapped page ran 1.12 screens with Next below the fold). */
  .gr-one{max-height:calc(100vh - 104px);max-height:calc(100dvh - 104px)}
}
@media (min-width:900px) and (max-height:900px){
  .gr-seg-body{min-height:0}
}
@media (max-width:899px){
  .gr-one{height:calc(100vh - 130px);height:calc(100dvh - 130px);gap:12px}
  .gr-main-card{padding:16px}
  .gr-hero-in{flex-direction:column;gap:16px}
  /* Point segment only: the fixed card trapped the Watch out
     note in a scrollbar-less inner scroll region, where the
     bottom fade mask made it read as cut off. While Point is
     active the card grows with its content and the page
     scrolls instead; Examples keeps the fixed card. */
  .gr-one.gr-on-point{height:auto;min-height:calc(100vh - 130px);min-height:calc(100dvh - 130px)}
  .gr-one.gr-on-point .gr-main-card{flex:none}
  .gr-one.gr-on-point .gr-seg-body{flex:none;overflow:visible;
    -webkit-mask-image:none;mask-image:none}
}
