/*
 * MATO
 */

@import url('https://fonts.googleapis.com/css2?family=Space+Grotesk:wght@400;500;600;700&family=DM+Serif+Display&family=JetBrains+Mono:wght@500;700&display=swap');

:root {
  --bg: #111110;
  --bg-surface: #1C1B19;
  --bg-elevated: #252420;

  --text: #E8E4DC;
  --text-secondary: #6B6560;
  --text-inverse: #111110;

  --accent: #D4A843;
  --accent-rgb: 212, 168, 67;
  --accent-hover: #E0B950;
  --accent-soft: rgba(212, 168, 67, 0.12);

  --info: #D4A843;
  --success: #4ADE80;
  --danger: #EF4444;
  --warm: #F59E0B;

  --card-bg: #F5F0E6;
  --card-red: #C53030;
  --card-black: #1A1715;
  --card-back: #2F4A2F;

  --shadow-sm: 0 1px 2px rgba(0,0,0,0.3);
  --shadow-md: 0 4px 16px rgba(0,0,0,0.4);
  --shadow-lg: 0 12px 40px rgba(0,0,0,0.5);

  --font-body: 'Space Grotesk', sans-serif;
  --font-display: 'DM Serif Display', Georgia, serif;
  --font-mono: 'JetBrains Mono', monospace;

  --card-w: 80px;
  --card-h: 114px;

  --border: #2A2725;
  --card-radius: 4px;

  --radius-sm: 2px;
  --radius-md: 4px;
  --radius-lg: 8px;
  --radius-xl: 16px;
  --radius-pill: 100px;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
button, select { color: inherit; }

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

/* --- Global Affordances --- */
::selection {
  background: var(--accent);
  color: #fff;
}
::placeholder {
  color: var(--text-secondary);
  opacity: 0.6;
}
:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}
input:focus-visible {
  outline-offset: 0;
}
button:disabled, input:disabled, select:disabled {
  cursor: default;
}

/* Custom scrollbars */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--text-secondary); border-radius: 3px; opacity: 0.4; }
::-webkit-scrollbar-thumb:hover { opacity: 0.7; }
* { scrollbar-width: thin; scrollbar-color: var(--text-secondary) transparent; }

.hidden { display: none !important; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0; }

/* --- Screens --- */
.screen {
  display: none;
  min-height: 100dvh;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}
.screen.active { display: flex; animation: screenIn 0.3s ease; }

@keyframes screenIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

/* --- Home Screen --- */
#screen-home .home-content {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 24px;
  padding: 24px;
  width: 100%;
}

.logo-container { text-align: center; }
.logo {
  font-family: var(--font-display);
  font-size: 72px;
  font-weight: 400;
  font-style: normal;
  color: var(--text);
  letter-spacing: -1px;
  line-height: 1;
}
.home-form {
  width: 100%;
  max-width: 380px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.home-form #btn-create {
  font-size: 13px;
  padding: 14px 32px;
}
.home-join {
  width: 100%;
  max-width: 380px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
}
.home-divider {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  color: var(--text-secondary);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 1px;
  text-transform: lowercase;
}
.home-divider::before,
.home-divider::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--border);
}
.home-join-row {
  display: flex;
  gap: 10px;
  width: 100%;
}
.home-join-row #join-code {
  flex: 1;
  font-family: var(--font-mono);
  letter-spacing: 2px;
  text-transform: uppercase;
}
.home-join-row #btn-join {
  padding: 14px 20px;
  font-size: 11px;
}

/* --- Inputs --- */
input {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  padding: 14px 16px;
  border-radius: 0;
  color: var(--text);
  font-family: inherit;
  font-size: 15px;
  font-weight: 500;
  text-align: center;
  transition: border-color 0.15s ease;
}
input:focus {
  border-color: var(--accent);
  box-shadow: none;
}
input:focus:not(:focus-visible) {
  outline: none;
}

/* --- Buttons --- */
.btn {
  padding: 14px 28px;
  border-radius: 0;
  border: none;
  font-family: var(--font-body);
  font-weight: 700;
  font-size: 12px;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  cursor: pointer;
  transition: background-color 0.12s ease, color 0.12s ease, border-color 0.12s ease;
}

.btn-primary {
  background: var(--accent);
  color: var(--text-inverse);
}
.btn-primary:hover {
  background: var(--accent-hover);
}
.btn-primary:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}
.btn-primary.small { padding: 10px 20px; font-size: 11px; }

.btn-secondary {
  background: transparent;
  color: var(--text);
  border: 1px solid var(--border);
}
.btn-secondary:hover {
  border-color: var(--text);
}

.btn-minimal {
  background: transparent;
  border: none;
  color: var(--text-secondary);
  padding: 10px 16px;
  font-family: var(--font-body);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 2px;
  text-transform: uppercase;
  cursor: pointer;
  transition: color 0.12s ease;
}
.btn-minimal:hover { color: var(--text); }

.btn-live::before {
  content: '';
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--accent);
  margin-right: 6px;
  vertical-align: middle;
  animation: livePulse 2s ease-in-out infinite;
}
@keyframes livePulse {
  0%, 100% { opacity: 1; box-shadow: 0 0 0 0 rgba(var(--accent-rgb), 0.5); }
  50% { opacity: 0.6; box-shadow: 0 0 0 4px rgba(var(--accent-rgb), 0); }
}

.btn-icon {
  width: 36px;
  height: 36px;
  border-radius: 0;
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text-secondary);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  transition: border-color 0.12s ease, color 0.12s ease;
}
.btn-icon:hover { border-color: var(--text); color: var(--text); }

/* --- Loading Spinner on Buttons --- */
.btn-loading {
  pointer-events: none;
  opacity: 0.6;
  position: relative;
}
.btn-loading::after {
  content: '';
  width: 14px; height: 14px;
  border: 2px solid transparent;
  border-top-color: currentColor;
  border-radius: 50%;
  animation: spin 0.6s linear infinite;
  display: inline-block;
  vertical-align: middle;
  margin-left: 8px;
}

