/* Shared surfaces: every application route uses the Odyssey tokens. */

img { display: block; max-width: 100%; }
input, select, textarea { font: inherit; color: inherit; caret-color: var(--cyan); }
button, a, input, select, textarea { -webkit-tap-highlight-color: transparent; }
button:disabled { cursor: not-allowed; }
[hidden] { display: none !important; }
h1, h2, h3 { overflow-wrap: anywhere; text-wrap: balance; }
.icon { display: block; width: 20px; height: 20px; flex: none; }
.btn .icon, .ghost .icon { width: 18px; height: 18px; }
.btn, .ghost, .tabs button, .rune-choice, .rune-act { min-height: 44px; }
.btn, .ghost { text-decoration: none; text-align: center; }
.btn-primary:hover:not(:disabled) { background: var(--cyan); color: var(--cyan-ink); }
.btn-ghost { background: transparent; }
.ghost[aria-current="page"] { color: var(--cyan); background: var(--cyan-soft); border-radius: var(--r-sm); }
.field { min-width: 0; }
.field > span { color: var(--ink-2); font-size: 12px; letter-spacing: 0.04em; }
.field input, .field select, .field textarea, .admin-reset input { width: 100%; min-width: 0; min-height: 44px; padding: 10px 12px; border: 1px solid var(--line-2); border-radius: var(--r-md); color: var(--ink); background: var(--surface-3); }
.field textarea { resize: vertical; }
input::placeholder, textarea::placeholder { color: var(--muted); opacity: 1; }
.field input:hover, .field select:hover, .field textarea:hover { border-color: var(--line-3); }
[aria-invalid="true"] { border-color: var(--hp) !important; }
.field-hint { color: var(--muted); font-size: 12px; margin-top: -8px; }
.section-heading { font-size: 24px; }
.lede { max-width: 65ch; color: var(--ink-2); font-size: 16px; line-height: 1.7; }
.page { width: 100%; max-width: 1360px; margin: 0 auto; padding: var(--s6) max(var(--s5), env(safe-area-inset-right)) max(80px, env(safe-area-inset-bottom)) max(var(--s5), env(safe-area-inset-left)); min-width: 0; }
.page-narrow { max-width: 1180px; display: flex; flex-direction: column; gap: var(--s5); }
.page-heading { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: var(--s4); }
.page-heading h1 { font-size: 36px; margin-bottom: var(--s2); }
.alert, .gate-error { padding: var(--s3) var(--s4); color: var(--ink); background: var(--hp-soft); border: 1px solid var(--hp); border-radius: var(--r-md); font-size: 14px; }

/* The same navigation stays in place across the teacher and pupil paths. */
.topbar { height: auto; min-height: var(--topbar-h); gap: var(--s4); padding-block: max(8px, env(safe-area-inset-top)) 8px; }
.topbar > .class-picker { flex: none; max-width: 320px; }
.topbar-welcome .top-end { width: auto; margin-left: auto; }
.topbar-welcome .ghost span { display: inline; }
.top-end { gap: var(--s2); }
.board, .single, .sheet > *, .atelier > *, .rune-card-head h3 { min-width: 0; }
.board-sub, .panel-note, .target-names { line-height: 1.6; }
.console-head { align-items: center; gap: var(--s3); }
.console-head h2 { font-size: 15px; letter-spacing: 0.05em; }
.console-head .btn { flex: none; }
.console details.panel > summary { min-height: 44px; letter-spacing: 0.05em; }
.console details.panel > summary::after { content: ""; margin-left: auto; width: 7px; height: 7px; flex: none; border-right: 1.5px solid currentColor; border-bottom: 1.5px solid currentColor; transform: rotate(45deg); }
.console details.panel[open] > summary::after { transform: rotate(225deg); }
.console .panel > .btn { margin-top: var(--s3); }
.add-form { display: flex; flex-direction: column; gap: var(--s3); }
.field-row > .field { flex: 1 1 120px; }
.hero-sheet-art { flex: none; }
.hero-sheet-facts { min-width: 0; }
.hero-sheet-top { display: flex; flex-wrap: wrap; align-items: center; gap: var(--s2); }
.gear { grid-template-columns: minmax(0, 1fr); }
.gear div { align-items: baseline; }
.gear dd { text-align: right; overflow-wrap: anywhere; }
.account-line { flex-wrap: wrap; overflow-wrap: anywhere; }
.rune-card-head h3 { letter-spacing: 0.03em; }
.lvl-seal { flex: none; }
.rune-card.is-out { opacity: 1; }
.rune-card.is-out .hero-fig { filter: grayscale(1); }
.out-tag { color: var(--void); font-weight: 700; }
:root[data-theme="light"] .out-tag { color: white; }
.picker { padding: var(--s5) 0; }
.picker-card strong { overflow-wrap: anywhere; max-width: 100%; }
.picker-card .level { font-size: 13px; }
.picker .empty { padding-block: var(--s6); }
.hero-page-heading { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: var(--s3); max-width: 1360px; margin: 0 auto var(--s5); }
.hero-page-heading h1 { font-size: clamp(26px, 3vw, 40px); max-width: 28ch; }
.equipment-details { padding-block: var(--s3); border-top: 1px solid var(--line); }
.equipment-details summary { cursor: pointer; color: var(--ink-2); min-height: 44px; padding-block: var(--s3); }
.viewer-fallback { width: 100%; height: 90%; object-fit: contain; }
/* The recovery portrait has a different crop from the live camera. Showing it
   during loading creates a false zoom jump; reserve it for actual failures. */
[data-viewer-host].is-loading .viewer-fallback { visibility: hidden; }
.viewer-recovery { position: absolute; z-index: 2; bottom: var(--s4); left: var(--s4); right: var(--s4); display: flex; align-items: center; flex-wrap: wrap; justify-content: center; gap: var(--s3); padding: var(--s3); background: var(--panel-solid); border: 1px solid var(--line); border-radius: var(--r-md); }
.viewer-recovery .viewer-error { position: static; color: var(--ink-2); }
.sheet-info > .row { order: -1; }

