/* The student portal (#595, #607), from the approved prototype: a rail of
   sections on the inline start and the section's content beside it; on a
   phone the rail is a bar at the bottom. Light to study in, dark only when
   chosen: nothing here follows the system. System type, logical properties,
   and no width calibrated against one language. */

:root {
  color-scheme: light;
  --ground: #f3f5f9;
  --panel: #ffffff;
  --raised: #eef1f6;
  --ink: #121a2b;
  --muted: #5a6580;
  --faint: #636d85;
  --rule: #dde2ec;
  --accent: #a65f00;
  --accent-ink: #ffffff;
  --accent-soft: #fff1d6;
  --danger: #b3261e;
  --danger-ink: #ffffff;
  --screen: #0d1526;
  --screen-ink: #f4f1e8;
  --screen-muted: #aab4cb;
  --glow: #f2b347;
  --heat-0: #e6eaf1;
  --heat-1: #f8dca6;
  --heat-2: #f2b347;
  --heat-3: #c47a08;
  /* a line of dialogue: quiet paper in light, the screen in dark */
  --strip-bg: #f6f2ea;
  --strip-edge: #e9dcc4;
  --strip-ink: #121a2b;
  --strip-muted: #5a6580;
  --strip-mark: #9a5700;
  --font: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --radius-s: 0.4rem;
  --radius-m: 0.75rem;
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --ground: #0a101c;
  --panel: #111a2b;
  --raised: #18233a;
  --ink: #e9edf6;
  --muted: #a3adc4;
  --faint: #8b96ae;
  --rule: #222e46;
  --accent: #f2c14e;
  --accent-ink: #1a1200;
  --accent-soft: #2b2511;
  --danger: #f28b82;
  --danger-ink: #2b0705;
  --screen: #050912;
  --heat-0: #1a2539;
  --heat-1: #4a3a14;
  --heat-2: #a7741a;
  --heat-3: #f2c14e;
  --strip-bg: #050912;
  --strip-edge: #050912;
  --strip-ink: #f4f1e8;
  --strip-muted: #aab4cb;
  --strip-mark: #f2b347;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; }
body { background: var(--ground); color: var(--ink); font: 0.97rem/1.5 var(--font); }
@media (prefers-reduced-motion: reduce) { * { transition: none !important; } }
button { font: inherit; color: inherit; }
a { color: var(--accent); }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
h1:focus { outline: none; }
h1, h2, h3 { margin: 0; line-height: 1.2; text-wrap: balance; letter-spacing: -0.01em; }
h1 { font-size: 1.45rem; font-weight: 750; }
h2 { font-size: 1.08rem; font-weight: 700; }
h3 { font-size: 0.98rem; font-weight: 650; }
p { margin: 0; }
.muted { color: var(--muted); }
svg.i { inline-size: 1.25rem; block-size: 1.25rem; flex: none; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }

/* ---------- shell ---------- */
/* The rail spans every row, or it could not stick past the first. */
.app { display: grid; grid-template-columns: minmax(5.2rem, max-content) minmax(0, 1fr) 18.5rem; grid-template-rows: 1fr auto; min-block-size: 100dvh; }
.app:has(> .summary[hidden]) { grid-template-columns: minmax(5.2rem, max-content) minmax(0, 1fr); }
.rail { grid-row: 1 / span 2; position: sticky; inset-block-start: 0; align-self: start; block-size: 100dvh; overflow-y: auto; display: flex; flex-direction: column; align-items: stretch; gap: 0.25rem; padding: 0.9rem 0.5rem; border-inline-end: 1px solid var(--rule); background: var(--panel); }
.brand { display: grid; place-items: center; block-size: 2.6rem; margin-block-end: 0.8rem; }
.brand img { inline-size: 2rem; block-size: 2rem; }
.rail a.sec { display: grid; justify-items: center; gap: 0.2rem; padding: 0.55rem 0.4rem; border-radius: var(--radius-m); color: var(--muted); text-decoration: none; font-size: 0.72rem; font-weight: 600; text-align: center; }
.rail a.sec:hover { color: var(--ink); background: var(--raised); }
.rail a.sec[aria-current="page"] { color: var(--ink); background: var(--accent-soft); }
.rail a.sec[aria-current="page"] svg { color: var(--accent); }
.rail .spacer { flex: 1; }
.rail hr { inline-size: calc(100% - 1.2rem); border: 0; border-block-start: 1px solid var(--rule); margin: 0.4rem auto; }

main { grid-column: 2; grid-row: 1; padding: 1.4rem clamp(1rem, 2.5vw, 2rem) 3rem; display: grid; gap: 1.8rem; align-content: start; min-inline-size: 0; }
aside.summary { grid-column: 3; grid-row: 1 / span 2; border-inline-start: 1px solid var(--rule); padding: 1.4rem 1rem 2rem; display: grid; gap: 1rem; align-content: start; justify-items: stretch; min-inline-size: 0; }
.summary-body { display: contents; }
.bar { display: flex; flex-wrap: wrap; align-items: center; gap: 0.6rem 1rem; }
#view-head .search { margin-inline-start: auto; inline-size: min(24rem, 100%); }
.num { font-variant-numeric: tabular-nums; }
.soon-tag { font-size: 0.72rem; font-weight: 700; padding: 0.1em 0.55em; border-radius: 2rem; background: var(--accent-soft); color: var(--ink); }

.fine { grid-column: 2; grid-row: 2; margin-block: 0 2rem; margin-inline: clamp(1rem, 2.5vw, 2rem); padding-block-start: 1rem; border-block-start: 1px solid var(--rule); display: grid; gap: 0.5rem; max-inline-size: 44rem; font-size: 0.76rem; color: var(--faint); }
.fine a { color: var(--muted); }
.fine-links { display: flex; flex-wrap: wrap; gap: 0.2rem 1rem; }

/* ---------- buttons ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 0.4em; padding: 0.5em 1.05em; border-radius: 2rem; border: 1px solid transparent; background: var(--accent); color: var(--accent-ink); font-weight: 700; font-size: 0.9rem; cursor: pointer; text-decoration: none; }
.btn.ghost { background: transparent; border-color: var(--rule); color: var(--ink); }
.btn.danger { background: var(--danger); color: var(--danger-ink); }
.btn.danger-ghost { color: var(--danger); border-color: var(--danger); }
.btn:disabled, .btn[aria-disabled="true"] { opacity: 0.45; cursor: not-allowed; }
.btn.small { padding: 0.35em 0.9em; font-size: 0.84rem; }
.chips { display: flex; flex-wrap: wrap; gap: 0.4rem; min-inline-size: 0; }
.chip { max-inline-size: 100%; padding: 0.3em 0.85em; border-radius: 2rem; border: 1px solid var(--rule); background: var(--panel); cursor: pointer; font-size: 0.86rem; color: var(--muted); overflow-wrap: anywhere; text-align: start; unicode-bidi: isolate; }
.chip[aria-pressed="true"] { border-color: var(--accent); color: var(--ink); background: var(--accent-soft); font-weight: 650; }
.select { font: inherit; font-size: 0.86rem; padding: 0.35em 0.7em; border-radius: 2rem; border: 1px solid var(--rule); background: var(--panel); color: var(--ink); }
.search { display: flex; align-items: center; gap: 0.45rem; padding: 0.4rem 0.7rem; border: 1px solid var(--rule); border-radius: 2rem; background: var(--panel); color: var(--muted); inline-size: min(18rem, 100%); }
.search input { border: 0; background: none; font: inherit; color: var(--ink); inline-size: 100%; min-inline-size: 0; outline: none; text-overflow: ellipsis; }
.search:focus-within { border-color: var(--accent); }
.status-tabs { display: inline-flex; border: 1px solid var(--rule); border-radius: 2rem; overflow: hidden; }
.status-tabs button { border: 0; background: none; padding: 0.4em 1em; font-size: 0.9rem; color: var(--muted); cursor: pointer; }
.status-tabs button:focus-visible { outline-offset: -2px; }
.status-tabs button[aria-selected="true"], .status-tabs button[aria-checked="true"] { background: var(--ink); color: var(--ground); font-weight: 650; }

/* ---------- Inicio and Títulos: a title drawn as a line of its own dialogue ---------- */
.overview { display: grid; gap: 1.8rem; justify-items: start; min-inline-size: 0; }
.overview > section, .overview > .covers { inline-size: 100%; }
.section-head { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 0.2rem 1rem; margin-block-end: 0.8rem; }
.section-head a { font-size: 0.88rem; font-weight: 600; text-decoration: none; }
.covers { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(14.5rem, 100%), 1fr)); gap: 1.2rem 1rem; }
.title-card { display: grid; gap: 0.55rem; align-content: start; min-inline-size: 0; color: var(--ink); text-decoration: none; }
.title-card:focus-visible { outline: none; }
.title-card:hover .cover, .title-card:focus-visible .cover { outline: 2px solid var(--accent); outline-offset: 2px; }
/* 16:9 is the least it takes: a long line makes it taller, never cut. */
.cover { position: relative; aspect-ratio: 16 / 9; border-radius: var(--radius-m); display: grid; align-content: end; justify-items: center; padding: 2.2rem 0.9rem 0.8rem; text-align: center; color: var(--screen-ink); background: radial-gradient(120% 90% at 30% 10%, hsl(var(--h) 45% 26%) 0%, transparent 60%), radial-gradient(90% 80% at 85% 90%, hsl(calc(var(--h) + 40) 40% 18%) 0%, transparent 65%), var(--screen); }
.cover .sub { max-inline-size: 100%; overflow-wrap: anywhere; font-weight: 600; font-size: 0.98rem; line-height: 1.35; text-shadow: 0 1px 2px rgba(0, 0, 0, 0.6); unicode-bidi: isolate; text-wrap: balance; }
.cover mark { background: none; color: var(--glow); border-block-end: 2px solid var(--glow); }
.cover .tag { position: absolute; inset-block-start: 0.6rem; inset-inline-start: 0.6rem; font-size: 0.72rem; font-weight: 700; padding: 0.15em 0.55em; border-radius: var(--radius-s); background: rgba(0, 0, 0, 0.45); color: var(--screen-ink); }
.meta { display: grid; gap: 0.1rem; min-inline-size: 0; }
.meta h3, .meta p { overflow-wrap: anywhere; unicode-bidi: isolate; }
.meta p { font-size: 0.86rem; }
a.wrow { color: inherit; text-decoration: none; }

