/* styles.css - Modern, Glassmorphic Style Design for Snakes & Ladders */

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

:root {
  --bg-primary: #0f172a;
  --bg-secondary: #1e293b;
  --glass-bg: rgba(30, 41, 59, 0.7);
  --glass-border: rgba(255, 255, 255, 0.08);
  --text-primary: #f8fafc;
  --text-secondary: #94a3b8;
  
  --accent-color: #6366f1;
  --accent-glow: rgba(99, 102, 241, 0.4);
  
  --board-dark: #1e293b;
  --board-light: #334155;
  --board-border: #475569;
  
  --font-title: 'Outfit', sans-serif;
  --font-body: 'Inter', sans-serif;
  
  --shadow-premium: 0 8px 32px 0 rgba(0, 0, 0, 0.37);
}

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

body {
  background-color: var(--bg-primary);
  background-image: 
    radial-gradient(at 10% 20%, rgba(99, 102, 241, 0.15) 0px, transparent 50%),
    radial-gradient(at 90% 80%, rgba(236, 72, 153, 0.15) 0px, transparent 50%);
  color: var(--text-primary);
  font-family: var(--font-body);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 20px;
  overflow-x: hidden;
}

/* Glassmorphism Container */
.container {
  background: var(--glass-bg);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid var(--glass-border);
  border-radius: 24px;
  padding: 24px;
  width: 100%;
  max-width: 1200px;
  box-shadow: var(--shadow-premium);
  display: flex;
  flex-direction: column;
  gap: 20px;
}

/* Header Section */
header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px solid var(--glass-border);
  padding-bottom: 16px;
}

h1 {
  font-family: var(--font-title);
  font-size: 2rem;
  font-weight: 800;
  background: linear-gradient(135deg, #818cf8 0%, #ec4899 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  display: flex;
  align-items: center;
  gap: 10px;
}

.mute-btn {
  background: transparent;
  border: 1px solid var(--glass-border);
  border-radius: 50%;
  width: 44px;
  height: 44px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-primary);
  font-size: 1.2rem;
  transition: all 0.2s ease;
}

.mute-btn:hover {
  background: var(--accent-color);
  box-shadow: 0 0 12px var(--accent-glow);
  transform: scale(1.05);
}

/* Setup Screen */
#setup-screen {
  display: flex;
  flex-direction: column;
  gap: 24px;
  max-width: 600px;
  margin: 40px auto;
  width: 100%;
}

.setup-card {
  background: rgba(15, 23, 42, 0.4);
  border: 1px solid var(--glass-border);
  border-radius: 16px;
  padding: 24px;
}

.setup-title {
  font-family: var(--font-title);
  font-size: 1.4rem;
  font-weight: 600;
  margin-bottom: 16px;
}

.player-config-row {
  display: grid;
  grid-template-columns: auto 1fr auto auto;
  gap: 12px;
  align-items: center;
  margin-bottom: 12px;
}

.player-dot {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  box-shadow: 0 0 8px currentColor;
}

input[type="text"] {
  background: rgba(15, 23, 42, 0.6);
  border: 1px solid var(--glass-border);
  border-radius: 8px;
  padding: 8px 12px;
  color: var(--text-primary);
  font-family: var(--font-body);
  font-size: 0.95rem;
  outline: none;
  transition: border-color 0.2s;
}

input[type="text"]:focus {
  border-color: var(--accent-color);
}

select {
  background: rgba(15, 23, 42, 0.6);
  border: 1px solid var(--glass-border);
  border-radius: 8px;
  padding: 8px 12px;
  color: var(--text-primary);
  font-family: var(--font-body);
  outline: none;
  cursor: pointer;
}

.checkbox-label {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.9rem;
  cursor: pointer;
}

.primary-btn {
  background: linear-gradient(135deg, #6366f1 0%, #a855f7 100%);
  color: #fff;
  border: none;
  border-radius: 12px;
  padding: 14px 28px;
  font-family: var(--font-title);
  font-size: 1.1rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s ease;
  box-shadow: 0 4px 15px rgba(99, 102, 241, 0.3);
}

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

/* Game Interface */
#game-screen {
  display: grid;
  grid-template-columns: 1fr 340px;
  gap: 24px;
}

@media (max-width: 950px) {
  #game-screen {
    grid-template-columns: 1fr;
  }
}

/* Game Board Wrapper */
.board-container {
  position: relative;
  width: 100%;
  aspect-ratio: 1 / 1;
  background: #111827;
  border-radius: 16px;
  border: 4px solid var(--board-border);
  overflow: hidden;
  box-shadow: inset 0 0 20px rgba(0,0,0,0.8);
}