/* Welcome and teacher unlock use one form language. */
.gate-page { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 440px); gap: clamp(32px, 6vw, 96px); align-items: center; max-width: 1180px; min-height: calc(100dvh - var(--topbar-h)); padding-block: var(--s7) 80px; }
.gate-intro h1 { max-width: 13ch; font-size: clamp(32px, 4vw, 52px); line-height: 1.14; }
.gate-intro .lede { margin-top: var(--s5); max-width: 40ch; }
.gate-heroes { display: flex; align-items: end; justify-content: center; margin-top: var(--s5); padding-bottom: var(--s4); border-bottom: 1px solid var(--line-2); }
.gate-heroes img { width: 50%; height: clamp(180px, 24vw, 290px); object-fit: contain; }
.gate { min-width: 0; width: 100%; }
.gate-card { display: flex; flex-direction: column; gap: var(--s4); padding: var(--s6); background: var(--panel-solid); border: 1px solid var(--line-2); border-radius: var(--r-lg); }
.gate-card h1, .gate-card h2 { font-size: 30px; }
.gate-lede, .gate-help { color: var(--ink-2); font-size: 14px; line-height: 1.65; }
.gate-tabs { margin-block: var(--s2); }
.gate-tabs button { font-family: var(--font-display); font-size: 14px; font-weight: 600; }
.gate-tabs button:hover:not(:disabled) { background: var(--cyan-soft); }
.gate-tabs button:disabled { opacity: 0.6; }
.gate-form { display: flex; flex-direction: column; gap: var(--s4); }
.gate-form .btn { width: 100%; min-height: 48px; font-size: 15px; margin-top: var(--s2); }
.gate-form input { min-height: 48px; }
.gate-actions { display: flex; flex-wrap: wrap; gap: var(--s2); }
.gate-actions .btn { flex: 1 1 160px; }
.gate-badge { color: var(--cyan); }
.gate-badge .icon { width: 32px; height: 32px; }
.lock-page { max-width: 540px; padding-top: clamp(24px, 8vh, 80px); }

/* Reading surface: the game's own words, with projection-friendly measure. */
.rules { display: flex; flex-direction: column; gap: var(--s6); max-width: 880px; width: 100%; margin-inline: auto; padding: var(--s6); background: var(--panel-solid); border: 1px solid var(--line); border-radius: var(--r-lg); }
.rules-head h1 { font-size: 36px; margin-bottom: var(--s4); }
.rules-section h2 { font-size: 24px; margin-bottom: var(--s4); }
.rules-section + .rules-section { padding-top: var(--s5); border-top: 1px solid var(--line); }
.rules-list { margin: 0; padding-left: 24px; display: flex; flex-direction: column; gap: var(--s3); font-size: 16px; line-height: 1.7; color: var(--ink-2); }
.rules-list li::marker { color: var(--cyan); }

/* A shop remains in the current role and always names its hero. */
.shop-hero-summary { display: flex; align-items: center; flex-wrap: wrap; gap: var(--s3); padding-block: var(--s3); border-block: 1px solid var(--line); }
.shop-hero-summary img { object-fit: contain; }
.shop-hero-summary > strong { font-family: var(--font-display); font-size: 24px; overflow-wrap: anywhere; }
.shop-head { flex-wrap: wrap; align-items: start; gap: var(--s4); }
.shop-tabs { flex: 1 1 100%; }
.shop-tabs button { min-height: 44px; border-radius: var(--r-md); padding: 8px 12px; font-size: 13px; }
.shop-tabs button:hover { border-color: var(--cyan); background: var(--cyan-soft); }
.shop-balance { flex-wrap: wrap; font-size: 14px; }
.shop-items { grid-template-columns: repeat(auto-fill, minmax(min(100%, 176px), 1fr)); gap: var(--s4); }
.shop-item { min-width: 0; gap: var(--s3); background: var(--panel-solid); padding: var(--s3); }
.shop-item.is-equipped { border-color: var(--cyan); }
.shop-item > .btn { margin-top: auto; }
.shop-item-text strong { font-size: 14px; }
.shop-item-text small, .shop-item-description { font-size: 12px; }
.shop-thumb { position: relative; width: 100%; min-height: 132px; padding: var(--s3); color: var(--ink); background: var(--surface-3); border: 1px solid var(--line); cursor: pointer; }
.shop-thumb:hover { border-color: var(--cyan); }
.shop-thumb .item-art { width: 112px; height: 112px; object-fit: contain; }
.shop-thumb .item-tier { position: absolute; top: 8px; right: 8px; }
.title-chip, .hero-title-tag { color: var(--amber); font-family: var(--font-display); font-weight: 600; overflow-wrap: anywhere; }
.title-chip { font-size: 16px; }

/* Earned titles are a prestige ladder. The tag takes its colours from the same
 * per-title palette as the backdrop (--t-main / --t-accent, see odyssey.css):
 *   tier 1  quiet, muted lettering
 *   tier 2  coloured lettering and ornaments, a small crest on the plaque
 *   tier 3  wider ornaments, spaced lettering, a soft glow
 *   tier 4  gilded two-tone lettering between rules, a framed plaque
 *   tier 5  shimmering lettering, a radiant plaque with corner brackets */
