/* Sloptasy, Note 15: the dark ink-and-gold look. Tokens first, then base, shell, components and page parts. */

/* ---- Tokens ---- */
:root {
    --bg: #0d1117;
    --surface: #151b24;
    --surface-raised: #1b222d;
    --border: #2a3340;
    --text: #e6e1d6;
    --text-muted: #9aa3ae;
    --heading: #efe7d4;
    --gold: #dcab4c;
    --gold-ink: #1d1608;
    --gold-dim: #2b2412;
    --teal: #5fb6a3;
    --coral: #e46b56;
    --danger-bg: #2a1715;
    --track: #2a3240;
    --load: #a7b0bd;

    --font-display: "Marcellus", "Iowan Old Style", "Palatino Linotype", Georgia, serif;
    --font-body: "Alegreya Sans", "Segoe UI", system-ui, sans-serif;

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

    --r-card: 6px;
    --r-panel: 8px;
    --r-full: 999px;

    --sidebar: 340px;
    --page-max: 1280px;
}

/* ---- Base ---- */
* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

html, body {
    margin: 0;
    background: var(--bg);
    color: var(--text);
    font-family: var(--font-body);
    font-size: 18px;
    line-height: 1.5;
}

body { min-height: 100vh; }

a { color: var(--gold); text-underline-offset: 3px; }
a:hover { color: #ecc272; }

h1, h2, h3 {
    font-family: var(--font-display);
    font-weight: 400;
    color: var(--heading);
    line-height: 1.15;
    margin: 0 0 var(--s3);
}

h1 { font-size: clamp(2.2rem, 5vw, 3.4rem); }
h2 { font-size: 1.75rem; }
h3 { font-size: 1.3rem; }

p { margin: 0 0 var(--s3); }

strong, b { font-weight: 700; color: var(--heading); }

:focus-visible {
    outline: 2px solid var(--gold);
    outline-offset: 2px;
    border-radius: 3px;
}

.num, .vital-value, td.num, th.num { font-variant-numeric: tabular-nums lining-nums; }

.visually-hidden {
    position: absolute !important;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
    white-space: nowrap;
}

.icon {
    width: 1.25em;
    height: 1.25em;
    flex: none;
    fill: none;
    stroke: currentColor;
    stroke-width: 1.75;
    stroke-linecap: round;
    stroke-linejoin: round;
    vertical-align: -0.2em;
}

/* ---- Forms ---- */
label { display: block; margin: var(--s3) 0; color: var(--text); }

input[type=text], input[type=email], input[type=password], input[type=number], input[type=search], input:not([type]), select, textarea {
    display: block;
    width: 100%;
    margin-top: var(--s1);
    padding: 10px var(--s3);
    font: inherit;
    font-size: 1rem;
    color: var(--text);
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: var(--r-card);
    min-height: 44px;
}

input:focus, select:focus, textarea:focus { border-color: var(--gold); outline: none; box-shadow: 0 0 0 2px rgba(220, 171, 76, .25); }

input[type=checkbox], input[type=radio] { accent-color: var(--gold); width: 1.1em; height: 1.1em; vertical-align: -0.15em; }

fieldset {
    border: 1px solid var(--border);
    border-radius: var(--r-panel);
    margin: var(--s4) 0;
    padding: var(--s3) var(--s4) var(--s4);
    background: var(--surface);
}

legend { padding: 0 var(--s2); color: var(--text-muted); font-size: .85rem; text-transform: uppercase; letter-spacing: .12em; }

/* ---- Buttons ---- */
button, .btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: var(--s2);
    min-height: 44px;
    padding: 0 var(--s5);
    font: inherit;
    font-weight: 700;
    font-size: 1rem;
    line-height: 1.2;
    color: var(--gold);
    background: transparent;
    border: 1px solid var(--gold);
    border-radius: var(--r-card);
    cursor: pointer;
    text-decoration: none;
    text-align: center;
}