.btn-copied { color: var(--accent) !important; }

/* --- Browser Screen --- */
.browser-content {
  max-width: 560px;
  width: 100%;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: 16px;
  padding: 24px 32px;
  position: relative;
}
#screen-browser { position: relative; }
#btn-back-home {
  position: fixed;
  top: 16px;
  left: 16px;
  z-index: 10;
  padding: 8px 14px;
  font-size: 11px;
}
.browser-content h2 {
  font-family: var(--font-display);
  font-size: 24px;
  font-weight: 400;
  font-style: normal;
  text-align: center;
  letter-spacing: 0;
  text-transform: none;
  color: var(--text);
}

.game-list { display: flex; flex-direction: column; gap: 6px; }
.game-list p {
  text-align: center;
  color: var(--text-secondary);
  font-size: 13px;
  padding: 32px 0;
}
.game-status-badge {
  display: inline-block;
  font-size: 9px;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 0;
  background: var(--warm);
  color: #fff;
  text-transform: uppercase;
  letter-spacing: 1px;
  vertical-align: middle;
  margin-left: 8px;
}
.game-list-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 16px;
  background: var(--bg-elevated);
  border-radius: 0;
  border-left: 3px solid var(--accent);
  box-shadow: var(--shadow-sm);
}

/* --- Lobby Screen --- */
#screen-lobby { position: relative; }
#btn-leave-lobby {
  position: fixed;
  top: 16px;
  left: 16px;
  z-index: 10;
}
/* --- Lobby --- */
.lobby-content {
  max-width: 400px;
  width: 100%;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: 24px;
  padding: 48px 24px 30px;
  overflow-y: auto;
  max-height: 100dvh;
}

.join-code-display {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
}
.join-code-display .code {
  font-family: var(--font-mono);
  font-size: 40px;
  font-weight: 700;
  letter-spacing: 12px;
  text-indent: 12px;
  color: var(--accent);
}
.code-actions {
  display: flex;
  gap: 8px;
}

/* --- Player List --- */
.player-list {
  display: flex;
  flex-direction: column;
  border-radius: var(--radius);
  overflow: hidden;
}
.lobby-player-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 14px;
  background: var(--bg-surface);
  border: none;
  font-family: var(--font-body);
}
.lobby-player-row + .lobby-player-row {
  border-top: 1px solid var(--border);
}
.lobby-player-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: 2px solid var(--border);
  background: transparent;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  font-weight: 800;
  flex-shrink: 0;
}
.lobby-player-name {
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.lobby-badge {
  font-size: 9px;
  font-weight: 700;
  padding: 2px 8px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}
.lobby-badge.host {
  background: var(--accent-soft);
  color: var(--accent);
}
button.lobby-badge.bot-diff {
  cursor: pointer;
  border: none;
  font-family: var(--font-body);
  transition: opacity 0.15s;
}
button.lobby-badge.bot-diff:hover { opacity: 0.7; }
.lobby-badge.bot-diff.easy { background: rgba(74,222,128,0.15); color: #4ADE80; }
.lobby-badge.bot-diff.medium { background: rgba(245,158,11,0.15); color: #F59E0B; }
.lobby-badge.bot-diff.hard { background: rgba(239,68,68,0.15); color: #EF4444; }
[data-theme="light"] .lobby-badge.bot-diff.easy { background: #DCFCE7; color: #166534; }
[data-theme="light"] .lobby-badge.bot-diff.medium { background: #FEF3C7; color: #92400E; }
[data-theme="light"] .lobby-badge.bot-diff.hard { background: #FEE2E2; color: #991B1B; }

.btn-remove-bot {
  background: none;
  border: none;
  color: var(--text-secondary);
  font-size: 18px;
  line-height: 1;
  cursor: pointer;
  padding: 0 2px;
  opacity: 0.4;
  transition: opacity 0.15s, color 0.15s;
}
.btn-remove-bot:hover { opacity: 1; color: var(--danger); }

.lobby-add-bot {
  cursor: pointer;
  opacity: 0.5;
  transition: opacity 0.15s;
}
.lobby-add-bot:hover { opacity: 0.8; }
.lobby-add-bot .lobby-player-avatar {
  border-style: dashed;
  color: var(--text-secondary);
  background: transparent;
}
.lobby-add-bot .lobby-player-name {
  color: var(--text-secondary);
}

/* --- Settings --- */
.settings-grid {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.setting-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
}
.setting-label {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-secondary);
  white-space: nowrap;
  letter-spacing: 0.5px;
  text-transform: uppercase;
}
.setting-value {
  font-size: 13px;
  font-weight: 700;
  color: var(--text);
}
.setting-slider {
  display: flex;
  align-items: center;
  gap: 10px;
  flex: 1;
  min-width: 0;
}
.setting-slider input[type="range"] {
  flex: 1;
  -webkit-appearance: none;
  appearance: none;
  height: 4px;
  background: var(--border);
  border-radius: 2px;
  outline: none;
  cursor: pointer;
}
.setting-slider input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--accent);
  border: 2px solid var(--bg);
  box-shadow: 0 0 4px rgba(0,0,0,0.3);
  cursor: pointer;
}
.setting-slider input[type="range"]::-moz-range-thumb {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--accent);
  border: 2px solid var(--bg);
  box-shadow: 0 0 4px rgba(0,0,0,0.3);
  cursor: pointer;
}
.setting-slider-val {
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 700;
  color: var(--text);
  min-width: 40px;
  text-align: right;
}

.wait-text {
  color: var(--text-secondary);
  text-align: center;
  font-size: 13px;
}

/* --- Game Screen --- */
#game-ui-layer {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 100;
  display: flex;
  flex-direction: column;
}

#top-controls {
  padding: 12px 16px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  pointer-events: auto;
}

#game-code-tag {
  font-family: var(--font-mono);
  font-weight: 700;
  font-size: 10px;
  letter-spacing: 3px;
  color: var(--text-secondary);
  opacity: 0.4;
}