.board-grid {
  display: grid;
  grid-template-columns: repeat(10, 1fr);
  grid-template-rows: repeat(10, 1fr);
  width: 100%;
  height: 100%;
}

.cell {
  position: relative;
  display: flex;
  align-items: flex-end;
  justify-content: flex-start;
  padding: 6px;
  border: 1px solid rgba(255, 255, 255, 0.03);
  font-family: var(--font-title);
  font-size: 0.95rem;
  font-weight: 600;
  color: rgba(255, 255, 255, 0.4);
  transition: background-color 0.3s;
}

.cell:nth-child(even) {
  background-color: var(--board-dark);
}

.cell:nth-child(odd) {
  background-color: var(--board-light);
}

/* Highlight tile of current turn or path */
.cell.active {
  background-color: rgba(99, 102, 241, 0.15);
}

.cell-number {
  pointer-events: none;
}

/* Snakes and Ladders SVG Overlay */
.overlay-svg {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 5;
}

/* Tokens layer */
.tokens-container {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 10;
}

.token {
  position: absolute;
  width: 7.5%;
  height: 7.5%;
  transform: translate(-50%, -50%);
  transition: left 0.4s cubic-bezier(0.25, 1, 0.5, 1), top 0.4s cubic-bezier(0.25, 1, 0.5, 1);
  display: flex;
  align-items: center;
  justify-content: center;
}