button:hover, .btn:hover { background: var(--gold-dim); color: #ecc272; }

.btn-primary, button.btn-primary {
    color: var(--gold-ink);
    background: var(--gold);
    border-color: var(--gold);
}

.btn-primary:hover, button.btn-primary:hover { background: #e6b95f; color: var(--gold-ink); }

.btn-danger, button.btn-danger { color: var(--coral); border-color: var(--coral); }
.btn-danger:hover, button.btn-danger:hover { background: var(--danger-bg); color: #f08372; }

.btn-quiet, button.btn-quiet { color: var(--text); border-color: var(--border); background: var(--surface-raised); }
.btn-quiet:hover, button.btn-quiet:hover { color: var(--heading); border-color: var(--text-muted); background: var(--surface-raised); }

button:disabled, .btn[aria-disabled=true], button.is-disabled {
    color: var(--text-muted);
    background: var(--surface-raised);
    border-color: var(--border);
    cursor: not-allowed;
}

.btn-block { display: flex; width: 100%; }
.btn-small { min-height: 36px; padding: 0 var(--s3); font-size: .9rem; }
.btn-big { min-height: 56px; font-family: var(--font-display); font-weight: 400; font-size: 1.5rem; }

.actions { display: flex; flex-wrap: wrap; gap: var(--s2); align-items: center; }
.form-row { margin-bottom: var(--s4); }

/* ---- Shell: top bar ---- */
.topbar {
    background: var(--surface);
    border-bottom: 1px solid var(--border);
}

.topbar-inner {
    display: flex;
    align-items: stretch;
    gap: var(--s5);
    padding: 0 var(--s5);
    min-height: 60px;
}

.brand {
    display: flex;
    align-items: center;
    gap: 10px;
    color: var(--gold);
    text-decoration: none;
    font-family: var(--font-display);
    font-size: 1.6rem;
    white-space: nowrap;
}

.brand:hover { color: var(--gold); }

.brand-mark { width: 24px; height: 24px; flex: none; }

.tabs { display: flex; align-items: stretch; gap: var(--s1); margin-left: var(--s4); }

.tabs a {
    display: flex;
    align-items: center;
    padding: 0 var(--s3);
    color: var(--text);
    text-decoration: none;
    border-bottom: 2px solid transparent;
    margin-bottom: -1px;
}

.tabs a:hover { color: var(--heading); }
.tabs a.active { color: var(--gold); font-weight: 700; border-bottom-color: var(--gold); }

.who { margin-left: auto; position: relative; display: flex; align-items: center; }

.who summary {
    list-style: none;
    cursor: pointer;
    text-align: right;
    line-height: 1.2;
    padding: var(--s2) 0;
}

.who summary::-webkit-details-marker { display: none; }
.who-name { display: block; font-weight: 700; color: var(--heading); }
.who-line { display: block; font-size: .85rem; color: var(--text-muted); }

.who-menu {
    position: absolute;
    right: 0;
    top: 100%;
    z-index: 20;
    min-width: 200px;
    margin: 0;
    padding: var(--s2) 0;
    list-style: none;
    background: var(--surface-raised);
    border: 1px solid var(--border);
    border-radius: var(--r-panel);
    box-shadow: 0 12px 24px rgba(0, 0, 0, .4);
}

.who-menu a { display: block; padding: var(--s2) var(--s4); color: var(--text); text-decoration: none; }
.who-menu a:hover { background: var(--surface); color: var(--gold); }

/* ---- Shell: vitals strip ---- */
.vitals {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr)) auto auto;
    gap: var(--s4) var(--s6);
    align-items: end;
    padding: var(--s4) var(--s5) 18px;
    background: var(--surface);
    border-bottom: 1px solid var(--border);
}

.vital-head { display: flex; justify-content: space-between; align-items: baseline; gap: var(--s2); }
.vital-label, .eyebrow, .stat-label {
    font-size: .78rem;
    letter-spacing: .14em;
    text-transform: uppercase;
    color: var(--text-muted);
}
.vital-value { font-weight: 700; color: var(--heading); font-size: 1.05rem; }
.vital-value small { font-weight: 400; color: var(--text-muted); font-size: .85rem; }
.vital-gold .vital-value { color: var(--gold); }
.vital-plain { display: flex; flex-direction: column; gap: 2px; }

.bar {
    height: 6px;
    margin-top: 6px;
    background: var(--track);
    border-radius: var(--r-full);
    overflow: hidden;
}

.bar-fill { height: 100%; border-radius: var(--r-full); background: var(--load); }
.bar-health .bar-fill { background: var(--coral); }
.bar-energy .bar-fill { background: var(--gold); }
.bar-xp .bar-fill { background: var(--teal); }
.bar-mana .bar-fill { background: #7f9be0; }
.bar-load .bar-fill { background: var(--load); }
.bar-load.band-burdened .bar-fill { background: var(--gold); }
.bar-load.band-immobile .bar-fill { background: var(--coral); }

.statuses { display: flex; flex-wrap: wrap; gap: var(--s2); padding: var(--s2) var(--s5); background: var(--surface); border-bottom: 1px solid var(--border); }

.event-band {
    display: flex;
    gap: var(--s3);
    align-items: center;
    padding: var(--s2) var(--s5);
    background: var(--gold-dim);
    border-bottom: 1px solid #4a3c1d;
    color: var(--gold);
    font-size: .95rem;
}

.event-band a { font-weight: 700; }

.phone-head, .phone-tabs { display: none; }

/* ---- Page grid ---- */
.page {
    max-width: var(--page-max);
    margin: 0 auto;
    padding: var(--s6) var(--s6) var(--s7);
}

.page-grid {
    display: grid;
    grid-template-columns: minmax(0, 1fr) var(--sidebar);
    gap: var(--s6) 40px;
    align-items: start;
}

.page-main { min-width: 0; }
.page-side { display: flex; flex-direction: column; gap: var(--s5); min-width: 0; }
.page-narrow { max-width: 760px; }

/* ---- Page header ---- */
.page-header { margin-bottom: var(--s5); }
.page-header .eyebrow { color: var(--gold); margin-bottom: var(--s2); }
.page-title-row { display: flex; flex-wrap: wrap; align-items: center; gap: var(--s3) var(--s5); }
.page-title-row h1 { margin: 0; }
.page-title-row .spacer { flex: 1; }

.lede { font-size: 1.15rem; max-width: 70ch; color: var(--text); margin-top: var(--s3); }

/* ---- Panels and cards ---- */
.panel {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--r-panel);
    padding: var(--s5);
}

.panel + .panel { margin-top: var(--s5); }
.page-side .panel + .panel { margin-top: 0; }

.panel-gold { border-color: var(--gold); }

.panel-head { display: flex; align-items: baseline; justify-content: space-between; gap: var(--s3); margin-bottom: var(--s4); }
.panel-head h2 { margin: 0; font-size: 1.75rem; }
.panel-foot { color: var(--text-muted); font-size: .95rem; margin: var(--s4) 0 0; }

.section-heading { display: flex; align-items: center; gap: var(--s4); margin: var(--s6) 0 var(--s4); }
.section-heading h2 { margin: 0; white-space: nowrap; }
.section-heading .rule { flex: 1; height: 1px; background: var(--border); }
.section-heading .aside { color: var(--text-muted); white-space: nowrap; font-size: .95rem; }

.card {
    background: var(--surface-raised);
    border: 1px solid var(--border);
    border-radius: var(--r-card);
    padding: var(--s3) var(--s4);
}

/* ---- Road cards ---- */
.roads { display: flex; flex-direction: column; gap: var(--s3); }

.road {
    display: flex;
    align-items: center;
    gap: var(--s3);
    padding: var(--s3) var(--s4);
    background: var(--surface-raised);
    border-radius: var(--r-card);
}

.road-text { flex: 1; min-width: 0; }
.road-name { display: block; font-weight: 700; color: var(--heading); }
.road-sub { display: block; font-size: .92rem; color: var(--text-muted); }
.road-sub .safe { color: var(--teal); }
.road-sub .risky { color: var(--gold); }
.road-sub .deadly { color: var(--coral); }
.road-zone.safe .road-sub { color: var(--teal); }
.road-zone.risky .road-sub { color: var(--gold); }
.road-zone.deadly .road-sub { color: var(--coral); }
.road .btn, .road button { min-width: 112px; flex: none; }
.road-refusal { font-size: .85rem; color: var(--coral); max-width: 140px; text-align: right; }

/* ---- Service cards ---- */
.services { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: var(--s3); }

.service {
    display: flex;
    gap: var(--s3);
    padding: var(--s4);
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--r-card);
    color: var(--text);
    text-decoration: none;
    min-height: 100%;
}

