:root {
  --bg-deep: #110918;
  --bg-mid: #231129;
  --bg-warm: #3e1928;
  --surface: rgba(24, 14, 34, 0.84);
  --surface-strong: rgba(30, 17, 42, 0.94);
  --surface-border: rgba(255, 198, 128, 0.16);
  --surface-border-hover: rgba(255, 198, 128, 0.42);

  --text-main: #fdf6ec;
  --text-muted: #c2adc7;
  --text-dim: #8c7596;

  --neon-pink: #ff3b8d;
  --neon-amber: #ffae34;
  --neon-cyan: #2de2e6;
  --neon-lime: #7bf1a8;
  --neon-gold: #ffd166;
  --danger: #ff4d6d;

  --radius-sm: 10px;
  --radius-md: 16px;
  --radius-lg: 22px;

  --font-sans: 'Outfit', system-ui, -apple-system, sans-serif;
  --font-mono: 'JetBrains Mono', ui-monospace, monospace;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html, body {
  min-height: 100%;
  font-family: var(--font-sans);
  color: var(--text-main);
  background: var(--bg-deep);
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}

/* ===== DESERT TWILIGHT BACKDROP ===== */
.desert-backdrop {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  background:
    radial-gradient(ellipse 90% 55% at 50% 92%, rgba(255, 118, 64, 0.28) 0%, rgba(255, 59, 141, 0.14) 40%, transparent 72%),
    radial-gradient(ellipse 70% 50% at 15% 15%, rgba(45, 226, 230, 0.08) 0%, transparent 60%),
    linear-gradient(180deg, #0d0714 0%, #1d0e26 48%, #3a192a 84%, #52242c 100%);
}

.stars {
  position: absolute;
  inset: 0;
  background-image:
    radial-gradient(1.5px 1.5px at 12% 18%, rgba(255, 245, 225, 0.8), transparent),
    radial-gradient(1px 1px at 28% 8%, rgba(255, 245, 225, 0.6), transparent),
    radial-gradient(1.5px 1.5px at 44% 22%, rgba(255, 220, 180, 0.7), transparent),
    radial-gradient(1px 1px at 67% 12%, rgba(255, 255, 255, 0.75), transparent),
    radial-gradient(1.8px 1.8px at 82% 20%, rgba(255, 210, 160, 0.8), transparent),
    radial-gradient(1px 1px at 91% 9%, rgba(255, 255, 255, 0.5), transparent),
    radial-gradient(1px 1px at 56% 5%, rgba(45, 226, 230, 0.6), transparent),
    radial-gradient(1.2px 1.2px at 19% 31%, rgba(255, 255, 255, 0.45), transparent),
    radial-gradient(1.2px 1.2px at 74% 29%, rgba(255, 255, 255, 0.5), transparent);
}

.horizon-glow {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 240px;
  background: linear-gradient(180deg, transparent 0%, rgba(255, 130, 67, 0.16) 65%, rgba(20, 10, 22, 0.9) 100%);
}

.dunes-svg {
  position: absolute;
  bottom: 0;
  left: 0;
  width: 100%;
  height: 210px;
}

/* ===== SCREENS ===== */
.screen {
  position: relative;
  z-index: 1;
  display: none;
  min-height: 100vh;
}

.screen.active {
  display: flex;
  flex-direction: column;
}

.hidden {
  display: none !important;
}

/* ===== BUTTONS ===== */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-family: var(--font-sans);
  font-weight: 700;
  font-size: 0.95rem;
  border: 1px solid transparent;
  border-radius: 12px;
  padding: 10px 18px;
  cursor: pointer;
  transition: transform 0.15s ease, box-shadow 0.2s ease, background 0.2s ease, border-color 0.2s ease, opacity 0.2s ease;
  color: var(--text-main);
  background: rgba(255, 255, 255, 0.08);
  white-space: nowrap;
}

.btn:hover:not(:disabled) {
  transform: translateY(-1px);
}

.btn:active:not(:disabled) {
  transform: translateY(1px);
}

.btn:disabled {
  opacity: 0.42;
  cursor: not-allowed;
  transform: none;
}

.btn-primary {
  background: linear-gradient(135deg, #ff3b8d 0%, #ff7b3b 100%);
  border-color: rgba(255, 200, 160, 0.35);
  box-shadow: 0 6px 24px rgba(255, 59, 141, 0.38), inset 0 1px 0 rgba(255, 255, 255, 0.25);
  color: #fff;
}

.btn-primary:hover:not(:disabled) {
  box-shadow: 0 8px 30px rgba(255, 80, 120, 0.58), inset 0 1px 0 rgba(255, 255, 255, 0.35);
}

.btn-accent {
  background: linear-gradient(135deg, #2de2e6 0%, #2b8cff 100%);
  color: #0b0714;
  box-shadow: 0 6px 22px rgba(45, 226, 230, 0.35);
}

.btn-ghost {
  background: rgba(255, 255, 255, 0.06);
  border-color: rgba(255, 255, 255, 0.14);
  color: var(--text-main);
}

.btn-ghost:hover:not(:disabled) {
  background: rgba(255, 255, 255, 0.12);
  border-color: rgba(255, 255, 255, 0.28);
}

.btn-sm {
  padding: 7px 12px;
  font-size: 0.85rem;
  border-radius: 10px;
}

.btn-lg {
  padding: 13px 26px;
  font-size: 1.05rem;
  border-radius: 14px;
}

.icon-btn {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  background: rgba(255, 255, 255, 0.06);
  color: var(--text-main);
  font-size: 1rem;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s ease, border-color 0.15s ease;
}

.icon-btn:hover {
  background: rgba(255, 255, 255, 0.14);
  border-color: rgba(255, 255, 255, 0.3);
}

/* ===== SETUP SCREEN ===== */
#setup-screen {
  align-items: center;
  justify-content: center;
  padding: 28px 16px 40px;
}

.setup-container {
  width: 100%;
  max-width: 720px;
  display: flex;
  flex-direction: column;
  gap: 22px;
}

.brand-header {
  text-align: center;
}

.neon-badge {
  display: inline-block;
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.18em;
  color: var(--neon-amber);
  background: rgba(255, 174, 52, 0.12);
  border: 1px solid rgba(255, 174, 52, 0.34);
  padding: 5px 14px;
  border-radius: 999px;
  margin-bottom: 10px;
}

.neon-title {
  font-size: clamp(2.8rem, 8vw, 4.6rem);
  font-weight: 900;
  letter-spacing: 0.1em;
  line-height: 1;
  background: linear-gradient(180deg, #fff5dc 0%, #ffbe5c 52%, #ff3b8d 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  filter: drop-shadow(0 0 22px rgba(255, 59, 141, 0.45)) drop-shadow(0 4px 12px rgba(0, 0, 0, 0.6));
  margin-bottom: 10px;
}

.subtitle {
  color: var(--text-muted);
  font-size: 1.02rem;
  max-width: 520px;
  margin: 0 auto;
  line-height: 1.45;
}

.setup-card {
  background: var(--surface);
  backdrop-filter: blur(18px);
  border: 1px solid var(--surface-border);
  border-radius: var(--radius-lg);
  padding: 24px;
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.55), inset 0 1px 0 rgba(255, 255, 255, 0.08);
  display: flex;
  flex-direction: column;
  gap: 22px;
}

.setup-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 18px;
}

.setup-group {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.setup-variant-box {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  flex-wrap: wrap;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.11);
  border-radius: 14px;
  padding: 12px 14px;
}

.variant-info {
  display: flex;
  flex-direction: column;
  gap: 3px;
  flex: 1;
  min-width: 220px;
}

.variant-toggle {
  min-width: 220px;
}

.variant-toggle .seg-btn:disabled {
  opacity: 0.35;
  cursor: not-allowed;
}

.setup-label {
  font-size: 0.82rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
}

.segmented-control {
  display: flex;
  background: rgba(0, 0, 0, 0.35);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 12px;
  padding: 4px;
  gap: 4px;
}

.seg-btn {
  flex: 1;
  border: none;
  background: transparent;
  color: var(--text-muted);
  font-family: var(--font-sans);
  font-weight: 700;
  font-size: 0.9rem;
  padding: 9px 10px;
  border-radius: 9px;
  cursor: pointer;
  transition: all 0.18s ease;
}

.seg-btn:hover {
  color: var(--text-main);
}

.seg-btn.active {
  background: linear-gradient(135deg, rgba(255, 59, 141, 0.88), rgba(255, 130, 58, 0.88));
  color: #fff;
  box-shadow: 0 4px 14px rgba(255, 59, 141, 0.32);
}

.players-config {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.players-config-header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
}

.hint-text {
  font-size: 0.8rem;
  color: var(--text-dim);
}

.player-rows {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.player-config-row {
  display: flex;
  align-items: center;
  gap: 12px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.09);
  border-radius: 12px;
  padding: 8px 12px;
}

.color-swatch {
  width: 22px;
  height: 22px;
  border-radius: 7px;
  flex-shrink: 0;
  box-shadow: 0 0 12px currentColor;
}

.player-name-input {
  flex: 1;
  min-width: 0;
  background: rgba(0, 0, 0, 0.3);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 8px;
  color: var(--text-main);
  font-family: var(--font-sans);
  font-size: 0.95rem;
  font-weight: 600;
  padding: 7px 11px;
  outline: none;
  transition: border-color 0.18s ease;
}

.player-name-input:focus {
  border-color: var(--neon-amber);
}

.type-toggle {
  display: flex;
  background: rgba(0, 0, 0, 0.35);
  border-radius: 9px;
  padding: 3px;
  gap: 3px;
  border: 1px solid rgba(255, 255, 255, 0.08);
}

.type-btn {
  border: none;
  background: transparent;
  color: var(--text-dim);
  font-family: var(--font-sans);
  font-size: 0.8rem;
  font-weight: 700;
  padding: 5px 10px;
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.15s ease;
}

.type-btn.active {
  background: rgba(255, 255, 255, 0.16);
  color: #fff;
}

.setup-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding-top: 6px;
}

