:root {
  --ink: #efe6d2;
  --dim: #b5a98f;
  --panel: rgba(26, 21, 19, 0.84);
  --edge: #6b5d49;
  --accent: #e0a64a;
  --blue: #5b8fb5;
  font-family: ui-monospace, "SF Mono", Menlo, Consolas, "Liberation Mono", monospace;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; background: #14110f; color: var(--ink); overflow: hidden; }
#c { position: fixed; inset: 0; width: 100%; height: 100%; display: block; image-rendering: pixelated; image-rendering: crisp-edges; touch-action: none; }

#hud { position: fixed; top: max(14px, env(safe-area-inset-top)); left: 16px; right: 16px; pointer-events: none; display: grid; gap: 2px; text-shadow: 0 1px 0 rgba(0,0,0,.8), 0 0 4px rgba(0,0,0,.6); }
#hud .title { font-size: 22px; letter-spacing: .18em; text-transform: lowercase; }
#clock, #status { font-size: 13px; color: var(--ink); opacity: .9; }
#status { color: var(--accent); }
#online { position: absolute; right: 0; top: 4px; font-size: 12px; color: var(--dim); }

#bubble { position: fixed; transform: translate(-50%, -100%); max-width: min(260px, 70vw); padding: 8px 11px; background: #efe6d2; color: #231c17; border: 2px solid #231c17; font-size: 13px; line-height: 1.35; pointer-events: none; z-index: 5; box-shadow: 3px 3px 0 rgba(0,0,0,.35); }
#bubble::after { content: ""; position: absolute; left: 50%; bottom: -9px; margin-left: -6px; border: 6px solid transparent; border-top-color: #231c17; border-bottom: 0; }

#dock { position: fixed; bottom: max(14px, env(safe-area-inset-bottom)); left: 224px; right: 14px; display: flex; gap: 8px; flex-wrap: wrap; justify-content: flex-end; }
button { font: inherit; font-size: 13px; color: var(--ink); background: var(--panel); border: 2px solid var(--edge); padding: 9px 12px; cursor: pointer; border-radius: 0; }
button:hover, button:focus-visible { border-color: var(--accent); outline: none; }
button.primary { background: var(--accent); color: #231c17; border-color: #231c17; font-weight: 700; }
button.wide { width: 100%; margin-top: 12px; padding: 12px; }

#toast { position: fixed; top: 84px; left: 50%; transform: translateX(-50%); background: var(--panel); border: 2px solid var(--accent); padding: 9px 14px; max-width: min(420px, 90vw); font-size: 13px; z-index: 8; }
#conn { position: fixed; top: 50px; left: 50%; transform: translateX(-50%); font-size: 12px; background: #5a2a22; padding: 5px 10px; border: 2px solid #231c17; z-index: 8; }

#sheet { position: fixed; inset: auto 0 0 0; max-height: 82vh; overflow: auto; background: var(--panel); border-top: 2px solid var(--edge); padding: 18px 18px 26px; z-index: 10; backdrop-filter: blur(3px); }
@media (min-width: 720px) { #sheet { inset: 50% auto auto 50%; transform: translate(-50%, -50%); width: 520px; max-height: 78vh; border: 2px solid var(--edge); } }
#close { position: absolute; top: 8px; right: 8px; width: 34px; height: 34px; padding: 0; font-size: 20px; line-height: 1; }
.pane { display: none; }
.pane.on { display: block; }
h2 { margin: 0 0 6px; font-size: 17px; letter-spacing: .08em; font-weight: 600; }
h3 { margin: 18px 0 6px; font-size: 13px; letter-spacing: .1em; color: var(--accent); font-weight: 600; }
.hint, .dim { color: var(--dim); font-size: 12px; line-height: 1.5; }
.hint { margin: 0 0 12px; }
label, .label { display: block; margin-top: 12px; font-size: 12px; color: var(--dim); }
label span { float: right; }
input, textarea { width: 100%; margin-top: 4px; font: inherit; font-size: 14px; color: var(--ink); background: rgba(0,0,0,.35); border: 2px solid var(--edge); padding: 8px 10px; border-radius: 0; resize: none; }
input:focus, textarea:focus { outline: none; border-color: var(--accent); }
#offerings { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 6px; margin-top: 6px; }
#offerings button { text-align: left; padding: 7px 9px; font-size: 12px; }
#offerings button[aria-checked="true"] { border-color: var(--accent); background: rgba(224,166,74,.18); }
.msg { min-height: 1.4em; margin-top: 10px; font-size: 12px; color: var(--accent); }
.list { display: grid; gap: 8px; margin-top: 8px; }
.card { border-left: 3px solid var(--edge); padding: 4px 0 4px 10px; font-size: 13px; line-height: 1.45; }
.card .who { color: var(--dim); font-size: 11px; }
.card .re { color: var(--accent); }
.bar { display: flex; align-items: center; gap: 8px; font-size: 12px; }
.bar i { flex: 1; height: 6px; background: rgba(255,255,255,.12); position: relative; }
.bar i b { position: absolute; top: 0; bottom: 0; background: var(--accent); }
.bar i b.neg { background: var(--blue); }
[hidden] { display: none !important; }

#where { font-size: 12px; color: var(--dim); }
#hint { position: fixed; top: 116px; left: 16px; font-size: 11px; color: var(--dim); max-width: 60vw; text-shadow: 0 1px 0 rgba(0,0,0,.7); transition: opacity 1.2s; pointer-events: none; }
#hint.gone { opacity: 0; }

#mapwrap { position: fixed; left: 14px; bottom: max(14px, env(safe-area-inset-bottom)); width: 176px; z-index: 6; }
#map { display: block; width: 176px; height: 176px; border-radius: 50%; background: #14110f; box-shadow: 3px 3px 0 rgba(0,0,0,.4); cursor: crosshair; touch-action: none; }
#mapbtns { position: absolute; left: 184px; bottom: 6px; display: grid; gap: 5px; }
#mapbtns button { padding: 5px 7px; font-size: 11px; white-space: nowrap; }
#mapbtns button.on { border-color: var(--accent); background: rgba(224,166,74,.22); }

#stick { position: fixed; right: 22px; bottom: 96px; width: 112px; height: 112px; border-radius: 50%; background: rgba(26,21,19,.45); border: 2px solid var(--edge); touch-action: none; z-index: 6; }
#stick i { position: absolute; left: 50%; top: 50%; width: 46px; height: 46px; margin: -23px 0 0 -23px; border-radius: 50%; background: rgba(239,230,210,.55); border: 2px solid #231c17; }

@media (max-width: 700px) {
  #mapwrap { width: 128px; }
  #map { width: 128px; height: 128px; }
  #mapbtns { left: auto; right: -2px; bottom: auto; top: -2px; transform: translateX(100%); }
  #mapbtns { left: 132px; right: auto; transform: none; bottom: 4px; top: auto; }
  #dock { left: 14px; right: 14px; bottom: calc(148px + env(safe-area-inset-bottom)); justify-content: center; }
  #dock button { padding: 7px 9px; font-size: 12px; }
  #stick { bottom: calc(14px + env(safe-area-inset-bottom)); }
  #hint { display: none; }
}
.card.ev { border-left-color: var(--accent); padding: 2px 0 2px 10px; font-size: 12px; }
.card.ev .who { display: inline; margin-right: 8px; }
