:root {
  --text: #ff4f00;
  --bg: #000000;
  --accent: var(--text);
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }

body {
  margin: 0;
  overflow-x: hidden;
  background: var(--bg);
  color: var(--text);
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  line-height: 1.6;
  transition: background-color 0.5s ease, color 0.5s ease;
}

a { color: var(--text); }

.wrap { max-width: 1240px; margin: 0 auto; padding: 0 16px; }

/* Header */
.header {
  display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 10px;
  padding-top: 28px; padding-bottom: 18px;
  border-bottom: 1px solid var(--text);
}
.logo { font-weight: 800; font-size: 1.4rem; letter-spacing: 3px; text-decoration: none; }
nav { display: flex; align-items: center; }
nav a { margin-left: 20px; text-decoration: none; opacity: 0.75; }
nav a:hover, nav a.active { opacity: 1; }
nav a.active { text-decoration: underline; text-underline-offset: 6px; }

/* Casino dropdown */
.nav-drop { position: relative; display: inline-flex; align-items: center; }
.nav-caret {
  background: none; border: none; color: inherit; cursor: pointer;
  font-size: 0.7rem; padding: 0 2px; opacity: 0.75; line-height: 1;
}
.nav-caret:hover { opacity: 1; }
.dropdown-menu {
  position: absolute; top: calc(100% + 12px); left: 50%;
  transform: translateX(-50%) translateY(-6px);
  min-width: 190px; padding: 6px; z-index: 60;
  background: var(--bg); border: 1px solid var(--accent); border-radius: 12px;
  box-shadow: 0 18px 40px rgba(0, 0, 0, 0.6);
  display: flex; flex-direction: column; gap: 2px;
  opacity: 0; pointer-events: none; transition: opacity 0.16s ease, transform 0.16s ease;
}
.nav-drop:hover .dropdown-menu,
.nav-drop.open .dropdown-menu { opacity: 1; pointer-events: auto; transform: translateX(-50%) translateY(0); }
.menu-item {
  display: flex; align-items: center; gap: 10px; width: 100%; text-align: left;
  background: none; border: none; color: var(--text); font: inherit; font-size: 0.9rem;
  padding: 8px 10px; border-radius: 8px; cursor: pointer;
}
.menu-item:hover { background: color-mix(in srgb, var(--text) 14%, transparent); }

/* Auth box */
.auth-box { display: flex; align-items: center; gap: 10px; font-size: 0.9rem; }
.chips-badge {
  display: none;
  font-weight: 700; border: 1px solid var(--accent); border-radius: 20px; padding: 3px 12px;
}
body.casino-mode .chips-badge { display: inline-block; }
.auth-email { opacity: 0.7; max-width: 200px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* Three-column shell: filler rails flank the main column */
main { padding-top: 12px; }
.layout {
  display: grid;
  grid-template-columns: minmax(0, 250px) minmax(0, 720px) minmax(0, 250px);
  justify-content: center; align-items: start; gap: 28px;
}
.layout-main { min-width: 0; }
.rail { display: flex; flex-direction: column; gap: 14px; padding-top: 22px; }
.rail-card {
  border: 1px solid color-mix(in srgb, var(--text) 22%, transparent);
  border-radius: 12px; padding: 14px;
}
.rail-card h4 {
  margin: 0 0 10px; font-size: 0.7rem; text-transform: uppercase;
  letter-spacing: 1.6px; opacity: 0.6; font-weight: 700;
}
.rail-note { margin: 0; font-size: 0.8rem; opacity: 0.7; }
.rail-news { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 10px; }
.rail-news li { display: flex; flex-direction: column; }
.rail-news time { font-size: 0.68rem; opacity: 0.55; }
.rail-news a { font-size: 0.85rem; text-decoration: none; line-height: 1.35; }
.rail-news a:hover { text-decoration: underline; }
.rail-more { display: inline-block; margin-top: 12px; font-size: 0.78rem; opacity: 0.75; text-decoration: none; }
.rail-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; font-size: 0.82rem; }
.rail-list li { opacity: 0.8; }
.rail-links button, .rail-links a {
  background: none; border: none; padding: 0; color: var(--text); font: inherit;
  cursor: pointer; text-decoration: none; opacity: 0.85;
}
.rail-links button:hover, .rail-links a:hover { opacity: 1; text-decoration: underline; }
.rail-stack { margin: 0; font-size: 1.6rem; font-weight: 800; color: var(--accent); line-height: 1.2; }
.rail-release { margin: 0 0 2px; font-size: 0.9rem; }
.rail-card .btn { margin-top: 10px; }
.rail-teaser { border-color: color-mix(in srgb, var(--accent) 45%, transparent); }