/* Controls & Status Panel */
.panel {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.status-card {
  background: rgba(15, 23, 42, 0.4);
  border: 1px solid var(--glass-border);
  border-radius: 16px;
  padding: 20px;
}

.current-player-info {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 12px;
}

.player-badge {
  padding: 6px 12px;
  border-radius: 20px;
  font-family: var(--font-title);
  font-weight: 700;
  font-size: 0.9rem;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

/* Local Player Identity Card */
.local-player-info {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: rgba(99, 102, 241, 0.1);
  border: 1px dashed var(--accent-color);
  border-radius: 10px;
  padding: 8px 12px;
  margin-bottom: 12px;
  font-size: 0.9rem;
}

.timer-subtext {
  font-size: 0.85rem;
  color: #fbbf24;
  font-family: var(--font-title);
  font-weight: 600;
  text-align: center;
}

/* Custom 13-sided Dice UI */
.dice-section {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
  margin: 10px 0;
}

.dice-container {
  width: 100px;
  height: 100px;
  perspective: 400px;
  cursor: pointer;
}

.dice-cube {
  width: 100%;
  height: 100%;
  position: relative;
  transform-style: preserve-3d;
  transition: transform 0.5s ease-out;
}

.dice-face {
  position: absolute;
  width: 100%;
  height: 100%;
  background: 
    linear-gradient(135deg, rgba(255, 255, 255, 0.1) 0%, rgba(255, 255, 255, 0) 50%),
    linear-gradient(210deg, #1e1b4b 0%, #0c0418 100%);
  border: 3px solid #6366f1;
  border-radius: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-title);
  font-size: 2.3rem;
  font-weight: 800;
  color: #fff;
  text-shadow: 0 0 8px rgba(255,255,255,0.6);
  box-shadow: 
    inset 0 0 20px rgba(99, 102, 241, 0.6), 
    inset 0 4px 8px rgba(255,255,255,0.3),
    0 10px 25px rgba(0,0,0,0.6);
  backface-visibility: hidden;
}

/* Styling depending on rolled value */
.dice-face.positive {
  color: #5eff5e;
  border-color: #5eff5e;
  text-shadow: 0 0 10px rgba(94, 255, 94, 0.6);
  box-shadow: 
    inset 0 0 20px rgba(94, 255, 94, 0.4), 
    inset 0 4px 8px rgba(255,255,255,0.3),
    0 10px 25px rgba(0,0,0,0.6),
    0 0 15px rgba(94, 255, 94, 0.3);
}

.dice-face.negative {
  color: #ff5e5e;
  border-color: #ff5e5e;
  text-shadow: 0 0 10px rgba(255, 94, 94, 0.6);
  box-shadow: 
    inset 0 0 20px rgba(255, 94, 94, 0.4), 
    inset 0 4px 8px rgba(255,255,255,0.3),
    0 10px 25px rgba(0,0,0,0.6),
    0 0 15px rgba(255, 94, 94, 0.3);
}

.dice-face.zero {
  color: #ffd000;
  border-color: #ffd000;
  text-shadow: 0 0 10px rgba(255, 208, 0, 0.6);
  box-shadow: 
    inset 0 0 20px rgba(255, 208, 0, 0.4), 
    inset 0 4px 8px rgba(255,255,255,0.3),
    0 10px 25px rgba(0,0,0,0.6),
    0 0 15px rgba(255, 208, 0, 0.3);
}

/* Spin animation classes */
@keyframes spin {
  0% { transform: rotateX(0deg) rotateY(0deg) rotateZ(0deg); }
  100% { transform: rotateX(720deg) rotateY(720deg) rotateZ(360deg); }
}

.dice-cube.rolling {
  animation: spin 0.8s linear infinite;
}

.dice-subtext {
  font-size: 0.85rem;
  color: var(--text-secondary);
  text-align: center;
}

/* 3x3 Pips Grid inside Dice Face */
.dice-pips-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  grid-template-rows: repeat(3, 1fr);
  width: 68px;
  height: 68px;
  gap: 5px;
  padding: 4px;
}

.pip {
  background-color: transparent;
  border-radius: 50%;
  width: 14px;
  height: 14px;
  margin: auto;
  transition: background-color 0.2s, box-shadow 0.2s;
}

.pip.active-positive {
  background-color: #5eff5e;
  box-shadow: 0 0 8px #5eff5e, inset 0 2px 3px rgba(255,255,255,0.6);
}

.pip.active-negative {
  background-color: #ff5e5e;
  box-shadow: 0 0 8px #ff5e5e, inset 0 2px 3px rgba(255,255,255,0.6);
}

.pip.active-zero {
  background-color: #ffd000;
  box-shadow: 0 0 8px #ffd000, inset 0 2px 3px rgba(255,255,255,0.6);
  border-radius: 20%; /* diamond shape */
}

/* Game Feed / Logs */
.log-card {
  background: rgba(15, 23, 42, 0.4);
  border: 1px solid var(--glass-border);
  border-radius: 16px;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  flex-grow: 1;
  height: 240px;
}

.log-title {
  font-family: var(--font-title);
  font-weight: 600;
  font-size: 1rem;
  border-bottom: 1px solid var(--glass-border);
  padding-bottom: 8px;
}

/* Live Game Players Roster Card */
.roster-card {
  background: var(--bg-card);
  backdrop-filter: blur(12px);
  border: 1px solid var(--glass-border);
  border-radius: 16px;
  padding: 12px 16px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.roster-title {
  font-family: var(--font-title);
  font-size: 0.9rem;
  font-weight: 700;
  color: var(--text-primary);
}

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

.roster-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 6px 10px;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid transparent;
  transition: all 0.2s ease;
}

.roster-item.active-turn {
  background: rgba(99, 102, 241, 0.12);
  border-color: var(--accent-color);
  box-shadow: 0 2px 8px rgba(99, 102, 241, 0.2);
}

.roster-avatar {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.9rem;
}

.roster-info {
  display: flex;
  flex-direction: column;
  flex: 1;
}

.roster-name {
  font-weight: 700;
  font-size: 0.85rem;
}

.roster-pos {
  font-size: 0.75rem;
  color: var(--text-secondary);
}

.roster-turn-badge {
  font-size: 0.7rem;
  font-weight: bold;
  padding: 2px 6px;
  border-radius: 10px;
  color: #fff;
}

.log-messages {
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 6px;
  flex-grow: 1;
  font-size: 0.85rem;
  scroll-behavior: smooth;
  padding-right: 4px;
}

.log-entry {
  line-height: 1.4;
  padding: 4px 8px;
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.02);
}

.log-entry span {
  font-weight: bold;
}

/* Modal Overlay for game win */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: rgba(15, 23, 42, 0.85);
  backdrop-filter: blur(10px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease;
}

.modal-overlay.active {
  opacity: 1;
  pointer-events: all;
}

.modal-content {
  background: var(--bg-secondary);
  border: 1px solid var(--glass-border);
  border-radius: 24px;
  padding: 40px;
  text-align: center;
  max-width: 480px;
  width: 90%;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.6);
  transform: translateY(-20px);
  transition: transform 0.3s ease;
}

.modal-overlay.active .modal-content {
  transform: translateY(0);
}

