:root {
  --bg: #15100E; --bar: #1A1412; --card: #1F1916; --raise: #2A221E; --line: #3A302A; --line-soft: #2E2621;
  --text: #EFE6D8; --muted: #B3A592; --dim: #8F826F; --gold: #EFD38A; --gold-line: #D8B25A;
  --red: #B8322A; --red-text: #EE6A5E; --red-soft: #2A1714; --red-line: #6B2A24; --ok: #7FC48A;
  color-scheme: dark;
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--text); font: 15px/1.5 'IBM Plex Sans', system-ui, sans-serif; }
a { color: var(--gold-line); } a:hover { color: var(--gold); }
button, input, select { font: inherit; color: inherit; }
h1, h2, h3 { margin: 0; }
h2 { font-family: Grenze, serif; font-size: 26px; font-weight: 700; }
code { font: 13px 'IBM Plex Mono', monospace; background: var(--bg); padding: 1px 6px; border-radius: 4px; }
[hidden] { display: none !important; }
:focus-visible { outline: 2px solid var(--gold); outline-offset: 2px; }

.wrap { max-width: 1360px; margin: 0 auto; padding-left: 24px; padding-right: 24px; }
@media (max-width: 520px) { .wrap { padding-left: 16px; padding-right: 16px; } }
.page { padding-top: 28px; padding-bottom: 48px; display: flex; flex-direction: column; gap: 24px; }
.bar { border-bottom: 1px solid var(--line); background: var(--bar); }
.bar-row { display: flex; flex-wrap: wrap; gap: 14px; align-items: center; padding-top: 12px; padding-bottom: 12px; }
.brand { display: flex; align-items: center; gap: 10px; margin-right: auto; color: var(--red-text); text-decoration: none; }
.brand span { font-family: Grenze, serif; font-size: 26px; font-weight: 700; color: var(--text); }
.pill { display: flex; align-items: center; gap: 8px; padding: 6px 12px; border: 1px solid var(--line); border-radius: 999px; background: var(--card); font-size: 14px; }
.dot { width: 8px; height: 8px; border-radius: 50%; background: var(--ok); }

