/* Going Twice - 16-bit style with crisp modern text */
:root {
  --ink: #160f2a;
  --night: #120d29;
  --night2: #1c1540;
  --panel: #241c4f;
  --panel2: #2e2563;
  --line: #3e3480;
  --text: #f1edff;
  --muted: #a99fd6;
  --gold: #ffcf4a;
  --gold2: #f2a93b;
  --pink: #ff6fae;
  --mint: #5ce1b0;
  --red: #ff5c6c;
  --blue: #58a6ff;
  --purple: #9b6bff;
  --orange: #ff9f43;
  --radius: 0;
  color-scheme: dark;
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  background-color: var(--night);
  background-image:
    radial-gradient(1px 1px at 20px 30px, #ffffff55 50%, transparent 51%),
    radial-gradient(1px 1px at 120px 80px, #ffffff33 50%, transparent 51%),
    radial-gradient(1px 1px at 200px 20px, #ffffff44 50%, transparent 51%),
    radial-gradient(1px 1px at 260px 140px, #ffffff22 50%, transparent 51%),
    linear-gradient(180deg, #120d29 0%, #1a1340 60%, #22184d 100%);
  background-size: 300px 180px, 300px 180px, 300px 180px, 300px 180px, 100% 100%;
  background-attachment: fixed;
  color: var(--text);
  font: 15px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  min-height: 100vh;
  display: flex; flex-direction: column;
}
main.wrap { flex: 1 0 auto; width: 100%; }
img.px, canvas { image-rendering: pixelated; image-rendering: crisp-edges; }
a { color: var(--gold); }
h1, h2, h3 { margin: 0; line-height: 1.2; }
h1 canvas, h2 canvas, .ptitle canvas { display: block; max-width: 100%; height: auto; }
.wrap { max-width: 1180px; margin: 0 auto; padding: 18px 16px 40px; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.row { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }
.spread { justify-content: space-between; }
.grid { display: grid; gap: 14px; }
.g2 { grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); }
.g3 { grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); }
.g4 { grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); }
.stack > * + * { margin-top: 14px; }

/* Panels: chunky pixel frame */
.panel {
  background: var(--panel);
  border: 3px solid var(--ink);
  box-shadow: inset 0 0 0 2px var(--line), inset 0 3px 0 2px #ffffff14, 0 5px 0 var(--ink);
  padding: 16px;
  position: relative;
}
.panel.alt { background: var(--panel2); }
.panel h2, .panel h3 { font-size: 16px; letter-spacing: .02em; }
.ptitle { margin-bottom: 10px; }
.kicker { font-size: 12px; text-transform: uppercase; letter-spacing: .12em; color: var(--muted); font-weight: 700; }

/* Buttons */
.btn {
  appearance: none; cursor: pointer; font: 700 15px/1 system-ui, -apple-system, "Segoe UI", sans-serif;
  color: #2a1700; background: var(--gold);
  border: 3px solid var(--ink); padding: 11px 16px;
  box-shadow: inset -3px -3px 0 #0000003a, inset 3px 3px 0 #ffffff66, 0 4px 0 var(--ink);
  transition: transform .05s; display: inline-flex; align-items: center; gap: 8px; text-decoration: none;
  touch-action: manipulation; user-select: none;
}
.btn:hover { filter: brightness(1.08); }
.btn:active { transform: translateY(3px); box-shadow: inset -3px -3px 0 #0000003a, inset 3px 3px 0 #ffffff66, 0 1px 0 var(--ink); }
.btn:focus-visible, a:focus-visible, button:focus-visible, input:focus-visible, select:focus-visible { outline: 3px solid var(--pink); outline-offset: 2px; }
.btn[disabled] { filter: grayscale(.9) brightness(.7); cursor: not-allowed; transform: none; }
.btn.mint { background: var(--mint); color: #062a1d; }
.btn.red { background: var(--red); color: #2a0008; }
.btn.blue { background: var(--blue); color: #021a33; }
.btn.purple { background: var(--purple); color: #fff; }
.btn.pink { background: var(--pink); color: #2a0016; }
.btn.ghost { background: var(--panel2); color: var(--text); }
.btn.big { font-size: 20px; padding: 16px 22px; }
.btn.sm { font-size: 13px; padding: 7px 10px; border-width: 2px; box-shadow: inset -2px -2px 0 #0000003a, inset 2px 2px 0 #ffffff55, 0 3px 0 var(--ink); }
.btn.block { width: 100%; justify-content: center; }
input[type=number], input[type=text], select {
  font: 600 15px system-ui, sans-serif; background: #120d29; color: var(--text);
  border: 3px solid var(--ink); box-shadow: inset 0 0 0 2px var(--line); padding: 9px 10px;
}
input[type=range] { accent-color: var(--gold); }

/* Header / HUD */
.hud {
  display: flex; align-items: center; gap: 14px; flex-wrap: wrap;
  padding: 10px 16px; background: #0e0a22; border-bottom: 3px solid var(--ink);
  box-shadow: 0 3px 0 var(--line); position: sticky; top: 0; z-index: 20;
}
.brand canvas { display: block; height: 22px; width: auto; }
.hud nav { display: flex; gap: 2px; flex-wrap: wrap; flex: 1; }
.hud nav a {
  color: var(--muted); text-decoration: none; font-weight: 700; font-size: 14px; padding: 6px 9px; position: relative;
}
.hud nav a:hover { color: var(--text); background: #ffffff10; }
.hud nav a[aria-current=page] { color: var(--ink); background: var(--gold); box-shadow: inset -2px -2px 0 #0003; }
.dot { position: absolute; top: 3px; right: 2px; width: 7px; height: 7px; background: var(--pink); box-shadow: 0 0 0 2px var(--ink); animation: blink 1s steps(2) infinite; }
@keyframes blink { 50% { opacity: .2; } }
.wallet { display: flex; gap: 6px; flex-wrap: wrap; }
.chip {
  display: inline-flex; align-items: center; gap: 6px; background: var(--panel); border: 2px solid var(--ink);
  box-shadow: inset 0 0 0 2px var(--line); padding: 4px 8px; font-size: 14px; white-space: nowrap;
}
.chip img { width: 16px; height: auto; }
.chip.pop { animation: pop .35s steps(3); }
@keyframes pop { 40% { transform: scale(1.15); background: #3c2f12; } }
.chip.meter { flex-direction: column; align-items: stretch; gap: 2px; padding: 3px 8px; }
.chip .lbl { font-size: 12px; line-height: 1.1; }
.bar { display: block; height: 6px; background: #0b0820; box-shadow: inset 0 0 0 1px var(--ink); min-width: 56px; }
.bar i { display: block; height: 100%; background: var(--mint); }
.bar i.blue { background: var(--blue); }
.bar i.gold { background: var(--gold); }
.bar i.pink { background: var(--pink); }
.bigbar { height: 18px; position: relative; }
.bigbar span { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; font-size: 12px; font-weight: 800; color: #fff; text-shadow: 1px 1px 0 var(--ink); }

.foot { display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap; padding: 14px 16px; color: var(--muted); font-size: 13px; border-top: 3px solid var(--ink); background: #0e0a22; }
.powered { display: inline-flex; gap: 6px; align-items: center; }
.powered img { width: 18px; }
.powered b { color: var(--gold); }

/* Tags */
.tag { display: inline-block; font-size: 11px; font-weight: 800; text-transform: uppercase; letter-spacing: .06em; padding: 2px 6px; color: var(--ink); background: var(--c, var(--muted)); border: 2px solid var(--ink); }
.tag.plain { background: var(--panel2); color: var(--text); }
.trend { font-size: 12px; font-weight: 800; }
.trend.up { color: var(--mint); }
.trend.down { color: var(--red); }
.trend.flat { color: var(--muted); }
.itile { display: inline-flex; align-items: center; justify-content: center; width: 64px; height: 64px; background: #120d29; border: 3px solid var(--ink); box-shadow: inset 0 0 0 2px var(--c, var(--line)); flex: none; }
.itile img { max-width: 54px; max-height: 54px; }
.itile.r-u { --c: #2f9e6e; } .itile.r-r { --c: #2a6fb0; } .itile.r-e { --c: #7b3fbf; } .itile.r-l { --c: #c9961e; animation: shine 1.4s steps(4) infinite; }
@keyframes shine { 50% { box-shadow: inset 0 0 0 2px #ffe066, 0 0 12px #ffcf4a88; } }
.money { color: var(--gold); font-weight: 800; }
.good { color: var(--mint); font-weight: 800; }
.bad { color: var(--red); font-weight: 800; }

/* Toasts */
#toasts { position: fixed; right: 16px; bottom: 16px; z-index: 60; display: flex; flex-direction: column; gap: 8px; max-width: min(360px, calc(100vw - 32px)); }
.toast { display: flex; gap: 10px; align-items: center; background: var(--panel2); border: 3px solid var(--ink); box-shadow: inset 0 0 0 2px var(--gold), 0 4px 0 var(--ink); padding: 10px 12px; animation: tin .25s steps(3); }
.toast b { display: block; }
.toast span { font-size: 13px; color: var(--muted); }
.toast.out { opacity: 0; transform: translateX(20px); transition: all .4s; }
@keyframes tin { from { transform: translateX(30px); opacity: 0; } }

/* Modal */
.modal-bg { position: fixed; inset: 0; background: #08051acc; z-index: 50; display: flex; align-items: center; justify-content: center; padding: 16px; }
.modal { max-width: 560px; width: 100%; max-height: 90vh; overflow: auto; animation: tin .2s steps(3); }
.mbtns { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 16px; }

/* Lists */
.list { list-style: none; margin: 0; padding: 0; }
.list li { padding: 8px 0; border-bottom: 2px dashed #ffffff14; }
.list li:last-child { border-bottom: 0; }
table.tbl { width: 100%; border-collapse: collapse; font-size: 14px; }
.tbl th { text-align: left; font-size: 12px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); padding: 6px 8px; border-bottom: 3px solid var(--ink); }
.tbl td { padding: 7px 8px; border-bottom: 2px solid #ffffff10; }
.tbl tr.me td { background: #ffcf4a1f; font-weight: 800; }
.num { text-align: right; font-variant-numeric: tabular-nums; }

/* Title screen */
.title-hero { text-align: center; padding: 20px 0 10px; }
.title-hero .logo canvas { width: min(100%, 660px); height: auto; margin: 0 auto; display: block; animation: bob 2.4s steps(4) infinite; }
@keyframes bob { 50% { transform: translateY(-4px); } }
.boot { max-width: 520px; margin: 18px auto; }
.boot .bar { height: 20px; }
.boot-line { display: flex; justify-content: space-between; font-size: 13px; color: var(--muted); margin-top: 6px; font-variant-numeric: tabular-nums; }
.hero-town { width: 100%; height: auto; display: block; border: 3px solid var(--ink); box-shadow: 0 5px 0 var(--ink); background: #2b5f8a; }
[hidden] { display: none !important; }

/* Map */
.townwrap { position: relative; border: 3px solid var(--ink); box-shadow: inset 0 0 0 2px var(--line), 0 5px 0 var(--ink); background: #2b5f8a; overflow: hidden; }
.townwrap canvas { display: block; width: 100%; height: auto; cursor: pointer; }
.tip { position: absolute; pointer-events: none; background: var(--panel2); border: 3px solid var(--ink); box-shadow: inset 0 0 0 2px var(--gold), 0 4px 0 var(--ink); padding: 8px 10px; font-size: 13px; min-width: 170px; transform: translate(-50%, -110%); display: none; z-index: 5; }
.tip b { display: block; font-size: 14px; }
.house-card { display: flex; gap: 12px; align-items: flex-start; }
.house-card .swatch { width: 14px; align-self: stretch; background: var(--c); border: 2px solid var(--ink); flex: none; }
.house-card.locked { opacity: .65; }
.trendbar { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.inbox li { font-size: 14px; }
.inbox .d { color: var(--muted); font-size: 12px; margin-right: 6px; }

/* Lobby */
.lot { display: flex; gap: 12px; align-items: center; }
.lot + .lot { border-top: 2px dashed #ffffff14; padding-top: 12px; margin-top: 12px; }
.lot .meta { flex: 1; min-width: 0; }
.lot .meta b { display: block; }
.bidcard { display: flex; gap: 10px; align-items: center; background: #ffffff08; padding: 10px; border: 2px solid var(--ink); }
.bidcard .portrait { width: 56px; height: 82px; display: flex; align-items: flex-end; justify-content: center; background: linear-gradient(#2e2563, #1c1540); border: 2px solid var(--ink); flex: none; }
.bidcard .portrait img { width: 42px; }
.diff { height: 22px; }
.diff i { transition: width .5s steps(6); }

/* Auction */
.floor { display: grid; grid-template-columns: minmax(0, 1.55fr) minmax(300px, 1fr); gap: 14px; align-items: start; }
@media (max-width: 900px) {
  .floor { grid-template-columns: 1fr; }
  .lstack, .rstack { display: contents; }
  #stage { order: 1; } #lotpanel { order: 2; } .logpanel { order: 3; } .qpanel { order: 4; }
}
.stage { position: relative; border: 3px solid var(--ink); box-shadow: inset 0 0 0 2px var(--line), 0 5px 0 var(--ink); background: #2a1b3d; overflow: hidden; }
.stage canvas { display: block; width: 100%; height: auto; }
.stage.shake { animation: shake .4s steps(6); }
@keyframes shake { 20% { transform: translate(-4px, 2px); } 40% { transform: translate(4px, -2px); } 60% { transform: translate(-3px, -1px); } 80% { transform: translate(2px, 2px); } }
.bubble { position: absolute; transform: translate(-50%, -100%); background: #fff; color: var(--ink); font-weight: 900; font-size: 13px; padding: 3px 7px; border: 2px solid var(--ink); white-space: nowrap; pointer-events: none; animation: bub .2s steps(2); z-index: 3; }
.bubble.you { background: var(--gold); }
.bubble.call { background: var(--pink); color: #fff; font-size: 14px; }
.bubble::after { content: ''; position: absolute; left: 50%; bottom: -7px; margin-left: -4px; border: 4px solid transparent; border-top-color: var(--ink); }
@keyframes bub { from { transform: translate(-50%, -80%) scale(.7); } }
.banner { position: absolute; left: 50%; top: 46%; transform: translate(-50%, -50%); text-align: center; pointer-events: none; z-index: 4; }
.banner canvas { display: block; margin: 0 auto; max-width: 90vw; height: auto; }
.banner .sub { margin-top: 6px; background: var(--ink); display: inline-block; padding: 4px 10px; font-weight: 800; }
.lotcard { display: flex; gap: 12px; align-items: center; }
.lotcard .itile { width: 84px; height: 84px; }
.lotcard .itile img { max-width: 72px; max-height: 72px; }
.price { font-variant-numeric: tabular-nums; }
.curbid canvas { display: block; height: 42px; width: auto; }
.timer { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 3px; }
.timer div { height: 12px; background: #0b0820; box-shadow: inset 0 0 0 2px var(--ink); position: relative; }
.timer div i { position: absolute; inset: 2px auto 2px 2px; background: var(--mint); }
.phase { display: flex; justify-content: space-between; font-size: 11px; font-weight: 800; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); margin-top: 3px; }
.phase .on { color: var(--gold); }
.controls { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.controls .full { grid-column: 1 / -1; }
.maxrow { display: flex; gap: 8px; }
.maxrow input { flex: 1; min-width: 0; }
.log { max-height: 210px; overflow: auto; font-size: 13px; }
.log li { padding: 3px 0; border-bottom: 1px solid #ffffff10; }
.log .you { color: var(--gold); font-weight: 800; }
.log .call { color: var(--pink); font-weight: 800; }
.log .sold { color: var(--mint); font-weight: 800; }
.queue { display: flex; gap: 6px; flex-wrap: wrap; }
.queue .q { width: 40px; height: 40px; display: flex; align-items: center; justify-content: center; background: #120d29; border: 2px solid var(--ink); position: relative; }
.queue .q img { max-width: 30px; max-height: 30px; }
.queue .q.cur { box-shadow: 0 0 0 2px var(--gold); }
.queue .q.done { opacity: .35; }
.queue .q .mk { position: absolute; right: -4px; top: -6px; font-size: 10px; font-weight: 900; background: var(--mint); color: var(--ink); padding: 0 3px; border: 2px solid var(--ink); }
.youhigh { color: var(--mint); font-weight: 900; }
.mine { background: #ff6fae22; border: 2px dashed var(--pink); padding: 6px 10px; font-weight: 700; }

/* Inventory */
.tabs { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 12px; }
.tabs button { background: var(--panel); color: var(--muted); border: 3px solid var(--ink); padding: 8px 12px; font-weight: 800; cursor: pointer; font-size: 14px; }
.tabs button[aria-selected=true] { background: var(--gold); color: var(--ink); }
.icard { display: flex; flex-direction: column; gap: 8px; }
.icard .top { display: flex; gap: 10px; align-items: center; }
.icard .acts { display: flex; gap: 6px; flex-wrap: wrap; }
.kv { display: grid; grid-template-columns: auto auto; gap: 2px 12px; font-size: 13px; }
.kv span:nth-child(odd) { color: var(--muted); }
.kv span:nth-child(even) { text-align: right; font-weight: 700; font-variant-numeric: tabular-nums; }
.empty { text-align: center; padding: 30px 10px; color: var(--muted); }

/* Rewards */
.week { display: grid; grid-template-columns: repeat(7, 1fr); gap: 6px; }
.week .d { background: #120d29; border: 3px solid var(--ink); padding: 8px 4px; text-align: center; font-size: 12px; min-height: 92px; display: flex; flex-direction: column; align-items: center; gap: 4px; }
.week .d b { font-size: 13px; }
.week .d.done { background: #2f9e6e33; box-shadow: inset 0 0 0 2px var(--mint); }
.week .d.today { box-shadow: inset 0 0 0 2px var(--gold); animation: shine 1.4s steps(4) infinite; }
@media (max-width: 600px) { .week { grid-template-columns: repeat(4, 1fr); } }
.dice { display: flex; align-items: center; justify-content: center; height: 150px; background: #120d29; border: 3px solid var(--ink); box-shadow: inset 0 0 0 2px var(--line); }
.dice canvas { height: auto; max-height: 130px; max-width: 90%; }
.odds td, .odds th { padding: 4px 8px; }
.drop { display: flex; gap: 12px; align-items: center; }

/* Bidders */
.roster .bc { display: flex; gap: 12px; }
.roster .portrait { width: 72px; height: 104px; display: flex; align-items: flex-end; justify-content: center; background: linear-gradient(#3a2f7a, #1c1540); border: 3px solid var(--ink); flex: none; }
.roster .portrait img { width: 56px; }
.chips { display: flex; gap: 4px; flex-wrap: wrap; }
.ach { display: flex; gap: 10px; align-items: center; padding: 10px; background: #ffffff08; border: 2px solid var(--ink); }
.ach.locked { opacity: .45; filter: grayscale(1); }
.ach b { display: block; }

@media (max-width: 700px) {
  body { font-size: 14px; }
  .hud { gap: 8px; padding: 8px 10px; }
  .hud nav { order: 3; flex-basis: 100%; overflow-x: auto; flex-wrap: nowrap; }
  .hud nav a { white-space: nowrap; }
  .controls { grid-template-columns: 1fr; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}

/* v0.2 */
.stars { color: var(--gold); letter-spacing: 1px; font-size: 14px; }
.trend.spike { color: #0b0820; background: var(--mint); padding: 0 5px; border: 2px solid var(--ink); animation: blink 0.8s steps(2) infinite; }
.ticker { display: flex; align-items: stretch; gap: 0; margin-bottom: 12px; border: 3px solid var(--ink); background: #0e0a22; box-shadow: 0 4px 0 var(--ink); overflow: hidden; }
.ticker > b { background: var(--red); color: #fff; padding: 6px 10px; font-size: 13px; letter-spacing: .1em; flex: none; }
.ticker .tk { overflow: hidden; flex: 1; white-space: nowrap; position: relative; }
.ticker .tk span { display: inline-block; padding: 6px 12px; font-weight: 700; font-size: 14px; animation: tick 28s linear infinite; padding-left: 100%; }
@keyframes tick { to { transform: translateX(-100%); } }
.mapctl { position: absolute; right: 10px; top: 10px; display: flex; gap: 6px; z-index: 6; }
.townwrap canvas { cursor: grab; touch-action: none; }
.bubble.say { background: #e8f4ff; font-weight: 700; font-style: italic; font-size: 12px; }
.lots-compact .lot { padding-top: 8px; margin-top: 8px; }
.crowdgrid { display: grid; gap: 6px; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); }
.crowdgrid .bidcard { padding: 6px; gap: 6px; }
.crowdgrid .bidcard .portrait { width: 40px; height: 58px; }
.crowdgrid .bidcard .portrait img { width: 28px; }
.filters { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 12px; }
.filters button { background: var(--panel); color: var(--muted); border: 3px solid var(--ink); padding: 6px 10px; font-weight: 800; cursor: pointer; }
.filters button[aria-pressed=true] { background: var(--gold); color: var(--ink); }
.quotes { font-size: 12px; color: var(--muted); margin: 6px 0 0; padding-left: 16px; }
.reveal { display: grid; gap: 6px; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); max-height: 46vh; overflow: auto; }
.reveal .lot { animation: tin .3s steps(3) both; }