/* ---------- the summary column ---------- */
.widget { background: var(--panel); border: 1px solid var(--rule); border-radius: var(--radius-m); padding: 0.95rem 1rem; display: grid; gap: 0.75rem; align-content: start; min-inline-size: 0; }
.widget .head { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: baseline; gap: 0.1rem 0.5rem; }
.widget .head.stacked { display: grid; }
.widget .head .muted { font-size: 0.82rem; }
.week { display: grid; grid-template-columns: repeat(7, 1fr); gap: 0.35rem; align-items: end; block-size: 5.2rem; }
.week .day { display: flex; flex-direction: column; justify-content: flex-end; align-items: center; gap: 0.25rem; block-size: 100%; }
.week .barv { inline-size: 70%; border-radius: 0.25rem 0.25rem 0.1rem 0.1rem; background: var(--heat-2); min-block-size: 3px; }
.week .day.today .barv { background: var(--accent); }
.week .day.zero .barv { background: var(--heat-0); }
.week .lab { font-size: 0.7rem; color: var(--faint); }
.stats { display: grid; grid-template-columns: 1fr 1fr; gap: 0.6rem; min-inline-size: 0; }
.stat { background: var(--panel); border: 1px solid var(--rule); border-radius: var(--radius-m); padding: 0.75rem 0.85rem; display: grid; gap: 0.05rem; align-content: start; min-inline-size: 0; }
.stat b { font-size: 1.35rem; line-height: 1.2; font-weight: 750; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; text-wrap: balance; }
.stat span { font-size: 0.8rem; color: var(--muted); }
.review-w .pair { display: grid; grid-template-columns: 1fr 1fr; gap: 0.6rem; }
.review-w .pair div { display: grid; }
.review-w .pair b { font-size: 1.2rem; font-variant-numeric: tabular-nums; color: var(--faint); }
.review-w .pair span { font-size: 0.78rem; color: var(--muted); }
.heat { display: grid; grid-auto-flow: column; grid-template-rows: repeat(7, 0.62rem); gap: 0.18rem; overflow-x: auto; }
.heat i { inline-size: 0.62rem; border-radius: 0.12rem; background: var(--heat-0); }
.heat i.l1 { background: var(--heat-1); }
.heat i.l2 { background: var(--heat-2); }
.heat i.l3 { background: var(--heat-3); }
.heat-legend { display: flex; justify-content: space-between; font-size: 0.72rem; color: var(--faint); }