/* --- Top Bar Buttons --- */
.top-btn {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  background: transparent;
  border: none;
  color: var(--text-secondary);
  padding: 6px 8px;
  border-radius: 0;
  font-family: var(--font-body);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  cursor: pointer;
  transition: color 0.12s ease;
}
.top-btn:hover {
  color: var(--text);
}
.top-btn svg { flex-shrink: 0; }
.top-btn-label { display: none; }
.top-controls-right {
  display: flex;
  align-items: center;
  gap: 2px;
}

/* --- Overflow Menu --- */
.top-menu-wrap { position: relative; }
.top-menu-dropdown {
  position: absolute;
  top: 100%;
  right: 0;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-md);
  min-width: 140px;
  z-index: 500;
  display: flex;
  flex-direction: column;
}
.top-menu-item {
  padding: 10px 16px;
  background: none;
  border: none;
  font-family: var(--font-body);
  font-size: 12px;
  font-weight: 600;
  color: var(--text);
  text-align: left;
  cursor: pointer;
  transition: background-color 0.12s ease;
}
.top-menu-item:hover { background: var(--bg-surface); }

/* --- Game Table --- */
#game-table {
  flex: 1;
  margin: 0 auto;
  width: 90vw;
  max-width: 900px;
  position: relative;
  background: var(--bg-surface);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-md);
  pointer-events: none;
}

#game-stage {
  height: 100dvh;
  display: flex;
  align-items: center;
  justify-content: center;
}
#table-wrapper {
  width: 90vw;
  max-width: 900px;
  height: 70vh;
  position: relative;
}
#main-table {
  width: 100%; height: 100%;
  background: var(--bg-surface);
  border-radius: var(--radius-xl);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-md);
  position: relative;
}
#table-surface {
  width: 100%; height: 100%;
  position: relative;
  border-radius: var(--radius-xl);
}
#felt-inlay {
  position: absolute;
  inset: 0;
  border-radius: var(--radius-xl);
  background: radial-gradient(ellipse at 50% 50%, rgba(255,255,255,0.02) 0%, transparent 70%);
}
#felt-inlay::after {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  width: 75%;
  height: 75%;
  transform: translate(-50%, -50%);
  border: 1px solid rgba(255,255,255,0.06);
  border-radius: 50%;
  pointer-events: none;
}

/* --- Stats Bar --- */
#player-stats-bar {
  pointer-events: auto;
  margin: 0 16px;
  display: flex;
  gap: 4px;
  justify-content: center;
  flex-wrap: wrap;
}

.stat-chip {
  background: var(--bg-elevated);
  border: 1px solid rgba(var(--accent-rgb), 0.2);
  padding: 3px 8px;
  border-radius: var(--radius-pill);
  display: flex;
  align-items: center;
  gap: 4px;
  font-family: var(--font-mono);
  font-size: 10px;
  transition: border-color 0.15s ease;
}
.stat-chip.active {
  border-color: rgba(var(--accent-rgb), 0.5);
}
.stat-chip .p-indicator {
  width: 6px; height: 6px;
  border-radius: 50%;
  background: var(--border);
}
.stat-chip.on-track .p-indicator { background: var(--success); }
.stat-chip.failing .p-indicator { background: var(--danger); }
.stat-chip .p-name {
  font-weight: 500;
  font-size: 10px;
  color: var(--text-secondary);
}
.stat-chip .p-val {
  font-weight: 700;
  font-size: 11px;
  color: var(--text);
}

/* --- Center Zone --- */
#center-pot {
  position: absolute;
  top: 50%; left: 50%;
  transform: translate(-50%, -50%);
  width: 400px;
  height: 200px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  pointer-events: none;
  z-index: 10;
}

#active-trick {
  width: 100%;
  min-height: 150px;
  display: flex;
  gap: 20px;
  justify-content: center;
  align-items: center;
  position: relative;
  pointer-events: auto;
  cursor: pointer;
}


/* --- Seats & Avatars --- */
#seats-container { position: absolute; inset: 0; }

