/* 文 — THE GRAMMAR TABLE OF ONE LINE (pilot 2026-11-03; js/manabi-grammar-table.js;
   ARCHITECTURE-RULES §2.8). Every colour is an app token (css/design.css), so light and
   dark follow body[data-theme] with no rule of their own. Brass = this chapter's ④
   (the ④ cards wear brass); hanada blue = the shared deck card — and since his iPhone
   test of build 211 (2026-11-04) colour is ONLY the thin stripe on a row: a blue group
   name read as a link. Delete this file with the module and nothing else is styled
   differently. */

/* the symbol: it rides the reader's own .bunpou-btn, so it has the speaker's size and
   muted colour already — only the glyph is ours */
#sec-honbun .sentence-bunpou.has-gt { display: inline-flex; }
.mnb-gt-glyph {
  display: inline-grid; place-items: center;
  width: 1.02em; height: 1.02em;
  border: 1px solid currentColor; border-radius: 0.22em;
  font-family: var(--font-jp); font-size: 0.82em; font-weight: 400; line-height: 1;
}
.reader .mnb-gt-btn { font-size: 1.25rem; }
.reader .mnb-gt-btn.is-on { color: var(--brass); }
.lg-gt { font-size: 13px; width: 17px; height: 17px; color: var(--brass); }

/* the layer: a shade over the page + the sheet. The shade takes taps and does nothing
   with them (his ruling: a tap outside must NOT close it — swipe down or the handle) */
.mnb-gt-dim {
  position: fixed; inset: 0; z-index: 85;   /* under the card overlay (90) and both bars */
  display: flex; align-items: flex-end; justify-content: center;
}
.mnb-gt-dim[hidden] { display: none !important; }
.mnb-gt-shade {
  position: absolute; inset: 0;
  background: rgba(8, 10, 18, 0.55);
  transition: opacity 0.32s ease;
}
body[data-theme="light"] .mnb-gt-shade { background: rgba(43, 38, 32, 0.32); }

/* 🔒 A CARD ON TOP OF A SHEET — Joshua, 2026-11-05, iPhone dark mode: "with the grammar list opened and
   then on top of it a link to a card opened, the design becomes very busy with the many overlays … maybe
   darkening (or better: making the background behind anything a little bit less intimidating".
   The card's layer is TRANSPARENT by family design (tile-overlay.css, shared — a card over the page keeps
   the page in view), so over a sheet three layers stood at the same weight: dimmed page, a full-bright
   sheet whose rows showed round the card, the card. ⇒ The layer on top FROSTS what is behind it: one soft
   background, the card the only sharp thing. Blur, not a second shade — two shades stacked made the page
   near-black, which is the "intimidating" part. Both orders: a card over the sheet, and the 形 list over
   a card (.is-over-card). The bars sit above both layers and stay sharp. */
body:has(.mnb-gt-dim:not([hidden]):not(.is-over-card)) #tile-overlay.open {
  -webkit-backdrop-filter: blur(7px) saturate(0.85);
  backdrop-filter: blur(7px) saturate(0.85);
  background: rgba(8, 10, 18, 0.16);
}
body[data-theme="light"]:has(.mnb-gt-dim:not([hidden]):not(.is-over-card)) #tile-overlay.open {
  background: rgba(43, 38, 32, 0.06);
}
.mnb-gt-dim.is-over-card .mnb-gt-shade {
  -webkit-backdrop-filter: blur(7px) saturate(0.85);
  backdrop-filter: blur(7px) saturate(0.85);
}

/* THE PRINT FOLLOWS 文字の大きさ (his ruling 3): one base size per step, everything inside
   in em — the same ≈ ×1.17 / ×1.35 steps as the reader, and live (no re-render). The
   default itself went up from ~15 px English: "I have difficulties to read the small text". */
.mnb-gt-sheet { font-size: 17px; }
body[data-textsize="large"] .mnb-gt-sheet { font-size: 20px; }
body[data-textsize="xl"] .mnb-gt-sheet { font-size: 23px; }

.mnb-gt-sheet {
  position: relative;
  width: 100%; max-width: 640px; max-height: 74vh;
  display: flex; flex-direction: column; overflow: hidden;
  background: var(--canvas-elev); color: var(--text);
  border: 1px solid var(--rule); border-bottom: 0; border-radius: 18px 18px 0 0;
  box-shadow: 0 -12px 40px rgba(0, 0, 0, 0.28);
  /* RISES from below the bottom bar (ruling 1) — the iOS sheet curve */
  transition: transform 0.42s cubic-bezier(0.32, 0.72, 0, 1);
  will-change: transform;
}
.mnb-gt-dim.is-entering .mnb-gt-shade,
.mnb-gt-dim.is-leaving .mnb-gt-shade { opacity: 0; }
.mnb-gt-dim.is-entering .mnb-gt-sheet,
.mnb-gt-dim.is-leaving .mnb-gt-sheet { transform: translateY(calc(100% + var(--gt-below, 0px) + 32px)); }
.mnb-gt-dim.is-leaving { pointer-events: none; }
.mnb-gt-dim.is-leaving .mnb-gt-sheet { transition: transform 0.28s cubic-bezier(0.4, 0, 1, 1); }
@media (prefers-reduced-motion: reduce) {
  .mnb-gt-sheet, .mnb-gt-shade, .mnb-gt-dim.is-leaving .mnb-gt-sheet { transition: none; }
}
/* iPad / Mac: over the text column only — the dock on the right stays live */
.mnb-gt-dim.beside-dock { padding: 24px 24px 0; }
.mnb-gt-dim.beside-dock .mnb-gt-sheet {
  max-width: 600px;
  border-radius: 18px; border-bottom: 1px solid var(--rule);
}

