/* ==========================================================================
   RCA SPEED CHALLENGE - Online Board Game Design System
   ========================================================================== */

@import url('https://fonts.googleapis.com/css2?family=Kanit:wght@300;400;500;600;700&family=Prompt:wght@300;400;500;600;700&family=Sarabun:wght@400;500;600&display=swap');

:root {
  --bg-dark: #0B132B;
  --bg-panel: #1C2541;
  --bg-card: #263859;
  --bg-card-hover: #324670;
  --border-color: #3A4E7A;
  --text-main: #FFFFFF;
  --text-muted: #94A3B8;

  --neon-cyan: #00F5D4;
  --gold-amber: #FFB703;
  --crimson-red: #FF0055;
  --purple-accent: #7B2CBF;
  --emerald-green: #10B981;

  --step-1-color: #FF595E;
  --step-2-color: #FFCA3A;
  --step-3-color: #8AC926;
  --step-4-color: #1982C4;
  --step-5-color: #6A4C93;

  --font-heading: 'Prompt', 'Kanit', sans-serif;
  --font-body: 'Sarabun', 'Prompt', sans-serif;
  --shadow-glow: 0 0 20px rgba(0, 245, 212, 0.25);
  --shadow-card: 0 8px 24px rgba(0, 0, 0, 0.4);
}

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

body {
  background-color: var(--bg-dark);
  color: var(--text-main);
  font-family: var(--font-body);
  line-height: 1.5;
  min-height: 100vh;
}

/* Button & Controls Base */
.btn {
  font-family: var(--font-heading);
  font-weight: 600;
  border: none;
  border-radius: 12px;
  padding: 0.75rem 1.5rem;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  transition: all 0.2s ease;
  font-size: 1rem;
  text-decoration: none;
}

.btn-primary {
  background: linear-gradient(135deg, var(--neon-cyan), #00B4D8);
  color: #060C1B;
  box-shadow: 0 4px 14px rgba(0, 245, 212, 0.3);
}

.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(0, 245, 212, 0.5);
}

.btn-gold {
  background: linear-gradient(135deg, var(--gold-amber), #FB8500);
  color: #060C1B;
  box-shadow: 0 4px 14px rgba(255, 183, 3, 0.3);
}

.btn-gold:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(255, 183, 3, 0.5);
}

.btn-secondary {
  background: var(--bg-card);
  color: var(--text-main);
  border: 1px solid var(--border-color);
}

.btn-secondary:hover {
  background: var(--bg-card-hover);
  border-color: var(--neon-cyan);
}

