/* ============================================================
   BROTHEL BRIAN — pixel styles
   Palette pulled from the title art: purple shotgun house,
   green shutters, gold trim. Mardi Gras all the way down.
   ============================================================ */

:root {
  --bg: #17121f;
  --panel: #241a33;
  --panel-2: #2f2344;
  --purple: #6b5a9e;
  --green: #2e7d5b;
  --gold: #f2c14e;
  --cream: #f5ead6;
  --red: #d0533f;
  --ink: #0c0913;
  --muted: #a794c9;
}

* { margin: 0; padding: 0; box-sizing: border-box; }

html, body { height: 100%; }

body {
  background: var(--bg);
  background-image:
    linear-gradient(rgba(107, 90, 158, 0.06) 1px, transparent 1px),
    linear-gradient(90deg, rgba(107, 90, 158, 0.06) 1px, transparent 1px);
  background-size: 24px 24px;
  color: var(--cream);
  font-family: 'Press Start 2P', 'Courier New', monospace;
  font-size: 10px;
  line-height: 1.8;
  image-rendering: pixelated;
}

img { image-rendering: pixelated; }

/* ---------- screens ---------- */

.screen { display: none; min-height: 100vh; padding: 16px; }
.screen.active { display: flex; align-items: center; justify-content: center; flex-direction: column; }

/* ---------- panels & buttons ---------- */

.panel {
  background: var(--panel);
  border: 3px solid var(--gold);
  box-shadow: 6px 6px 0 var(--ink);
  padding: 16px;
}

.btn {
  font-family: inherit;
  font-size: 10px;
  color: var(--cream);
  background: var(--purple);
  border: 3px solid var(--ink);
  box-shadow: 4px 4px 0 var(--ink);
  padding: 10px 14px;
  cursor: pointer;
  text-transform: uppercase;
}

.btn:hover:not(:disabled) { background: var(--green); }
.btn:active:not(:disabled) { transform: translate(3px, 3px); box-shadow: 1px 1px 0 var(--ink); }
.btn:disabled { opacity: 0.4; cursor: not-allowed; }
.btn:focus-visible { outline: 3px dashed var(--gold); outline-offset: 3px; }

.btn-big { font-size: 12px; padding: 14px 20px; background: var(--red); }
.btn-big:hover:not(:disabled) { background: var(--gold); color: var(--ink); }
.btn.wide { width: 100%; margin-top: 12px; }

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

/* ---------- main menu ---------- */

.menu-box { text-align: center; max-width: 420px; }

.splash {
  width: min(300px, 78vw);
  border: 4px solid var(--gold);
  box-shadow: 8px 8px 0 var(--ink);
  margin-bottom: 20px;
}

h1 {
  font-size: clamp(24px, 6vw, 40px);
  color: var(--gold);
  text-shadow: 4px 4px 0 var(--red), 8px 8px 0 var(--ink);
  line-height: 1.2;
  margin-bottom: 12px;
}

.subtitle { color: var(--muted); margin-bottom: 24px; }

.menu-buttons { display: flex; flex-direction: column; gap: 12px; align-items: center; margin-bottom: 20px; }
.menu-buttons .btn-big { min-width: 240px; }

.footnote { color: var(--muted); font-size: 8px; }

/* ---------- character creation ---------- */

.create-box { max-width: 420px; width: 100%; text-align: center; }
.create-box h2 { color: var(--gold); margin-bottom: 14px; }

.portrait {
  width: 160px;
  border: 3px solid var(--purple);
  margin-bottom: 14px;
}

.create-box label { display: block; text-align: left; color: var(--muted); margin-bottom: 6px; }

.create-box input {
  width: 100%;
  font-family: inherit;
  font-size: 12px;
  color: var(--cream);
  background: var(--ink);
  border: 3px solid var(--purple);
  padding: 10px;
  margin-bottom: 12px;
}
.create-box input:focus { outline: none; border-color: var(--gold); }

.hint { color: var(--muted); font-size: 8px; line-height: 1.9; margin-bottom: 14px; text-align: left; }

