/* Classic Ludo - Phase 3 AAA Premium Theme & Design System */

:root {
  --bg-dark: #090D16;
  --bg-card: rgba(26, 35, 50, 0.85);
  --border-card: rgba(255, 255, 255, 0.15);
  --text-main: #F8FAFC;
  --text-muted: #94A3B8;

  --red-color: #E74C3C;
  --green-color: #2ECC71;
  --yellow-color: #F1C40F;
  --blue-color: #3498DB;

  --gold-glow: rgba(241, 196, 15, 0.6);
  --font-family: 'Outfit', 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
}

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

html, body {
  width: 100%;
  height: 100%;
  overflow: hidden;
  background-color: var(--bg-dark);
  color: var(--text-main);
  font-family: var(--font-family);
}

#game-container {
  width: 100%;
  height: 100%;
  position: absolute;
  top: 0;
  left: 0;
  z-index: 1;
}

/* UI Layer Overlay */
.ui-layer {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 10;
  pointer-events: none;
}

.ui-layer * {
  pointer-events: auto;
}

.hidden {
  display: none !important;
  opacity: 0;
  pointer-events: none !important;
}

/* AAA Glassmorphism Card Utility */
.glass-panel {
  background: var(--bg-card);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid var(--border-card);
  border-radius: 14px;
  box-shadow: 0 15px 35px rgba(0, 0, 0, 0.45), inset 0 1px 0 rgba(255, 255, 255, 0.15);
}

/* Main Menu Screen */
#main-menu-container {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  background: radial-gradient(circle at center, #1E293B 0%, #090D16 100%);
  z-index: 100;
  transition: opacity 0.4s ease;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding: 30px 12px;
}

.menu-card {
  width: 92%;
  max-width: 440px;
  height: auto;
  overflow: visible;
  padding: 24px 18px;
  text-align: center;
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin: auto 0;
}

.game-title {
  font-size: 2.4rem;
  font-weight: 800;
  letter-spacing: 2px;
  background: linear-gradient(135deg, #FF6B6B 0%, #FCA5A5 30%, #FDE047 60%, #60A5FA 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  text-shadow: 0 8px 25px rgba(255, 107, 107, 0.35);
}

.menu-subtitle {
  font-size: 0.88rem;
  color: var(--text-muted);
  margin-top: -6px;
  margin-bottom: 4px;
}

.menu-btn-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-top: 4px;
}

.menu-btn-grid .btn-secondary {
  padding: 8px 6px;
  font-size: 0.76rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Buttons & Micro-interactions */
.btn-primary {
  padding: 10px 22px;
  font-size: 0.95rem;
  font-weight: 700;
  color: #FFFFFF;
  background: linear-gradient(135deg, #3B82F6 0%, #1D4ED8 100%);
  border: none;
  border-radius: 10px;
  cursor: pointer;
  box-shadow: 0 6px 18px rgba(29, 78, 216, 0.4);
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  position: relative;
  overflow: hidden;
}

.btn-primary:hover {
  transform: translateY(-2px) scale(1.02);
  box-shadow: 0 10px 22px rgba(29, 78, 216, 0.6);
  background: linear-gradient(135deg, #60A5FA 0%, #2563EB 100%);
}

.btn-primary:active {
  transform: translateY(1px) scale(0.98);
}

.btn-secondary {
  padding: 8px 16px;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-main);
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid var(--border-card);
  border-radius: 10px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.btn-secondary:hover {
  background: rgba(255, 255, 255, 0.18);
  transform: translateY(-1px);
}

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

/* AAA 4-Corner Player Cards - Compact & Clean */
.player-card-corner {
  position: absolute;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 12px;
  min-width: 130px;
  z-index: 20;
  transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1);
  border-radius: 12px;
}

.player-card-corner.active-turn {
  box-shadow: 0 0 18px var(--gold-glow), 0 8px 20px rgba(0, 0, 0, 0.5);
  border-color: #F1C40F;
  transform: scale(1.04);
}

.player-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.1rem;
  border: 2px solid #FFFFFF;
  box-shadow: 0 3px 8px rgba(0, 0, 0, 0.3);
  flex-shrink: 0;
}

.player-info-column {
  display: flex;
  flex-direction: column;
}

.player-name-label {
  font-weight: 800;
  font-size: 0.82rem;
  line-height: 1.1;
}

.player-sub-status {
  font-size: 0.7rem;
  color: var(--text-muted);
  line-height: 1.1;
}

/* Corner Positioning - No Overlaps */
#player-card-red { top: 12px; left: 14px; }
#player-card-green { top: 12px; right: 14px; }
#player-card-yellow { bottom: 54px; right: 14px; }
#player-card-blue { bottom: 54px; left: 14px; }

/* HUD Top Header & Bottom Control Bar */
#hud-container {
  width: 100%;
  height: 100%;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: 10px;
  pointer-events: none;
}

/* Compact Centered Header Bar */
.hud-top-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 6px 14px;
  width: fit-content;
  min-width: 360px;
  max-width: 500px;
  margin: 2px auto 0 auto;
  border-radius: 12px;
  gap: 12px;
}