/* ---------- a line of dialogue ---------- */
.strip { background: var(--strip-bg); color: var(--strip-ink); border: 1px solid var(--strip-edge); border-radius: var(--radius-s); padding: 0.6rem 0.8rem; display: grid; gap: 0.15rem; }
.strip .l { font-weight: 600; unicode-bidi: isolate; overflow-wrap: anywhere; }
.strip .r { color: var(--strip-muted); font-size: 0.9rem; unicode-bidi: isolate; overflow-wrap: anywhere; }
.strip mark { background: none; color: var(--strip-mark); border-block-end: 2px solid var(--strip-mark); }

.line { display: grid; gap: 0.35rem; }
.line .foot { display: flex; flex-wrap: wrap; align-items: center; gap: 0.2rem 1rem; font-size: 0.82rem; color: var(--muted); }

/* ---------- Palabras: dense, one line per word, opening to its lines ---------- */
.words-view, .word-panel { display: grid; gap: 1rem; justify-items: start; min-inline-size: 0; }
.words-view > *, .word-panel > .words { inline-size: 100%; }
.tools { justify-content: space-between; align-items: start; }
.filters { display: grid; gap: 0.5rem; min-inline-size: 0; flex: 1 1 16rem; }
.words { list-style: none; margin: 0; padding: 0; background: var(--panel); border: 1px solid var(--rule); border-radius: var(--radius-m); overflow: hidden; }
.words > li + li { border-block-start: 1px solid var(--rule); }
.wrow { display: grid; grid-template-columns: minmax(8rem, 1fr) minmax(12rem, 2fr) 2rem; align-items: center; gap: 0.8rem; padding: 0.6rem 0.8rem; inline-size: 100%; border: 0; background: none; text-align: start; cursor: pointer; }
.wrow:hover { background: var(--raised); }
/* Palabras's rows: word, gloss, where it was met, the chevron. Inicio's keep three cells. */
button.wrow { grid-template-columns: minmax(8rem, 1fr) minmax(0, 1.6fr) minmax(12rem, 1.5fr) 2rem; }
/* Written left to right, and still set under the word, at the page's start. */
.wcell .ipa { justify-self: start; font-size: 0.8rem; color: var(--faint); unicode-bidi: isolate; overflow-wrap: anywhere; }
/* The line stays reserved, so that a transcription arriving does not move the list. */
.wcell .ipa:empty::before { content: "\00a0"; }
a.wrow .wcell .ipa { display: none; }
/* The cut belongs to the gloss's own box and direction, or a gloss written against the page's direction would lose its beginning. */
.gloss { display: flex; align-items: baseline; min-inline-size: 0; color: var(--muted); font-size: 0.9rem; }
.gloss .cat { flex: none; font-style: italic; color: var(--faint); margin-inline-end: 0.35em; }
.gloss .g { min-inline-size: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--ink); unicode-bidi: isolate; }
.words > li.is-known .gloss .g { color: var(--muted); }
.wrow:focus-visible { outline-offset: -2px; }
.wrow[aria-expanded="true"] .chev { transform: rotate(180deg); }
.wcell { display: grid; min-inline-size: 0; }
.wcell .w { font-weight: 700; font-size: 1.02rem; overflow-wrap: anywhere; }
.wcell .w > span:last-child { unicode-bidi: isolate; }
.words > li.is-known .wcell .w { color: var(--muted); }
.wcell .ok { display: inline-grid; place-items: center; inline-size: 1.05rem; block-size: 1.05rem; margin-inline-end: 0.35rem; border-radius: 50%; background: var(--accent-soft); color: var(--accent); vertical-align: -0.1rem; }
.wcell .ok svg { inline-size: 0.7rem; block-size: 0.7rem; fill: none; stroke: currentColor; stroke-width: 3; stroke-linecap: round; stroke-linejoin: round; }
.seen { display: flex; flex-wrap: wrap; align-items: center; gap: 0.3rem; font-size: 0.82rem; color: var(--muted); min-inline-size: 0; }
.seen .when { color: var(--faint); font-size: 0.78rem; }
/* the title a word came from, tinted the same wherever that title appears */
.src-tag { display: inline-block; max-inline-size: 100%; padding: 0.1em 0.6em; border-radius: 2rem; border: 1px solid var(--rule); background: var(--raised); color: var(--ink); font-size: 0.76rem; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; unicode-bidi: isolate; }
.src-tag::before { content: ""; display: inline-block; margin-inline-end: 0.35em; inline-size: 0.5rem; block-size: 0.5rem; border-radius: 50%; background: hsl(var(--h) 55% 55%); }
.chev { transition: transform 0.15s; color: var(--faint); justify-self: end; }
.lines { display: grid; gap: 0.7rem; padding-block: 0.2rem 0.95rem; padding-inline: 0.8rem; }
.line-list { display: grid; gap: 0.7rem; justify-items: start; }
.line-list > .line { inline-size: 100%; }
.row-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 0.5rem 1.2rem; }
.row-actions .quiet { background: none; border: 0; padding: 0; color: var(--muted); cursor: pointer; font-size: 0.82rem; text-align: start; }
.row-actions .quiet span { unicode-bidi: isolate; }

