/* ================================================================= BATTLES */
.mode-ic { display: inline-flex; align-items: center; gap: 3px; }
.mode-ic i { width: 9px; height: 13px; border-radius: 4px 4px 2px 2px; background: currentColor; opacity: 0.85; }
.mode-ic b { font-size: 9px; font-weight: 800; color: var(--muted-2); text-transform: uppercase; margin: 0 2px; }

.battle-list { display: flex; flex-direction: column; gap: 10px; }
.battle-row {
  display: grid; grid-template-columns: 150px minmax(0, 1fr) 210px 120px 170px; align-items: center; gap: 16px;
  padding: 12px 16px; border-radius: 14px; background: linear-gradient(90deg, #1b1c30, #161728); border: 1px solid var(--line);
  animation: fadeUp 0.3s var(--ease);
}
.battle-row.mine { border-color: rgba(255, 150, 20, 0.4); background: linear-gradient(90deg, rgba(255, 150, 20, 0.08), #161728 50%); }
.br-mode { display: flex; align-items: center; gap: 8px; font-weight: 700; color: var(--text-2); flex-wrap: wrap; }
.br-mode .mode-ic { color: var(--yellow); }
.br-cases { display: flex; align-items: center; gap: 12px; min-width: 0; }
.bcase-strip { display: flex; align-items: center; gap: 4px; min-width: 0; overflow: hidden; }
.bcase { position: relative; width: 54px; flex: none; }
.bcase i { position: absolute; right: -2px; bottom: 0; font-style: normal; font-size: 10.5px; font-weight: 700; padding: 1px 4px; border-radius: 4px; background: rgba(0, 0, 0, 0.75); }
.bcase-more { font-size: 12px; color: var(--muted); font-weight: 700; padding: 0 6px; }
.br-seats { display: flex; align-items: center; gap: 4px; flex-wrap: wrap; }
.bseat { width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center; }
.bseat.open-seat { border: 1.5px dashed var(--line-2); color: var(--muted-2); }
.bseat.you .avatar { box-shadow: 0 0 0 2px var(--yellow); }
.bstat { margin-left: 8px; font-size: 12px; font-weight: 600; color: var(--muted); display: inline-flex; align-items: center; gap: 5px; }
.bstat.live { color: var(--green-1); }
.bstat.live i { width: 7px; height: 7px; border-radius: 50%; background: var(--green-1); animation: pulse 1.2s infinite; }
.bstat.done { color: var(--muted-2); }
.br-cost { display: flex; flex-direction: column; gap: 2px; font-size: 15px; }
.br-act { display: flex; justify-content: flex-end; }
.br-act .btn { min-width: 150px; }

/* empty lobby hero */
.bte { animation: fadeUp 0.3s var(--ease); }
.bte-hero {
  position: relative; display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.1fr); align-items: center; gap: 36px;
  min-height: 340px; padding: 36px 48px; border-radius: 16px; overflow: hidden; border: 1px solid var(--line);
  background:
    radial-gradient(45% 80% at 14% 55%, rgba(255, 150, 20, 0.18), transparent 70%),
    radial-gradient(45% 80% at 40% 45%, rgba(76, 141, 255, 0.14), transparent 70%),
    linear-gradient(180deg, var(--bg-3), #141526);
}
.bte-art { position: relative; display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; }
.bte-side { --r: -7deg; animation: bteBob 4.2s ease-in-out infinite; filter: drop-shadow(0 18px 24px rgba(0, 0, 0, 0.5)); }
.bte-side.right { --r: 7deg; animation-delay: -2.1s; }
.bte-side .case-visual { width: 100%; max-width: 220px; margin: 0 auto; }
.bte-vs {
  position: relative; z-index: 1; width: 66px; height: 66px; margin: 0 -10px; display: grid; place-items: center; border-radius: 50%;
  background: var(--accent-grad); color: #2a1300; font-family: var(--display); font-weight: 800; font-size: 27px; letter-spacing: 0.02em;
  box-shadow: 0 0 0 6px rgba(255, 150, 20, 0.12), 0 10px 24px rgba(0, 0, 0, 0.45);
}
.bte-copy { position: relative; }
.bte-kicker { display: inline-flex; align-items: center; gap: 6px; color: var(--yellow); font-family: var(--display); font-weight: 700; font-size: 14px; letter-spacing: 0.08em; text-transform: uppercase; }
.bte-copy h2 { margin-top: 8px; font-family: var(--display); font-size: 42px; font-weight: 800; line-height: 1.02; text-transform: uppercase; }
.bte-copy p { max-width: 470px; margin: 12px 0 24px; color: var(--muted); font-size: 15px; line-height: 1.55; }
.bte-cta { display: flex; gap: 12px; flex-wrap: wrap; }

@keyframes bteBob { 0%, 100% { transform: translateY(0) rotate(var(--r)); } 50% { transform: translateY(-9px) rotate(var(--r)); } }
@media (prefers-reduced-motion: reduce) { .bte-side { animation: none; transform: rotate(var(--r)); } }
@media (max-width: 900px) {
  .bte-hero { grid-template-columns: 1fr; gap: 18px; padding: 24px 18px; text-align: center; }
  .bte-art { max-width: 400px; width: 100%; margin: 0 auto; }
  .bte-copy h2 { font-size: 30px; }
  .bte-copy p { margin-left: auto; margin-right: auto; }
  .bte-cta { justify-content: center; }
}

/* create */
.bc-layout { display: grid; grid-template-columns: 330px minmax(0, 1fr); gap: 18px; align-items: start; }
.bc-side { position: sticky; top: calc(var(--topbar-h) + 16px); padding: 18px; display: flex; flex-direction: column; gap: 12px; max-height: calc(100vh - var(--topbar-h) - 32px); overflow: auto; }
.bc-h { font-size: 14px; display: flex; justify-content: space-between; align-items: center; margin-top: 4px; }
.bc-modes { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.bc-mode { display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 12px 6px; border-radius: 10px; background: var(--bg-1); border: 1px solid var(--line); color: var(--muted); transition: border-color 0.15s, background 0.15s; }
.bc-mode b { color: #fff; font-size: 14px; }
.bc-mode span { font-size: 11px; }
.bc-mode .mode-ic { color: var(--muted); height: 16px; }
.bc-mode.on { border-color: var(--yellow); background: rgba(255, 150, 20, 0.08); }
.bc-mode.on .mode-ic { color: var(--yellow); }
.bc-crazy { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 12px; border-radius: 10px; background: var(--bg-1); border: 1px solid var(--line); cursor: pointer; }
.bc-crazy span { display: flex; flex-direction: column; }
.bc-crazy small { color: var(--muted); font-size: 12px; }
.bc-picks { display: flex; flex-direction: column; gap: 6px; }
.bc-empty { padding: 18px 10px; text-align: center; border: 1.5px dashed var(--line-2); border-radius: 10px; }
.bc-pick { display: flex; align-items: center; gap: 10px; padding: 6px 8px; border-radius: 10px; background: var(--bg-1); }
.bc-pick .case-visual { width: 46px; flex: none; }
.bp-name { flex: 1; min-width: 0; display: flex; flex-direction: column; font-size: 12.5px; }
.bp-name b { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.bp-qty { display: flex; align-items: center; gap: 6px; }
.bp-qty button { width: 26px; height: 26px; border-radius: 7px; background: var(--bg-4); display: grid; place-items: center; color: var(--muted); }
.bp-qty button:hover { color: #fff; }
.bp-qty .ic { width: 13px; height: 13px; }
.bp-qty span { min-width: 16px; text-align: center; font-weight: 700; }
.bc-total { display: flex; justify-content: space-between; align-items: center; padding: 12px 0 4px; border-top: 1px solid var(--line); }
.bc-total b .amt { font-size: 18px; }
.bc-note { text-align: center; }
.bc-tools { margin-bottom: 12px; max-width: 320px; }
.bc-grid { grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); }
.bc-card { cursor: pointer; }
.bc-card .bc-add { position: absolute; inset: auto 10px 10px 10px; height: 34px; border-radius: 8px; display: none; align-items: center; justify-content: center; gap: 6px; background: linear-gradient(180deg, #2fd56f, #1ea955); font-weight: 600; z-index: 3; }
.bc-card:hover .bc-add { display: flex; }
.bc-card.picked { border-color: var(--yellow); }
.bc-n { position: absolute; top: 10px; right: 10px; z-index: 3; min-width: 26px; height: 26px; border-radius: 99px; background: var(--yellow); color: #241900; font-weight: 800; display: grid; place-items: center; font-size: 13px; }

/* battle view */
.bt-head { display: flex; align-items: center; justify-content: space-between; gap: 14px; margin: 12px 0 14px; flex-wrap: wrap; }
.bt-title { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.bt-title h1 { font-size: 26px; }
.bt-meta { display: flex; gap: 22px; }
.bt-meta > span { display: flex; flex-direction: column; gap: 2px; font-size: 16px; }
.bt-rounds { display: flex; gap: 8px; overflow-x: auto; padding: 4px 2px 10px; }
.bt-round { position: relative; width: 74px; flex: none; padding: 6px; border-radius: 10px; background: var(--bg-3); border: 1px solid var(--line); opacity: 0.7; transition: all 0.25s; }
.bt-round .r-n { position: absolute; top: 4px; left: 6px; font-size: 11px; font-weight: 700; color: var(--muted); z-index: 2; }
.bt-round.cur { opacity: 1; border-color: var(--yellow); box-shadow: 0 0 18px -4px rgba(255, 150, 20, 0.5); transform: translateY(-2px); }
.bt-round.past { opacity: 0.35; }
.bt-status { display: flex; align-items: center; justify-content: center; gap: 8px; padding: 12px; margin: 6px 0 14px; border-radius: 12px; background: var(--bg-3); border: 1px solid var(--line); font-size: 15px; color: var(--text-2); flex-wrap: wrap; }
.bt-status .ic { color: var(--yellow); }
.bt-status b { color: #fff; }
.bt-status .cd { font-size: 20px; color: var(--yellow); animation: pop 0.5s var(--ease); }
.bt-status.st-done { border-color: rgba(255, 150, 20, 0.4); background: linear-gradient(90deg, rgba(255, 150, 20, 0.1), var(--bg-3), rgba(255, 150, 20, 0.1)); }
.bt-arena { display: flex; gap: 10px; align-items: stretch; }
.bt-team { flex: 1; display: flex; gap: 10px; min-width: 0; }
.bt-vs { display: flex; align-items: center; justify-content: center; flex: none; width: 34px; }
.bt-vs span { width: 34px; height: 34px; border-radius: 50%; display: grid; place-items: center; background: var(--bg-4); border: 1px solid var(--line-2); font-size: 11px; font-weight: 800; color: var(--yellow); }
.seat { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 10px; padding: 12px; border-radius: 14px; background: linear-gradient(180deg, #1b1c30, #151626); border: 1px solid var(--line); position: relative; transition: border-color 0.3s, opacity 0.3s, box-shadow 0.3s; }
.seat.you { border-color: rgba(255, 150, 20, 0.35); }
.seat.leading { border-color: rgba(36, 198, 97, 0.55); }
.seat.winner { border-color: var(--yellow); box-shadow: 0 0 34px -10px rgba(255, 150, 20, 0.7); background: radial-gradient(80% 40% at 50% 0%, rgba(255, 150, 20, 0.16), transparent 70%), linear-gradient(180deg, #23252a, #151626); }
.seat.loser { opacity: 0.55; }
.seat-player { display: flex; align-items: center; gap: 8px; min-height: 32px; flex-wrap: wrap; }
.seat-player b { font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 120px; }
.seat-wait { display: inline-flex; align-items: center; gap: 6px; color: var(--muted); font-size: 13px; flex: 1; }
.seat-reel { height: 270px; }
.seat-reel .reel { height: 100%; }
.seat-reel.is-empty .reel { opacity: 0.25; }
.seat-total { text-align: center; font-size: 18px; font-weight: 700; padding: 6px; border-radius: 9px; background: rgba(0, 0, 0, 0.25); }
.seat-banner { position: absolute; top: -12px; left: 50%; transform: translateX(-50%); display: inline-flex; align-items: center; gap: 6px; padding: 5px 12px; border-radius: 99px; background: linear-gradient(180deg, #ffd84a, #f5b400); color: #241900; font-weight: 800; font-size: 12px; text-transform: uppercase; letter-spacing: 0.06em; box-shadow: 0 8px 20px rgba(255, 190, 0, 0.35); animation: pop 0.5s var(--ease); z-index: 3; }
.seat-banner .ic { width: 14px; height: 14px; }
.seat-items { display: grid; grid-template-columns: repeat(auto-fill, minmax(76px, 1fr)); gap: 6px; }
.seat-item { --rc: #8b93a4; padding: 6px 4px 5px; border-radius: 8px; background: radial-gradient(90% 70% at 50% 110%, color-mix(in srgb, var(--rc) 30%, transparent), transparent 70%), #1b1c30; border-bottom: 2px solid var(--rc); display: flex; flex-direction: column; align-items: center; gap: 2px; font-size: 11px; }
.seat-item img { height: 40px; width: 100%; object-fit: contain; }
.seat-item.new { animation: pop 0.45s var(--ease); }
.bt-foot { display: flex; justify-content: center; align-items: center; gap: 10px; margin-top: 18px; flex-wrap: wrap; }
.bt-result { display: flex; align-items: center; gap: 12px; padding: 12px 16px; border-radius: 12px; margin-right: 8px; }
.bt-result > div { display: flex; flex-direction: column; }
.bt-result .ic { width: 26px; height: 26px; }
.bt-result.win { background: rgba(255, 150, 20, 0.1); border: 1px solid rgba(255, 150, 20, 0.4); }
.bt-result.win .ic { color: var(--yellow); }
.bt-result.lose { background: rgba(255, 77, 94, 0.08); border: 1px solid rgba(255, 77, 94, 0.3); }
.bt-result.lose .ic { color: var(--red); }
.bt-result a { color: var(--yellow); text-decoration: underline; }

@media (max-width: 1100px) {
  .battle-row { grid-template-columns: 1fr auto; grid-template-areas: 'mode act' 'cases cases' 'seats cost'; }
  .br-mode { grid-area: mode; } .br-cases { grid-area: cases; } .br-seats { grid-area: seats; } .br-cost { grid-area: cost; align-items: flex-end; } .br-act { grid-area: act; }
  .bc-layout { grid-template-columns: 1fr; }
  .bc-side { position: static; max-height: none; }
  .bt-arena.seats-4 { flex-wrap: wrap; }
  .bt-arena.seats-4 .bt-team { flex-basis: 100%; }
  .bt-arena.seats-4:not(.teams) { display: grid; grid-template-columns: 1fr 1fr; }
  .bt-arena.seats-4:not(.teams) .bt-vs { display: none; }
}
@media (max-width: 640px) {
  .bt-arena { flex-direction: column; }
  .bt-arena.seats-4:not(.teams) { grid-template-columns: 1fr; }
  .bt-vs { width: 100%; height: 30px; }
  .seat-reel { height: 200px; }
  .br-act .btn { min-width: 0; }
}

/* ================================================================ UPGRADER */
.upg-stage { position: relative; overflow: hidden; border-radius: var(--radius); border: 1px solid var(--line); background: linear-gradient(180deg, var(--bg-3), #161728); }
/* showcase: stake | hexagon | target, no boxes */
.upg-show { display: grid; grid-template-columns: minmax(0, 1fr) minmax(240px, 300px) minmax(0, 1fr); align-items: center; gap: 20px; padding: 26px 34px 22px; }
.upg-side { display: flex; flex-direction: column; align-items: center; gap: 10px; min-width: 0; text-align: center; }
.upg-label { display: flex; align-items: center; justify-content: center; gap: 10px; height: 24px; color: var(--muted); font-size: 11.5px; font-weight: 700; letter-spacing: 0.12em; text-transform: uppercase; }
.upg-link { padding: 2px 8px; border-radius: 6px; background: rgba(255, 255, 255, 0.05); color: var(--muted); font-size: 11.5px; font-weight: 600; letter-spacing: 0; text-transform: none; }
.upg-link:hover { color: #fff; background: rgba(255, 255, 255, 0.09); }
.upg-mult { padding: 2px 8px; border-radius: 6px; background: rgba(76, 236, 136, 0.13); color: var(--green-1); font-family: var(--display); font-size: 15px; font-weight: 800; letter-spacing: 0.02em; }
.upg-mult:empty { display: none; }

/* the item floats on a rarity glow with a soft shadow under it */
.upg-pic { --rc: transparent; position: relative; width: 100%; max-width: 300px; height: 200px; display: grid; place-items: center; }
.upg-pic::after { content: ''; position: absolute; left: 22%; right: 22%; bottom: 10px; height: 14px; border-radius: 50%; background: radial-gradient(closest-side, rgba(0, 0, 0, 0.55), transparent); opacity: 0; transition: opacity 0.35s; }
.upg-pic.has::after { opacity: 1; }
.upg-pic > img { position: relative; z-index: 1; max-width: 82%; max-height: 80%; object-fit: contain; filter: drop-shadow(0 16px 24px rgba(0, 0, 0, 0.55)); animation: upgFloat 0.45s var(--ease); }
@keyframes upgFloat { from { opacity: 0; transform: translateY(10px) scale(0.92); } }
.upg-empty { position: relative; z-index: 1; display: flex; flex-direction: column; align-items: center; gap: 12px; color: var(--muted-2); font-size: 13px; line-height: 1.45; }
.upg-empty i { width: 92px; height: 92px; display: grid; place-items: center; border-radius: 50%; border: 1.5px dashed rgba(160, 170, 255, 0.16); color: var(--muted-2); }
.upg-empty i .ic { width: 26px; height: 26px; }
.upg-stack { position: relative; z-index: 1; width: 82%; height: 80%; isolation: isolate; }
.upg-stack img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; filter: drop-shadow(0 14px 20px rgba(0, 0, 0, 0.55)); animation: upgFloat 0.45s var(--ease); }
.upg-stack.n2 img:nth-child(2), .upg-stack.n3 img:nth-child(2) { transform: translate(-18%, -12%) scale(0.7); opacity: 0.8; z-index: -1; }
.upg-stack.n3 img:nth-child(3) { transform: translate(18%, -12%) scale(0.7); opacity: 0.8; z-index: -1; }
.upg-more { position: absolute; right: 8%; top: 6%; z-index: 2; padding: 2px 8px; border-radius: 6px; background: rgba(255, 255, 255, 0.09); color: #fff; font-size: 12px; font-weight: 700; }
.upg-coinpic { position: relative; z-index: 1; }
.upg-coinpic .coin { width: 84px; height: 84px; filter: drop-shadow(0 12px 24px rgba(255, 174, 26, 0.4)); }
.upg-val { display: flex; flex-direction: column; align-items: center; gap: 2px; min-width: 0; max-width: 100%; }
.upg-val small { max-width: 100%; color: var(--muted); font-size: 12.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.upg-val .amt { font-family: var(--display); font-size: 28px; font-weight: 800; color: #fff; }
.upg-val .coin { width: 20px; height: 20px; }
.upg-chips { display: flex; flex-wrap: wrap; justify-content: center; gap: 6px; }
.upg-chips:empty { display: none; }
.upg-chip { --rc: #888; position: relative; width: 46px; height: 36px; display: grid; place-items: center; border-radius: 8px; background: rgba(255, 255, 255, 0.04); box-shadow: inset 0 -2px 0 var(--rc); }
.upg-chip img { width: 86%; height: 80%; object-fit: contain; }
.upg-chip i { position: absolute; inset: 0; display: none; place-items: center; border-radius: 8px; background: rgba(15, 16, 32, 0.82); color: var(--red); }
.upg-chip i .ic { width: 14px; height: 14px; }
.upg-chip:hover i { display: grid; }

/* hexagon */
.upg-mid { display: grid; place-items: center; }
.upg-ring { position: relative; width: 100%; max-width: 290px; aspect-ratio: 1; }
.upg-hex { width: 100%; height: 100%; overflow: visible; }
.hex-core { fill: rgba(255, 255, 255, 0.02); stroke: rgba(255, 255, 255, 0.05); stroke-width: 1; }
.hex-track { fill: none; stroke: rgba(255, 255, 255, 0.06); stroke-width: 12; stroke-linejoin: round; }
.hex-win { fill: none; stroke: url(#upg-win); stroke-width: 12; stroke-linejoin: round; filter: drop-shadow(0 0 6px rgba(214, 255, 232, 0.55)) drop-shadow(0 0 16px rgba(120, 245, 175, 0.35)); transition: stroke-dasharray 0.45s var(--ease), opacity 0.3s; }
.hex-dot { fill: #fff; filter: drop-shadow(0 0 5px #fff) drop-shadow(0 0 14px rgba(190, 255, 220, 0.85)); transition: fill 0.3s; }
.upg-fx { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; }
.upg-read { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; pointer-events: none; }
.upg-read span { color: var(--muted); font-size: 11px; font-weight: 700; letter-spacing: 0.14em; text-transform: uppercase; }
.upg-read b { font-family: var(--display); font-size: 50px; font-weight: 800; line-height: 1.05; color: #fff; font-variant-numeric: tabular-nums; transition: color 0.3s; }
.upg-read small { min-height: 16px; color: var(--muted-2); font-size: 12px; font-weight: 600; font-variant-numeric: tabular-nums; }
.upg-read small b { font-family: inherit; font-size: inherit; }
.upg-read small b.green { color: #b6ffd3; }
.upg-read small b.red { color: var(--red); }
.upg-mid.won .upg-read > b { color: #d4ffe6; text-shadow: 0 0 24px rgba(160, 255, 205, 0.55); }
.upg-mid.won .hex-dot { fill: #eafff3; }
.upg-mid.won .hex-track { stroke: rgba(182, 255, 211, 0.12); }
.upg-mid.lost .upg-read > b { color: var(--red); }
.upg-mid.lost .hex-dot { fill: var(--red); filter: drop-shadow(0 0 8px rgba(255, 77, 94, 0.8)); }
.upg-mid.lost .hex-win { opacity: 0.45; }
/* gentle pulse when the roll lands */
.upg-mid.pulse .upg-hex { animation: upgPulse 0.7s var(--ease); }
@keyframes upgPulse { 0% { transform: scale(1); } 35% { transform: scale(1.045); } 100% { transform: scale(1); } }
.upg-mid.won.pulse .hex-win { animation: upgFlash 0.9s ease-out; }
@keyframes upgFlash { 0% { stroke-width: 12; } 30% { stroke-width: 16; filter: drop-shadow(0 0 10px #fff) drop-shadow(0 0 28px rgba(160, 255, 205, 0.8)); } 100% { stroke-width: 12; } }
@media (prefers-reduced-motion: reduce) { .upg-mid.pulse .upg-hex, .upg-mid.won.pulse .hex-win { animation: none; } }

/* control bar */
.upg-bar { display: grid; grid-template-columns: minmax(0, 1fr) minmax(300px, 380px) minmax(0, 1fr); align-items: center; gap: 20px; padding: 16px 34px; border-top: 1px solid var(--line); background: rgba(0, 0, 0, 0.12); }
.upg-bar-amt .bet-control { max-width: 300px; }
.bet-compact .bet-input { height: 50px; padding: 0 6px 0 14px; gap: 4px; border-radius: 12px; background: #0d0e1a; border-color: rgba(160, 170, 255, 0.08); }
.bet-compact .bet-input input { font-size: 18px; }
.bet-compact .bet-input .coin { width: 18px; height: 18px; }
.bet-compact .bet-input button { width: auto; min-width: 34px; height: 38px; padding: 0 9px; border-radius: 9px; background: rgba(255, 255, 255, 0.05); font-size: 13px; }
.upg-bar-go { display: flex; align-items: center; gap: 8px; }
.upg-dir { flex: none; display: flex; gap: 2px; padding: 3px; border-radius: 12px; background: #0d0e1a; border: 1px solid rgba(160, 170, 255, 0.08); }
.upg-dir button { display: inline-flex; align-items: center; gap: 3px; height: 42px; padding: 0 10px; border-radius: 9px; color: var(--muted); font-size: 13px; font-weight: 700; transition: background 0.15s, color 0.15s; }
.upg-dir button .ic { width: 13px; height: 13px; }
.upg-dir button:hover { color: #fff; }
.upg-dir button.on { color: #fff; background: #23253d; }
.upg-dir button.on .ic { color: var(--green-1); }
.upg-go { flex: 1; height: 50px; font-size: 19px; }
.upg-mults { display: flex; justify-content: flex-end; gap: 6px; }
.upg-mults button { min-width: 46px; height: 38px; padding: 0 8px; border-radius: 9px; background: #0d0e1a; border: 1px solid rgba(160, 170, 255, 0.08); color: var(--muted); font-size: 13px; font-weight: 700; transition: background 0.15s, color 0.15s, border-color 0.15s; }
.upg-mults button:hover { background: rgba(76, 236, 136, 0.1); border-color: rgba(76, 236, 136, 0.3); color: var(--green-1); }

/* item browser */
/* item browser: your items | upgrade to, side by side */
.upg-browser { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 16px; margin-top: 18px; container-type: inline-size; }
.upg-pane { display: flex; flex-direction: column; gap: 10px; min-width: 0; padding: 16px 18px; border-radius: var(--radius); background: linear-gradient(180deg, var(--bg-3), #161728); border: 1px solid var(--line); }
.upg-ph { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.upg-ph h3 { display: inline-flex; align-items: center; gap: 9px; font-family: var(--display); font-size: 19px; font-weight: 800; letter-spacing: 0.03em; text-transform: uppercase; }
.upg-ph h3 .ic { width: 18px; height: 18px; color: var(--yellow); }
.upg-ph .cselect { min-width: 0; height: 36px; }
.upg-n { min-width: 20px; padding: 1px 6px; border-radius: 6px; background: rgba(255, 255, 255, 0.07); font-family: inherit; font-size: 11.5px; letter-spacing: 0; text-align: center; }
.upg-search { width: 100%; }
.upg-search .input { height: 40px; background: #0f1020; border-color: rgba(160, 170, 255, 0.08); }
.upg-prange { height: 42px; }
.upg-hint { min-height: 16px; margin: 2px 0 4px; color: var(--muted-2); font-size: 12px; }
.upg-hint b { color: #fff; }
.upg-pane[data-pane="tgt"] { border-color: rgba(255, 174, 26, 0.16); }
@container (max-width: 860px) { .upg-browser { grid-template-columns: 1fr; } }
.upg-grid { flex: none; grid-auto-rows: max-content; align-content: start; max-height: 620px; overflow-y: auto; padding: 8px 6px 6px 2px; margin: -6px -6px 0 -2px; }
.upg-ch { padding: 2px 6px; border-radius: 5px; background: rgba(76, 236, 136, 0.13); color: var(--green-1); font-size: 11px; font-weight: 700; font-variant-numeric: tabular-nums; }

/* layout follows the stage's own width (chat and menu change it), not the window */
.upg-stage { container-type: inline-size; }
@container (max-width: 1060px) {
  .upg-bar { grid-template-columns: minmax(0, 1fr) auto; gap: 12px 16px; }
  .upg-bar-go { grid-column: 1 / -1; order: -1; }
  .upg-bar-amt .bet-control { max-width: none; }
}
@container (max-width: 760px) {
  .upg-show { grid-template-columns: 1fr 1fr; gap: 14px; padding: 20px 18px; }
  .upg-mid { grid-column: 1 / -1; order: -1; }
  .upg-ring { max-width: 240px; }
  .upg-pic { height: 150px; }
  .upg-val .amt { font-size: 22px; }
  .upg-bar { grid-template-columns: 1fr; padding: 14px 18px; }
  .upg-mults { justify-content: stretch; }
  .upg-mults button { flex: 1; min-width: 0; }
}
@container (max-width: 420px) {
  .upg-pic { height: 120px; }
  .upg-read b { font-size: 40px; }
}

/* ================================================================== DOUBLE */
.side-red { color: #ff5a5a; } .side-blue { color: #6fa8ff; } .side-bonus { color: #ffd24a; }
/* tile palette: muted by default, bright when it wins. red team, blue team and the gold bonus */
.dtile, .dh, .l100 { --bg: #262833; --fg: #4a4e60; --bg-on: #3d4256; --fg-on: #c9cfe0; }
.dtile.red, .dh.red, .l100.red { --bg: #5c2124; --fg: #a3363b; --bg-on: #e23b3b; --fg-on: #ffc9c9; }
.dtile.blue, .dh.blue, .l100.blue { --bg: #1f3260; --fg: #3d63b8; --bg-on: #2f6ae6; --fg-on: #c8dbff; }
.dtile.bonus, .dh.bonus, .l100.bonus { --bg: #5a4416; --fg: #a8802a; --bg-on: #e6ae1e; --fg-on: #fff1c2; }
.dmark { display: block; width: 100%; height: 100%; }
/* the team coins: dim on the unlit tiles, full colour on the winner */
.dmark .face { width: 100%; height: 100%; filter: drop-shadow(0 2px 3px rgba(0, 0, 0, 0.35)); }
.dtile { padding: 7px; }
.dtile .dmark, .dh:not(:first-child) .dmark { filter: saturate(0.8) brightness(0.88); transition: filter 0.3s; }
.dtile.win .dmark { filter: none; }

.dbl-hist { display: flex; gap: 5px; }
.dh { width: 28px; height: 28px; }

.dbl-wheel { padding: 0; overflow: hidden; }
.dbl-strip { position: relative; height: 104px; overflow: hidden; background: #111219; border-bottom: 1px solid var(--line); }
.dbl-strip::after { content: ''; position: absolute; inset: 0; pointer-events: none; z-index: 3; background: linear-gradient(90deg, #111219, transparent 12%, transparent 88%, #111219); }
.dbl-track { position: absolute; top: 20px; left: 0; display: flex; gap: 10px; will-change: transform; }
.dtile {
  position: relative; width: 64px; height: 64px; flex: none; padding: 13px; border-radius: 8px;
  background: var(--bg); color: var(--fg); box-shadow: inset 0 -3px 0 rgba(0, 0, 0, 0.28), inset 0 1px 0 rgba(255, 255, 255, 0.04);
  transition: background 0.3s, color 0.3s, transform 0.3s var(--ease), box-shadow 0.3s, opacity 0.3s;
}
.dbl-strip.done .dtile:not(.win) { opacity: 0.55; }
.dtile.win {
  background: var(--bg-on); color: var(--fg-on); transform: translateY(-2px); z-index: 2;
  box-shadow: inset 0 -3px 0 rgba(0, 0, 0, 0.25), inset 0 1px 0 rgba(255, 255, 255, 0.18), 0 8px 24px color-mix(in srgb, var(--bg-on) 45%, transparent);
}
/* centre markers: green arrows above and below */
.dbl-arrow { position: absolute; left: 50%; z-index: 4; width: 0; height: 0; margin-left: -9px; border: 9px solid transparent; }
.dbl-arrow.top { top: 0; border-top: 9px solid #3ecf7a; border-bottom-width: 0; }
.dbl-arrow.bottom { bottom: 0; border-bottom: 9px solid #3ecf7a; border-top-width: 0; }
/* countdown box over the centre tile while bets are open */
.dbl-timer {
  position: absolute; left: 50%; top: 50%; z-index: 4; width: 72px; height: 72px; margin: -36px 0 0 -36px;
  display: none; flex-direction: column; align-items: center; justify-content: center; gap: 1px; overflow: hidden;
  border-radius: 9px; background: linear-gradient(180deg, #2f8a5e, #23704b); border: 1px solid rgba(255, 255, 255, 0.14);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5), 0 0 24px rgba(62, 207, 122, 0.25);
}
.dbl-strip.betting .dbl-timer { display: flex; }
.dbl-timer .ic { position: absolute; width: 44px; height: 44px; color: rgba(255, 255, 255, 0.1); }
.dbl-timer span { position: relative; font-size: 14px; font-weight: 700; color: #fff; }
.dbl-timer b { position: relative; font-family: var(--display); font-size: 21px; font-weight: 800; color: #fff; font-variant-numeric: tabular-nums; line-height: 1; }

.dbl-foot { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; padding: 12px 16px; }
.dbl-status { font-size: 14px; color: var(--muted); }
.dbl-status b { color: #fff; font-variant-numeric: tabular-nums; }
.dbl-last100 { display: flex; align-items: center; gap: 14px; }
.l100 { display: inline-flex; align-items: center; gap: 7px; font-weight: 700; }
.l100 i { width: 24px; height: 24px; }
.dbl-controls { margin-top: 14px; padding: 14px; }
.dbl-controls .bet-control { flex-direction: row; align-items: center; }
.dbl-controls .bet-input { flex: 1; max-width: 360px; }
.dbl-controls .bet-quick { flex: 1; }
.dbl-cols { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; margin-top: 14px; }
.dbl-col { display: flex; flex-direction: column; gap: 14px; min-width: 0; transition: opacity 0.3s; }
.dbl-col.lose { opacity: 0.5; }
/* side header: icon + PLACE BET on the left, payout on the right */
.dbl-btn {
  display: flex; align-items: center; gap: 12px; height: 54px; padding: 0 18px; border-radius: 6px; color: #fff; text-align: left;
  box-shadow: inset 0 -3px 0 rgba(0, 0, 0, 0.25); transition: filter 0.15s, transform 0.08s;
}
.dbl-btn .dmark { width: 32px; height: 32px; flex: none; }
.dbl-btn b { flex: 1; font-family: var(--display); font-size: 19px; font-weight: 800; letter-spacing: 0.02em; text-transform: uppercase; }
.dbl-btn i { font-style: normal; font-family: var(--display); font-size: 19px; font-weight: 800; }
.dbl-btn.red { background: linear-gradient(180deg, #e5484d, #b3262c); }
.dbl-btn.bonus { background: linear-gradient(180deg, #f2c037, #c48d12); color: #2a1d00; }
.dbl-btn.blue { background: linear-gradient(180deg, #3d7bf0, #2353c2); color: #fff; }
.dbl-btn:hover { filter: brightness(1.12); }
.dbl-btn:active { transform: translateY(1px); }
.dbl-btn:disabled { filter: saturate(0.5) brightness(0.65); cursor: not-allowed; }
/* everyone's bets on that side */
.dbl-board { display: flex; flex-direction: column; min-height: 260px; padding: 0 16px 10px; border-radius: 8px; background: #17182a; border: 1px solid var(--line); transition: border-color 0.2s, background 0.2s; }
.dbl-sum { display: flex; justify-content: space-between; align-items: center; height: 52px; border-bottom: 1px solid var(--line); }
.dbl-n { color: var(--muted-2); font-size: 13px; font-weight: 600; }
.dbl-total .amt { color: #fff; font-weight: 700; font-size: 14px; }
.dbl-col.win .dbl-board { border-color: rgba(36, 198, 97, 0.5); background: linear-gradient(180deg, rgba(36, 198, 97, 0.07), #17182a 60%); }
.dbl-bets { display: flex; flex-direction: column; max-height: 440px; overflow-y: auto; padding-top: 6px; scrollbar-width: thin; }
.dbl-bet { display: flex; align-items: center; gap: 12px; padding: 9px 0; animation: fadeUp 0.25s var(--ease); }
.db-av { position: relative; flex: none; width: 40px; height: 44px; }
.db-av .avatar { width: 40px; height: 40px; border-radius: 10px; }
.db-lvl { position: absolute; left: 50%; bottom: -1px; transform: translateX(-50%); border-radius: 6px; background: #17182a; }
.db-lvl .lvl { min-width: 24px; height: 16px; padding: 0 5px; font-size: 10.5px; }
.db-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 14px; font-weight: 700; color: #fff; }
.db-amt { flex: none; display: inline-flex; align-items: center; height: 30px; padding: 0 10px; border-radius: 6px; background: #20213a; }
.db-amt .amt { font-size: 13px; font-weight: 700; color: #fff; }
.db-amt.win { background: rgba(36, 198, 97, 0.14); }
.db-amt.win .amt { color: var(--green-1); }
.db-amt.lose .amt { color: var(--muted); }
.dbl-bet.you .db-name { color: var(--yellow); }
.dbl-none { margin: auto; padding: 40px 0; color: var(--muted-2); font-size: 13px; }
@media (max-width: 900px) {
  .dbl-cols { grid-template-columns: 1fr; }
  .dbl-controls .bet-control { flex-direction: column; align-items: stretch; }
  .dbl-controls .bet-input { max-width: none; }
  .page-double .page-title .right { width: 100%; }
}

/* =================================================================== CRASH */
.cr-hist { display: flex; gap: 5px; flex-wrap: wrap; justify-content: flex-end; }
.cr-pill { padding: 4px 8px; border-radius: 7px; font-size: 12px; font-weight: 700; font-variant-numeric: tabular-nums; background: var(--bg-4); }
.cr-pill.bad { color: #ff8592; }
.cr-pill.good { color: var(--green-1); }
.cr-pill.gold { color: var(--yellow); background: rgba(255, 150, 20, 0.12); }
.cr-layout { display: grid; grid-template-columns: minmax(0, 1fr) 330px; gap: 16px; }
.cr-graph { position: relative; height: 420px; overflow: hidden; background: radial-gradient(80% 80% at 70% 100%, rgba(36, 198, 97, 0.07), transparent 70%), var(--bg-3); }
.cr-graph canvas { position: absolute; inset: 0; width: 100%; height: 100%; }
.cr-center { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; pointer-events: none; gap: 6px; }
.cr-center b { font-size: 64px; font-weight: 800; font-variant-numeric: tabular-nums; text-shadow: 0 6px 30px rgba(0, 0, 0, 0.6); }
.cr-center.wait b { font-size: 46px; color: var(--yellow); }
.cr-center.bust b, .cr-center.bust span { color: var(--red); }
.cr-center.bust { animation: shake 0.45s; }
.cr-cd { width: 220px; height: 6px; border-radius: 6px; background: rgba(255, 255, 255, 0.08); overflow: hidden; }
.cr-cd i { display: block; height: 100%; background: var(--yellow); }
.cr-side { padding: 16px; display: flex; flex-direction: column; gap: 10px; }
.cr-label { font-size: 12.5px; font-weight: 600; color: var(--muted); margin-top: 4px; }
.cr-side .bet-quick { grid-template-columns: repeat(4, 1fr); }
.cr-auto .cr-x { color: var(--muted); font-weight: 700; font-size: 18px; width: 20px; text-align: center; }
.cr-auto input { flex: 1; min-width: 0; height: 100%; background: none; border: 0; outline: none; font-size: 17px; font-weight: 700; color: #fff; }
.cr-auto-q { display: grid; grid-template-columns: repeat(5, 1fr); gap: 5px; }
.cr-auto-q button { height: 30px; border-radius: 7px; background: var(--bg-4); color: var(--muted); font-size: 12px; font-weight: 600; }
.cr-auto-q button:hover { color: #fff; }
.cr-side #act { margin-top: 8px; }
.cr-note { display: flex; align-items: center; gap: 8px; padding: 10px 12px; border-radius: 10px; background: var(--bg-1); font-size: 13px; color: var(--text-2); flex-wrap: wrap; }
.cr-note .ic { width: 16px; height: 16px; color: var(--yellow); }
.cr-note.good { color: var(--green-1); background: rgba(36, 198, 97, 0.08); }
.cr-note.good .ic { color: var(--green-1); }
.cr-note.bad { color: var(--red); background: rgba(255, 77, 94, 0.08); }
.cr-note.bad .ic { color: var(--red); }
.cr-players { margin-top: 16px; padding: 14px; }
.cr-ph { display: flex; align-items: baseline; gap: 10px; margin-bottom: 6px; }
.cr-ph h3 { font-size: 16px; }
.cr-who { display: inline-flex; align-items: center; gap: 8px; }
.cr-who .avatar { width: 24px; height: 24px; }
.cr-players tr.you td { background: rgba(255, 150, 20, 0.06); }
.cr-players tr.lost td { opacity: 0.6; }
@media (max-width: 980px) {
  .cr-layout { grid-template-columns: 1fr; }
  .cr-graph { height: 320px; }
  .cr-center b { font-size: 48px; }
}

/* ================================================================== PLINKO */
.pl-layout { display: grid; grid-template-columns: 320px minmax(0, 1fr); gap: 16px; align-items: start; }
.pl-side { display: flex; flex-direction: column; gap: 20px; padding: 20px; border-radius: 16px; background: #15162a; border: 1px solid rgba(160, 170, 255, 0.09); }
.pl-sec { display: flex; flex-direction: column; gap: 10px; }
.pl-head { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; color: var(--muted); font-size: 12.5px; font-weight: 600; letter-spacing: 0.02em; }
.pl-maxwin { font-size: 12px; color: var(--muted-2); }
.pl-maxwin b, .pl-maxwin .amt { color: var(--text-2); font-weight: 700; }
.pl-maxwin .coin { width: 13px; height: 13px; }

/* amount field with ½ / 2× inside, one row of quick chips below */
.bet-inline .bet-input { height: 54px; padding: 0 6px 0 14px; gap: 10px; border-radius: 12px; background: #0d0e1a; border: 1px solid rgba(160, 170, 255, 0.1); transition: border-color 0.15s, box-shadow 0.15s; }
.bet-inline .bet-input:focus-within { border-color: rgba(255, 174, 26, 0.55); box-shadow: 0 0 0 3px rgba(255, 174, 26, 0.1); }
.bet-inline .bet-input .coin { width: 22px; height: 22px; }
.bet-inline .bet-input input { font-size: 22px; }
.bet-inline .bet-input button { flex: none; width: 40px; height: 40px; border-radius: 9px; background: #1d1e33; color: var(--text-2); font-weight: 700; font-size: 14px; transition: background 0.15s, color 0.15s; }
.bet-inline .bet-input button:hover { background: #26284a; color: #fff; }
.bet-inline .bet-quick { grid-template-columns: repeat(4, 1fr) 36px; gap: 6px; }
.bet-inline .bet-quick button { height: 32px; border-radius: 8px; background: rgba(255, 255, 255, 0.04); color: var(--muted); font-size: 12.5px; font-weight: 600; display: grid; place-items: center; }
.bet-inline .bet-quick button:hover { background: rgba(255, 255, 255, 0.08); color: #fff; }
.bet-inline .bet-quick .ic { width: 14px; height: 14px; }

/* segmented pickers */
.pl-seg { display: grid; grid-template-columns: repeat(3, 1fr); gap: 4px; padding: 4px; border-radius: 12px; background: #0d0e1a; border: 1px solid rgba(160, 170, 255, 0.08); }
.pl-seg button { display: inline-flex; align-items: center; justify-content: center; gap: 7px; height: 38px; border-radius: 9px; color: var(--muted); font-family: var(--display); font-size: 15.5px; font-weight: 700; letter-spacing: 0.04em; text-transform: uppercase; transition: background 0.15s, color 0.15s; }
.pl-seg button:hover:not(:disabled) { color: #fff; }
.pl-seg button.on { color: #fff; background: #23253d; box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.06), 0 2px 8px rgba(0, 0, 0, 0.35); }
.pl-seg button:disabled { opacity: 0.5; cursor: not-allowed; }
.pl-dot { width: 7px; height: 7px; border-radius: 50%; opacity: 0.55; }
.pl-dot.low { background: #3ecf7a; }
.pl-dot.medium { background: #f2c94c; }
.pl-dot.high { background: #e5484d; }
.pl-seg button.on .pl-dot { opacity: 1; box-shadow: 0 0 8px currentColor; }

.pl-drop { height: 58px; font-size: 22px; margin-top: 2px; }
.pl-auto { display: flex; align-items: center; gap: 6px; margin-top: -8px; }
.pl-auto-l { display: inline-flex; align-items: center; gap: 6px; margin-right: auto; color: var(--muted); font-size: 12.5px; font-weight: 600; }
.pl-auto button { height: 32px; padding: 0 12px; border-radius: 8px; background: rgba(255, 255, 255, 0.04); color: var(--text-2); font-size: 13px; font-weight: 700; transition: background 0.15s, color 0.15s; }
.pl-auto button:hover { background: rgba(255, 255, 255, 0.08); color: #fff; }
.pl-auto.running [data-auto] { display: none; }
.pl-auto .pl-stop { background: rgba(255, 77, 94, 0.14); color: #ff8592; }
.pl-auto .pl-stop:hover { background: rgba(255, 77, 94, 0.22); color: #fff; }
.pl-last { padding-top: 16px; border-top: 1px solid var(--line); }
.pl-recent { display: flex; flex-wrap: wrap; gap: 5px; min-height: 26px; }
.pl-none { color: var(--muted-2); font-size: 12.5px; }
.pl-res { padding: 3px 7px; border-radius: 6px; font-size: 11.5px; font-weight: 800; color: #1b1300; animation: pop 0.3s var(--ease); }
.pl-board { position: relative; height: 620px; background: radial-gradient(60% 50% at 50% 0%, rgba(255, 150, 20, 0.06), transparent 70%), var(--bg-3); }
.pl-board canvas { position: absolute; inset: 0; width: 100%; height: 100%; }
@media (max-width: 980px) {
  .pl-layout { grid-template-columns: 1fr; }
  .pl-board { height: 460px; order: -1; }
}

/* =================================================================== TILES */
.ti-layout { display: grid; grid-template-columns: 320px minmax(0, 1fr); gap: 16px; align-items: start; }
.ti-side { padding: 16px; display: flex; flex-direction: column; gap: 10px; }
.ti-side .bet-quick { grid-template-columns: repeat(4, 1fr); }
.bet-control.locked { opacity: 0.6; pointer-events: none; }
.ti-mines { display: flex; gap: 8px; }
.ti-mines .select { width: 86px; }
.ti-mq { flex: 1; display: grid; grid-template-columns: repeat(5, 1fr); gap: 5px; }
.ti-mq button { height: 40px; border-radius: 8px; background: var(--bg-4); color: var(--muted); font-weight: 700; }
.ti-mq button.on { color: var(--yellow); box-shadow: inset 0 0 0 1px rgba(255, 150, 20, 0.5); }
.ti-mq button:disabled { opacity: 0.5; cursor: not-allowed; }
.ti-side #act { margin-top: 6px; }
.ti-info { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 4px; }
.ti-info div { padding: 10px 12px; border-radius: 10px; background: var(--bg-1); display: flex; flex-direction: column; gap: 2px; }
.ti-info b { font-size: 16px; font-variant-numeric: tabular-nums; }
.ti-board { padding: 22px; display: grid; place-items: center; background: radial-gradient(60% 50% at 50% 0%, rgba(36, 198, 97, 0.06), transparent 70%), var(--bg-3); }
.ti-grid { width: min(100%, 560px); display: grid; grid-template-columns: repeat(5, 1fr); gap: 10px; }
.tile {
  position: relative; aspect-ratio: 1; border-radius: 12px; display: grid; place-items: center;
  background: linear-gradient(180deg, #343a47, #26283f); box-shadow: inset 0 -5px 0 rgba(0, 0, 0, 0.3), 0 4px 10px rgba(0, 0, 0, 0.25);
  transition: transform 0.12s, background 0.2s, box-shadow 0.2s, opacity 0.3s;
}
.tile .t-n { font-weight: 700; color: rgba(255, 255, 255, 0.18); font-size: 14px; }
.tile.live:hover:not(:disabled) { transform: translateY(-3px); background: linear-gradient(180deg, #3f4656, #313745); }
.tile:disabled { cursor: default; }
/* what the tile hid: the green gem (safe) or the bomb */
.tile .t-ic { width: 74%; height: 74%; animation: pop 0.35s var(--ease); }
.tile .t-ic img { display: block; width: 100%; height: 100%; object-fit: contain; filter: drop-shadow(0 4px 6px rgba(0, 0, 0, 0.45)); }
.tile.gem { background: radial-gradient(70% 70% at 50% 40%, rgba(46, 230, 140, 0.18), transparent 70%), linear-gradient(180deg, #17402f, #102c22); box-shadow: inset 0 0 0 2px rgba(46, 230, 140, 0.55), 0 0 24px -6px rgba(46, 230, 140, 0.7); }
.tile.ghost { opacity: 0.4; box-shadow: none; }
.tile.bomb { background: linear-gradient(180deg, #3a2226, #2c1a1d); box-shadow: inset 0 0 0 2px rgba(255, 77, 94, 0.35); opacity: 0.75; }
.tile.hit { opacity: 1; background: linear-gradient(180deg, #ff6170, #c42a38); box-shadow: 0 0 30px rgba(255, 77, 94, 0.7); }
/* the blast on the tile you opened */
.t-boom { position: absolute; inset: -30%; pointer-events: none; border-radius: 50%;
  background: radial-gradient(circle, #fff6c8 0%, #ffcf4a 18%, #ff7a1a 38%, rgba(220, 40, 10, 0.55) 55%, transparent 70%);
  animation: tiBoom 0.7s ease-out forwards; }
@keyframes tiBoom { from { transform: scale(0.2); opacity: 1; } 60% { opacity: 0.9; } to { transform: scale(1.35); opacity: 0; } }
@media (max-width: 980px) {
  .ti-layout { grid-template-columns: 1fr; }
  .ti-board { order: -1; padding: 14px; }
  .ti-grid { gap: 7px; }
}

/* ================================================================ COINFLIP */
.cf-create { display: flex; align-items: center; gap: 16px; padding: 16px; flex-wrap: wrap; }
.cf-sides { display: flex; gap: 8px; }
.cf-side { display: flex; align-items: center; gap: 8px; height: 50px; padding: 0 14px; border-radius: 11px; background: var(--bg-1); border: 1px solid var(--line); color: var(--muted); font-weight: 600; }
.cf-side .face { width: 30px; height: 30px; }
.cf-side.on { color: #fff; border-color: var(--yellow); background: rgba(255, 150, 20, 0.08); }
.cf-side.red.on { border-color: #e5484d; background: rgba(229, 72, 77, 0.12); }
.cf-side.blue.on { border-color: #3d7bf0; background: rgba(61, 123, 240, 0.12); }
.cf-create .bet-control { flex: 1; min-width: 280px; flex-direction: row; align-items: center; }
.cf-create .bet-input { flex: 1; }
.cf-create .bet-quick { flex: 1.3; }
.cf-list { display: flex; flex-direction: column; gap: 10px; }
.cf-row { display: grid; grid-template-columns: minmax(0, 1fr) 150px minmax(0, 1fr) 210px; align-items: center; gap: 14px; padding: 12px 16px; border-radius: 14px; background: linear-gradient(90deg, #1b1c30, #161728); border: 1px solid var(--line); animation: fadeUp 0.3s var(--ease); }
.cf-row.mine { border-color: rgba(255, 150, 20, 0.4); }
.cf-player { display: flex; align-items: center; gap: 10px; min-width: 0; transition: opacity 0.3s; }
.cf-player > div { display: flex; align-items: center; gap: 6px; min-width: 0; }
.cf-player b { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cf-player.win b { color: var(--yellow); }
.cf-player.lose { opacity: 0.45; }
.cf-q { width: 30px; height: 30px; border-radius: 50%; border: 1.5px dashed var(--line-2); display: grid; place-items: center; color: var(--muted-2); font-weight: 700; }
.cf-chip { width: 28px; height: 28px; flex: none; margin-left: auto; }
.cf-chip .face { width: 100%; height: 100%; }
.cf-mid { display: flex; flex-direction: column; align-items: center; gap: 6px; perspective: 600px; }
.cf-amt { font-size: 15px; }
.cf-coin { position: relative; width: 56px; height: 56px; transform-style: preserve-3d; }
.cf-face { position: absolute; inset: 0; backface-visibility: hidden; }
.cf-face .face { width: 100%; height: 100%; }
.cf-face.back { transform: rotateY(180deg); }
.cf-coin.flipping { animation: cfFlip var(--dur) cubic-bezier(0.15, 0.6, 0.2, 1) forwards; }
.cf-coin.landed[data-result='blue'] { transform: rotateY(180deg); }
@keyframes cfFlip { from { transform: rotateY(0deg) translateY(0); } 40% { transform: rotateY(calc(var(--turns) * 140deg)) translateY(-12px); } to { transform: rotateY(calc(var(--turns) * 360deg)) translateY(0); } }
/* the flip popup (your own flips): the two players and a big coin tossed between them */
.cfp { position: fixed; inset: 0; z-index: 190; display: grid; place-items: center; padding: 16px; background: rgba(6, 7, 14, 0.72); backdrop-filter: blur(6px); animation: cfpFade 0.25s ease; }
.cfp.out { animation: cfpFade 0.22s ease reverse forwards; }
.cfp-card {
  position: relative; width: min(600px, 100%); display: grid; grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr); align-items: center; gap: 12px;
  padding: 30px 22px 22px; border-radius: 18px; border: 1px solid var(--line-2); box-shadow: 0 30px 80px rgba(0, 0, 0, 0.65);
  background: radial-gradient(70% 60% at 50% 30%, rgba(255, 190, 60, 0.08), transparent 70%), linear-gradient(180deg, #1c1e34, #131425);
  animation: cfpIn 0.35s var(--ease);
}
.cfp-player { display: flex; flex-direction: column; align-items: center; gap: 8px; min-width: 0; transition: opacity 0.4s, transform 0.4s var(--ease); }
.cfp-player .avatar { width: 72px; height: 72px; border-radius: 16px; }
.cfp-player b { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-family: var(--display); font-size: 19px; }
.cfp-chip { display: inline-flex; align-items: center; gap: 6px; padding: 3px 10px 3px 3px; border-radius: 99px; font-family: var(--display); font-weight: 800; font-size: 14px; }
.cfp-chip .face { width: 24px; height: 24px; }
.cfp-chip em { font-style: normal; }
.cfp-chip.red { background: rgba(229, 72, 77, 0.18); color: #ff9a9a; }
.cfp-chip.blue { background: rgba(61, 123, 240, 0.18); color: #a9c4ff; }
.cfp-player.win { transform: scale(1.06); }
.cfp-player.win b { color: var(--yellow); }
.cfp-player.lose { opacity: 0.35; transform: scale(0.95); }
.cfp-stage { position: relative; width: 170px; height: 210px; display: grid; place-items: center; perspective: 900px; }
.cfp-coin { position: relative; width: 140px; height: 140px; transform-style: preserve-3d; }
.cfp-face { position: absolute; inset: 0; backface-visibility: hidden; }
.cfp-face .face { width: 100%; height: 100%; }
.cfp-face.blue { transform: rotateY(180deg); }
.cfp-coin.spin { animation: cfpSpin var(--dur) cubic-bezier(0.22, 0.6, 0.18, 1) forwards; }
.cfp-shadow { position: absolute; bottom: 12px; left: 50%; width: 112px; height: 16px; margin-left: -56px; border-radius: 50%; background: radial-gradient(closest-side, rgba(0, 0, 0, 0.6), transparent); animation: cfpShadow var(--dur) cubic-bezier(0.22, 0.6, 0.18, 1) forwards; }
.cfp.landed .cfp-stage::after { content: ''; position: absolute; left: 15px; right: 15px; top: 35px; aspect-ratio: 1; border-radius: 50%; pointer-events: none; animation: cfpRing 0.9s ease-out forwards; }
.cfp.won .cfp-stage::after { box-shadow: 0 0 0 3px rgba(255, 200, 60, 0.85), 0 0 40px rgba(255, 190, 40, 0.6); }
.cfp.lost .cfp-stage::after { box-shadow: 0 0 0 3px rgba(255, 255, 255, 0.35); }
.cfp-result { grid-column: 1 / -1; display: flex; justify-content: center; align-items: center; gap: 8px; margin-top: 4px; font-family: var(--display); font-size: 24px; font-weight: 800; letter-spacing: 0.02em; text-transform: uppercase; }
.cfp-result .muted { font-family: var(--font); font-size: 16px; font-weight: 600; text-transform: none; letter-spacing: 0; }
@keyframes cfpSpin { 0% { transform: translateY(0) rotateY(0deg) scale(1); } 42% { transform: translateY(-80px) rotateY(calc(var(--end) * 0.6)) scale(1.18); } 100% { transform: translateY(0) rotateY(var(--end)) scale(1); } }
@keyframes cfpShadow { 0% { transform: scale(1); opacity: 1; } 42% { transform: scale(0.45); opacity: 0.35; } 100% { transform: scale(1); opacity: 1; } }
@keyframes cfpIn { from { transform: translateY(16px) scale(0.92); opacity: 0; } }
@keyframes cfpFade { from { opacity: 0; } }
@keyframes cfpRing { from { transform: scale(0.85); opacity: 1; } to { transform: scale(1.3); opacity: 0; } }
@media (max-width: 560px) {
  .cfp-card { gap: 6px; padding: 24px 12px 16px; }
  .cfp-stage { width: 116px; height: 160px; }
  .cfp-coin { width: 100px; height: 100px; }
  .cfp-player .avatar { width: 52px; height: 52px; }
  .cfp-player b { font-size: 15px; }
  .cfp.landed .cfp-stage::after { left: 8px; right: 8px; top: 30px; }
}
.cf-act { display: flex; justify-content: flex-end; }
.cf-act .btn { min-width: 150px; }
.cf-won { display: inline-flex; align-items: center; gap: 6px; color: var(--yellow); font-weight: 600; font-size: 13px; text-align: right; }
@media (max-width: 900px) {
  .cf-row { grid-template-columns: 1fr auto 1fr; }
  .cf-act { grid-column: 1 / -1; justify-content: center; }
  .cf-create .bet-control { flex-direction: column; align-items: stretch; }
}