.service:hover { border-color: var(--gold); color: var(--text); }
.service .icon { color: var(--gold); width: 26px; height: 26px; margin-top: 2px; }
.service-name { display: block; font-weight: 700; color: var(--heading); font-size: 1.05rem; }
.service-desc {
    display: -webkit-box;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
    line-clamp: 2;
    overflow: hidden;
    color: var(--text-muted);
    font-size: .95rem;
}
.service-status { display: block; color: var(--teal); font-size: .9rem; margin-top: 2px; }
.service.closed { opacity: .55; }
.service.closed .service-status { color: var(--text-muted); }

/* ---- Pills and chips ---- */
.pill {
    display: inline-flex;
    align-items: center;
    gap: var(--s2);
    padding: 4px 14px;
    border: 1px solid currentColor;
    border-radius: var(--r-full);
    font-weight: 700;
    font-size: .95rem;
    color: var(--text-muted);
    white-space: nowrap;
}

.pill::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: currentColor; }
.pill.safe { color: var(--teal); background: rgba(95, 182, 163, .08); }
.pill.risky { color: var(--gold); background: rgba(220, 171, 76, .08); }
.pill.deadly { color: var(--coral); background: rgba(228, 107, 86, .08); }
.pill.plain::before { display: none; }

.chips { display: flex; flex-wrap: wrap; gap: var(--s2); }

