/* ============================================================
   Class Odyssey — Tablette Sheikah
   Inventaire gravé : une dalle minérale, des héros en pied, des
   sceaux de niveau et une encre d'activation. Au jour : calcaire,
   céladon et bronze. La nuit : schiste et gravures bleu-vert.
   Les inscriptions sont réservées aux articulations de la tablette;
   la couleur active désigne toujours un choix ou une progression.
   ============================================================ */

:root {
  color-scheme: dark;

  --void: #101b20;
  --slate: #152329;
  --slate-2: #1b2c32;
  --slate-3: #24383d;
  --panel: #1b2c32;
  --panel-solid: #1b2c32;
  --stage: #233a3e;
  --stage-line: #405959;
  --inlay: #ac9b73;
  --selected: #80cfca;
  --on-selected: #102e32;

  --line: rgba(98, 200, 224, 0.14);
  --line-2: rgba(98, 200, 224, 0.30);
  --line-3: rgba(98, 200, 224, 0.52);

  --cyan: #8adbd3;
  --cyan-2: #85bdbb;
  --cyan-soft: rgba(95, 224, 240, 0.12);
  --cyan-ink: #06222a;

  --amber: #f0a94a;
  --amber-soft: rgba(240, 169, 74, 0.14);

  --ink: #e4f5fb;
  --ink-2: #bbcdcf;
  --muted: #99b1b4;

  --hp: #ff6f5c;
  --hp-soft: rgba(255, 111, 92, 0.14);
  --ok: #5fe0a0;

  /* Shared components use the classic semantic names. */
  --surface-1: var(--panel-solid);
  --surface-2: var(--slate-3);
  --surface-3: var(--slate);
  --surface-hover: var(--slate-3);
  --line-strong: var(--line-2);
  --ink-muted: var(--muted);
  --xp: var(--cyan);
  --xp-dim: var(--cyan-soft);
  --money: var(--amber);
  --money-dim: var(--amber-soft);
  --action: var(--cyan);
  --on-action: var(--cyan-ink);
  --rank: var(--amber);
  --rank-dim: var(--amber-soft);
  --shadow-2: 0 18px 44px rgba(3, 9, 20, 0.6);
  --t-xs: 0.75rem;
  --t-sm: 0.875rem;
  --t-lg: 1.125rem;

  --s1: 4px; --s2: 8px; --s3: 12px; --s4: 16px; --s5: 24px; --s6: 32px; --s7: 48px;

  --r-sm: 2px; --r-md: 4px; --r-lg: 6px; --r-pill: 999px;

  --font-display: "Chakra Petch", ui-sans-serif, system-ui, sans-serif;
  --font-ui: "Barlow", ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;

  --ease: cubic-bezier(0.2, 0.8, 0.25, 1);
  --topbar-h: 80px;
}

*, *::before, *::after { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  min-height: 100vh;
  font-family: var(--font-ui);
  font-size: 16px;
  line-height: 1.5;
  color: var(--ink);
  background-color: var(--void);
  -webkit-font-smoothing: antialiased;
}

/* Browser surfaces carry the design. */
::selection { background: var(--cyan); color: var(--cyan-ink); }
:focus-visible { outline: 2px solid var(--cyan); outline-offset: 3px; }
* { scrollbar-color: var(--line-2) transparent; scrollbar-width: thin; }
*::-webkit-scrollbar { width: 10px; height: 10px; }
*::-webkit-scrollbar-thumb { background: var(--line-2); border-radius: 99px; border: 3px solid transparent; background-clip: padding-box; }
*::-webkit-scrollbar-thumb:hover { background: var(--line-3); background-clip: padding-box; }

h1, h2, h3, h4 { margin: 0; line-height: 1.12; font-family: var(--font-display); font-weight: 600; letter-spacing: 0.01em; }
p { margin: 0; }
button, input, select { font-family: inherit; }
input { caret-color: var(--cyan); }
.ic { width: 18px; height: 18px; display: block; flex: none; fill: none; }

.label {
  font-family: var(--font-display);
  text-transform: uppercase;
  letter-spacing: 0.1em;
  font-size: 12px;
  font-weight: 600;
  color: var(--muted);
  margin: 0 0 var(--s3);
}

/* ---------------- shell ---------------- */

#app { min-height: 100vh; }

.topbar {
  position: sticky;
  top: 0;
  z-index: 30;
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: var(--s2) var(--s4);
  min-height: var(--topbar-h);
  padding: 8px var(--s5);
  background: var(--slate);
  border-bottom: 1px solid var(--line-2);
  min-width: 0;
}
.topbar::after {
  content: "";
  position: absolute;
  left: 0; right: 0; bottom: -5px;
  height: 4px;
  border-bottom: 1px solid var(--line);
  pointer-events: none;
}
.brand { display: flex; align-items: center; gap: var(--s3); min-width: 0; flex: none; }
.seal { display: block; width: 44px; height: 44px; object-fit: contain; color: var(--cyan); }
.brand-wordmark { display: flex; flex-direction: column; gap: 1px; }
.brand-name { font-family: var(--font-display); font-weight: 700; font-size: 21px; letter-spacing: 0.02em; text-transform: uppercase; line-height: 1.2; }
.brand-name em { font-style: normal; color: var(--amber); }
.brand-sub {
  font-family: var(--font-display);
  font-size: 10px;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  color: var(--muted);
}
/* Class switcher: a "My classes" dropdown that scales from two to many groups. */
.class-picker { position: relative; }
.class-picker-summary {
  list-style: none;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 44px;
  padding: 8px 14px;
  border: 1px solid var(--line-2);
  border-radius: var(--r-pill);
  background: var(--slate-3);
  color: var(--ink-2);
  cursor: pointer;
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 15px;
  letter-spacing: 0.01em;
  transition: color var(--ease) 160ms, border-color var(--ease) 160ms, background var(--ease) 160ms;
}
.class-picker-summary::-webkit-details-marker { display: none; }
.class-picker-summary:hover { color: var(--ink); border-color: var(--cyan-2); }
.class-picker[open] .class-picker-summary { color: var(--ink); border-color: var(--cyan-2); background: var(--cyan-soft); }
.class-picker-label { color: var(--muted); }
.class-picker-current { color: var(--ink); }
.class-picker-caret { width: 7px; height: 7px; border-right: 1.6px solid currentColor; border-bottom: 1.6px solid currentColor; transform: rotate(45deg) translate(-2px, -2px); transition: transform 160ms var(--ease); }
.class-picker[open] .class-picker-caret { transform: rotate(225deg) translate(-1px, -1px); }
.class-picker-menu {
  position: absolute;
  z-index: 35;
  top: calc(100% + 10px);
  left: 0;
  min-width: 220px;
  max-height: min(60vh, 380px);
  overflow: auto;
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 8px;
  background: var(--panel-solid);
  border: 1px solid var(--line-2);
  border-radius: var(--r-md);
  box-shadow: 0 12px 28px rgb(0 0 0 / 15%);
}
.class-picker-menu button {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 44px;
  padding: 10px 12px;
  border: 0;
  border-radius: var(--r-sm);
  background: none;
  color: var(--ink-2);
  font: 600 15px/1.2 var(--font-display);
  text-align: left;
  cursor: pointer;
}
.class-picker-menu button:hover { background: var(--cyan-soft); color: var(--ink); }
.class-picker-menu button.on { background: var(--cyan-soft); color: var(--cyan); }
.class-picker-menu .ic { width: 16px; height: 16px; flex: none; }
.top-end { margin-left: auto; display: flex; align-items: center; flex-wrap: wrap; justify-content: flex-end; gap: var(--s2); min-width: 0; }
.ghost {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-family: var(--font-display);
  font-size: 12px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ink-2);
  background: none;
  border: 0;
  cursor: pointer;
  white-space: nowrap;
  flex: none;
  min-width: 44px;
  min-height: 44px;
  padding: 8px;
  text-decoration: none;
}
.ghost:hover { color: var(--cyan); }
.ghost .ic { width: 16px; height: 16px; }
.account-tag { color: var(--muted); font-size: 14px; overflow-wrap: anywhere; padding: 8px; border-bottom: 1px solid var(--line); }
.tablet-tools { position: relative; }
.tablet-tools > summary { list-style: none; justify-content: center; }
.tablet-tools > summary::-webkit-details-marker { display: none; }
.tablet-tools[open] > summary { color: var(--cyan); background: var(--cyan-soft); }
.tablet-tools-menu { position: absolute; z-index: 35; top: calc(100% + 12px); right: 0; width: 260px; padding: 12px; background: var(--panel-solid); border: 1px solid var(--line-2); box-shadow: 0 12px 28px rgb(0 0 0 / 15%); }
.tablet-tools[open] .tablet-tools-menu { display: flex; flex-direction: column; gap: 4px; }
.tablet-tools-menu .ghost { justify-content: flex-start; text-align: left; }