.seat {
  position: absolute;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.avatar-sphere {
  width: 44px; height: 44px;
  background: transparent;
  border: 2px solid var(--border);
  border-radius: 50%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
  position: relative;
}
.avatar-sphere.active {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(var(--accent-rgb), 0.3), 0 0 12px rgba(var(--accent-rgb), 0.25);
}
.avatar-sphere .initial { font-size: 16px; font-weight: 700; line-height: 1; }

.seat .seat-name {
  font-size: 10px;
  font-weight: 700;
  color: var(--text-secondary);
  margin-top: 4px;
  max-width: 70px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  text-align: center;
}

.role-badge {
  position: absolute;
  bottom: -6px;
  padding: 2px;
  border-radius: 50%;
  width: 18px;
  height: 18px;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 5;
  border: 1.5px solid var(--bg-surface);
}
.role-badge svg { width: 10px; height: 10px; }
.role-badge.mano { background: #2D5A3D; }
.role-badge.mano svg { stroke: #6EE7A0; fill: none; }
.role-badge.pie { background: #5A2D2D; }
.role-badge.pie svg { stroke: #F08080; fill: none; }

/* --- Cards --- */
.card-3d {
  width: var(--card-w);
  min-width: var(--card-w);
  height: var(--card-h);
  position: relative;
  flex-shrink: 0;
}
.card-inner {
  position: relative;
  width: 100%; height: 100%;
}
.card-front, .card-back {
  position: absolute;
  inset: 0;
  border-radius: var(--card-radius);
}
.card-front {
  background: var(--card-bg);
  color: var(--card-black);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  border: 1px solid rgba(0,0,0,0.08);
  box-shadow: 0 1px 1px rgba(0,0,0,0.2), 0 4px 12px rgba(0,0,0,0.15);
  gap: 2px;
  z-index: 1;
}
.card-front.red { color: var(--card-red); }

.card-back {
  background: var(--card-back);
  border: 2px solid rgba(212,168,67,0.3);
  display: none;
  z-index: 0;
}
.card-back .pattern {
  width: calc(100% - 8px); height: calc(100% - 8px);
  margin: 4px;
  border: 1px solid rgba(212,168,67,0.2);
  border-radius: 2px;
  background-image:
    repeating-linear-gradient(45deg, transparent, transparent 5px, rgba(212,168,67,0.1) 5px, rgba(212,168,67,0.1) 6px),
    repeating-linear-gradient(-45deg, transparent, transparent 5px, rgba(212,168,67,0.1) 5px, rgba(212,168,67,0.1) 6px);
}

.card-front .rank { font-size: 22px; font-weight: 800; line-height: 1; }
.card-front .suit-sm { font-size: 18px; line-height: 1; }

.corner, .corner-br {
  position: absolute;
  display: flex;
  flex-direction: column;
  align-items: center;
  line-height: 1.1;
  font-weight: 800;
}
.corner { top: 4px; left: 5px; }
.corner span:first-child { font-size: 15px; }
.corner span:last-child { font-size: 13px; }
.corner-br { bottom: 4px; right: 5px; transform: rotate(180deg); }
.corner-br span:first-child { font-size: 15px; }
.corner-br span:last-child { font-size: 13px; }

/* --- Sort Button (hidden — always ascending) --- */
.btn-sort-hand { display: none; }

/* --- Hand Area --- */
#player-hand-container {
  position: fixed;
  bottom: 0; left: 50%;
  transform: translateX(-50%);
  width: 100%;
  max-width: 800px;
  pointer-events: auto;
  z-index: 200;
}
#my-actual-hand {
  display: flex;
  justify-content: center;
  padding-bottom: 30px;
}
.my-card {
  transition: transform 0.2s cubic-bezier(0.34, 1.56, 0.64, 1), box-shadow 0.15s ease !important;
  cursor: pointer;
}
.my-card::after {
  content: '';
  position: absolute;
  left: -4px;
  right: -4px;
  bottom: -60px;
  height: 60px;
}
.my-card:hover {
  transform: translateY(-28px) !important;
  z-index: 1000 !important;
  box-shadow: 0 16px 32px rgba(0,0,0,0.3), 0 0 8px rgba(212,168,67,0.2);
}
.my-card.disabled { filter: brightness(0.35) saturate(0.5); pointer-events: none; }

/* --- Hand Status (unified turn + role) --- */
.hand-status {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 5px 14px;
  margin: 0 auto 40px;
  border-radius: var(--radius-pill);
  font-family: var(--font-body);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 1px;
  text-transform: uppercase;
  width: fit-content;
  pointer-events: none;
}
.hand-status svg { width: 12px; height: 12px; flex-shrink: 0; }
.hand-status-role { display: flex; align-items: center; gap: 3px; }
.hand-status-sep { opacity: 0.4; }
.hand-status.active {
  background: var(--accent);
  color: var(--text-inverse);
  animation: turnPulse 2s ease-in-out infinite;
}
.hand-status.active svg { stroke: var(--text-inverse); }
.hand-status.role-only {
  padding: 3px 10px;
  font-size: 9px;
  opacity: 0.6;
}
.hand-status.role-only.mano { background: #2D5A3D; color: #6EE7A0; }
.hand-status.role-only.mano svg { stroke: #6EE7A0; }
.hand-status.role-only.pie { background: #5A2D2D; color: #F08080; }
.hand-status.role-only.pie svg { stroke: #F08080; }

/* --- Card Keyboard Badges --- */
.card-badge {
  position: absolute;
  top: -8px;
  right: -6px;
  background: var(--text);
  color: var(--text-inverse);
  font-size: 11px;
  font-weight: 700;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 5;
  pointer-events: none;
  opacity: 0.4;
  transition: opacity 0.15s ease;
}
#my-actual-hand:hover .card-badge {
  opacity: 1;
}
.my-card:hover .card-badge {
  opacity: 1;
}

/* --- Trick Animations --- */
.played-card {
  position: absolute;
  transition: transform 0.5s ease, opacity 0.3s ease;
}
.in-place {
  transform: translate(var(--px, 0px), var(--py, 0px)) rotate(var(--r)) scale(1) !important;
  opacity: 1 !important;
}

.played-card:not(.winner-glow) { z-index: 1; }
.winner-glow { z-index: 2; }
.winner-glow .card-front { display: none; }
.winner-glow .card-back {
  display: flex;
  align-items: center;
  justify-content: center;
  border-color: var(--accent);
  animation: winnerPulse 1.5s ease infinite;
}
@keyframes winnerPulse {
  0%, 100% { box-shadow: 0 0 8px rgba(var(--accent-rgb), 0.3); }
  50% { box-shadow: 0 0 16px rgba(var(--accent-rgb), 0.5); }
}

/* --- Turn Indicator --- */
/* .turn-indicator removed — replaced by .hand-status */
@keyframes turnPulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.4; }
}

/* --- Turn Timer Ring --- */
.turn-timer-ring {
  position: absolute;
  inset: -4px;
  width: calc(100% + 8px);
  height: calc(100% + 8px);
  pointer-events: none;
  z-index: 3;
}
.turn-timer-ring circle {
  transition: stroke-dashoffset 0.15s linear, stroke 0.3s ease;
  transform: rotate(-90deg);
  transform-origin: center;
}

/* --- Turn Timer Bar --- */
.turn-timer-bar {
  position: fixed;
  bottom: 0;
  left: 0;
  width: 100%;
  height: 3px;
  background: rgba(255,255,255,0.06);
  border-radius: 0;
  overflow: hidden;
  z-index: 250;
  pointer-events: none;
}
.timer-fill {
  height: 100%;
  width: 100%;
  background: var(--accent);
  border-radius: 2px;
  transition: width 0.15s linear, background 0.3s ease;
}

/* --- Trick Stacks --- */
.trick-stack {
  position: absolute;
  display: flex;
  flex-direction: column;
  align-items: center;
  z-index: 5;
}
.stack-card {
  width: 32px;
  height: 46px;
  background: var(--card-back);
  border: 1.5px solid var(--bg-elevated);
  border-radius: 4px;
  position: absolute;
  box-shadow: 0 1px 3px rgba(0,0,0,0.15);
}
.stack-card::after {
  content: '';
  position: absolute;
  inset: 3px;
  border: 1px solid rgba(212,168,67,0.12);
  border-radius: 2px;
  background-image:
    repeating-linear-gradient(45deg, transparent, transparent 3px, rgba(212,168,67,0.05) 3px, rgba(212,168,67,0.05) 4px);
}
.stack-count {
  position: relative;
  top: 50px;
  font-size: 11px;
  font-weight: 800;
  color: var(--text-secondary);
  background: var(--bg-elevated);
  padding: 1px 6px;
  border-radius: 0;
  box-shadow: var(--shadow-sm);
}

/* --- Bidding HUD --- */
#action-hud {
  position: fixed;
  top: 40%; left: 50%;
  transform: translate(-50%, -50%);
  z-index: 300;
  pointer-events: auto;
}

#bid-wheel {
  background: var(--bg-elevated);
  padding: 20px 28px;
  border-radius: var(--radius-lg);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-lg);
  z-index: 500;
  pointer-events: auto;
  text-align: center;
}
.bid-label {
  font-family: var(--font-body);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  color: var(--accent);
}
.bid-grid { display: flex; flex-wrap: wrap; justify-content: center; gap: 10px; margin-top: 12px; }
.btn-bid {
  width: 48px; height: 48px;
  background: transparent;
  border: 2px solid var(--border);
  color: var(--text);
  border-radius: 50%;
  font-family: var(--font-mono);
  font-weight: 700;
  font-size: 17px;
  cursor: pointer;
  transition: background-color 0.12s ease, color 0.12s ease, border-color 0.12s ease;
}
.btn-bid:hover { background: var(--accent); color: var(--text-inverse); border-color: var(--accent); }
.btn-bid.forbidden { opacity: 0.12; border-color: var(--danger); color: var(--danger); pointer-events: none; }

/* --- Scoreboard --- */
.scoreboard {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  z-index: 2000;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  pointer-events: auto;
}
.score-modal, .glass-panel {
  background: var(--bg-elevated);
  padding: 24px 28px;
  box-shadow: var(--shadow-lg);
  max-width: 100%;
  width: 100%;
  border-radius: var(--radius-lg) var(--radius-lg) 0 0;
  animation: slideUp 0.3s ease;
}
.score-modal h3 {
  font-family: var(--font-display);
  font-size: 24px;
  font-weight: 400;
  font-style: normal;
  color: var(--text);
  letter-spacing: 0;
  text-transform: none;
  margin-bottom: 24px;
  text-align: center;
}
.score-modal table { width: 100%; border-collapse: collapse; margin-bottom: 24px; }
.score-modal th {
  font-size: 9px;
  font-weight: 700;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 1px;
  padding-bottom: 12px;
}
.score-modal td {
  padding: 10px;
  font-family: var(--font-mono);
  font-weight: 700;
  font-size: 12px;
  border-bottom: 1px solid var(--bg-surface);
  text-align: center;
}

/* --- Overlays --- */
.overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 3000;
}
.overlay-content {
  background: var(--bg-elevated);
  border-radius: var(--radius-lg);
  padding: 36px 40px;
  box-shadow: var(--shadow-lg);
  max-width: 500px;
  width: 90%;
  text-align: center;
}

