/* ===================================================
   MEMORY CHESS — CREATIVE WONDER STUDIO THEME
   Bright, Kid-Friendly, Consistent with Home Page
   =================================================== */

/* ---- GOOGLE FONTS & ROOT VARIABLES ---- */
:root {
  --yellow:    #FFD93D;
  --orange:    #FF6B35;
  --pink:      #FF6B9D;
  --red:       #FF4757;
  --green:     #2ED573;
  --teal:      #1E90FF;
  --blue:      #5352ED;
  --purple:    #A55EEA;
  --lime:      #7BED9F;
  --coral:     #FF6348;
  --saffron:   #FF9000;
  --cream:     #FFF9F0;
  --dark:      #2D2D2D;
  --mid:       #555555;
  --light:     #F5F5F5;
  
  --color-purple: #A55EEA;
  --color-blue:   #1E90FF;
  --color-pink:   #FF6B9D;
  --color-orange: #FF6B35;
  --color-red:    #FF4757;
  --color-green:  #2ED573;
  
  --font-head: 'Fredoka One', cursive;
  --font-body: 'Nunito', sans-serif;
  --font-hand: 'Caveat', cursive;
  
  --shadow-fun: 0 8px 25px rgba(0,0,0,0.1);
  --shadow-strong: 0 12px 35px rgba(0,0,0,0.15);
}

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

html { scroll-behavior: smooth; }