/* ---------------- layout ---------------- */

.layout { display: grid; grid-template-columns: minmax(0, 1fr) 350px; align-items: start; }
.board { min-width: 0; padding: var(--s6); display: flex; flex-direction: column; gap: var(--s5); }
.single { padding: var(--s6); }

/* ---------------- board bar ---------------- */

.board-heading { display: flex; align-items: center; gap: 20px; padding-block: 4px 0; }
.class-seal { position: relative; isolation: isolate; flex: none; display: grid; place-items: center; width: 76px; height: 76px; color: var(--cyan); font: 600 30px/1 var(--font-display); }
.class-seal::before { content: ""; position: absolute; z-index: -1; inset: 9px; border: 1px solid var(--inlay); background: var(--slate); transform: rotate(45deg); }
.class-seal::after { content: ""; position: absolute; z-index: -1; inset: 15px; border: 1px solid var(--line-2); transform: rotate(45deg); }
.board-title { min-width: 0; }
.board-title h1 { font-size: 30px; letter-spacing: -0.02em; text-wrap: balance; }
.board-sub { color: var(--muted); font-size: 14px; margin-top: 7px; }
#clock { font-variant-numeric: tabular-nums; }
.tablet-inscription { display: block; flex: 0 1 168px; height: 24px; margin-left: auto; background: var(--inlay); mask: url("../assets/sheikah/inscription.svg") center / contain no-repeat; opacity: 0.65; }
.board-bar { display: flex; align-items: center; flex-wrap: wrap; gap: 16px; padding-block: 4px 20px; border-bottom: 1px solid var(--line-2); }
.board-stats { display: flex; gap: 20px; }
.chip {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-size: 14px;
  white-space: nowrap;
  color: var(--ink-2);
  padding: 4px 0;
}
.chip .ic { width: 15px; height: 15px; color: var(--cyan-2); }
.chip b { font-family: var(--font-display); font-weight: 600; font-size: 18px; font-variant-numeric: tabular-nums; color: var(--ink); }
.chip.danger .ic, .chip.danger b { color: var(--hp); }
.board-tools { margin-left: auto; }
.search {
  display: flex;
  align-items: center;
  gap: var(--s2);
  background: var(--slate);
  border: 1px solid var(--line-2);
  border-radius: var(--r-sm);
  min-height: 44px;
  padding: 8px 12px;
  color: var(--muted);
  width: 240px;
}
.search .ic { color: var(--cyan-2); }
.search input { min-width: 0; border: 0; outline: 0; background: none; color: var(--ink); font: inherit; width: 100%; }
.search input::placeholder { color: var(--muted); }
.search:focus-within { border-color: var(--cyan); box-shadow: 0 0 0 2px var(--cyan-soft); }

/* ---------------- rune grid ---------------- */

.rune-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 20px; }

.rune-card {
  position: relative;
  display: flex;
  flex-direction: column;
  min-width: 0;
  background: var(--panel-solid);
  border: 1px solid var(--line-2);
  border-radius: var(--r-md);
  overflow: hidden;
  transition: border-color 180ms var(--ease);
}
.rune-card:hover { border-color: var(--cyan); }
.rune-card.is-selected { border-color: var(--selected); }
.rune-card.is-out .hero-fig { opacity: 0.55; filter: grayscale(0.7); }
.card-hit { position: absolute; inset: 0; z-index: 1; border: 0; background: none; cursor: pointer; }
.rune-card:has(.card-hit:focus-visible) { outline: 2px solid var(--cyan); outline-offset: 3px; }
.card-hit:focus-visible { outline: none; }
.rune-card > *:not(.card-hit) { pointer-events: none; }
.rune-card .card-open, .rune-card .rune-act { pointer-events: auto; }
.rune-card-head { position: relative; z-index: 2; display: flex; align-items: center; justify-content: space-between; gap: var(--s2); padding: 12px 15px 8px; min-height: 54px; border-top: 1px solid var(--line); pointer-events: none; transition: background 180ms var(--ease), color 180ms var(--ease); }
.rune-card-name { min-width: 0; }
.rune-card-head h2 { font-size: 23px; letter-spacing: -0.015em; overflow-wrap: anywhere; }
.rune-card.is-selected .rune-card-head { background: var(--selected); color: var(--on-selected); }
.rune-card.is-selected .hero-role { color: var(--on-selected); }
.lvl-seal {
  display: inline-grid;
  place-items: center;
  flex: none;
  min-width: 38px;
  min-height: 42px;
  padding: 4px 6px;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 15px;
  color: var(--amber);
  background: var(--slate);
  border: 1px solid var(--inlay);
  border-radius: 2px 2px 12px 12px;
  line-height: 1;
}
.lvl-seal small { font-size: 9px; letter-spacing: 0.08em; font-weight: 600; }
.lvl-seal b { font-size: 20px; font-weight: 600; }
.lvl-seal.big { min-width: 46px; height: 46px; font-size: 24px; }
.hero-role { font-size: 12px; color: var(--muted); position: relative; z-index: 2; margin-top: 4px; pointer-events: none; }

/* ---------------- dais ---------------- */

.dais {
  position: relative;
  display: grid;
  place-items: center;
  overflow: hidden;
}
.dais::after {
  content: "";
  position: absolute;
  left: 18%;
  right: 18%;
  bottom: 9%;
  height: 13px;
  border-radius: 50%;
  background: radial-gradient(closest-side, rgba(3, 7, 11, 0.62), transparent 74%);
  filter: blur(2px);
  pointer-events: none;
}
.dais-lg::after { content: none; }
.dais-card { height: clamp(270px, 29vh, 340px); background: var(--stage); }
.dais-card::before { content: ""; position: absolute; inset: 14px 22% -1px; border: 1px solid var(--stage-line); border-bottom: 0; border-radius: 100px 100px 0 0; }
.selection-mark { position: absolute; z-index: 2; left: 12px; bottom: 12px; display: grid; place-items: center; width: 25px; height: 25px; border: 1px solid var(--stage-line); background: var(--stage); color: var(--on-selected); transform: rotate(45deg); }
.selection-mark .ic { transform: rotate(-45deg); visibility: hidden; }
.rune-card.is-selected .selection-mark { background: var(--selected); border-color: var(--selected); }
.rune-card.is-selected .selection-mark .ic { visibility: visible; }
.hero-fig {
  position: relative;
  z-index: 2;
  height: 100%;
  width: 100%;
  object-fit: contain;
  padding: 4px;
}
.out-tag {
  position: absolute;
  z-index: 3;
  top: 9px; right: 10px;
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 10px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: #fff;
  background: var(--hp);
  padding: 3px 7px;
  border-radius: var(--r-sm);
}
.card-open {
  position: absolute;
  z-index: 3;
  right: 7px; bottom: 7px;
  width: 36px; height: 36px;
  display: grid; place-items: center;
  border-radius: var(--r-sm);
  border: 1px solid transparent;
  background: var(--stage);
  color: var(--cyan);
  cursor: pointer;
  opacity: 1;
  transition: opacity var(--ease) 160ms, transform var(--ease) 160ms, border-color var(--ease) 160ms;
}
.card-open .ic { width: 15px; height: 15px; }
.rune-card:hover .card-open, .rune-card.is-selected .card-open, .card-open:focus-visible { opacity: 1; transform: none; }
.card-open:hover { border-color: var(--cyan); }

/* stats on card */
.rune-vitals { padding: 14px 15px 12px; }
.rune-xp-label { display: flex; justify-content: space-between; gap: 8px; margin: 7px 0 5px; color: var(--cyan-2); font: 500 12px/1.3 var(--font-display); font-variant-numeric: tabular-nums; }
.xp-needed { color: var(--muted); }
.hearts { display: flex; gap: 3px; position: relative; z-index: 2; pointer-events: none; }
.heart { color: var(--hp); display: block; }
.heart .ic { width: 17px; height: 17px; fill: currentColor; stroke-width: 1.3; }
.heart.off { color: var(--muted); }
.heart.off .ic { fill: none; }
.hearts.big .ic { width: 22px; height: 22px; }