/* Results: bottom sheet */
#screen-results {
  align-items: flex-end;
}
#screen-results .overlay-content {
  max-width: 100%;
  width: 100%;
  border-radius: var(--radius-lg) var(--radius-lg) 0 0;
  padding: 24px 32px 32px;
  animation: slideUp 0.3s ease !important;
}
@keyframes slideUp {
  from { transform: translateY(100%); }
  to { transform: translateY(0); }
}

/* Game Over: fullscreen takeover */
#screen-gameover {
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
  background: var(--bg);
}
#screen-gameover .overlay-content {
  max-width: 100%;
  width: 100%;
  height: 100%;
  border-radius: 0;
  background: var(--bg);
  box-shadow: none;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 16px;
  padding: 40px;
}
#screen-gameover .overlay-content h2 {
  font-family: var(--font-display);
  font-size: 48px;
  font-style: normal;
  font-weight: 400;
  letter-spacing: 0;
  text-transform: none;
}

/* Rules: bottom sheet */
#rules-modal {
  align-items: flex-end;
}
#rules-modal .overlay-content {
  max-width: 100%;
  width: 100%;
  border-radius: var(--radius-lg) var(--radius-lg) 0 0;
  animation: slideUp 0.3s ease !important;
  max-height: 85vh;
  overflow-y: auto;
}

.overlay-content h2 {
  font-family: var(--font-display);
  font-size: 24px;
  font-weight: 400;
  font-style: normal;
  color: var(--text);
  letter-spacing: 0;
  text-transform: none;
  margin-bottom: 24px;
}

#results-table, #final-table { width: 100%; border-collapse: collapse; margin: 20px 0; }
#results-table th, #final-table th {
  font-size: 9px;
  font-weight: 700;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 1px;
  padding-bottom: 12px;
}
#results-table td, #final-table td {
  padding: 12px;
  font-family: var(--font-mono);
  font-weight: 700;
  font-size: 12px;
  border-bottom: 1px solid var(--bg-surface);
  text-align: center;
}
.score-hit { color: var(--success); }
.score-miss { color: var(--danger); }