.chip {
    display: inline-flex;
    align-items: center;
    min-height: 40px;
    padding: 0 18px;
    border: 1px solid var(--border);
    border-radius: var(--r-full);
    color: var(--text);
    text-decoration: none;
}

.chip:hover { border-color: var(--text-muted); color: var(--heading); }
.chip.active { background: var(--surface-raised); border-color: var(--text-muted); color: var(--heading); font-weight: 700; }

/* ---- Segmented choice ---- */
.segmented { display: grid; grid-auto-columns: minmax(0, 1fr); grid-auto-flow: column; gap: var(--s3); }
.segmented label { margin: 0; }
.segmented input { position: absolute; opacity: 0; width: 1px; height: 1px; }

.segmented span {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 48px;
    border: 1px solid var(--border);
    border-radius: var(--r-card);
    background: var(--bg);
    font-weight: 700;
    color: var(--heading);
    cursor: pointer;
}

.segmented input:checked + span { border-color: var(--gold); color: var(--gold); background: var(--gold-dim); }
.segmented input:focus-visible + span { outline: 2px solid var(--gold); outline-offset: 2px; }

.toggle { display: inline-flex; padding: var(--s1); gap: var(--s1); background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-panel); }
.toggle a, .toggle span { display: inline-flex; align-items: center; min-height: 40px; padding: 0 var(--s4); border-radius: var(--r-card); color: var(--text); text-decoration: none; }
.toggle a.active { background: var(--surface-raised); color: var(--heading); font-weight: 700; }
.toggle .disabled { color: var(--text-muted); cursor: not-allowed; }

/* ---- Stat grid and delta tiles ---- */
.stat-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--s4) var(--s5); margin: var(--s4) 0; }
.stat-grid dt { margin: 0; }
.stat-grid dd { margin: 2px 0 0; font-weight: 700; color: var(--heading); font-size: 1.1rem; }

.deltas { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: var(--s3); margin: var(--s4) 0; }
.delta { padding: var(--s3) var(--s4); background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-card); }
.delta-value { display: block; font-size: 1.4rem; font-weight: 700; color: var(--heading); margin-top: 2px; }
.delta-value.up { color: var(--teal); }
.delta-value.down { color: var(--coral); }
.delta-value.spent { color: var(--gold); }