.conduit { position: relative; z-index: 2; height: 6px; background: var(--cyan-soft); overflow: hidden; }
.conduit::after { content: ""; position: absolute; inset: 0; background: repeating-linear-gradient(90deg, transparent 0 calc(20% - 1px), var(--panel-solid) calc(20% - 1px) 20%); pointer-events: none; }
.conduit i { display: block; height: 100%; width: 100%; transform: scaleX(var(--progress, 0)); transform-origin: left; background: var(--cyan); transition: transform 460ms var(--ease); }
.conduit span {
  position: absolute;
  right: 0; top: -16px;
  font-family: var(--font-display);
  font-size: 10px;
  letter-spacing: 0.08em;
  color: var(--muted);
}
.conduit.big { height: 12px; margin-top: var(--s2); }
.conduit.big span { display: none; }

.rune-card-foot { display: flex; align-items: center; justify-content: space-between; gap: var(--s2); position: relative; z-index: 2; min-height: 46px; padding: 0 12px 0 15px; border-top: 1px solid var(--line); }
.coins { display: inline-flex; align-items: center; gap: 6px; font-family: var(--font-display); font-weight: 600; font-size: 15px; color: var(--amber); }
.coins .ic { width: 16px; height: 16px; }
.rune-act {
  display: inline-flex; align-items: center; gap: 6px;
  font-family: var(--font-display); font-size: 11px; letter-spacing: 0.1em; text-transform: uppercase;
  color: var(--cyan); background: none; border: 0;
  min-height: 44px; padding: 6px; cursor: pointer;
}
.rune-act:hover { background: var(--cyan-soft); }
.rune-act .ic { width: 14px; height: 14px; }

@media (hover: none) {
  .card-open { opacity: 1; transform: none; }
}

@keyframes reward-flash {
  0% { box-shadow: 0 0 0 0 rgba(240, 169, 74, 0.7); }
  100% { box-shadow: 0 0 0 14px rgba(240, 169, 74, 0); }
}

.is-flash { animation: reward-flash 700ms var(--ease); }

/* ---------------- console ---------------- */

.console {
  position: sticky;
  top: var(--topbar-h);
  height: calc(100vh - var(--topbar-h));
  height: calc(100dvh - var(--topbar-h));
  min-height: 0;
  max-height: calc(100dvh - var(--topbar-h));
  padding: var(--s6) 22px var(--s7);
  background: var(--slate);
  border-left: 1px solid var(--line-2);
  display: flex;
  flex-direction: column;
  gap: var(--s5);
  overflow: auto;
}
.console-body { display: flex; flex-direction: column; gap: 22px; min-height: 0; }
.console-mobile-toggle { display: none; }
.console-head { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding-bottom: 18px; border-bottom: 1px solid var(--line-2); }
.console-head h2 { font-size: 20px; letter-spacing: 0; line-height: 1.2; }
.console-head .btn { flex: none; }
.console-hint { font-family: var(--font-display); font-size: 12px; letter-spacing: 0.12em; color: var(--muted); }
.panel-block { display: flex; flex-direction: column; gap: var(--s3); }
.target-names { font-size: 12.5px; color: var(--ink-2); }

.row { display: flex; flex-wrap: wrap; gap: var(--s2); }
.btn {
  display: inline-flex; align-items: center; gap: 7px;
  justify-content: center; min-height: 44px;
  font-family: var(--font-display); font-weight: 600; font-size: 12.5px; letter-spacing: 0.04em;
   color: var(--ink); background: var(--panel-solid);
  border: 1px solid var(--line-2); border-radius: var(--r-md);
  padding: 9px 13px; cursor: pointer;
  transition: background var(--ease) 160ms, border-color var(--ease) 160ms, transform var(--ease) 160ms;
}
.btn:hover:not(:disabled) { background: var(--cyan-soft); border-color: var(--cyan); }
.btn:disabled { opacity: 0.4; cursor: not-allowed; }
.btn-sm { padding: 7px 10px; font-size: 12px; }
.btn-lg { padding: 13px 20px; font-size: 14px; }
.btn-primary { background: var(--selected); border-color: var(--selected); color: var(--on-selected); font-weight: 700; }
.btn-primary:hover:not(:disabled) { background: var(--cyan-2); border-color: var(--cyan-2); color: var(--cyan-ink); }
.btn-danger { color: var(--hp); border-color: rgba(255, 111, 92, 0.4); }
.btn-danger:hover { background: var(--hp-soft); border-color: var(--hp); }
.btn-ok { color: var(--ok); border-color: rgba(95, 224, 160, 0.4); }
.btn-ok:hover { background: rgba(95, 224, 160, 0.12); border-color: var(--ok); }
.btn-coin { color: var(--amber); border-color: rgba(240, 169, 74, 0.4); }
.btn-coin:hover { background: var(--amber-soft); border-color: var(--amber); }

/* ---------------- sheet & atelier ---------------- */

.sheet, .atelier { display: grid; grid-template-columns: minmax(0, 1fr) 420px; grid-template-rows: auto 1fr; grid-template-areas: "stage heading" "stage info"; gap: 20px var(--s7); max-width: 1360px; margin: 0 auto; align-items: start; }
.atelier { grid-template-columns: minmax(0, 1fr) 460px; }
.sheet-stage, .atelier-stage { position: relative; grid-area: stage; }
.sheet-heading { grid-area: heading; padding-top: var(--s6); min-width: 0; }
.sheet-heading > .btn { margin-top: var(--s4); }
.sheet-info, .atelier-panel { grid-area: info; }
.sheet-stage, .atelier-stage { background: var(--stage); border: 1px solid var(--line-2); border-radius: 120px 120px var(--r-sm) var(--r-sm); padding: 16px; }
.sheet-stage::before, .atelier-stage::before { content: ""; position: absolute; inset: 12px; border: 1px solid var(--stage-line); border-radius: 108px 108px 0 0; pointer-events: none; }
.dais-lg { height: min(72vh, 660px); }
.dais-lg canvas { position: absolute; inset: 0; width: 100%; height: 100%; touch-action: pan-y; cursor: grab; }
.dais-lg canvas:active { cursor: grabbing; }
.loader { position: absolute; inset: auto 12% 20px; height: 3px; background: rgba(95, 224, 240, 0.1); border-radius: 99px; overflow: hidden; opacity: 1; transition: opacity 400ms var(--ease); }
.loader i { display: block; height: 100%; width: var(--p); background: var(--cyan); }
.dais:not(.is-loading) .loader { opacity: 0; }

.angle-bar { position: relative; display: flex; justify-content: center; flex-wrap: wrap; gap: 4px; margin-top: var(--s4); }
.angle-bar button {
  display: inline-flex; align-items: center; gap: 6px;
  min-height: 44px;
  font-family: var(--font-display); font-size: 11.5px; letter-spacing: 0.08em; text-transform: uppercase;
   color: var(--ink-2); background: transparent; border: 1px solid transparent;
  border-radius: var(--r-sm); padding: 8px 12px; cursor: pointer;
}
.angle-bar button:hover { color: var(--ink); border-color: var(--line-2); }
.angle-bar button.on { color: var(--cyan); background: var(--slate); border-color: var(--line-3); }
.angle-bar .rot.on { color: var(--cyan); border-color: var(--cyan); }

