/* ================================================================
   MANCALA AI — Wooden Board Realistic Design
   Inspired by physical Mancala board game
   ================================================================ */

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

:root {
  /* Wood palette */
  --wood-light:   #d4a96a;
  --wood-mid:     #b8894a;
  --wood-dark:    #8b6030;
  --wood-darker:  #6b4820;
  --wood-edge:    #5a3a18;
  --wood-grain1:  rgba(180,130,60,0.18);
  --wood-grain2:  rgba(100,60,20,0.12);
  --wood-shadow:  rgba(40,20,5,0.55);

  /* Pit colors */
  --pit-bg:       #c09050;
  --pit-inner:    #a07030;
  --pit-shadow:   rgba(40,20,5,0.7);
  --pit-rim:      #d4b070;

  /* Board bg (dark red like image) */
  --bg-deep:      #4a1010;
  --bg-felt:      #3a0c0c;

  /* Store */
  --store-bg:     #c09050;
  --store-inner:  #a07030;

  /* Seed colors */
  --seed-dark:    #2a2a2a;
  --seed-pink:    #e0a0a0;
  --seed-red:     #c03030;

  /* UI */
  --ink:          #1a0a00;
  --ink2:         #2a1500;
  --panel-bg:     rgba(20,10,0,0.85);
  --border-warm:  rgba(180,130,60,0.3);
  --text:         #f0e8d8;
  --text2:        #c0a880;
  --text3:        #8a7050;
  --amber:        #f5a623;
  --teal:         #00d4aa;
  --coral:        #ff6b6b;
  --blue:         #4f9eff;
  --green:        #4ade80;
  --violet:       #a78bfa;

  --font-display: 'Bebas Neue', sans-serif;
  --font-body:    'DM Sans', sans-serif;
  --font-mono:    'JetBrains Mono', monospace;

  --r-sm:   8px;
  --r-md:   14px;
  --r-lg:   20px;
  --r-full: 999px;
}

html { scroll-behavior: smooth; }
body {
  min-height: 100vh;
  background: var(--bg-felt);
  color: var(--text);
  font-family: var(--font-body);
  font-size: 14px;
  line-height: 1.6;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}

/* ── Felt texture background ── */
body::before {
  content: '';
  position: fixed; inset: 0; z-index: 0;
  background:
    radial-gradient(ellipse 80% 50% at 50% 0%, rgba(100,20,20,0.4) 0%, transparent 70%),
    repeating-linear-gradient(
      45deg,
      rgba(0,0,0,0.04) 0px, rgba(0,0,0,0.04) 1px,
      transparent 1px, transparent 6px
    );
  pointer-events: none;
}

/* ── Ambient light ── */
body::after {
  content: '';
  position: fixed; inset: 0; z-index: 0;
  background: radial-gradient(ellipse 60% 40% at 50% 30%, rgba(180,100,30,0.08) 0%, transparent 70%);
  pointer-events: none;
}

/* ================================================================
   HEADER
   ================================================================ */
.site-header {
  position: sticky; top: 0; z-index: 100;
  background: rgba(20, 8, 0, 0.92);
  backdrop-filter: blur(16px);
  border-bottom: 1px solid rgba(180,130,60,0.25);
  animation: header-down 0.5s cubic-bezier(0.22,1,0.36,1) both;
}
@keyframes header-down {
  from { transform: translateY(-100%); opacity: 0; }
  to   { transform: translateY(0); opacity: 1; }
}
.header-inner {
  display: flex; align-items: center; justify-content: space-between;
  padding: 12px 24px; gap: 16px;
  max-width: 1680px; margin: 0 auto;
}
.header-line {
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--amber) 30%, var(--wood-light) 50%, var(--amber) 70%, transparent);
  opacity: 0.5;
}

.logo-group { display: flex; align-items: center; gap: 12px; }
.logo-badge {
  width: 36px; height: 36px;
  background: linear-gradient(135deg, var(--wood-mid), var(--amber));
  border-radius: 9px;
  display: flex; align-items: center; justify-content: center;
  font-family: var(--font-display);
  font-size: 0.9rem; color: #1a0800;
  box-shadow: 0 3px 12px rgba(245,166,35,0.4);
  flex-shrink: 0;
}
.logo-text { display: flex; align-items: baseline; gap: 8px; }
.logo-main { font-family: var(--font-display); font-size: 1.6rem; letter-spacing: 0.1em; color: var(--wood-light); line-height: 1; }
.logo-dot  { color: var(--amber); }
.logo-sub-inline { font-size: 0.62rem; letter-spacing: 0.2em; color: var(--text3); text-transform: uppercase; }

.header-nav { display: flex; gap: 8px; flex-wrap: wrap; }
.nav-chip {
  display: flex; align-items: center; gap: 6px;
  padding: 5px 12px;
  background: rgba(40,20,5,0.7);
  border: 1px solid var(--border-warm);
  border-radius: var(--r-full);
  font-size: 0.76rem; color: var(--text2); font-weight: 500;
}
.nav-chip strong { color: var(--amber); }
.chip-dot { width: 7px; height: 7px; border-radius: 50%; animation: dot-blink 2s ease infinite; }
.dot-green { background: var(--green); box-shadow: 0 0 6px var(--green); }
@keyframes dot-blink { 0%,100%{opacity:1} 50%{opacity:0.3} }