/* --- Dealer Draw --- */
.dealer-draw-area {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 32px;
  z-index: 50;
  pointer-events: auto;
}
.draw-players {
  display: flex;
  gap: 32px;
  align-items: flex-start;
  justify-content: center;
  flex-wrap: wrap;
  padding: 0 24px;
}
.draw-player {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  min-width: 80px;
}
.draw-avatar {
  width: 52px;
  height: 52px;
  border-radius: 50%;
  background: transparent;
  border: 2px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  font-size: 20px;
  color: var(--text);
}
.draw-name {
  font-size: 12px;
  font-weight: 700;
  color: var(--text-secondary);
  text-align: center;
  max-width: 80px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.draw-card-slot {
  width: 60px;
  height: 84px;
}
.draw-card {
  width: 100%;
  height: 100%;
  border-radius: var(--card-radius);
  transition: transform 0.4s ease;
  position: relative;
}
.draw-card.face-down {
  background: var(--card-back);
  border: 2px solid var(--bg-elevated);
  box-shadow: var(--shadow-sm);
}
.draw-card.face-down .draw-card-back {
  width: calc(100% - 6px);
  height: calc(100% - 6px);
  margin: 3px;
  border: 1px solid rgba(212,168,67,0.12);
  border-radius: 3px;
  background-image:
    repeating-linear-gradient(45deg, transparent, transparent 4px, rgba(212,168,67,0.06) 4px, rgba(212,168,67,0.06) 5px),
    repeating-linear-gradient(-45deg, transparent, transparent 4px, rgba(212,168,67,0.06) 4px, rgba(212,168,67,0.06) 5px);
}
.draw-card.face-up {
  animation: cardFlipIn 0.4s ease;
}
@keyframes cardFlipIn {
  0% { transform: rotateY(90deg); }
  100% { transform: rotateY(0deg); }
}
.draw-card-front {
  width: 100%;
  height: 100%;
  background: var(--card-bg);
  border: 1px solid rgba(0,0,0,0.1);
  border-radius: var(--card-radius);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  box-shadow: var(--shadow-sm);
  color: var(--card-black);
}
.draw-card-front.red { color: var(--card-red); }
.draw-rank { font-size: 22px; font-weight: 800; line-height: 1; }
.draw-suit { font-size: 16px; margin-top: 2px; }

.draw-card.draw-winner {
  box-shadow: 0 0 16px var(--accent), 0 0 32px rgba(var(--accent-rgb), 0.3);
  animation: winnerPulse 1.5s ease infinite;
}

.draw-status {
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
}
.draw-toast {
  font-family: var(--font-body);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 1px;
  text-transform: uppercase;
  color: var(--accent);
}

/* --- Toasts --- */
.toasts {
  position: fixed;
  top: 100px;
  bottom: auto;
  left: 50%;
  transform: translateX(-50%);
  z-index: 5000;
  display: flex;
  flex-direction: column;
  gap: 6px;
  pointer-events: none;
}
.toast {
  background: rgba(37, 36, 32, 0.92);
  color: var(--text);
  padding: 10px 20px;
  border-radius: var(--radius-pill);
  border: 1px solid var(--border);
  font-family: var(--font-body);
  font-weight: 500;
  font-size: 12px;
  letter-spacing: 0.3px;
  text-transform: none;
  box-shadow: var(--shadow-lg);
  animation: toastIn 0.25s ease;
  pointer-events: auto;
  white-space: nowrap;
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}
@keyframes toastIn {
  from { opacity: 0; transform: translateY(-8px); }
  to { opacity: 1; transform: translateY(0); }
}

.card-pending {
  filter: brightness(0.7);
}
@keyframes cardShake {
  0%, 100% { transform: translateX(0); }
  25% { transform: translateX(-6px); }
  75% { transform: translateX(6px); }
}
.card-rejected {
  animation: cardShake 0.4s ease !important;
}

.winner-glow-text {
  text-shadow: 0 0 20px rgba(var(--accent-rgb), 0.4);
}

.reconnecting-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.92);
  z-index: 10000;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 16px;
  color: #fff;
  font-family: var(--font-display);
  font-weight: 400;
  font-size: 24px;
  font-style: normal;
}
.reconnecting-overlay.hidden { display: none; }
.reconnecting-spinner {
  width: 48px;
  height: 48px;
  border: 2px solid rgba(255,255,255,0.1);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}
@keyframes spin {
  to { transform: rotate(360deg); }
}

.reconnect-attempts {
  font-family: var(--font-body);
  font-size: 12px;
  font-weight: 600;
  opacity: 0.5;
  font-style: normal;
}

.avatar-sphere.disconnected {
  opacity: 0.35;
  filter: grayscale(1);
}
.disconnected-badge {
  position: absolute;
  top: -8px;
  left: -8px;
  font-size: 14px;
  z-index: 2;
}

.auto-advance-countdown {
  margin-top: 12px;
  font-size: 11px;
  font-weight: 700;
  color: var(--text-secondary);
  letter-spacing: 2px;
  text-transform: uppercase;
}

.opp-cards {
  display: flex;
  justify-content: center;
  margin-top: 6px;
  height: 20px;
  opacity: 0.8;
  position: relative;
  z-index: 0;
}
.opp-card-stub {
  width: 14px;
  height: 20px;
  background: var(--card-back);
  border: 1px solid rgba(212,168,67,0.25);
  border-radius: 2px;
  margin-left: -6px;
  box-shadow: 0 1px 2px rgba(0,0,0,0.2);
  transform-origin: bottom center;
}
.opp-card-stub:first-child { margin-left: 0; }

