:root {
  --bg-table: #113622;
  --bg-panel: #ffffff;
  --bg-panel-dark: #f8fafc;
  --text-dark: #0f172a;
  --text-dim: #64748b;
  --primary-red: #dc2626;
  --primary-green: #15803d;
  --accent-gold: #b45309;
  --border-subtle: #e2e8f0;
}

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

body {
  background-color: var(--bg-table);
  background-image: radial-gradient(circle at 50% 50%, #1a472d 0%, #0d2617 100%);
  color: var(--text-dark);
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 24px;
  background: rgba(15, 23, 42, 0.85);
  backdrop-filter: blur(8px);
  color: #fff;
  border-bottom: 2px solid #b45309;
}

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

.brand-badge {
  background: var(--primary-red);
  color: #fff;
  font-weight: 900;
  font-size: 20px;
  padding: 4px 12px;
  border-radius: 4px;
  letter-spacing: 1px;
}

.brand-sub {
  font-size: 13px;
  color: #cbd5e1;
  font-weight: 600;
}

.controls {
  display: flex;
  gap: 10px;
}

.btn-ctrl {
  background: #1e293b;
  border: 1px solid #475569;
  color: #fff;
  padding: 6px 14px;
  border-radius: 6px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s;
}

.btn-ctrl:hover {
  background: #334155;
}

#app {
  flex: 1;
  display: flex;
  flex-direction: column;
}

/* Předsálí (Lobby) */
.lobby-box {
  max-width: 580px;
  margin: 40px auto;
  padding: 32px;
  background: var(--bg-panel);
  border-radius: 12px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.4);
  text-align: center;
}

.lobby-box h2 {
  font-size: 26px;
  color: var(--primary-red);
  margin-bottom: 8px;
}

.lobby-box p {
  color: var(--text-dim);
  font-size: 14px;
  margin-bottom: 24px;
}

.form-group {
  margin-bottom: 20px;
  text-align: left;
}

.form-group label {
  display: block;
  font-size: 13px;
  font-weight: 700;
  color: var(--text-dark);
  margin-bottom: 8px;
}

.input-txt {
  width: 100%;
  padding: 10px 14px;
  border: 1px solid var(--border-subtle);
  border-radius: 6px;
  font-size: 15px;
  outline: none;
}

.input-txt:focus {
  border-color: var(--primary-red);
}

.tokens-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
}

.token-card {
  padding: 10px;
  border: 2px solid var(--border-subtle);
  border-radius: 8px;
  cursor: pointer;
  text-align: center;
  transition: all 0.15s;
}

.token-card:hover {
  border-color: #94a3b8;
  background: #f8fafc;
}

.token-card.selected {
  border-color: var(--primary-red);
  background: #fef2f2;
}

.token-card .emoji {
  font-size: 28px;
  margin-bottom: 4px;
}

.token-card .t-name {
  font-size: 12px;
  font-weight: 700;
}

.btn-primary {
  width: 100%;
  padding: 14px;
  background: var(--primary-red);
  color: #fff;
  border: none;
  border-radius: 6px;
  font-size: 16px;
  font-weight: 700;
  cursor: pointer;
  margin-top: 10px;
  transition: background 0.15s;
}

.btn-primary:hover {
  background: #b91c1c;
}

.btn-secondary {
  width: 100%;
  padding: 10px;
  background: #f1f5f9;
  color: #334155;
  border: 1px solid var(--border-subtle);
  border-radius: 6px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  margin-top: 10px;
}

.code-pill {
  display: inline-block;
  padding: 6px 16px;
  background: #f1f5f9;
  border: 2px dashed #94a3b8;
  border-radius: 8px;
  font-size: 22px;
  font-weight: 900;
  letter-spacing: 2px;
  margin: 12px 0;
}

/* Herní obrazovka */
.game-layout {
  display: flex;
  gap: 20px;
  padding: 20px;
  max-width: 1600px;
  margin: 0 auto;
  align-items: flex-start;
}

.board-container {
  background: #fff;
  padding: 8px;
  border-radius: 8px;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.6);
}

#boardCanvas {
  display: block;
  max-width: 100%;
  height: auto;
  aspect-ratio: 1 / 1;
}

.sidebar {
  flex: 1;
  min-width: 380px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.card-box {
  background: #fff;
  border-radius: 8px;
  padding: 16px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.action-card {
  border-top: 4px solid var(--primary-red);
}

.turn-heading {
  font-size: 16px;
  font-weight: 800;
  margin-bottom: 12px;
  text-align: center;
}

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

.btn-game {
  padding: 12px 8px;
  border-radius: 6px;
  border: 1px solid var(--border-subtle);
  font-weight: 700;
  font-size: 13px;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
}

.btn-game:disabled {
  opacity: 0.35;
  cursor: not-allowed;
}

.btn-roll {
  grid-column: span 2;
  background: var(--primary-red);
  color: #fff;
  border: none;
  font-size: 15px;
  padding: 14px;
}

.btn-roll:not(:disabled):hover {
  background: #b91c1c;
}

.btn-buy {
  background: #0284c7;
  color: #fff;
  border: none;
}

.btn-upgrade {
  background: var(--primary-green);
  color: #fff;
  border: none;
}

.btn-bail {
  background: #ea580c;
  color: #fff;
  border: none;
}

.btn-end {
  grid-column: span 2;
  background: #f1f5f9;
  color: #1e293b;
}

/* Hráči */
.players-table {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.player-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px;
  border-radius: 6px;
  background: #f8fafc;
  border-left: 4px solid #cbd5e1;
}

.player-item.active {
  background: #fef2f2;
  border-left-color: var(--primary-red);
}

.p-name {
  font-weight: 800;
  font-size: 14px;
}

.p-cash {
  font-weight: 800;
  font-size: 15px;
  color: var(--primary-green);
}

/* Log */
.log-box {
  height: 200px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 12px;
}

.log-item {
  padding: 6px 8px;
  background: #f8fafc;
  border-radius: 4px;
  line-height: 1.4;
}

/* Modal pro karty */
.modal-mask {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.7);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 999;
}

.modal-content {
  max-width: 420px;
  background: #fff;
  border: 4px solid var(--primary-red);
  border-radius: 8px;
  padding: 24px;
  text-align: center;
}

@media (max-width: 1024px) {
  .game-layout {
    flex-direction: column;
    align-items: center;
  }
  .sidebar {
    width: 100%;
    min-width: auto;
  }
}