.modal-winner-badge {
  width: 80px;
  height: 80px;
  border-radius: 50%;
  background: linear-gradient(135deg, #fbbf24 0%, #f59e0b 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 3rem;
  margin: 0 auto 20px auto;
  box-shadow: 0 0 20px rgba(245, 158, 11, 0.5);
}

.modal-title {
  font-family: var(--font-title);
  font-size: 2.2rem;
  font-weight: 800;
  margin-bottom: 12px;
}

.modal-text {
  color: var(--text-secondary);
  margin-bottom: 24px;
}

.icon-btn-secondary {
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid var(--glass-border);
  color: var(--text-primary);
  border-radius: 8px;
  padding: 8px 12px;
  font-family: var(--font-title);
  font-weight: 600;
  font-size: 0.85rem;
  cursor: pointer;
  transition: all 0.2s ease;
}

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

/* Mode Selection Tabs */
.mode-tabs {
  display: flex;
  gap: 8px;
  margin-bottom: 20px;
  background: rgba(15, 23, 42, 0.6);
  padding: 4px;
  border-radius: 12px;
  border: 1px solid var(--glass-border);
}

.tab-btn {
  flex: 1;
  background: transparent;
  border: none;
  color: var(--text-secondary);
  font-family: var(--font-title);
  font-size: 0.95rem;
  font-weight: 600;
  padding: 10px 16px;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.tab-btn.active {
  background: var(--accent-color);
  color: #fff;
  box-shadow: 0 4px 12px var(--accent-glow);
}

/* Remote Multiplayer Box */
.multiplayer-box {
  display: flex;
  flex-direction: column;
  gap: 16px;
  background: rgba(15, 23, 42, 0.4);
  border: 1px solid var(--glass-border);
  border-radius: 14px;
  padding: 20px;
}

.mp-section h3 {
  font-family: var(--font-title);
  font-size: 1.1rem;
  margin-bottom: 4px;
}

.mp-section p {
  font-size: 0.85rem;
  color: var(--text-secondary);
  margin-bottom: 12px;
}

/* Room Action Container */
.room-action-container {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-bottom: 12px;
}

/* Active Room Share Link Banner */
.room-share-banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  background: rgba(99, 102, 241, 0.15);
  border: 1px solid var(--accent-color);
  border-radius: 12px;
  padding: 12px 16px;
  margin-top: 10px;
}

.share-link-btn {
  background: linear-gradient(135deg, #6366f1 0%, #4f46e5 100%);
  color: #fff;
  border: none;
  border-radius: 8px;
  padding: 8px 14px;
  font-family: var(--font-title);
  font-weight: 600;
  font-size: 0.85rem;
  cursor: pointer;
  box-shadow: 0 4px 12px var(--accent-glow);
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.share-link-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 16px var(--accent-glow);
}

/* Visual 4-Slot Live Lobby Grid */
.lobby-title {
  font-family: var(--font-title);
  font-weight: 700;
  font-size: 0.95rem;
  margin-bottom: 10px;
  color: var(--text-primary);
}

.lobby-slots-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
}

.slot-card {
  display: flex;
  align-items: center;
  gap: 10px;
  background: rgba(15, 23, 42, 0.6);
  border: 1px solid var(--glass-border);
  border-radius: 12px;
  padding: 10px 12px;
  position: relative;
  transition: all 0.2s ease;
}

.slot-card.active-slot {
  border-color: rgba(99, 102, 241, 0.4);
  background: rgba(99, 102, 241, 0.08);
}

.slot-card.empty-slot {
  border-style: dashed;
  opacity: 0.7;
}

.slot-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.2rem;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
}

.slot-info {
  display: flex;
  flex-direction: column;
  gap: 2px;
  flex: 1;
  overflow: hidden;
}

.slot-name {
  font-weight: 700;
  font-size: 0.85rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.slot-badge {
  font-size: 0.75rem;
  color: var(--text-secondary);
}

.host-badge {
  color: #fbbf24;
  font-weight: 600;
}

.slot-bot-toggle {
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid var(--glass-border);
  color: var(--text-primary);
  border-radius: 6px;
  padding: 4px 8px;
  font-size: 0.75rem;
  cursor: pointer;
}

/* Toast Notification Popup */
.toast-notification {
  position: fixed;
  bottom: 24px;
  right: 24px;
  background: #10b981;
  color: #fff;
  font-family: var(--font-title);
  font-weight: 700;
  font-size: 0.9rem;
  padding: 12px 20px;
  border-radius: 12px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.4);
  z-index: 200;
  transform: translateY(100px);
  opacity: 0;
  pointer-events: none;
  transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.toast-notification.active {
  transform: translateY(0);
  opacity: 1;
}