.seat-tricks {
  display: flex;
  justify-content: center;
  margin-top: 4px;
  height: 14px;
  opacity: 0.6;
}
.seat-trick-stub {
  width: 10px;
  height: 14px;
  background: var(--card-back);
  border: 1px solid var(--bg-elevated);
  border-radius: 1px;
  margin-left: -4px;
}
.seat-trick-stub:first-child {
  margin-left: 0;
}

.my-trick-count {
  position: absolute;
  top: 4px;
  left: 12px;
  font-size: 10px;
  font-weight: 800;
  color: var(--text-secondary);
  letter-spacing: 0.5px;
  z-index: 210;
  pointer-events: none;
  display: flex;
  align-items: center;
  gap: 4px;
}
.my-trick-count .trick-pip {
  width: 8px;
  height: 11px;
  background: var(--accent);
  border-radius: 1px;
  display: inline-block;
}

.bot-seat-badge {
  position: absolute;
  top: -6px;
  right: -6px;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  border: 1.5px solid var(--bg-elevated);
  z-index: 2;
}

@keyframes overlayIn {
  from { opacity: 0; transform: scale(0.96); }
  to { opacity: 1; transform: scale(1); }
}
.overlay:not(.hidden) .overlay-content {
  animation: overlayIn 0.3s ease;
}

.forbidden-label {
  position: absolute;
  bottom: -16px;
  left: 50%;
  transform: translateX(-50%);
  font-size: 7px;
  font-weight: 800;
  color: var(--danger);
  letter-spacing: 1px;
  text-transform: uppercase;
  white-space: nowrap;
}

.trick-placeholder {
  color: var(--text-secondary);
  opacity: 0.2;
  font-size: 28px;
  text-align: center;
  line-height: 1.6;
  letter-spacing: 8px;
  user-select: none;
}
.trick-placeholder br + * {
  font-size: 11px;
  letter-spacing: 2px;
}

.played-card.in-place::after { display: none; }

@keyframes scoreBounce {
  0% { transform: scale(1); }
  40% { transform: scale(1.25); color: var(--accent); }
  100% { transform: scale(1); }
}
.score-bounce {
  animation: scoreBounce 0.6s ease;
  display: inline-block;
}

.reaction-bar {
  display: flex;
  gap: 4px;
  justify-content: center;
  padding: 4px 0 8px;
  position: relative;
  z-index: 1001;
}
.reaction-btn {
  background: transparent;
  border: none;
  border-radius: 0;
  width: 30px;
  height: 30px;
  font-size: 16px;
  color: var(--text-secondary);
  cursor: pointer;
  transition: background-color 0.12s ease, color 0.12s ease;
  display: flex;
  align-items: center;
  justify-content: center;
}
.reaction-btn:hover {
  color: var(--text);
  background: var(--bg-surface);
}
.emoji-bubble {
  padding: 10px;
  line-height: 0;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
}
.emoji-bubble svg {
  display: block;
  stroke: var(--text);
}

/* --- Chat --- */
.chat-input-bar {
  display: flex;
  gap: 6px;
  justify-content: center;
  padding: 4px 16px 8px;
}
.chat-input-bar input {
  flex: 1;
  max-width: 200px;
  padding: 8px 14px;
  font-size: 13px;
  border-radius: 0;
  border: 1px solid var(--border);
  background: var(--bg-elevated);
  color: var(--text);
  text-align: left;
}
.chat-input-bar input:focus {
  border-color: var(--accent);
}
.chat-input-bar input:focus:not(:focus-visible) {
  outline: none;
}
.btn-chat-send {
  width: 36px;
  height: 36px;
  border-radius: 0;
  border: none;
  background: var(--accent);
  color: #fff;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background-color 0.12s ease;
}
.btn-chat-send:hover { background: var(--accent-hover); }
.chat-toggle-btn svg { stroke: var(--text-secondary); }

/* --- Chat Bubbles --- */
.chat-bubble {
  position: fixed;
  transform: translateX(-50%);
  background: var(--bg-elevated);
  color: var(--text);
  padding: 8px 14px;
  border-radius: 0 8px 8px 8px;
  font-size: 13px;
  font-weight: 500;
  max-width: 200px;
  word-wrap: break-word;
  box-shadow: var(--shadow-md);
  z-index: 150;
  pointer-events: auto;
  cursor: pointer;
  animation: chatIn 0.25s ease;
  border: 1px solid var(--border);
}
.chat-bubble .chat-name {
  font-size: 10px;
  font-weight: 700;
  color: var(--accent);
  letter-spacing: 1px;
  text-transform: uppercase;
  display: block;
  margin-bottom: 2px;
}
@keyframes chatIn {
  from { opacity: 0; transform: translateX(-50%) translateY(8px) scale(0.95); }
  to { opacity: 1; transform: translateX(-50%) translateY(0) scale(1); }
}

/* --- Rules --- */
.rules-content {
  text-align: center;
  max-width: 520px;
}
.rules-content h2 {
  text-align: center;
  margin-bottom: 20px;
}
.rules-content .btn {
  display: block;
  margin: 0 auto;
}

.rules-steps {
  display: flex;
  align-items: flex-start;
  justify-content: center;
  gap: 8px;
  margin-bottom: 24px;
}
.rules-step {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  flex: 1;
  max-width: 130px;
}
.rules-step-icon {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: var(--bg-surface);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--accent);
  margin-bottom: 4px;
}
.rules-step-title {
  font-family: var(--font-body);
  font-weight: 800;
  font-size: 12px;
  letter-spacing: 1px;
  text-transform: uppercase;
  color: var(--text);
}
.rules-step-desc {
  font-size: 12px;
  color: var(--text-secondary);
  line-height: 1.3;
}
.rules-step-arrow {
  color: var(--text-secondary);
  opacity: 0.3;
  padding-top: 14px;
  flex-shrink: 0;
}