body {
  font-family: var(--font-body);
  background-color: var(--cream);
  background-image: linear-gradient(135deg, #FFF0D6 0%, #F0FFF4 50%, #F0F0FF 100%);
  color: var(--dark);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  overflow-x: hidden;
  line-height: 1.6;
}

/* ---- FLOATING DOODLES BACKGROUND ---- */
.doodle {
  position: fixed;
  font-size: 2.2rem;
  pointer-events: none;
  z-index: 0;
  animation: floatDoodle 8s ease-in-out infinite;
  opacity: 0.12;
  user-select: none;
}
.doodle-1 { top: 15%; left: 3%; animation-delay: 0s; }
.doodle-2 { top: 35%; right: 4%; animation-delay: 1.5s; }
.doodle-3 { top: 60%; left: 2%; animation-delay: 3s; }
.doodle-4 { top: 80%; right: 3%; animation-delay: 2s; }
.doodle-5 { top: 20%; right: 8%; animation-delay: 2.5s; }
.doodle-6 { top: 75%; left: 5%; animation-delay: 1s; }

@keyframes floatDoodle {
  0%, 100% { transform: translateY(0) rotate(0deg); }
  50% { transform: translateY(-20px) rotate(10deg); }
}

/* ---- NAVBAR (MATCHING HOME PAGE) ---- */
.navbar {
  position: sticky;
  top: 0;
  left: 0;
  right: 0;
  z-index: 1000;
  background: rgba(255, 255, 255, 0.95);
  backdrop-filter: blur(15px);
  padding: 0.8rem 2rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  box-shadow: 0 4px 20px rgba(0,0,0,0.08);
  border-bottom: 4px solid var(--yellow);
}

.brand-link {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-family: var(--font-head);
  font-size: 1.35rem;
  color: var(--orange);
  text-decoration: none;
}

.brand-emoji { font-size: 1.5rem; }

.nav-links {
  display: flex;
  list-style: none;
  gap: 0.3rem;
  align-items: center;
  flex-wrap: wrap;
}

.nav-links a {
  text-decoration: none;
  color: var(--dark);
  font-weight: 700;
  font-size: 0.8rem;
  padding: 0.35rem 0.65rem;
  border-radius: 20px;
  transition: all 0.2s ease;
  white-space: nowrap;
}

.nav-links a:hover, .nav-links a.active-nav-link {
  background: var(--yellow);
  color: var(--dark);
  transform: translateY(-2px);
}

.btn-nav-home {
  background: linear-gradient(135deg, var(--orange), var(--pink)) !important;
  color: white !important;
  font-weight: 800 !important;
  padding: 0.4rem 0.9rem !important;
  box-shadow: 0 3px 10px rgba(255, 107, 53, 0.3);
}

.hamburger {
  display: none;
  flex-direction: column;
  gap: 5px;
  background: none;
  border: none;
  cursor: pointer;
  padding: 5px;
}
.hamburger span {
  display: block;
  width: 25px;
  height: 3px;
  background: var(--dark);
  border-radius: 3px;
}

/* ---- GAME TOP CONTROL BAR ---- */
.game-top-bar {
  max-width: 1200px;
  width: 95%;
  margin: 1.5rem auto 0;
  background: white;
  border-radius: 24px;
  padding: 1.25rem 2rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1.5rem;
  box-shadow: var(--shadow-fun);
  border: 3px solid #FFE0B2;
  position: relative;
  z-index: 10;
  flex-wrap: wrap;
}

.game-title-group {
  display: flex;
  align-items: center;
  gap: 0.85rem;
}

.game-emoji-badge {
  font-size: 2.2rem;
  background: #FFF3E0;
  padding: 0.4rem;
  border-radius: 16px;
  border: 2px solid var(--orange);
}

.game-heading {
  font-family: var(--font-head);
  font-size: 1.8rem;
  color: var(--purple);
  line-height: 1.1;
}

.game-subhead {
  font-size: 1.05rem;
  color: var(--mid);
}

/* Mode Selector */
.mode-selector {
  display: flex;
  background: #FFF3E0;
  padding: 0.3rem;
  border-radius: 50px;
  border: 2px solid var(--yellow);
}

.btn-mode {
  background: transparent;
  border: none;
  color: var(--mid);
  padding: 0.45rem 1.1rem;
  border-radius: 50px;
  font-weight: 800;
  font-size: 0.85rem;
  cursor: pointer;
  transition: all 0.2s ease;
  font-family: var(--font-body);
}

.btn-mode.active {
  background: linear-gradient(135deg, var(--purple), var(--blue));
  color: white;
  box-shadow: 0 3px 10px rgba(165, 94, 234, 0.35);
}

/* Actions */
.header-actions {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.btn-action {
  font-family: var(--font-body);
  font-weight: 800;
  font-size: 0.85rem;
  padding: 0.45rem 0.9rem;
  border-radius: 50px;
  border: none;
  cursor: pointer;
  transition: all 0.2s ease;
}

.btn-restart {
  background: linear-gradient(135deg, var(--orange), var(--pink));
  color: white;
  box-shadow: 0 3px 10px rgba(255, 107, 53, 0.3);
}

.btn-restart:hover { transform: translateY(-2px); }

.btn-sound, .btn-music, .btn-rules {
  background: white;
  color: var(--dark);
  border: 2px solid #ddd;
}

.btn-sound:hover, .btn-music:hover, .btn-rules:hover {
  background: var(--yellow);
  border-color: var(--yellow);
  transform: translateY(-2px);
}

/* ---- STATS & TURN BANNER ---- */
.stats-banner {
  max-width: 1200px;
  width: 95%;
  margin: 1rem auto 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1.5rem;
  flex-wrap: wrap;
  position: relative;
  z-index: 5;
}

.stat-card {
  background: white;
  border-radius: 18px;
  padding: 0.75rem 1.5rem;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  box-shadow: var(--shadow-fun);
  border: 2px solid var(--yellow);
}

.stat-icon { font-size: 1.8rem; }
.stat-label { font-size: 0.8rem; font-weight: 800; color: var(--mid); display: block; }
.stat-value { font-family: var(--font-head); font-size: 1.4rem; color: var(--orange); }

.turn-announcer {
  flex: 1;
  background: white;
  border-radius: 18px;
  padding: 0.85rem 1.5rem;
  text-align: center;
  font-family: var(--font-hand);
  font-size: 1.35rem;
  font-weight: 700;
  color: var(--dark);
  box-shadow: var(--shadow-fun);
  border: 3px dashed var(--purple);
  min-width: 280px;
}

/* VS Scoreboard */
.vs-scoreboard {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  background: white;
  padding: 0.5rem 1rem;
  border-radius: 18px;
  box-shadow: var(--shadow-fun);
  border: 2px solid #ddd;
}

.score-card {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.35rem 0.75rem;
  border-radius: 12px;
}

.player-card.active-turn {
  background: #E8F5E9;
  border: 2px solid var(--green);
}

.ai-card.active-turn {
  background: #EDE7F6;
  border: 2px solid var(--purple);
}

.score-avatar { font-size: 1.4rem; }
.score-title { font-size: 0.75rem; font-weight: 800; color: var(--mid); display: block; }
.score-val { font-family: var(--font-head); font-size: 1.2rem; color: var(--dark); }
.score-divider { font-family: var(--font-head); font-size: 0.9rem; color: var(--orange); }

/* ---- MAIN GAME FIELD ---- */
.game-field {
  max-width: 1200px;
  width: 95%;
  margin: 1.5rem auto 3rem;
  display: grid;
  grid-template-columns: 1fr 340px;
  gap: 2rem;
  position: relative;
  z-index: 5;
}

/* ---- CIRCULAR CHESS PLATE ---- */
.board-container {
  display: flex;
  justify-content: center;
  align-items: center;
  background: white;
  border-radius: 28px;
  padding: 2.5rem;
  box-shadow: var(--shadow-strong);
  border: 4px solid #FFE0B2;
}

.chess-plate {
  width: 480px;
  height: 480px;
  background: radial-gradient(circle at 40% 40%, #E6B17E, #C4813A 60%, #8B4A15 100%);
  border-radius: 50%;
  border: 12px solid #5C320E;
  box-shadow: 
    0 15px 35px rgba(92, 50, 14, 0.4),
    inset 0 0 40px rgba(0,0,0,0.3);
  position: relative;
  margin: auto;
}

/* Pawn Slots & Pieces */
.pawn-slot {
  position: absolute;
  width: 52px;
  height: 52px;
  transform: translate(-50%, -50%);
  cursor: pointer;
}

.pawn-piece {
  width: 100%;
  height: 100%;
  position: relative;
  transition: transform 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.pawn-piece:hover:not(.captured) {
  transform: translateY(-8px) scale(1.1);
}

/* Pawn 3D Body */
.pawn-head {
  width: 24px;
  height: 24px;
  background: radial-gradient(circle at 35% 35%, #FFF0D6, #D4A373 70%, #A47148);
  border-radius: 50%;
  margin: 0 auto;
  border: 2px solid #7F4F24;
  box-shadow: 0 3px 6px rgba(0,0,0,0.3);
}

.pawn-collar {
  width: 32px;
  height: 8px;
  background: #D4A373;
  border-radius: 6px;
  margin: -3px auto 0;
  border: 2px solid #7F4F24;
}

.pawn-base {
  width: 44px;
  height: 22px;
  background: radial-gradient(circle at 50% 30%, #D4A373, #A47148 90%);
  border-radius: 8px 8px 14px 14px;
  margin: -2px auto 0;
  border: 2px solid #7F4F24;
  box-shadow: 0 4px 10px rgba(0,0,0,0.35);
  position: relative;
  overflow: hidden;
}

/* Secret Color Bottom Peg */
.peg-color {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 10px;
  border-radius: 0 0 10px 10px;
  opacity: 0;
  transition: opacity 0.3s;
}

/* Lift & Reveal States */
.pawn-slot.revealed .pawn-piece {
  transform: translateY(-26px) rotate(-8deg) scale(1.2);
  z-index: 100;
}

.pawn-slot.revealed .peg-color {
  opacity: 1;
  box-shadow: 0 0 15px currentColor;
}

.pawn-slot.captured {
  pointer-events: none;
  opacity: 0.15;
}

/* Hole indentation on plate */
.pawn-slot::after {
  content: '';
  position: absolute;
  top: 50%; left: 50%;
  transform: translate(-50%, -50%);
  width: 36px;
  height: 36px;
  background: radial-gradient(circle, #3D1C04, #5C320E 80%);
  border-radius: 50%;
  box-shadow: inset 0 3px 8px rgba(0,0,0,0.8);
  z-index: -1;
}

/* Peg Colors */
.peg-purple { background: var(--color-purple); color: var(--color-purple); }
.peg-blue   { background: var(--color-blue);   color: var(--color-blue); }
.peg-pink   { background: var(--color-pink);   color: var(--color-pink); }
.peg-orange { background: var(--color-orange); color: var(--color-orange); }
.peg-red    { background: var(--color-red);    color: var(--color-red); }
.peg-green  { background: var(--color-green);  color: var(--color-green); }

/* ---- CONTROL PANEL ---- */
.control-panel {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

.dice-station, .captured-tray {
  background: white;
  border-radius: 24px;
  padding: 1.75rem;
  box-shadow: var(--shadow-strong);
  border: 3px solid #FFE0B2;
}

.station-heading {
  font-size: 1.6rem;
  color: var(--orange);
  margin-bottom: 0.35rem;
}

.dice-sub {
  font-size: 0.88rem;
  color: var(--mid);
  margin-bottom: 1.5rem;
  line-height: 1.5;
}

/* ---- 3D CUBE DIE ---- */
.scene-3d {
  width: 90px;
  height: 90px;
  perspective: 400px;
  margin: 0 auto 1.5rem;
  cursor: pointer;
}

.cube-dice {
  width: 100%;
  height: 100%;
  position: relative;
  transform-style: preserve-3d;
  transform: translateZ(-45px);
  transition: transform 1s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.cube-face {
  position: absolute;
  width: 90px;
  height: 90px;
  border-radius: 18px;
  border: 3px solid rgba(255,255,255,0.7);
  box-shadow: inset 0 0 15px rgba(0,0,0,0.2), 0 4px 15px rgba(0,0,0,0.15);
  display: flex;
  align-items: center;
  justify-content: center;
}

.color-dot {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: white;
  box-shadow: 0 2px 8px rgba(0,0,0,0.3);
}

.face-purple { background: var(--color-purple); transform: rotateY(  0deg) translateZ(45px); }
.face-blue   { background: var(--color-blue);   transform: rotateY( 90deg) translateZ(45px); }
.face-pink   { background: var(--color-pink);   transform: rotateY(180deg) translateZ(45px); }
.face-orange { background: var(--color-orange); transform: rotateY(-90deg) translateZ(45px); }
.face-red    { background: var(--color-red);    transform: rotateX( 90deg) translateZ(45px); }
.face-green  { background: var(--color-green);  transform: rotateX(-90deg) translateZ(45px); }

/* Cube Show Rotations */
.cube-dice.show-purple { transform: translateZ(-45px) rotateY(   0deg); }
.cube-dice.show-blue   { transform: translateZ(-45px) rotateY( -90deg); }
.cube-dice.show-pink   { transform: translateZ(-45px) rotateY(-180deg); }
.cube-dice.show-orange { transform: translateZ(-45px) rotateY(  90deg); }
.cube-dice.show-red    { transform: translateZ(-45px) rotateX( -90deg); }
.cube-dice.show-green  { transform: translateZ(-45px) rotateX(  90deg); }

.cube-dice.rolling {
  animation: diceRollAnim 0.9s cubic-bezier(0.2, 0.8, 0.3, 1.2);
}

@keyframes diceRollAnim {
  0%   { transform: translateZ(-45px) rotateX(0deg) rotateY(0deg) rotateZ(0deg); }
  25%  { transform: translateZ(-45px) rotateX(240deg) rotateY(180deg) rotateZ(45deg); }
  50%  { transform: translateZ(-45px) rotateX(480deg) rotateY(360deg) rotateZ(90deg); }
  75%  { transform: translateZ(-45px) rotateX(720deg) rotateY(540deg) rotateZ(180deg); }
  100% { transform: translateZ(-45px) rotateX(1080deg) rotateY(720deg) rotateZ(360deg); }
}

.btn-roll {
  width: 100%;
  background: linear-gradient(135deg, var(--orange), var(--pink));
  color: white;
  border: none;
  padding: 0.85rem;
  border-radius: 50px;
  font-family: var(--font-body);
  font-weight: 900;
  font-size: 1.05rem;
  cursor: pointer;
  box-shadow: 0 6px 20px rgba(255, 107, 53, 0.35);
  transition: all 0.2s ease;
}

.btn-roll:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 25px rgba(255, 107, 53, 0.45);
}

/* Target Color Glow Swatch */
.target-indicator {
  margin-top: 1.25rem;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.75rem;
  font-weight: 800;
  font-size: 0.95rem;
}

.color-swatch-glow {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  border: 3px solid white;
  box-shadow: 0 2px 10px rgba(0,0,0,0.2);
  transition: background 0.3s, box-shadow 0.3s;
}

/* ---- CAPTURED TRAY ---- */
.captured-tray h4 {
  font-size: 1.5rem;
  color: var(--purple);
  margin-bottom: 1rem;
}

.captured-stacks {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.75rem;
}

.stack-slot {
  background: var(--cream);
  border-radius: 14px;
  padding: 0.75rem 0.5rem;
  text-align: center;
  border: 2px solid #E0E0E0;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.25rem;
}

.stack-indicator { font-size: 1.3rem; }
.stack-count { font-family: var(--font-head); font-size: 1.2rem; color: var(--dark); }

/* ---- RULES MODAL ---- */
.modal-overlay {
  display: none;
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(0,0,0,0.6);
  z-index: 2000;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
}

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

.modal-card {
  background: white;
  border-radius: 24px;
  padding: 2.5rem;
  max-width: 540px;
  width: 100%;
  position: relative;
  box-shadow: var(--shadow-strong);
  border: 4px solid var(--yellow);
}

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

.modal-title {
  font-size: 1.8rem;
  color: var(--orange);
}

.modal-close {
  background: var(--red);
  color: white;
  border: none;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  font-size: 1.2rem;
  font-weight: 900;
  cursor: pointer;
}

.rule-list {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  font-size: 0.95rem;
  line-height: 1.6;
  color: var(--mid);
}

/* ---- FOOTER (MATCHING HOME PAGE) ---- */
.footer {
  background: var(--dark);
  color: white;
  text-align: center;
  padding: 3rem 2rem;
  margin-top: auto;
  position: relative;
  overflow: hidden;
}

.footer-doodles {
  font-size: 1.8rem;
  margin-bottom: 1.5rem;
  display: flex;
  justify-content: center;
  gap: 1rem;
  flex-wrap: wrap;
}

.footer-name {
  font-size: 2rem;
  margin-bottom: 0.5rem;
  background: linear-gradient(135deg, var(--yellow), var(--pink), var(--teal));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.footer-tagline { color: #aaa; font-size: 0.9rem; margin-bottom: 1rem; }

.footer-contact { margin-bottom: 1rem; }
.footer-contact p { color: #ddd; font-size: 0.95rem; font-weight: 700; }

.footer-email {
  color: var(--yellow);
  text-decoration: none;
  font-weight: 800;
  padding: 0.2rem 0.6rem;
  border-radius: 8px;
  background: rgba(255, 217, 61, 0.15);
  transition: all 0.2s ease;
}

.footer-email:hover {
  background: var(--yellow);
  color: var(--dark);
  text-decoration: underline;
}

.footer-copy { color: #888; font-size: 0.85rem; }

/* ---- HELPER CLASSES ---- */
.caveat-font { font-family: var(--font-hand) !important; }

/* ---- RESPONSIVE ---- */
@media (max-width: 900px) {
  .game-field {
    grid-template-columns: 1fr;
  }
  .chess-plate {
    width: 360px;
    height: 360px;
  }
  .pawn-slot {
    width: 42px;
    height: 42px;
  }
  .pawn-head { width: 18px; height: 18px; }
  .pawn-collar { width: 24px; height: 6px; }
  .pawn-base { width: 34px; height: 16px; }
}

@media (max-width: 768px) {
  .nav-links {
    display: none;
    position: fixed;
    top: 65px; left: 0; right: 0;
    background: white;
    flex-direction: column;
    gap: 0;
    padding: 1rem;
    box-shadow: 0 10px 20px rgba(0,0,0,0.1);
    z-index: 999;
  }
  .nav-links.open { display: flex; }
  .nav-links a { padding: 0.75rem 1rem; border-radius: 8px; font-size: 1rem; }
  .hamburger { display: flex; }
  
  .game-top-bar { flex-direction: column; text-align: center; }
  .stats-banner { flex-direction: column; }
}