/* Leaderboard */
.leader-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.leader-row {
  display: flex; align-items: center; gap: 8px; font-size: 0.82rem;
  padding: 3px 6px; border-radius: 7px;
}
.leader-row.leader-me { background: color-mix(in srgb, var(--accent) 18%, transparent); font-weight: 700; }
.leader-rank {
  width: 19px; height: 19px; flex-shrink: 0; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 0.62rem; font-weight: 800;
  background: rgba(255, 255, 255, 0.12);
}
.leader-rank.rank-1 { background: #e8c46a; color: #14161a; }
.leader-rank.rank-2 { background: #c9ccd1; color: #14161a; }
.leader-rank.rank-3 { background: #c98a52; color: #14161a; }
.leader-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.leader-chips { font-weight: 700; color: var(--accent); font-size: 0.78rem; }

h2 {
  font-size: 0.8rem; text-transform: uppercase; letter-spacing: 2px;
  margin: 40px 0 8px; opacity: 0.6; font-weight: 600;
}

/* Project rows */
.row {
  display: flex; justify-content: space-between; align-items: flex-start; gap: 16px;
  padding: 18px 0;
  border-bottom: 1px solid color-mix(in srgb, var(--text) 25%, transparent);
}
.row-main { min-width: 0; }
.row h3 { margin: 0; font-size: 1.1rem; }
.row p { margin: 4px 0 0; opacity: 0.75; font-size: 0.95rem; }
.row-side { display: flex; align-items: center; gap: 14px; flex-shrink: 0; }
.version { font-size: 0.85rem; opacity: 0.75; }

.btn {
  display: inline-block; padding: 6px 14px; border: 1px solid var(--text); border-radius: 6px;
  text-decoration: none; font-size: 0.9rem; font-weight: 600;
  cursor: pointer; background: none; color: var(--text); font-family: inherit;
}
.btn:hover { background: var(--text); color: var(--bg); }
.btn-ghost { border-color: color-mix(in srgb, var(--text) 40%, transparent); opacity: 0.85; }
.btn-gold { border-color: var(--accent); color: var(--accent); font-weight: 700; }
.btn-gold:hover { background: var(--accent); color: #14161a; }
.btn:disabled { opacity: 0.4; cursor: default; }
.btn:disabled:hover { background: none; color: var(--text); }

details { margin-top: 8px; font-size: 0.88rem; }
summary { cursor: pointer; opacity: 0.6; }
.older { list-style: none; padding: 0; margin: 6px 0 0; }
.older li { padding: 4px 0; opacity: 0.85; }

/* News */
.news-item { padding: 14px 0; border-bottom: 1px solid color-mix(in srgb, var(--text) 25%, transparent); }
.news-item time { font-size: 0.8rem; opacity: 0.6; }
.news-item h3 { margin: 2px 0; font-size: 1rem; }
.news-item p { margin: 0; opacity: 0.75; font-size: 0.95rem; }

.empty { opacity: 0.6; }
.footer { padding-top: 48px; padding-bottom: 32px; font-size: 0.8rem; opacity: 0.5; }

/* ============================================================
   Casino — felt table theme
   ============================================================ */

body.casino-mode {
  --text: #f4f6f3;
  --bg: #0c5137;
  --accent: #e8c46a;
  background-color: #0c5137;
  background-image:
    radial-gradient(ellipse 120% 70% at 50% -10%, rgba(255, 255, 255, 0.10), transparent 60%),
    radial-gradient(ellipse 130% 45% at 50% 118%, rgba(0, 0, 0, 0.26), transparent 70%),
    repeating-linear-gradient(45deg, rgba(0, 0, 0, 0.05) 0 2px, transparent 2px 4px),
    repeating-linear-gradient(-45deg, rgba(0, 0, 0, 0.04) 0 2px, transparent 2px 4px);
  background-attachment: fixed;
}
body.casino-mode .header { border-bottom-color: color-mix(in srgb, var(--accent) 55%, transparent); }
body.casino-mode .logo { color: var(--accent); }

.casino-head {
  display: flex; justify-content: space-between; align-items: center;
  gap: 12px; flex-wrap: wrap; margin: 20px 0 16px;
}
.casino-title {
  margin: 0; font-size: 1.25rem; letter-spacing: 4px; text-transform: uppercase;
  font-weight: 800; color: var(--accent); opacity: 1;
}
.casino-head-right { display: flex; align-items: center; gap: 10px; }
.stack-badge { font-size: 0.85rem; border: 1px solid var(--accent); border-radius: 20px; padding: 4px 14px; }
.casino-locked { text-align: center; padding: 40px 0; }

.casino-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 14px; }
.casino-tile {
  display: flex; align-items: center; gap: 14px; text-align: left; padding: 16px;
  border: 1px solid color-mix(in srgb, var(--text) 22%, transparent); border-radius: 14px;
  background: linear-gradient(160deg, rgba(255, 255, 255, 0.08), rgba(0, 0, 0, 0.2));
  color: var(--text); font: inherit; cursor: pointer;
  transition: transform 0.15s ease, border-color 0.15s ease, box-shadow 0.15s ease;
}
.casino-tile:hover { transform: translateY(-3px); border-color: var(--accent); box-shadow: 0 12px 28px rgba(0, 0, 0, 0.45); }
.tile-icon { font-size: 1.9rem; line-height: 1; }
.casino-tile h3 { margin: 0; font-size: 1rem; }
.casino-tile p { margin: 2px 0 0; font-size: 0.8rem; opacity: 0.72; }

/* Modal */
.modal-overlay {
  position: fixed; inset: 0; background: rgba(0, 0, 0, 0.78);
  display: flex; align-items: center; justify-content: center; z-index: 100; padding: 16px;
}
.modal-box {
  background: var(--bg); border: 1px solid var(--accent); border-radius: 14px;
  width: 100%; max-width: 760px; max-height: 90vh;
  display: flex; flex-direction: column; overflow: hidden;
  box-shadow: 0 30px 70px rgba(0, 0, 0, 0.6);
}
body.casino-mode .modal-box { background: #0d5b3d; }
.modal-bar {
  display: flex; justify-content: space-between; align-items: center;
  padding: 12px 16px; border-bottom: 1px solid color-mix(in srgb, var(--accent) 40%, transparent);
  font-weight: 700; letter-spacing: 0.5px; color: var(--accent);
}
.modal-close { border: none; background: none; color: var(--text); font-size: 1rem; padding: 4px 8px; cursor: pointer; }
.modal-body { padding: 18px; overflow-y: auto; }

/* Forms */
.auth-form, .lobby-create { display: flex; flex-direction: column; gap: 10px; max-width: 320px; }
.lobby-create { flex-direction: row; max-width: none; margin-bottom: 14px; }
.lobby-create input { flex: 1; min-width: 0; }
input, select {
  background: rgba(0, 0, 0, 0.25); color: var(--text);
  border: 1px solid color-mix(in srgb, var(--text) 40%, transparent);
  border-radius: 6px; padding: 7px 10px; font-family: inherit; font-size: 0.9rem;
}
label { display: flex; flex-direction: column; gap: 4px; font-size: 0.85rem; opacity: 0.85; }
.auth-err { color: #ff8d8d; min-height: 1em; font-size: 0.85rem; margin: 0; }
.auth-toggle { font-size: 0.85rem; opacity: 0.75; }

/* Rooms list */
.room-list { display: flex; flex-direction: column; gap: 8px; }
.room-row {
  display: flex; justify-content: space-between; align-items: center; gap: 12px;
  border: 1px solid color-mix(in srgb, var(--text) 25%, transparent); border-radius: 8px; padding: 10px 14px;
}

/* Game panels */
.game-panel { display: flex; flex-direction: column; gap: 16px; align-items: center; text-align: center; }
.game-msg { margin: 0; opacity: 0.9; min-height: 1.4em; }
.bet-row { display: flex; align-items: flex-end; gap: 10px; flex-wrap: wrap; justify-content: center; }
.bet-row input[type="number"] { width: 100px; }

/* ---- Slots ---- */
.slot-machine {
  background: linear-gradient(#32220f, #170f07); border: 3px solid var(--accent);
  border-radius: 20px; padding: 14px; box-shadow: 0 18px 44px rgba(0, 0, 0, 0.55);
}
.slot-machine.slot-win { animation: slotWin 0.45s ease-in-out 3; }
@keyframes slotWin { 50% { box-shadow: 0 0 40px rgba(232, 196, 106, 0.85); } }
.slot-top { display: flex; align-items: center; justify-content: center; gap: 12px; margin-bottom: 10px; }
.slot-title { font-weight: 800; letter-spacing: 4px; color: var(--accent); font-size: 0.78rem; }
.slot-bulb {
  width: 10px; height: 10px; border-radius: 50%; background: var(--accent);
  box-shadow: 0 0 10px var(--accent); animation: bulb 1.3s infinite alternate;
}
@keyframes bulb { from { opacity: 0.35; } to { opacity: 1; } }
.reels { position: relative; display: flex; gap: 8px; justify-content: center; background: #08080a; padding: 8px; border-radius: 12px; }
.reel-window {
  width: 76px; height: 228px; overflow: hidden; border-radius: 8px;
  background: linear-gradient(#fdfdf8, #e4e2d6);
  box-shadow: inset 0 16px 20px -12px rgba(0, 0, 0, 0.75), inset 0 -16px 20px -12px rgba(0, 0, 0, 0.75);
}
.reel-cell { height: 76px; display: flex; align-items: center; justify-content: center; font-size: 2.4rem; }
.payline {
  position: absolute; left: 10px; right: 10px; top: 50%; height: 2px;
  background: rgba(232, 196, 106, 0.9); box-shadow: 0 0 10px rgba(232, 196, 106, 0.8);
}
.slot-paytable {
  display: flex; flex-wrap: wrap; justify-content: center; gap: 10px;
  margin-top: 10px; font-size: 0.7rem; opacity: 0.75; color: #f0e2c2;
}

/* ---- Roulette ---- */
.wheel-wrap { position: relative; width: 230px; height: 230px; }
.wheel { width: 100%; height: 100%; display: block; filter: drop-shadow(0 12px 24px rgba(0, 0, 0, 0.55)); }
.ball-orbit { position: absolute; inset: 0; pointer-events: none; }
.ball {
  position: absolute; top: 10px; left: 50%; transform: translateX(-50%);
  width: 11px; height: 11px; border-radius: 50%;
  background: radial-gradient(circle at 32% 30%, #fff, #b4b4aa);
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.7);
}
.wheel-result {
  position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%);
  width: 60px; height: 60px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 1.5rem; font-weight: 800; color: #fff;
  background: #2a1d10; border: 2px solid var(--accent);
}
.wheel-result.color-red { background: #b1232b; }
.wheel-result.color-black { background: #16181c; }
.wheel-result.color-green { background: #127a45; }

.rtable {
  display: grid; width: 100%; max-width: 470px; gap: 4px;
  grid-template-columns: 30px minmax(0, 1fr) 42px;
  grid-template-areas: "zero nums cols" "dz dozens dz2" "out outside out2";
}
.rzero { grid-area: zero; background: #127a45; }
.rnums { grid-area: nums; display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); grid-template-rows: repeat(3, 1fr); gap: 2px; }
.rcols { grid-area: cols; display: grid; grid-template-rows: repeat(3, 1fr); gap: 2px; }
.rdozens { grid-area: dozens; display: grid; grid-template-columns: repeat(3, 1fr); gap: 2px; }
.routside { grid-area: outside; display: grid; grid-template-columns: repeat(6, 1fr); gap: 2px; }
.rcell {
  border: 1px solid rgba(255, 255, 255, 0.3); background: #0f5c3e; color: #fff;
  font: inherit; font-size: 0.62rem; font-weight: 700; padding: 6px 2px;
  border-radius: 4px; cursor: pointer; min-width: 0;
}
.rcell:hover { filter: brightness(1.3); }
.rcell.r-red { background: #b1232b; }
.rcell.r-black { background: #16181c; }
.rcell.picked { outline: 2px solid var(--accent); box-shadow: 0 0 12px rgba(232, 196, 106, 0.8); }

/* ---- Craps ---- */
.craps-felt {
  width: 100%; max-width: 460px; padding: 18px 16px;
  border: 2px solid var(--accent); border-radius: 90px / 36px;
  background: radial-gradient(ellipse at 50% 20%, rgba(255, 255, 255, 0.08), transparent 70%);
}
.pass-line {
  text-align: center; font-size: 0.66rem; letter-spacing: 3px; font-weight: 800; color: var(--accent);
  border-bottom: 1px solid color-mix(in srgb, var(--accent) 40%, transparent); padding-bottom: 8px;
}
.point-row { display: flex; justify-content: center; gap: 6px; margin: 14px 0; }
.point-box {
  width: 34px; height: 34px; border: 1px solid rgba(255, 255, 255, 0.4); border-radius: 6px;
  display: flex; align-items: center; justify-content: center; font-weight: 800; font-size: 0.85rem;
}
.point-box.on { background: var(--accent); color: #14161a; box-shadow: 0 0 14px rgba(232, 196, 106, 0.75); }
.dice-row { display: flex; gap: 16px; justify-content: center; }
.die-svg { width: 64px; height: 64px; display: block; }
.die.rolling { animation: tumble 0.5s ease-out; }
@keyframes tumble {
  0% { transform: rotate(0) translateY(0); }
  30% { transform: rotate(210deg) translateY(-28px); }
  65% { transform: rotate(430deg) translateY(4px); }
  100% { transform: rotate(720deg) translateY(0); }
}
.puck {
  width: 38px; height: 38px; border-radius: 50%; background: #16181c; color: #fff;
  border: 2px solid #fff; display: inline-flex; align-items: center; justify-content: center;
  font-size: 0.55rem; font-weight: 800;
}
.puck.on { background: #fff; color: #14161a; }
.point-badge { font-weight: 700; border: 1px solid var(--accent); border-radius: 6px; padding: 7px 12px; }

/* ---- Horse races ---- */
.horses-panel { width: 100%; }
.track {
  --runner-w: 72px;
  position: relative; width: 100%; border-radius: 12px; overflow: hidden; padding: 6px 0;
  border: 2px solid var(--accent);
  background: repeating-linear-gradient(90deg, #0e6b47 0 42px, #0b5c3d 42px 84px);
}
.track-rail { height: 6px; background: linear-gradient(#f3f3ee, #c9c9c0); opacity: 0.85; }
.lane { position: relative; height: 52px; border-bottom: 1px dashed rgba(255, 255, 255, 0.16); }
.lane:last-of-type { border-bottom: none; }
.lane-no {
  position: absolute; left: 5px; top: 50%; transform: translateY(-50%); z-index: 2;
  width: 19px; height: 19px; border-radius: 50%; background: var(--silk); color: #fff;
  font-size: 0.6rem; font-weight: 800; display: flex; align-items: center; justify-content: center;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.6);
}
.runner { position: absolute; bottom: 3px; left: 0; width: var(--runner-w); }
.runner.winner { filter: drop-shadow(0 0 10px var(--accent)); }
.horse-svg { width: 100%; display: block; }
.h-leg { transform-box: fill-box; transform-origin: 50% 0%; }
.track.running .runner { animation: bob 0.22s linear infinite; }
.track.running .h-leg-a, .track.running .h-leg-d { animation: legA 0.22s linear infinite; }
.track.running .h-leg-b, .track.running .h-leg-c { animation: legB 0.22s linear infinite; }
@keyframes bob { 50% { transform: translateY(-3px); } }
@keyframes legA { 0%, 100% { transform: rotate(24deg); } 50% { transform: rotate(-24deg); } }
@keyframes legB { 0%, 100% { transform: rotate(-24deg); } 50% { transform: rotate(24deg); } }
.finish-line {
  position: absolute; top: 0; bottom: 0; right: 10px; width: 12px;
  background: repeating-linear-gradient(0deg, #fff 0 8px, #16181c 8px 16px);
}
.finish-line span {
  position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%) rotate(90deg);
  font-size: 0.5rem; letter-spacing: 2px; color: #fff; white-space: nowrap; text-shadow: 0 0 4px #000;
}
.odds-board { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 6px; width: 100%; }
.odds-row {
  display: flex; align-items: center; gap: 9px; text-align: left; cursor: pointer;
  background: rgba(0, 0, 0, 0.25); border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 8px; padding: 8px 10px; color: var(--text); font: inherit; font-size: 0.82rem;
}
.odds-row.picked { border-color: var(--accent); background: rgba(232, 196, 106, 0.16); }
.silk-dot { width: 12px; height: 12px; border-radius: 50%; flex-shrink: 0; }
.odds-name { flex: 1; }
.odds-mult { font-weight: 800; color: var(--accent); }
.photo-finish { display: flex; flex-wrap: wrap; gap: 10px; justify-content: center; font-size: 0.78rem; }
.pf-row { display: flex; align-items: center; gap: 6px; opacity: 0.75; }
.pf-mine { opacity: 1; color: var(--accent); font-weight: 700; }

/* ---- Playing cards ---- */
.card {
  position: relative; display: inline-block; width: 52px; height: 74px; margin: 3px;
  border-radius: 7px; vertical-align: middle; font-weight: 700; color: #14161a;
  background: linear-gradient(160deg, #ffffff, #ece9dd);
  box-shadow: 0 3px 9px rgba(0, 0, 0, 0.45), inset 0 0 0 1px rgba(0, 0, 0, 0.14);
}
.card-red { color: #c0272d; }
.card-ix { position: absolute; display: flex; flex-direction: column; align-items: center; font-size: 0.74rem; line-height: 1; }
.card-ix b { font-size: 0.68rem; }
.card-ix-tl { top: 5px; left: 5px; }
.card-ix-br { bottom: 5px; right: 5px; transform: rotate(180deg); }
.card-mid { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; }
.card-spot { font-size: 1.9rem; line-height: 1; }
.card-face { font-size: 1.5rem; line-height: 1; }
.card-face-suit { font-size: 0.8rem; line-height: 1; }
.card-back {
  background: repeating-linear-gradient(45deg, #b1232b 0 7px, #8c1a21 7px 14px);
  box-shadow: inset 0 0 0 3px #f3f3ee, inset 0 0 0 4px #8c1a21, 0 3px 9px rgba(0, 0, 0, 0.45);
}

/* ---- Chips ---- */
.chip-stack { display: inline-flex; vertical-align: middle; }
.chip {
  width: 26px; height: 26px; border-radius: 50%; margin-left: -9px;
  display: inline-flex; align-items: center; justify-content: center;
  font-size: 0.5rem; font-weight: 800; color: #fff; font-style: normal;
  border: 2px dashed rgba(255, 255, 255, 0.85); box-shadow: 0 2px 5px rgba(0, 0, 0, 0.55);
}
.chip:first-child { margin-left: 0; }
.chip i { font-style: normal; }
.chip-white { background: #ecebe4; color: #222; border-color: rgba(0, 0, 0, 0.35); }
.chip-red { background: #b1232b; }
.chip-green { background: #17724e; }
.chip-black { background: #1b1d22; }
.chip-purple { background: #5b3d8a; }

/* ---- Live tables (blackjack / poker) ---- */
.table-view { display: flex; flex-direction: column; gap: 14px; overflow-x: auto; }

.felt-table {
  position: relative; width: 100%; min-width: 540px; aspect-ratio: 16 / 10; min-height: 400px;
  border-radius: 46% / 40%;
  background:
    radial-gradient(ellipse at 50% 34%, #1a8d5f 0%, #0e6243 52%, #07402a 100%);
  border: 11px solid #4b3519;
  box-shadow:
    inset 0 0 0 3px rgba(232, 196, 106, 0.3),
    inset 0 0 80px rgba(0, 0, 0, 0.45),
    0 22px 48px rgba(0, 0, 0, 0.5);
}
.felt-inlay {
  position: absolute; inset: 7% 5%; border-radius: 46% / 40%;
  border: 1px dashed rgba(232, 196, 106, 0.28); pointer-events: none;
}
.felt-legend {
  position: absolute; top: 27%; left: 50%; transform: translateX(-50%);
  width: 46%; opacity: 0.3; pointer-events: none;
}
.felt-legend text { fill: var(--accent); font-size: 17px; font-weight: 700; letter-spacing: 2px; }

.table-status {
  position: absolute; top: 14px; left: 50%; transform: translateX(-50%); white-space: nowrap;
  font-weight: 800; letter-spacing: 1.5px; text-transform: uppercase; font-size: 0.8rem;
  color: var(--accent); text-shadow: 0 2px 8px rgba(0, 0, 0, 0.7);
}
.turn-timer {
  position: absolute; top: 40px; left: 28%; right: 28%; height: 5px;
  border-radius: 3px; background: rgba(0, 0, 0, 0.4); overflow: hidden;
}
.turn-timer span { display: block; height: 100%; width: 0; background: linear-gradient(90deg, #e8c46a, #ff8a3d); }

/* Dealer + shoe (blackjack) */
.dealer-zone { position: absolute; top: 17%; left: 50%; transform: translateX(-50%); text-align: center; }
.dealer-badge {
  display: inline-block; margin-bottom: 8px; padding: 2px 14px; border-radius: 20px;
  font-size: 0.66rem; font-weight: 800; letter-spacing: 2px;
  background: rgba(0, 0, 0, 0.35); border: 1px solid rgba(232, 196, 106, 0.5); color: var(--accent);
}
.shoe { position: absolute; top: 11%; right: 9%; width: 46px; height: 34px; }
.shoe i {
  position: absolute; inset: 0; border-radius: 4px;
  background: repeating-linear-gradient(45deg, #b1232b 0 5px, #8c1a21 5px 10px);
  box-shadow: inset 0 0 0 2px #f3f3ee;
}
.shoe i:nth-child(2) { transform: translate(3px, -3px); }
.shoe i:nth-child(3) { transform: translate(6px, -6px); }

/* Seat pods */
.seat-pod {
  --pod-w: 150px;
  position: absolute; left: var(--px); top: var(--py); transform: translate(-50%, -50%);
  width: var(--pod-w); border-radius: 14px; text-align: center; z-index: 2;
}
.pk-pod { --pod-w: 120px; }
.seat-pod .pod-live { display: none; }
.seat-pod.occupied .pod-live { display: block; }
.seat-pod.occupied .pod-empty { display: none; }
.pod-empty {
  border: 1px dashed rgba(255, 255, 255, 0.3); border-radius: 50px; padding: 12px 0;
  font-size: 0.6rem; letter-spacing: 2px; opacity: 0.45;
}
.seat-pod.occupied {
  background: linear-gradient(180deg, rgba(0, 0, 0, 0.3), rgba(0, 0, 0, 0.5));
  border: 1px solid rgba(255, 255, 255, 0.18); padding: 8px 6px 10px;
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.4);
}
.seat-pod.is-you { border-color: var(--accent); }
.seat-pod.folded { opacity: 0.42; }
.seat-pod.disconnected { filter: grayscale(0.6); }
.seat-pod.res-win, .seat-pod.winner { background: linear-gradient(180deg, rgba(34, 197, 94, 0.4), rgba(0, 0, 0, 0.45)); }
.seat-pod.res-lose { background: linear-gradient(180deg, rgba(177, 35, 43, 0.4), rgba(0, 0, 0, 0.45)); }
.seat-pod.res-push { background: linear-gradient(180deg, rgba(232, 196, 106, 0.3), rgba(0, 0, 0, 0.45)); }

.seat-plate {
  display: flex; flex-direction: column; line-height: 1.25; margin-top: 4px;
}
.seat-name { font-weight: 700; font-size: 0.72rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.seat-stack { font-size: 0.7rem; color: var(--accent); font-weight: 700; }
.seat-result {
  position: absolute; bottom: -9px; left: 50%; transform: translateX(-50%); white-space: nowrap;
  font-size: 0.58rem; font-weight: 800; letter-spacing: 0.5px; padding: 2px 8px; border-radius: 10px;
  background: rgba(0, 0, 0, 0.72); color: var(--accent);
}
.seat-result:empty { display: none; }
.bet-spot { min-height: 28px; display: flex; align-items: center; justify-content: center; }

/* Hands */
.hand { display: flex; justify-content: center; align-items: flex-end; min-height: 0; }
.hand:not(:empty) { min-height: 76px; }
.pk-pod .hand:not(:empty) { min-height: 58px; }
.card-slot { display: inline-block; line-height: 0; }
.card-slot + .card-slot { margin-left: -26px; }
/* Small hands don't need to be squeezed — fan them out more. */
.hand .card-slot:first-child:nth-last-child(2) ~ .card-slot { margin-left: -9px; }
.hand .card-slot:first-child:nth-last-child(3) ~ .card-slot { margin-left: -17px; }
.hand .card-slot:hover { z-index: 5; position: relative; }
.hand-total {
  display: inline-block; min-width: 26px; margin-top: 2px; padding: 0 7px; border-radius: 10px;
  font-size: 0.7rem; font-weight: 800; background: rgba(0, 0, 0, 0.5); color: #fff;
}
.hand-total:empty { display: none; }
.hand-total.bust { background: #b1232b; }
.hand-total.blackjack { background: var(--accent); color: #14161a; }

/* Poker centre */
.table-center {
  position: absolute; top: 46%; left: 50%; transform: translate(-50%, -50%);
  display: flex; flex-direction: column; align-items: center; gap: 8px; z-index: 1;
}
.pot-display { display: flex; align-items: center; gap: 8px; }
.pot-amt { font-weight: 800; color: var(--accent); font-size: 0.95rem; }
.community:not(:empty) { min-height: 78px; }
.community .card-slot + .card-slot { margin-left: 3px; }
.street-label { font-size: 0.64rem; letter-spacing: 3px; font-weight: 800; opacity: 0.6; }
.dealer-button {
  position: absolute; width: 26px; height: 26px; border-radius: 50%; z-index: 3;
  background: #f5f3ea; color: #14161a; font-weight: 800; font-size: 0.68rem;
  display: flex; align-items: center; justify-content: center; transform: translate(-50%, -50%);
  box-shadow: 0 2px 7px rgba(0, 0, 0, 0.55); opacity: 0;
  transition: left 0.5s ease, top 0.5s ease, opacity 0.3s ease;
}

/* Controls under the table */
.table-controls { display: flex; justify-content: center; align-items: center; min-height: 46px; }
.action-row .btn { min-width: 86px; }
.raise-group { display: flex; align-items: center; gap: 8px; }
.raise-group input[type="range"] { width: 130px; accent-color: var(--accent); padding: 0; }
.raise-amt { font-weight: 800; color: var(--accent); min-width: 62px; font-size: 0.85rem; }
.table-hint { margin: 0; opacity: 0.6; font-size: 0.85rem; }
.room-seats { font-size: 0.8rem; opacity: 0.7; }

/* Small cards for poker pods */
.card-sm { width: 38px; height: 54px; margin: 2px; border-radius: 5px; }
.card-sm .card-spot { font-size: 1.3rem; }
.card-sm .card-face { font-size: 1.05rem; }
.card-sm .card-face-suit { font-size: 0.6rem; }
.card-sm .card-ix { font-size: 0.55rem; }
.card-sm .card-ix b { font-size: 0.52rem; }
.card-sm.card-back { box-shadow: inset 0 0 0 2px #f3f3ee, inset 0 0 0 3px #8c1a21, 0 3px 7px rgba(0, 0, 0, 0.45); }
.pk-pod .card-slot + .card-slot { margin-left: -14px; }

/* ---- Table animations ---- */
@keyframes dealIn {
  from { opacity: 0; transform: translate(80px, -120px) rotate(-24deg) scale(0.9); }
  70% { opacity: 1; }
  to { opacity: 1; transform: none; }
}
.card.dealing { animation: dealIn 0.42s cubic-bezier(0.2, 0.8, 0.3, 1) backwards; }

@keyframes flipReveal {
  0% { transform: rotateY(90deg) scale(1.05); }
  100% { transform: rotateY(0) scale(1); }
}
.card.flipping { animation: flipReveal 0.38s ease-out; }

@keyframes cardCollect { to { opacity: 0; transform: translate(70px, -110px) rotate(20deg) scale(0.85); } }
.card-slot.card-collect { animation: cardCollect 0.3s ease-in forwards; }

@keyframes chipDrop {
  from { opacity: 0; transform: translateY(-26px) scale(0.7); }
  70% { transform: translateY(3px) scale(1.05); }
  to { opacity: 1; transform: none; }
}
.chip { animation: chipDrop 0.32s backwards; animation-delay: calc(var(--i, 0) * 0.05s); }

@keyframes seatEnter {
  from { opacity: 0; transform: translate(-50%, -50%) scale(0.8); }
  to { opacity: 1; transform: translate(-50%, -50%) scale(1); }
}
.seat-pod.seat-enter { animation: seatEnter 0.45s cubic-bezier(0.2, 0.9, 0.3, 1.2); }

@keyframes turnPulse {
  0%, 100% { box-shadow: 0 0 0 2px var(--accent), 0 0 16px rgba(232, 196, 106, 0.45); }
  50% { box-shadow: 0 0 0 3px var(--accent), 0 0 32px rgba(232, 196, 106, 0.9); }
}
.seat-pod.is-turn { animation: turnPulse 1.1s ease-in-out infinite; }

@keyframes resultPop {
  from { opacity: 0; transform: translateX(-50%) scale(0.6); }
  60% { transform: translateX(-50%) scale(1.14); }
  to { opacity: 1; transform: translateX(-50%) scale(1); }
}
.seat-result.result-pop { animation: resultPop 0.42s ease-out; }

@keyframes statusPop { from { opacity: 0.25; letter-spacing: 7px; } to { opacity: 1; letter-spacing: 1.5px; } }
.status-pop { animation: statusPop 0.42s ease-out; }

.chip-ghost {
  position: fixed; z-index: 150; pointer-events: none;
  transition: transform 0.55s cubic-bezier(0.4, 0, 0.2, 1), opacity 0.55s ease-in;
}

/* Bust cat overlay */
.bust-overlay {
  position: fixed; inset: 0; background: rgba(0, 0, 0, 0.9); z-index: 200;
  display: flex; align-items: center; justify-content: center; padding: 16px;
}
.bust-card { text-align: center; max-width: 320px; }
.bust-cat-svg { width: 140px; height: 120px; color: var(--accent); }
.bust-cat-wiggle { animation: cat-laugh 0.5s ease-in-out infinite; transform-origin: center bottom; }
@keyframes cat-laugh {
  0%, 100% { transform: rotate(-4deg) scale(1); }
  50% { transform: rotate(4deg) scale(1.05); }
}
.bust-line { font-size: 1.2rem; font-weight: 800; margin: 10px 0 4px; }
.bust-sub { opacity: 0.75; margin: 0 0 16px; font-size: 0.9rem; }
.bust-actions { display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; }

/* ============================================================
   Responsive
   ============================================================ */
@media (max-width: 1080px) {
  .layout { grid-template-columns: minmax(0, 760px); }
  .rail { display: none !important; }
}
@media (max-width: 700px) {
  .auth-email { display: none; }
  .header { padding-top: 18px; gap: 8px; }
  nav a { margin-left: 14px; }
  .casino-grid { grid-template-columns: 1fr; }
  .modal-body { padding: 14px 12px; }
  .wheel-wrap { width: 200px; height: 200px; }
  .card { width: 44px; height: 63px; }
  .card-spot { font-size: 1.6rem; }
  .card-face { font-size: 1.25rem; }
}
@media (max-width: 560px) {
  .row { flex-direction: column; }
  .lobby-create { flex-direction: column; }
}
