/* Rentfall — a rainy apartment block with a slot machine for windows. */

:root {
  --night: #141526;
  --night-2: #1c1e35;
  --night-3: #262944;
  --ink: #2b2135;
  --brick: #b9443a;
  --brick-2: #d9594a;
  --brick-dark: #7e2c2a;
  --amber: #f6c548;
  --amber-2: #e9a62b;
  --paper: #f3ead8;
  --paper-2: #e6d9bd;
  --teal: #4fb3a9;
  --mint: #7fd3a0;
  --rose: #ff6f7d;
  --violet: #9b6fe0;
  --text: #f5efe3;
  --muted: #a9a5bd;
  --line: rgba(255, 255, 255, .09);
  --shadow: 0 10px 30px rgba(0, 0, 0, .35);
  --r: 14px;
  --cell: 96px;
  --display: 'Bungee', 'Impact', 'Arial Black', sans-serif;
  --ui: 'Outfit', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --mono: 'Courier Prime', 'Courier New', ui-monospace, monospace;
  --common: #c9c3b5;
  --uncommon: #5fc28f;
  --rare: #5aa8f0;
  --legendary: #f0a83c;
}

* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; }
body {
  background: radial-gradient(1200px 700px at 50% -10%, #2a2d52 0%, var(--night) 60%) fixed, var(--night);
  color: var(--text);
  font: 16px/1.4 var(--ui);
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}
button { font: inherit; color: inherit; }
.loading { text-align: center; padding: 40vh 0; color: var(--muted); }
.ico { width: 100%; height: 100%; display: block; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
kbd { font: 600 .78em var(--mono); background: rgba(255,255,255,.1); border: 1px solid var(--line); border-radius: 4px; padding: 0 .35em; }

/* ── Rain ─────────────────────────────────────────────────────────────── */
#rain { position: fixed; inset: 0; pointer-events: none; z-index: 0; overflow: hidden; }
#rain i { position: absolute; top: -20vh; width: 1px; height: 14vh; background: linear-gradient(transparent, rgba(170, 190, 255, .35)); animation: fall linear infinite; }
@keyframes fall { to { transform: translate3d(-6vw, 130vh, 0); } }
body.no-anim #rain, body.no-rain #rain { display: none; }

#app { position: relative; z-index: 1; }

/* ── Buttons ──────────────────────────────────────────────────────────── */
.btn {
  appearance: none; border: 2px solid var(--ink); border-radius: 12px; padding: .6em 1.1em; cursor: pointer;
  background: var(--paper); color: var(--ink); font-weight: 700; letter-spacing: .01em;
  box-shadow: 0 4px 0 var(--ink); transition: transform .08s, box-shadow .08s, filter .15s;
  display: inline-flex; align-items: center; justify-content: center; gap: .45em;
}
.btn:hover { filter: brightness(1.05); }
.btn:active:not(:disabled) { transform: translateY(3px); box-shadow: 0 1px 0 var(--ink); }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.btn:focus-visible, .cell:focus-visible, .card:focus-visible, .chip:focus-visible { outline: 3px solid var(--amber); outline-offset: 2px; }
.btn.primary { background: var(--amber); }
.btn.danger { background: var(--brick-2); color: #fff; }
.btn.ghost { background: transparent; color: var(--text); border-color: var(--line); box-shadow: none; }
.btn.ghost:hover { background: rgba(255,255,255,.06); }
.btn.small { padding: .35em .75em; font-size: .9em; border-radius: 9px; box-shadow: 0 3px 0 var(--ink); }
.btn .ico { width: 1.3em; height: 1.3em; }
.btn.ghost .ico { filter: invert(1) brightness(1.4); }
.icon-btn { appearance: none; background: rgba(255,255,255,.06); border: 1px solid var(--line); color: var(--text); border-radius: 10px; padding: .45em .8em; cursor: pointer; font-weight: 600; display: inline-flex; gap: .4em; align-items: center; }
.icon-btn:hover { background: rgba(255,255,255,.12); }
.icon-btn .count { background: var(--amber); color: var(--ink); border-radius: 99px; padding: 0 .45em; font-size: .8em; font-weight: 800; }

/* ── Title screen ─────────────────────────────────────────────────────── */
.title-screen { min-height: 100vh; display: grid; place-items: center; padding: 32px 16px; }
.title-card { width: min(980px, 100%); display: grid; grid-template-columns: 1.1fr 1fr; gap: 40px; align-items: center; }
.title-art { position: relative; }
.logo { font: 400 clamp(48px, 8vw, 92px)/.9 var(--display); color: var(--amber); letter-spacing: .02em; margin: 0 0 .15em; text-shadow: 0 0 22px rgba(246, 197, 72, .45), 4px 4px 0 var(--brick-dark); }
.tagline { color: var(--muted); font-size: 1.12em; margin: 0 0 1.4em; max-width: 30em; }
.title-menu { display: grid; gap: 12px; max-width: 340px; }
.title-menu .btn { font-size: 1.1em; padding: .8em 1.2em; justify-content: flex-start; }
.title-menu .btn .ico { width: 1.6em; height: 1.6em; }
.records { display: flex; gap: 18px; margin-top: 22px; color: var(--muted); font-size: .92em; flex-wrap: wrap; }
.records b { color: var(--text); font-size: 1.25em; display: block; }
.mini-building { width: 100%; max-width: 420px; margin: auto; filter: drop-shadow(0 20px 40px rgba(0,0,0,.5)); }
.disclaimer { color: var(--muted); font-size: .8em; margin-top: 18px; max-width: 34em; }

/* ── Game layout ──────────────────────────────────────────────────────── */
.game { min-height: 100vh; display: grid; grid-template-rows: auto 1fr; grid-template-columns: minmax(0, 1fr); }
.topbar { display: flex; align-items: center; gap: 18px; padding: 12px 22px; background: rgba(12, 12, 24, .7); backdrop-filter: blur(6px); border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 5; flex-wrap: wrap; }
.topbar .brand { font: 400 26px var(--display); color: var(--amber); text-shadow: 2px 2px 0 var(--brick-dark); cursor: pointer; background: none; border: 0; padding: 0; }
.money { display: flex; align-items: center; gap: 10px; background: var(--paper); color: var(--ink); border: 2px solid var(--ink); border-radius: 12px; padding: 4px 14px 4px 6px; box-shadow: 0 3px 0 var(--ink); }
.money .ico { width: 34px; height: 34px; }
.money .label { font-size: .72em; text-transform: uppercase; letter-spacing: .08em; font-weight: 700; opacity: .7; line-height: 1; }
.money .val { font: 400 24px/1 var(--display); }
.money.bump { animation: bump .35s ease; }
@keyframes bump { 40% { transform: scale(1.08); } }
.rent-card { display: flex; align-items: center; gap: 12px; flex: 1; min-width: 280px; max-width: 520px; }
.rent-card .ico { width: 38px; height: 38px; flex: none; }
.rent-card .meta { flex: 1; }
.rent-card .line1 { display: flex; justify-content: space-between; gap: 10px; font-weight: 700; }
.rent-card .line1 .due { color: var(--amber); }
.progress { height: 10px; background: rgba(255,255,255,.08); border-radius: 99px; overflow: hidden; margin-top: 5px; border: 1px solid var(--line); }
.progress > i { display: block; height: 100%; background: linear-gradient(90deg, var(--brick-2), var(--amber)); border-radius: 99px; transition: width .5s ease; }
.progress.ok > i { background: linear-gradient(90deg, var(--teal), var(--mint)); }
.rent-card .line2 { font-size: .85em; color: var(--muted); margin-top: 3px; display: flex; justify-content: space-between; }
.topbar .tools { display: flex; gap: 8px; margin-left: auto; flex-wrap: wrap; }

.board { display: grid; grid-template-columns: 270px minmax(0, 1fr) 320px; gap: 22px; padding: 22px; align-items: start; max-width: 1500px; margin: 0 auto; width: 100%; }
.panel { background: rgba(28, 30, 53, .82); border: 1px solid var(--line); border-radius: var(--r); padding: 14px; box-shadow: var(--shadow); }
.panel h2 { font: 400 15px var(--display); letter-spacing: .04em; margin: 0 0 10px; color: var(--paper); display: flex; justify-content: space-between; align-items: center; }
.panel h2 small { font: 600 12px var(--ui); color: var(--muted); letter-spacing: 0; }
.side { display: grid; gap: 16px; }

/* Rent calendar */
.calendar { list-style: none; margin: 0; padding: 0; display: grid; gap: 4px; }
.calendar li { display: grid; grid-template-columns: 28px 1fr auto; gap: 8px; align-items: center; padding: 5px 8px; border-radius: 8px; font-size: .88em; color: var(--muted); }
.calendar li .n { font: 400 13px var(--display); text-align: center; background: rgba(255,255,255,.07); border-radius: 6px; padding: 2px 0; }
.calendar li.paid { color: #8fb7a3; }
.calendar li.paid .n { background: rgba(79, 179, 169, .25); color: var(--mint); }
.calendar li.current { background: rgba(246, 197, 72, .12); color: var(--text); outline: 1px solid rgba(246, 197, 72, .4); }
.calendar li.current .n { background: var(--amber); color: var(--ink); }
.calendar li.failed { color: var(--rose); }
.calendar .notice { display: block; font-size: .78em; color: var(--amber); }
.calendar .notice.bad { color: #ff9d8a; }
.calendar li.final .n { background: var(--brick); color: #fff; }

.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip { width: 52px; height: 52px; border-radius: 12px; background: var(--paper); border: 2px solid var(--ink); padding: 5px; cursor: help; position: relative; box-shadow: 0 3px 0 var(--ink); }
.chip.usable { cursor: pointer; }
.chip.usable:hover { transform: translateY(-2px); }
.chip.empty-slot { background: transparent; border: 2px dashed var(--line); box-shadow: none; cursor: default; }
.chips .none { color: var(--muted); font-size: .88em; }
.rerolls { font-size: .85em; color: var(--muted); margin-top: 8px; }

/* ── The building (slot machine) ──────────────────────────────────────── */
.stage { display: grid; justify-items: center; gap: 16px; }
.building { position: relative; padding: 0 18px 0; width: max-content; max-width: 100%; }
.roof { position: relative; height: 70px; margin: 0 -10px; }
.roof .cornice { position: absolute; inset: auto 0 0 0; height: 22px; background: #5b2522; border: 3px solid var(--ink); border-radius: 6px; box-shadow: 0 4px 0 rgba(0,0,0,.25); }
.roof .sign { position: absolute; left: 50%; bottom: 20px; transform: translateX(-50%); padding: 6px 22px 4px; background: #1a1528; border: 3px solid var(--ink); border-radius: 10px; font: 400 30px/1 var(--display); color: #ff8ad8; text-shadow: 0 0 6px #ff4fd8, 0 0 18px #ff4fd8; letter-spacing: .08em; white-space: nowrap; }
.roof .sign.flicker { animation: flicker 6s infinite; }
@keyframes flicker { 0%, 92%, 100% { opacity: 1; } 93% { opacity: .4; } 94% { opacity: 1; } 96% { opacity: .55; } }
.roof .tank { position: absolute; right: 12px; bottom: 22px; width: 44px; height: 40px; background: #6b4a33; border: 3px solid var(--ink); border-radius: 6px 6px 0 0; }
.roof .tank::before { content: ''; position: absolute; left: -6px; right: -6px; top: -12px; height: 14px; background: #4b3324; border: 3px solid var(--ink); border-radius: 50% 50% 0 0; }
.roof .antenna { position: absolute; left: 22px; bottom: 22px; width: 3px; height: 46px; background: var(--ink); }
.roof .antenna::after { content: ''; position: absolute; top: 6px; left: -10px; width: 23px; height: 3px; background: var(--ink); }
.facade {
  position: relative; padding: 18px; border: 3px solid var(--ink); border-top: 0;
  background-color: var(--brick);
  background-image:
    linear-gradient(rgba(0,0,0,.18) 2px, transparent 2px),
    linear-gradient(90deg, rgba(0,0,0,.14) 2px, transparent 2px),
    linear-gradient(90deg, rgba(0,0,0,.14) 2px, transparent 2px);
  background-size: 100% 16px, 32px 32px, 32px 32px;
  background-position: 0 0, 0 0, 16px 16px;
  box-shadow: inset 0 0 60px rgba(0,0,0,.35), var(--shadow);
}
.grid { display: grid; grid-template-columns: repeat(5, var(--cell)); grid-auto-rows: var(--cell); gap: 14px 16px; }
.cell {
  position: relative; border-radius: 6px 6px 3px 3px; border: 3px solid var(--ink); background: #20253f; overflow: hidden;
  box-shadow: inset 0 0 0 4px #5c3a28, 0 6px 0 -1px #e6d9bd, 0 6px 0 2px var(--ink);
  cursor: default; padding: 0; transition: background .3s;
}
.cell::after { content: ''; position: absolute; inset: 4px; pointer-events: none; background: linear-gradient(90deg, transparent calc(50% - 1.5px), rgba(92,58,40,.85) calc(50% - 1.5px), rgba(92,58,40,.85) calc(50% + 1.5px), transparent calc(50% + 1.5px)), linear-gradient(transparent calc(50% - 1.5px), rgba(92,58,40,.85) calc(50% - 1.5px), rgba(92,58,40,.85) calc(50% + 1.5px), transparent calc(50% + 1.5px)); opacity: .0; }
.cell.dark::after { opacity: .7; }
.cell.dark { background: linear-gradient(160deg, #262c4a, #171a2e); }
.cell.lit { background: radial-gradient(circle at 50% 40%, #fff3c9 0%, #f8d987 55%, #e9b85a 100%); cursor: help; }
.cell.lit.r-uncommon { background: radial-gradient(circle at 50% 40%, #f2fff5 0%, #c7efcf 55%, #8fd6a6 100%); }
.cell.lit.r-rare { background: radial-gradient(circle at 50% 40%, #f0f8ff 0%, #c4e0fa 55%, #8cbde9 100%); }
.cell.lit.r-legendary { background: radial-gradient(circle at 50% 40%, #fff6e8 0%, #ffd7a1 55%, #f5a85a 100%); }
.cell.lit.landlord { background: radial-gradient(circle at 50% 40%, #ffe5e0 0%, #f5a69a 60%, #d9594a 100%); }
.cell .sym { position: absolute; inset: 10px; }
.cell .val { position: absolute; right: 4px; bottom: 3px; font: 400 14px/1 var(--display); color: var(--ink); background: rgba(255,255,255,.85); border-radius: 6px; padding: 3px 5px 2px; border: 2px solid var(--ink); }
.cell .val.neg { background: #ffd0d0; color: #8b1d1d; }
.cell .val.zero { opacity: .55; }
.cell .val.big { background: var(--amber); }
.cell .tagline-mini { position: absolute; left: 4px; top: 3px; font: 700 10px var(--ui); color: var(--ink); background: rgba(255,255,255,.75); border-radius: 5px; padding: 1px 4px; }
.cell.destroyed .sym { opacity: .35; filter: grayscale(1); }
.cell.destroyed::before { content: ''; position: absolute; inset: 0; z-index: 2; background: linear-gradient(45deg, transparent 46%, rgba(43,33,53,.75) 47%, rgba(43,33,53,.75) 53%, transparent 54%), linear-gradient(-45deg, transparent 46%, rgba(43,33,53,.75) 47%, rgba(43,33,53,.75) 53%, transparent 54%); }
.cell.disabled .sym { filter: grayscale(1) brightness(.8); opacity: .6; }
.cell.disabled::before { content: 'zz'; position: absolute; left: 6px; top: 2px; font: 400 14px var(--display); color: var(--ink); z-index: 2; }
.cell.src-hl { box-shadow: inset 0 0 0 4px var(--teal), 0 0 0 3px var(--teal), 0 6px 0 2px var(--ink); }
.cell.tgt-hl { box-shadow: inset 0 0 0 4px var(--amber-2), 0 0 0 3px var(--amber), 0 6px 0 2px var(--ink); }
.cell.pulse { animation: pulse .32s ease; }
@keyframes pulse { 40% { transform: scale(1.1); } }
.reel { position: absolute; left: 0; right: 0; top: 0; will-change: transform; }
.reel > div { height: calc(var(--cell) - 6px); padding: 10px; }
.cell.spinning { background: radial-gradient(circle at 50% 40%, #fff3c9 0%, #f8d987 70%, #e9b85a 100%); }
.cell.spinning .reel { filter: blur(1.2px); }
.floater { position: absolute; z-index: 20; pointer-events: none; font: 400 22px var(--display); color: var(--amber); text-shadow: 2px 2px 0 var(--ink), -1px -1px 0 var(--ink); animation: floatup .9s ease-out forwards; white-space: nowrap; }
.floater.neg { color: var(--rose); }
.floater.small { font-size: 15px; color: var(--paper); }
@keyframes floatup { from { transform: translate(-50%, 0) scale(.8); opacity: 0; } 15% { opacity: 1; transform: translate(-50%, -8px) scale(1.1); } to { transform: translate(-50%, -48px) scale(1); opacity: 0; } }

.door-row { display: flex; align-items: flex-end; justify-content: center; gap: 22px; margin-top: 22px; }
.stoop { height: 14px; margin: 0 -24px; background: #8a8fa0; border: 3px solid var(--ink); border-radius: 4px; }
.spin-btn {
  appearance: none; cursor: pointer; border: 3px solid var(--ink); border-radius: 18px 18px 8px 8px; padding: 16px 40px 12px;
  background: linear-gradient(#ffd45e, #e9a62b); color: var(--ink); font: 400 30px/1 var(--display); letter-spacing: .05em;
  box-shadow: 0 7px 0 var(--ink), inset 0 -6px 0 rgba(0,0,0,.12); transition: transform .08s, box-shadow .08s;
  min-width: 230px;
}
.spin-btn small { display: block; font: 700 12px var(--ui); letter-spacing: .06em; margin-top: 4px; opacity: .8; }
.spin-btn:hover:not(:disabled) { filter: brightness(1.06); }
.spin-btn:active:not(:disabled) { transform: translateY(5px); box-shadow: 0 2px 0 var(--ink); }
.spin-btn:disabled { filter: grayscale(.7); opacity: .6; cursor: not-allowed; }
.spin-btn.pay { background: linear-gradient(#ff8a72, var(--brick)); color: #fff; }
.spin-btn.shop { background: linear-gradient(#8fe0d6, var(--teal)); }
.pips { display: flex; gap: 6px; justify-content: center; margin-top: 10px; }
.pips i { width: 14px; height: 14px; border-radius: 50%; border: 2px solid var(--ink); background: var(--amber); }
.pips i.used { background: #3a3d5c; }
.pips i.extra { background: var(--mint); }
.spin-total { font: 400 22px var(--display); color: var(--amber); min-height: 30px; text-align: center; text-shadow: 2px 2px 0 var(--brick-dark); }
.spin-total.neg { color: var(--rose); }
.spin-total small { display: block; font: 600 13px var(--ui); color: var(--muted); text-shadow: none; }
.hint { color: var(--muted); font-size: .85em; text-align: center; }
.garage-note { position: absolute; right: -2px; bottom: -30px; font-size: .78em; color: var(--muted); }

/* ── Receipt ──────────────────────────────────────────────────────────── */
.receipt { background: var(--paper); color: var(--ink); font-family: var(--mono); padding: 16px 16px 22px; border-radius: 4px 4px 0 0; position: relative; box-shadow: var(--shadow); max-height: calc(100vh - 140px); overflow: auto; }
.receipt::after { content: ''; position: sticky; display: block; bottom: -22px; height: 12px; margin: 10px -16px -22px; background: linear-gradient(-45deg, var(--night) 6px, transparent 0) 0 0 / 12px 12px, linear-gradient(45deg, var(--night) 6px, transparent 0) 0 0 / 12px 12px; }
.receipt h2 { font: 700 15px var(--mono); text-align: center; letter-spacing: .2em; margin: 0; }
.receipt .sub { text-align: center; font-size: .78em; opacity: .7; margin-bottom: 8px; }
.receipt hr { border: 0; border-top: 2px dashed rgba(43,33,53,.35); margin: 8px 0; }
.receipt .row { display: grid; grid-template-columns: 26px 1fr auto; gap: 8px; align-items: start; padding: 3px 0; font-size: .86em; cursor: default; border-radius: 4px; }
.receipt .row:hover { background: rgba(43,33,53,.07); }
.receipt .row .ico { width: 24px; height: 24px; }
.receipt .row .why { display: block; font-size: .85em; opacity: .72; }
.receipt .row .amt { font-weight: 700; }
.receipt .row .amt.neg { color: #a12222; }
.receipt .row.event { grid-template-columns: 26px 1fr; opacity: .85; }
.receipt .total { display: flex; justify-content: space-between; font-weight: 700; font-size: 1.15em; }
.receipt .empty { text-align: center; opacity: .6; padding: 20px 0; font-size: .9em; }

/* ── Modals ───────────────────────────────────────────────────────────── */
.modal-wrap { position: fixed; inset: 0; z-index: 50; display: grid; place-items: center; padding: 20px 16px; background: rgba(8, 8, 18, .66); backdrop-filter: blur(3px); animation: fadein .18s ease; overflow-y: auto; }
@keyframes fadein { from { opacity: 0; } }
.modal { width: min(720px, 100%); background: var(--night-2); border: 2px solid var(--ink); outline: 1px solid var(--line); border-radius: 18px; box-shadow: 0 30px 80px rgba(0,0,0,.6); padding: 22px; position: relative; animation: popin .22s ease; max-height: calc(100vh - 40px); overflow: auto; }
.modal.wide { width: min(1100px, 100%); }
.modal.paper { background: var(--paper); color: var(--ink); }
@keyframes popin { from { transform: translateY(12px) scale(.98); opacity: 0; } }
.modal h1 { font: 400 26px/1.1 var(--display); margin: 0 0 6px; color: var(--amber); text-shadow: 2px 2px 0 var(--brick-dark); }
.modal.paper h1 { color: var(--brick); text-shadow: none; }
.modal .lead { color: var(--muted); margin: 0 0 16px; }
.modal.paper .lead { color: #5d5468; }
.modal .close { position: absolute; top: 12px; right: 12px; }
.modal .actions { display: flex; gap: 10px; justify-content: flex-end; margin-top: 18px; flex-wrap: wrap; align-items: center; }
.modal .actions .spacer { flex: 1; }
body.no-anim *, body.no-anim *::before, body.no-anim *::after { animation-duration: 0s !important; transition-duration: 0s !important; }

/* Cards (delivery, shop, collection) */
.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 14px; }
.card { appearance: none; text-align: left; background: var(--paper); color: var(--ink); border: 3px solid var(--ink); border-radius: 14px; padding: 12px; display: grid; grid-template-rows: auto auto 1fr auto; gap: 6px; box-shadow: 0 5px 0 var(--ink); cursor: pointer; transition: transform .1s; position: relative; }
.card:hover:not(:disabled) { transform: translateY(-3px); }
.card:disabled { cursor: not-allowed; }
.card.sold { opacity: .45; }
.card.sold::after { content: 'SOLD'; position: absolute; top: 40%; left: 50%; transform: translate(-50%, -50%) rotate(-12deg); font: 400 28px var(--display); color: var(--brick); border: 3px solid var(--brick); padding: 0 10px; border-radius: 8px; background: rgba(243,234,216,.9); }
.card .art { width: 72px; height: 72px; margin: 2px auto 0; border-radius: 12px; background: radial-gradient(circle at 50% 40%, #fff3c9, #f2d38a); border: 2px solid var(--ink); padding: 6px; }
.card .art.r-uncommon { background: radial-gradient(circle at 50% 40%, #f2fff5, #a9e3bb); }
.card .art.r-rare { background: radial-gradient(circle at 50% 40%, #f0f8ff, #a9cff3); }
.card .art.r-legendary { background: radial-gradient(circle at 50% 40%, #fff6e8, #ffc480); }
.card .art.relic { background: radial-gradient(circle at 50% 40%, #fbf1ff, #d8c2f5); }
.card .art.item { background: radial-gradient(circle at 50% 40%, #f2fbff, #bfe3ea); }
.card .name { font-weight: 800; font-size: 1.02em; text-align: center; line-height: 1.15; }
.card .meta { display: flex; justify-content: center; gap: 6px; flex-wrap: wrap; }
.card .desc { font-size: .86em; line-height: 1.35; color: #4a3f55; }
.card .foot { display: flex; justify-content: space-between; align-items: center; gap: 8px; font-size: .85em; }
.card .price { font: 400 18px var(--display); color: var(--ink); }
.card .price.cant { color: var(--brick); }
.card .base { font-weight: 700; }
.rar { font: 700 10px var(--ui); letter-spacing: .08em; text-transform: uppercase; padding: 2px 7px; border-radius: 99px; border: 1.5px solid var(--ink); background: var(--common); color: var(--ink); }
.rar.uncommon { background: var(--uncommon); }
.rar.rare { background: var(--rare); }
.rar.legendary { background: var(--legendary); }
.rar.relic { background: #c8a8f0; }
.rar.item { background: #9fd8e2; }
.tag { font: 600 10px var(--ui); padding: 2px 6px; border-radius: 99px; background: rgba(43,33,53,.1); color: #4a3f55; }
.owned { font-size: .8em; color: #6b5e78; }

/* Shop */
.shop { padding: 22px; max-width: 1300px; margin: 0 auto; }
.shop-head { display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-bottom: 14px; }
.shop-head h1 { font: 400 34px var(--display); color: var(--amber); margin: 0; text-shadow: 3px 3px 0 var(--brick-dark); }
.shop-head p { margin: 2px 0 0; color: var(--muted); }
.shop-section { margin-bottom: 22px; }
.shop-section h2 { font: 400 16px var(--display); color: var(--paper); margin: 0 0 10px; letter-spacing: .04em; display: flex; gap: 10px; align-items: baseline; }
.shop-section h2 small { font: 500 13px var(--ui); color: var(--muted); letter-spacing: 0; }
.shop-cols { display: grid; grid-template-columns: 2fr 1fr; gap: 22px; }
.service-row { display: flex; gap: 14px; flex-wrap: wrap; }
.service-row .card { width: 230px; }
.discount-badge { background: var(--mint); color: var(--ink); border: 2px solid var(--ink); border-radius: 99px; padding: 2px 10px; font-weight: 800; font-size: .85em; }

/* Picker (choose a symbol from your collection) */
.picker { display: grid; grid-template-columns: repeat(auto-fill, minmax(82px, 1fr)); gap: 10px; }
.pick { appearance: none; background: var(--paper); border: 2px solid var(--ink); border-radius: 12px; padding: 6px; cursor: pointer; color: var(--ink); display: grid; gap: 2px; justify-items: center; font-size: .75em; font-weight: 700; box-shadow: 0 3px 0 var(--ink); position: relative; }
.pick .ico { width: 48px; height: 48px; }
.pick:hover { transform: translateY(-2px); }
.pick .badges { position: absolute; top: 3px; right: 4px; display: flex; gap: 2px; font-size: .9em; }
.pick:disabled { opacity: .4; cursor: not-allowed; }

/* Collection / almanac */
.tabs { display: flex; gap: 6px; margin-bottom: 14px; flex-wrap: wrap; }
.tabs button { appearance: none; border: 1px solid var(--line); background: rgba(255,255,255,.05); color: var(--text); padding: .45em .9em; border-radius: 99px; cursor: pointer; font-weight: 600; }
.tabs button.on { background: var(--amber); color: var(--ink); border-color: var(--ink); }
.coll-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 10px; }
.coll-item { display: grid; grid-template-columns: 54px 1fr; gap: 10px; align-items: start; background: rgba(255,255,255,.04); border: 1px solid var(--line); border-radius: 12px; padding: 10px; }
.coll-item .art { width: 54px; height: 54px; border-radius: 10px; background: var(--paper); border: 2px solid var(--ink); padding: 4px; position: relative; }
.coll-item .art .n { position: absolute; right: -8px; bottom: -8px; background: var(--amber); color: var(--ink); border: 2px solid var(--ink); border-radius: 99px; font: 400 12px var(--display); padding: 1px 6px; }
.coll-item h3 { margin: 0; font-size: 1em; display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.coll-item p { margin: 3px 0 0; font-size: .84em; color: #cfc9dc; }
.coll-item .trig { font-size: .78em; color: var(--muted); }
.coll-item.unseen { opacity: .5; }
.coll-item .upg { font-size: .76em; color: var(--mint); }
.coll-item .tag { background: rgba(255,255,255,.1); color: var(--muted); }

/* History / settings */
.stats-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); gap: 10px; margin-bottom: 16px; }
.stat { background: rgba(255,255,255,.05); border: 1px solid var(--line); border-radius: 12px; padding: 10px 12px; }
.stat b { display: block; font: 400 22px var(--display); color: var(--amber); }
.stat span { font-size: .82em; color: var(--muted); }
table.hist { width: 100%; border-collapse: collapse; font-size: .9em; }
table.hist th, table.hist td { text-align: left; padding: 7px 8px; border-bottom: 1px solid var(--line); }
table.hist th { color: var(--muted); font-weight: 600; font-size: .85em; }
.won-tag { color: var(--mint); font-weight: 800; }
.lost-tag { color: var(--rose); font-weight: 800; }
.setting { display: grid; grid-template-columns: 1fr auto; gap: 12px; align-items: center; padding: 12px 0; border-bottom: 1px solid var(--line); }
.setting p { margin: 2px 0 0; color: var(--muted); font-size: .85em; }
.setting select, .setting input[type=range] { font: inherit; }
.setting select { background: var(--night-3); color: var(--text); border: 1px solid var(--line); border-radius: 8px; padding: .35em .5em; }
.switch { appearance: none; width: 48px; height: 28px; border-radius: 99px; background: #3a3d5c; border: 2px solid var(--ink); position: relative; cursor: pointer; transition: background .15s; }
.switch::after { content: ''; position: absolute; top: 2px; left: 2px; width: 20px; height: 20px; border-radius: 50%; background: var(--paper); transition: transform .15s; }
.switch:checked { background: var(--teal); }
.switch:checked::after { transform: translateX(20px); }
.field { display: grid; gap: 6px; margin: 12px 0; }
.field input { font: 600 18px var(--mono); padding: .5em .7em; border-radius: 10px; border: 2px solid var(--ink); background: var(--paper); color: var(--ink); text-transform: uppercase; }
.help h3 { color: var(--amber); font: 400 15px var(--display); margin: 18px 0 6px; letter-spacing: .03em; }
.help p, .help li { color: #d8d2e4; font-size: .94em; }
.help ol, .help ul { padding-left: 1.3em; margin: 6px 0; }
.help .order { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; margin: 8px 0; }
.help .order div { background: rgba(255,255,255,.05); border: 1px solid var(--line); border-radius: 10px; padding: 8px; font-size: .85em; }
.help .order b { display: block; color: var(--amber); }

/* Delivery */
.delivery .cards { grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); }
.delivery .card .key { position: absolute; top: 8px; left: 10px; font: 400 13px var(--display); opacity: .5; }

/* Rent day / end screens */
.rent-sheet { font-family: var(--mono); }
.rent-sheet .line { display: flex; justify-content: space-between; padding: 6px 0; border-bottom: 1px dashed rgba(43,33,53,.3); }
.rent-sheet .line.big { font-weight: 700; font-size: 1.2em; border-bottom: 0; }
.rent-sheet .stamp { display: inline-block; font: 400 30px var(--display); padding: 4px 14px; border: 4px solid; border-radius: 10px; transform: rotate(-8deg); margin: 12px auto 0; }
.rent-sheet .stamp.paid { color: #2f8f6a; }
.rent-sheet .stamp.late { color: var(--brick); }
.end-screen { min-height: 100vh; display: grid; place-items: center; padding: 30px 16px; }
.end-card { width: min(760px, 100%); background: var(--night-2); border: 2px solid var(--ink); border-radius: 22px; padding: 30px; box-shadow: 0 30px 80px rgba(0,0,0,.6); text-align: center; }
.end-card h1 { font: 400 clamp(36px, 6vw, 60px)/1 var(--display); margin: 0 0 8px; }
.end-card.win h1 { color: var(--amber); text-shadow: 4px 4px 0 var(--brick-dark); }
.end-card.lose h1 { color: var(--rose); text-shadow: 4px 4px 0 #4a1520; }
.end-card .ico.hero { width: 120px; height: 120px; margin: 0 auto 10px; }
.end-card .stats-row { margin: 22px 0; text-align: left; grid-template-columns: repeat(3, 1fr); }
.end-card .actions { display: flex; gap: 12px; justify-content: center; flex-wrap: wrap; }
.ledger-mini { display: flex; gap: 4px; justify-content: center; flex-wrap: wrap; margin: 6px 0 12px; }
.ledger-mini i { width: 22px; height: 22px; border-radius: 6px; border: 2px solid var(--ink); background: #3a3d5c; font: 400 11px/18px var(--display); font-style: normal; color: var(--paper); }
.ledger-mini i.paid { background: var(--teal); }
.ledger-mini i.failed { background: var(--brick); }
.confetti { position: fixed; top: -20px; width: 10px; height: 14px; z-index: 60; pointer-events: none; animation: confetti 3s linear forwards; }
@keyframes confetti { to { transform: translate3d(var(--dx), 110vh, 0) rotate(720deg); } }

/* Tooltip and toasts */
#tooltip { position: fixed; z-index: 80; max-width: 300px; background: var(--paper); color: var(--ink); border: 2px solid var(--ink); border-radius: 10px; padding: 10px 12px; font-size: .86em; box-shadow: 0 10px 24px rgba(0,0,0,.45); pointer-events: none; }
#tooltip h4 { margin: 0 0 4px; font-size: 1.05em; display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
#tooltip p { margin: 3px 0; }
#tooltip .calc { font-family: var(--mono); font-size: .92em; background: rgba(43,33,53,.07); padding: 5px 7px; border-radius: 6px; margin-top: 6px; }
#tooltip .notes { color: #6b5e78; font-style: italic; }
#toasts { position: fixed; z-index: 90; bottom: 18px; left: 50%; transform: translateX(-50%); display: grid; gap: 8px; justify-items: center; pointer-events: none; }
.toast { background: var(--paper); color: var(--ink); border: 2px solid var(--ink); border-radius: 12px; padding: 8px 14px; font-weight: 700; box-shadow: 0 6px 18px rgba(0,0,0,.4); animation: toast 2.6s ease forwards; }
.toast.bad { background: #ffd6d0; }
.toast.good { background: #d2f5df; }
@keyframes toast { 0% { opacity: 0; transform: translateY(10px); } 10%, 85% { opacity: 1; transform: none; } 100% { opacity: 0; } }

/* ── Responsive ───────────────────────────────────────────────────────── */
@media (max-width: 1280px) {
  :root { --cell: 86px; }
  .board { grid-template-columns: 240px minmax(0, 1fr) 280px; gap: 16px; padding: 16px; }
}
@media (max-width: 1080px) {
  .board { grid-template-columns: minmax(0, 1fr) 300px; }
  .board > .side.left { grid-column: 1 / -1; grid-row: 2; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); }
  .shop-cols { grid-template-columns: 1fr; }
}
@media (max-width: 820px) {
  :root { --cell: min(15vw, 80px); }
  .topbar .tools { margin-left: 0; width: 100%; flex-wrap: nowrap; overflow-x: auto; }
  .topbar .tools .icon-btn { flex: none; }
  .board { grid-template-columns: 1fr; }
  .grid { gap: 10px 8px; }
  .facade { padding: 12px; }
  .title-card { grid-template-columns: 1fr; text-align: center; }
  .title-menu { margin: 0 auto; }
  .records { justify-content: center; }
  .roof .sign { font-size: 22px; }
  .topbar { padding: 10px 14px; gap: 10px; }
  .rent-card { min-width: 100%; order: 3; }
  .help .order { grid-template-columns: 1fr 1fr; }
  .receipt { max-height: none; }
}
@media (max-width: 480px) {
  .building { padding: 0 6px; }
  .grid { gap: 8px 6px; }
  .cell .val { font-size: 11px; padding: 2px 3px 1px; }
  .spin-btn { min-width: 0; width: 100%; }
}
@media (prefers-reduced-motion: reduce) {
  #rain { display: none; }
}
