:root {
  --bg: #0b0d14;
  --panel: rgba(14, 17, 28, 0.72);
  --line: rgba(255, 255, 255, 0.09);
  --dim: rgba(255, 255, 255, 0.6);
  --accent: #ff5a7a;
  --gold: #ffd34d;
  color-scheme: dark;
}
html, body {
  margin: 0; height: 100%; overflow: hidden; background: var(--bg); color: #fff;
  font: 600 14px ui-rounded, "SF Pro Rounded", system-ui, -apple-system, "Segoe UI", sans-serif;
  -webkit-user-select: none; user-select: none; touch-action: none; overscroll-behavior: none;
  -webkit-tap-highlight-color: transparent;
}
canvas { position: fixed; inset: 0; width: 100%; height: 100%; display: block; }
#gl { touch-action: none; cursor: crosshair; }
#hud { pointer-events: none; }
#ui { position: fixed; inset: 0; pointer-events: none; }
#ui > *:not(.tl), .tl > * { pointer-events: auto; }
[hidden] { display: none !important; }

.tl { position: absolute; top: 10px; left: 10px; display: flex; gap: 6px; align-items: center; flex-wrap: wrap; max-width: 58%; }
.chip {
  display: flex; align-items: center; gap: 7px; padding: 4px 11px 4px 4px; border-radius: 999px;
  background: var(--panel); border: 1px solid var(--line); color: #fff; font: inherit; font-size: 13px;
  backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px); cursor: pointer; max-width: 100%;
}
.chip .nm { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.av {
  width: 24px; height: 24px; border-radius: 50%; overflow: hidden; display: inline-grid; place-items: center;
  font-size: 11px; font-weight: 800; color: #fff; flex: none; background: #2a2f40; text-shadow: 0 1px 2px rgba(0,0,0,.4);
}
.av img { width: 100%; height: 100%; object-fit: cover; display: block; }
.btn { border: 0; border-radius: 999px; padding: 7px 12px; font: inherit; font-size: 12px; cursor: pointer; white-space: nowrap; }
.xbtn { background: #fff; color: #000; font-weight: 800; }
.ghost { background: var(--panel); color: #fff; border: 1px solid var(--line); }

.lb {
  position: absolute; top: 10px; right: 10px; width: min(230px, 44vw); background: var(--panel);
  border: 1px solid var(--line); border-radius: 14px; overflow: hidden;
  backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
}
.lb-head { width: 100%; display: flex; align-items: center; gap: 6px; flex-wrap: wrap; background: none; border: 0; color: #fff; font: inherit; padding: 8px 11px; cursor: pointer; text-align: left; }
.lb-head .pos { font-weight: 800; }
.lb-head .of { color: var(--dim); font-size: 12px; }
.lb-head .chev { margin-left: auto; transition: transform .2s; opacity: .7; }
.lb:not(.collapsed) .chev { transform: rotate(180deg); }
.lb-by { width: 100%; font-size: 10.5px; color: var(--dim); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.lb-by b { color: var(--gold); }
.lb.collapsed .lb-body { display: none; }
.lb-body { padding: 0 10px 10px; max-height: 62vh; overflow: auto; }

.sec { font-size: 10px; letter-spacing: .12em; text-transform: uppercase; color: var(--dim); margin: 8px 0 4px; }
.sp { background: linear-gradient(135deg, rgba(255,211,77,.13), rgba(255,90,122,.08)); border: 1px solid rgba(255,211,77,.28); border-radius: 10px; padding: 1px 9px 8px; }
.sp .sec { color: rgba(255,211,77,.85); }
.sp-list { list-style: none; margin: 0; padding: 0; }
.sp-list li { display: flex; gap: 6px; align-items: center; padding: 3px 0; font-size: 12px; }
.sp-list .sp-top { font-size: 15px; font-weight: 800; color: var(--gold); }
.sp a { color: inherit; text-decoration: none; }
.sp-cta { display: block; margin-top: 4px; font-size: 11px; color: var(--gold) !important; }
.sp-empty { font-size: 12px; color: var(--dim); font-style: italic; padding: 2px 0; }
.top { list-style: none; margin: 0; padding: 0; }
.top li { display: flex; align-items: center; gap: 6px; padding: 3px 4px; border-radius: 8px; font-size: 12px; }
.top li.me { background: rgba(255,255,255,.13); }
.top .rk { width: 18px; color: var(--dim); text-align: right; font-variant-numeric: tabular-nums; flex: none; }
.top .nm { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.top .ms { color: var(--dim); font-variant-numeric: tabular-nums; }
.top .av { width: 18px; height: 18px; font-size: 9px; }
.top li:first-child .rk { color: var(--gold); }

.boost {
  position: absolute; right: 14px; bottom: 14px; width: 70px; height: 70px; border-radius: 50%;
  border: 2px solid rgba(255,255,255,.25); background: rgba(255,90,122,.32); color: #fff; font: inherit;
  font-size: 11px; font-weight: 800; letter-spacing: .08em; touch-action: none;
}
.boost.on { background: rgba(255,90,122,.8); transform: scale(.94); }

.death { position: absolute; inset: 0; display: grid; place-items: center; background: rgba(5,6,10,.45); padding: 10px; box-sizing: border-box; }
.card {
  width: min(370px, 100%); max-height: 100%; overflow: auto; background: rgba(14,17,28,.94); border: 1px solid var(--line);
  border-radius: 18px; padding: 14px; box-sizing: border-box; animation: pop .25s ease-out; box-shadow: 0 20px 60px rgba(0,0,0,.5);
}
@keyframes pop { from { transform: scale(.94); opacity: 0; } }
.dt { font-size: 18px; font-weight: 800; text-align: center; }
.dt b { color: var(--accent); }
.stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; margin: 10px 0 4px; }
.st { text-align: center; background: rgba(255,255,255,.05); border-radius: 10px; padding: 6px 2px; }
.st b { display: block; font-size: 16px; }
.st span { font-size: 10px; color: var(--dim); }
.card .top li:nth-child(n+8) { display: none; }
.row { display: flex; gap: 8px; margin-top: 12px; }
.play { flex: 1.4; border: 0; border-radius: 12px; padding: 12px; font: inherit; font-size: 15px; font-weight: 800; color: #fff; background: linear-gradient(135deg, #ff5a7a, #ff8a4d); cursor: pointer; }
.share { flex: 1; display: grid; place-items: center; border-radius: 12px; background: #fff; color: #000; text-decoration: none; font-weight: 800; font-size: 13px; }
.hint { text-align: center; font-size: 11px; color: var(--dim); margin-top: 8px; }

.toast {
  position: absolute; left: 50%; top: 54px; transform: translateX(-50%) translateY(-6px); background: var(--panel);
  border: 1px solid var(--line); padding: 6px 12px; border-radius: 999px; font-size: 12px; opacity: 0;
  transition: .2s; pointer-events: none !important; white-space: nowrap;
}
.toast.on { opacity: 1; transform: translateX(-50%); }
.fatal { position: fixed; inset: 0; display: grid; place-items: center; text-align: center; padding: 20px; }

@media (max-width: 420px) {
  .tl .ghost { padding: 7px 9px; }
  .lb { width: min(200px, 46vw); }
}

.hint-pill {
  position: absolute; left: 50%; bottom: 64px; transform: translateX(-50%); padding: 8px 14px; border-radius: 999px;
  background: rgba(255,255,255,.92); color: #0b0d14; font-size: 12.5px; font-weight: 800; white-space: nowrap;
  pointer-events: none !important; animation: bob 1.6s ease-in-out infinite; box-shadow: 0 6px 24px rgba(0,0,0,.35);
}
@keyframes bob { 50% { transform: translateX(-50%) translateY(-4px); } }

.chip .set { font-size: 11px; color: #0b0d14; background: var(--gold); padding: 2px 7px; border-radius: 999px; font-weight: 800; }
.chip .pen { opacity: .55; font-size: 11px; }
.dot { width: 26px; height: 26px; border-radius: 50%; border: 2px solid rgba(255,255,255,.7); cursor: pointer; padding: 0; }
.editor {
  position: absolute; top: 50px; left: 10px; display: flex; gap: 6px; padding: 6px; border-radius: 14px;
  background: rgba(14,17,28,.95); border: 1px solid var(--line); z-index: 5; box-shadow: 0 10px 30px rgba(0,0,0,.4);
}
.editor input {
  width: 150px; border: 1px solid var(--line); background: rgba(255,255,255,.06); color: #fff; border-radius: 10px;
  padding: 8px 10px; font: inherit; font-size: 14px; outline: none; -webkit-user-select: text; user-select: text;
}
.editor input:focus { border-color: var(--gold); }
.save { background: var(--gold); color: #1a1300; font-weight: 800; }
.linkish { display: block; margin: 10px auto 0; background: none; border: 0; color: var(--gold); font: inherit; font-size: 12px; cursor: pointer; text-decoration: underline; }

.sp-list .amt, .bid-board .amt { margin-left: auto; font-size: 11px; color: rgba(255,211,77,.8); font-variant-numeric: tabular-nums; }
.sp-cta { display: block; margin-top: 6px; background: none; border: 0; padding: 0; font: inherit; font-size: 11.5px; font-weight: 800; color: var(--gold) !important; cursor: pointer; text-align: left; }
.bidwrap { position: absolute; inset: 0; display: grid; place-items: center; background: rgba(5,6,10,.6); padding: 10px; box-sizing: border-box; z-index: 10; }
.card.bid { width: min(380px, 100%); }
.bid-head { display: flex; align-items: center; gap: 8px; }
.bid-head .dt { flex: 1; text-align: left; font-size: 17px; }
.bid-head .x { background: none; border: 0; color: var(--dim); font-size: 16px; cursor: pointer; padding: 4px; }
.bid-copy, .info-p { font-size: 12.5px; color: rgba(255,255,255,.75); line-height: 1.45; margin: 8px 0; font-weight: 600; }
.bid-board { background: rgba(255,211,77,.08); border: 1px solid rgba(255,211,77,.25); border-radius: 10px; padding: 6px 10px !important; margin: 6px 0 10px !important; }
.bid-form { display: grid; gap: 7px; }
.bid-form input {
  width: 100%; box-sizing: border-box; border: 1px solid var(--line); background: rgba(255,255,255,.06); color: #fff;
  border-radius: 10px; padding: 9px 10px; font: inherit; font-size: 14px; outline: none; -webkit-user-select: text; user-select: text;
}
.bid-form input:focus { border-color: var(--gold); }
.tiers { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; }
.tier { display: grid; gap: 1px; padding: 8px 4px; border-radius: 10px; border: 1px solid var(--line); background: rgba(255,255,255,.05); color: #fff; font: inherit; cursor: pointer; }
.tier b { font-size: 16px; }
.tier span { font-size: 10px; color: var(--dim); }
.tier.on { border-color: var(--gold); background: rgba(255,211,77,.14); }
.bid-err { color: #ff8a9a; font-size: 12px; }
.fine { font-size: 10.5px; color: var(--dim); margin-top: 8px; text-align: center; }
.wallet { display: block; text-align: center; text-decoration: none; box-sizing: border-box; margin-top: 10px; }
body.info { display: grid; place-items: center; min-height: 100vh; padding: 16px; box-sizing: border-box; touch-action: auto; overflow: auto; }
body.info .dt { text-align: left; }

body.shot #ui, body.shot #hud { display: none !important; }