/* ---- Tables ---- */
.table-wrap { border: 1px solid var(--border); border-radius: var(--r-panel); overflow-x: auto; background: var(--surface); }

.data-table, .stats { width: 100%; border-collapse: collapse; }
.data-table th, .stats th {
    padding: var(--s3) var(--s4);
    text-align: left;
    font-weight: 400;
    font-size: .78rem;
    letter-spacing: .14em;
    text-transform: uppercase;
    color: var(--text-muted);
    border-bottom: 1px solid var(--border);
}

.data-table td, .stats td { padding: 14px var(--s4); border-bottom: 1px solid var(--border); vertical-align: middle; }
.data-table tr:last-child td { border-bottom: none; }
.data-table .num, .stats td:not(:first-child), .stats th:not(:first-child) { text-align: right; }
.data-table tbody tr:hover { background: var(--surface-raised); }
.data-table td.name { font-weight: 700; color: var(--heading); }
.data-table td.muted { color: var(--text-muted); }
.data-table a.row-link { color: inherit; text-decoration: none; display: block; }
.data-table tr.selected { background: var(--surface-raised); box-shadow: inset 3px 0 0 var(--gold); }
.data-table tr.selected td.name, .data-table tr.selected td.name a { color: var(--gold); }

/* ---- Log table (outing, fight rounds) ---- */
.log { border: 1px solid var(--border); border-radius: var(--r-panel); overflow: hidden; background: var(--surface); }
.log-row { display: grid; grid-template-columns: 40px 110px minmax(0, 1fr) auto; gap: var(--s3); align-items: baseline; padding: 14px var(--s4); border-bottom: 1px solid var(--border); }
.log-row:last-child { border-bottom: none; }
.log-row.fight { background: rgba(27, 34, 45, .5); }
.log-num { color: var(--text-muted); font-variant-numeric: tabular-nums; }
.log-kind { font-size: .78rem; letter-spacing: .14em; text-transform: uppercase; font-weight: 700; color: var(--text-muted); }
.log-kind.fight { color: var(--coral); }
.log-kind.found { color: var(--teal); }
.log-kind.gold { color: var(--gold); }
.log-detail { color: var(--text); }
.log-detail b { color: var(--heading); }
.log-detail.quiet { font-style: italic; color: var(--text-muted); }
.log-side { white-space: nowrap; color: var(--text-muted); display: flex; gap: var(--s4); }

.log-row.log-row-round { grid-template-columns: 40px minmax(0, 1fr); }
.pager { margin-top: var(--s4); }
a.more-link { text-decoration: none; color: var(--text); border: 1px solid var(--border); }
a.more-link:hover { border-color: var(--gold); }

/* ---- Warning and notice boxes ---- */
.warning-box { padding: var(--s3) var(--s4); background: var(--danger-bg); border: 1px solid var(--coral); border-radius: var(--r-card); }
.warning-box strong { display: block; color: var(--coral); }
.warning-box p { margin: 2px 0 0; color: var(--text); font-size: .95rem; }

.flash { margin-bottom: var(--s5); padding: var(--s3) var(--s4); border-radius: var(--r-card); background: var(--surface); border: 1px solid var(--border); border-left: 3px solid var(--teal); }
.flash p:last-child { margin-bottom: 0; }
.flash ul { margin: var(--s2) 0 0; padding-left: 1.2rem; color: var(--text-muted); }
.flash.error, .error { border-left-color: var(--coral); }
p.error, .error { color: var(--coral); border-left: 3px solid var(--coral); padding-left: var(--s3); }
.flash.error { color: var(--text); }
.notice { border-left: 3px solid var(--teal); padding-left: var(--s3); }

.hint, .muted { color: var(--text-muted); font-size: .95rem; }
.hint { display: inline; }
label.choice .hint { display: block; margin-left: 1.6rem; }
.flavor { font-style: italic; color: var(--text); }
.danger-text { color: var(--coral); }
.safe-text { color: var(--teal); }
.gold-text { color: var(--gold); }

