:root { --ink: #120e18; --paper: #f3ead6; --wine: #173a26; --red: #c23b3b; --gold: #ffbe5a; --neon: #ff4fa3; --acc: #7dff9b;
  --pix: 'Silkscreen', monospace; --mono: 'Space Mono', ui-monospace, monospace; }
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; overflow: hidden; background: #081009; color: var(--paper); font: 14px/1.5 var(--mono); }
#town { position: fixed; inset: 0; width: 100%; height: 100%; display: block; cursor: grab; image-rendering: pixelated; }
#town.drag { cursor: grabbing; }
button { font: inherit; color: inherit; cursor: pointer; }
[hidden] { display: none !important; }
.small { font-size: 12px; opacity: .75; }
.btn { background: var(--paper); color: var(--ink); border: 2px solid var(--ink); padding: 8px 16px; font: 700 13px var(--pix); letter-spacing: 1px; box-shadow: 3px 3px 0 var(--ink); text-decoration: none; display: inline-block; }
.btn:hover { background: var(--gold); } .btn:active { transform: translate(2px, 2px); box-shadow: 1px 1px 0 var(--ink); }
.btn.ghost { background: transparent; } .btn.on { background: var(--ink); color: var(--paper); }
.btn:disabled { opacity: .55; cursor: wait; }
:focus-visible { outline: 2px solid var(--gold); outline-offset: 2px; }

.bar { position: fixed; top: 0; left: 0; right: 0; z-index: 10; display: flex; align-items: center; gap: 16px; padding: 10px 16px; background: var(--wine); border-bottom: 3px solid var(--ink); }
.brand { display: flex; align-items: center; gap: 10px; color: var(--paper); text-decoration: none; font: 700 22px var(--pix); letter-spacing: 3px; white-space: nowrap; }
.brand img { border: 2px solid var(--paper); image-rendering: pixelated; }
.bar nav { display: flex; gap: 2px; flex: 1; justify-content: center; flex-wrap: wrap; }
.bar nav button { background: none; border: 2px solid transparent; padding: 4px 10px; font: 400 13px var(--mono); }
.bar nav button:hover { border-color: var(--paper); } .bar nav button.on { border-color: var(--paper); background: rgba(0,0,0,.25); }
.bar .right { display: flex; gap: 10px; align-items: center; }
.clock { font-size: 12px; opacity: .85; white-space: nowrap; }
.xbtn { display: grid; place-items: center; width: 36px; height: 36px; border: 2px solid var(--paper); color: var(--paper); text-decoration: none; }
@media (max-width: 1050px) { .bar nav, .clock { display: none; } }

.ca { position: fixed; top: 72px; left: 16px; z-index: 9; display: flex; align-items: center; gap: 8px; background: var(--paper); color: var(--ink); border: 2px solid var(--ink); padding: 6px 8px; font-size: 12px; box-shadow: 3px 3px 0 var(--ink); }
.ca b { background: var(--ink); color: var(--paper); padding: 1px 6px; font-family: var(--pix); }
.ca button, .ca a { background: none; border: 2px solid var(--ink); padding: 1px 8px; font: 700 11px var(--pix); color: var(--ink); text-decoration: none; }
.ca a.buy { background: var(--ink); color: var(--paper); }