/* ===== ONLINE MULTIPLAYER SETUP & LOBBY ===== */
.mode-tabs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
  background: rgba(0, 0, 0, 0.35);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 14px;
  padding: 5px;
}

.mode-tab {
  border: none;
  background: transparent;
  color: var(--text-muted);
  font-family: var(--font-sans);
  font-weight: 700;
  font-size: 0.94rem;
  padding: 10px 12px;
  border-radius: 10px;
  cursor: pointer;
  transition: all 0.18s ease;
}

.mode-tab:hover {
  color: var(--text-main);
}

.mode-tab.active {
  background: linear-gradient(135deg, rgba(255, 59, 141, 0.9), rgba(255, 130, 58, 0.9));
  color: #fff;
  box-shadow: 0 4px 16px rgba(255, 59, 141, 0.32);
}

.setup-panel {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.online-entry,
.online-lobby {
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.online-actions-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}

.online-action-card {
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 14px;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  justify-content: space-between;
}

.online-action-card h3 {
  font-size: 1rem;
  color: #fff4df;
}

.join-code-row {
  display: flex;
  gap: 8px;
}

.code-input {
  font-family: var(--font-mono);
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.16em;
  text-align: center;
}

.online-error {
  background: rgba(255, 77, 109, 0.16);
  border: 1px solid rgba(255, 77, 109, 0.55);
  color: #ffd0d9;
  border-radius: 10px;
  padding: 10px 14px;
  font-size: 0.88rem;
  font-weight: 600;
}

.ws-status-pill {
  font-size: 0.78rem;
  font-weight: 700;
  padding: 5px 11px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.08);
  color: var(--text-muted);
}