/* ---- Equipment ---- */
.equip-grid { display: grid; grid-template-columns: minmax(0, 1fr) 200px minmax(0, 1fr); gap: var(--s4); align-items: start; }
.slots { display: flex; flex-direction: column; gap: var(--s3); }

.slot {
    display: block;
    padding: var(--s3) var(--s4);
    background: var(--surface-raised);
    border: 1px solid var(--border);
    border-radius: var(--r-card);
    color: var(--text);
    text-decoration: none;
}

a.slot:hover { border-color: var(--text-muted); color: var(--text); }
.slot.empty { background: transparent; border-style: dashed; }
.slot.target { border-color: var(--gold); }
.slot.target .stat-label { color: var(--gold); }
.slot-item { display: block; font-weight: 700; color: var(--heading); margin-top: 2px; }
.slot.empty .slot-item { font-weight: 400; color: var(--text-muted); }
.slot-line { display: block; font-size: .9rem; color: var(--text-muted); }
.slot-line.worn { color: var(--coral); }

.doll { display: flex; flex-direction: column; align-items: center; gap: var(--s3); padding-top: var(--s6); }
.doll svg { width: 150px; height: auto; }
.doll .figure { fill: var(--surface-raised); stroke: var(--border); stroke-width: 2; }
.doll .dot { fill: var(--gold); }
.doll .ring { fill: none; stroke: var(--text-muted); stroke-width: 2; }
.doll-caption { color: var(--text-muted); font-size: .92rem; text-align: center; }

.load-meter { position: relative; height: 12px; background: var(--track); border-radius: var(--r-full); margin: var(--s4) 0 var(--s2); }
.load-meter .bar-fill { height: 100%; border-radius: var(--r-full); background: var(--load); }
.load-meter.band-burdened .bar-fill { background: var(--gold); }
.load-meter.band-immobile .bar-fill { background: var(--coral); }
.load-meter .tick { position: absolute; top: -4px; width: 2px; height: 20px; background: var(--heading); }
.load-scale { display: flex; justify-content: space-between; gap: var(--s3); color: var(--text-muted); font-size: .9rem; }
.band-word.normal { color: var(--teal); }
.band-word.burdened { color: var(--gold); }
.band-word.immobile { color: var(--coral); }