/* ---------- states ---------- */
.status, .gate { max-inline-size: 30rem; margin: 4rem auto; padding: 1.5rem; }
.status { display: grid; gap: 1rem; justify-items: center; text-align: center; color: var(--muted); }
.gate { display: grid; gap: 1rem; background: var(--panel); border: 1px solid var(--rule); border-radius: var(--radius-m); }
.note { background: var(--accent-soft); border-radius: var(--radius-m); padding: 0.75rem 1rem; font-size: 0.9rem; }
.invite { display: grid; justify-items: center; text-align: center; gap: 1rem; padding: 2rem 1rem; max-inline-size: 34rem; margin-inline: auto; }
.invite .strip { inline-size: min(26rem, 100%); padding: 0.9rem 1.1rem; }
.invite ul { text-align: start; margin: 0; padding-inline-start: 1.2rem; display: grid; gap: 0.25rem; color: var(--muted); font-size: 0.92rem; }
.actions { display: flex; flex-wrap: wrap; gap: 0.5rem; }
.invite .actions { justify-content: center; }
.soon-page { display: grid; gap: 1.2rem; max-inline-size: 44rem; }
.pieces { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(12rem, 100%), 1fr)); gap: 0.7rem; }
.piece { display: grid; gap: 0.3rem; align-content: start; padding: 0.9rem 1rem; border: 1px dashed var(--rule); border-radius: var(--radius-m); background: var(--panel); }
.piece h2 { font-size: 0.98rem; font-weight: 650; }
.piece span { font-size: 0.84rem; color: var(--muted); }
.flash { max-inline-size: 22rem; min-block-size: 12rem; border-radius: var(--radius-m); background: var(--screen); color: var(--screen-ink); display: grid; place-content: center; gap: 0.6rem; padding: 1.2rem; text-align: center; box-shadow: 0.5rem 0.5rem 0 -0.1rem var(--raised); }
[dir="rtl"] .flash { box-shadow: -0.5rem 0.5rem 0 -0.1rem var(--raised); }
.flash .q { font-size: 1.05rem; font-weight: 600; overflow-wrap: anywhere; }
.flash mark { background: none; color: var(--glow); border-block-end: 2px solid var(--glow); }
.flash .hint { color: var(--screen-muted); font-size: 0.85rem; }

