:root {
  --bg-dark: #0a0a0a;
  --panel-dark: #111;
  --accent-neon: #0ff;
  --danger-neon: #f0f;
  --text-light: #e0e0e0;
  --shadow-neon: rgba(0, 255, 255, 0.5);
}
a.btn.position-absolute {
  top: 15px !important;
  left: 15px !important;
  z-index: 1000;
}
html, body {
  height: 100%;
  margin: 0;
  font-family: 'Inter', system-ui, Arial;
  background: var(--bg-dark);
  color: var(--text-light);
}

/* MAIN CONTAINER */
.app-shell {
  max-width: 1200px;
  margin: 0 auto;
  padding: 10px;
  min-height: 100vh;   /* ✅ use min-height instead */
    display: flex;
  flex-direction: column;
}

.status {
  animation: glowText 1.5s infinite alternate;
}

@keyframes glowText {
  from { text-shadow: 0 0 5px #0ff; }
  to { text-shadow: 0 0 20px #0ff; }
}

.history {
  margin-top: 15px;
  padding: 15px;
  border-radius: 12px;
  background: rgba(255,255,255,0.03);
  border: 1px solid rgba(0,255,255,0.2);
  text-align: center;
}
/* HEADER */
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 12px;
  position: relative;
  margin-bottom: 10px;
}

.topbar h1 {
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  margin: 0;
  font-size: 1.8rem;
  color: #0ff;
  text-shadow: 0 0 10px #0ff;
}
/* RULES BUTTON */
.rules-text {
  position: absolute;
  right: 20px;
  color: #aaa;
  top: 50%;
  transform: translateY(-50%);
  font-size: 0.9rem;
  opacity: 0.6;
  cursor: pointer;
  transition: 0.2s ease;
}

.rules-text:hover {
  opacity: 1;
  text-decoration: underline;
}

/* LAYOUT GRID */
.content {
  display: grid;
  grid-template-columns: 300px 1fr;
  gap: 30px;
    flex: 1;              /* 🔥 take remaining space */
  align-items: center;
}

/* CONTROLS PANEL */
.controls {
  display: flex;
  flex-direction: column;
  gap: 15px;
  align-items: flex-start;
  justify-content: center; /* 🔥 center vertically */
  height: 90%;
    background: rgba(255,255,255,0.03);
  border: 1px solid rgba(0,255,255,0.2);
  padding: 20px;
  border-radius: 16px;
  box-shadow: 0 0 20px rgba(0,255,255,0.1);
}

.controls label {
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 8px;
}

/* BUTTONS */
.btn {
  width: 100%;
  padding: 12px;
  border-radius: 12px;
  border: none;
  background: linear-gradient(135deg, #0ff, #00c3ff);
  color: #000;
  cursor: pointer;
  font-weight: 700;
  letter-spacing: 0.5px;
  box-shadow: 0 0 12px rgba(0,255,255,0.6);
  transition: all 0.25s ease;
}

.btn:hover {
  transform: translateY(-2px) scale(1.03);
  box-shadow: 0 0 25px rgba(0,255,255,0.9);
}
.back-btn {
  color: #0ff;
  font-size: 1.2rem;
  text-decoration: none;
  padding: 6px 10px;
  border-radius: 8px;
  transition: 0.2s ease;
}

.back-btn:hover {
  background: rgba(0,255,255,0.15);
  box-shadow: 0 0 10px #0ff;
}
.btn.ghost {
  background: transparent;
  color: var(--accent-neon);
  border: 1px solid var(--accent-neon);
}

/* BOARD */
.board-wrap {
  display: flex;
  justify-content: center;
  align-items: center;
  height: auto; /* 🔥 limit height */
  padding: 10px;
  background: radial-gradient(circle at center, #111 40%, #000 100%);
  border-radius: 16px;
  box-shadow: 
    0 0 30px rgba(0,255,255,0.3),
    inset 0 0 15px rgba(0,255,255,0.2);
}

#boardCanvas {
  max-width: 100%;
  height: auto;
  display: block;
} 

/* STATUS */
.status {
  font-weight: 600;
  color: var(--accent-neon);
  text-align: center;
}

/* FOOTER */
.footer {
  margin-top: 12px;
  color: #666;
  text-align: center;
}
@media (min-width: 1025px) {
  .content {
    grid-template-columns: 280px 1fr;
    gap: 50px;
  }
}
/* ================= RESPONSIVE ================= */
@media (max-width: 768px) {
  .content {
    grid-template-columns: 1fr;
    align-items: center;
  }

  .controls {
    align-items: center;
    text-align: center;
  }
}
/* 🔥 DESKTOP (FIXED — KEEP SIDE LAYOUT) */
@media (min-width: 1025px) {
  .content {
    grid-template-columns: 320px 1fr;
  }

}

/* 📱 TABLET */
@media (min-width: 641px) and (max-width: 1024px) {
  .content {
    grid-template-columns: 1fr; /* stack */
  }

  .controls {
    align-items: center;
    text-align: center;
  }

}

/* 📱 MOBILE */
@media (max-width: 640px) {
  .app-shell {
    margin: 5px;
    padding: 5px;
  }

  h1 {
    font-size: 1.3rem;
    text-align: center;
  }

  .content {
    grid-template-columns: 1fr;
  }

  .controls {
    align-items: center;
    text-align: center;
    gap: 10px;
  }

  .controls label {
    font-size: 0.9rem;
  }

  .btn {
    padding: 6px 10px;
    font-size: 0.85rem;
  }


  .status {
    font-size: 0.9rem;
  }

  .footer {
    font-size: 0.8rem;
  }
}

/* 📱 SMALL DEVICES */
@media (max-width: 360px) {


  .btn {
    font-size: 0.8rem;
  }
}

/* POPUP */
#rulesPopup {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.75);
  display: none;
  justify-content: center;
  align-items: center;
  z-index: 9999;
}

.rules-box {
  background: #222;
  padding: 20px;
  width: 85%;
  max-width: 420px;
  border-radius: 12px;
  animation: popIn 0.3s ease;
}

.rules-box h2 {
  text-align: center;
}

.close-rules {
  margin-top: 15px;
  width: 100%;
  padding: 10px;
  background: #444;
  border: none;
  border-radius: 8px;
  color: #fff;
}

.close-rules:hover {
  background: #666;
}

@keyframes popIn {
  from { transform: scale(0.85); opacity: 0; }
  to { transform: scale(1); opacity: 1; }
}