/* Living Frontier — parchment & iron. No external fonts, no CDN. */
:root {
  --ink: #efe3c6;
  --ink-dim: #c3b393;
  --ink-faint: #8f8269;
  --parch: #211d16;
  --parch-2: #1a1712;
  --parch-3: #2b261d;
  --panel: #262117;
  --panel-2: #302a1e;
  --line: #4a3f2c;
  --line-soft: #3a3224;
  --iron: #6d6a63;
  --brass: #c9a45b;
  --brass-dim: #8f763f;
  --blood: #b0432f;
  --blood-2: #8c3626;
  --moss: #7a9a55;
  --moss-2: #4f6b38;
  --amber: #d9a441;
  --rust: #c46a3a;
  --danger: #d4573f;
  --focus: #f2d489;
  --radius: 6px;
  --font: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background:
    radial-gradient(1200px 700px at 15% -10%, #332c20 0%, transparent 60%),
    radial-gradient(900px 600px at 110% 10%, #2c2419 0%, transparent 55%),
    var(--parch-2);
  color: var(--ink);
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.45;
  min-height: 100%;
  -webkit-font-smoothing: antialiased;
}

body {
  background-attachment: fixed;
}

a { color: var(--brass); }

h1, h2, h3, h4 {
  margin: 0 0 .4em;
  font-weight: 650;
  letter-spacing: .02em;
  color: var(--ink);
}
h1 { font-size: 1.55rem; }
h2 { font-size: 1.18rem; }
h3 { font-size: 0.98rem; text-transform: uppercase; letter-spacing: .08em; color: var(--brass); }
h4 { font-size: 0.9rem; }

p { margin: 0 0 .6em; }

small, .dim { color: var(--ink-dim); }
.faint { color: var(--ink-faint); }
.mono { font-family: var(--mono); }
.nowrap { white-space: nowrap; }
.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

/* ---------- focus & buttons ---------- */
:focus-visible {
  outline: 2px solid var(--focus);
  outline-offset: 2px;
  border-radius: 3px;
}

button, .btn {
  font: inherit;
  font-size: .86rem;
  color: var(--ink);
  background: linear-gradient(#3a3325, #2a251b);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: .38em .7em;
  cursor: pointer;
  text-align: center;
  line-height: 1.2;
  transition: border-color .12s ease, background .12s ease, color .12s ease;
  min-height: 30px;
}
button:hover:not(:disabled), .btn:hover:not(:disabled) {
  border-color: var(--brass-dim);
  background: linear-gradient(#443b2a, #302a1e);
}
button:active:not(:disabled) { background: #2a251b; }
button:disabled {
  opacity: .45;
  cursor: not-allowed;
  filter: grayscale(.4);
}
button.primary {
  background: linear-gradient(#6f5a2c, #57431d);
  border-color: var(--brass-dim);
  color: #fbf3dd;
  font-weight: 600;
}
button.primary:hover:not(:disabled) { background: linear-gradient(#806930, #64501f); }
button.danger {
  border-color: var(--blood-2);
  color: #f0c3b8;
  background: linear-gradient(#4a241d, #38201a);
}
button.danger:hover:not(:disabled) { border-color: var(--blood); background: linear-gradient(#5a2a20, #43251d); }
button.ghost {
  background: transparent;
  border-color: var(--line-soft);
}
button.tiny {
  font-size: .76rem;
  padding: .22em .45em;
  min-height: 24px;
}
button.linkish {
  background: none; border: none; padding: 0 .15em;
  color: var(--brass); text-decoration: underline; font-size: inherit;
  min-height: 0; cursor: pointer;
}
button.linkish:disabled { text-decoration: none; }

input[type="text"], input[type="password"], input[type="search"], select {
  font: inherit;
  font-size: .9rem;
  color: var(--ink);
  background: var(--parch-2);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: .45em .6em;
  width: 100%;
  min-height: 34px;
}
input::placeholder { color: var(--ink-faint); }
input:focus-visible, select:focus-visible {
  outline: 2px solid var(--focus);
  outline-offset: 1px;
  border-color: var(--brass-dim);
}
label { display: block; font-size: .82rem; color: var(--ink-dim); margin-bottom: .3em; }

/* ---------- layout primitives ---------- */
.card {
  background: linear-gradient(180deg, var(--panel-2), var(--panel));
  border: 1px solid var(--line-soft);
  border-radius: var(--radius);
  padding: .75rem .85rem;
  margin-bottom: .8rem;
  box-shadow: 0 1px 0 rgba(0,0,0,.25) inset, 0 6px 18px rgba(0,0,0,.18);
}
.card.plain { background: var(--parch); }

.row { display: flex; gap: .5em; align-items: center; flex-wrap: wrap; }
.row.spread { justify-content: space-between; }
.row.tight { gap: .3em; }
.stack > * + * { margin-top: .45em; }
.sep { border-top: 1px dashed var(--line-soft); margin: .6em 0; }
.hidden { display: none !important; }

/* ---------- meter bars ---------- */
.bar {
  position: relative;
  height: 12px;
  border-radius: 999px;
  background: #15120d;
  border: 1px solid var(--line-soft);
  overflow: hidden;
}
.bar > .fill {
  height: 100%;
  width: 0%;
  background: var(--moss-2);
  transition: width .25s ease;
}
.bar.hp > .fill { background: linear-gradient(90deg, #7b3a2a, #b0432f); }
.bar.hp.mid > .fill { background: linear-gradient(90deg, #8a6420, #d9a441); }
.bar.hp.high > .fill { background: linear-gradient(90deg, #4f6b38, #7a9a55); }
.bar.xp { height: 8px; }
.bar.xp > .fill { background: linear-gradient(90deg, #6e5c2a, #c9a45b); }
.bar.threat > .fill { background: var(--moss-2); }
.bar.threat.warn > .fill { background: var(--amber); }
.bar.threat.high > .fill { background: var(--rust); }
.bar.threat.severe > .fill { background: var(--blood); }
.bar-label {
  display: flex; justify-content: space-between; align-items: baseline;
  font-size: .78rem; color: var(--ink-dim);
  gap: .5em;
}
.bar-label b { color: var(--ink); font-weight: 600; }

/* ---------- top bar ---------- */
.topbar {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; justify-content: space-between; gap: .75em;
  padding: .55em 1em;
  background: rgba(26, 23, 18, .94);
  border-bottom: 1px solid var(--line-soft);
  backdrop-filter: blur(4px);
}
.brand {
  display: flex; align-items: baseline; gap: .55em; min-width: 0;
}
.brand .mark {
  color: var(--brass); font-size: 1.1rem; letter-spacing: .14em; font-weight: 700;
  text-transform: uppercase;
}
.brand .sub { color: var(--ink-faint); font-size: .74rem; letter-spacing: .12em; text-transform: uppercase; }
.topbar .who { font-size: .82rem; color: var(--ink-dim); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.topbar .actions { display: flex; gap: .4em; align-items: center; flex-wrap: wrap; justify-content: flex-end; }

/* ---------- auth / select screens ---------- */
.screen { max-width: 980px; margin: 0 auto; padding: 2rem 1rem 3rem; }
.screen.narrow { max-width: 460px; }
.hero { text-align: center; margin-bottom: 1.4rem; }
.hero h1 { font-size: 1.9rem; letter-spacing: .04em; }
.hero .region { color: var(--brass); text-transform: uppercase; letter-spacing: .22em; font-size: .74rem; }
.hero p { color: var(--ink-dim); max-width: 46ch; margin: .6em auto 0; }

.tabs { display: flex; gap: 0; border-bottom: 1px solid var(--line); margin-bottom: 1rem; }
.tabs button {
  flex: 1;
  border: none; border-bottom: 2px solid transparent;
  border-radius: 0; background: transparent;
  padding: .6em; color: var(--ink-dim); font-weight: 600;
}
.tabs button[aria-selected="true"] { color: var(--ink); border-bottom-color: var(--brass); background: rgba(201,164,91,.06); }
.tabs button:hover:not(:disabled) { background: rgba(201,164,91,.06); }

.field { margin-bottom: .8rem; }
.field-error { color: var(--danger); font-size: .78rem; margin-top: .25em; min-height: 1em; }
.form-error {
  border: 1px solid var(--blood-2);
  background: rgba(176, 67, 47, .12);
  color: #f3c9bf;
  border-radius: var(--radius);
  padding: .55em .7em;
  margin-bottom: .8rem;
  font-size: .86rem;
}

.class-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: .6rem; }
.class-card {
  text-align: left;
  padding: .7em;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: linear-gradient(180deg, #2b2519, #221d14);
  cursor: pointer;
  display: flex; flex-direction: column; gap: .35em;
}
.class-card:hover { border-color: var(--brass-dim); }
.class-card[aria-pressed="true"] {
  border-color: var(--brass);
  box-shadow: 0 0 0 1px var(--brass) inset, 0 0 18px rgba(201,164,91,.12);
  background: linear-gradient(180deg, #36301f, #282214);
}
.class-card .cls-name { font-weight: 700; color: var(--ink); }
.class-card .cls-blurb { font-size: .76rem; color: var(--ink-dim); }
.statgrid {
  display: grid; grid-template-columns: repeat(2, minmax(0,1fr));
  gap: .15em .6em; font-size: .78rem; font-family: var(--mono); color: var(--ink);
}
.statgrid .k { color: var(--ink-faint); }

.char-list { display: flex; flex-direction: column; gap: .5rem; margin-bottom: 1rem; }
.char-row {
  display: flex; align-items: center; gap: .7em; justify-content: space-between;
  padding: .6em .75em;
  border: 1px solid var(--line-soft); border-radius: var(--radius);
  background: var(--panel);
}
.char-row .meta { min-width: 0; }
.char-row .nm { font-weight: 650; }
.char-row .sub { font-size: .78rem; color: var(--ink-dim); }

/* ---------- game shell ---------- */
.shell {
  display: grid;
  grid-template-columns: minmax(250px, 300px) minmax(0, 1fr) minmax(250px, 300px);
  gap: .85rem;
  padding: .85rem;
  max-width: 1500px;
  margin: 0 auto;
  align-items: start;
}
.col { min-width: 0; }
.col.left, .col.right { position: sticky; top: 56px; }
.col-stack { display: flex; flex-direction: column; }

.sheet-head { display: flex; justify-content: space-between; gap: .5em; align-items: flex-start; }
.sheet-head .nm { font-size: 1.1rem; font-weight: 700; }
.chip {
  display: inline-block;
  font-size: .72rem; padding: .12em .5em;
  border: 1px solid var(--line); border-radius: 999px;
  color: var(--ink-dim); background: var(--parch);
  text-transform: uppercase; letter-spacing: .06em;
}
.chip.ok { border-color: var(--moss-2); color: #cfe0b4; }
.chip.warn { border-color: var(--brass-dim); color: #eed9a4; }
.chip.bad { border-color: var(--blood-2); color: #f0bfb4; }

.stats-row {
  display: grid; grid-template-columns: repeat(4, 1fr); gap: .3em;
  margin: .55em 0 .1em;
}
.stat {
  background: var(--parch); border: 1px solid var(--line-soft); border-radius: var(--radius);
  padding: .3em .35em; text-align: center;
}
.stat .k { display: block; font-size: .64rem; color: var(--ink-faint); text-transform: uppercase; letter-spacing: .08em; }
.stat .v { font-family: var(--mono); font-weight: 700; font-size: .95rem; }

.slot-list { display: flex; flex-direction: column; gap: .3em; }
.slot {
  display: flex; justify-content: space-between; align-items: center; gap: .5em;
  padding: .3em .45em; border: 1px dashed var(--line-soft); border-radius: var(--radius);
  font-size: .82rem; min-height: 34px;
}
.slot .slot-name { color: var(--ink-faint); text-transform: uppercase; font-size: .66rem; letter-spacing: .08em; display: block; }
.slot .slot-item { color: var(--ink); }
.slot.empty .slot-item { color: var(--ink-faint); font-style: italic; }

.inv-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: .28em; max-height: 300px; overflow-y: auto; }
.inv-item {
  display: grid; grid-template-columns: minmax(0,1fr) auto; gap: .2em .5em;
  padding: .3em .45em; border-radius: var(--radius);
  background: rgba(0,0,0,.14); border: 1px solid transparent;
}
.inv-item:hover { border-color: var(--line-soft); }
.inv-item .nm { font-size: .84rem; overflow: hidden; text-overflow: ellipsis; }
.inv-item .qty { font-family: var(--mono); color: var(--brass); font-size: .8rem; }
.inv-item .acts { grid-column: 1 / -1; display: flex; gap: .25em; flex-wrap: wrap; }
.inv-item .desc { grid-column: 1 / -1; font-size: .72rem; color: var(--ink-faint); }

/* ---------- centre column ---------- */
.loc-hero { position: relative; overflow: hidden; }
.loc-hero .kicker {
  font-size: .68rem; letter-spacing: .18em; text-transform: uppercase; color: var(--ink-faint);
}
.loc-hero h2 { font-size: 1.4rem; margin: .1em 0 .25em; }
.loc-hero .desc { color: var(--ink-dim); font-size: .9rem; max-width: 70ch; }
.loc-hero .badges { display: flex; gap: .35em; flex-wrap: wrap; margin-top: .55em; }

.section-head {
  display: flex; justify-content: space-between; align-items: baseline; gap: .5em;
  margin: .9em 0 .45em;
}
.section-head h3 { margin: 0; }
.section-head .hint { font-size: .74rem; color: var(--ink-faint); }

.exit-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: .5em; }
.exit-btn {
  display: flex; flex-direction: column; align-items: flex-start; gap: .25em;
  padding: .55em .65em; text-align: left; min-height: 56px;
}
.exit-btn .dest { font-weight: 650; font-size: .9rem; }
.exit-btn .meta { font-size: .74rem; color: var(--ink-dim); display: flex; gap: .45em; align-items: center; flex-wrap: wrap; }
.exit-btn .mini-bar { width: 100%; }

.threat-band { font-size: .72rem; font-weight: 600; letter-spacing: .04em; }
.threat-band.calm { color: #a8c48a; }
.threat-band.warn { color: var(--amber); }
.threat-band.high { color: var(--rust); }
.threat-band.severe { color: var(--danger); }

.npc-list { display: flex; flex-direction: column; gap: .4em; }
.npc-row {
  display: flex; justify-content: space-between; align-items: center; gap: .6em;
  padding: .45em .55em; border: 1px solid var(--line-soft); border-radius: var(--radius);
  background: rgba(0,0,0,.12);
}
.npc-row .nm { font-weight: 600; font-size: .88rem; }
.npc-row .role { font-size: .76rem; color: var(--ink-dim); }

table.grid {
  width: 100%; border-collapse: collapse; font-size: .82rem;
}
table.grid th {
  text-align: left; font-size: .68rem; letter-spacing: .08em; text-transform: uppercase;
  color: var(--ink-faint); font-weight: 600; padding: .25em .4em; border-bottom: 1px solid var(--line-soft);
}
table.grid td { padding: .32em .4em; border-bottom: 1px solid rgba(74,63,44,.35); vertical-align: middle; }
table.grid tr:last-child td { border-bottom: none; }
table.grid td.num { font-family: var(--mono); white-space: nowrap; text-align: right; }
table.grid td.acts { white-space: nowrap; text-align: right; }
table.grid td.acts .btn { margin-left: .2em; }
.sold-out { color: var(--danger); font-size: .76rem; }

.list-plain { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: .45em; }
.recipe-row, .quest-row, .upgrade-row {
  border: 1px solid var(--line-soft); border-radius: var(--radius);
  padding: .5em .6em; background: rgba(0,0,0,.12);
}
.req-list { list-style: none; margin: .25em 0 0; padding: 0; display: flex; gap: .35em; flex-wrap: wrap; font-size: .76rem; }
.req { padding: .08em .4em; border-radius: 999px; border: 1px solid var(--line); font-family: var(--mono); font-size: .74rem; }
.req.have { color: #cfe0b4; border-color: var(--moss-2); }
.req.missing { color: #f3b4a6; border-color: var(--blood-2); background: rgba(176,67,47,.12); }

.stage-track { display: flex; gap: .2em; margin-top: .35em; }
.stage-track .pip {
  height: 5px; flex: 1; border-radius: 999px; background: #15120d; border: 1px solid var(--line-soft);
}
.stage-track .pip.done { background: var(--moss-2); border-color: var(--moss-2); }
.stage-track .pip.now { background: var(--brass); border-color: var(--brass); }

.empty-note { color: var(--ink-faint); font-size: .82rem; font-style: italic; padding: .3em 0; }

/* ---------- right column ---------- */
.clock { font-family: var(--mono); font-size: 1.4rem; letter-spacing: .04em; }
.clock small { font-size: .7rem; color: var(--ink-faint); letter-spacing: .06em; }
.faction-row { margin-bottom: .5em; }
.faction-row .top { display: flex; justify-content: space-between; font-size: .8rem; gap: .4em; }
.faction-row .top .nm { font-weight: 600; }

.chronicle { list-style: none; margin: 0; padding: 0; max-height: 46vh; overflow-y: auto; display: flex; flex-direction: column; gap: .35em; }
.chronicle li {
  font-size: .8rem; padding: .35em .45em; border-left: 2px solid var(--line-soft);
  background: rgba(0,0,0,.1);
}
.chronicle .when { font-family: var(--mono); font-size: .66rem; color: var(--ink-faint); display: block; }
.chronicle .kind { color: var(--brass); font-size: .66rem; text-transform: uppercase; letter-spacing: .06em; }

.ai-line {
  border: 1px solid var(--line-soft); border-left: 3px solid var(--moss-2);
  background: rgba(0,0,0,.12); padding: .5em .6em; border-radius: var(--radius);
  font-size: .85rem; margin-top: .5em;
}
.ai-line .said { font-style: italic; color: var(--ink); }
.ai-line .byline { font-size: .7rem; color: var(--ink-faint); margin-top: .25em; display: flex; gap: .4em; align-items: center; flex-wrap: wrap; }
.ai-badge {
  display: inline-block; font-size: .63rem; letter-spacing: .08em; text-transform: uppercase;
  padding: .05em .4em; border-radius: 3px; border: 1px solid;
}
.ai-badge.model { color: #cfe0b4; border-color: var(--moss-2); background: rgba(122,154,85,.12); }
.ai-badge.fallback { color: #f0c9a0; border-color: #8a5a2a; background: rgba(196,106,58,.14); }
.ai-line.fallback { border-left-color: var(--rust); background: repeating-linear-gradient(-45deg, rgba(196,106,58,.06), rgba(196,106,58,.06) 6px, transparent 6px, transparent 12px); }
.ai-line.fallback .said { font-style: normal; }
.ai-status { font-size: .74rem; display: flex; flex-direction: column; gap: .12em; color: var(--ink-dim); }
.ai-status .k { color: var(--ink-faint); }
.ai-status .err { color: #f3b4a6; word-break: break-word; }

/* ---------- toasts ---------- */
.toast-zone {
  position: fixed; right: .8rem; bottom: .8rem; z-index: 60;
  display: flex; flex-direction: column; gap: .4rem; max-width: min(92vw, 380px);
}
.toast {
  display: flex; gap: .55em; align-items: flex-start;
  background: #2a2117; color: var(--ink);
  border: 1px solid var(--brass-dim);
  border-left: 4px solid var(--brass);
  border-radius: var(--radius);
  padding: .55em .65em;
  font-size: .84rem;
  box-shadow: 0 8px 24px rgba(0,0,0,.45);
  animation: toast-in .16s ease-out;
}
.toast.error { border-left-color: var(--blood); border-color: var(--blood-2); background: #331d17; }
.toast.ok { border-left-color: var(--moss); border-color: var(--moss-2); }
.toast .msg { flex: 1; word-break: break-word; }
.toast button { min-height: 0; padding: 0 .3em; background: none; border: none; color: var(--ink-faint); font-size: 1.05rem; line-height: 1; }
.toast button:hover:not(:disabled) { color: var(--ink); background: none; }
@keyframes toast-in { from { transform: translateY(6px); opacity: 0; } to { transform: none; opacity: 1; } }

/* ---------- combat overlay ---------- */
.overlay {
  position: fixed; inset: 0; z-index: 50;
  background: rgba(10, 8, 6, .78);
  display: flex; align-items: center; justify-content: center;
  padding: 1rem;
  overflow-y: auto;
}
.overlay[hidden] { display: none; }
.combat {
  width: min(680px, 100%); max-height: calc(100vh - 2rem); overflow-y: auto;
  background: linear-gradient(180deg, #2c2419, #1f1a13);
  border: 1px solid var(--brass-dim);
  border-radius: 8px;
  box-shadow: 0 20px 60px rgba(0,0,0,.6);
  padding: 1rem 1.1rem 1.1rem;
}
.combat-head { display: flex; justify-content: space-between; align-items: baseline; gap: .5em; }
.combat-head .round { font-family: var(--mono); color: var(--brass); font-size: .82rem; }
.enemy-name { font-size: 1.2rem; font-weight: 700; }
.enemy-hp { margin-top: .35em; }
.combat-actions { display: grid; grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); gap: .45em; margin: .8em 0; }
.combat-actions button { min-height: 42px; font-size: .9rem; }
.combat-actions button.primary { font-weight: 700; }
.combat-pick {
  border: 1px solid var(--line); border-radius: var(--radius); padding: .5em;
  margin-bottom: .7em; background: rgba(0,0,0,.18);
}
.combat-pick .row { gap: .35em; }
.combat-log {
  font-family: var(--mono); font-size: .78rem; line-height: 1.5;
  background: #14110c; border: 1px solid var(--line-soft); border-radius: var(--radius);
  padding: .6em .7em; height: 150px; overflow-y: auto;
  white-space: pre-wrap; word-break: break-word;
}
.combat-log .you { color: #d8e4bf; }
.combat-log .foe { color: #f0b9ad; }
.combat-log .sys { color: var(--ink-faint); }
.outcome {
  border: 1px solid var(--line); border-radius: var(--radius);
  padding: .8em; margin-top: .8em; background: rgba(0,0,0,.2);
}
.outcome.victory { border-color: var(--brass-dim); }
.outcome.defeat { border-color: var(--blood-2); }
.outcome h3 { margin-bottom: .35em; }

/* ---------- map ---------- */
.map-wrap { position: relative; }
.map-canvas {
  display: block; width: 100%; height: auto;
  border: 1px solid var(--line-soft); border-radius: var(--radius);
  background: #191510;
  cursor: default;
  touch-action: manipulation;
}
.map-canvas.clickable { cursor: pointer; }
.map-legend { display: flex; gap: .7em; flex-wrap: wrap; font-size: .7rem; color: var(--ink-faint); margin-top: .35em; }
.map-legend .sw { display: inline-block; width: 9px; height: 9px; border-radius: 2px; margin-right: .25em; vertical-align: middle; }
.map-hint { font-size: .74rem; color: var(--ink-dim); min-height: 1.2em; margin-top: .2em; }

/* ---------- misc ---------- */
.busy-dot { display: inline-block; width: 7px; height: 7px; border-radius: 50%; background: var(--brass); animation: pulse 1s infinite; }
@keyframes pulse { 50% { opacity: .25; } }
.loading { text-align: center; padding: 3rem 1rem; color: var(--ink-dim); }

@media (prefers-reduced-motion: reduce) {
  * { animation: none !important; transition: none !important; }
}

/* ---------- responsive ---------- */
@media (max-width: 1080px) {
  .shell { grid-template-columns: minmax(230px, 270px) minmax(0, 1fr); }
  .col.right { grid-column: 1 / -1; position: static; }
  .col.right .col-stack { display: grid; grid-template-columns: 1fr 1fr; gap: .8rem; align-items: start; }
  .col.right .col-stack > .card { margin-bottom: 0; }
}
@media (max-width: 820px) {
  .shell { grid-template-columns: 1fr; }
  .col.left, .col.right { position: static; }
  .col.right .col-stack { grid-template-columns: 1fr; }
  .col.main { order: -1; }
  .class-grid { grid-template-columns: 1fr; }
}
@media (max-width: 480px) {
  body { font-size: 14px; }
  .shell { padding: .6rem; gap: .6rem; }
  .topbar { padding: .45em .6em; }
  .brand .sub { display: none; }
  .chat-who { display: none; }
  .screen { padding: 1.2rem .7rem 2rem; }
  .exit-grid { grid-template-columns: 1fr; }
  .stats-row { grid-template-columns: repeat(2, 1fr); }
  .combat { padding: .8rem; }
  .combat-actions { grid-template-columns: 1fr 1fr; }
  table.grid { font-size: .78rem; }
  table.grid th:nth-child(3), table.grid td:nth-child(3) { display: none; }
  .toast-zone { left: .5rem; right: .5rem; max-width: none; }
}
@media (max-width: 380px) {
  .exit-grid { grid-template-columns: 1fr; }
  .combat-actions { grid-template-columns: 1fr; }
  .topbar .who { display: none; }
}