.ws-status-pill.connected {
  background: rgba(123, 241, 168, 0.14);
  border: 1px solid rgba(123, 241, 168, 0.4);
  color: var(--neon-lime);
}

.ws-status-pill.offline {
  background: rgba(255, 77, 109, 0.14);
  border: 1px solid rgba(255, 77, 109, 0.4);
  color: #ff9eb0;
}

.lobby-header-box {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  background: rgba(45, 226, 230, 0.08);
  border: 1px solid rgba(45, 226, 230, 0.3);
  border-radius: 14px;
  padding: 12px 16px;
}

.lobby-code-display {
  font-family: var(--font-mono);
  font-size: 1.7rem;
  font-weight: 900;
  letter-spacing: 0.2em;
  color: var(--neon-cyan);
  line-height: 1.1;
}

.lobby-share-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.seat-meta-badges {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-left: auto;
}

.host-badge {
  font-size: 0.72rem;
  font-weight: 800;
  background: rgba(255, 209, 102, 0.18);
  border: 1px solid rgba(255, 209, 102, 0.45);
  color: var(--neon-gold);
  padding: 2px 8px;
  border-radius: 999px;
}

.you-badge {
  font-size: 0.72rem;
  font-weight: 800;
  background: rgba(45, 226, 230, 0.16);
  border: 1px solid rgba(45, 226, 230, 0.4);
  color: var(--neon-cyan);
  padding: 2px 8px;
  border-radius: 999px;
}