.sheet-info, .atelier-panel { display: flex; flex-direction: column; gap: var(--s4); min-width: 0; }
.sheet-heading h1 { font-size: 48px; letter-spacing: -0.025em; overflow-wrap: anywhere; }
.sheet-context { margin-top: 8px; color: var(--cyan-2); font-size: 16px; }
.sheet-role, .atelier-sub { color: var(--ink-2); font-size: 14px; }
.sheet-stats { display: flex; gap: var(--s5); align-items: flex-end; padding: var(--s4) 0; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.sheet-stats .stat { display: flex; flex-direction: column; align-items: center; gap: 4px; }
.sheet-stats .stat b { font-family: var(--font-display); font-weight: 700; font-size: 20px; }
.sheet-stats .stat .ic { width: 18px; height: 18px; color: var(--cyan-2); }
.sheet-stats small { font-size: 12px; color: var(--muted); }

.rune-section { display: flex; flex-direction: column; gap: var(--s2); padding-bottom: var(--s3); border-bottom: 1px solid var(--line); }
.rune-row { display: flex; gap: var(--s2); flex-wrap: wrap; }
.rune-choice {
  display: inline-flex; align-items: center; gap: 8px;
  font-family: var(--font-display); font-weight: 600; font-size: 13px; letter-spacing: 0.04em;
   color: var(--ink-2); background: var(--panel-solid);
  border: 1px solid var(--line); border-radius: var(--r-md);
  padding: 10px 15px; cursor: pointer;
  transition: color var(--ease) 140ms, background var(--ease) 140ms, border-color var(--ease) 140ms, box-shadow var(--ease) 140ms;
}
.rune-choice:hover { color: var(--ink); border-color: var(--line-2); }
.rune-choice.on {
  color: var(--on-selected);
  background: var(--selected);
  border-color: var(--selected);
}
.rune-choice.on::after { content: ""; width: 7px; height: 7px; border: 1px solid currentColor; transform: rotate(45deg); }
.dye { width: 16px; height: 16px; border-radius: 50%; background: var(--c); border: 1px solid rgba(255, 255, 255, 0.35); }
.atelier-actions { display: flex; gap: var(--s3); margin-top: var(--s3); }

/* ---------------- empty ---------------- */

.empty { display: flex; flex-direction: column; align-items: center; gap: var(--s4); text-align: center; padding: 12vh var(--s5); color: var(--ink-2); }
.empty .ic { width: 42px; height: 42px; color: var(--cyan-2); }
.empty h2 { font-size: 26px; text-transform: uppercase; letter-spacing: 0.06em; }

/* ---------------- toast ---------------- */

#toasts { position: fixed; left: 50%; bottom: 26px; transform: translateX(-50%); z-index: 200; display: flex; flex-direction: column; gap: 8px; }
.toast {
  display: flex; align-items: center; gap: 10px;
  padding: 11px 14px;
  background: var(--panel-solid);
  border: 1px solid var(--line-3);
  border-radius: var(--r-md);
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.2);
  color: var(--ink);
  font-size: 13.5px;
  animation: toastIn 320ms var(--ease) both;
}
.toast .ic { width: 16px; height: 16px; color: var(--cyan); }
.toast-danger { border-color: rgba(255, 111, 92, 0.5); }
.toast-danger .ic { color: var(--hp); }
.toast button { background: none; border: 0; color: var(--muted); cursor: pointer; display: grid; place-items: center; }
.toast button:hover { color: var(--ink); }

/* ---------------- wake ---------------- */

.wake {
  position: fixed;
  inset: 0;
  z-index: 300;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: var(--s5);
  background: var(--void);
  opacity: 0;
  transition: opacity 320ms var(--ease);
}
.wake.is-open { opacity: 1; }
.wake.is-closing { opacity: 0; }
.wake-eye { width: 66px; height: 66px; color: var(--cyan); opacity: 0.3; transform: scale(0.9); transition: opacity 600ms var(--ease), transform 600ms var(--ease); }
.wake.is-open .wake-eye { opacity: 1; transform: scale(1); filter: drop-shadow(0 0 18px rgba(95, 224, 240, 0.6)); }
.wake-line { width: 180px; height: 2px; background: rgba(95, 224, 240, 0.14); border-radius: 99px; overflow: hidden; position: relative; }
.wake-line::after { content: ""; position: absolute; inset: 0; background: linear-gradient(90deg, transparent, var(--cyan), transparent); transform: translateX(-100%); animation: scan 1150ms var(--ease) infinite; }
.wake p { font-family: var(--font-display); font-size: 11px; letter-spacing: 0.28em; text-transform: uppercase; color: var(--muted); }

/* ---------------- motion ---------------- */

@keyframes spin { to { transform: rotate(360deg); } }
@keyframes scan { to { transform: translateX(100%); } }
@keyframes toastIn { from { opacity: 0; transform: translateY(12px) scale(0.98); } to { opacity: 1; transform: none; } }

/* ---------------- responsive ---------------- */

@media (max-width: 1180px) {
  .layout { grid-template-columns: 1fr; }
  .layout .board { padding-bottom: calc(var(--s5) + 68px + env(safe-area-inset-bottom)); }
  .console {
    position: fixed;
    inset: auto 0 0;
    z-index: 40;
    width: min(680px, calc(100% - 24px));
    height: auto;
    min-height: 0;
    max-height: calc(100dvh - 96px - env(safe-area-inset-top));
    margin-inline: auto;
    padding: 0;
    gap: 0;
    background: var(--surface-1);
    overflow: hidden;
    border: 1px solid var(--line-2);
    border-bottom: 0;
    border-radius: var(--r-lg) var(--r-lg) 0 0;
    box-shadow: 0 -18px 44px rgba(0, 0, 0, 0.34);
    padding-bottom: env(safe-area-inset-bottom);
  }
  .console:not(.is-open) .console-body { display: none; }
  .console-mobile-toggle {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--s3);
    width: 100%;
    min-height: 60px;
    padding: 0 var(--s4);
    color: var(--ink);
    background: var(--surface-1);
    border: 0;
    border-bottom: 1px solid var(--line);
    cursor: pointer;
  }
  .console-mobile-toggle span { display: inline-flex; align-items: center; gap: 8px; font-family: var(--font-display); font-weight: 600; text-transform: uppercase; letter-spacing: 0.06em; }
  .console-mobile-toggle strong { color: var(--cyan); font-size: 12px; }
  .console-body { padding: var(--s4); padding-bottom: max(var(--s4), env(safe-area-inset-bottom)); overflow: auto; overscroll-behavior: contain; }
  .console { overflow: hidden; }
  .console.is-open .console-body { max-height: calc(100dvh - 180px - env(safe-area-inset-top)); }
  .sheet, .atelier { grid-template-columns: minmax(0, 1fr); grid-template-rows: auto auto 1fr; grid-template-areas: "heading" "stage" "info"; gap: var(--s5); }
  .sheet-heading { padding-top: 0; }
  .dais-lg { height: min(58vh, 520px); }
}

@media (max-width: 1020px) {
  .topbar { flex-wrap: wrap; height: auto; min-height: var(--topbar-h); gap: var(--s2) var(--s3); padding: 12px var(--s5) 8px; }
  .topbar > .class-picker { margin-left: var(--s3); }
  .top-end { width: 100%; margin-left: 0; justify-content: space-between; }
  .top-end > .ghost span { display: none; }
  .ghost { justify-content: center; min-width: 44px; min-height: 44px; padding: 8px; }
  .board-tools { width: 100%; margin-left: 0; }
  .search { width: 100%; min-width: 0; }
}

@media (max-width: 720px) {
  .brand-name { font-size: 19px; white-space: nowrap; }
  .seal { width: 36px; height: 36px; }
  .class-picker-label { display: none; }
  .class-picker-summary { padding-inline: 12px; }
  .board, .single { padding: 24px 16px; }
  .board-heading { gap: 14px; }
  .board-title h1 { font-size: 25px; }
  .board-stats { flex-wrap: wrap; gap: 18px; }
  .tablet-inscription { display: none; }
  .class-seal { width: 62px; height: 62px; font-size: 24px; }
  .board-tools { margin-left: 0; width: 100%; }
  .search { min-width: 0; }
  .rune-grid { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: var(--s3); }
  .hero-fig { height: 100%; }
  .dais-card { height: 240px; }
  .rune-card-head { padding: 12px 10px; gap: 5px; }
  .rune-card-head h2 { font-size: 20px; }
  .lvl-seal { min-width: 32px; }
  .rune-vitals { padding-inline: 10px; }
  .rune-card-foot { padding-inline: 10px 4px; }
  .rune-act { letter-spacing: 0.04em; font-size: 10px; }
  .rune-act { justify-content: center; }
  .sheet-heading h1 { font-size: 36px; }
  .sheet-stage, .atelier-stage { padding: 12px; }
  .atelier-actions { flex-direction: column; }
}

