:root {
  --bg: #14120d;
  --panel: #1f1c14;
  --line: #3a3526;
  --text: #d9d2b3;
  --muted: #8c8567;
  --accent: #e0a526;
  --hp: #b8402f;
  --rad: #8bb32a;
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; height: 100%; background: var(--bg); color: var(--text);
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; }
#app { display: flex; flex-direction: column; height: 100%; max-width: 560px; margin: 0 auto; }

#hud { padding: 10px 14px 8px; background: var(--panel); border-bottom: 1px solid var(--line); }
#hud .row { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 6px;
  font-family: "Courier New", ui-monospace, monospace; text-transform: uppercase; letter-spacing: .08em; }
#rank { color: var(--accent); font-size: 13px; }
#money { font-size: 14px; }
.bars { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.bar { position: relative; height: 16px; background: #0d0c08; border: 1px solid var(--line); overflow: hidden; }
.bar span { position: absolute; inset: 0 auto 0 0; width: 0; transition: width .35s; }
.bar.hp span { background: var(--hp); }
.bar.rad span { background: var(--rad); }
.bar b { position: relative; display: block; text-align: center; font: 600 11px/16px "Courier New", monospace; color: #fff; text-shadow: 0 1px 2px #000; }
.xp { height: 3px; background: #0d0c08; margin-top: 7px; }
.xp span { display: block; height: 100%; width: 0; background: var(--accent); transition: width .35s; }

main { flex: 1; overflow-y: auto; padding: 16px 14px; }
.view { display: none; }
.view.active { display: block; }

.story { font-size: 16px; line-height: 1.55; margin: 0 0 14px; }
.log { margin: 0 0 14px; padding: 8px 10px; border-left: 3px solid var(--accent); background: var(--panel);
  font: 13px/1.5 "Courier New", ui-monospace, monospace; color: var(--muted); }
.log div:first-child { color: var(--text); }
.choices { display: flex; flex-direction: column; gap: 8px; }
.btn { width: 100%; text-align: left; padding: 13px 14px; font-size: 15px; color: var(--text);
  background: var(--panel); border: 1px solid var(--line); border-radius: 6px; cursor: pointer; }
.btn:active { background: #2b2719; border-color: var(--accent); }
.btn:disabled { opacity: .45; cursor: default; }
.btn small { display: block; margin-top: 3px; color: var(--muted); font-size: 12px; }
.btn.primary { background: var(--accent); color: #1a1405; border-color: var(--accent); font-weight: 700; text-align: center; }

canvas#weld { width: 100%; height: 220px; display: block; border: 1px solid var(--line); border-radius: 6px;
  touch-action: none; margin-bottom: 8px; }
.hint { color: var(--muted); font-size: 13px; margin: 0 0 12px; }

.item { display: flex; gap: 12px; align-items: center; padding: 12px; margin-bottom: 8px;
  background: var(--panel); border: 1px solid var(--line); border-radius: 6px; }
.item .ico { font-size: 26px; }
.item .meta { flex: 1; }
.item .meta b { display: block; }
.item .meta span { color: var(--muted); font-size: 13px; }
.item button { padding: 8px 12px; border-radius: 6px; border: 1px solid var(--accent); background: transparent; color: var(--accent); cursor: pointer; }
.empty { color: var(--muted); text-align: center; padding: 30px 0; }
.top-row { display: flex; gap: 10px; padding: 10px 12px; border-bottom: 1px solid var(--line); }
.top-row .n { width: 22px; color: var(--accent); font-family: "Courier New", monospace; }
.top-row .nm { flex: 1; }
.top-row .xp-val { color: var(--muted); font-family: "Courier New", monospace; }

#tabs { display: flex; background: var(--panel); border-top: 1px solid var(--line); padding-bottom: env(safe-area-inset-bottom); }
#tabs button { flex: 1; padding: 14px 0; background: none; border: 0; color: var(--muted); font-size: 14px; cursor: pointer; }
#tabs button.on { color: var(--accent); box-shadow: inset 0 2px 0 var(--accent); }