.offline-badge {
  font-size: 0.68rem;
  font-weight: 800;
  background: rgba(255, 77, 109, 0.2);
  color: #ff9eb0;
  padding: 2px 6px;
  border-radius: 6px;
}

.room-pill {
  font-family: var(--font-sans);
  font-size: 0.8rem;
  font-weight: 600;
  color: #e6f7ff;
  background: rgba(45, 226, 230, 0.12);
  border: 1px solid rgba(45, 226, 230, 0.35);
  padding: 4px 11px;
  border-radius: 999px;
  cursor: pointer;
  transition: background 0.15s ease;
}

.room-pill:hover {
  background: rgba(45, 226, 230, 0.24);
}

/* ===== GAME SCREEN TOP BAR ===== */
#game-screen {
  padding: 12px 18px 14px;
  gap: 10px;
  max-width: 1380px;
  width: 100%;
  margin: 0 auto;
}

.top-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  background: var(--surface);
  backdrop-filter: blur(14px);
  border: 1px solid var(--surface-border);
  border-radius: 14px;
  padding: 9px 14px;
}

.top-bar-left {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.mini-logo {
  font-weight: 900;
  font-size: 1.2rem;
  letter-spacing: 0.1em;
  background: linear-gradient(180deg, #fff5dc 0%, #ffae34 60%, #ff3b8d 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.round-pill {
  font-size: 0.85rem;
  font-weight: 600;
  background: rgba(255, 174, 52, 0.14);
  border: 1px solid rgba(255, 174, 52, 0.34);
  color: #ffd58c;
  padding: 4px 12px;
  border-radius: 999px;
}

.phase-pill {
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--neon-cyan);
  background: rgba(45, 226, 230, 0.1);
  border: 1px solid rgba(45, 226, 230, 0.25);
  padding: 4px 12px;
  border-radius: 999px;
}

.top-bar-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

/* ===== PLAYERS SCOREBOARD STRIP ===== */
.players-strip {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 10px;
}

.player-card {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  background: var(--surface);
  backdrop-filter: blur(12px);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 14px;
  padding: 10px 13px;
  transition: transform 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease;
}

.player-card.active-turn {
  border-color: var(--p-color, var(--neon-amber));
  box-shadow: 0 0 0 1px var(--p-color, var(--neon-amber)), 0 8px 24px rgba(0, 0, 0, 0.4);
  transform: translateY(-2px);
}

.player-card.out-of-dice {
  opacity: 0.72;
}

.player-card-left {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.player-avatar {
  width: 34px;
  height: 34px;
  border-radius: 10px;
  background: var(--p-color);
  color: #100816;
  font-weight: 900;
  font-size: 0.92rem;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  box-shadow: 0 0 14px color-mix(in srgb, var(--p-color) 55%, transparent);
}

.player-info {
  min-width: 0;
}

.player-name-line {
  display: flex;
  align-items: center;
  gap: 5px;
  font-weight: 700;
  font-size: 0.92rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.bot-tag {
  font-size: 0.65rem;
  font-weight: 800;
  letter-spacing: 0.04em;
  background: rgba(255, 255, 255, 0.12);
  color: var(--text-muted);
  padding: 1px 5px;
  border-radius: 5px;
}

.player-dice-left {
  font-size: 0.76rem;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  gap: 5px;
  margin-top: 2px;
}

.player-money {
  text-align: right;
  flex-shrink: 0;
}

.money-amount {
  font-family: var(--font-mono);
  font-weight: 800;
  font-size: 0.96rem;
  color: var(--neon-gold);
}

.bills-count {
  font-size: 0.72rem;
  color: var(--text-dim);
}

/* ===== CASINOS BOARD ===== */
.board-wrapper {
  flex: 1;
  display: flex;
  flex-direction: column;
}

.casinos-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  flex: 1;
}

.casino-card {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 10px;
  background: linear-gradient(180deg, rgba(34, 18, 46, 0.9) 0%, rgba(20, 11, 29, 0.92) 100%);
  backdrop-filter: blur(12px);
  border: 1.5px solid rgba(255, 198, 128, 0.16);
  border-radius: var(--radius-md);
  padding: 13px;
  transition: transform 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease, opacity 0.2s ease;
  overflow: hidden;
}

.casino-card::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: linear-gradient(90deg, transparent, var(--casino-accent, var(--neon-amber)), transparent);
  opacity: 0.75;
}

.casino-card.selectable {
  cursor: pointer;
  border-color: var(--neon-amber);
  box-shadow: 0 0 0 1px rgba(255, 174, 52, 0.4), 0 0 26px rgba(255, 174, 52, 0.22);
  animation: pulseBorder 1.8s ease-in-out infinite;
}

.casino-card.selectable:hover {
  transform: translateY(-3px) scale(1.01);
  border-color: #fff;
  box-shadow: 0 0 0 2px var(--neon-amber), 0 12px 32px rgba(255, 174, 52, 0.35);
}

.casino-card.dimmed {
  opacity: 0.52;
}

.casino-card.resolving {
  border-color: var(--neon-cyan);
  box-shadow: 0 0 0 2px var(--neon-cyan), 0 0 36px rgba(45, 226, 230, 0.35);
  transform: scale(1.02);
  z-index: 3;
}

.casino-card.resolved {
  opacity: 0.65;
}

@keyframes pulseBorder {
  0%, 100% { box-shadow: 0 0 0 1px rgba(255, 174, 52, 0.35), 0 0 18px rgba(255, 174, 52, 0.16); }
  50% { box-shadow: 0 0 0 2px rgba(255, 174, 52, 0.75), 0 0 28px rgba(255, 174, 52, 0.35); }
}

.casino-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.casino-title-wrap {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.casino-name-block {
  min-width: 0;
}

.casino-name {
  font-size: 0.98rem;
  font-weight: 800;
  letter-spacing: 0.02em;
  color: #fff6e6;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.casino-pot {
  font-family: var(--font-mono);
  font-size: 0.76rem;
  font-weight: 700;
  color: var(--neon-amber);
}

.place-preview-badge {
  font-size: 0.75rem;
  font-weight: 800;
  color: #12081a;
  background: var(--neon-amber);
  padding: 4px 9px;
  border-radius: 999px;
  box-shadow: 0 0 14px rgba(255, 174, 52, 0.55);
  white-space: nowrap;
}

/* ===== EURO BANKNOTES ===== */
.bills-row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.euro-bill {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-family: var(--font-mono);
  font-weight: 800;
  font-size: 0.8rem;
  padding: 5px 10px;
  border-radius: 8px;
  border: 1.5px solid rgba(255, 255, 255, 0.25);
  box-shadow: 0 3px 10px rgba(0, 0, 0, 0.32), inset 0 1px 0 rgba(255, 255, 255, 0.2);
  transition: transform 0.25s ease, opacity 0.25s ease;
}

.euro-bill .bill-rank {
  font-family: var(--font-sans);
  font-size: 0.65rem;
  font-weight: 800;
  opacity: 0.85;
  background: rgba(0, 0, 0, 0.25);
  padding: 1px 5px;
  border-radius: 4px;
}

.euro-bill.tier-low {
  background: linear-gradient(135deg, #1d5b68, #163d4a);
  color: #d6f7ff;
  border-color: rgba(114, 229, 255, 0.35);
}

.euro-bill.tier-mid {
  background: linear-gradient(135deg, #7c4a1d, #562f12);
  color: #ffe6c2;
  border-color: rgba(255, 186, 98, 0.42);
}

.euro-bill.tier-high {
  background: linear-gradient(135deg, #8b1e5a, #5c1343);
  color: #ffd6ec;
  border-color: rgba(255, 92, 173, 0.48);
}

.euro-bill.tier-ultra {
  background: linear-gradient(135deg, #3c2a8c, #24185c);
  color: #dfd6ff;
  border-color: rgba(158, 134, 255, 0.5);
}

.euro-bill.tier-jackpot {
  background: linear-gradient(135deg, #c78d16, #8f5c06);
  color: #fff7d6;
  border-color: rgba(255, 224, 115, 0.72);
  box-shadow: 0 0 14px rgba(255, 209, 102, 0.3);
}

.euro-bill.won {
  opacity: 0.35;
  transform: scale(0.92);
  text-decoration: line-through;
}

/* ===== CASINO DICE AREA ===== */
.casino-dice-area {
  flex: 1;
  min-height: 76px;
  background: rgba(8, 4, 14, 0.45);
  border: 1px dashed rgba(255, 255, 255, 0.1);
  border-radius: 11px;
  padding: 8px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.casino-empty-hint {
  margin: auto;
  font-size: 0.78rem;
  color: var(--text-dim);
  font-style: italic;
}

.player-stack {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 9px;
  padding: 5px 8px;
  transition: all 0.25s ease;
}

.player-stack.tied {
  border-color: rgba(255, 77, 109, 0.55);
  background: rgba(255, 77, 109, 0.1);
}

.player-stack.cancelled {
  opacity: 0.42;
  text-decoration: line-through;
  border-color: rgba(255, 77, 109, 0.7);
}

.player-stack.winner-highlight {
  border-color: var(--neon-gold);
  background: rgba(255, 209, 102, 0.16);
  box-shadow: 0 0 14px rgba(255, 209, 102, 0.25);
}

.player-stack.neutral-stack {
  background: rgba(244, 246, 251, 0.08);
  border-color: rgba(244, 246, 251, 0.22);
}

.stack-left {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

.stack-owner {
  font-size: 0.76rem;
  font-weight: 700;
  color: var(--text-main);
  margin-right: 2px;
}

.stack-dice-row {
  display: flex;
  align-items: center;
  gap: 4px;
  flex-wrap: wrap;
}

.stack-right {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
}

.stack-count {
  font-family: var(--font-mono);
  font-size: 0.78rem;
  font-weight: 800;
  color: var(--text-main);
  background: rgba(0, 0, 0, 0.35);
  padding: 2px 7px;
  border-radius: 6px;
}

.tie-badge {
  font-size: 0.65rem;
  font-weight: 800;
  letter-spacing: 0.04em;
  color: #ffd0d9;
  background: rgba(255, 77, 109, 0.35);
  border: 1px solid rgba(255, 77, 109, 0.65);
  padding: 2px 6px;
  border-radius: 5px;
}

.win-badge {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  font-weight: 800;
  color: #140a16;
  background: var(--neon-gold);
  padding: 2px 7px;
  border-radius: 5px;
}

/* ===== 3D-STYLED CSS DICE ===== */
.die {
  --die-size: 32px;
  --die-bg: #fff;
  --pip-color: #150a1e;
  width: var(--die-size);
  height: var(--die-size);
  background: var(--die-bg);
  border-radius: 7px;
  padding: 4px;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  grid-template-rows: repeat(3, 1fr);
  place-items: center;
  box-shadow:
    inset 0 2px 2px rgba(255, 255, 255, 0.45),
    inset 0 -2px 3px rgba(0, 0, 0, 0.3),
    0 3px 8px rgba(0, 0, 0, 0.45);
  position: relative;
  flex-shrink: 0;
}

.die.die-sm {
  --die-size: 22px;
  border-radius: 5px;
  padding: 3px;
}

.die.die-md {
  --die-size: 38px;
  border-radius: 9px;
  padding: 5px;
}

.die.die-casino {
  --die-size: 36px;
  --die-bg: linear-gradient(145deg, #fff5e1, #e8cfa0);
  --pip-color: #210e24;
  border: 1.5px solid rgba(255, 209, 102, 0.8);
  border-radius: 9px;
  padding: 5px;
}

.die.die-neutral {
  --die-bg: linear-gradient(145deg, #ffffff, #e5e8f0);
  --pip-color: #161024;
  border: 1.5px solid rgba(255, 255, 255, 0.9);
  box-shadow:
    0 0 10px rgba(255, 255, 255, 0.3),
    inset 0 2px 2px rgba(255, 255, 255, 0.9),
    inset 0 -2px 3px rgba(0, 0, 0, 0.2),
    0 3px 8px rgba(0, 0, 0, 0.45);
}

.die.die-biggy {
  outline: 2px solid var(--neon-gold);
  box-shadow:
    0 0 12px rgba(255, 209, 102, 0.65),
    inset 0 2px 2px rgba(255, 255, 255, 0.55),
    inset 0 -2px 3px rgba(0, 0, 0, 0.3);
}

.die.die-sm.die-biggy {
  --die-size: 26px;
}

.die.die-md.die-biggy {
  --die-size: 44px;
}

.die.die-biggy::after {
  content: "×2";
  position: absolute;
  top: -7px;
  right: -7px;
  font-family: var(--font-mono);
  font-size: 0.58rem;
  font-weight: 900;
  background: var(--neon-gold);
  color: #16091b;
  padding: 0 3px;
  border-radius: 4px;
  line-height: 1.3;
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.5);
}

.die .pip {
  width: 24%;
  height: 24%;
  min-width: 4px;
  min-height: 4px;
  border-radius: 50%;
  background: var(--pip-color);
  opacity: 0;
}

.die.die-sm .pip {
  min-width: 3px;
  min-height: 3px;
}

.die.die-md .pip, .die.die-casino .pip {
  min-width: 6px;
  min-height: 6px;
}

/* Pip visibility for faces 1-6 on a 3x3 grid (children 1..9) */
.die[data-face="1"] .pip:nth-child(5) { opacity: 1; }

.die[data-face="2"] .pip:nth-child(3),
.die[data-face="2"] .pip:nth-child(7) { opacity: 1; }

.die[data-face="3"] .pip:nth-child(3),
.die[data-face="3"] .pip:nth-child(5),
.die[data-face="3"] .pip:nth-child(7) { opacity: 1; }

.die[data-face="4"] .pip:nth-child(1),
.die[data-face="4"] .pip:nth-child(3),
.die[data-face="4"] .pip:nth-child(7),
.die[data-face="4"] .pip:nth-child(9) { opacity: 1; }

.die[data-face="5"] .pip:nth-child(1),
.die[data-face="5"] .pip:nth-child(3),
.die[data-face="5"] .pip:nth-child(5),
.die[data-face="5"] .pip:nth-child(7),
.die[data-face="5"] .pip:nth-child(9) { opacity: 1; }

.die[data-face="6"] .pip:nth-child(1),
.die[data-face="6"] .pip:nth-child(3),
.die[data-face="6"] .pip:nth-child(4),
.die[data-face="6"] .pip:nth-child(6),
.die[data-face="6"] .pip:nth-child(7),
.die[data-face="6"] .pip:nth-child(9) { opacity: 1; }

.die.rolling {
  animation: dieTumble 0.42s ease-out;
}

@keyframes dieTumble {
  0% { transform: translateY(-10px) rotate(-25deg) scale(0.85); opacity: 0.4; }
  50% { transform: translateY(3px) rotate(14deg) scale(1.08); opacity: 1; }
  100% { transform: translateY(0) rotate(0deg) scale(1); }
}

/* ===== TURN CONTROL DOCK ===== */
.turn-dock {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  background: var(--surface-strong);
  backdrop-filter: blur(18px);
  border: 1.5px solid rgba(255, 198, 128, 0.22);
  border-radius: var(--radius-md);
  padding: 12px 16px;
  box-shadow: 0 -6px 30px rgba(0, 0, 0, 0.45);
  min-height: 82px;
}

.dock-left {
  min-width: 210px;
}

.active-player-badge {
  display: flex;
  align-items: center;
  gap: 11px;
}

.player-dot {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: var(--neon-amber);
  box-shadow: 0 0 12px currentColor;
  flex-shrink: 0;
}

.active-player-name {
  font-weight: 800;
  font-size: 1.02rem;
}

.active-player-sub {
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-top: 1px;
}

.dock-center {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

.dice-tray {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  gap: 8px;
}

.choice-buttons {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  gap: 8px;
}

.choice-group-btn {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  background: rgba(255, 255, 255, 0.07);
  border: 1.5px solid rgba(255, 198, 128, 0.28);
  border-radius: 12px;
  padding: 6px 12px;
  color: var(--text-main);
  font-family: var(--font-sans);
  font-weight: 700;
  font-size: 0.86rem;
  cursor: pointer;
  transition: all 0.16s ease;
}

.choice-group-btn:hover {
  background: rgba(255, 174, 52, 0.22);
  border-color: var(--neon-amber);
  transform: translateY(-2px);
  box-shadow: 0 6px 18px rgba(255, 174, 52, 0.25);
}

.dock-right {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

.btn-roll {
  padding: 12px 24px;
  font-size: 1rem;
}

/* ===== EVENT TICKER ===== */
.event-ticker {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.82rem;
  color: var(--text-muted);
  padding: 2px 8px;
}

.ticker-icon {
  color: var(--neon-amber);
}

/* ===== RESOLUTION BANNER ===== */
.resolution-banner {
  position: fixed;
  top: 76px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 40;
  width: min(560px, calc(100vw - 32px));
  background: rgba(20, 10, 32, 0.96);
  border: 1.5px solid var(--neon-cyan);
  border-radius: 16px;
  padding: 14px 18px;
  box-shadow: 0 16px 48px rgba(0, 0, 0, 0.65), 0 0 28px rgba(45, 226, 230, 0.28);
  animation: slideDown 0.25s ease-out;
}

@keyframes slideDown {
  from { opacity: 0; transform: translate(-50%, -12px); }
  to { opacity: 1; transform: translate(-50%, 0); }
}

.res-header {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 8px;
  font-size: 1.02rem;
}

.res-badge {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  font-weight: 800;
  background: var(--neon-cyan);
  color: #0b0614;
  padding: 3px 8px;
  border-radius: 6px;
}

.res-details {
  display: flex;
  flex-direction: column;
  gap: 5px;
  font-size: 0.9rem;
  color: var(--text-main);
}

.res-line-tie {
  color: #ff8fa3;
}

.res-line-win {
  color: var(--neon-gold);
  font-weight: 600;
}

.res-line-neutral {
  color: #e4e8f5;
  font-weight: 600;
}

.res-line-empty {
  color: var(--text-muted);
}

/* ===== MODALS ===== */
.modal {
  position: fixed;
  inset: 0;
  z-index: 60;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(8, 4, 14, 0.78);
  backdrop-filter: blur(6px);
}

.modal-card {
  position: relative;
  z-index: 1;
  width: min(620px, 100%);
  max-height: 88vh;
  overflow-y: auto;
  background: #1a0e26;
  border: 1.5px solid rgba(255, 198, 128, 0.28);
  border-radius: 20px;
  box-shadow: 0 28px 70px rgba(0, 0, 0, 0.75);
  display: flex;
  flex-direction: column;
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 22px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.modal-header h2 {
  font-size: 1.3rem;
  color: #fff5e1;
}

.close-btn {
  background: rgba(255, 255, 255, 0.08);
  border: none;
  color: var(--text-main);
  width: 32px;
  height: 32px;
  border-radius: 8px;
  cursor: pointer;
  font-size: 1rem;
}

.close-btn:hover {
  background: rgba(255, 255, 255, 0.16);
}

.rules-body {
  padding: 20px 22px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  line-height: 1.55;
  color: var(--text-muted);
  font-size: 0.94rem;
}

.rules-body strong {
  color: var(--text-main);
}

.rules-body h3 {
  color: var(--neon-amber);
  font-size: 1rem;
  margin-top: 6px;
}

.rules-body ul {
  padding-left: 20px;
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.modal-footer {
  padding: 16px 22px;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  display: flex;
  justify-content: flex-end;
  gap: 10px;
}

/* ===== GAME OVER PODIUM ===== */
.gameover-card {
  text-align: center;
  padding: 28px 24px 22px;
  gap: 18px;
}

.trophy {
  font-size: 3rem;
  margin-bottom: 6px;
  filter: drop-shadow(0 0 20px rgba(255, 209, 102, 0.55));
}

.gameover-header h2 {
  font-size: 1.85rem;
  margin-top: 6px;
  color: #fff6e0;
}

.gameover-subtitle {
  color: var(--neon-gold);
  font-size: 1.02rem;
  font-weight: 600;
  margin-top: 4px;
}

.podium-list {
  display: flex;
  flex-direction: column;
  gap: 9px;
  text-align: left;
}

.podium-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 13px;
  padding: 12px 15px;
}

.podium-row.rank-1 {
  background: linear-gradient(135deg, rgba(255, 209, 102, 0.18), rgba(255, 59, 141, 0.14));
  border-color: rgba(255, 209, 102, 0.58);
}

.podium-left {
  display: flex;
  align-items: center;
  gap: 12px;
}

.podium-rank {
  font-family: var(--font-mono);
  font-weight: 900;
  font-size: 1.1rem;
  width: 30px;
  text-align: center;
}

.podium-name {
  font-weight: 700;
  font-size: 1rem;
}

.podium-bills {
  font-size: 0.78rem;
  color: var(--text-muted);
}

.podium-cash {
  font-family: var(--font-mono);
  font-weight: 800;
  font-size: 1.12rem;
  color: var(--neon-gold);
}

.gameover-actions {
  justify-content: center;
  border-top: none;
  padding-top: 6px;
}

/* ===== RESPONSIVE ===== */
@media (max-width: 980px) {
  .casinos-grid {
    grid-template-columns: repeat(2, 1fr);
  }
  .turn-dock {
    flex-direction: column;
    align-items: stretch;
    text-align: center;
  }
  .active-player-badge {
    justify-content: center;
  }
  .dock-right {
    justify-content: center;
  }
}

@media (max-width: 640px) {
  .setup-row,
  .online-actions-grid {
    grid-template-columns: 1fr;
  }
  .casinos-grid {
    grid-template-columns: 1fr;
  }
  .player-config-row {
    flex-wrap: wrap;
  }
  #game-screen {
    padding: 8px 10px 12px;
  }
}