@media (max-width: 520px) {
  .topbar { padding-inline: max(12px, env(safe-area-inset-left)) max(12px, env(safe-area-inset-right)); }
  .brand { gap: 8px; }
  .brand-name { font-size: 17px; }
  .brand-sub { font-size: 8px; }
  .seal { width: 32px; height: 32px; }
  .topbar > .class-picker { margin-left: auto; }
  .class-picker-summary { max-width: 42vw; }
  .top-end { gap: 4px; }
  .top-end > .ghost, .tablet-tools > summary { min-width: 40px; padding: 8px; }
  .board-bar { gap: var(--s3); }
  .board-title h1 { font-size: 23px; }
  .board-stats { gap: 14px; }
  .chip { gap: 4px; font-size: 13px; }
  .chip .ic { width: 14px; height: 14px; }
  .rune-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .rune-card-head h2 { font-size: 18px; }
  .card-open { width: 44px; height: 44px; right: 2px; bottom: 2px; }
  .selection-mark { left: 10px; width: 21px; height: 21px; }
  .rune-act { min-height: 44px; }
  .sheet-stats { flex-wrap: wrap; gap: var(--s4); }
  #toasts { width: calc(100% - 24px); bottom: 78px; }
}

@media (pointer: coarse) {
  .class-picker-summary, .btn, .angle-bar button, .rune-choice, .shop-tabs button { min-height: 44px; }
}

@media (prefers-reduced-motion: reduce) {
  * { animation-duration: 0.001ms !important; animation-iteration-count: 1 !important; transition-duration: 0.001ms !important; }
}

/* ============================================================
   THÈME CLAIR — calcaire & céladon
   Des aplats minéraux lisibles sous la lumière de la classe.
   Le pétrole porte l'action, le bronze les niveaux. La matière
   vient des emboîtements et des gravures, jamais d'un halo.
   ============================================================ */

:root[data-theme="light"] {
  color-scheme: light;

  --void: #e7e9df;
  --slate: #f0f0e6;
  --slate-2: #f8f7ef;
  --slate-3: #e0e5d9;
  --panel: #f8f7ef;
  --panel-solid: #f8f7ef;
  --stage: #dce4d9;
  --stage-line: #b6c5b5;
  --inlay: #8b7950;
  --selected: #244d47;
  --on-selected: #f5f3e5;

  --line: #d2d7c9;
  --line-2: #b8c0af;
  --line-3: #6c8c79;

  --cyan: #245b51;
  --cyan-2: #376859;
  --cyan-soft: #dbe4d8;
  --cyan-ink: #f8f7ef;

  --amber: #7f612c;
  --amber-soft: #ebe4cf;

  --ink: #283d35;
  --ink-2: #4a6055;
  --muted: #5c6b5e;

  --hp: #aa493d;
  --hp-soft: #f0dfd5;
  --ok: #37684c;
}

