/* Undecim Trail: an illustrated frontier journal. Parchment, ink and leather. */
:root {
  --paper: #f1e4c6;
  --paper-2: #e8d6b0;
  --paper-3: #dcc597;
  --ink: #2b2118;
  --ink-soft: #5b4a38;
  --muted: #7a6650;
  --rule: #b49a6e;
  --leather: #3b2c1d;
  --leather-2: #523d28;
  --accent: #8a3b1e;
  --accent-2: #b8662e;
  --good: #4f6b2e;
  --mid: #a5781f;
  --bad: #9a2f22;
  --shadow: 0 2px 0 rgba(60, 40, 20, .15), 0 8px 24px rgba(40, 25, 10, .18);
  --radius: 6px;
  --fs: 16px;
  --serif: "Iowan Old Style", "Palatino Linotype", Palatino, "Book Antiqua", Georgia, serif;
  --display: "Iowan Old Style", "Palatino Linotype", Palatino, Georgia, serif;
  color-scheme: light;
}
:root[data-text="s"] { --fs: 14px; }
:root[data-text="l"] { --fs: 18px; }
:root[data-text="xl"] { --fs: 21px; }
:root[data-contrast="high"] { --ink: #000; --ink-soft: #1d1610; --muted: #3e3020; --rule: #6d5636; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --paper: #2c2219; --paper-2: #362a1f; --paper-3: #44362a; --ink: #f0e3c6; --ink-soft: #d9c7a3; --muted: #b29d7c; --rule: #6e5940;
    --leather: #18110b; --leather-2: #241a12; --accent: #e08b5a; --accent-2: #e9a24a; --good: #9cbd6a; --mid: #e0b04a; --bad: #ec7a66;
    color-scheme: dark;
  }
}
:root[data-theme="dark"] { --paper: #2c2219; --paper-2: #362a1f; --paper-3: #44362a; --ink: #f0e3c6; --ink-soft: #d9c7a3; --muted: #b29d7c; --rule: #6e5940; --leather: #18110b; --leather-2: #241a12; --accent: #e08b5a; --accent-2: #e9a24a; --good: #9cbd6a; --mid: #e0b04a; --bad: #ec7a66; }

* { box-sizing: border-box; }
html { font-size: var(--fs); -webkit-text-size-adjust: 100%; }
body {
  margin: 0; min-height: 100vh; color: var(--ink); font-family: var(--serif); line-height: 1.45;
  background: var(--leather);
  background-image: radial-gradient(ellipse at 50% 0%, rgba(255, 220, 160, .08), transparent 60%);
}
.no-anim *, .no-anim *::before, .no-anim *::after { transition: none !important; animation: none !important; }
@media (prefers-reduced-motion: reduce) { * { transition: none !important; animation: none !important; } }
h1, h2, h3, h4 { font-family: var(--display); font-weight: 600; margin: .2em 0 .4em; line-height: 1.15; }
h1 { font-size: 2.2rem; letter-spacing: .02em; }
h2 { font-size: 1.35rem; }
h3 { font-size: 1.1rem; }
h4 { font-size: 1rem; color: var(--ink-soft); border-bottom: 1px solid var(--rule); padding-bottom: .15em; margin-top: 1em; }
p { margin: .35em 0 .6em; }
a { color: var(--accent); }
.muted { color: var(--muted); }
.small { font-size: .85rem; }
.good { color: var(--good); }
.bad { color: var(--bad); }
.row { display: flex; align-items: center; }
.col { display: flex; flex-direction: column; }
.gap { gap: .6rem; }
.wrap { flex-wrap: wrap; }
.end { justify-content: flex-end; }
.center { justify-content: center; }
.noscript { color: #fff; padding: 2rem; }

/* Paper surfaces */
.paper, .modal, .create, .end-card, .title-card, .status-panel, .actions-panel, .party-panel, .report-panel {
  background-color: var(--paper);
  background-image:
    radial-gradient(ellipse at 20% 10%, rgba(255, 255, 255, .18), transparent 50%),
    radial-gradient(ellipse at 90% 90%, rgba(120, 80, 30, .10), transparent 55%);
  border: 1px solid var(--rule);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

/* Buttons */
.btn {
  font: inherit; font-size: .95rem; color: var(--ink); background: var(--paper-2); border: 1px solid var(--rule); border-bottom-width: 2px;
  padding: .45em .9em; border-radius: 5px; cursor: pointer; display: inline-flex; align-items: center; gap: .4em; min-height: 2.4rem;
  transition: background .15s, transform .05s;
}
.btn:hover:not([disabled]) { background: var(--paper-3); }
.btn:active:not([disabled]) { transform: translateY(1px); }
.btn:focus-visible, .tab:focus-visible, .card:focus-visible, .chip:focus-visible, select:focus-visible, input:focus-visible { outline: 3px solid var(--accent-2); outline-offset: 2px; }
.btn[disabled] { opacity: .45; cursor: not-allowed; }
.btn.primary { background: var(--accent); color: #fff7e8; border-color: #5e2410; }
.btn.primary:hover:not([disabled]) { background: #9c4724; }
.btn.accent { border-color: var(--accent); color: var(--accent); }
.btn.secondary { background: transparent; }
.btn.danger { color: var(--bad); border-color: var(--bad); background: transparent; }
.btn.big { font-size: 1.1rem; padding: .6em 1.2em; }
.btn.small { font-size: .82rem; padding: .25em .6em; min-height: 2rem; }
.btn.icon { min-width: 2rem; justify-content: center; }
.btn .ico { font-size: 1.05em; }
.icon-btn { background: none; border: 0; color: inherit; font-size: 1.2rem; cursor: pointer; padding: .2em .45em; border-radius: 4px; }
.icon-btn:hover { background: rgba(0, 0, 0, .08); }

input, select, textarea { font: inherit; font-size: .95rem; color: var(--ink); background: #fffaf0; border: 1px solid var(--rule); border-radius: 4px; padding: .35em .5em; min-height: 2.2rem; max-width: 100%; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) input, :root:not([data-theme="light"]) select { background: #1f1711; } }
input[type="range"] { padding: 0; accent-color: var(--accent); }
input[type="checkbox"] { min-height: auto; accent-color: var(--accent); width: 1.1em; height: 1.1em; }
.field { display: flex; flex-direction: column; gap: .2em; margin: .4em 0; }
.field > span { font-size: .85rem; color: var(--muted); }
.field.inline { flex-direction: row; align-items: center; gap: .5em; justify-content: space-between; }
.check { display: flex; align-items: center; gap: .4em; margin: .4em 0; cursor: pointer; }
label.inline { display: inline-flex; align-items: center; gap: .3em; }

/* Bars */
.bar { height: 7px; background: rgba(60, 40, 20, .15); border-radius: 4px; overflow: hidden; min-width: 50px; }
.bar > span { display: block; height: 100%; background: var(--good); border-radius: 4px; }
.bar.mid > span { background: var(--mid); }
.bar.bad > span { background: var(--bad); }
.bar.invert.good > span { background: var(--ink-soft); }

/* ---------- Title ---------- */
.screen-title { min-height: 100vh; }
.title-wrap { position: relative; min-height: 100vh; display: grid; place-items: center; padding: 1rem; overflow: hidden; }
.title-scene, .end-scene { position: fixed; inset: 0; width: 100%; height: 100%; z-index: 0; }
.title-card { position: relative; z-index: 1; max-width: 34rem; padding: 2rem 2.2rem; text-align: center; }
.title-card h1 { font-size: clamp(2.4rem, 8vw, 3.6rem); margin: 0; color: var(--leather-2); text-shadow: 0 1px 0 rgba(255, 255, 255, .4); }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .title-card h1 { color: var(--accent-2); } }
.kicker { text-transform: uppercase; letter-spacing: .18em; font-size: .78rem; color: var(--accent); margin: 0; }
.lede { font-size: 1.05rem; color: var(--ink-soft); }
.title-card .col { margin-top: 1.2rem; align-items: stretch; }
.title-card .btn { justify-content: center; }

/* ---------- Creation ---------- */
.create { max-width: 1100px; margin: 1rem auto; padding: 1rem 1.4rem; }
.create-head h1 { margin-bottom: .2em; }
.steps { list-style: none; display: flex; flex-wrap: wrap; gap: .3rem; padding: 0; margin: 0 0 1rem; }
.steps button { font: inherit; font-size: .85rem; background: none; border: 1px solid var(--rule); border-radius: 20px; padding: .2em .8em; color: var(--muted); cursor: pointer; }
.steps li.on button { background: var(--accent); color: #fff7e8; border-color: var(--accent); }
.steps li.done button { color: var(--ink); }
.steps button[disabled] { cursor: default; }
.create-foot { display: flex; align-items: center; justify-content: space-between; gap: 1rem; border-top: 1px solid var(--rule); margin-top: 1rem; padding-top: .8rem; position: sticky; bottom: 0; background: var(--paper); }
.grid2 { display: grid; grid-template-columns: 1fr 1.3fr; gap: 1.6rem; }
.grid-outfit { display: grid; grid-template-columns: minmax(260px, .8fr) 1.6fr; gap: 1.4rem; }
.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: .5rem; }
.cards.wide { grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); }
.card { font: inherit; text-align: left; color: var(--ink); background: var(--paper-2); border: 1px solid var(--rule); border-radius: var(--radius); padding: .6rem .7rem; display: flex; flex-direction: column; gap: .25rem; cursor: pointer; }
.card:hover:not([disabled]) { background: var(--paper-3); }
.card.on { border: 2px solid var(--accent); background: #f7e7c2; box-shadow: inset 0 0 0 1px var(--accent); }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .card.on { background: #4a3522; } }
.card[disabled] { opacity: .5; cursor: not-allowed; }
.chips { display: flex; flex-wrap: wrap; gap: .35rem; }
.chip { font: inherit; font-size: .82rem; border: 1px solid var(--rule); border-radius: 14px; padding: .15em .65em; background: transparent; color: var(--ink-soft); cursor: pointer; }
span.chip { cursor: default; display: inline-block; margin: 0 .2em .2em 0; }
.chip.good { border-color: var(--good); }
.chip.on { background: var(--accent); color: #fff7e8; border-color: var(--accent); }
.leader-row { display: flex; gap: 1rem; align-items: flex-start; }
.family-list { display: flex; flex-direction: column; gap: .5rem; margin: .8rem 0; }
.family-row { display: flex; gap: .5rem; align-items: center; flex-wrap: wrap; }
.family-row input:first-of-type { flex: 1 1 12rem; }
.dials { margin-top: .8rem; display: grid; grid-template-columns: 1fr; gap: .1rem; }
.dial { flex-direction: row; align-items: center; gap: .6em; }
.dial > span { flex: 0 0 11rem; }
.dial input { flex: 1; }
.dial output { flex: 0 0 3.5rem; text-align: right; font-size: .85rem; }
.outfit-summary { display: flex; flex-direction: column; gap: .2rem; }
.warn { color: var(--bad); padding-left: 1.2rem; margin: .4rem 0; }

/* ---------- Game layout ---------- */
.screen-game { min-height: 100vh; }
.topbar { display: flex; flex-wrap: wrap; align-items: center; gap: .4rem 1.2rem; padding: .5rem 1rem; color: #f3e6c9; background: linear-gradient(var(--leather-2), var(--leather)); border-bottom: 2px solid #1c140c; position: sticky; top: 0; z-index: 5; }
.topbar .muted { color: #c9b48e; }
.topbar .brand { display: flex; flex-direction: column; line-height: 1.1; }
.topbar .brand strong { font-size: 1.15rem; letter-spacing: .04em; }
.topbar .when { font-size: .95rem; }
.topbar .weather { font-size: .92rem; }
.topbar .menu { margin-left: auto; display: flex; flex-wrap: wrap; gap: .3rem; }
.topbar .btn { background: rgba(255, 240, 210, .08); color: #f3e6c9; border-color: #6e5638; }
.topbar .btn:hover { background: rgba(255, 240, 210, .18); }
.game { max-width: 1280px; margin: 0 auto; padding: .7rem; }
.scene-wrap { position: relative; border-radius: var(--radius); overflow: hidden; border: 2px solid #1c140c; box-shadow: var(--shadow); background: #556; }
.scene { display: block; width: 100%; height: clamp(190px, 34vh, 360px); }
.scene-cap { position: absolute; left: .8rem; bottom: .6rem; color: #fff8e6; text-shadow: 0 1px 3px rgba(0, 0, 0, .8); }
.scene-cap .place { font-size: 1.35rem; font-weight: 600; }
.game-cols { display: grid; grid-template-columns: 1.6fr 1fr; gap: .7rem; margin-top: .7rem; }
.col-main, .col-side { display: flex; flex-direction: column; gap: .7rem; min-width: 0; }
.status-panel, .actions-panel, .party-panel, .report-panel { padding: .7rem .9rem; }
.panel-title { font-size: .8rem; text-transform: uppercase; letter-spacing: .14em; color: var(--accent); margin: 0 0 .5rem; }
.srow { display: grid; grid-template-columns: 5.2rem 1fr; gap: .1rem .6rem; align-items: center; font-size: .92rem; margin-bottom: .3rem; }
.srow .sl { color: var(--muted); }
.srow .bar { grid-column: 2; }
.controls { margin-top: .6rem; border-top: 1px solid var(--rule); padding-top: .4rem; }
.action-row { display: flex; flex-wrap: wrap; gap: .5rem; margin: .4rem 0; }
.secondary-actions .btn { font-size: .9rem; }
.note { background: rgba(165, 120, 31, .14); border-left: 3px solid var(--mid); padding: .35rem .6rem; border-radius: 3px; }
.end-exp { margin-top: .8rem; }
.end-exp summary { cursor: pointer; }
.mini-party { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: .4rem; }
.mini-person { font: inherit; display: flex; gap: .45rem; align-items: center; background: var(--paper-2); border: 1px solid var(--rule); border-radius: 5px; padding: .3rem; cursor: pointer; color: var(--ink); text-align: left; min-width: 0; }
.mini-person svg { flex: 0 0 auto; border-radius: 50%; }
.mp-text { display: flex; flex-direction: column; min-width: 0; flex: 1; gap: .1rem; }
.mp-name { font-weight: 600; font-size: .9rem; }
.mp-status { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mp-status.bad { color: var(--bad); }
.report-panel .latest { border-left: 3px solid var(--accent); padding-left: .6rem; margin-bottom: .6rem; }
.report-panel .latest p { margin: .2rem 0; }
.log p { margin: .15rem 0; font-size: .9rem; }
.log.warn, p.log.warn { color: var(--bad); }

/* ---------- Modal ---------- */
.shade { position: fixed; inset: 0; z-index: 20; background: rgba(20, 12, 5, .55); display: grid; place-items: center; padding: .8rem; animation: fade .15s ease-out; }
@keyframes fade { from { opacity: 0; } }
.modal { width: min(640px, 100%); max-height: calc(100vh - 1.6rem); display: flex; flex-direction: column; animation: rise .18s ease-out; }
.modal.wide { width: min(980px, 100%); }
@keyframes rise { from { transform: translateY(10px); opacity: 0; } }
.modal-head { display: flex; align-items: center; gap: .6rem; padding: .6rem .9rem; border-bottom: 1px solid var(--rule); }
.modal-head h2 { margin: 0; flex: 1; font-size: 1.3rem; }
.modal-icon { font-size: 1.4rem; color: var(--accent); }
.modal-body { padding: .8rem 1rem 1rem; overflow: auto; }
.situation .modal-head { background: rgba(138, 59, 30, .08); }
.situation.danger .modal-head { background: rgba(154, 47, 34, .16); }
.night .modal-head { background: rgba(40, 50, 90, .15); }
.story { font-size: 1.05rem; }
.choices { display: flex; flex-direction: column; gap: .4rem; margin: .6rem 0; }
.choice-row { display: grid; grid-template-columns: minmax(12rem, auto) 1fr; gap: .2rem .8rem; align-items: center; }
.choice { justify-content: flex-start; text-align: left; }
.hint { font-size: .85rem; color: var(--muted); }
.result-lines p { margin: .3rem 0; }
.result-lines { border-left: 3px solid var(--accent); padding-left: .7rem; margin: .5rem 0; }
.stats-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: .4rem .8rem; margin: .5rem 0; }
.stats-grid.small .stat { font-size: .88rem; }
.stat { display: flex; flex-direction: column; background: rgba(255, 255, 255, .25); border: 1px solid rgba(180, 154, 110, .5); border-radius: 4px; padding: .3rem .5rem; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .stat { background: rgba(0, 0, 0, .15); } }
.stat-l { font-size: .75rem; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); }
.stat-v { font-weight: 600; }
.tabs { display: flex; flex-wrap: wrap; gap: .25rem; border-bottom: 1px solid var(--rule); margin: .4rem 0 .6rem; }
.tab { font: inherit; background: none; border: 1px solid transparent; border-bottom: 0; padding: .35em .8em; cursor: pointer; color: var(--muted); border-radius: 5px 5px 0 0; }
.tab.on { color: var(--ink); border-color: var(--rule); background: var(--paper-2); font-weight: 600; }
.market-head { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: .4rem; }
.market-list { display: flex; flex-direction: column; }
.market-row { display: grid; grid-template-columns: 1fr 7rem 8rem auto; gap: .5rem; align-items: center; padding: .3rem 0; border-bottom: 1px dotted var(--rule); }
.mi-name { min-width: 0; }
.mi-act { display: flex; gap: .3rem; justify-content: flex-end; }
.inline-market { background: var(--paper-2); border: 1px solid var(--rule); border-radius: var(--radius); padding: .6rem .8rem; max-height: 70vh; overflow: auto; }
.assign { display: flex; flex-direction: column; gap: .35rem; margin: .6rem 0; }
.assign-row { display: grid; grid-template-columns: 34px 1fr minmax(10rem, 14rem); gap: .6rem; align-items: center; }
.assign-who { display: flex; flex-direction: column; min-width: 0; }
.party-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: .7rem; }
.person-card { border: 1px solid var(--rule); border-radius: var(--radius); padding: .6rem; background: rgba(255, 255, 255, .2); }
.person-card.dead { opacity: .6; filter: grayscale(.8); }
.pc-head { display: flex; gap: .6rem; }
.pc-head h3 { margin: 0; }
.badge { font-size: .7rem; text-transform: uppercase; letter-spacing: .08em; background: var(--accent); color: #fff7e8; border-radius: 3px; padding: .05em .4em; margin-left: .4em; vertical-align: middle; }
.meters { display: grid; grid-template-columns: repeat(auto-fill, minmax(110px, 1fr)); gap: .25rem .6rem; margin: .4rem 0; }
.meter { display: flex; flex-direction: column; gap: .1rem; }
.conditions { margin: .3rem 0; padding-left: 1.1rem; color: var(--bad); font-size: .88rem; }
.skills { display: grid; grid-template-columns: 1fr; gap: .1rem; font-size: .85rem; }
.skill { display: flex; justify-content: space-between; gap: .5rem; }
.dots { letter-spacing: .05em; color: var(--accent); font-size: .75rem; }
.wagon-card { border-bottom: 1px dotted var(--rule); padding: .4rem 0 .6rem; }
.journal section { margin-bottom: .6rem; }
.journal p { margin: .2rem 0; }
.j-milestone { font-weight: 600; }
.j-death { color: var(--bad); font-style: italic; }
.j-bad { color: var(--bad); }
.map-wrap { width: 100%; overflow: auto; border: 1px solid var(--rule); border-radius: 4px; background: #efe1bf; }
.route-map { max-height: 40vh; overflow: hidden; border: 1px solid var(--rule); border-radius: 4px; }
.route-map svg { width: 100%; height: auto; display: block; }
.worldmap { width: 100%; min-width: 640px; height: auto; display: block; font-family: var(--serif); }
.map-region { font-size: 15px; letter-spacing: .35em; fill: rgba(80, 60, 35, .45); font-style: italic; }
.map-title { font-size: 17px; fill: #3b2c1d; font-style: italic; }
.map-edge { stroke: #6b4e2e; stroke-width: 2.2; }
.map-edge.rumor { stroke-dasharray: 5 5; opacity: .55; }
.map-edge.traveled { stroke: #8a3b1e; stroke-width: 3.4; }
.map-edge.dry { stroke: #b27a3a; }
.map-edge.highlight { stroke: #d4682c; stroke-width: 5; opacity: .8; }
.map-miles { font-size: 10px; fill: #6b5a44; }
.map-node { cursor: pointer; }
.map-node:focus { outline: none; }
.map-node:focus .map-label, .map-node:hover .map-label { fill: #8a3b1e; font-weight: 700; }
.map-label { font-size: 11px; fill: #3b2c1d; paint-order: stroke; stroke: #efe1bf; stroke-width: 3px; }
.map-label.major { font-size: 13px; font-weight: 600; }
.map-node.rumor .map-label { fill: #7a6650; font-style: italic; }
.sym-town { fill: #3b2c1d; }
.sym-post { fill: #6b5a44; }
.sym-landmark { fill: #efe1bf; stroke: #3b2c1d; stroke-width: 1.5; }
.sym-dest { fill: #b8662e; stroke: #3b2c1d; stroke-width: 1; }
.sym-river { fill: none; stroke: #3d6a8a; stroke-width: 1.6; }
.pass-flag { font-size: 10px; fill: #3d5a8a; }
.pass-flag.closed { fill: #9a2f22; font-weight: 700; }
.you-ring { fill: none; stroke: #c0392b; stroke-width: 2.5; animation: pulse 1.6s infinite; transform-origin: center; transform-box: fill-box; }
.you-dot { fill: #c0392b; }
@keyframes pulse { 50% { opacity: .35; transform: scale(1.3); } }
.compass text { font-size: 12px; fill: #6b5a44; }
.map-info { margin-top: .6rem; }
.pros-cons { display: grid; grid-template-columns: 1fr 1fr; gap: .8rem; }
.pros-cons ul { margin: .2rem 0; padding-left: 1.2rem; font-size: .92rem; }
.pros li::marker { content: "+ "; color: var(--good); }
.cons li::marker { content: "− "; color: var(--bad); }
.prospect { display: flex; gap: .8rem; align-items: center; border: 1px solid var(--rule); border-radius: var(--radius); padding: .6rem; margin: .6rem 0; }
.grade { display: grid; place-items: center; width: 2.6rem; height: 2.6rem; border-radius: 50%; border: 2px solid var(--accent); color: var(--accent); font-weight: 700; font-size: 1.3rem; flex: 0 0 auto; }
.grade.big { width: 3.6rem; height: 3.6rem; font-size: 1.9rem; }
.service-list { display: flex; flex-direction: column; gap: .3rem; }
.service { display: flex; justify-content: space-between; align-items: center; gap: .8rem; border-bottom: 1px dotted var(--rule); padding: .3rem 0; }
.service p { margin: 0; }
.slots { display: flex; flex-direction: column; gap: .4rem; margin-bottom: .8rem; }
.slot { display: flex; justify-content: space-between; align-items: center; gap: .6rem; border-bottom: 1px dotted var(--rule); padding: .3rem 0; flex-wrap: wrap; }
.slot p { margin: 0; }
.help ul { padding-left: 1.2rem; }

/* ---------- Minigames ---------- */
.minigame { display: flex; flex-direction: column; gap: .4rem; }
.game-canvas { width: 100%; height: min(56vh, 460px); display: block; border-radius: 4px; border: 1px solid #1c140c; touch-action: none; user-select: none; background: #334; }
.crosshair { cursor: crosshair; }
.game-status { font-size: .9rem; color: var(--ink-soft); }

/* ---------- End ---------- */
.endscreen { position: relative; min-height: 100vh; padding: 2rem 1rem; }
.end-card { position: relative; z-index: 1; max-width: 820px; margin: 0 auto; padding: 1.6rem 2rem; }
.grade-row { display: flex; align-items: center; gap: 1rem; margin: .4rem 0 .8rem; }
.grade-row h1 { margin: 0; font-size: clamp(1.5rem, 4vw, 2.2rem); }
.g-A { border-color: var(--good); color: var(--good); }
.g-F { border-color: var(--bad); color: var(--bad); }

/* ---------- Toast ---------- */
#toast-root { position: fixed; bottom: 1rem; left: 50%; transform: translateX(-50%); z-index: 40; display: flex; flex-direction: column; gap: .4rem; align-items: center; pointer-events: none; width: min(92vw, 480px); }
.toast { background: var(--leather-2); color: #f3e6c9; border: 1px solid #6e5638; padding: .5rem .9rem; border-radius: 5px; box-shadow: var(--shadow); transition: opacity .5s, transform .5s; text-align: center; }
.toast.out { opacity: 0; transform: translateY(8px); }

/* ---------- Responsive ---------- */
@media (max-width: 900px) {
  .game-cols { grid-template-columns: 1fr; }
  .grid2, .grid-outfit { grid-template-columns: 1fr; }
  .market-row { grid-template-columns: 1fr auto; }
  .market-row .mi-have { grid-column: 1; }
  .market-row .mi-act { grid-column: 2; grid-row: 1 / span 2; }
  .market-row .mi-price { grid-column: 1; font-size: .85rem; }
}
@media (max-width: 600px) {
  :root { --fs: 15px; }
  :root[data-text="l"] { --fs: 17px; }
  :root[data-text="xl"] { --fs: 19px; }
  .topbar { padding: .4rem .6rem; gap: .3rem .8rem; }
  .topbar .menu { margin-left: 0; width: 100%; }
  .topbar .menu .btn { flex: 1 1 auto; justify-content: center; }
  .game { padding: .4rem; }
  .create { margin: 0; padding: .8rem; border-radius: 0; }
  .choice-row { grid-template-columns: 1fr; }
  .assign-row { grid-template-columns: 34px 1fr; }
  .assign-row select { grid-column: 1 / -1; }
  .pros-cons { grid-template-columns: 1fr; }
  .dial > span { flex-basis: 8rem; }
  .modal { max-height: calc(100vh - 1rem); }
  .shade { padding: .4rem; }
  .title-card { padding: 1.4rem 1.2rem; }
  .end-card { padding: 1.2rem 1rem; }
  .action-row .btn { flex: 1 1 calc(50% - .5rem); justify-content: center; }
}