.panel { position: fixed; z-index: 9; background: var(--paper); color: var(--ink); border: 3px solid var(--ink); box-shadow: 6px 6px 0 rgba(0,0,0,.6); padding: 22px; overflow: auto; }
.panel.left { left: 16px; top: 128px; width: min(470px, calc(100vw - 32px)); max-height: calc(100vh - 150px); }
.panel.right { right: 16px; top: 76px; width: min(450px, calc(100vw - 32px)); max-height: calc(100vh - 170px); }
.panel .x { position: absolute; top: 12px; right: 12px; width: 30px; height: 30px; background: none; border: 2px solid var(--ink); font-size: 16px; line-height: 1; }
.badge { width: 62px; height: 62px; display: grid; place-items: center; background: var(--wine); border: 2px solid var(--ink); margin-bottom: 14px; } .badge img { image-rendering: pixelated; }
h1 { font: 700 clamp(28px, 3.5vw, 42px)/1.12 var(--pix); margin: 0 0 14px; letter-spacing: 1px; }
h1 mark { background: var(--wine); color: var(--paper); padding: 0 6px; }
.panel p { margin: 0 0 12px; }
.row2 { display: flex; gap: 10px; flex-wrap: wrap; margin: 6px 0 14px; }
.intro-links { display: flex; gap: 14px; flex-wrap: wrap; padding-top: 12px; border-top: 3px dotted var(--ink); margin-bottom: 8px; }
.intro-links button { background: none; border: 0; padding: 0; text-decoration: underline; font-weight: 700; color: var(--ink); }
.panel h2 { font: 700 20px var(--pix); margin: 0 0 4px; } .panel h3 { font: 700 14px var(--pix); margin: 16px 0 8px; }
.sub { font-size: 12px; opacity: .7; margin-bottom: 12px; }
.err { color: #b3261e; min-height: 1.2em; font-size: 12px; margin: 8px 0 !important; }
.ok { color: #1e7a3a; font-size: 12px; }
.list { list-style: none; margin: 0; padding: 0; } .list li { padding: 7px 0; border-bottom: 2px dotted rgba(18,14,24,.25); font-size: 13px; }
.list li.click { cursor: pointer; } .list li.click:hover { background: rgba(23,58,38,.1); }
.list time { opacity: .6; margin-right: 6px; font-size: 11px; }
.tg { display: inline-block; font: 700 10px var(--pix); padding: 0 5px; border: 2px solid var(--ink); margin-right: 6px; }
.tg.win { background: #bff2c9; } .tg.loss { background: #ffc4bd; } .tg.raid { background: #ffe8a8; } .tg.round { background: var(--gold); } .tg.council { background: var(--wine); color: var(--paper); }
.kv { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin: 12px 0; }
.kv div { border: 2px solid var(--ink); padding: 8px; } .kv b { display: block; font: 700 18px var(--pix); } .kv span { font-size: 11px; opacity: .7; }
.pos { color: #1e7a3a; } .neg { color: #b3261e; }
.who { display: flex; gap: 14px; align-items: center; margin-bottom: 8px; }
.who canvas { width: 72px; height: 96px; image-rendering: pixelated; border: 2px solid var(--ink); background: #0f1d14; flex: none; }
.orders { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; } .orders button { text-align: left; font-size: 12px; padding: 7px 10px; }
.orders button small { display: block; font: 400 11px var(--mono); opacity: .75; }
.find { display: flex; gap: 8px; } .find input { flex: 1; min-width: 0; border: 2px solid var(--ink); padding: 9px; font: 13px var(--mono); background: #fff; color: var(--ink); }
#briefText { width: 100%; border: 2px solid var(--ink); padding: 9px; font: 13px var(--mono); background: #fff; color: var(--ink); resize: vertical; }
#briefs li { font-size: 12px; }
.tier { display: inline-block; font: 700 9px var(--pix); padding: 1px 5px; border: 2px solid var(--ink); }
.tier.proven { background: #ffbe5a; } .tier.new { background: #e3ecd8; } .tier.cold { background: #9aa6a0; color: #fff; }
.untrack { float: right; background: none; border: 2px solid var(--ink); width: 24px; height: 24px; line-height: 1; }
#trackList a, table a { color: var(--ink); }
.steps { counter-reset: s; list-style: none; padding: 0; margin: 0; }
.steps li { counter-increment: s; padding: 10px 0 10px 44px; position: relative; border-bottom: 2px dotted rgba(18,14,24,.25); }
.steps li::before { content: '0' counter(s); position: absolute; left: 0; top: 10px; font: 700 18px var(--pix); }
.steps b { display: block; }
table { width: 100%; border-collapse: collapse; font-size: 12.5px; } th { text-align: left; font: 700 11px var(--pix); border-bottom: 2px solid var(--ink); padding: 4px; } td { padding: 6px 4px; border-bottom: 2px dotted rgba(18,14,24,.2); }
tr.click { cursor: pointer; } tr.click:hover { background: rgba(23,58,38,.1); }
.transcript li b { display: block; font-size: 12px; }

.sitbar { position: fixed; left: 50%; top: 76px; transform: translateX(-50%); z-index: 8; background: var(--ink); color: var(--paper); border: 2px solid var(--gold); padding: 6px 14px; font: 700 12px var(--pix); letter-spacing: 1px; white-space: nowrap; }
.sitbar.live { background: var(--wine); animation: pulse 1.2s infinite; } @keyframes pulse { 50% { box-shadow: 0 0 18px var(--gold); } }
.ticker { position: fixed; left: 16px; bottom: 16px; z-index: 8; max-width: min(620px, calc(100vw - 420px)); background: rgba(5,14,9,.88); border: 2px solid var(--wine); padding: 6px 10px; font-size: 12px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.controls { position: fixed; right: 16px; bottom: 16px; z-index: 8; display: flex; gap: 6px; align-items: center; }
.controls button { background: var(--paper); color: var(--ink); border: 2px solid var(--ink); min-width: 38px; height: 34px; font: 700 12px var(--pix); }
.controls button.on { background: var(--wine); color: var(--paper); }
.chip { display: flex; align-items: center; gap: 6px; background: rgba(5,14,9,.88); border: 2px solid var(--wine); padding: 4px 10px; font-size: 12px; }
.chip i { width: 8px; height: 8px; background: var(--acc); box-shadow: 0 0 8px var(--acc); }
.campchat { position: fixed; right: 16px; bottom: 64px; z-index: 8; width: min(340px, calc(100vw - 32px)); display: flex; flex-direction: column; gap: 8px; pointer-events: none; }
#p-side:not([hidden]) ~ .campchat { right: 482px; }
.cc { pointer-events: auto; cursor: pointer; display: flex; gap: 10px; align-items: flex-start; background: var(--paper); color: var(--ink); border: 2px solid var(--ink); box-shadow: 4px 4px 0 rgba(0,0,0,.6); padding: 8px 10px; font-size: 12px; line-height: 1.4; animation: ccin .35s ease-out; transition: opacity .5s, transform .5s; }
.cc canvas { width: 27px; height: 36px; image-rendering: pixelated; background: #0f1d14; border: 2px solid var(--ink); flex: none; }
.cc b { display: block; font: 700 11px var(--pix); }
.cc.head { background: var(--wine); color: var(--paper); cursor: default; }
.cc.out { opacity: 0; transform: translateX(30px); }
@keyframes ccin { from { opacity: 0; transform: translateX(40px); } }
@media (max-width: 1000px) { #p-side:not([hidden]) ~ .campchat { display: none; } }
@media (max-width: 760px) { .ticker, .chip, .sitbar { display: none; } .panel.left { top: 120px; } }
@media (prefers-reduced-motion: reduce) { .sitbar.live { animation: none; } }

/* the gate: click the campfire to enter */
.gate { position: fixed; inset: 0; z-index: 1000; display: grid; place-items: center; background: radial-gradient(ellipse at 50% 62%, #2a1a0c 0%, #0c160e 45%, #050a06 100%); transition: opacity .7s ease, visibility .7s; }
.gate.out { opacity: 0; visibility: hidden; }
.gate-sky { position: absolute; inset: 0; pointer-events: none; background-image: radial-gradient(2px 2px at 12% 18%, #d8f27a, transparent), radial-gradient(2px 2px at 28% 9%, #d8f27a, transparent), radial-gradient(2px 2px at 71% 14%, #d8f27a, transparent), radial-gradient(2px 2px at 86% 28%, #d8f27a, transparent), radial-gradient(2px 2px at 45% 6%, #d8f27a, transparent), radial-gradient(2px 2px at 7% 44%, #d8f27a, transparent), radial-gradient(2px 2px at 93% 52%, #d8f27a, transparent); opacity: .7; animation: twinkle 3s steps(2) infinite; }
.gate-inner { position: relative; display: flex; flex-direction: column; align-items: center; gap: 10px; padding: 16px; text-align: center; }
.gate-logo { image-rendering: pixelated; }
.gate-title { margin: 0; font: 700 clamp(34px, 7vw, 64px)/1 var(--pix); letter-spacing: 6px; color: var(--paper); text-shadow: 4px 4px 0 var(--ink); }
.fire { position: relative; width: min(300px, 70vw); aspect-ratio: 1; margin: 6px 0; padding: 0; border: 0; background: none; cursor: pointer; transition: transform .15s; }
.fire:hover { transform: scale(1.06); } .fire:active { transform: scale(.97); }
.fire:focus-visible { outline: 3px dashed var(--gold); outline-offset: 8px; }
.fire-art { position: relative; width: 100%; height: 100%; image-rendering: pixelated; }
.fire-glow { position: absolute; inset: -30%; border-radius: 50%; background: radial-gradient(circle, rgba(255,170,60,.45) 0%, rgba(240,120,30,.15) 40%, transparent 70%); animation: glow 1.4s ease-in-out infinite alternate; pointer-events: none; }
.fire:hover .fire-glow { background: radial-gradient(circle, rgba(255,190,80,.6) 0%, rgba(240,120,30,.22) 40%, transparent 70%); }
.flame { animation: flick .5s steps(1) infinite; } .flame.f2 { animation-delay: .25s; opacity: 0; }
.spark { position: absolute; width: 8px; height: 8px; background: #ffd166; left: 50%; top: 35%; opacity: 0; animation: rise 2.2s linear infinite; pointer-events: none; }
.spark.s2 { left: 42%; animation-delay: .7s; background: #ff9f1c; } .spark.s3 { left: 57%; animation-delay: 1.4s; }
.gate-hint { margin: 0; font: 700 clamp(13px, 2.4vw, 18px) var(--pix); letter-spacing: 2px; color: var(--gold); animation: pulse 1.6s ease-in-out infinite; }
.gate.lit .fire-glow { animation: flare .7s ease-out forwards; }
@keyframes flick { 0% { opacity: 1; } 50% { opacity: 0; } }
@keyframes glow { from { opacity: .75; transform: scale(.95); } to { opacity: 1; transform: scale(1.05); } }
@keyframes flare { to { opacity: 1; transform: scale(4); } }
@keyframes rise { 0% { opacity: 0; transform: translate(0, 0); } 15% { opacity: 1; } 100% { opacity: 0; transform: translate(10px, -140px); } }
@keyframes pulse { 50% { opacity: .45; } }
@keyframes twinkle { 50% { opacity: .35; } }
@media (prefers-reduced-motion: reduce) { .flame, .fire-glow, .spark, .gate-hint, .gate-sky { animation: none; } .flame.f2 { display: none; } }