/* Header & Nav */
.game-header {
  background: rgba(13, 27, 42, 0.95);
  border-bottom: 1px solid var(--border-color);
  padding: 0.75rem 1.5rem;
  position: sticky;
  top: 0;
  z-index: 100;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.brand-logo {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.brand-icon {
  width: 42px;
  height: 42px;
  background: linear-gradient(135deg, var(--neon-cyan), var(--purple-accent));
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.4rem;
}

.brand-title {
  font-family: var(--font-heading);
  font-size: 1.25rem;
  font-weight: 700;
  color: #FFFFFF;
}

.brand-sub {
  font-size: 0.75rem;
  color: var(--text-muted);
}

/* App Screens Container */
.app-container {
  max-width: 1280px;
  margin: 0 auto;
  padding: 1.5rem;
}

.screen {
  display: none;
}

.screen.active {
  display: block;
  animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

/* Landing Card */
.hero-card {
  background: var(--bg-panel);
  border: 1px solid var(--border-color);
  border-radius: 24px;
  padding: 2.5rem;
  text-align: center;
  max-width: 800px;
  margin: 1.5rem auto;
  box-shadow: var(--shadow-card);
}

.hero-badge {
  display: inline-block;
  background: rgba(0, 245, 212, 0.1);
  color: var(--neon-cyan);
  border: 1px solid rgba(0, 245, 212, 0.3);
  padding: 0.35rem 1rem;
  border-radius: 20px;
  font-size: 0.85rem;
  font-family: var(--font-heading);
  font-weight: 600;
  margin-bottom: 1rem;
}

.hero-title {
  font-family: var(--font-heading);
  font-size: 2.2rem;
  font-weight: 700;
  margin-bottom: 0.75rem;
}

.hero-desc {
  color: var(--text-muted);
  font-size: 1rem;
  margin-bottom: 2rem;
}

/* Mode Selector Pills */
.mode-selector {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 1rem;
  margin-bottom: 2rem;
  text-align: left;
}

.mode-card {
  background: var(--bg-card);
  border: 2px solid var(--border-color);
  border-radius: 16px;
  padding: 1.25rem;
  cursor: pointer;
  transition: all 0.2s ease;
}

.mode-card:hover {
  transform: translateY(-3px);
  border-color: var(--neon-cyan);
  background: var(--bg-card-hover);
}

.mode-card.selected {
  border-color: var(--neon-cyan);
  background: rgba(0, 245, 212, 0.08);
  box-shadow: var(--shadow-glow);
}

.mode-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.5rem;
}

.mode-tag {
  font-size: 0.75rem;
  font-weight: 700;
  padding: 0.2rem 0.6rem;
  border-radius: 8px;
}

.mode-tag.easy { background: rgba(16, 185, 129, 0.2); color: var(--emerald-green); }
.mode-tag.medium { background: rgba(255, 183, 3, 0.2); color: var(--gold-amber); }
.mode-tag.hard { background: rgba(255, 0, 85, 0.2); color: var(--crimson-red); }

.mode-title {
  font-family: var(--font-heading);
  font-size: 1.1rem;
  font-weight: 600;
}

.mode-features {
  font-size: 0.825rem;
  color: var(--text-muted);
  list-style: none;
}

.mode-features li {
  margin-bottom: 0.25rem;
}

.landing-actions {
  display: flex;
  gap: 1rem;
  justify-content: center;
  flex-wrap: wrap;
}

.join-input-group {
  display: flex;
  gap: 0.5rem;
  max-width: 400px;
  width: 100%;
}

.join-input {
  flex: 1;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 12px;
  padding: 0.75rem 1rem;
  color: white;
  font-family: var(--font-heading);
  font-size: 1rem;
  text-transform: uppercase;
}

/* Lobby Card */
.lobby-card {
  background: var(--bg-panel);
  border: 1px solid var(--border-color);
  border-radius: 24px;
  padding: 2rem;
  max-width: 900px;
  margin: 0 auto;
}

.room-code-badge {
  background: var(--bg-card);
  border: 2px dashed var(--neon-cyan);
  padding: 0.4rem 1rem;
  border-radius: 12px;
  font-family: var(--font-heading);
  font-size: 1.3rem;
  font-weight: 700;
  color: var(--neon-cyan);
  display: inline-flex;
  align-items: center;
  gap: 0.75rem;
}

.qr-btn {
  background: rgba(0, 245, 212, 0.1);
  color: var(--neon-cyan);
  border: none;
  padding: 0.3rem 0.65rem;
  border-radius: 8px;
  cursor: pointer;
  font-size: 0.85rem;
  font-weight: 600;
}

.players-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 1rem;
}

.player-slot {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 16px;
  padding: 1.25rem;
  display: flex;
  align-items: center;
  gap: 1rem;
}

.player-slot.empty {
  border-style: dashed;
  opacity: 0.5;
  justify-content: center;
  color: var(--text-muted);
}

.player-avatar {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.3rem;
  font-weight: 700;
  color: #060C1B;
}

/* ==========================================================================
   RESTORED BOARD GAME TABLE (5 VERTICAL BOARD SLOTS + CARDS HAND)
   ========================================================================== */
.board-layout {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

.game-status-bar {
  background: var(--bg-panel);
  border: 1px solid var(--border-color);
  border-radius: 16px;
  padding: 1rem 1.5rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 1rem;
}

.round-info {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.round-badge {
  background: linear-gradient(135deg, var(--purple-accent), #480CA8);
  padding: 0.4rem 0.9rem;
  border-radius: 10px;
  font-family: var(--font-heading);
  font-weight: 700;
  font-size: 0.9rem;
}

.timer-box {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  background: var(--bg-card);
  padding: 0.4rem 1rem;
  border-radius: 12px;
  border: 1px solid var(--border-color);
}

.timer-text {
  font-family: var(--font-heading);
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--neon-cyan);
}

.bell-btn {
  background: linear-gradient(135deg, #FFB703, #FB8500);
  color: #060C1B;
  font-family: var(--font-heading);
  font-weight: 700;
  font-size: 1.2rem;
  padding: 0.65rem 1.75rem;
  border-radius: 50px;
  border: 3px solid #FFF;
  cursor: pointer;
  box-shadow: 0 4px 15px rgba(255, 183, 3, 0.4);
  transition: all 0.15s ease;
}

.bell-btn:active {
  transform: scale(0.92);
}

/* Situation Banner Card */
.situation-banner {
  background: linear-gradient(135deg, rgba(27, 38, 59, 0.9), rgba(13, 27, 42, 0.95));
  border: 1px solid var(--border-color);
  border-left: 6px solid var(--neon-cyan);
  border-radius: 16px;
  padding: 1.5rem;
  box-shadow: var(--shadow-card);
}

.meta-pill {
  font-size: 0.75rem;
  font-weight: 700;
  padding: 0.2rem 0.6rem;
  border-radius: 6px;
  background: rgba(0, 245, 212, 0.1);
  color: var(--neon-cyan);
}

.situation-title {
  font-family: var(--font-heading);
  font-size: 1.35rem;
  font-weight: 700;
  margin-top: 0.35rem;
  margin-bottom: 0.35rem;
}

.situation-desc {
  color: var(--text-main);
  font-size: 1.05rem;
}

/* 5 VERTICAL BOARD TARGET SLOTS (RESTORED ORIGINAL BOARD LOOK) */
.rca-board-slots {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 0.85rem;
}

@media (max-width: 900px) {
  .rca-board-slots {
    grid-template-columns: 1fr;
  }
}

.step-slot {
  background: var(--bg-panel);
  border: 2px dashed var(--border-color);
  border-radius: 16px;
  min-height: 200px;
  padding: 1rem;
  display: flex;
  flex-direction: column;
  transition: all 0.25s ease;
}

.step-slot.drag-over {
  border-color: var(--neon-cyan);
  background: rgba(0, 245, 212, 0.08);
}

.step-slot-header {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 0.75rem;
  padding-bottom: 0.5rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.step-num-badge {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-heading);
  font-weight: 700;
  font-size: 0.85rem;
  color: #060C1B;
  flex-shrink: 0;
}

.step-slot:nth-child(1) .step-num-badge { background: var(--step-1-color); }
.step-slot:nth-child(2) .step-num-badge { background: var(--step-2-color); }
.step-slot:nth-child(3) .step-num-badge { background: var(--step-3-color); }
.step-slot:nth-child(4) .step-num-badge { background: var(--step-4-color); }
.step-slot:nth-child(5) .step-num-badge { background: var(--step-5-color); }

.step-name {
  font-family: var(--font-heading);
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-main);
  line-height: 1.3;
}

.slot-drop-zone {
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
}

.empty-placeholder {
  color: var(--text-muted);
  font-size: 0.8rem;
  text-align: center;
}

/* Action Cards in Hand */
.action-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 12px;
  padding: 0.85rem 1rem;
  cursor: grab;
  user-select: none;
  transition: all 0.2s ease;
  font-size: 0.9rem;
  color: var(--text-main);
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.3);
  width: 100%;
}

.action-card:hover {
  transform: translateY(-2px);
  border-color: var(--neon-cyan);
  box-shadow: var(--shadow-glow);
}

.action-card.selected-tap {
  border-color: var(--gold-amber);
  box-shadow: 0 0 15px rgba(255, 183, 3, 0.4);
  transform: scale(1.02);
}

.player-hand-panel {
  background: var(--bg-panel);
  border: 1px solid var(--border-color);
  border-radius: 16px;
  padding: 1.25rem;
}

.hand-title {
  font-family: var(--font-heading);
  font-size: 1rem;
  font-weight: 600;
  margin-bottom: 0.75rem;
  display: flex;
  justify-content: space-between;
}

.cards-hand-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 0.75rem;
}