.create-box .btn-big { width: 100%; margin-bottom: 10px; }

/* ---------- game screen ---------- */

#screen-game.active { justify-content: flex-start; align-items: stretch; gap: 12px; }

.hud {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
  background: var(--panel);
  border: 3px solid var(--gold);
  box-shadow: 6px 6px 0 var(--ink);
  padding: 10px 14px;
}

.hud-item { display: flex; flex-direction: column; gap: 2px; margin-right: 10px; }
.hud-label { color: var(--muted); font-size: 7px; text-transform: uppercase; }
.hud .btn { margin-left: auto; }

.game-layout {
  display: grid;
  grid-template-columns: 230px 1fr 230px;
  gap: 12px;
  flex: 1;
  min-height: 0;
}

.side { overflow-y: auto; max-height: 74vh; }
.side h3 { color: var(--gold); font-size: 11px; margin-bottom: 10px; }

.stage { display: flex; flex-direction: column; gap: 12px; min-width: 0; }

#game-canvas {
  width: 100%;
  aspect-ratio: 16 / 9;
  border: 4px solid var(--gold);
  box-shadow: 8px 8px 0 var(--ink);
  background: var(--ink);
  image-rendering: pixelated;
}

.stage-controls { display: flex; gap: 10px; flex-wrap: wrap; justify-content: center; }

/* ---------- roster ---------- */

.roster-card {
  background: var(--panel-2);
  border: 2px solid var(--purple);
  padding: 10px;
  margin-bottom: 10px;
}
.roster-card .name { color: var(--gold); margin-bottom: 4px; }
.roster-card .meta { color: var(--muted); font-size: 8px; line-height: 1.9; }
.roster-card .pips { color: var(--red); letter-spacing: 2px; }
.roster-empty { color: var(--muted); font-size: 8px; line-height: 1.9; }

/* ---------- log ---------- */

.log { display: flex; flex-direction: column; gap: 8px; font-size: 8px; line-height: 1.9; }
.log-entry { border-bottom: 2px solid var(--panel-2); padding-bottom: 8px; }
.log-entry.money { color: var(--gold); }
.log-entry.bad { color: var(--red); }
.log-entry.info { color: var(--muted); }

/* ---------- modals ---------- */

.modal {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(12, 9, 19, 0.85);
  align-items: center;
  justify-content: center;
  padding: 16px;
  z-index: 50;
}
.modal.open { display: flex; }

.modal-box { max-width: 640px; width: 100%; max-height: 86vh; overflow-y: auto; }
.modal-box.small { max-width: 420px; }
.modal-box h2 { color: var(--gold); margin-bottom: 12px; }
.modal-box p { font-size: 9px; line-height: 2; margin-bottom: 8px; }

.candidates { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 12px; margin: 14px 0; }

.candidate {
  background: var(--panel-2);
  border: 2px solid var(--purple);
  padding: 12px;
  text-align: left;
}
.candidate .name { color: var(--gold); margin-bottom: 6px; }
.candidate .meta { color: var(--muted); font-size: 8px; line-height: 1.9; margin-bottom: 8px; }
.candidate .blurb { font-size: 8px; line-height: 1.9; margin-bottom: 10px; }
.candidate .btn { width: 100%; font-size: 8px; }

.summary { font-size: 9px; line-height: 2.1; margin-bottom: 12px; }
.summary .row { display: flex; justify-content: space-between; gap: 10px; border-bottom: 2px solid var(--panel-2); padding: 4px 0; }

/* ---------- scrollbars ---------- */

::-webkit-scrollbar { width: 10px; }
::-webkit-scrollbar-track { background: var(--ink); }
::-webkit-scrollbar-thumb { background: var(--purple); border: 2px solid var(--ink); }

/* ---------- responsive ---------- */

@media (max-width: 900px) {
  .game-layout { grid-template-columns: 1fr; }
  .side { max-height: none; }
  .hud .btn { margin-left: 0; width: 100%; }
}

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; animation: none !important; }
}