/* the head never scrolls away: the handle is always there to tap */
.gt-head { flex: none; padding-bottom: 4px; }
.gt-handle {
  display: grid; place-items: center;
  width: 100%; height: 30px; margin: 0;
  padding: 0; background: none; border: 0; cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}
.gt-grip { width: 42px; height: 5px; border-radius: 5px; background: var(--text-faint); }
.gt-handle:active .gt-grip, .gt-handle:focus-visible .gt-grip { background: var(--text-soft); }
.gt-handle:focus-visible { outline: none; }
.gt-title {
  display: flex; align-items: center; gap: 0.5em;
  padding: 0 max(16px, env(safe-area-inset-right)) 0 max(16px, env(safe-area-inset-left));
  font-family: var(--font-ui); font-size: 0.8em; font-weight: 500; color: var(--text-soft);
}
.gt-title .mnb-gt-glyph { color: var(--brass); font-size: 1.15em; }

.gt-scroll {
  flex: 1 1 auto; min-height: 0;
  overflow-y: auto; overscroll-behavior: contain; -webkit-overflow-scrolling: touch;
  padding: 0 max(16px, env(safe-area-inset-right)) 18px max(16px, env(safe-area-inset-left));
}
.mnb-gt-sheet.is-dragging .gt-scroll { overflow: hidden; }

/* the line itself, at reading size */
.gt-sentence { padding: 2px 0 10px; border-bottom: 1px solid var(--rule); }
.mnb-gt-line { margin: 0; font-family: var(--font-jp); font-size: 1.22em; line-height: 2.05; color: var(--text); }
.mnb-gt-line * { border-bottom: 0 !important; text-decoration: none !important; cursor: default !important; pointer-events: none; }
/* the ○ "beyond this book" mark belongs to the reading page, not to the copy of the line */
.mnb-gt-line .kx { -webkit-text-emphasis: none; text-emphasis: none; }
.mnb-gt-line rt { visibility: visible !important; }
.mnb-gt-line .sentence-speaker { font-size: 0.72em; color: var(--text-soft); margin-right: 0.4em; }

/* the two group names: quiet labels, nothing about them says "tap me" */
.gt-grp { margin-top: 16px; }
.gt-sec {
  margin: 0 2px 8px;
  font-family: var(--font-jp); font-size: 0.82em; font-weight: 600; color: var(--text-soft);
}
.gt-sec span { margin-left: 0.6em; font-family: var(--font-ui); font-weight: 400; font-size: 0.92em; }

/* a row is ONE tappable card: the pattern, the words it covers, what it does here, › */
.mnb-gt-row {
  position: relative;
  width: 100%; display: flex; align-items: center; gap: 12px;
  text-align: left; margin: 0 0 8px; padding: 0.7em 12px 0.75em 18px;
  background: var(--card-inset); border: 0; border-radius: 12px;
  color: var(--text); font: inherit; cursor: pointer; -webkit-tap-highlight-color: transparent;
}
.mnb-gt-row::before {   /* the only colour: brass = ④ of this chapter, blue = a deck card */
  content: ''; position: absolute; left: 7px; top: 12px; bottom: 12px; width: 3px; border-radius: 3px;
}
.mnb-gt-row.g1::before { background: var(--brass); }
.mnb-gt-row.g2::before { background: var(--hanada); }
body[data-theme="dark"] .mnb-gt-row.g2::before { background: #86a9da; }
.mnb-gt-row:active, .mnb-gt-row.is-sel { background: rgba(255, 255, 255, 0.11); }
body[data-theme="light"] .mnb-gt-row:active, body[data-theme="light"] .mnb-gt-row.is-sel { background: rgba(43, 38, 32, 0.12); }
.mnb-gt-row:focus-visible { outline: 2px solid var(--brass); outline-offset: 1px; }
.gt-body { flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; }
.gt-pat { font-family: var(--font-jp); font-size: 1.1em; font-weight: 600; line-height: 1.35; color: var(--text); }
.gt-jp { font-family: var(--font-jp); font-size: 1em; line-height: 2; color: var(--text-soft); }
.gt-jp rt { font-size: 0.52em; color: var(--text-soft); }
.gt-en { font-family: var(--font-en); font-size: 1em; line-height: 1.4; color: var(--text); }
.gt-where { margin-top: 0.3em; font-family: var(--font-ui); font-size: 0.78em; color: var(--text-soft); }
.gt-go { flex: none; display: flex; align-items: center; gap: 6px; color: var(--text-faint); }
.gt-four { font-family: var(--font-jp); font-size: 0.95em; color: var(--brass); }
.gt-chev { font-family: var(--font-ui); font-size: 1.5em; line-height: 1; }

/* 文 → ④: the landing scrolls the CARDS to the top — clear of the sticky top bar */
#atelier-body .mnb-cc { scroll-margin-top: calc(env(safe-area-inset-top) + 132px); }   /* the 対比表 heading stays in view */
/* iPad: the card it landed on rings once, so the eye finds it in the grid */
#atelier-body .mnb-gt-landed { animation: mnbGtLanded 1.8s ease-out; }
@keyframes mnbGtLanded { 0%, 35% { box-shadow: 0 0 0 3px var(--brass); } 100% { box-shadow: 0 0 0 3px transparent; } }
@media (prefers-reduced-motion: reduce) { #atelier-body .mnb-gt-landed { animation: none; box-shadow: 0 0 0 3px var(--brass); } }