.rules-scale-wrap {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  margin-bottom: 20px;
}
.rules-scale-label {
  font-size: 10px;
  letter-spacing: 1px;
  text-transform: uppercase;
  color: var(--text-secondary);
  font-weight: 700;
}
.rules-scale-arrow {
  color: var(--text-secondary);
  opacity: 0.3;
  line-height: 0;
}
.rules-scale-card .card-3d {
  width: 44px;
  min-width: 44px;
  height: 66px;
  cursor: default;
  pointer-events: none;
}
.rules-scale-card .card-front,
.rules-scale-card .card-back {
  border-radius: 4px;
}
.rules-scale-card .card-inner {
  transform: none !important;
}
.rules-scale-card .card-front .rank {
  font-size: 11px;
}
.rules-scale-card .card-front .suit-sm {
  font-size: 9px;
}
.rules-scale-card .card-front .corner span:first-child,
.rules-scale-card .card-front .corner-br span:first-child {
  font-size: 7px;
}
.rules-scale-card .card-front .corner span:last-child,
.rules-scale-card .card-front .corner-br span:last-child {
  font-size: 6px;
}

.rules-tagline {
  font-family: var(--font-display);
  font-size: 24px;
  font-weight: 400;
  font-style: normal;
  color: var(--text);
  margin-bottom: 20px;
}

.rules-details {
  text-align: left;
  margin-bottom: 20px;
  background: var(--bg-surface);
  border-radius: 0;
  padding: 4px 16px;
  max-height: 40vh;
  overflow-y: auto;
}
.rules-details[open] {
  padding: 4px 16px 16px;
}
.rules-details summary {
  cursor: pointer;
  font-size: 12px;
  font-weight: 700;
  color: var(--text-secondary);
  padding: 10px 0;
  list-style: none;
  display: flex;
  align-items: center;
  gap: 6px;
  justify-content: center;
  letter-spacing: 1px;
  text-transform: uppercase;
}
.rules-details summary::before {
  content: '\25B8';
  transition: transform 0.2s;
}
.rules-details[open] summary::before {
  transform: rotate(90deg);
}
.rules-details summary::-webkit-details-marker {
  display: none;
}
.rules-text {
  display: flex;
  flex-direction: column;
  gap: 10px;
  font-size: 13px;
  line-height: 1.5;
  color: var(--text);
  text-align: left;
}
.rules-text strong {
  color: var(--accent);
}

/* --- Dark Mode --- */
[data-theme="light"] {
  --bg: #F2EEE8;
  --bg-surface: #E8E4DC;
  --bg-elevated: #FFFFFF;
  --text: #1A1715;
  --text-secondary: #8A8580;
  --text-inverse: #F2EEE8;
  --accent: #B8922A;
  --accent-rgb: 184, 146, 42;
  --accent-hover: #A07D1F;
  --accent-soft: rgba(184, 146, 42, 0.10);
  --card-bg: #FFFFFF;
  --card-red: #B91C1C;
  --card-black: #1A1715;
  --card-back: #1E2A1E;
  --shadow-sm: 0 1px 2px rgba(0,0,0,0.06);
  --shadow-md: 0 3px 12px rgba(0,0,0,0.08);
  --shadow-lg: 0 12px 40px rgba(0,0,0,0.13);

  --border: #D4CFC7;
  --info: #B8922A;
  --success: #1A7F37;
  --danger: #CF222E;
  --warm: #D97706;
}
[data-theme="light"] .overlay {
  background: rgba(0, 0, 0, 0.4);
}
[data-theme="light"] .card-front {
  box-shadow: 0 1px 1px rgba(0,0,0,0.08), 0 4px 12px rgba(0,0,0,0.06);
}
[data-theme="light"] .toast {
  background: rgba(255, 255, 255, 0.92);
}
[data-theme="light"] .my-card.disabled {
  filter: brightness(0.85) saturate(0.4) opacity(0.5);
}

/* --- Home Actions --- */
.home-actions {
  position: fixed;
  top: 12px;
  right: 16px;
  display: flex;
  align-items: center;
  gap: 8px;
  z-index: 10;
}

/* --- Language Picker --- */
.lang-picker {
  background: transparent;
  border: 1px solid var(--border);
  border-radius: 0;
  padding: 6px 8px;
  font-family: var(--font-body);
  font-size: 12px;
  font-weight: 700;
  color: var(--text-secondary);
  cursor: pointer;
  letter-spacing: 1px;
}
.lang-picker:focus {
  border-color: var(--accent);
}
.lang-picker:focus:not(:focus-visible) {
  outline: none;
}

.online-count {
  font-size: 10px;
  font-weight: 600;
  color: var(--text-secondary);
  min-height: 0;
  letter-spacing: 0.5px;
  opacity: 0.5;
}

/* --- Mobile --- */
@media (max-width: 768px) {
  #player-stats-bar { margin: 4px 10px; gap: 6px; }
  .stat-chip { padding: 2px 6px; font-size: 10px; }
  #action-hud { top: 35%; }
  #table-wrapper { width: 95vw; }
  #main-table { border-radius: var(--radius-lg); }
  #table-surface, #felt-inlay { border-radius: var(--radius-lg); }

  .bid-grid { gap: 8px; }
  .btn-bid { width: 42px; height: 42px; font-size: 15px; }

  .seat .seat-name { font-size: 8px; max-width: 54px; }

  #center-pot { width: 280px; }

  .reaction-bar { gap: 2px; }
  .reaction-btn { width: 32px; height: 32px; font-size: 15px; }

  .rules-content { max-width: 100%; }
  #rules-modal .overlay-content { padding: 24px 16px; }
  .rules-step-desc { font-size: 11px; }


  .card-badge { display: none !important; }

  .top-btn { padding: 8px; }
  .top-controls-right { gap: 0; }
}

/* --- Desktop --- */
@media (min-width: 769px) {
  :root { --card-w: 90px; --card-h: 128px; }
  .top-btn-label { display: inline; }
  .logo { font-size: 80px; }
}

/* --- Reduced Motion --- */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}
