:root {
  --bg-color: #0f172a;
  --glass: rgba(255, 255, 255, 0.1);
  --glass-border: rgba(255, 255, 255, 0.2);
  --text-main: #ffffff;
  --text-muted: #94a3b8;
  
  --p1-color: #ff6b6b;
  --p2-color: #4dabf7;
  --snake-color: #ef4444;
  --ladder-color: #10b981;
  
  --board-size: min(90vw, 80vh);
}

* { box-sizing: border-box; }

body {
  font-family: 'Poppins', sans-serif;
  margin: 0;
  background-color: var(--bg-color);
  color: var(--text-main);
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow-x: hidden; /* Important for floating items */
}

/* NEW: Background Animation */
.background-blobs {
  position: fixed;
  top: 0; left: 0; width: 100%; height: 100%;
  /* Existing gradient */
  background: radial-gradient(circle at 10% 20%, #2d1b69 0%, transparent 40%),
              radial-gradient(circle at 90% 80%, #1e40af 0%, transparent 40%);
  z-index: -1;
  overflow: hidden;
}

.floating-item {
  position: absolute;
  opacity: 0.15;
  pointer-events: none;
}

.snake { width: 150px; height: 150px; }
.ladder { width: 80px; height: 150px; }

/* Animation */
.s1 { top: 10%; left: -10%; animation: floatRight 35s linear infinite; }
.l1 { bottom: 20%; right: -10%; animation: floatLeft 40s linear infinite; }
.s2 { animation: floatDiagonal 45s linear infinite; }
.l2 { animation: floatUp 38s linear infinite; }

@keyframes floatRight {
  0% { transform: translateX(0) rotate(0deg); }
  100% { transform: translateX(120vw) rotate(20deg); }
}

@keyframes floatLeft {
  0% { transform: translateX(0) rotate(0deg); }
  100% { transform: translateX(-120vw) rotate(-20deg); }
}

@keyframes floatDiagonal {
  0% { transform: translate(0, 0) rotate(0deg); }
  100% { transform: translate(120vw, 120vh) rotate(45deg); }
}

@keyframes floatUp {
  0% { transform: translateY(0) rotate(0deg); }
  100% { transform: translateY(-120vh) rotate(-10deg); }
}
main {
  width: 100%;
  display: flex;
  justify-content: center;
  padding: 20px;
  z-index: 1;
}

.game-container {
  display: flex;
  gap: 40px;
  align-items: center;
  flex-wrap: wrap;
  justify-content: center;
}

/*  BOARD STYLES  */
.board-wrapper {
  padding: 10px;
  background: var(--glass);
  border: 1px solid var(--glass-border);
  border-radius: 24px;
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}

.board {
  display: grid;
  grid-template-columns: repeat(10, 1fr);
  width: var(--board-size);
  height: var(--board-size);
  gap: 2px;
}

.cell {
  background: rgba(255,255,255,0.03);
  border-radius: 4px;
  position: relative;
  display: flex;
  font-size: 10px;
  color: var(--text-muted);
  padding: 4px;
}
.cell:nth-child(odd) { background: rgba(255,255,255,0.06); }

.cell.is-ladder { background: rgba(16, 185, 129, 0.15); box-shadow: inset 0 0 10px rgba(16, 185, 129, 0.2); }
.cell.is-snake { background: rgba(239, 68, 68, 0.15); box-shadow: inset 0 0 10px rgba(239, 68, 68, 0.2); }

.cell .num { position: absolute; top: 2px; left: 4px; opacity: 0.5; }

.hint-icon {
  position: absolute;
  bottom: 2px; right: 4px;
  font-size: 14px;
  font-weight: bold;
}
.up { color: var(--ladder-color); }
.down { color: var(--snake-color); }

.piece {
  width: 60%;
  height: 60%;
  position: absolute;
  border-radius: 50%;
  top: 20%; left: 20%;
  border: 2px solid #fff;
  box-shadow: 0 4px 10px rgba(0,0,0,0.5);
  transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
  z-index: 10;
}
.piece.p1 { background: var(--p1-color); }
.piece.p2 { background: var(--p2-color); }

/*  CONTROLS PANEL  */
.panel {
  width: 320px;
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.title {
  margin: 0;
  font-weight: 800;
  font-size: 32px;
  text-align: center;
  letter-spacing: -1px;
}
.accent { color: var(--p1-color); }

.status-card {
  background: var(--glass);
  border: 1px solid var(--glass-border);
  border-radius: 16px;
  padding: 16px;
}

.player-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px;
  border-radius: 12px;
  transition: 0.3s;
  opacity: 0.5;
}
.player-row.active {
  background: rgba(255,255,255,0.1);
  opacity: 1;
  transform: scale(1.02);
}

.avatar {
  width: 40px; height: 40px;
  border-radius: 12px;
  display: flex; align-items: center; justify-content: center;
  font-weight: bold;
  font-size: 14px;
  color: #fff;
}
.avatar.p1 { background: var(--p1-color); }
.avatar.p2 { background: var(--p2-color); }

.info { flex: 1; display: flex; justify-content: space-between; align-items: center; }
.label { font-weight: 600; font-size: 14px; }
.pos-badge { font-family: monospace; font-size: 16px; font-weight: bold; }

.control-center {
  display: flex; flex-direction: column; gap: 12px; align-items: center;
}

.dice-box {
  width: 80px; height: 80px;
  background: linear-gradient(135deg, #ffffff, #e2e8f0);
  border-radius: 20px;
  display: flex; align-items: center; justify-content: center;
  font-size: 36px;
  font-weight: bold;
  color: #334155;
  box-shadow: 0 10px 25px rgba(0,0,0,0.2);
  margin-bottom: 10px;
}

.btn-main {
  width: 100%;
  padding: 16px;
  border: none;
  border-radius: 12px;
  background: linear-gradient(90deg, #4f46e5, #7c3aed);
  color: white;
  font-weight: 600;
  font-size: 16px;
  cursor: pointer;
  transition: transform 0.1s;
  box-shadow: 0 4px 15px rgba(124, 58, 237, 0.4);
}
.btn-main:active { transform: scale(0.98); }
.btn-main:disabled { opacity: 0.5; cursor: not-allowed; }

.btn-sec {
  background: transparent;
  color: var(--text-muted);
  border: none;
  cursor: pointer;
  font-size: 12px;
  text-decoration: underline;
}

.log-wrapper {
  background: rgba(0,0,0,0.2);
  border-radius: 12px;
  padding: 12px;
  height: 150px;
  display: flex; flex-direction: column;
}
.log-title { font-size: 10px; text-transform: uppercase; color: var(--text-muted); margin-bottom: 8px; font-weight: bold; }
.log {
  flex: 1;
  overflow-y: auto;
  font-size: 12px;
  color: #cbd5e1;
  display: flex; flex-direction: column; gap: 4px;
}
.log div { border-bottom: 1px solid rgba(255,255,255,0.05); padding-bottom: 4px; }

@media (max-width: 900px) {
  .game-container { flex-direction: column; }
  .panel { width: 100%; max-width: 400px; }
  .board-wrapper { order: 2; }
  .panel { order: 1; }
}
.game-footer {
  position: fixed;
  bottom: 0;
  left: 0;
  width: 100%;
  padding: 15px;
  text-align: center;
  color: var(--text-muted);
  font-size: 12px;
  letter-spacing: 1px;
  pointer-events: none;
  z-index: 50;
  background: linear-gradient(to top, rgba(15, 23, 42, 0.8) 0%, transparent 100%);
}

.game-footer span {
  font-weight: 600;
  opacity: 0.7;
  text-transform: uppercase;
  text-shadow: 0 2px 4px rgba(0,0,0,0.5);

}