/* ---------- version tag ---------- */

#version {
  position: fixed;
  right: 10px;
  bottom: 8px;
  font-size: 8px;
  color: var(--muted);
  text-shadow: 2px 2px 0 var(--ink);
  z-index: 99;
  pointer-events: none;
}

/* ---------- wallet modal ---------- */

.wallet-links { display: flex; flex-direction: column; gap: 10px; margin: 14px 0; }
.wallet-links .btn { text-align: center; text-decoration: none; display: block; }
.wallet-icon { width: 16px; height: 16px; vertical-align: middle; image-rendering: auto; }
.wallet-addr { margin-bottom: 10px; }
.wallet-status { color: var(--red); font-size: 9px; margin-top: 8px; }
.wallet-fineprint { color: var(--muted); font-size: 7px; line-height: 2; margin-top: 12px; }
.wallet-fineprint a { color: var(--gold); }
.footnote a { color: var(--gold); text-decoration: none; }
.footnote a:hover { text-decoration: underline; }
.addr { font-size: 8px; color: var(--gold); word-break: break-all; }

/* ---------- whitepaper page ---------- */

.paper-page { display: block; overflow-y: auto; }
.paper { max-width: 720px; margin: 0 auto; padding: 32px 16px 64px; }
.paper-back { color: var(--gold); font-size: 9px; text-decoration: none; }
.paper-back:hover { text-decoration: underline; }
.paper-title { margin-top: 18px; }
.paper .subtitle { margin-bottom: 28px; }
.paper-section { margin-bottom: 20px; }
.paper-section h2 { color: var(--gold); font-size: 12px; margin-bottom: 12px; }
.paper-section p { font-size: 9px; line-height: 2.1; margin-bottom: 10px; }
.paper-section .btn { display: inline-block; text-decoration: none; margin-right: 10px; margin-top: 6px; }
.alloc { width: 100%; border-collapse: collapse; font-size: 8px; line-height: 1.9; }
.alloc th { color: var(--gold); text-align: left; border-bottom: 3px solid var(--purple); padding: 6px 8px 6px 0; }
.alloc td { border-bottom: 2px solid var(--panel-2); padding: 8px 8px 8px 0; vertical-align: top; }
.paper-disclaimer { color: var(--muted); font-size: 7px; line-height: 2; margin-top: 28px; }

/* ---------- lady portraits (v0.5) ---------- */

.lady-thumb {
  width: 46px;
  height: 64px;
  float: left;
  margin: 0 10px 6px 0;
  border: 2px solid var(--purple);
  image-rendering: pixelated;
}
.candidate .name, .candidate .meta, .candidate .blurb { margin-left: 0; }
.roster-card { overflow: hidden; }
.roster-card .pips { clear: both; padding-top: 4px; }

/* ---------- walkable controls (v0.8) ---------- */

.canvas-wrap { position: relative; width: 100%; }

.walk-btn {
  position: absolute;
  bottom: 10px;
  width: 44px; height: 44px;
  font-size: 18px;
  color: var(--cream);
  background: rgba(36, 26, 51, 0.82);
  border: 3px solid var(--gold);
  box-shadow: 3px 3px 0 var(--ink);
  cursor: pointer;
  user-select: none;
  -webkit-user-select: none;
  touch-action: none;
  display: flex; align-items: center; justify-content: center;
}
.walk-btn:active { transform: translate(2px, 2px); box-shadow: 1px 1px 0 var(--ink); }
.walk-left { left: 10px; }
.walk-right { left: 62px; }

.door-hint {
  display: none;
  position: absolute;
  top: 10px; left: 50%;
  transform: translateX(-50%);
  background: rgba(36, 26, 51, 0.9);
  border: 2px solid var(--gold);
  color: var(--gold);
  font-size: 9px;
  padding: 6px 10px;
  white-space: nowrap;
  box-shadow: 3px 3px 0 var(--ink);
}

.walk-hint { color: var(--muted); font-size: 8px; text-align: center; margin-top: 8px; line-height: 1.8; }