/* ================================================================
   PAGE LAYOUT
   ================================================================ */
.page-wrapper {
  position: relative; z-index: 1;
  display: grid;
  grid-template-columns: 280px 1fr 300px;
  min-height: calc(100vh - 58px);
  max-width: 1680px;
  margin: 0 auto;
}

.sidebar {
  padding: 18px 14px;
  overflow-y: auto;
  max-height: calc(100vh - 58px);
  display: flex; flex-direction: column; gap: 12px;
  scrollbar-width: thin;
  scrollbar-color: var(--wood-dark) transparent;
}
.sidebar-left  { border-right: 1px solid rgba(180,130,60,0.15); }
.sidebar-right { border-left:  1px solid rgba(180,130,60,0.15); }

.panel {
  background: var(--panel-bg);
  border: 1px solid var(--border-warm);
  border-radius: var(--r-lg);
  padding: 16px;
  animation: panel-up 0.45s cubic-bezier(0.22,1,0.36,1) both;
  animation-delay: var(--delay, 0s);
  backdrop-filter: blur(8px);
}
@keyframes panel-up {
  from { opacity: 0; transform: translateY(14px); }
  to   { opacity: 1; transform: translateY(0); }
}
.panel-header {
  display: flex; align-items: center; gap: 8px;
  margin-bottom: 14px; padding-bottom: 10px;
  border-bottom: 1px solid rgba(180,130,60,0.18);
}
.panel-icon { font-size: 0.9rem; }
.panel-title { font-size: 0.7rem; font-weight: 700; letter-spacing: 0.18em; text-transform: uppercase; color: var(--text2); }

/* ── Controls ── */
.field-group { margin-bottom: 14px; }
.field-label { display: block; font-size: 0.7rem; font-weight: 600; text-transform: uppercase; letter-spacing: 0.12em; color: var(--text3); margin-bottom: 7px; }

.segmented {
  display: flex; background: rgba(0,0,0,0.3); border: 1px solid var(--border-warm);
  border-radius: 10px; padding: 3px; gap: 3px;
}
.seg-btn {
  flex: 1; padding: 8px 10px; border: none;
  background: transparent; color: var(--text3);
  border-radius: 8px; cursor: pointer;
  font-family: var(--font-body); font-size: 0.78rem; font-weight: 600;
  transition: all 0.2s; display: flex; align-items: center; justify-content: center; gap: 5px;
}
.seg-btn:hover { color: var(--text); }
.seg-btn.active { background: rgba(180,130,60,0.25); color: var(--amber); box-shadow: 0 2px 8px rgba(0,0,0,0.3); }

