*{
  box-sizing:border-box;
  margin:0;
  padding:0;
  font-family:"Space Grotesk",sans-serif;
}

html,
body{
  width:100%;
  min-height:100%;
  overflow-x:hidden;
  background:radial-gradient(circle at top,#4a2c13 0%,#170b04 50%,#050201 100%);
  color:white;
}

body{
  min-height:100vh;
}

button,
a{
  font-family:inherit;
}

.game-shell{
  min-height:100vh;
  display:flex;
  flex-direction:column;
}

.top-bar{
  display:flex;
  justify-content:space-between;
  align-items:center;
  gap:16px;
  padding:16px 22px;
  background:rgba(0,0,0,.38);
  border-bottom:1px solid rgba(255,255,255,.1);
  position:sticky;
  top:0;
  z-index:50;
  backdrop-filter:blur(14px);
}

.top-left{
  display:flex;
  align-items:center;
  gap:28px;
  flex:1;
}

.title-wrap h1{
  font-size:clamp(1.6rem,3vw,2.7rem);
  letter-spacing:.14em;
}

.subtitle{
  opacity:.74;
  margin-top:6px;
}

.top-actions{
  display:flex;
  align-items:center;
  gap:10px;
  flex-wrap:wrap;
}

.top-btn{
  min-height:48px;
  display:flex;
  align-items:center;
  justify-content:center;
  color:white;
  text-decoration:none;
  border:none;
  cursor:pointer;
  padding:12px 20px;
  border-radius:999px;
  font-size:1.05rem;
  font-weight:900;
  background:linear-gradient(180deg,rgba(255,255,255,.18),rgba(255,255,255,.07));
  box-shadow:0 10px 24px rgba(0,0,0,.25);
}

.hud{
  display:grid;
  grid-template-columns:repeat(3,1fr);
  gap:14px;
  padding:16px 22px 0;
}

.hud-card{
  padding:14px;
  border-radius:18px;
  background:linear-gradient(180deg,rgba(255,255,255,.12),rgba(255,255,255,.05));
  border:1px solid rgba(255,255,255,.1);
}

.hud-label{
  opacity:.72;
  margin-bottom:6px;
  font-size:.85rem;
  letter-spacing:.08em;
  text-transform:uppercase;
}

.hud-value{
  font-size:1.25rem;
  font-weight:900;
}

.game-area{
  flex:1;
  display:flex;
  flex-direction:column;
  gap:20px;
  padding:24px 24px 100px;
}

.board-panel{
  display:flex;
  justify-content:center;
}

.mancala-board{
  width:min(94vw,980px);
  display:grid;
  grid-template-columns:1.05fr repeat(6,1fr) 1.05fr;
  grid-template-rows:1fr 1fr;
  gap:16px;
  padding:28px;
  border-radius:34px;
  background:
    radial-gradient(circle at 50% 18%,rgba(255,233,170,.18),transparent 36%),
    repeating-linear-gradient(
      90deg,
      rgba(113,61,25,.24) 0 24px,
      rgba(255,220,145,.08) 24px 48px
    ),
    linear-gradient(135deg,#c78943,#7d431c 52%,#3a1708);
  border:5px solid #6a3514;
  box-shadow:
    0 30px 80px rgba(0,0,0,.6),
    inset 0 0 0 12px rgba(70,32,10,.45),
    inset 0 0 45px rgba(255,231,170,.18);
}

.store,
.pit{
  border:none;
  color:white;
  position:relative;
  border-radius:999px;
  background:
    radial-gradient(circle at 50% 34%,#2d1208 0%,#170702 72%);
  border:2px solid rgba(255,214,135,.45);
  box-shadow:
    inset 0 8px 18px rgba(0,0,0,.78),
    0 3px 8px rgba(255,232,160,.14);
  cursor:pointer;
  min-height:128px;
  overflow:hidden;
}

.store{
  grid-row:1 / 3;
  min-height:280px;
}

.store.ai-store{
  grid-column:1;
}

.store.player-store{
  grid-column:8;
}

.pit.ai-pit{
  grid-row:1;
}

.pit.player-pit{
  grid-row:2;
}

.pit:hover{
  box-shadow:
    inset 0 8px 18px rgba(0,0,0,.78),
    0 0 0 4px rgba(255,226,143,.5),
    0 0 22px rgba(255,226,143,.32);
}

.pit.disabled{
  opacity:.55;
  cursor:not-allowed;
}

.pit-label,
.store-label{
  position:absolute;
  left:50%;
  bottom:10px;
  transform:translateX(-50%);
  font-size:.8rem;
  font-weight:900;
  color:#ffe7b0;
  text-shadow:0 2px 4px rgba(0,0,0,.7);
  white-space:nowrap;
}

.stone-count{
  position:absolute;
  top:10px;
  right:12px;
  width:32px;
  height:32px;
  border-radius:50%;
  display:flex;
  align-items:center;
  justify-content:center;
  font-weight:900;
  background:rgba(0,0,0,.45);
  border:1px solid rgba(255,255,255,.18);
  z-index:5;
}

.stones{
  position:absolute;
  inset:18px 16px 34px;
}

.stone{
  position:absolute;
  width:18px;
  height:18px;
  border-radius:50%;
  background:
    radial-gradient(circle at 35% 25%,#fff0b9,#d49230 58%,#5d2b08);
  border:1px solid rgba(255,255,255,.28);
  box-shadow:
    inset 0 3px 5px rgba(255,255,255,.32),
    inset 0 -4px 7px rgba(0,0,0,.28),
    0 3px 5px rgba(0,0,0,.35);
}

.status-panel{
  display:flex;
  justify-content:center;
}

.status-box{
  width:min(94vw,980px);
  padding:18px;
  border-radius:22px;
  background:linear-gradient(180deg,rgba(255,255,255,.12),rgba(255,255,255,.045));
  border:1px solid rgba(255,255,255,.1);
  line-height:1.55;
  font-weight:800;
}

.instructions-overlay{
  position:fixed;
  inset:0;
  background:rgba(0,0,0,.78);
  display:flex;
  align-items:center;
  justify-content:center;
  padding:18px;
  z-index:999;
}

.hidden{
  display:none;
}

.instructions-modal{
  width:min(94vw,780px);
  max-height:86vh;
  overflow:auto;
  border-radius:28px;
  background:
    radial-gradient(circle at top,rgba(164,97,42,.28),transparent 40%),
    #160d06;
  border:1px solid rgba(255,255,255,.12);
  padding:28px;
  position:relative;
}

.instructions-modal h2{
  margin-bottom:20px;
}

.instructions-content{
  display:flex;
  flex-direction:column;
  gap:18px;
  line-height:1.7;
}

.instructions-content ul{
  padding-left:24px;
}

.close-btn{
  position:absolute;
  top:18px;
  right:18px;
  width:42px;
  height:42px;
  border:none;
  border-radius:50%;
  font-weight:900;
  cursor:pointer;
}

@media (max-width:760px){
  .top-bar{
    flex-direction:column;
    align-items:flex-start;
  }

  .top-left{
    width:100%;
    gap:16px;
    flex-wrap:wrap;
  }

  .title-wrap h1{
    font-size:1.55rem;
  }

  .top-actions,
  .top-btn{
    width:100%;
  }

  .hud{
    grid-template-columns:1fr;
    padding:14px 14px 0;
  }

  .game-area{
    padding:14px 14px 90px;
  }

  .mancala-board{
    gap:8px;
    padding:14px;
    border-radius:22px;
  }

  .store,
  .pit{
    min-height:86px;
  }

  .store{
    min-height:190px;
  }

  .stone{
    width:12px;
    height:12px;
  }

  .stone-count{
    width:26px;
    height:26px;
    font-size:.82rem;
  }

  .pit-label,
  .store-label{
    font-size:.62rem;
  }
}
