/* Asylum: The Ward — asylum-horror theme: sepia/yellowed paper,
   filthy tiles, blood-red accents. Own CSS; layout follows the
   family chassis. */
:root {
  --bg: #171410; --card: #221d16; --card2: #2c251b; --ink: #ece2cc;
  --muted: #a99a7d; --gold: #d9a441; --orange: #e07b28; --teal: #7fa08a;
  --red: #b3312c; --bar: #453a2a;
}
* { box-sizing: border-box; }
body { margin: 0; font-family: system-ui, -apple-system, "Segoe UI", sans-serif; background: var(--bg); color: var(--ink); }
#app { max-width: 860px; margin: 0 auto; padding: 12px; }
header { display: flex; justify-content: space-between; align-items: center; gap: 10px; flex-wrap: wrap; }
.brand { display: flex; align-items: center; gap: 10px; }
.logo { width: 46px; height: 46px; }
h1 { font-size: 20px; margin: 0; letter-spacing: .4px; }
.sub { color: var(--muted); font-size: 12px; }
.head-right { display: flex; align-items: center; gap: 10px; }
.balance-box { background: var(--card); border: 1px solid var(--bar); border-radius: 10px; padding: 8px 12px; display: flex; gap: 8px; align-items: center; }
.bal-label { color: var(--muted); font-size: 12px; }
.badge { background: #3d3423; color: #ffd98a; border-radius: 6px; padding: 2px 7px; font-size: 11px; font-weight: 700; }
.badge.real { background: var(--red); color: #fff; }
button { font: inherit; }
.ghost { background: var(--card2); color: var(--ink); border: 1px solid var(--bar); border-radius: 9px; padding: 8px 12px; cursor: pointer; }
.ghost.on { border-color: var(--gold); color: var(--gold); }
main { display: flex; flex-direction: column; gap: 12px; margin-top: 12px; }
.card, .stage-card { background: var(--card); border: 1px solid var(--bar); border-radius: 14px; padding: 14px; }
.stage-card { position: relative; background: linear-gradient(180deg, #2a2318, #1d1811); overflow: hidden; }
.tower-decor { text-align: center; color: #5c4f36; font-weight: 800; letter-spacing: 3px; font-size: 13px; margin-bottom: 8px; }
.fs-banner { display: flex; justify-content: space-between; gap: 8px; flex-wrap: wrap; background: #3a1d10; border: 1px solid var(--red); color: #ffd9ae; border-radius: 10px; padding: 8px 12px; margin-bottom: 10px; font-size: 13px; }
.hidden { display: none !important; }
.board { display: flex; gap: 6px; align-items: flex-start; justify-content: center; }
.col { flex: 1; display: flex; flex-direction: column; gap: 6px; }
.cells-row { display: grid; grid-template-columns: repeat(5, 1fr); gap: 6px; margin: 6px 0; }
.ecell { height: 40px; border-radius: 8px; display: grid; place-items: center; font-size: 15px; background: #12100c; border: 2px dashed #453a2a; color: #77694e; }
.ecell.spacer { background: transparent; border: 0; }
.ecell.open { border: 2px solid var(--gold); background: #2b2113; color: var(--ink); box-shadow: 0 0 10px rgba(217,164,65,.35); }
.ecell.kind-xsplit { border-color: #ff7ad9; background: #33142a; }
.ecell.kind-xways { border-color: var(--teal); background: #16241b; }
.ecell.kind-wild, .ecell.kind-xnudge { border-color: #ffe27a; background: #33300f; }
.ecell.kind-dead { border-color: var(--red); background: #331413; }
.cell { aspect-ratio: 1 / 1.02; border-radius: 10px; background: #33291b; border: 1px solid #5a4a2f; display: grid; place-items: center; position: relative;
  background-image: repeating-linear-gradient(0deg, transparent 0 10px, rgba(0,0,0,.16) 10px 12px); }
.cell .tile-glyph { font-size: 26px; }
.cell.framed { border-color: #ff7a1a; box-shadow: 0 0 12px rgba(255,110,26,.75), inset 0 0 14px rgba(255,110,26,.35); }
.cell.transformed { border-color: #c9a0ff; box-shadow: 0 0 10px rgba(160,110,255,.5); }
.cell.deadcell { border-color: var(--red); background-color: #40201c; }
.cell .dead-badge { position: absolute; right: 3px; bottom: 2px; font-size: 12px; font-weight: 800; color: #ff6d66; }
.cell.win { border-color: var(--gold); box-shadow: 0 0 12px rgba(217,164,65,.55); background-color: #3d3016; }
.cell.wild { background-color: #4a3d10; border-color: #ffe27a; }
.cell.scorp { background-color: #2e2113; border-color: var(--orange); }
.cell.spider { background-color: #241a2e; border-color: #9a7bc0; }
.cell.dead { background-color: #331d1a; border-color: var(--red); }
.win-panel { margin-top: 10px; text-align: center; background: #14110a; border: 1px solid var(--gold); color: #ffe9b0; border-radius: 10px; padding: 9px; font-weight: 700; }
.win-banner { margin-top: 10px; text-align: center; font-size: 24px; font-weight: 800; color: var(--gold); }
.win-banner .tier-head { font-size: 15px; letter-spacing: 2px; color: var(--orange); }
.win-banner.tier-epic { color: #ff5d5d; font-size: 30px; }
.overlay { position: absolute; inset: 0; background: rgba(12, 9, 6, .92); display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 10px; z-index: 5; text-align: center; padding: 20px; }
.overlay h3 { margin: 0; color: var(--gold); letter-spacing: 1px; }
.controls .bet-row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.chips { display: flex; gap: 6px; flex-wrap: wrap; }
.chip { background: var(--card2); color: var(--ink); border: 1px solid var(--bar); border-radius: 999px; padding: 6px 12px; cursor: pointer; }
.chip.on { background: var(--gold); color: #241300; font-weight: 700; }
.bet-input { display: flex; align-items: center; gap: 6px; margin-left: auto; }
.bet-input input { width: 76px; padding: 8px; border-radius: 8px; border: 1px solid var(--bar); background: #14110c; color: var(--ink); }
.bet-input button { width: 34px; height: 34px; border-radius: 8px; border: 1px solid var(--bar); background: var(--card2); color: var(--ink); cursor: pointer; }
.spin-btn { width: 100%; margin-top: 12px; padding: 14px; border: 0; border-radius: 12px; background: linear-gradient(180deg, #e0aa4a, #b97a16); color: #241300; font-size: 18px; font-weight: 800; cursor: pointer; letter-spacing: 1px; }
.spin-btn:disabled { opacity: .55; cursor: wait; }
.overlay .spin-btn { width: auto; padding: 12px 34px; }
.quick-row { display: flex; gap: 8px; margin-top: 10px; flex-wrap: wrap; }
.msg { margin-top: 10px; min-height: 20px; color: var(--teal); font-weight: 600; }
.msg.err { color: #ff8585; }
.paytable .prow { padding: 7px 0; border-bottom: 1px solid #362d1e; font-size: 14px; }
.paytable .prow span { color: var(--muted); }
.note { color: var(--muted); font-size: 13px; line-height: 1.55; }
.history { list-style: none; margin: 0; padding: 0; }
.history li { display: flex; justify-content: space-between; padding: 6px 0; border-bottom: 1px solid #362d1e; font-size: 14px; }
.history .win { color: #7be495; font-weight: 700; }
.fair-grid { display: grid; gap: 8px; font-size: 13px; }
.fair-grid code { word-break: break-all; color: #ffd98a; }
.seed-edit { display: inline-flex; gap: 6px; }
.seed-edit input, .fair-actions input { padding: 7px; border-radius: 8px; border: 1px solid var(--bar); background: #14110c; color: var(--ink); }
.fair-actions { display: flex; gap: 8px; margin-top: 10px; flex-wrap: wrap; }
.verify-out { white-space: pre-wrap; font-size: 11px; color: var(--muted); max-height: 260px; overflow: auto; }
footer { color: var(--muted); font-size: 12px; text-align: center; padding: 10px 0 4px; }
@media (max-width: 480px) {
  .cell .tile-glyph { font-size: 20px; }
  .ecell { height: 34px; font-size: 13px; }
  h1 { font-size: 17px; }
}
