:root {
  --bg-dark: #0d0f1a;
  --bg-panel: #1a1d33;
  --text: #e0e8ff;
  --muted: #a0a8c8;
  --accent-blue: #6fa8ff;
  --accent-pink: #ff7ac2;
  --accent-green: #6fe3a2;
  --accent-yellow: #ffd86b;
  --accent-red: #ff6f6f;
  --accent-purple: #b794f6;
  --shadow: 0 8px 30px rgba(0, 0, 0, 0.5);
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  height: 100%;
  overflow: hidden;
}

body {
  background: radial-gradient(circle at top, #1e2245, var(--bg-dark) 70%);
  color: var(--text);
  font-family: "Lexend", system-ui, -apple-system, Segoe UI, Roboto, sans-serif;
}

/* Header */
.app-header {
  padding: 16px 24px;
  border-bottom: 1px solid #303560;
}

.title-wrap {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  flex-wrap: wrap;
}

.brand {
  display: flex;
  align-items: flex-end;
  gap: 10px;
  flex-wrap: wrap;
}

.help-btn {
  margin-left: 6px;
  padding: 6px 10px;
  border-radius: 999px;
  border: 1px solid #4a4f80;
  background: #2a2d4a;
  color: #fff;
  font-size: 12px;
  cursor: pointer;
  transition: all 0.2s;
}

.help-btn:hover {
  background: #38406c;
}

.help-btn:active {
  transform: translateY(1px);
}

.limit-badge,
.game-title {
  font-size: 32px;
  font-weight: 900;
  color: var(--accent-blue);
  line-height: 1;
  text-shadow: 0 0 6px #1a1d33;
}

.bunny-digits {
  font-family: "Space Mono", monospace;
  font-size: 18px;
  color: var(--accent-green);
  text-shadow: 0 0 10px var(--accent-green);
  white-space: nowrap;
}

.game-info {
  display: flex;
  gap: 32px;
  margin-top: 8px;
  flex-wrap: wrap;
}

.blind-info {
  font-family: "Space Mono", monospace;
  font-size: 14px;
}

.blind-info .label {
  color: var(--muted);
}

.blind-info .value {
  color: var(--accent-yellow);
  font-weight: 700;
  margin: 0 6px;
}

.blind-info .amount {
  color: var(--accent-pink);
}

/* Layout */
.layout {
  display: grid;
  grid-template-columns: 1fr 420px;
  gap: 16px;
  padding: 16px;
  height: calc(100vh - 120px);
}

.table {
  background: linear-gradient(135deg, #0a1628 0%, #000 100%);
  border-radius: 16px;
  box-shadow: var(--shadow);
  overflow: hidden;
  border: 1px solid #303560;
  position: relative;
}

.right-panel {
  display: flex;
  flex-direction: column;
  gap: 16px;
  overflow-y: auto;
}

/* Arena */
.arena {
  position: absolute;
  inset: 0;
  padding: 20px;
}

.center-area {
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  display: flex;
  flex-direction: column;
  gap: 16px;
  align-items: center;
}

.pot-display {
  background: var(--bg-panel);
  border: 2px solid var(--accent-yellow);
  border-radius: 16px;
  padding: 12px 24px;
  text-align: center;
  box-shadow: 0 0 20px rgba(255, 216, 107, 0.3);
}

.pot-label {
  font-size: 14px;
  color: var(--muted);
  font-family: "Space Mono", monospace;
}

.pot-amount {
  font-size: 32px;
  font-weight: 900;
  color: var(--accent-yellow);
  font-family: "Space Mono", monospace;
  text-shadow: 0 0 10px var(--accent-yellow);
}

.deck-area {
  display: flex;
  gap: 16px;
  align-items: center;
}

.pile {
  width: 100px;
  height: 140px;
  border-radius: 10px;
  background: #111429;
  border: 2px solid #4a4f80;
  box-shadow: var(--shadow);
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
}

.pile.draw::after {
  content: "Deck";
  position: absolute;
  bottom: 8px;
  text-align: center;
  color: var(--muted);
  font-family: "Space Mono";
  font-size: 12px;
}

.pile.discard::after {
  content: "Discard";
  position: absolute;
  bottom: 8px;
  text-align: center;
  color: var(--muted);
  font-family: "Space Mono";
  font-size: 11px;
}

.deck-count {
  position: absolute;
  top: 8px;
  right: 8px;
  background: #2a2d4a;
  color: #fff;
  font-family: "Space Mono";
  font-size: 14px;
  font-weight: 700;
  padding: 4px 8px;
  border-radius: 999px;
  border: 1px solid #4a4f80;
}

/* Players Container */
.players-container {
  position: relative;
  width: 100%;
  height: 100%;
}

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

.player-info {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  background: var(--bg-panel);
  border: 2px solid #4a4f80;
  border-radius: 10px;
  padding: 8px 10px;
  box-shadow: var(--shadow);
  min-width: 110px;
}

.player-seat.active .player-info {
  border-color: var(--accent-green);
  box-shadow: 0 0 20px rgba(111, 227, 162, 0.4);
}

.player-seat.dealer .player-info::before {
  content: "D";
  position: absolute;
  top: -12px;
  right: -12px;
  background: var(--accent-blue);
  color: #fff;
  font-weight: 900;
  font-size: 12px;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 2px solid var(--bg-dark);
}

.player-seat.small-blind .player-info::before {
  content: "SB";
  position: absolute;
  top: -12px;
  left: -12px;
  background: var(--accent-yellow);
  color: #000;
  font-weight: 900;
  font-size: 10px;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 2px solid var(--bg-dark);
}

.player-seat.big-blind .player-info::before {
  content: "BB";
  position: absolute;
  top: -12px;
  right: -12px;
  background: var(--accent-pink);
  color: #fff;
  font-weight: 900;
  font-size: 10px;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 2px solid var(--bg-dark);
}

.player-avatar {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  border: 3px solid #4a4f80;
  background: #111429;
  box-shadow: var(--shadow);
  background-size: cover;
  background-position: center;
}

.player-seat.active .player-avatar {
  border-color: var(--accent-green);
}

.player-seat.folded .player-avatar {
  opacity: 0.4;
  filter: grayscale(1);
}

.avatar-female {
  background-image: radial-gradient(circle at 30% 30%, #ff9bd8, #7b2e6f);
}

.avatar-male {
  background-image: radial-gradient(circle at 30% 30%, #7bd0ff, #1e4d7b);
}

.avatar-human {
  background-image: radial-gradient(circle at 30% 30%, #d1d1ff, #4747a3);
}

.avatar-robot {
  background-image: radial-gradient(circle at 30% 30%, #b8e1ff, #3c627a);
}

.avatar-bunny {
  background-image: radial-gradient(circle at 30% 30%, #ffd6e8, #b35d8a);
}

.avatar-wizard {
  background-image: radial-gradient(circle at 30% 30%, #e6d5ff, #6a3fb3);
}

.player-name {
  font-weight: 700;
  font-size: 14px;
  color: var(--text);
}

.player-money {
  font-family: "Space Mono", monospace;
  font-size: 12px;
  color: var(--accent-yellow);
  font-weight: 700;
}

.player-status {
  font-family: "Space Mono", monospace;
  font-size: 11px;
  color: var(--muted);
  font-style: italic;
}

.player-seat.folded .player-status {
  color: var(--accent-red);
}

/* Player hands */
.player-hand {
  display: flex;
  gap: 6px;
  margin-top: 8px;
}

/* Cards */
.card {
  width: 64px;
  height: 90px;
  border-radius: 8px;
  background: linear-gradient(180deg, #ffffff 0%, #eaf0ff 100%);
  color: #222;
  border: 2px solid #d0d4e6;
  box-shadow: var(--shadow);
  position: relative;
  cursor: pointer;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: 6px;
}

.card:hover {
  transform: translateY(-4px);
  box-shadow: 0 12px 36px rgba(0, 0, 0, 0.45);
}

.card.selected {
  transform: translateY(-12px);
  border-color: var(--accent-pink);
  box-shadow: 0 0 20px rgba(255, 122, 194, 0.6);
}

.card .rank {
  font-family: "Space Mono", monospace;
  font-weight: 700;
  font-size: 16px;
}

.card .suit {
  font-size: 20px;
  text-align: right;
}

.card.hearts,
.card.diamonds {
  color: #b8103c;
}

.card.spades,
.card.clubs {
  color: #0d0f1a;
}

.card.joker {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: #fff;
  border-color: var(--accent-purple);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 900;
  font-size: 14px;
}

.card.back {
  background: radial-gradient(circle at 30% 30%, #6fa8ff, #1a1d33);
  border-color: #6fa8ff;
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 900;
  letter-spacing: 0.5px;
  font-size: 11px;
  cursor: default;
}

.card.back:hover {
  transform: none;
  box-shadow: var(--shadow);
}

/* Panels */
.status-box,
.controls-box,
.player-chips-box,
.history-box {
  background: var(--bg-panel);
  border: 1px solid #303560;
  border-radius: 14px;
  padding: 16px;
  box-shadow: var(--shadow);
}

.status-box {
  display: flex;
  justify-content: space-around;
  text-align: center;
}

.status-item .label {
  font-size: 12px;
  color: var(--muted);
}

.status-item .value {
  display: block;
  font-size: 24px;
  font-weight: 700;
  font-family: "Space Mono";
  margin-top: 4px;
  color: var(--text);
}

.controls-box {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.question {
  text-align: center;
  font-weight: 700;
  color: var(--accent-blue);
  font-size: 16px;
}

.player-actions {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.betting-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.action-btn {
  padding: 12px;
  border-radius: 10px;
  border: 2px solid #4a4f80;
  background: #2a2d4a;
  color: #fff;
  font-weight: 700;
  font-size: 14px;
  cursor: pointer;
  transition: all 0.2s;
}

.action-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

.action-btn:active {
  transform: translateY(0);
}

.fold-btn {
  background: linear-gradient(135deg, #ff6b6b, #c92a2a);
  border-color: #c92a2a;
}

.check-btn {
  background: linear-gradient(135deg, #51cf66, #2f9e44);
  border-color: #2f9e44;
}

.call-btn {
  background: linear-gradient(135deg, #74c0fc, #339af0);
  border-color: #339af0;
}

.raise-btn {
  background: linear-gradient(135deg, #ffd43b, #fab005);
  border-color: #fab005;
  color: #000;
}

.action-btn.primary {
  background: linear-gradient(45deg, var(--accent-blue), var(--accent-pink));
  border: none;
  grid-column: 1 / -1;
}

.raise-input {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
}

.raise-input label {
  color: var(--muted);
  font-size: 14px;
}

.raise-input input {
  flex: 1;
  min-width: 100px;
  padding: 10px;
  border-radius: 8px;
  border: 1px solid #4a4f80;
  background: #141938;
  color: var(--text);
  font-family: "Space Mono", monospace;
  font-size: 16px;
}

.chip {
  padding: 8px 14px;
  border-radius: 999px;
  border: 1px solid #4a4f80;
  background: #2a2d4a;
  color: #fff;
  font-size: 13px;
  cursor: pointer;
  transition: all 0.2s;
}

.chip:hover {
  background: #38406c;
}

.discard-actions p {
  text-align: center;
  color: var(--muted);
  font-size: 14px;
  margin: 0 0 10px 0;
}

.hand-value-input {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.hand-value-input label {
  color: var(--muted);
  font-size: 14px;
}

.hand-value-input input {
  padding: 12px;
  border-radius: 8px;
  border: 1px solid #4a4f80;
  background: #141938;
  color: var(--text);
  font-family: "Space Mono", monospace;
  font-size: 18px;
  text-align: center;
}

.feedback {
  min-height: 20px;
  text-align: center;
  font-family: "Space Mono";
  font-size: 13px;
}

.feedback.error {
  color: var(--accent-red);
}

.feedback.success {
  color: var(--accent-green);
}

.hint {
  background: #1a1d33;
  border: 1px solid #4a4f80;
  border-radius: 8px;
  padding: 10px;
  color: var(--accent-yellow);
  font-size: 13px;
  line-height: 1.5;
}

.hidden {
  display: none !important;
}

/* Player Chips Display */
.player-chips-box h3 {
  margin: 0 0 10px;
  text-align: center;
  color: var(--accent-blue);
  font-size: 16px;
}

.chips-display {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.chip-row {
  display: flex;
  justify-content: space-between;
  font-family: "Space Mono", monospace;
  font-size: 14px;
  padding: 4px 8px;
  border-radius: 6px;
  background: #141938;
}

.chip-row.total {
  margin-top: 4px;
  border-top: 2px solid #4a4f80;
  padding-top: 8px;
  font-weight: 700;
  color: var(--accent-yellow);
}

.chip-label {
  color: var(--muted);
}

.chip-count {
  color: var(--text);
  font-weight: 700;
}

/* History */
.history-box h3 {
  margin: 0 0 8px;
  text-align: center;
  color: var(--accent-blue);
  font-size: 16px;
}

.history-list {
  margin: 0;
  padding-left: 20px;
  max-height: 180px;
  overflow-y: auto;
  overflow-x: hidden;
}

.history-list li {
  margin: 3px 0;
  padding: 4px 0;
  font-family: "Space Mono";
  font-size: 12px;
  line-height: 1.4;
  color: var(--muted);
}

.history-list li.highlight {
  color: var(--accent-green);
}

.history-list li.warning {
  color: var(--accent-yellow);
}

.history-list li.error {
  color: var(--accent-red);
}

/* Overlays */
.overlay {
  position: fixed;
  inset: 0;
  display: none;
  place-items: center;
  background: #0d0f1acc;
  backdrop-filter: blur(8px);
  z-index: 100;
}

.overlay.visible {
  display: grid;
}

.overlay .card {
  background: #000;
  border: 1px solid #303560;
  border-radius: 16px;
  padding: 32px;
  box-shadow: var(--shadow);
  color: #fff;
  max-width: 90vw;
  max-height: 85vh;
  overflow-y: auto;
}

.overlay .card h2 {
  margin: 0 0 16px;
  color: var(--accent-blue);
  font-size: 28px;
}

.overlay .card h3 {
  color: var(--accent-pink);
  font-size: 18px;
  margin: 16px 0 8px;
}

.overlay .card h4 {
  color: var(--accent-green);
  font-size: 16px;
  margin: 12px 0 6px;
}

.overlay .card p,
.overlay .card ul,
.overlay .card ol {
  margin: 8px 0;
  line-height: 1.6;
}

.overlay .card ul,
.overlay .card ol {
  padding-left: 24px;
}

.overlay .card li {
  margin: 4px 0;
}

/* Instructions overlay */
.instructions {
  width: min(1200px, 90vw);
  min-height: 60vh;
}

.instructions-content {
  max-height: 60vh;
  overflow-y: auto;
  padding-right: 10px;
}

.countdown {
  margin-top: 16px;
  text-align: center;
  color: var(--accent-yellow);
  font-family: "Space Mono";
  font-size: 16px;
  font-weight: 700;
}

button.primary {
  width: 100%;
  background: linear-gradient(45deg, var(--accent-blue), var(--accent-pink));
  border: none;
  color: #fff;
  padding: 14px;
  border-radius: 10px;
  font-weight: 700;
  font-size: 16px;
  cursor: pointer;
  text-shadow: 0 1px 3px #0005;
  transition: transform 0.2s;
}

button.primary:hover {
  transform: scale(1.02);
}

button.primary:active {
  transform: scale(0.98);
}

/* Setup overlay */
.setup {
  width: min(900px, 90vw);
  min-height: 50vh;
}

.setup form {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.setup label {
  display: block;
  color: #fff;
  font-size: 14px;
  font-weight: 700;
}

.setup input,
.setup select {
  width: 100%;
  padding: 12px;
  margin-top: 6px;
  border-radius: 8px;
  background: var(--bg-dark);
  color: var(--text);
  border: 1px solid #4a4f80;
  font-size: 14px;
}

#playerSetupContainer {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.player-setup {
  background: var(--bg-panel);
  border: 1px solid #4a4f80;
  border-radius: 10px;
  padding: 16px;
}

.player-setup h4 {
  margin: 0 0 12px;
  color: var(--accent-green);
}

/* Game over overlay */
.gameover {
  width: min(700px, 90vw);
  min-height: 40vh;
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 20px;
}

.gameover h2 {
  font-size: 42px;
  margin: 0;
  text-shadow: 0 0 20px var(--accent-blue);
}

.gameover p {
  font-size: 18px;
  margin: 0;
}

.final-score-display {
  font-size: 24px;
  font-weight: 700;
  color: var(--accent-yellow);
  font-family: "Space Mono";
}

.gameover-actions {
  display: flex;
  gap: 12px;
  width: 100%;
  max-width: 400px;
}

.gameover-actions button {
  flex: 1;
}

/* Help overlay */
.help {
  width: min(1300px, 92vw);
  max-height: 85vh;
  min-height: 60vh;
}

.help-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
}

.help-content {
  max-height: 70vh;
  overflow-y: auto;
  padding-right: 10px;
}

.close-btn {
  background: #2a2d4a;
  border: 1px solid #4a4f80;
  color: #fff;
  border-radius: 8px;
  font-size: 20px;
  width: 36px;
  height: 36px;
  cursor: pointer;
  transition: all 0.2s;
}

.close-btn:hover {
  background: #38406c;
}

/* Responsive */
@media (max-width: 1200px) {
  .layout {
    grid-template-columns: 1fr 360px;
  }
}

@media (max-width: 900px) {
  .layout {
    grid-template-columns: 1fr;
    height: auto;
  }

  body {
    overflow: auto;
  }

  .right-panel {
    max-height: none;
  }

  .table {
    min-height: 600px;
  }
}

/* Scrollbar styling */
::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}

::-webkit-scrollbar-track {
  background: #1a1d33;
  border-radius: 4px;
}

::-webkit-scrollbar-thumb {
  background: #4a4f80;
  border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
  background: #6fa8ff;
}