:root[data-theme="light"] .dais::after { background: radial-gradient(closest-side, rgb(40 61 53 / 14%), transparent 74%); }
:root[data-theme="light"] .btn-danger, :root[data-theme="light"] .btn-quiet-danger { border-color: #cda89c; }
:root[data-theme="light"] .btn-ok { border-color: #a3b6a0; }
:root[data-theme="light"] .btn-coin { border-color: #c6b994; }
:root[data-theme="light"] .shop-thumb { background: var(--stage); }

/* ============================================================
   Compatibilité — composants de l'application
   La console enseignant, la fiche et la boutique partagent leurs
   classes d'origine ; cette section les habille avec la matière
   Sheikah pour que toutes les pages soient cohérentes.
   ============================================================ */

.console .panel { border-top: 1px solid var(--line); padding: 10px 0; }
.console details.panel > summary { display: flex; align-items: center; gap: 8px; min-height: 44px; cursor: pointer; list-style: none; color: var(--ink-2); font: 500 14px/1.4 var(--font-display); padding: 6px 0; }
.console details.panel > summary::after { content: ""; width: 7px; height: 7px; border-right: 1px solid currentColor; border-bottom: 1px solid currentColor; margin-left: auto; margin-right: 3px; transform: rotate(45deg); }
.console details.panel[open] > summary::after { transform: rotate(225deg); }
.console details.panel > summary::-webkit-details-marker { display: none; }
.console details.panel > summary .icon { width: 16px; height: 16px; color: var(--cyan-2); }
.console details.panel[open] > summary { color: var(--ink); }
.panel-note { color: var(--muted); font-size: 14px; margin: 6px 0; }
.account-line { display: flex; align-items: baseline; gap: 8px; margin: 6px 0; }
.account-line span { color: var(--muted); font-size: 12px; }
.access-form { display: flex; flex-direction: column; gap: 12px; }
.section-label { font: 600 12px/1.4 var(--font-display); letter-spacing: 0.08em; text-transform: uppercase; color: var(--muted); margin: 22px 0 10px; }
.target > .section-label, .award > .section-label:first-child { margin-top: 0; }
.target-names { color: var(--ink-2); font-size: 15px; margin: 10px 0; }
.target-actions .btn { background: transparent; border-color: transparent; min-height: 36px; padding: 4px 0; text-decoration: underline; text-underline-offset: 4px; }
.target-actions { justify-content: space-between; }
.target-actions, .button-row, .hp-row, .coin-row, .field-row { display: flex; flex-wrap: wrap; gap: 8px; align-items: flex-end; }
.award-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.award-btn { display: flex; flex-direction: column; align-items: flex-start; justify-content: center; gap: 2px; min-height: 70px; padding: 10px 12px; background: var(--panel); border: 1px solid var(--line-2); border-radius: var(--r-sm); color: var(--ink); cursor: pointer; font: inherit; }
.award-btn:hover:not(:disabled) { border-color: var(--cyan); background: var(--cyan-soft); }
.award-btn:disabled, .btn:disabled { opacity: 0.48; cursor: not-allowed; }
.award-btn strong { font-family: var(--font-display); font-size: 24px; font-weight: 500; color: var(--cyan); }
.award-btn span { font-size: 14px; color: var(--muted); }
.award-hint { color: var(--muted); font-size: 14px; margin-top: 12px; }
.stepper-row, .coin-row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin-top: 8px; }
.stepper-row > .btn, .coin-row > .btn-primary { flex: 1; }
.stepper { display: flex; align-items: center; border: 1px solid var(--line); border-radius: var(--r-md); overflow: hidden; }
.stepper-btn { background: none; border: 0; color: var(--ink-2); width: 44px; height: 44px; cursor: pointer; }
.stepper-btn:hover { background: var(--cyan-soft); color: var(--cyan); }
.stepper input { width: 48px; min-height: 44px; border: 0; background: none; color: var(--ink); text-align: center; font: inherit; font-variant-numeric: tabular-nums; appearance: textfield; }
.stepper input::-webkit-inner-spin-button, .stepper input::-webkit-outer-spin-button { appearance: none; margin: 0; }
.field { display: flex; flex-direction: column; gap: 4px; }
.field > span { font-size: 11px; letter-spacing: 0.1em; text-transform: uppercase; color: var(--muted); }
.field input, .field select, .inline-form input { min-width: 0; min-height: 44px; background: var(--panel-solid); border: 1px solid var(--line); border-radius: var(--r-md); color: var(--ink); padding: 7px 9px; font: inherit; }
.inline-form { display: flex; gap: 8px; align-items: center; }
.inline-form input { flex: 1; min-width: 0; }
.rule { border: 0; border-top: 1px solid var(--line); margin: 10px 0; }
.btn-quiet-danger { color: var(--hp); border-color: rgba(255, 111, 92, 0.35); }
.btn-quiet-danger:hover { background: var(--hp-soft); border-color: var(--hp); }
.btn-quiet-danger.is-armed { background: var(--hp-soft); border-color: var(--hp); color: var(--hp); }
.hero-sheet { display: flex; gap: 12px; align-items: center; }
.hero-sheet-art { background: var(--panel); border: 1px solid var(--line); border-radius: var(--r-md); padding: 4px; width: 96px; cursor: pointer; }
.hero-sheet-art .avatar-base3d { width: 100%; height: auto; display: block; }
.hero-sheet-facts { display: flex; flex-direction: column; gap: 6px; }
.hero-sheet-xp { color: var(--ink-2); font-size: 12px; }
.hp-heart { width: 18px; height: 18px; }
.hp-heart > path:first-child { fill: var(--hp); stroke: var(--hp); stroke-width: 1.2; }
.hp-heart.empty > path:first-child { fill: none; stroke: var(--muted); }
.hp-heart > path + path { display: none; }
.coin > circle { fill: none; stroke: var(--amber); }
.coin > path { fill: var(--amber); }
.level { color: var(--amber); background: var(--amber-soft); border-color: var(--inlay); border-radius: 2px 2px 8px 8px; }
.xp-track { border-radius: 0; height: 6px; border: 0; background: var(--cyan-soft); }
.xp-fill { border-radius: 0; background: var(--cyan); }
.gear { display: grid; grid-template-columns: minmax(0, 1fr); gap: 6px 12px; margin: 10px 0; }
.gear div { display: flex; justify-content: space-between; gap: 8px; border-bottom: 1px solid var(--line); padding: 4px 0; }
.gear dt { color: var(--muted); font-size: 12px; }
.gear dd { margin: 0; font-size: 12px; }
.rewards { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; margin: 8px 0; }
.reward-tag { background: var(--amber-soft); color: var(--amber); padding: 3px 9px; font-size: 12px; }
.events { list-style: none; margin: 8px 0; padding: 0; display: flex; flex-direction: column; gap: 4px; max-height: 200px; overflow: auto; }
.event { display: flex; align-items: center; gap: 8px; font-size: 12px; }
.event time { color: var(--muted); }
.event .is-gain { color: var(--ok); }
.event .is-loss { color: var(--hp); }
.segmented { display: flex; border: 1px solid var(--line); border-radius: var(--r-md); overflow: hidden; }
.segmented button { flex: 1; min-width: 0; min-height: 44px; background: none; border: 0; color: var(--ink-2); padding: 8px 12px; font: 500 15px/1.3 var(--font-ui); cursor: pointer; }
.segmented button.is-active, .segmented button[aria-pressed="true"] { background: var(--selected); color: var(--on-selected); }
.segmented-lg button { padding: 11px 14px; }
.segmented b { margin-left: 6px; color: inherit; font-variant-numeric: tabular-nums; }

.sync-conflict { display: flex; align-items: center; justify-content: center; flex-wrap: wrap; gap: 8px; padding: 8px 16px; color: var(--ink); background: var(--hp-soft); border-bottom: 1px solid var(--hp); font-size: 13px; }
.toast-undo { min-height: 36px; padding: 0 10px; pointer-events: auto; border: 1px solid var(--line-2) !important; border-radius: var(--r-sm); }

/* --- boutique --- */
.shop { display: flex; flex-direction: column; gap: 12px; }
.shop-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px 12px; }
.shop-tabs { display: flex; flex-wrap: wrap; gap: 6px; flex: 1 1 auto; }
.shop-tabs button { min-height: 44px; background: none; border: 1px solid var(--line); border-radius: var(--r-sm); color: var(--ink-2); padding: 5px 10px; font: inherit; font-size: 13px; cursor: pointer; }
.shop-tabs button.is-active, .shop-tabs button[aria-selected="true"] { background: var(--cyan-soft); border-color: var(--cyan-2); color: var(--ink); }
.shop-balance { color: var(--amber); display: flex; align-items: center; gap: 6px; white-space: nowrap; margin-left: auto; }
.shop-items { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 10px; }
.shop-item { display: flex; flex-direction: column; gap: 6px; background: var(--panel); border: 1px solid var(--line); border-radius: var(--r-md); padding: 10px; }
.shop-item.is-owned { border-color: var(--line-2); }
.shop-item.is-equipped { border-color: var(--cyan-2); }
.shop-item.is-preview { border-color: var(--amber); box-shadow: 0 0 0 1px var(--amber); }
.shop-thumb { background: rgba(4, 7, 12, 0.4); border-radius: var(--r-sm); display: grid; place-items: center; min-height: 78px; }
.shop-thumb svg, .shop-thumb img { max-width: 100%; height: auto; }
.shop-item-text { display: flex; flex-direction: column; gap: 2px; }
.shop-item-text strong { font-size: 13px; }
.shop-item-text small, .shop-item-description { color: var(--muted); font-size: 11.5px; }
.item-tier, .title-chip { font-size: 10px; letter-spacing: 0.1em; text-transform: uppercase; color: var(--amber); }

/* --- sélecteur de héros (espace élève) --- */
.picker { max-width: 1560px; margin: 0 auto; display: flex; flex-direction: column; gap: var(--s4); padding: var(--s6) 0; }
.picker h1 { font-size: 38px; letter-spacing: -0.02em; }
.picker-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: var(--s4); }
.picker-card { position: relative; display: flex; flex-direction: column; align-items: stretch; gap: 0; padding: 0; overflow: hidden; background: var(--panel); border: 1px solid var(--line-2); border-radius: var(--r-md); color: var(--ink); cursor: pointer; font: inherit; text-align: left; transition: border-color 180ms var(--ease), background 180ms var(--ease); }
.picker-card:hover { border-color: var(--cyan); background: var(--cyan-soft); }
.picker-portrait { height: clamp(280px, 31vh, 350px); width: 100%; margin: 0; padding: 5px; object-fit: contain; background: var(--stage); }
.picker-info { display: flex; flex-direction: column; gap: 10px; padding: 12px 14px 16px; border-top: 1px solid var(--line); }
.picker-identity { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.picker-card .lvl-seal, .rune-card .lvl-seal { min-width: 30px; min-height: 34px; padding: 3px 5px; }
.picker-card .lvl-seal b, .rune-card .lvl-seal b { font-size: 16px; }
.picker-card strong { font: 600 24px/1.2 var(--font-display); overflow-wrap: anywhere; min-width: 0; }
.picker-card small { color: var(--muted); }
.picker-card .lvl-seal small { color: var(--amber); }
.viewer-error { position: absolute; inset: auto 12% 22px; color: var(--muted); font-size: 12px; text-align: center; }

/* Portraits and product cards all come from the same current 3D catalogue. */
.portrait-render-host { position: fixed; left: -10000px; top: 0; width: 512px; height: 768px; overflow: hidden; pointer-events: none; }
.portrait-render-host canvas { display: block; width: 100%; height: 100%; }
.shop-thumb .item-thumbnail { display: block; width: 100%; height: 144px; object-fit: contain; padding: 8px; }
.cosmetic-swatch { display: block; width: 64px; height: 64px; border-radius: 50%; background: var(--swatch); border: 1px solid var(--line-2); }
.empty-slot-preview { display: grid; place-items: center; width: 64px; height: 64px; color: var(--muted); }
.empty-slot-preview .icon { width: 36px; height: 36px; }
.item-only-preview { display: grid; place-items: center; }
.item-only-preview .item-thumbnail { width: min(100%, 320px); height: auto; }
.item-preview-caption { margin-top: 12px; color: var(--ink-2); text-align: center; font-size: 15px; }
.dais-card { grid-template-columns: minmax(0, 1fr); grid-template-rows: minmax(0, 1fr); }
.dais-card > .hero-fig { display: block; width: 100%; height: 100%; max-height: 100%; min-height: 0; min-width: 0; object-fit: contain; margin: 0; padding: 8px; transform: none; background: transparent; }
.student-card .dais-card { height: clamp(280px,31vh,350px); }
.card-health-money { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 6px; }
.rune-card .rune-card-foot { padding: 4px; gap: 2px; }
.rune-card-foot .rune-act { flex: 1; justify-content: center; min-width: 0; }
@media (max-width: 640px) { .student-card .dais-card { height: 245px; } }
.atelier-stage { scroll-margin-top: calc(var(--topbar-h) + 24px); }
@media (min-width: 1101px) {
  .atelier-shop .atelier-stage { position: sticky; top: calc(var(--topbar-h) + 16px); }
  .atelier-shop .dais-lg { height: min(58vh, 520px); }
}

/* --- dialogues (commande sur-mesure, aperçu article) ---
   Sheikah ne charge pas styles.css : elle fournit son propre habillage,
   dans les deux thèmes via les variables --panel / --ink. */
.dialog {
  position: relative;
  width: min(560px, calc(100vw - 32px));
  max-height: calc(100vh - 40px);
  overflow: auto;
  padding: var(--s5);
  background: var(--panel-solid);
  color: var(--ink);
  border: 1px solid var(--line-2);
  border-radius: var(--r-lg);
  box-shadow: 0 30px 80px rgba(0, 0, 0, 0.35);
}
.dialog::backdrop { background: rgba(6, 12, 18, 0.62); backdrop-filter: blur(4px); }
.dialog h2 { font-family: var(--font-display); font-weight: 700; text-transform: uppercase; letter-spacing: 0.04em; margin: var(--s3) 0; }
.dialog-close {
  position: absolute; top: var(--s3); right: var(--s3);
  width: 40px; height: 40px; display: grid; place-items: center;
  background: var(--panel); border: 1px solid var(--line); border-radius: 50%;
  color: var(--ink-2); cursor: pointer;
}
.dialog-close:hover { color: var(--ink); border-color: var(--line-2); }
.dialog-item-art {
  display: grid; place-items: center; min-height: 260px;
  background: var(--panel); border: 1px solid var(--line); border-radius: var(--r-md);
}
.dialog-item-art svg, .dialog-item-art img { max-width: 220px; height: auto; }
.dialog-item-description, .dialog-status { color: var(--ink-2); font-size: 13.5px; }
.item-meta { color: var(--muted); font-size: 12px; }
.bespoke-order-form { display: flex; flex-direction: column; gap: var(--s3); margin-top: var(--s3); }
.bespoke-order-form textarea {
  width: 100%; resize: vertical;
  background: var(--panel-solid); border: 1px solid var(--line); border-radius: var(--r-md);
  color: var(--ink); padding: 8px 10px; font: inherit;
}

@media (max-width: 520px) {
  .picker-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .picker-portrait { height: 245px; }
  .picker-info { padding: 10px; }
  .picker-card strong { font-size: 21px; }
  .picker h1 { font-size: 30px; }
}

/* ============================================================
   Title backdrop — the dais behind the character reflects prestige.
   Decoration is drawn with precise, centred geometry (masks, borders and
   rules) so nothing crosses or gets cut: a baselined rule with a gem from
   tier 2, banner rails from tier 3, a medallion from tier 4 and radiant
   rays plus a title emblem from tier 5. Everything lives inside the dais.
   ============================================================ */
.title-halo,
.title-emblem,
.title-frame { position: absolute; inset: 0; z-index: 1; pointer-events: none; }
.title-halo::before,
.title-halo::after,
.title-frame::before,
.title-frame::after { content: ""; position: absolute; pointer-events: none; }

.dais[data-title-tier="2"] { --halo-color: #2f6fa8; --halo-soft: rgba(47,111,168,.22); }
.dais[data-title-tier="3"] { --halo-color: #2b7d63; --halo-soft: rgba(43,125,99,.26); }
.dais[data-title-tier="4"] { --halo-color: #a23b3b; --halo-soft: rgba(162,59,59,.28); }
.dais[data-title-tier="5"] { --halo-color: #b8871f; --halo-soft: rgba(197,150,42,.34); }

/* Four prestige titles own their accent, independent of the shared tier
 * ladder: Explorer teal, Champion amber, King royal violet, Legend rose. The
 * emblem mask (badge) and the accent together give each a distinct identity. */
.dais[data-title-id="pathfinder"] { --halo-color: #1f9aa3; --halo-soft: rgba(31,154,163,.28); }
.dais[data-title-id="realm-champion"] { --halo-color: #c07a1e; --halo-soft: rgba(192,122,30,.30); }
.dais[data-title-id="paragon-sovereign"] { --halo-color: #6a4bb0; --halo-soft: rgba(106,75,176,.30); }
.dais[data-title-id="class-legend"] { --halo-color: #c04a86; --halo-soft: rgba(192,74,134,.32); }

/* Ambient tint, rising with the tier. */
.dais[data-title-tier="2"] .title-halo::before { inset: 0; background: radial-gradient(62% 56% at 50% 90%, var(--halo-soft), transparent 72%); }
.dais[data-title-tier="3"] .title-halo::before { inset: 0; background: radial-gradient(66% 60% at 50% 92%, var(--halo-soft), transparent 74%); }
.dais[data-title-tier="4"] .title-halo::before { inset: 0; background: radial-gradient(72% 64% at 50% 94%, var(--halo-soft), transparent 76%); }
.dais[data-title-tier="5"] .title-halo::before { inset: 0; background: radial-gradient(78% 70% at 50% 96%, var(--halo-soft), transparent 78%); }

/* Tier 4: a precise ring medallion behind the shoulders. */
.dais[data-title-tier="4"] .title-halo::after,
.dais[data-title-tier="5"] .title-halo::after {
  left: 50%; top: 47%; width: 46%; aspect-ratio: 1; transform: translate(-50%, -50%);
  border: 1px solid color-mix(in srgb, var(--halo-color) 48%, transparent);
  border-radius: 50%;
  box-shadow: inset 0 0 0 5px color-mix(in srgb, var(--halo-color) 10%, transparent);
}
.dais[data-title-tier="5"] .title-halo::after { box-shadow: inset 0 0 0 5px color-mix(in srgb, var(--halo-color) 14%, transparent), 0 0 34px color-mix(in srgb, var(--halo-color) 28%, transparent); }

/* Tier 5: radiant rays, evenly spaced and masked away from the centre. */
.title-frame::before {
  inset: -22% -8% 14%;
  background: repeating-conic-gradient(from 0deg at 50% 66%,
    color-mix(in srgb, var(--halo-color) 46%, transparent) 0deg 1.3deg, transparent 1.3deg 12deg);
  -webkit-mask: radial-gradient(closest-side, transparent 36%, #000 48%, transparent 82%);
  mask: radial-gradient(closest-side, transparent 36%, #000 48%, transparent 82%);
  opacity: 0;
}
.dais[data-title-tier="5"] .title-frame::before { opacity: .6; }

/* A precise baselined rule with a centred gem: quiet frame for tier 2,
 * doubled rails for tier 3 and up. */
.title-frame::after {
  left: 24%; right: 24%; bottom: 11%; height: 0;
  border-top: 1px solid color-mix(in srgb, var(--halo-color) 62%, transparent);
  background:
    radial-gradient(circle at 50% 0, color-mix(in srgb, var(--halo-color) 90%, transparent) 0 2.4px, transparent 2.6px),
    linear-gradient(to right, transparent 46%, color-mix(in srgb, var(--halo-color) 70%, transparent) 46% 54%, transparent 54%) no-repeat;
  opacity: 0;
}
.dais[data-title-tier="2"] .title-frame::after { opacity: .9; }
.dais[data-title-tier="3"] .title-frame::after,
.dais[data-title-tier="4"] .title-frame::after,
.dais[data-title-tier="5"] .title-frame::after {
  opacity: 1;
  box-shadow: 0 4px 0 -1px color-mix(in srgb, var(--halo-color) 34%, transparent);
  bottom: 12%;
}

/* The arch line behind the head picks up the title colour from tier 3 up. */
.dais[data-title-tier="3"]::before,
.dais[data-title-tier="4"]::before,
.dais[data-title-tier="5"]::before { border-color: color-mix(in srgb, var(--halo-color) 55%, var(--stage-line)); }

/* Title emblems: alpha masks recoloured to the tier, pinned above the head so
 * they are never cropped and never cross the character. */
.title-emblem { background: var(--halo-color, currentColor); opacity: 0; -webkit-mask-position: 50% 6%; mask-position: 50% 6%; -webkit-mask-repeat: no-repeat; mask-repeat: no-repeat; -webkit-mask-size: 30% auto; mask-size: 30% auto; }
.dais[data-title-tier="3"] .title-emblem { -webkit-mask-size: 26% auto; mask-size: 26% auto; }
.dais[data-title-tier="5"] .title-emblem { -webkit-mask-size: 34% auto; mask-size: 34% auto; }

.dais[data-title-id="perfect-pupil"] .title-emblem,
.dais[data-title-id="pathfinder"] .title-emblem,
.dais[data-title-id="scholar-virtuoso"] .title-emblem,
.dais[data-title-id="realm-champion"] .title-emblem,
.dais[data-title-id="grand-archon"] .title-emblem,
.dais[data-title-id="paragon-sovereign"] .title-emblem,
.dais[data-title-id="grammar-master"] .title-emblem,
.dais[data-title-id="class-legend"] .title-emblem { opacity: .85; }

.dais[data-title-id="perfect-pupil"] .title-emblem { -webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='96' height='48' viewBox='0 0 96 48'%3E%3Cpath d='M46 16c-5-4-12-6-20-6H18v22h8c8 0 15 2 20 6M50 16c5-4 12-6 20-6h8v22h-8c-8 0-15 2-20 6M48 16v22' fill='none' stroke='%23000' stroke-width='3' stroke-linejoin='round' stroke-linecap='round'/%3E%3C/svg%3E"); mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='96' height='48' viewBox='0 0 96 48'%3E%3Cpath d='M46 16c-5-4-12-6-20-6H18v22h8c8 0 15 2 20 6M50 16c5-4 12-6 20-6h8v22h-8c-8 0-15 2-20 6M48 16v22' fill='none' stroke='%23000' stroke-width='3' stroke-linejoin='round' stroke-linecap='round'/%3E%3C/svg%3E"); }
.dais[data-title-id="pathfinder"] .title-emblem { -webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='96' height='48' viewBox='0 0 96 48'%3E%3Cpath d='M48 6l6 14 14 6-14 6-6 14-6-14-14-6 14-6z' fill='none' stroke='%23000' stroke-width='3' stroke-linejoin='round'/%3E%3Ccircle cx='48' cy='26' r='6' fill='none' stroke='%23000' stroke-width='3'/%3E%3C/svg%3E"); mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='96' height='48' viewBox='0 0 96 48'%3E%3Cpath d='M48 6l6 14 14 6-14 6-6 14-6-14-14-6 14-6z' fill='none' stroke='%23000' stroke-width='3' stroke-linejoin='round'/%3E%3Ccircle cx='48' cy='26' r='6' fill='none' stroke='%23000' stroke-width='3'/%3E%3C/svg%3E"); }
.dais[data-title-id="scholar-virtuoso"] .title-emblem { -webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='96' height='48' viewBox='0 0 96 48'%3E%3Cpath d='M48 6l7 16 17 2-12 12 3 17-15-9-15 9 3-17-12-12 17-2z' fill='none' stroke='%23000' stroke-width='3' stroke-linejoin='round'/%3E%3C/svg%3E"); mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='96' height='48' viewBox='0 0 96 48'%3E%3Cpath d='M48 6l7 16 17 2-12 12 3 17-15-9-15 9 3-17-12-12 17-2z' fill='none' stroke='%23000' stroke-width='3' stroke-linejoin='round'/%3E%3C/svg%3E"); }
.dais[data-title-id="realm-champion"] .title-emblem { -webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='96' height='48' viewBox='0 0 96 48'%3E%3Cpath d='M28 10h40v14c0 9-9 15-20 18-11-3-20-9-20-18z' fill='none' stroke='%23000' stroke-width='3' stroke-linejoin='round'/%3E%3Cpath d='M34 20h28M48 14v22' fill='none' stroke='%23000' stroke-width='3' stroke-linecap='round'/%3E%3C/svg%3E"); mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='96' height='48' viewBox='0 0 96 48'%3E%3Cpath d='M28 10h40v14c0 9-9 15-20 18-11-3-20-9-20-18z' fill='none' stroke='%23000' stroke-width='3' stroke-linejoin='round'/%3E%3Cpath d='M34 20h28M48 14v22' fill='none' stroke='%23000' stroke-width='3' stroke-linecap='round'/%3E%3C/svg%3E"); }
.dais[data-title-id="grand-archon"] .title-emblem { -webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='96' height='48' viewBox='0 0 96 48'%3E%3Cpath d='M30 40V12l18 8 18-8v28' fill='none' stroke='%23000' stroke-width='3' stroke-linejoin='round' stroke-linecap='round'/%3E%3Cpath d='M30 18 18 12v22l12 6' fill='none' stroke='%23000' stroke-width='3' stroke-linejoin='round'/%3E%3C/svg%3E"); mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='96' height='48' viewBox='0 0 96 48'%3E%3Cpath d='M30 40V12l18 8 18-8v28' fill='none' stroke='%23000' stroke-width='3' stroke-linejoin='round' stroke-linecap='round'/%3E%3Cpath d='M30 18 18 12v22l12 6' fill='none' stroke='%23000' stroke-width='3' stroke-linejoin='round'/%3E%3C/svg%3E"); }
.dais[data-title-id="paragon-sovereign"] .title-emblem { -webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='96' height='48' viewBox='0 0 96 48'%3E%3Cpath d='M22 38 28 12l12 10 8-14 8 14 12-10 6 26z' fill='none' stroke='%23000' stroke-width='3' stroke-linejoin='round'/%3E%3Cpath d='M22 38h52' fill='none' stroke='%23000' stroke-width='3' stroke-linecap='round'/%3E%3C/svg%3E"); mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='96' height='48' viewBox='0 0 96 48'%3E%3Cpath d='M22 38 28 12l12 10 8-14 8 14 12-10 6 26z' fill='none' stroke='%23000' stroke-width='3' stroke-linejoin='round'/%3E%3Cpath d='M22 38h52' fill='none' stroke='%23000' stroke-width='3' stroke-linecap='round'/%3E%3C/svg%3E"); }
.dais[data-title-id="grammar-master"] .title-emblem { -webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='96' height='48' viewBox='0 0 96 48'%3E%3Cpath d='M18 38c4-16 14-24 30-24s26 8 30 24' fill='none' stroke='%23000' stroke-width='3' stroke-linecap='round'/%3E%3Cpath d='M22 30c2-3 4-6 5-10M74 30c-2-3-4-6-5-10M30 22c2-2 4-3 6-4M66 22c-2-2-4-3-6-4' fill='none' stroke='%23000' stroke-width='2.6' stroke-linecap='round'/%3E%3C/svg%3E"); mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='96' height='48' viewBox='0 0 96 48'%3E%3Cpath d='M18 38c4-16 14-24 30-24s26 8 30 24' fill='none' stroke='%23000' stroke-width='3' stroke-linecap='round'/%3E%3Cpath d='M22 30c2-3 4-6 5-10M74 30c-2-3-4-6-5-10M30 22c2-2 4-3 6-4M66 22c-2-2-4-3-6-4' fill='none' stroke='%23000' stroke-width='2.6' stroke-linecap='round'/%3E%3C/svg%3E"); }
.dais[data-title-id="class-legend"] .title-emblem { -webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='96' height='48' viewBox='0 0 96 48'%3E%3Cpath d='M48 4l5 12 13 1-10 9 3 13-11-7-11 7 3-13-10-9 13-1z' fill='none' stroke='%23000' stroke-width='3' stroke-linejoin='round'/%3E%3Cpath d='M24 14l2 5 5 1-4 4 1 5-4-3-4 3 1-5-4-4 5-1zM72 14l2 5 5 1-4 4 1 5-4-3-4 3 1-5-4-4 5-1z' fill='none' stroke='%23000' stroke-width='2.4' stroke-linejoin='round'/%3E%3C/svg%3E"); mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='96' height='48' viewBox='0 0 96 48'%3E%3Cpath d='M48 4l5 12 13 1-10 9 3 13-11-7-11 7 3-13-10-9 13-1z' fill='none' stroke='%23000' stroke-width='3' stroke-linejoin='round'/%3E%3Cpath d='M24 14l2 5 5 1-4 4 1 5-4-3-4 3 1-5-4-4 5-1zM72 14l2 5 5 1-4 4 1 5-4-3-4 3 1-5-4-4 5-1z' fill='none' stroke='%23000' stroke-width='2.4' stroke-linejoin='round'/%3E%3C/svg%3E"); }

/* The character must always sit above its title backdrop. */
.dais-lg canvas { z-index: 2; }
.dais .viewer-fallback { position: relative; z-index: 2; }

/* Shop title preview: the title shown on its own backdrop, never cropped. */
.title-stage { display: grid; place-items: center; }
.title-stage-tag { position: relative; z-index: 2; display: grid; place-items: center; width: 100%; }
.title-stage-tag .hero-title-tag[data-title-labelled] { display: inline-block; width: auto; min-width: min(100%, 320px); padding-inline: 34px; }
.shop-title-thumb { display: grid; place-items: center; min-height: 96px; padding: 6px; }
.shop-title-thumb .hero-title-tag { font-size: 14px; }
.shop-title-thumb .title-ornament { width: 20px; height: 18px; }