.hero-title-tag {
  --t-text: color-mix(in srgb, var(--t-main, #8a9a8c) 72%, var(--ink));
  --t-text-2: color-mix(in srgb, var(--t-accent, #c3cdbf) 62%, var(--ink));
  display: block;
  color: var(--t-text);
  font-size: 20px;
  line-height: 1.2;
  text-align: center;
}
:root[data-theme="light"] .hero-title-tag {
  --t-text: color-mix(in srgb, var(--t-main, #8a9a8c) 56%, var(--ink));
  --t-text-2: color-mix(in srgb, var(--t-accent, #c3cdbf) 44%, var(--ink));
}
.hero-title-label { display: block; margin-bottom: 8px; font: 600 11px/1.3 var(--font-ui); text-transform: uppercase; letter-spacing: .14em; color: var(--muted); }
.hero-title-ribbon { display: flex; align-items: center; justify-content: center; gap: 6px; min-width: 0; position: relative; isolation: isolate; }
/* The name keeps its width; the ornaments give way first on narrow plaques. */
.hero-title-name { flex: 0 0 auto; max-width: 100%; overflow-wrap: anywhere; }
.title-ornament { width: 26px; height: 22px; flex: 0 1 auto; min-width: 10px; opacity: .9; }
.title-ornament:last-child { transform: scaleX(-1); }
.title-ornament .orn-gem { fill: currentColor; }
.title-ornament .orn-dot { fill: currentColor; stroke: none; }

/* Crest: the title's emblem, shown on the plaque from tier 2 upward. */
.title-glyph {
  display: block; width: 30px; height: 30px; margin: 0 auto 8px;
  background: linear-gradient(180deg, var(--t-text-2), var(--t-text));
  -webkit-mask: var(--title-emblem) center / contain no-repeat;
  mask: var(--title-emblem) center / contain no-repeat;
}
.hero-title-tag[data-title-tier="3"] .title-glyph { width: 34px; height: 34px; }
.hero-title-tag[data-title-tier="4"] .title-glyph { width: 40px; height: 40px; filter: drop-shadow(0 0 6px color-mix(in srgb, var(--t-main) 45%, transparent)); }
.hero-title-tag[data-title-tier="5"] .title-glyph { width: 46px; height: 46px; filter: drop-shadow(0 0 10px color-mix(in srgb, var(--t-main) 60%, transparent)); }

/* 1 · quiet */
.hero-title-tag[data-title-tier="1"] { --t-text: color-mix(in srgb, var(--t-main, #8a9a8c) 50%, var(--ink-2)); }
.hero-title-tag[data-title-tier="1"] .title-ornament { width: 20px; opacity: .55; }

/* 3 · spaced lettering with a soft glow */
.hero-title-tag[data-title-tier="3"] .title-ornament,
.hero-title-tag[data-title-tier="4"] .title-ornament,
.hero-title-tag[data-title-tier="5"] .title-ornament { width: 36px; height: 28px; }
.hero-title-tag[data-title-tier="3"] .hero-title-name { letter-spacing: .04em; text-shadow: 0 0 12px color-mix(in srgb, var(--t-main) 38%, transparent); }

/* 4-5 · gilded two-tone lettering between fine rules */
.hero-title-tag[data-title-tier="4"] .title-ornament,
.hero-title-tag[data-title-tier="5"] .title-ornament { color: var(--t-text-2); }
.hero-title-tag[data-title-tier="4"] .hero-title-name,
.hero-title-tag[data-title-tier="5"] .hero-title-name {
  padding-block: 4px;
  letter-spacing: .06em;
  border-block: 1px solid color-mix(in srgb, var(--t-text) 45%, transparent);
  background: linear-gradient(90deg, var(--t-text), var(--t-text-2) 50%, var(--t-text)) 0 0 / 200% 100%;
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  filter: drop-shadow(0 0 7px color-mix(in srgb, var(--t-main) 40%, transparent));
}
.hero-title-tag[data-title-tier="5"] .hero-title-name { animation: title-shine 7s linear infinite; filter: drop-shadow(0 0 10px color-mix(in srgb, var(--t-main) 55%, transparent)); }
@keyframes title-shine { to { background-position: 200% 0; } }

/* 5 · radiant glow behind the name */
.hero-title-tag[data-title-tier="5"] .hero-title-ribbon::before {
  content: "";
  position: absolute;
  z-index: -1;
  inset: -14px -22px;
  border-radius: 999px;
  background: radial-gradient(closest-side, color-mix(in srgb, var(--t-main) 34%, transparent), transparent 78%);
  pointer-events: none;
}

/* Plaque (hero sheet, dressing room, shop preview) */
.hero-title-tag[data-title-labelled] { padding: 16px 10px; font-size: clamp(26px,2.6vw,36px); background: var(--slate); border-block: 1px solid var(--line-2); position: relative; }
.hero-title-tag[data-title-labelled] .title-ornament { width: 44px; height: 32px; }
.hero-title-tag[data-title-tier="2"][data-title-labelled],
.hero-title-tag[data-title-tier="3"][data-title-labelled] { border-block-color: color-mix(in srgb, var(--t-main) 38%, var(--line-2)); }
.hero-title-tag[data-title-tier="4"][data-title-labelled] {
  background: linear-gradient(180deg, color-mix(in srgb, var(--t-main) 14%, var(--slate)), var(--slate));
  border-block-color: color-mix(in srgb, var(--t-main) 55%, transparent);
}
.hero-title-tag[data-title-tier="5"][data-title-labelled] {
  background: radial-gradient(120% 90% at 50% 0%, color-mix(in srgb, var(--t-main) 22%, var(--slate)), var(--slate) 72%);
  border-block-color: color-mix(in srgb, var(--t-accent) 55%, transparent);
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--t-main) 38%, transparent), 0 0 26px color-mix(in srgb, var(--t-main) 18%, transparent);
}
/* Corner brackets on the plaque from tier 4, gilded at tier 5. */
.hero-title-tag[data-title-tier="4"][data-title-labelled]::before,
.hero-title-tag[data-title-tier="4"][data-title-labelled]::after,
.hero-title-tag[data-title-tier="5"][data-title-labelled]::before,
.hero-title-tag[data-title-tier="5"][data-title-labelled]::after {
  content: "";
  position: absolute;
  width: 16px; height: 16px;
  border-style: solid;
  border-color: color-mix(in srgb, var(--t-text) 70%, transparent);
  pointer-events: none;
}
.hero-title-tag[data-title-tier="4"][data-title-labelled]::before,
.hero-title-tag[data-title-tier="5"][data-title-labelled]::before { top: 6px; left: 6px; border-width: 1.5px 0 0 1.5px; }
.hero-title-tag[data-title-tier="4"][data-title-labelled]::after,
.hero-title-tag[data-title-tier="5"][data-title-labelled]::after { bottom: 6px; right: 6px; border-width: 0 1.5px 1.5px 0; }
.hero-title-tag[data-title-tier="5"][data-title-labelled]::before,
.hero-title-tag[data-title-tier="5"][data-title-labelled]::after { width: 22px; height: 22px; border-color: var(--t-text-2); }

.rune-card-title { padding: 0 10px 10px; position: relative; z-index: 2; }
.workshop-identity { display: grid; grid-template-columns: minmax(0,1fr) auto; align-items: center; gap: 14px; }
.picker-info .hero-title-tag { font-size: 21px; }

/* Rules: unchanged copy, presented as a readable classroom quest sheet. */
.rules { max-width: 1040px; gap: 30px; padding: clamp(22px,4vw,48px); position: relative; }
.rules::before { content: ""; position: absolute; inset: 10px; border: 1px solid var(--line); border-radius: var(--r-md); pointer-events: none; }
.rules-head { display: grid; grid-template-columns: 64px minmax(0,1fr); align-items: start; gap: 24px; padding-bottom: 28px; border-bottom: 1px solid var(--line-2); }
.rules-head h1 { font-size: clamp(30px,3.4vw,44px); margin-bottom: 12px; }
.rules-emblem { display: grid; place-items: center; width: 64px; height: 76px; color: var(--amber); background: var(--amber-soft); border: 1px solid var(--inlay); border-radius: 3px 3px 30px 30px; }
.rules-emblem .icon { width: 34px; height: 34px; }
.rules-journey .rules-list { display: grid; grid-template-columns: 1fr 1fr; gap: 0 32px; padding: 0; list-style: none; }
.rules-journey li { padding: 14px 0 14px 22px; position: relative; border-bottom: 1px solid var(--line); }
.rules-journey li::before { content: ""; width: 6px; height: 6px; border: 1px solid var(--inlay); background: var(--cyan-soft); transform: rotate(45deg); position: absolute; top: 25px; left: 2px; }
.rules-journey li:last-child { grid-column: 1 / -1; }
.rules-rewards { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
.rules-rewards .rules-section { padding: 24px; margin: 0; border: 1px solid var(--line-2); border-radius: var(--r-md); background: var(--slate); }
.rules-rewards h2 { display: flex; align-items: center; gap: 10px; font-size: 23px; }
.rule-symbol { display: inline-flex; color: var(--cyan); }
.rule-symbol .icon { width: 25px; height: 25px; }
.rules-money .rule-symbol { color: var(--amber); }
.rules-rewards .rules-money { border-top: 3px solid var(--inlay); }
.rules-rewards .rules-xp { border-top: 3px solid var(--cyan-2); }
.rules-back { text-align: center; padding-top: 2px; }
.rules-toolbar { display: flex; flex-wrap: wrap; align-items: center; gap: var(--s3); }
.rules-toolbar .panel-note { margin: 0; color: var(--ink-2); }
.rules.is-editing .rules-toolbar { padding-bottom: var(--s3); border-bottom: 1px solid var(--line); }
.rules-change { color: var(--ink-2); border: 1px solid var(--line-2); background: var(--panel); }
.rules-change:hover { color: var(--cyan); border-color: var(--cyan-2); background: var(--cyan-soft); }
.rules-empty { color: var(--muted); font-style: italic; }
.rules-list.rules-edit-list { list-style: none; padding-left: 0; }
.rules-journey .rules-edit-list { grid-template-columns: 1fr; }
.rule-edit { display: flex; align-items: center; gap: var(--s2); }
.rules-journey li.rule-edit, .rules-journey li.rule-add, .rules-journey li.rule-empty { grid-column: 1 / -1; }
.rules-journey li.rule-edit::before, .rules-journey li.rule-add::before, .rules-journey li.rule-empty::before { content: none; }
.rule-edit-open { display: flex; flex: 1 1 auto; align-items: center; justify-content: space-between; gap: var(--s3); min-width: 0; min-height: 44px; padding: 8px 10px; font: inherit; text-align: left; color: inherit; background: transparent; border: 1px solid transparent; border-radius: var(--r-sm); cursor: pointer; }
.rule-edit-open:hover, .rule-edit-open:focus-visible { border-color: var(--line-2); background: var(--surface-3, var(--slate)); }
.rule-edit-text { flex: 1 1 auto; min-width: 0; }
.rule-edit-mark { display: inline-flex; flex: none; color: var(--ink-2); opacity: 0.75; }
.rule-edit-open:hover .rule-edit-mark, .rule-edit-open:focus-visible .rule-edit-mark { color: var(--cyan); opacity: 1; }
.rule-remove { display: grid; place-items: center; flex: none; width: 44px; height: 44px; padding: 0; font: inherit; color: var(--ink-2); background: transparent; border: 1px solid transparent; border-radius: var(--r-sm); cursor: pointer; }
.rule-remove:hover, .rule-remove:focus-visible { color: var(--hp); background: var(--hp-soft); }
.rule-empty { color: var(--muted); font-style: italic; }
.rule-add .btn { border: 1px dashed var(--line-2); background: transparent; color: var(--cyan); }
.dialog-rule { width: min(520px, calc(100vw - 32px)); }
.dialog-rule h2 { padding-right: 32px; }
.rule-form { display: flex; flex-direction: column; gap: 16px; margin-top: 18px; }
.rule-form .field > span { display: block; margin-bottom: 6px; }
.rule-form .row { display: flex; justify-content: flex-end; gap: var(--s3); }

/* Account settings: profile, password recovery and help live in the console. */
.account-reset { margin-top: 12px; }
.account-reset > summary { cursor: pointer; color: var(--cyan); font-weight: 600; }
.account-reset[open] > summary { margin-bottom: 8px; }
.account-reset .access-form { margin-top: 12px; }
.dialog-help { width: min(520px, calc(100vw - 32px)); }
.dialog-help h2 { padding-right: 32px; }
.help-form { display: flex; flex-direction: column; gap: 16px; margin-top: 18px; }
.help-form .row { display: flex; justify-content: flex-end; gap: var(--s3); }
.dialog-reset { width: min(480px, calc(100vw - 32px)); }
.dialog-reset h2 { padding-right: 32px; }
.dialog-reset .access-form { margin-top: 18px; }
.welcome-forgot { align-self: flex-start; margin-top: 10px; padding: 0; font: inherit; color: var(--cyan); background: none; border: 0; cursor: pointer; text-decoration: underline; }
.welcome-forgot:hover, .welcome-forgot:focus-visible { color: var(--ink); }
@media (max-width: 640px) {
  .rules-head { grid-template-columns: 42px minmax(0,1fr); gap: 14px; }
  .rules-emblem { width: 42px; height: 54px; }
  .rules-emblem .icon { width: 26px; height: 26px; }
  .rules-journey .rules-list, .rules-rewards { grid-template-columns: 1fr; }
  .rules-rewards .rules-section { padding: 18px; }
  .picker-info .hero-title-tag { font-size: 17px; }
  .picker-info .title-ornament { width: 18px; }
}
.item-meta { display: flex; flex-wrap: wrap; gap: var(--s2); justify-content: center; }
.rarity-label { color: var(--amber); font-weight: 600; }
.custom-orders ul { list-style: none; margin: 0; padding: 0; }
.custom-orders li { display: flex; flex-direction: column; gap: var(--s1); padding-block: var(--s3); border-bottom: 1px solid var(--line); overflow-wrap: anywhere; }
.custom-orders time { color: var(--muted); font-size: 12px; }
.console .shop-items { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--s2); }
.console .shop-thumb { min-height: 100px; }
.console .shop-thumb .item-art { height: 88px; }

/* Account administration shares the form and table tokens. */
.admin-page { max-width: 1440px; }
.admin-card { min-width: 0; padding: var(--s5); background: var(--panel-solid); border: 1px solid var(--line); border-radius: var(--r-lg); }
.admin-email { display: block; color: var(--muted); font-size: 12px; }
.admin-heading { display: flex; justify-content: space-between; align-items: center; gap: var(--s4); margin-bottom: var(--s5); }
.admin-heading h1 { font-size: 32px; }
.admin-heading p { margin-top: var(--s2); }
.admin-table-wrap { overflow-x: auto; }
.admin-table { width: 100%; border-collapse: collapse; font-size: 13px; font-variant-numeric: tabular-nums; }
.admin-table th, .admin-table td { text-align: left; vertical-align: middle; padding: var(--s3); border-bottom: 1px solid var(--line); }
.admin-table th { color: var(--muted); font-weight: 500; }
.admin-table td { overflow-wrap: anywhere; }
.admin-reset { display: flex; gap: var(--s2); align-items: center; min-width: 260px; }
.admin-reset input { width: 150px; }
.admin-reset .btn { flex: none; }
.admin-empty { padding-block: var(--s5); color: var(--ink-2); }

@media (min-width: 1021px) and (max-width: 1480px) {
  .brand-sub { display: none; }
}
@media (min-width: 1021px) and (max-width: 1250px) {
  .topbar .top-end > .ghost span { display: none; }
  .topbar .top-end > .ghost { min-width: 44px; justify-content: center; }
}
@media (max-width: 1020px) {
  .topbar .top-end > .tabs { flex: 1; }
  .topbar [data-action="show-rules"] span, .topbar [data-action="show-admin"] span { display: inline; }
}
@media (min-width: 800px) and (max-width: 1180px) {
  .sheet, .atelier { grid-template-columns: minmax(0, 1fr) minmax(0, 360px); grid-template-rows: auto 1fr; grid-template-areas: "stage heading" "stage info"; }
}
@media (max-width: 800px) {
  .gate-page { grid-template-columns: minmax(0, 1fr); gap: var(--s5); max-width: 540px; min-height: 0; padding-top: var(--s5); }
  .gate-intro h1 { max-width: 20ch; font-size: 32px; }
  .gate-intro .lede { margin-top: var(--s3); font-size: 14px; }
  .gate-heroes { display: none; }
  .admin-table, .admin-table tbody { display: block; }
  .admin-table thead { position: absolute; width: 1px; height: 1px; clip-path: inset(50%); overflow: hidden; }
  .admin-table tr { display: block; padding-block: var(--s4); border-bottom: 1px solid var(--line-2); }
  .admin-table td { display: grid; grid-template-columns: minmax(100px, 0.8fr) minmax(0, 1fr); gap: var(--s3); padding: var(--s2) 0; border: 0; }
  .admin-table td::before { content: attr(data-label); color: var(--muted); }
  .admin-table td:last-child { grid-template-columns: minmax(0, 1fr); }
  .admin-reset { min-width: 0; flex-wrap: wrap; }
  .admin-reset input { flex: 1 1 140px; }
}
@media (max-width: 720px) {
  .page { padding-inline: max(var(--s4), env(safe-area-inset-left)) max(var(--s4), env(safe-area-inset-right)); }
  .gate-card, .rules, .admin-card { padding: var(--s5); }
  .page-heading h1, .rules-head h1 { font-size: 30px; }
  .shop-items { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--s3); }
  .sheet-stats { gap: var(--s4); }
  .sheet-stats .stat b { font-size: 18px; }
  .base-character-controls button { min-height: 44px; }
  .dais-lg { height: 260px; }
  .hero-page-heading h1 { font-size: 26px; }
  .sheet-stage .angle-bar, .atelier-stage .angle-bar { gap: var(--s1); }
  .angle-bar button { padding: 6px 9px; font-size: 10px; }
  input, select, textarea, .search input { font-size: 16px; }
}
@media (max-width: 520px) {
  .topbar .top-end { flex-wrap: wrap; justify-content: flex-end; }
  .topbar .top-end > .tabs { flex: 1 0 100%; }
  .topbar-welcome .top-end { flex: 0; }
  .gate-card, .rules, .admin-card { padding: var(--s4); }
  .gate-card h1, .gate-card h2 { font-size: 26px; }
  .shop-hero-summary > strong { font-size: 20px; }
  .shop-item { padding: var(--s2); }
  .shop-thumb { padding: var(--s2); }
}
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
}

#language-switcher {
  position: fixed;
  right: max(12px, env(safe-area-inset-right));
  bottom: max(12px, env(safe-area-inset-bottom));
  z-index: 90;
}

/* The flag is a welcome-page affordance. Once signed in, the language is the
 * one chosen at setup and can only be changed from the account settings, so
 * the floating control is hidden everywhere in the account. */
html[data-signed-in="true"] #language-switcher { display: none; }

body:has(.layout) #language-switcher {
  bottom: max(76px, calc(64px + env(safe-area-inset-bottom)));
}

#lang-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  min-width: 44px;
  min-height: 44px;
  padding: 0 12px;
  font: 700 12px/1 var(--font-display, system-ui);
  letter-spacing: 0.08em;
  color: var(--ink);
  background: var(--surface-1, var(--panel-solid));
  border: 1px solid var(--line-strong, var(--line-2));
  border-radius: var(--r-md, 8px);
  box-shadow: 0 8px 24px rgba(3, 9, 20, 0.22);
  cursor: pointer;
}

/* Mini-drapeau du pays vers lequel la bascule mène. */
#lang-toggle .lang-flag { display: none; }
#lang-toggle .lang-flag svg { display: block; width: 20px; height: 14px; border-radius: 2px; }
html[lang="fr"] #lang-toggle .lang-flag-en,
html[lang="en"] #lang-toggle .lang-flag-fr { display: block; }
#lang-toggle:hover { border-color: var(--cyan); }

.hearts { display: flex; gap: 3px; }
.hp-heart { display: block; width: 22px; height: 21px; flex: none; }
.xp { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.xp-track { display: block; height: 10px; background: var(--surface-3, var(--slate)); border: 1px solid var(--line); border-radius: 999px; overflow: hidden; }
.xp-fill { display: block; height: 100%; background: linear-gradient(90deg, var(--xp, var(--cyan)), color-mix(in srgb, var(--xp, var(--cyan)) 65%, white)); border-radius: inherit; }
.xp-label { color: var(--ink-muted, var(--muted)); font-size: 13px; }
.xp-label strong { color: var(--ink); }
.money { display: inline-flex; align-items: center; gap: 4px; width: fit-content; color: var(--money, var(--amber)); font-weight: 700; }
.money .coin { display: block; width: 20px; height: 20px; flex: none; }
.level { display: inline-flex; align-items: baseline; gap: 4px; width: fit-content; padding: 2px 8px; color: var(--rank, var(--cyan)); background: var(--rank-dim, var(--cyan-soft)); border: 1px solid var(--line-2); border-radius: var(--r-sm, 4px); }
.level-word { font-size: 12px; font-weight: 700; letter-spacing: 0.08em; }
.level strong { font-family: var(--font-display); font-size: 22px; line-height: 1; font-variant-numeric: tabular-nums; }
.out-badge { position: absolute; inset: auto 12px 12px; padding: 4px 8px; text-align: center; color: #fff; background: var(--hp); border-radius: var(--r-sm, 4px); }

.dialog {
  position: relative;
  max-width: min(880px, calc(100vw - 24px));
  max-height: min(90vh, 90dvh);
  padding: 24px;
  color: var(--ink);
  background: var(--surface-1, var(--panel-solid));
  border: 1px solid var(--line-strong, var(--line-2));
  border-radius: var(--r-lg, 12px);
  box-shadow: 0 18px 44px rgba(3, 9, 20, 0.6);
  overflow: auto;
}

dialog.dialog:not([open]) { display: none; }
.dialog::backdrop { background: rgba(4, 10, 20, 0.78); }
.dialog-add-pupil { width: min(460px, calc(100vw - 32px)); padding: 30px; }
.dialog-add-pupil h2 { padding-right: 32px; }
.dialog-add-pupil form { display: flex; flex-direction: column; gap: 20px; margin-top: 20px; }
.dialog-add-pupil .field-row { align-items: stretch; }
.dialog-add-pupil .field-row .field { flex: 1; min-width: 0; }
.dialog-onboarding { width: min(460px, calc(100vw - 32px)); }
.dialog-onboarding h2 { padding-right: 32px; }
.dialog-onboarding .panel-note { margin: 10px 0 0; }
.dialog-onboarding .row { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: var(--s3); margin-top: 22px; }
.onboarding-choices { display: flex; gap: var(--s3); margin-top: 18px; }
.onboarding-choices .btn { flex: 1; }
.onboarding-choices .btn.is-active { background: var(--cyan-soft); border-color: var(--cyan); color: var(--ink); }
.class-picker-add { display: flex; align-items: center; gap: 8px; width: 100%; padding: 10px 12px; margin-top: 6px; color: var(--cyan); background: transparent; border-top: 1px solid var(--line); }
.console-head { flex-wrap: wrap; gap: 8px; }
.console-history { display: flex; justify-content: flex-end; margin: 8px 0; }
/* Dressing and Shop share one back control, placed top-left in their header. */
.btn-back { align-self: flex-start; margin: 0 0 var(--s4); padding: 10px 16px; gap: 10px; font-weight: 600; color: var(--cyan); border: 1px solid var(--cyan-2); background: var(--panel); }
.btn-back:hover { background: var(--cyan-soft); border-color: var(--cyan); }
.hero-class-return .btn { color: var(--ink-2); }
.target-actions { justify-content: flex-start; }
.target-actions .btn { background: var(--panel); border: 1px solid var(--line-2); min-height: 40px; padding: 8px 12px; text-decoration: none; }
.target-actions .btn:hover:not(:disabled) { border-color: var(--cyan-2); background: var(--cyan-soft); }
.target-actions .btn.is-active { background: var(--selected); color: var(--on-selected); border-color: var(--selected); }
.rune-card-foot .rune-act { background: transparent; color: var(--cyan-2); }
.rune-card-foot .rune-act:hover { background: var(--cyan-soft); color: var(--ink); }
.rune-card-foot .rune-act:active { background: var(--selected); color: var(--on-selected); }
.picker h1[tabindex="-1"]:focus { outline: none; }
.teacher-console-tab {
  position: fixed; z-index: 31; right: 0; top: max(calc(var(--topbar-h) + 12px), calc(50dvh - 96px));
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 10px; width: 52px; padding: 16px 10px; min-height: 176px;
  border: 2px solid var(--console-edge, var(--cyan-2)); border-right: 0; border-radius: 12px 0 0 12px;
  background: linear-gradient(180deg, color-mix(in srgb, var(--cyan) 16%, var(--panel-solid)), var(--panel-solid));
  color: var(--cyan); cursor: pointer;
  box-shadow: -4px 4px 16px rgb(0 0 0 / 22%);
}
.teacher-console-tab span { writing-mode: vertical-rl; font: 700 14px/1.2 var(--font-ui); letter-spacing: .04em; }
.teacher-console-tab:hover { background: var(--cyan-soft); border-color: var(--cyan); }
.teacher-console-tab:focus-visible { outline-offset: -4px; }
.teacher-console-dialog {
  position: fixed; inset: 0 0 0 auto; margin: 0;
  width: min(480px,calc(100vw - 52px)); max-width: none;
  height: 100dvh; max-height: 100dvh; padding: 24px;
  border-left: 1px solid var(--line-2);
  background:
    linear-gradient(180deg, color-mix(in srgb, var(--cyan) 7%, transparent), transparent 260px),
    var(--surface-1, var(--panel-solid));
  box-shadow: -18px 0 44px rgb(0 0 0 / 28%), inset 2px 0 0 -1px var(--console-edge, var(--cyan-2));
  border-radius: 12px 0 0 12px; overflow: hidden; z-index: 45;
}
.teacher-session-status { min-height: 18px; padding-top: 10px; color: var(--muted); font-size: 12px; }
.teacher-session-lock { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; padding-top: 10px; }
.teacher-session-lock .teacher-session-status { padding-top: 0; }
.hero-class-return { margin-top: 12px; padding-top: 16px; border-top: 1px solid var(--line); }
body[data-teacher-panel="open"] .teacher-console-tab { z-index: 46; right: min(480px,calc(100vw - 44px)); }
@media (min-width: 1101px) {
  body[data-teacher-panel="open"] #app { margin-right: 480px; }
  body[data-teacher-panel="open"] #language-switcher { right: 496px; }
}
/* On narrow screens, keep part of the class visible and interactive. */
@media (max-width: 720px) {
  body[data-teacher-panel="open"] #app { padding-bottom: 52dvh; }
  .teacher-console-dialog {
    inset: auto 0 0 auto; width: 100%; height: 52dvh; max-height: 52dvh;
    padding: 16px; border-radius: 12px 12px 0 0;
    border-left: 1px solid var(--line-2);
    box-shadow: 0 -18px 44px rgb(0 0 0 / 32%), inset 0 2px 0 -1px var(--console-edge, var(--cyan-2));
  }
  .teacher-console-dialog::before {
    content: ""; position: absolute; top: 7px; left: 50%; width: 58px; height: 5px;
    transform: translateX(-50%); border-radius: var(--r-pill);
    background: var(--console-edge, var(--cyan-2)); opacity: 0.85;
  }
  body[data-teacher-panel="open"] .teacher-console-tab { right: 0; top: calc(48dvh - 44px); width: auto; min-height: 44px; height: 44px; flex-direction: row; padding: 8px 14px; border-radius: 8px 0 0 0; }
  body[data-teacher-panel="open"] .teacher-console-tab span { writing-mode: horizontal-tb; }
  body[data-teacher-panel="open"] #language-switcher { bottom: calc(52dvh + 56px); }
}
/* Keep the close control clear of the drawer's own scroll rail. */
.teacher-console-dialog .dialog-close { right: calc(var(--scroll-page, 22px) + 22px); }
.teacher-console-dialog .console-head {
  display: grid; grid-template-columns: minmax(0,1fr) auto; align-items: center;
  padding: 0 calc(var(--scroll-page, 22px) + 62px) var(--s3) 0;
  background: linear-gradient(90deg, color-mix(in srgb, var(--cyan) 14%, transparent), transparent 92%);
  border-bottom: 2px solid var(--console-edge, var(--cyan-2));
}
.teacher-console-dialog .console-head h2 { min-width: 0; font-size: clamp(17px,1.7vw,20px); letter-spacing: 0.04em; }
.teacher-console-content { height: 100%; max-height: none; overflow: auto; padding-right: 6px; }
.teacher-console-dialog details.panel { margin-top: 12px; border-top: 1px solid var(--line); padding-top: 12px; }
.teacher-console-dialog details.panel > summary { padding-block: 10px; }
.teacher-console-dialog details.panel > summary { display: flex; align-items: center; gap: 8px; list-style: none; cursor: pointer; color: var(--ink-2); }
.teacher-console-dialog details.panel > summary::-webkit-details-marker { display: none; }
.teacher-console-dialog details.panel > summary .icon { width: 16px; height: 16px; color: var(--cyan-2); }
.teacher-unlock-dialog { width: min(490px,calc(100vw - 24px)); padding: 20px; }
.teacher-unlock-dialog .gate { margin: 0; padding: 0; }
.teacher-unlock-dialog .gate-card { border: 0; padding: 24px 14px; }
.teacher-target { margin-block: 12px; }

/* One navigation row on every screen; the logo returns to the class roster. */
.topbar:not(.topbar-welcome) { flex-wrap: nowrap; }
.brand-home { display: flex; align-items: center; min-height: 44px; border: 0; background: none; padding: 0; cursor: pointer; }
.topbar:not(.topbar-welcome) .top-end { width: auto; flex: 0 0 auto; flex-wrap: nowrap; margin-left: auto; }
@media (max-width: 720px) {
  .topbar:not(.topbar-welcome) { gap: 4px; padding: 8px; min-height: 64px; }
  .topbar:not(.topbar-welcome) .brand-logo { width: clamp(70px,23vw,100px); height: auto; }
  .topbar:not(.topbar-welcome) > .class-picker { margin-left: auto; }
  .topbar:not(.topbar-welcome) .class-picker-summary { min-height: 40px; padding: 6px 12px; }
  .topbar:not(.topbar-welcome) .top-end { gap: 0; margin-left: 0; }
  .topbar:not(.topbar-welcome) .top-end > .ghost { width: 40px; padding: 8px; }
  .topbar:not(.topbar-welcome) .top-end > .ghost > span { display: none; }
  .topbar:not(.topbar-welcome) .top-end > .ghost[data-action="show-rules"] { width: auto; gap: 4px; }
  .topbar:not(.topbar-welcome) .top-end > .ghost[data-action="show-rules"] > span { display: inline; }
  .topbar:not(.topbar-welcome) .tablet-tools > summary { width: 40px; padding: 8px; }
}
@media (max-width: 359px) {
  .topbar:not(.topbar-welcome) .top-end > .ghost[data-action="show-rules"] { width: 40px; }
  .topbar:not(.topbar-welcome) .top-end > .ghost[data-action="show-rules"] > span { display: none; }
}

.dialog-close {
  position: absolute;
  z-index: 5;
  top: 12px;
  right: 12px;
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  color: var(--ink-muted, var(--muted));
  background: var(--surface-2, var(--slate-3));
  border: 1px solid var(--line);
  border-radius: var(--r-sm, 4px);
  cursor: pointer;
}

.dialog-close:hover { color: var(--ink); }
.dialog-hero { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 360px); gap: 24px; align-items: center; padding-top: 8px; }
.dialog-hero-art { position: relative; display: grid; place-items: end center; min-width: 0; min-height: 320px; background: var(--surface-3, var(--slate)); border: 1px solid var(--line); border-radius: var(--r-md, 8px); overflow: hidden; }
.dialog-hero-facts { display: flex; flex-direction: column; gap: 12px; min-width: 0; }
.dialog-hero-facts h2 { padding-right: 44px; font-size: 28px; }
.dialog-item { display: flex; flex-direction: column; align-items: center; gap: 12px; text-align: center; }
.dialog-item h2 { padding-inline: 44px; font-family: var(--font-display); font-size: 22px; }
.dialog-item-art { position: relative; display: grid; place-items: center; width: min(100%, 320px); min-height: 200px; padding: 16px; background: var(--surface-3, var(--slate)); border: 1px solid var(--line); border-radius: var(--r-md, 8px); overflow: hidden; }
.dialog-item-art.is-hero-preview { height: min(52vh, 380px); padding: 8px 16px 0; }
.dialog-item-art.is-hero-preview .avatar { width: 100%; height: 100%; }
.dialog-item-art .item-art { width: min(100%, 180px); height: auto; max-height: 180px; }
.dialog-status, .dialog-item-description { color: var(--ink-2); }
.dialog-item-description { max-width: 48ch; }
.bespoke-order-form { display: flex; flex-direction: column; gap: 12px; width: min(100%, 440px); text-align: left; }
.preview-title { position: absolute; left: 50%; bottom: 12px; transform: translateX(-50%); max-width: calc(100% - 16px); padding: 8px 12px; color: var(--money, var(--amber)); background: var(--surface-1, var(--panel-solid)); border: 1px solid currentColor; border-radius: var(--r-sm, 4px); }

@media (max-width: 720px) {
  .dialog { width: calc(100vw - 16px); padding: 16px; }
  .dialog-hero { grid-template-columns: minmax(0, 1fr); }
  .dialog-hero-art { min-height: 240px; }
}

#toasts { width: max-content; max-width: calc(100vw - 32px); bottom: max(20px, env(safe-area-inset-bottom)); pointer-events: none; }
.toast { overflow-wrap: anywhere; }
.toast-error, .toast-warn { border-color: var(--hp); }
.toast-success { border-color: var(--ok); }
.toast-coin, .toast-levelup { border-color: var(--amber); }
@media (max-width: 1180px) {
  body:has(.layout) #toasts { bottom: calc(76px + env(safe-area-inset-bottom)); }
  .console { overflow: hidden; }
}

/* ---------- Discreet application footer ---------- */

#app { position: relative; }
.app-footer {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 6px var(--s5);
  width: 100%;
  max-width: 1360px;
  margin: 0 auto;
  padding: var(--s5) max(var(--s5), env(safe-area-inset-right)) max(var(--s5), env(safe-area-inset-bottom)) max(var(--s5), env(safe-area-inset-left));
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 12.5px;
  line-height: 1.5;
  text-align: center;
}
.app-footer-copy { margin: 0; }
.app-footer-links { display: flex; align-items: center; gap: var(--s2); }
.app-footer-links a { color: var(--muted); text-decoration: none; text-underline-offset: 3px; }
.app-footer-links a:hover { color: var(--cyan); text-decoration: underline; }
.app-footer-cookie { padding: 0; border: 0; background: none; color: var(--muted); font: inherit; cursor: pointer; text-underline-offset: 3px; }
.app-footer-cookie:hover { color: var(--cyan); text-decoration: underline; }
.app-footer-dot { color: var(--line-3); }

/* On the full-height landing page the footer floats at the very bottom,
   without adding a scrollbar to an otherwise static screen. */
#app[data-view="welcome"] .app-footer {
  position: absolute;
  right: 0;
  bottom: 0;
  left: 0;
  z-index: 20;
  padding-block: var(--s3);
  border-top: 0;
  background: linear-gradient(0deg, rgba(231, 233, 223, 0.9), rgba(231, 233, 223, 0));
  color: #566552;
}
:root[data-theme="dark"] #app[data-view="welcome"] .app-footer {
  background: linear-gradient(0deg, rgba(16, 27, 32, 0.86), rgba(16, 27, 32, 0));
}

/* ---------- Legal documents ---------- */

.legal-page { max-width: 900px; }
.legal { display: flex; flex-direction: column; gap: var(--s5); padding: clamp(22px, 4vw, 48px); background: var(--panel-solid); border: 1px solid var(--line); border-radius: var(--r-lg); }
.legal-head { padding-bottom: var(--s4); border-bottom: 1px solid var(--line-2); }
.legal-kicker { margin-bottom: var(--s2); font-family: var(--font-display); font-size: 12px; font-weight: 600; letter-spacing: 0.14em; text-transform: uppercase; color: var(--amber); }
.legal-head h1 { margin-bottom: var(--s3); font-size: clamp(30px, 3.4vw, 44px); }
.legal-updated { margin-top: var(--s3); color: var(--muted); font-size: 13px; }
.legal-section h2 { font-size: 21px; }
.legal-section h3 { margin: var(--s4) 0 var(--s2); font-size: 16px; color: var(--ink); }
.legal-section p { color: var(--ink-2); line-height: 1.7; }
.legal-section p + p { margin-top: var(--s3); }
.legal-section ul { display: flex; flex-direction: column; gap: var(--s2); margin: var(--s3) 0 0; padding-left: 22px; color: var(--ink-2); line-height: 1.65; }
.legal-section a { color: var(--cyan-2); text-underline-offset: 3px; overflow-wrap: anywhere; }
.legal-section a:hover { color: var(--cyan); }
.legal-note { margin-top: var(--s3); font-size: 13px; color: var(--muted); }
@media (max-width: 720px) {
  .legal { padding: var(--s5); }
  .legal-section h2 { font-size: 19px; }
}

/* Consentement aux textes légaux (comptes créés via Google). */
.consent-page { align-items: center; }
.consent-card { width: min(560px, 100%); margin: var(--s6) 0; padding: var(--s5); display: flex; flex-direction: column; gap: var(--s4); background: var(--panel-solid); border: 1px solid var(--line); border-radius: var(--r-lg); }
.consent-card h1 { margin: 0; font-size: clamp(24px,3vw,32px); }
.consent-card > p { margin: 0; color: var(--muted); line-height: 1.6; }
.consent-check { display: flex; align-items: flex-start; gap: 10px; font-size: 15px; line-height: 1.55; color: var(--ink-2); }
.consent-check input { width: 18px; height: 18px; margin-top: 2px; flex: none; accent-color: var(--cyan); }
.consent-check a { color: inherit; text-decoration: underline; text-underline-offset: 2px; }
.consent-actions { display: flex; flex-wrap: wrap; gap: var(--s3); }

/* Class opening: every hero portrait is rendered before the board appears. */
.class-loading { display: grid; place-items: center; min-height: 60vh; }
.class-loading-card { display: flex; flex-direction: column; align-items: center; gap: 12px; width: min(420px, 100%); padding: 28px 24px; text-align: center; background: var(--surface-1, var(--panel-solid)); border: 1px solid var(--line-2); border-radius: var(--r-lg, 8px); }
.class-loading-card h1 { margin: 0; font-family: var(--font-display); font-size: 24px; }
.class-loading-name { margin: 0; color: var(--amber); font-family: var(--font-display); font-weight: 600; overflow-wrap: anywhere; }
.class-loading-track { position: relative; width: 100%; height: 12px; overflow: hidden; background: var(--surface-3, var(--slate)); border: 1px solid var(--line); border-radius: 999px; }
.class-loading-track > i { display: block; height: 100%; width: 0; background: linear-gradient(90deg, var(--cyan), color-mix(in srgb, var(--cyan) 60%, white)); border-radius: inherit; transition: width 240ms ease; }
.class-loading-count { margin: 0; color: var(--ink); font-size: 14px; font-weight: 600; font-variant-numeric: tabular-nums; }
.class-loading-hint { margin: 0; color: var(--muted); font-size: 12px; line-height: 1.5; }

/* Beta notice: a slim, calm strip under the top bar. Visible on every
 * signed-in class page without competing with the heroes. */
.beta-notice { display: flex; align-items: center; gap: 12px; max-width: 1240px; margin: 10px auto 0; padding: 7px 8px 7px 12px; width: calc(100% - 32px); color: var(--ink-muted, var(--muted)); background: color-mix(in srgb, var(--amber) 7%, transparent); border: 1px solid color-mix(in srgb, var(--amber) 28%, transparent); border-radius: var(--r-lg, 8px); font-size: 13px; line-height: 1.4; }
.beta-tag { flex: none; padding: 2px 8px; color: var(--amber); border: 1px solid currentColor; border-radius: 999px; font-family: var(--font-display); font-size: 11px; font-weight: 700; letter-spacing: 0.12em; text-transform: uppercase; }
.beta-text { flex: 1; min-width: 0; margin: 0; }
.beta-actions { display: flex; flex: none; gap: 6px; }
.beta-btn { gap: 6px; white-space: nowrap; }
.beta-btn .icon { width: 16px; height: 16px; }
.beta-btn-coffee { color: var(--amber); border-color: color-mix(in srgb, var(--amber) 45%, transparent); }
@media (max-width: 820px) {
  .beta-notice { flex-wrap: wrap; }
  .beta-text { flex-basis: calc(100% - 70px); font-size: 12px; }
  .beta-actions { width: 100%; justify-content: flex-end; }
}

.dialog-bug h2, .dialog-coffee h2 { display: flex; align-items: center; gap: 10px; padding-right: 48px; }
.dialog-bug h2 .icon, .dialog-coffee h2 .icon { flex: none; width: 24px; height: 24px; color: var(--amber); }
.dialog-bug, .dialog-coffee { width: min(520px, calc(100vw - 24px)); }
.beta-context-note { font-size: 12px; opacity: 0.85; }
.coffee-step { margin: 16px 0 0; padding: 0; border: 0; }
.coffee-step legend { margin-bottom: 8px; padding: 0; color: var(--ink); font-weight: 600; font-size: 14px; }
.coffee-tiers { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
.coffee-tier { position: relative; display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 14px 8px; color: var(--ink); text-align: center; cursor: pointer; background: var(--surface-2, var(--slate-3)); border: 1px solid var(--line-2); border-radius: var(--r-lg, 8px); transition: border-color 160ms ease, box-shadow 160ms ease; }
.coffee-tier input { position: absolute; opacity: 0; pointer-events: none; }
.coffee-tier:hover { border-color: var(--amber); }
.coffee-tier:has(input:checked) { border-color: var(--amber); box-shadow: inset 0 0 0 1px var(--amber); background: color-mix(in srgb, var(--amber) 10%, var(--surface-2, var(--slate-3))); }
.coffee-tier:has(input:focus-visible) { outline: 2px solid var(--amber); outline-offset: 2px; }
.coffee-tier strong { color: var(--amber); font-family: var(--font-display); font-size: 22px; }
.coffee-tier span { color: var(--ink-muted, var(--muted)); font-size: 12px; }
.coffee-methods { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
.coffee-method { flex-direction: column; justify-content: center; gap: 2px; min-height: 52px; }
.coffee-method small { font-size: 11px; font-weight: 500; opacity: 0.75; }
.coffee-method[aria-disabled="true"] { opacity: 0.6; }
.coffee-method-card { color: var(--on-action, #fff); background: var(--action, var(--cyan)); border-color: var(--action, var(--cyan)); }
@media (max-width: 480px) { .coffee-tiers, .coffee-methods { grid-template-columns: 1fr; } }
.coffee-secure { font-size: 12px; }