/* ---------- Ajustes ---------- */
.groups { display: grid; gap: 1.6rem; max-inline-size: 44rem; }
.group { display: grid; gap: 0.55rem; }
.settings { background: var(--panel); border: 1px solid var(--rule); border-radius: var(--radius-m); }
.setrow { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 0.5rem 1.5rem; padding: 0.9rem 1.1rem; }
.setrow:has(> .switch) { flex-wrap: nowrap; }
.setrow + .setrow { border-block-start: 1px solid var(--rule); }
.setrow .txt { display: grid; gap: 0.15rem; max-inline-size: 30rem; min-inline-size: 0; }
.setrow .txt span { font-size: 0.86rem; color: var(--muted); }
.setrow .val { color: var(--muted); overflow-wrap: anywhere; min-inline-size: 0; }
.setrow .lead { display: flex; align-items: center; gap: 0.75rem; min-inline-size: 0; flex: 1 1 16rem; }
.setrow .lead > svg.i { color: var(--muted); }
.switch { position: relative; inline-size: 2.6rem; block-size: 1.5rem; border-radius: 1rem; border: 0; padding: 0; background: var(--rule); cursor: pointer; flex: none; }
.switch::after { content: ""; position: absolute; inset-block-start: 0.2rem; inset-inline-start: 0.2rem; inline-size: 1.1rem; block-size: 1.1rem; border-radius: 50%; background: var(--panel); transition: inset-inline-start 0.15s; }
.switch[aria-checked="true"] { background: var(--accent); }
.switch[aria-checked="true"]::after { inset-inline-start: 1.3rem; background: var(--accent-ink); }
/* the theme switch: the knob carries the mode it shows, a moon or a sun */
.switch.with-icon::after { content: none; }
.switch.with-icon { inline-size: 3rem; block-size: 1.7rem; }
.switch.with-icon .knob { position: absolute; inset-block-start: 0.2rem; inset-inline-start: 0.2rem; inline-size: 1.3rem; block-size: 1.3rem; border-radius: 50%; display: grid; place-items: center; background: var(--panel); color: var(--ink); transition: inset-inline-start 0.15s; }
.switch.with-icon[aria-checked="true"] .knob { inset-inline-start: 1.5rem; background: var(--accent-ink); color: var(--accent); }
.switch.with-icon svg { inline-size: 0.85rem; block-size: 0.85rem; fill: none; stroke: currentColor; stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round; }
.switch.with-icon .moon, .switch.with-icon[aria-checked="true"] .sun { display: none; }
.switch.with-icon[aria-checked="true"] .moon { display: block; }
.confirm { border: 2px solid var(--danger); border-radius: var(--radius-m); padding: 0.9rem 1rem; display: grid; gap: 0.6rem; background: var(--panel); }
.danger-title { color: var(--danger); }
.typed { display: grid; gap: 0.3rem; font-size: 0.9rem; }
.typed input { font: inherit; padding: 0.45em 0.7em; border: 1px solid var(--rule); border-radius: var(--radius-s); background: var(--ground); color: var(--ink); max-inline-size: 16rem; }