.traps-bar {
  display: flex;
  gap: 0.75rem;
  flex-wrap: wrap;
  margin-top: 1rem;
}

.trap-card-btn {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 10px;
  padding: 0.5rem 1rem;
  color: var(--text-main);
  font-family: var(--font-heading);
  font-size: 0.85rem;
  cursor: pointer;
}

/* Modals & Handbook Cards Design */
.modal-overlay {
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(6, 12, 27, 0.85);
  backdrop-filter: blur(8px);
  z-index: 200;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
}

.modal-overlay.active {
  display: flex;
}

.modal-box {
  background: var(--bg-panel);
  border: 1px solid var(--border-color);
  border-radius: 24px;
  max-width: 600px;
  width: 100%;
  padding: 2rem;
  position: relative;
  max-height: 90vh;
  overflow-y: auto;
}

.modal-close-btn {
  position: absolute;
  top: 1.25rem;
  right: 1.25rem;
  background: rgba(255, 255, 255, 0.1);
  border: none;
  color: white;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  cursor: pointer;
}

/* Redesigned Handbook Step Cards */
.handbook-card {
  background: var(--bg-card);
  border-radius: 14px;
  padding: 1.1rem 1.25rem;
  border: 1px solid var(--border-color);
}

.handbook-card-header {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 0.4rem;
}

.handbook-badge {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  color: #0B132B;
  font-family: var(--font-heading);
  font-weight: 700;
  font-size: 0.85rem;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.handbook-card-title {
  font-family: var(--font-heading);
  font-size: 1.05rem;
  font-weight: 700;
}

.handbook-card-body {
  font-size: 0.9rem;
  color: var(--text-muted);
  line-height: 1.5;
  padding-left: 2.25rem;
}

.frozen-overlay {
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(0, 245, 212, 0.2);
  backdrop-filter: blur(4px);
  z-index: 300;
  display: none;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  color: white;
  font-family: var(--font-heading);
  font-size: 2rem;
}

.frozen-overlay.active {
  display: flex;
}