.turn-badge-container {
  display: flex;
  align-items: center;
  gap: 8px;
}

.player-badge {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  border: 2px solid #FFFFFF;
  box-shadow: 0 0 8px rgba(255, 255, 255, 0.5);
  flex-shrink: 0;
}

.turn-text-info {
  display: flex;
  flex-direction: column;
}

.turn-player-name {
  font-weight: 800;
  font-size: 0.85rem;
  line-height: 1.1;
}

.turn-message {
  font-size: 0.72rem;
  color: var(--text-muted);
  line-height: 1.1;
}

.hud-dice-section {
  display: flex;
  align-items: center;
  gap: 8px;
}

.dice-display-box {
  background: rgba(0, 0, 0, 0.35);
  border: 1px solid var(--border-card);
  border-radius: 8px;
  padding: 4px 10px;
  font-size: 0.85rem;
  font-weight: 800;
  color: #F1C40F;
  white-space: nowrap;
}

/* Compact Centered Footer Control Bar */
.hud-bottom-bar {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 6px;
  flex-wrap: nowrap;
  padding: 5px 10px;
  width: fit-content;
  margin: 0 auto 4px auto;
  border-radius: 12px;
}

.icon-btn {
  padding: 6px 12px;
  font-size: 0.78rem;
  font-weight: 600;
  border-radius: 8px;
  white-space: nowrap;
}

/* Tooltip */
.icon-btn[data-tooltip]:hover::after {
  content: attr(data-tooltip);
  position: absolute;
  bottom: 130%;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(15, 23, 42, 0.95);
  color: #FFF;
  padding: 4px 8px;
  border-radius: 6px;
  font-size: 0.7rem;
  white-space: nowrap;
  pointer-events: none;
  border: 1px solid var(--border-card);
}

/* Modals */
.modal-overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(9, 13, 22, 0.78);
  backdrop-filter: blur(8px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 200;
}

.modal-content {
  width: 90%;
  max-width: 480px;
  max-height: 85vh;
  overflow-y: auto;
  padding: 24px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  position: relative;
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px solid var(--border-card);
  padding-bottom: 10px;
}

.modal-title {
  font-size: 1.3rem;
  font-weight: 700;
}

.btn-close-modal {
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-size: 1.5rem;
  cursor: pointer;
  padding: 0 4px;
}

.btn-close-modal:hover {
  color: #FFFFFF;
}

/* Tabbed Settings Modal */
.tabs-header {
  display: flex;
  gap: 6px;
  border-bottom: 1px solid var(--border-card);
  padding-bottom: 8px;
  margin-bottom: 12px;
}

.tab-btn {
  padding: 6px 12px;
  border: none;
  background: transparent;
  color: var(--text-muted);
  font-weight: 600;
  font-size: 0.85rem;
  cursor: pointer;
  border-radius: 6px;
  transition: all 0.2s ease;
}

.tab-btn.active {
  background: rgba(255, 255, 255, 0.12);
  color: #FFFFFF;
}

/* Toast Notifications Layer */
#toast-layer {
  position: absolute;
  top: 60px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  flex-direction: column;
  gap: 8px;
  z-index: 1000;
  pointer-events: none;
}

.toast-msg {
  padding: 8px 18px;
  border-radius: 10px;
  font-weight: 700;
  font-size: 0.85rem;
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.4);
  animation: toastSlide 0.3s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

@keyframes toastSlide {
  from { opacity: 0; transform: translateY(-16px); }
  to { opacity: 1; transform: translateY(0); }
}

/* Rules list styling */
.rules-body {
  display: flex;
  flex-direction: column;
  gap: 10px;
  line-height: 1.5;
  font-size: 0.88rem;
  color: #CBD5E1;
}

.rules-body h4 {
  color: #38BDF8;
  margin-top: 4px;
}

/* Victory Screen */
.victory-card {
  text-align: center;
  gap: 18px;
}

.trophy-icon {
  font-size: 3.5rem;
  animation: bounce 1s infinite alternate ease-in-out;
}

.winner-name {
  font-size: 2rem;
  font-weight: 800;
}

/* Custom Scrollbar for Smooth Mobile & Desktop Scroll */
.menu-card::-webkit-scrollbar,
#main-menu-container::-webkit-scrollbar,
.modal-content::-webkit-scrollbar {
  width: 6px;
}

.menu-card::-webkit-scrollbar-track,
#main-menu-container::-webkit-scrollbar-track,
.modal-content::-webkit-scrollbar-track {
  background: rgba(0, 0, 0, 0.2);
  border-radius: 10px;
}

.menu-card::-webkit-scrollbar-thumb,
#main-menu-container::-webkit-scrollbar-thumb,
.modal-content::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.25);
  border-radius: 10px;
}

.menu-card::-webkit-scrollbar-thumb:hover,
#main-menu-container::-webkit-scrollbar-thumb:hover,
.modal-content::-webkit-scrollbar-thumb:hover {
  background: rgba(255, 255, 255, 0.45);
}