.toasts { position: fixed; inset-block-end: calc(5rem + env(safe-area-inset-bottom, 0px)); inset-inline: 0; z-index: 50; display: grid; justify-items: center; gap: 0.4rem; padding-inline: 1rem; pointer-events: none; }
.toast { pointer-events: auto; min-inline-size: 0; max-inline-size: 100%; padding: 0.55rem 1rem; border-radius: 2rem; background: var(--ink); color: var(--ground); font-size: 0.9rem; display: flex; flex-wrap: wrap; align-items: center; gap: 0.2rem 1rem; }
.toast span span { unicode-bidi: isolate; }
.toast button { background: none; border: 0; padding: 0; color: var(--glow); font-weight: 700; cursor: pointer; }

/* ---------- what the first «Ya la sé» explains ---------- */
.known-dialog { inline-size: min(26rem, calc(100% - 32px)); padding: 0; border: 1px solid var(--rule); border-radius: var(--radius-m); background: var(--panel); color: var(--ink); box-shadow: 0 1.5rem 3rem rgba(5, 9, 18, 0.45); }
.known-dialog::backdrop { background: rgba(5, 9, 18, 0.55); }
.known-dialog form { display: grid; gap: 0.9rem; padding: 1.2rem 1.3rem; }
.known-dialog h2 { font-size: 1.1rem; }
.known-dialog h2 span { unicode-bidi: isolate; }
.known-dialog ul { margin: 0; padding: 0; list-style: none; display: grid; gap: 0.7rem; }
.known-dialog li { display: grid; grid-template-columns: 1.6rem 1fr; gap: 0.5rem; align-items: start; font-size: 0.92rem; }
.known-dialog li svg { inline-size: 1.15rem; block-size: 1.15rem; margin-block-start: 0.1rem; fill: none; stroke: var(--accent); stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.known-dialog li b { font-weight: 650; }
.known-dialog .skip { display: flex; gap: 0.5rem; align-items: center; font-size: 0.86rem; color: var(--muted); }
.known-dialog .actions { justify-content: flex-end; }

/* ---------- the sheet that sends the address to a computer ---------- */
.handoff { inline-size: 100%; max-inline-size: 34rem; margin: auto auto 0; padding: 0; border: 0; border-radius: 1rem 1rem 0 0; background: var(--panel); color: var(--ink); }
.handoff::backdrop { background: rgba(5, 9, 18, 0.55); }
.handoff-in { display: grid; gap: 1rem; padding: 1.5rem 1.25rem calc(1.25rem + env(safe-area-inset-bottom, 0px)); }
.handoff-address { padding: 1rem; border-radius: var(--radius-s); background: var(--screen); color: var(--screen-ink); text-align: center; font-weight: 800; overflow-wrap: anywhere; user-select: all; -webkit-user-select: all; }
.handoff-actions { display: flex; flex-wrap: wrap; gap: 0.6rem; }
.handoff-actions .btn { flex: 1 1 10rem; }
.handoff-said { min-block-size: 1.5em; }
.handoff-close { justify-self: center; color: var(--muted); background: none; border: 0; padding: 0.5rem 1rem; text-decoration: underline; cursor: pointer; }

/* ---------- narrower: the summary goes under the content, above the fine print ---------- */
@media (max-width: 68rem) {
  .app, .app:has(> .summary[hidden]) { grid-template-columns: minmax(5.2rem, max-content) minmax(0, 1fr); grid-template-rows: auto auto 1fr; }
  .rail { grid-row: 1 / span 3; }
  aside.summary { grid-column: 2; grid-row: 2; padding-inline: clamp(1rem, 2.5vw, 2rem); border-inline-start: 0; border-block-start: 1px solid var(--rule); grid-template-columns: repeat(auto-fit, minmax(min(15rem, 100%), 1fr)); }
  .fine { grid-row: 3; margin-block-start: 1rem; }
}
/* ---------- phone: the rail becomes a bar at the bottom ---------- */
@media (max-width: 42rem) {
  .app, .app:has(> .summary[hidden]) { grid-template-columns: minmax(0, 1fr); padding-block-end: calc(4.5rem + env(safe-area-inset-bottom, 0px)); }
  main, aside.summary, .fine { grid-column: 1; }
  aside.summary { grid-template-columns: minmax(0, 1fr); }
  .covers { grid-template-columns: minmax(0, 1fr); }
  .fine { margin-inline: 16px; }
  .rail { position: fixed; inset-block: auto 0; inset-inline: 0; block-size: auto; overflow: visible; z-index: 20; flex-direction: row; justify-content: space-around; padding: 0.35rem 0.3rem calc(0.35rem + env(safe-area-inset-bottom, 0px)); border-inline-end: 0; border-block-start: 1px solid var(--rule); }
  .wrow { grid-template-columns: minmax(0, 1fr) 1.6rem; row-gap: 0.15rem; }
  button.wrow { grid-template-columns: minmax(0, 1fr) 1.6rem; }
  .wcell .ipa:empty::before { content: none; }
  .wrow .gloss { grid-column: 1; grid-row: 2; display: block; }
  .wrow .gloss .g { white-space: normal; overflow: visible; }
  .wrow .seen { grid-column: 1; grid-row: 3; }
  a.wrow .seen { grid-row: 2; }
  .mark-btn { min-block-size: 2rem; }
  .wrow .chev { grid-column: 2; grid-row: 1; }
  #view-head .search { inline-size: 100%; margin-inline-start: 0; }
  .rail .brand, .rail .spacer, .rail hr, .rail a.sec.soon { display: none; }
  .rail a.sec { flex: 1 1 0; min-inline-size: 0; padding: 0.4rem 0.1rem; overflow-wrap: anywhere; }
  main { padding-inline: 16px; padding-block-end: 1.5rem; }
}

/* ---------- the dictionary, as the panel draws it ---------- */
.iconbtn { display: inline-grid; place-items: center; inline-size: 2rem; block-size: 2rem; flex: none; border-radius: 50%; border: 0; background: none; color: var(--muted); cursor: pointer; }
.iconbtn:hover { background: var(--raised); color: var(--ink); }
.iconbtn svg.i { inline-size: 1.05rem; block-size: 1.05rem; }
.iconbtn[hidden] { display: none; }
html.dict-open { overflow: hidden; }
.mark-btn { font: inherit; color: inherit; background: none; border: 0; padding: 0; border-radius: 0.15rem; cursor: pointer; }
.mark-btn:hover { background: var(--accent-soft); }
.dict-scrim { position: fixed; inset: 0; z-index: 40; background: rgba(5, 9, 18, 0.45); }
.dict { position: fixed; inset-block: 0; inset-inline-end: 0; z-index: 41; inline-size: min(27rem, 100%); display: flex; flex-direction: column; background: var(--panel); border-inline-start: 1px solid var(--rule); box-shadow: 0 0 2.5rem rgba(5, 9, 18, 0.35); padding-block: env(safe-area-inset-top, 0px) env(safe-area-inset-bottom, 0px); padding-inline-end: env(safe-area-inset-right, 0px); }
.dict[hidden], .dict-scrim[hidden], .d-search-row[hidden] { display: none; }
.dict-top { display: flex; align-items: center; gap: 0.35rem; padding: 0.55rem 0.7rem; border-block-end: 1px solid var(--rule); }
.dict-top .spacer { flex: 1; }
.d-langs[hidden] { display: none; }
.d-langs button { font-size: 0.82rem; padding: 0.3em 0.85em; }
.d-search-row { flex: none; inline-size: auto; margin: 0.6rem 0.7rem 0; }
.dict-body { flex: 1; overflow: auto; padding: 1rem 1.15rem 1.5rem; display: grid; gap: 1.15rem; align-content: start; outline: none; }
.dict-body .hw { font-size: 1.75rem; font-weight: 700; unicode-bidi: isolate; overflow-wrap: anywhere; }
.dict-body .hw.small { font-size: 1.15rem; }
.d-head { display: grid; gap: 0.15rem; justify-items: start; }
.d-head .formof { color: var(--muted); font-size: 0.9rem; }
.d-head .d-known { margin-block-start: 0.4rem; }
.d-varieties { list-style: none; margin: 0; padding: 0; display: grid; gap: 0.25rem; }
.d-varieties li { display: flex; flex-wrap: wrap; align-items: center; gap: 0.2rem 0.5rem; }
.d-varieties .vname { color: var(--muted); font-size: 0.84rem; }
.d-varieties .ipa, .d-piece .ipa { unicode-bidi: isolate; }
.d-extra { display: flex; flex-wrap: wrap; gap: 0.3rem 1rem; margin-block-start: -0.6rem; }
.d-extra summary { cursor: pointer; font-size: 0.84rem; }
.d-howto { font: inherit; font-size: 0.84rem; background: none; border: 0; padding: 0; color: var(--accent); cursor: pointer; justify-self: start; text-align: start; overflow-wrap: anywhere; }
.d-line { display: grid; gap: 0.35rem; }
.d-line .cap { font-size: 0.8rem; color: var(--muted); }
.d-group h3 { font-size: 0.95rem; margin-block-end: 0.4rem; }
.d-group h3 button { font: inherit; font-weight: 650; color: var(--ink); background: none; border: 0; padding: 0; cursor: pointer; text-decoration: underline dotted; text-underline-offset: 0.2em; }
.d-group .group-lemma { unicode-bidi: isolate; }
.d-group.other-lemma { border-block-start: 1px solid var(--rule); padding-block-start: 0.9rem; }
.d-group ol { margin: 0; padding-inline-start: 1.3rem; display: grid; gap: 0.85rem; }
.d-group li { padding-inline-start: 0.2rem; overflow-wrap: anywhere; }
.d-group li.parent { list-style: none; margin-inline-start: -1.3rem; color: var(--muted); font-size: 0.9rem; font-style: italic; }
.d-group .tr { font-weight: 650; }
.d-group .gl { color: var(--muted); font-size: 0.92rem; }
.d-group .tagm { font: inherit; font-size: 0.78rem; color: var(--muted); background: none; border: 1px solid var(--rule); border-radius: 0.3rem; padding: 0 0.35em; margin-inline-end: 0.35em; }
.d-group .tagm.link { cursor: pointer; text-decoration: underline dotted; text-underline-offset: 0.15em; }
.d-group .points-to { color: var(--muted); font-size: 0.88rem; }
.ex { margin-block-start: 0.35rem; padding-inline-start: 0.7rem; border-inline-start: 2px solid var(--rule); font-size: 0.92rem; unicode-bidi: isolate; }
.said { padding-inline-start: 0.7rem; border-inline-start: 2px solid var(--rule); color: var(--muted); font-size: 0.88rem; unicode-bidi: isolate; }
.d-sec h2, .d-piece h2 { font-size: 0.95rem; margin-block-end: 0.35rem; }
.d-sec p, .d-sec li { font-size: 0.92rem; }
.d-sec ul { margin: 0; padding: 0; list-style: none; display: grid; gap: 0.4rem; }
.d-sec .role { color: var(--muted); }
.d-sec .pw { color: var(--muted); font-size: 0.88rem; unicode-bidi: isolate; }
.d-attrib { font-size: 0.76rem; color: var(--faint); border-block-start: 1px solid var(--rule); padding-block-start: 0.7rem; }
.d-none { color: var(--muted); }
.d-piece { display: grid; gap: 0.6rem; font-size: 0.95rem; }
.d-piece > .ipa { justify-self: start; }
.d-piece .sound { display: flex; flex-wrap: wrap; gap: 0.2rem 0.6rem; }
.d-piece .heard { color: var(--muted); font-size: 0.86rem; }
.d-report { display: grid; gap: 1rem; }
.d-report fieldset { border: 0; margin: 0; padding: 0; display: grid; gap: 0.3rem; min-inline-size: 0; }
.d-report legend { font-weight: 650; font-size: 0.95rem; margin-block-end: 0.3rem; padding: 0; }
.d-choice input { accent-color: var(--accent); }
.d-choice { display: flex; align-items: baseline; gap: 0.45rem; font-size: 0.92rem; overflow-wrap: anywhere; min-inline-size: 0; }
.d-write { display: grid; gap: 0.3rem; font-size: 0.92rem; }
.d-write textarea { font: inherit; color: var(--ink); background: var(--raised); border: 1px solid var(--rule); border-radius: var(--radius-s); padding: 0.5rem 0.6rem; resize: vertical; inline-size: 100%; }
.d-report .actions { display: flex; flex-wrap: wrap; gap: 0.5rem; justify-content: flex-end; }

/* Install buttons while the listing is Private (#592): the buttons keep their
   address and step aside; a quiet line stands in their place, and the store's
   name in the steps reads as plain text. */
[data-install="soon"] [data-install-cta] { display: none !important; }
[data-install="open"] [data-install-soon] { display: none !important; }
[data-install="soon"] a[data-install-link] { pointer-events: none; color: inherit; text-decoration: none; }
.install-soon { display: inline-flex; align-items: center; min-block-size: 2.6rem; font-weight: 600; }