.depth-label-row { display: flex; align-items: center; justify-content: space-between; margin-bottom: 8px; }
.depth-badge {
  background: rgba(245,166,35,0.15); color: var(--amber);
  border: 1px solid rgba(245,166,35,0.3); border-radius: var(--r-full);
  padding: 2px 10px; font-family: var(--font-mono); font-size: 0.82rem; font-weight: 700;
  min-width: 34px; text-align: center; transition: transform 0.2s;
}
.slider {
  -webkit-appearance: none; width: 100%; height: 5px;
  border-radius: 3px; background: rgba(180,130,60,0.2); outline: none; cursor: pointer;
}
.slider::-webkit-slider-thumb {
  -webkit-appearance: none; width: 18px; height: 18px; border-radius: 50%;
  background: linear-gradient(135deg, var(--amber), #c07800);
  border: 2px solid rgba(0,0,0,0.4);
  box-shadow: 0 2px 8px rgba(245,166,35,0.5);
  transition: transform 0.15s;
}
.slider::-webkit-slider-thumb:hover { transform: scale(1.2); }
.slider-ticks { display: flex; justify-content: space-between; font-size: 0.64rem; color: var(--text3); margin-top: 4px; }

.btn-start {
  position: relative; width: 100%; padding: 12px 20px;
  border: none; border-radius: var(--r-md); cursor: pointer; overflow: hidden;
  transition: transform 0.2s, box-shadow 0.2s;
}
.btn-start-bg {
  position: absolute; inset: 0;
  background: linear-gradient(135deg, #7a4800, var(--amber), #f5c842, var(--amber), #7a4800);
  background-size: 300%; animation: shimmer-btn 3s ease infinite;
}
@keyframes shimmer-btn { 0%{background-position:0%} 50%{background-position:100%} 100%{background-position:0%} }
.btn-start:hover { transform: translateY(-2px); box-shadow: 0 6px 20px rgba(245,166,35,0.4); }
.btn-start:active { transform: translateY(0); }
.btn-start-content {
  position: relative; z-index: 1;
  display: flex; align-items: center; justify-content: center; gap: 8px;
  font-family: var(--font-display); font-size: 0.95rem; letter-spacing: 0.12em; color: #1a0800;
}

.btn-ghost {
  width: 100%; padding: 8px 14px; background: transparent;
  border: 1px solid var(--border-warm); border-radius: var(--r-md);
  color: var(--text3); font-family: var(--font-body); font-size: 0.76rem; font-weight: 600;
  cursor: pointer; transition: all 0.2s;
  display: flex; align-items: center; justify-content: center; gap: 6px;
  margin-top: 8px;
}
.btn-ghost:hover { border-color: var(--teal); color: var(--teal); background: rgba(0,212,170,0.08); }
.btn-sm { padding: 6px 10px; font-size: 0.72rem; width: auto; margin-top: 0; }

/* Status */
.turn-card {
  display: flex; align-items: center; gap: 12px;
  padding: 11px 13px; background: rgba(0,0,0,0.3);
  border: 1px solid var(--border-warm); border-radius: var(--r-md);
  margin-bottom: 12px; transition: border-color 0.3s;
}
.turn-card.p1-turn { border-color: rgba(79,158,255,0.4); }
.turn-card.p2-turn { border-color: rgba(255,107,107,0.4); }
.turn-pulse { width: 11px; height: 11px; border-radius: 50%; background: var(--text3); flex-shrink: 0; transition: all 0.3s; }
.turn-pulse.p1 { background: var(--blue); animation: pulse-b 1.5s infinite; }
.turn-pulse.p2 { background: var(--coral); animation: pulse-r 1.5s infinite; }
@keyframes pulse-b { 0%,100%{box-shadow:0 0 0 2px rgba(79,158,255,0.2)} 50%{box-shadow:0 0 0 5px rgba(79,158,255,0)} }
@keyframes pulse-r { 0%,100%{box-shadow:0 0 0 2px rgba(255,107,107,0.2)} 50%{box-shadow:0 0 0 5px rgba(255,107,107,0)} }
.turn-who { font-weight: 700; font-size: 0.88rem; color: var(--text); display: block; }
.turn-sub { font-size: 0.7rem; color: var(--text3); }

.score-row { display: flex; align-items: center; gap: 10px; margin-bottom: 12px; }
.score-block {
  flex: 1; background: rgba(0,0,0,0.3); border: 1px solid var(--border-warm);
  border-radius: var(--r-md); padding: 10px; text-align: center;
}
.score-block.score-p1 { border-color: rgba(79,158,255,0.25); }
.score-block.score-p2 { border-color: rgba(255,107,107,0.25); }
.score-player { display: block; font-size: 0.68rem; color: var(--text3); }
.score-num { display: block; font-family: var(--font-display); font-size: 2rem; line-height: 1; transition: transform 0.3s cubic-bezier(0.34,1.56,0.64,1); }
.score-p1 .score-num { color: var(--blue); }
.score-p2 .score-num { color: var(--coral); }
.score-num.bump { transform: scale(1.3); }
.score-vs { font-family: var(--font-display); font-size: 0.9rem; color: var(--text3); letter-spacing: 0.1em; }
.score-label { display: block; font-size: 0.62rem; color: var(--text3); }

.game-result {
  padding: 11px 14px; border-radius: var(--r-md); border: 2px solid;
  font-family: var(--font-display); font-size: 1rem; letter-spacing: 0.1em; text-align: center;
  animation: pop 0.4s cubic-bezier(0.34,1.56,0.64,1) both;
}
@keyframes pop { from{transform:scale(0.8);opacity:0} to{transform:scale(1);opacity:1} }
.game-result.win  { background: rgba(74,222,128,0.1); border-color: var(--green); color: var(--green); }
.game-result.lose { background: rgba(255,107,107,0.1); border-color: var(--coral); color: var(--coral); }
.game-result.draw { background: rgba(245,166,35,0.1); border-color: var(--amber); color: var(--amber); }
.hidden { display: none !important; }

/* Stats */
.stats-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 7px; margin-bottom: 10px; }
.stat-item {
  background: rgba(0,0,0,0.3); border: 1px solid var(--border-warm);
  border-radius: var(--r-sm); padding: 9px 10px;
  display: flex; flex-direction: column; gap: 2px;
}
.stat-item.accent-green  { border-color: rgba(74,222,128,0.25); }
.stat-item.accent-purple { border-color: rgba(167,139,250,0.25); }
.stat-item.accent-gold   { border-color: rgba(245,166,35,0.25); }
.stat-val { font-family: var(--font-mono); font-size: 0.95rem; font-weight: 700; color: var(--text); transition: transform 0.3s; }
.stat-item.accent-green  .stat-val { color: var(--green); }
.stat-item.accent-purple .stat-val { color: var(--violet); }
.stat-item.accent-gold   .stat-val { color: var(--amber); }
.stat-name { font-size: 0.62rem; color: var(--text3); text-transform: uppercase; letter-spacing: 0.08em; }
.mini-stat-row { display: flex; gap: 7px; margin-bottom: 2px; }
.mini-stat {
  flex: 1; background: rgba(0,0,0,0.3); border: 1px solid var(--border-warm);
  border-radius: var(--r-sm); padding: 7px 9px;
  display: flex; flex-direction: column; gap: 2px;
}
.mini-label { font-size: 0.62rem; color: var(--text3); text-transform: uppercase; letter-spacing: 0.08em; }
.mini-val   { font-size: 0.82rem; font-weight: 600; color: var(--text2); }
.mono { font-family: var(--font-mono); }

/* ================================================================
   BOARD CENTER
   ================================================================ */
.board-center {
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  padding: 20px 16px; gap: 14px;
  min-height: calc(100vh - 58px);
}

/* Player banners */
.player-banner {
  width: 100%; max-width: 820px;
  background: rgba(20,8,0,0.7);
  border: 1px solid var(--border-warm);
  border-radius: var(--r-lg);
  padding: 10px 16px;
  backdrop-filter: blur(6px);
  animation: fade-up 0.5s cubic-bezier(0.22,1,0.36,1) both;
  animation-delay: var(--delay, 0s);
  position: relative; overflow: hidden;
}
@keyframes fade-up { from{opacity:0;transform:translateY(8px)} to{opacity:1;transform:translateY(0)} }
.banner-glow { position: absolute; inset: 0; pointer-events: none; opacity: 0.06; }
.banner-glow-ai    { background: radial-gradient(ellipse at left, var(--coral), transparent 60%); }
.banner-glow-human { background: radial-gradient(ellipse at right, var(--blue), transparent 60%); }
.banner-content { position: relative; z-index: 1; display: flex; align-items: center; gap: 12px; }
.banner-avatar { font-size: 1.4rem; }
.banner-name { display: block; font-weight: 700; font-size: 0.9rem; }
.banner-role { display: block; font-size: 0.68rem; color: var(--text3); }
.banner-score-pill {
  margin-left: auto; font-family: var(--font-display); font-size: 1.5rem;
  padding: 3px 14px; border-radius: var(--r-full); line-height: 1;
  transition: transform 0.3s cubic-bezier(0.34,1.56,0.64,1);
  background: rgba(255,107,107,0.15); color: var(--coral); border: 1px solid rgba(255,107,107,0.3);
}
.banner-score-human { background: rgba(79,158,255,0.15); color: var(--blue); border-color: rgba(79,158,255,0.3); }
.banner-score-pill.bump { transform: scale(1.25); }

/* ================================================================
   WOODEN MANCALA BOARD
   ================================================================ */
.mancala-wrapper {
  width: 100%; max-width: 820px;
  animation: scale-in 0.6s cubic-bezier(0.22,1,0.36,1) both;
  animation-delay: var(--delay, 0s);
  /* Perspective for 3D look */
  perspective: 1000px;
}
@keyframes scale-in { from{opacity:0;transform:scale(0.93)} to{opacity:1;transform:scale(1)} }

/* The main wooden board */
.mancala-board {
  display: flex;
  align-items: stretch;
  gap: 0;
  padding: 20px 14px;

  /* Wood base gradient */
  background:
    /* grain streaks */
    repeating-linear-gradient(
      92deg,
      transparent 0px, transparent 18px,
      rgba(100,60,10,0.06) 18px, rgba(100,60,10,0.06) 19px,
      transparent 19px, transparent 38px
    ),
    repeating-linear-gradient(
      88deg,
      transparent 0px, transparent 30px,
      rgba(180,120,40,0.05) 30px, rgba(180,120,40,0.05) 31px,
      transparent 31px, transparent 60px
    ),
    linear-gradient(
      160deg,
      #d9b070 0%, #c89850 20%, #b88040 45%, #c89850 70%, #d4aa60 100%
    );

  border-radius: 18px;
  border: 3px solid var(--wood-edge);
  box-shadow:
    /* outer shadow */
    0 20px 60px rgba(0,0,0,0.8),
    0 8px 20px rgba(0,0,0,0.5),
    /* top highlight */
    inset 0 2px 0 rgba(255,220,120,0.35),
    /* bottom inner shadow */
    inset 0 -3px 6px rgba(40,20,0,0.4),
    /* side bevels */
    inset 3px 0 6px rgba(255,200,100,0.15),
    inset -3px 0 6px rgba(40,20,0,0.2);

  position: relative;
  overflow: visible;
}

/* Center fold line (like a physical board folded) */
.mancala-board::after {
  content: '';
  position: absolute;
  top: 10px; bottom: 10px;
  left: 50%;
  width: 2px;
  transform: translateX(-50%);
  background: linear-gradient(180deg,
    transparent,
    rgba(80,40,10,0.5) 15%,
    rgba(80,40,10,0.7) 50%,
    rgba(80,40,10,0.5) 85%,
    transparent
  );
  border-radius: 1px;
  pointer-events: none;
  z-index: 5;
}

/* Hinge decoration */
.board-hinge {
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  width: 16px; height: 20px;
  background: linear-gradient(135deg, #d4a030, #8a6010, #d4a030);
  border-radius: 3px;
  box-shadow: 0 2px 4px rgba(0,0,0,0.5), inset 0 1px 0 rgba(255,220,120,0.4);
  z-index: 10;
}
.board-hinge.hinge-top    { top: -2px; }
.board-hinge.hinge-bottom { bottom: -2px; }

/* ── STORES (Mancala slots) ── */
.store {
  width: 88px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 8px 6px;
}
.store-inner {
  width: 100%;
  height: 100%;
  border-radius: 50px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px 6px;
  position: relative;

  /* Deep carved oval */
  background:
    radial-gradient(ellipse at 30% 25%, rgba(255,200,100,0.12) 0%, transparent 50%),
    linear-gradient(160deg, #7a5020 0%, #5a3510 40%, #6a4018 70%, #7a5020 100%);

  box-shadow:
    /* deep inset */
    inset 0 4px 16px rgba(0,0,0,0.8),
    inset 0 -2px 4px rgba(0,0,0,0.4),
    inset 2px 0 8px rgba(0,0,0,0.5),
    inset -2px 0 8px rgba(0,0,0,0.5),
    /* rim highlight */
    0 0 0 2px rgba(200,150,60,0.4),
    0 1px 0 rgba(255,220,120,0.2);

  border: 1.5px solid rgba(80,40,10,0.8);
  transition: box-shadow 0.3s;
}
.store-tag {
  font-size: 0.52rem; text-transform: uppercase; letter-spacing: 0.12em;
  color: rgba(220,170,80,0.6); text-align: center; font-weight: 600;
}
.store-num {
  font-family: var(--font-display);
  font-size: 2.6rem;
  line-height: 1;
  text-shadow: 0 2px 6px rgba(0,0,0,0.7), 0 0 20px currentColor;
  transition: transform 0.35s cubic-bezier(0.34,1.56,0.64,1);
}
.store-ai    .store-num { color: #ff9090; }
.store-human .store-num { color: #80b8ff; }
.store-num.bump { transform: scale(1.25); }
.store-gems {
  display: flex; flex-wrap: wrap; justify-content: center;
  gap: 3px; max-height: 80px; overflow: hidden; padding: 2px;
}

/* ── PITS ZONE ── */
.pits-zone {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 4px 10px;
}

.pits-row {
  display: flex;
  gap: 10px;
  justify-content: center;
}

/* Individual pit — carved circle in wood */
.pit {
  width: 88px;
  height: 88px;
  border-radius: 50%;
  position: relative;
  cursor: pointer;
  flex-shrink: 0;
  transition: transform 0.2s cubic-bezier(0.34,1.56,0.64,1);
}

/* Outer rim (wood around the pit) */
.pit-outer {
  position: absolute; inset: 0; border-radius: 50%;
  background: linear-gradient(135deg, rgba(200,150,60,0.4) 0%, transparent 50%, rgba(80,40,10,0.3) 100%);
  box-shadow:
    inset 0 -2px 4px rgba(255,200,100,0.2),
    inset 0 2px 0 rgba(255,220,120,0.1);
  pointer-events: none; z-index: 1;
}

/* The carved pit hole */
.pit-hole {
  position: absolute;
  inset: 5px;
  border-radius: 50%;
  background:
    radial-gradient(ellipse at 35% 28%, rgba(200,140,60,0.18) 0%, transparent 45%),
    linear-gradient(160deg, #7a5020 0%, #5a3010 35%, #4a2808 60%, #603818 100%);
  box-shadow:
    inset 0 4px 18px rgba(0,0,0,0.85),
    inset 0 2px 8px rgba(0,0,0,0.6),
    inset -2px -2px 6px rgba(0,0,0,0.5),
    /* top rim light */
    inset 0 -1px 0 rgba(180,120,40,0.3),
    0 0 0 1px rgba(80,40,10,0.6),
    /* subtle outer glow showing rim depth */
    0 2px 4px rgba(0,0,0,0.5);
  z-index: 2;
  transition: box-shadow 0.2s;
  overflow: hidden;
}

/* Inner highlight (light reflection at top of bowl) */
.pit-hole::before {
  content: '';
  position: absolute;
  top: 8%; left: 18%;
  width: 45%; height: 22%;
  border-radius: 50%;
  background: radial-gradient(ellipse, rgba(255,210,120,0.12) 0%, transparent 100%);
  pointer-events: none;
}

/* Seeds container inside hole */
.pit-gems {
  position: absolute; inset: 0;
  border-radius: 50%;
  display: flex; flex-wrap: wrap;
  align-items: center; justify-content: center;
  gap: 3px; padding: 14px;
  z-index: 3; pointer-events: none;
}

/* Count overlay */
.pit-count {
  position: absolute; inset: 0;
  display: flex; align-items: center; justify-content: center;
  z-index: 4;
  font-family: var(--font-display);
  font-size: 1.7rem;
  color: rgba(255,240,200,0.95);
  text-shadow:
    0 2px 4px rgba(0,0,0,0.9),
    0 0 12px rgba(0,0,0,0.6);
  line-height: 1;
  transition: transform 0.25s cubic-bezier(0.34,1.56,0.64,1);
  pointer-events: none;
}

/* Label below count */
.pit-label {
  position: absolute;
  bottom: -22px; left: 50%; transform: translateX(-50%);
  font-size: 0.62rem; font-weight: 700;
  letter-spacing: 0.12em; text-transform: uppercase;
  color: rgba(200,160,80,0.7);
  white-space: nowrap;
}

.pit-hover-glow {
  position: absolute; inset: 5px; border-radius: 50%;
  opacity: 0; transition: opacity 0.2s; pointer-events: none; z-index: 3;
}
.pit-human .pit-hover-glow { background: radial-gradient(circle, rgba(79,158,255,0.25), transparent 70%); }
.pit-ai    .pit-hover-glow { background: radial-gradient(circle, rgba(255,107,107,0.2), transparent 70%); }

/* Hover state */
.pit-human.can-play:hover {
  transform: translateY(-4px) scale(1.05);
}
.pit-human.can-play:hover .pit-hole {
  box-shadow:
    inset 0 4px 18px rgba(0,0,0,0.7),
    inset 0 2px 8px rgba(0,0,0,0.5),
    0 0 0 2px rgba(79,158,255,0.5),
    0 6px 20px rgba(79,158,255,0.25);
}
.pit-human.can-play:hover .pit-hover-glow { opacity: 1; }
.pit-human.can-play { cursor: pointer; }
.pit-human.can-play .pit-hole {
  box-shadow:
    inset 0 4px 18px rgba(0,0,0,0.8),
    inset 0 2px 8px rgba(0,0,0,0.55),
    0 0 0 1.5px rgba(79,158,255,0.3),
    0 2px 8px rgba(79,158,255,0.1);
}

/* Disabled */
.pit.disabled { opacity: 0.45; cursor: not-allowed; pointer-events: none; }

/* Last move highlight */
.pit.last-move .pit-hole {
  box-shadow:
    inset 0 4px 18px rgba(0,0,0,0.7),
    0 0 0 2.5px rgba(0,212,170,0.7),
    0 4px 16px rgba(0,212,170,0.35) !important;
  animation: last-flash 0.4s ease-out;
}
@keyframes last-flash { 0%{box-shadow: inset 0 4px 18px rgba(0,0,0,0.5), 0 0 0 4px rgba(0,212,170,0.9), 0 8px 30px rgba(0,212,170,0.6)} 100%{box-shadow: inset 0 4px 18px rgba(0,0,0,0.7), 0 0 0 2.5px rgba(0,212,170,0.7), 0 4px 16px rgba(0,212,170,0.35)} }

/* ── 3D Seed gems ── */
.gem {
  width: 14px; height: 14px;
  border-radius: 50%;
  flex-shrink: 0;
  position: relative;
  box-shadow:
    inset -2px -2px 3px rgba(0,0,0,0.4),
    inset 1px 1px 2px rgba(255,255,255,0.2),
    0 2px 4px rgba(0,0,0,0.5);
}
.gem::after {
  content: '';
  position: absolute;
  top: 15%; left: 22%;
  width: 35%; height: 28%;
  border-radius: 50%;
  background: rgba(255,255,255,0.3);
  filter: blur(1px);
}

/* Seed color variants (like real mancala: dark, pink/rose, red) */
.gem-dark {
  background: radial-gradient(circle at 38% 32%, #555, #1a1a1a);
}
.gem-pink {
  background: radial-gradient(circle at 38% 32%, #f0c0c0, #c07070);
}
.gem-red {
  background: radial-gradient(circle at 38% 32%, #e06060, #800000);
}
/* For stores */
.gem-store-d { background: radial-gradient(circle at 38% 32%, #555, #1a1a1a); }
.gem-store-p { background: radial-gradient(circle at 38% 32%, #f0c0c0, #c07070); }
.gem-store-r { background: radial-gradient(circle at 38% 32%, #e06060, #800000); }

/* Gem pop animation */
.gem-anim { animation: gem-pop 0.25s cubic-bezier(0.34,1.56,0.64,1) both; }
@keyframes gem-pop { from{transform:scale(0);opacity:0} to{transform:scale(1);opacity:1} }

/* Board corner labels */
.board-corners {
  display: flex; justify-content: space-between;
  padding: 8px 20px 0;
  font-size: 0.62rem; color: rgba(180,140,60,0.5);
  letter-spacing: 0.1em; text-transform: uppercase;
}

/* Divider between rows */
.board-divider-line {
  height: 1px;
  background: linear-gradient(90deg, transparent 0%, rgba(80,40,10,0.6) 20%, rgba(80,40,10,0.6) 80%, transparent 100%);
  margin: 0 4px;
}

/* ================================================================
   LOG
   ================================================================ */
.log-container {
  width: 100%; max-width: 820px;
  background: var(--panel-bg);
  border: 1px solid var(--border-warm);
  border-radius: var(--r-lg);
  overflow: hidden;
  backdrop-filter: blur(6px);
  animation: fade-up 0.5s cubic-bezier(0.22,1,0.36,1) both;
  animation-delay: var(--delay, 0s);
}
.log-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 8px 14px; border-bottom: 1px solid var(--border-warm);
  background: rgba(0,0,0,0.2);
}
.log-title { font-size: 0.72rem; font-weight: 700; letter-spacing: 0.1em; text-transform: uppercase; color: var(--text2); }
.log-clear { font-size: 0.68rem; color: var(--text3); background: none; border: none; cursor: pointer; padding: 2px 7px; border-radius: 4px; transition: color 0.2s; }
.log-clear:hover { color: var(--coral); }
.log-body { padding: 8px 10px; max-height: 90px; overflow-y: auto; display: flex; flex-direction: column; gap: 2px; scrollbar-width: thin; }
.log-entry { display: flex; gap: 8px; font-size: 0.78rem; padding: 2px 5px; border-radius: 3px; animation: log-in 0.2s ease-out; }
@keyframes log-in { from{opacity:0;transform:translateX(-5px)} to{opacity:1;transform:translateX(0)} }
.log-time { font-family: var(--font-mono); font-size: 0.62rem; color: var(--text3); flex-shrink: 0; }
.log-info    { color: var(--text3); }
.log-move    { color: #80b8ff; }
.log-ai      { color: #ff9090; }
.log-extra   { color: var(--amber); }
.log-capture { color: var(--violet); }
.log-win     { color: var(--green); font-weight: 700; background: rgba(74,222,128,0.08); }

/* ================================================================
   GAME TREE (right panel)
   ================================================================ */
.tree-toolbar { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; }
.select-sm {
  background: rgba(0,0,0,0.3); border: 1px solid var(--border-warm);
  color: var(--text2); border-radius: var(--r-sm); padding: 5px 9px;
  font-size: 0.76rem; font-family: var(--font-body); cursor: pointer; outline: none;
}
.tree-legend { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 8px; }
.legend-item { display: flex; align-items: center; gap: 4px; font-size: 0.68rem; color: var(--text3); }
.legend-pip { width: 8px; height: 8px; border-radius: 50%; }
.pip-max    { background: var(--coral); }
.pip-min    { background: var(--blue); }
.pip-pruned { background: #444; border: 1px solid #666; }
.pip-leaf   { background: var(--amber); }
.tree-viewport {
  overflow: auto; max-height: 400px;
  background: rgba(0,0,0,0.3); border: 1px solid var(--border-warm);
  border-radius: var(--r-md);
  scrollbar-width: thin;
}
.tree-empty { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 8px; padding: 36px 16px; color: var(--text3); font-size: 0.78rem; text-align: center; }
.tree-empty-icon { font-size: 1.8rem; opacity: 0.4; }
.tree-svg { font-family: var(--font-body); }
.t-edge { stroke: rgba(255,255,255,0.08); stroke-width: 1.5; fill: none; }
.t-edge-pruned { stroke: rgba(255,255,255,0.03); stroke-dasharray: 4; }
.t-circle { stroke-width: 1.5; }
.t-max    { fill: rgba(255,107,107,0.12); stroke: var(--coral); }
.t-min    { fill: rgba(79,158,255,0.12);  stroke: var(--blue); }
.t-leaf   { fill: rgba(245,166,35,0.12);  stroke: var(--amber); }
.t-pruned { fill: rgba(20,10,0,0.7); stroke: rgba(255,255,255,0.08); stroke-dasharray: 3; }
.t-val    { font-size: 10px; font-weight: 700; dominant-baseline: middle; text-anchor: middle; }
.t-val-max    { fill: var(--coral); }
.t-val-min    { fill: var(--blue); }
.t-val-leaf   { fill: var(--amber); }
.t-val-pruned { fill: var(--text3); }
.t-move { font-size: 8px; fill: var(--text3); dominant-baseline: middle; text-anchor: middle; }
.t-ab   { font-size: 7px; dominant-baseline: middle; }

/* Benchmark table */
.table-wrap { overflow-x: auto; }
.data-table { width: 100%; border-collapse: collapse; font-size: 0.74rem; }
.data-table th { background: rgba(0,0,0,0.3); color: var(--amber); font-size: 0.63rem; letter-spacing: 0.1em; text-transform: uppercase; padding: 7px 6px; text-align: right; border-bottom: 1px solid var(--border-warm); font-weight: 700; }
.data-table th:first-child { text-align: center; }
.data-table td { padding: 6px; text-align: right; border-bottom: 1px solid rgba(180,130,60,0.08); color: var(--text2); font-family: var(--font-mono); font-size: 0.72rem; }
.data-table td:first-child { text-align: center; color: var(--amber); font-weight: 700; }
.data-table tr:hover td { background: rgba(255,255,255,0.02); }
.col-pruned { color: var(--violet); font-weight: 700; }

/* ================================================================
   THINKING OVERLAY
   ================================================================ */
.thinking-overlay {
  position: fixed; inset: 0; z-index: 200;
  background: rgba(10,4,0,0.8); backdrop-filter: blur(8px);
  display: flex; align-items: center; justify-content: center;
}
.thinking-card {
  background: rgba(25,12,0,0.95);
  border: 1px solid var(--border-warm);
  border-radius: var(--r-xl, 28px);
  padding: 30px 38px;
  display: flex; flex-direction: column; align-items: center; gap: 16px;
  box-shadow: 0 20px 60px rgba(0,0,0,0.9);
  animation: think-pop 0.3s cubic-bezier(0.34,1.56,0.64,1);
}
@keyframes think-pop { from{transform:scale(0.8);opacity:0} to{transform:scale(1);opacity:1} }
.thinking-orbs { position: relative; width: 56px; height: 56px; }
.orb { position: absolute; width: 16px; height: 16px; border-radius: 50%; }
.orb1 { background: var(--amber); top: 0; left: 50%; transform: translateX(-50%); animation: orbit 1.4s ease-in-out infinite; box-shadow: 0 0 10px rgba(245,166,35,0.5); }
.orb2 { background: var(--coral); bottom: 0; left: 8%; animation: orbit 1.4s ease-in-out infinite 0.47s; box-shadow: 0 0 10px rgba(255,107,107,0.4); }
.orb3 { background: var(--blue); bottom: 0; right: 8%; animation: orbit 1.4s ease-in-out infinite 0.94s; box-shadow: 0 0 10px rgba(79,158,255,0.4); }
@keyframes orbit { 0%,100%{transform:scale(1);opacity:1} 33%{transform:scale(0.55) translateY(-4px);opacity:0.4} 66%{transform:scale(1.15);opacity:0.8} }
.thinking-label { font-size: 0.88rem; color: var(--text2); letter-spacing: 0.06em; }
.thinking-bar { width: 150px; height: 3px; background: rgba(180,130,60,0.2); border-radius: 2px; overflow: hidden; }
.thinking-bar-fill { height: 100%; background: linear-gradient(90deg, var(--amber), var(--teal)); animation: load-bar 1.8s ease-in-out infinite; border-radius: 2px; }
@keyframes load-bar { 0%{width:0%;margin-left:0%} 50%{width:70%;margin-left:15%} 100%{width:0%;margin-left:100%} }

/* Toast */
.toast-container { position: fixed; bottom: 20px; right: 20px; z-index: 300; display: flex; flex-direction: column; gap: 7px; pointer-events: none; }
.toast {
  padding: 10px 16px; background: rgba(20,10,0,0.95); border: 1px solid var(--border-warm);
  border-radius: var(--r-md); font-size: 0.8rem; color: var(--text);
  box-shadow: 0 6px 20px rgba(0,0,0,0.6); min-width: 190px;
  border-left: 3px solid var(--amber);
  animation: toast-in 0.3s cubic-bezier(0.34,1.56,0.64,1) both, toast-out 0.3s ease-in 2.7s both;
}
.toast.type-success { border-left-color: var(--green); }
.toast.type-ai      { border-left-color: var(--coral); }
.toast.type-extra   { border-left-color: var(--amber); }
@keyframes toast-in  { from{opacity:0;transform:translateX(20px)} to{opacity:1;transform:translateX(0)} }
@keyframes toast-out { to{opacity:0;transform:translateX(20px)} }

/* ================================================================
   RESPONSIVE
   ================================================================ */
@media (max-width: 1200px) {
  .page-wrapper { grid-template-columns: 260px 1fr; }
  .sidebar-right { display: none; }
}
@media (max-width: 800px) {
  .page-wrapper { grid-template-columns: 1fr; }
  .sidebar-left { max-height: none; border-right: none; border-bottom: 1px solid var(--border-warm); }
  .pit { width: 62px; height: 62px; }
  .pit-count { font-size: 1.2rem; }
  .store { width: 60px; }
  .store-num { font-size: 1.8rem; }
  .mancala-board { padding: 12px 8px; }
  .pits-row { gap: 6px; }
  .logo-sub-inline { display: none; }
}

/* ================================================================
   SEED DISTRIBUTION ANIMATION
   ================================================================ */

/* Flying seed overlay (absolutely positioned, travels via JS) */
.flying-seed {
  position: fixed;
  width: 14px; height: 14px;
  border-radius: 50%;
  z-index: 500;
  pointer-events: none;
  box-shadow:
    inset -2px -2px 3px rgba(0,0,0,0.4),
    inset 1px 1px 2px rgba(255,255,255,0.2),
    0 3px 8px rgba(0,0,0,0.6);
  transition: none;
}
.flying-seed::after {
  content: '';
  position: absolute;
  top: 15%; left: 22%;
  width: 35%; height: 28%;
  border-radius: 50%;
  background: rgba(255,255,255,0.3);
  filter: blur(1px);
}

/* Pit "receiving" flash */
.pit-receive {
  animation: pit-receive-flash 0.25s ease-out !important;
}
@keyframes pit-receive-flash {
  0%   { filter: brightness(1.8) drop-shadow(0 0 8px rgba(255,220,100,0.9)); }
  100% { filter: brightness(1); }
}

/* Source pit empty flash */
.pit-picked {
  animation: pit-picked-flash 0.3s ease-out !important;
}
@keyframes pit-picked-flash {
  0%   { filter: brightness(0.5); }
  100% { filter: brightness(1); }
}

/* Active distributing indicator on pit */
.pit-distributing .pit-hole {
  box-shadow:
    inset 0 4px 18px rgba(0,0,0,0.5),
    0 0 0 2px rgba(245,166,35,0.7),
    0 0 16px rgba(245,166,35,0.4) !important;
}

/* Speed control for animation */
.speed-row {
  display: flex; align-items: center; gap: 8px;
  margin-top: 8px;
}
.speed-label { font-size: 0.7rem; color: var(--text3); text-transform: uppercase; letter-spacing: 0.1em; }
.speed-btns  { display: flex; gap: 5px; }
.speed-btn {
  padding: 4px 10px;
  background: rgba(0,0,0,0.3);
  border: 1px solid var(--border-warm);
  border-radius: 6px;
  font-size: 0.72rem; font-weight: 600;
  color: var(--text3); cursor: pointer;
  transition: all 0.15s; font-family: var(--font-body);
}
.speed-btn:hover   { color: var(--text); border-color: var(--amber); }
.speed-btn.active  { background: rgba(245,166,35,0.18); color: var(--amber); border-color: rgba(245,166,35,0.5); }

/* ================================================================
   DIFFICULTY HINT
   ================================================================ */
.difficulty-hint {
  font-size: 0.7rem;
  color: var(--text3);
  margin-top: 6px;
  line-height: 1.5;
  transition: color 0.2s;
}