/* ---- Map ---- */
.map-panel { padding: 0; overflow: hidden; }
.world-map { display: block; width: 100%; height: auto; background: var(--surface); }
.world-map .grid-dot { fill: #242c38; }
.world-map .road { fill: none; stroke: #59626f; stroke-width: 2.5; }
.world-map .road.highway { stroke-width: 4; }
.world-map .road.dirt { stroke-dasharray: 14 10; }
.world-map .road.trail { stroke-dasharray: 2 8; stroke-linecap: round; stroke-width: 3; }
.world-map .road.here { stroke: var(--gold); }
.world-map .badge rect { fill: var(--surface); stroke: #59626f; stroke-width: 1.5; }
.world-map .badge.here rect { stroke: var(--gold); }
.world-map .badge text { fill: var(--heading); font: 700 20px var(--font-body); text-anchor: middle; dominant-baseline: central; }
.world-map .town { fill: var(--surface); stroke: var(--gold); stroke-width: 3; }
.world-map .town.current { fill: var(--gold); }
.world-map .halo { fill: var(--gold); opacity: .18; }
.world-map .zone { fill: var(--surface); stroke-width: 3.5; }
.world-map .zone.safe { stroke: var(--teal); }
.world-map .zone.risky { stroke: var(--gold); }
.world-map .zone.deadly { fill: var(--coral); stroke: var(--coral); }
.world-map .label, .world-map .sub { paint-order: stroke; stroke: var(--surface); stroke-width: 6px; stroke-linejoin: round; }
.world-map .label { fill: var(--heading); font: 700 24px var(--font-body); text-anchor: middle; }
.world-map .label.town-label { font: 400 36px var(--font-display); }
.world-map .sub { fill: var(--text-muted); font: 400 20px var(--font-body); text-anchor: middle; }
.world-map .sub.safe { fill: var(--teal); }
.world-map .sub.risky { fill: var(--gold); }
.world-map .sub.deadly { fill: var(--coral); }
.world-map .sub.here { fill: var(--gold); font-weight: 700; }

.legend { display: flex; flex-wrap: wrap; gap: var(--s3) var(--s5); margin-top: var(--s4); color: var(--text-muted); font-size: .95rem; }
.legend span { display: inline-flex; align-items: center; gap: var(--s2); }
.legend svg { width: 26px; height: 16px; overflow: visible; }

.further { list-style: none; margin: 0; padding: 0; }
.further li { display: flex; justify-content: space-between; gap: var(--s3); padding: 6px 0; }
.further .via { color: var(--text-muted); }
.further-warning { color: var(--coral); border-top: 1px solid var(--border); margin-top: var(--s3); padding-top: var(--s3); }

/* ---- Location page parts ---- */
.explore-panel .stat-label { margin: 0 0 var(--s3); }
.explore-panel .tactics-label { margin-top: var(--s5); }
.tactic-inputs { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: var(--s3); margin-bottom: var(--s5); }
.tactic-inputs label { margin: 0; }
.gather-nodes { margin-top: var(--s4); }
.report-lines { margin: 0; padding-left: 1.2rem; }
.report-lines li + li { margin-top: var(--s1); }
figure.art { margin: 0 0 var(--s5); padding: 0; overflow: hidden; }
figure.art img { display: block; width: 100%; height: auto; }
.page-main > .warning-box { margin-bottom: var(--s4); }
.page-main > .panel { margin-bottom: var(--s5); }

/* ---- Inventory page parts ---- */
.inv-pack .section-heading { flex-wrap: wrap; }
.selected-actions { display: flex; flex-direction: column; gap: var(--s3); margin-top: var(--s4); }
.actions.split > * { flex: 1 1 0; min-width: 0; }
.selected-actions .warning-box + .warning-box, .inv-selected .warning-box + .warning-box { margin-top: var(--s3); }
.inv-selected .stat-grid + .warning-box { margin-top: var(--s3); }

/* ---- Auth pages ---- */
.plain-page { max-width: 460px; margin: 0 auto; padding: var(--s7) var(--s4); }
.plain-brand { display: flex; justify-content: center; margin-bottom: var(--s5); }
.plain-links { display: flex; justify-content: center; gap: var(--s4); margin-top: var(--s4); color: var(--text-muted); }

/* ---- Older page parts, restyled ---- */
.items { list-style: none; padding: 0; margin: 0 0 var(--s4); border: 1px solid var(--border); border-radius: var(--r-panel); background: var(--surface); }
.items li { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: var(--s2) var(--s4); padding: var(--s3) var(--s4); border-bottom: 1px solid var(--border); }
.items li:last-child { border-bottom: none; }
.items button { min-height: 36px; padding: 0 var(--s3); font-size: .9rem; }

.sheet { display: grid; grid-template-columns: max-content 1fr; gap: var(--s2) var(--s5); margin: 0 0 var(--s4); }
.sheet dt { color: var(--text-muted); }
.sheet dd { margin: 0; }

.report { margin-top: var(--s4); padding: var(--s4); background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-panel); }
.report ul { padding-left: 1.25rem; margin-bottom: 0; }
.rounds { padding-left: 1.5rem; color: var(--text-muted); }

.steps { display: flex; gap: var(--s4); flex-wrap: wrap; }
.steps label { margin: var(--s2) 0; }
.tactics label { display: flex; align-items: center; justify-content: space-between; gap: var(--s3); margin: var(--s2) 0; }
.tactics input { width: 6rem; margin: 0; }

.stat-inputs { display: grid; grid-template-columns: repeat(auto-fill, minmax(8rem, 1fr)); gap: 0 var(--s4); }

.weight { margin: var(--s2) 0 var(--s4); }
.weight-bar { height: 8px; background: var(--track); border-radius: var(--r-full); overflow: hidden; }
.weight-fill { height: 100%; background: var(--load); }
.weight-fill.band-burdened { background: var(--gold); }
.weight-fill.band-immobile { background: var(--coral); }

main > h1:first-child, .page > h1:first-child { margin-top: 0; }

/* ---- Responsive ---- */
@media (max-width: 1100px) {
    .vitals { grid-template-columns: repeat(2, minmax(0, 1fr)) auto auto; }
    .services { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .equip-grid { grid-template-columns: minmax(0, 1fr) 140px minmax(0, 1fr); }
    .doll svg { width: 110px; }
}

@media (max-width: 900px) {
    .page-grid { grid-template-columns: minmax(0, 1fr); }
    /* On a phone the selected item sits right under the equipped panel. */
    .inventory-page .page-main, .inventory-page .page-side { display: contents; }
    .inventory-page .page-header, .inventory-page .flash { order: 0; }
    .inventory-page .inv-equipped { order: 1; }
    .inventory-page .inv-selected { order: 2; }
    .inventory-page .inv-pack { order: 3; }
    .inventory-page .inv-load { order: 4; }
    .tabs { display: none; }
    .page { padding: var(--s5) var(--s4) 96px; }
}

@media (max-width: 720px) {
    html, body { font-size: 17px; }
    .topbar { display: none; }
    .phone-head {
        display: flex;
        align-items: center;
        justify-content: space-between;
        gap: var(--s3);
        padding: var(--s3) var(--s4);
        background: var(--surface);
        border-bottom: 1px solid var(--border);
    }
    .phone-head .brand { font-size: 1.5rem; color: var(--heading); }
    .phone-head .brand-mark { color: var(--gold); }
    .phone-where { color: var(--text-muted); font-size: .9rem; text-align: right; }
    .vitals { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) auto; gap: var(--s3) var(--s4); padding: var(--s3) var(--s4); }
    .vitals .phone-hide { display: none; }
    .vital-label { text-transform: none; letter-spacing: 0; font-size: .95rem; }
    .statuses, .event-band { padding: var(--s2) var(--s4); }
    .phone-tabs {
        display: grid;
        grid-template-columns: repeat(5, 1fr);
        position: fixed;
        left: 0;
        right: 0;
        bottom: 0;
        z-index: 30;
        background: var(--surface);
        border-top: 1px solid var(--border);
    }
    .phone-tabs a {
        display: flex;
        flex-direction: column;
        align-items: center;
        gap: 2px;
        padding: var(--s2) 0 10px;
        min-height: 56px;
        color: var(--text);
        text-decoration: none;
        font-size: .85rem;
        border-top: 2px solid transparent;
        margin-top: -1px;
    }
    .phone-tabs a .icon { width: 24px; height: 24px; }
    .phone-tabs a.active { color: var(--gold); font-weight: 700; border-top-color: var(--gold); }
    .services { grid-template-columns: minmax(0, 1fr); }
    .deltas { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .equip-grid { grid-template-columns: minmax(0, 1fr); }
    .doll { display: none; }
    .log-row { grid-template-columns: 28px minmax(0, 1fr); }
    .log-row .log-detail, .log-row .log-side { grid-column: 2; }
    .segmented { grid-auto-flow: row; grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .stat-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .road .btn, .road button { min-width: 96px; }
    .world-map .sub.optional { display: none; }
    .world-map .label { font-size: 40px; stroke-width: 10px; }
    .world-map .label.town-label { font-size: 52px; }
    .world-map .sub { font-size: 34px; stroke-width: 10px; }
    .world-map .badge text { font-size: 30px; }
    .map-panel { margin: 0 calc(-1 * var(--s4)); border-radius: 0; border-left: none; border-right: none; }
    .statuses .pill.plain { display: none; }
    .statuses:not(:has(.pill:not(.plain))) { display: none; }
    .data-table th, .data-table td { padding: var(--s3); }
    .page-header { margin-bottom: var(--s4); }
}

@media (prefers-reduced-motion: reduce) {
    .world-map .halo { display: none; }
    * { transition: none !important; animation: none !important; }
}