.btn { min-height: 44px; padding: 0 16px; border-radius: 8px; border: 1px solid var(--line); background: var(--card); cursor: pointer; }
.btn:hover { border-color: var(--muted); }
.btn.primary { border: 0; background: var(--red); color: #fff; font-weight: 600; }
.btn.primary:hover { background: #C93C33; }
.btn.danger { border-color: var(--red-line); background: var(--red-soft); color: #F4A39B; }
.btn:disabled { background: var(--raise); border-color: var(--line-soft); color: var(--dim); cursor: default; }
input, select { min-height: 44px; padding: 0 10px; border-radius: 8px; border: 1px solid var(--line); background: var(--bg); min-width: 0; }
input[type=number] { width: 84px; }

.hero { font-family: Grenze, serif; font-size: clamp(36px, 6vw, 56px); line-height: 1.05; max-width: 760px; }
.lead { margin: 14px 0 0; color: var(--muted); font-size: 18px; max-width: 640px; }
.title { font-family: Grenze, serif; font-size: clamp(34px, 5vw, 46px); line-height: 1.05; }
.eyebrow { color: var(--muted); font-size: 13px; text-transform: uppercase; letter-spacing: .08em; }
.muted { color: var(--muted); } .small { font-size: 14px; }
.note { margin: 0 0 14px; padding: 10px 14px; border-radius: 8px; background: var(--raise); color: var(--gold); font-size: 14px; }
.hint { margin: 18px 0 0; padding: 14px 16px; border-radius: 10px; border: 1px dashed #5A4A3A; color: var(--muted); font-size: 14px; }

.split { display: flex; flex-wrap: wrap; gap: 24px; align-items: flex-start; }
.grow { flex: 999 1 560px; min-width: 0; }
.side { flex: 1 1 320px; min-width: 0; }
.card { background: var(--bar); border: 1px solid var(--line); border-radius: 14px; padding: 20px; }
.card > h2 { margin-bottom: 8px; }
.card-head { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; justify-content: space-between; margin-bottom: 16px; }

.found { margin: 0; padding: 0; list-style: none; display: flex; flex-direction: column; gap: 10px; }
.found li { display: flex; flex-wrap: wrap; gap: 14px; align-items: center; padding: 16px; border-radius: 10px; background: var(--card); border: 1px solid var(--line); }
.found .what { flex: 1 1 240px; min-width: 0; }
.found .what b { display: block; font-size: 20px; font-weight: 600; }
.steps { margin: 12px 0 0; padding: 0; list-style: none; display: flex; flex-direction: column; gap: 14px; }
.steps li { display: flex; gap: 12px; }
.steps li > span:first-child { flex: none; width: 28px; height: 28px; border-radius: 50%; background: var(--raise); color: var(--gold); display: grid; place-items: center; font-weight: 600; font-size: 14px; }

.cult { display: flex; flex-wrap: wrap; gap: 20px; align-items: flex-end; justify-content: space-between; }
.stats { display: flex; flex-wrap: wrap; gap: 10px; }
.stat { background: var(--card); border: 1px solid var(--line); border-radius: 10px; padding: 10px 14px; min-width: 96px; display: flex; gap: 10px; align-items: center; }
.stat img { width: 36px; height: 36px; }
.stat small { display: block; color: var(--muted); font-size: 13px; }
.stat b { display: block; font-size: 22px; font-weight: 600; line-height: 1.2; }

.tabs { display: flex; flex-wrap: wrap; gap: 6px; }
.tab { min-height: 44px; padding: 0 14px; border-radius: 8px; border: 1px solid var(--line); background: transparent; cursor: pointer; }
.tab[aria-selected=true] { border-color: var(--gold-line); background: var(--raise); color: var(--gold); }
.tab span { opacity: .75; }
.actions { display: grid; grid-template-columns: repeat(auto-fill, minmax(270px, 1fr)); gap: 12px; }
.act { background: var(--card); border: 1px solid var(--line); border-radius: 10px; padding: 14px; display: flex; flex-direction: column; gap: 10px; }
.act header { display: flex; gap: 10px; align-items: center; }
.act header img { width: 32px; height: 32px; flex: none; }
.act h3 { font-size: 16px; font-weight: 600; }
.act p { margin: 0; color: var(--muted); font-size: 14px; }
.act .row { margin-top: auto; }
.row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.row > select, .row > input:not([type=number]) { flex: 1 1 120px; }

.log { margin: 0; padding: 0; list-style: none; max-height: 560px; overflow: auto; }
.log li { padding: 10px 0; border-top: 1px solid var(--line-soft); display: flex; gap: 12px; }
.log time { font: 13px 'IBM Plex Mono', monospace; color: var(--muted); flex: none; padding-top: 1px; }
.log .bad { color: var(--red-text); }
.log:empty::after { content: 'Nothing yet. What you do here shows up in this list.'; color: var(--muted); font-size: 14px; }

.find { display: flex; gap: 8px; align-items: center; color: var(--muted); font-size: 14px; }
.find input { width: 200px; }
.people { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 10px; }
.person { text-decoration: none; color: var(--text); background: var(--card); border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; display: flex; gap: 12px; align-items: center; min-height: 64px; }
.person:hover { border-color: var(--muted); color: var(--text); }
.person img { width: 44px; height: 44px; flex: none; border-radius: 50%; background: var(--raise); }
.person b { display: block; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.person small { display: block; font-size: 13px; color: var(--muted); }
.warn { color: var(--red-text) !important; } .gold { color: var(--gold) !important; }

.back { align-self: flex-start; display: inline-flex; align-items: center; gap: 6px; min-height: 44px; text-decoration: none; }
.who { display: flex; flex-wrap: wrap; gap: 24px; align-items: center; }
.who .grow { flex: 1 1 340px; }
.face { width: 104px; height: 104px; border-radius: 50%; background: var(--raise); flex: none; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 12px; }
.chip { display: inline-flex; align-items: center; gap: 6px; min-height: 32px; padding: 3px 10px 3px 4px; border-radius: 999px; background: var(--raise); border: 1px solid transparent; font-size: 13px; cursor: pointer; }
.chip:hover { border-color: var(--red-line); }
.chip img { width: 22px; height: 22px; }
.chip.state { padding-left: 10px; background: #3A1D1A; color: #F4A39B; cursor: default; }
.bars { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px 22px; flex: 1 1 380px; max-width: 520px; }
.meter > div:first-child { display: flex; justify-content: space-between; font-size: 13px; color: var(--muted); }
.meter > div:first-child span:last-child { color: var(--text); }
.track { height: 8px; border-radius: 4px; background: var(--raise); margin-top: 4px; overflow: hidden; }
.track > div { height: 100%; border-radius: 4px; }
.cols { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 16px; }
.stack { display: flex; flex-direction: column; gap: 8px; margin-top: 14px; }
.stack .btn { display: flex; justify-content: space-between; align-items: center; min-height: 48px; text-align: left; }
.stack-lg { display: flex; flex-direction: column; gap: 16px; }
.field label { display: block; font-size: 14px; color: var(--muted); margin-bottom: 6px; }
.field p { margin: 8px 0 0; }

.nav { display: flex; flex-wrap: wrap; gap: 4px; }
.nav a { display: inline-flex; align-items: center; min-height: 44px; padding: 0 12px; border-radius: 8px; color: var(--text); text-decoration: none; }
.nav a:hover { background: var(--card); color: var(--text); }
.nav a[aria-current=page] { background: var(--raise); color: var(--gold); }
.switch { display: inline-flex; align-items: center; gap: 8px; min-height: 44px; }
.switch input { width: 20px; height: 20px; min-height: 0; accent-color: var(--red); }

.map-page { position: relative; height: calc(100vh - 69px); min-height: 480px; overflow: hidden; }
#map { position: absolute; inset: 0; width: 100%; height: 100%; touch-action: none; cursor: grab; }
#map:active { cursor: grabbing; }
.map-tools { position: absolute; left: 16px; right: 16px; top: 16px; display: flex; flex-wrap: wrap; gap: 8px; align-items: center; pointer-events: none; }
.map-tools > * { pointer-events: auto; }
.map-tools .switch { padding: 0 12px; border-radius: 8px; background: var(--card); border: 1px solid var(--line); }
.grow-gap { flex: 1; }
.map-note { position: absolute; left: 16px; top: 76px; max-width: 520px; margin: 0; }
.map-hint { position: absolute; left: 50%; bottom: 20px; transform: translateX(-50%); display: flex; flex-wrap: wrap; gap: 8px; align-items: center; justify-content: center;
  padding: 10px 14px; border-radius: 12px; background: rgba(21, 16, 14, .92); border: 1px solid var(--line); max-width: calc(100% - 32px); }
.map-card { position: absolute; right: 16px; top: 76px; width: 300px; max-width: calc(100% - 32px); }
.map-card h2 { font-size: 22px; }
.build-menu { position: absolute; left: 16px; top: 76px; bottom: 16px; width: 420px; max-width: calc(100% - 32px); overflow: auto; }
.build-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(118px, 1fr)); gap: 8px; }
.build-item { display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 10px 6px; border-radius: 10px; border: 1px solid var(--line); background: var(--card); cursor: pointer; text-align: center; font-size: 13px; }
.build-item:hover { border-color: var(--gold-line); }
.build-item img { width: 48px; height: 48px; }
.build-item small { font-size: 11px; }
@media (max-width: 700px) { .map-card, .build-menu { left: 16px; right: 16px; width: auto; top: auto; bottom: 16px; max-height: 60%; overflow: auto; } }

.item-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 10px; }
.item { display: flex; align-items: center; gap: 10px; padding: 10px; border-radius: 10px; background: var(--card); border: 1px solid var(--line); }
.item img { width: 40px; height: 40px; flex: none; }
.item .name { flex: 1; min-width: 0; font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.item input { width: 76px; }
.item .btn { min-width: 44px; padding: 0; }

.hearts { display: flex; flex-wrap: wrap; gap: 4px; font-size: 26px; line-height: 1; }
.gear { display: flex; flex-wrap: wrap; gap: 10px; }
.gear .stat img { width: 40px; height: 40px; }
.shot { width: 100%; height: auto; border-radius: 12px; border: 1px solid var(--line); background: var(--card); aspect-ratio: 16 / 9; }
