*{
  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,#342315 0%,#120904 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.25rem,3vw,2.45rem);
  letter-spacing:.1em;
}

.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.1rem;
  font-weight:900;
}

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

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

.morris-board{
  width:min(88vw,680px);
  aspect-ratio:1;
  position:relative;
  border-radius:32px;
  background:
    radial-gradient(circle at 50% 20%,rgba(255,231,170,.25),transparent 38%),
    repeating-linear-gradient(
      90deg,
      rgba(120,64,24,.22) 0 18px,
      rgba(255,210,135,.08) 18px 36px
    ),
    linear-gradient(135deg,#d89a4a,#9b5d24 48%,#5a2e12);
  border:5px solid #6b3514;
  box-shadow:
    0 30px 80px rgba(0,0,0,.58),
    inset 0 0 0 12px rgba(70,32,10,.45),
    inset 0 0 45px rgba(255,231,170,.22);
}

.board-line{
  position:absolute;
  background:rgba(45,20,7,.72);
  border-radius:999px;
  box-shadow:0 1px 0 rgba(255,226,160,.18);
  pointer-events:none;
}

.board-line.h{
  height:5px;
  transform:translateY(-50%);
}

.board-line.v{
  width:5px;
  transform:translateX(-50%);
}

.point{
  position:absolute;
  width:7.2%;
  aspect-ratio:1;
  border-radius:50%;
  border:none;
  transform:translate(-50%,-50%);
  background:
    radial-gradient(circle at 35% 25%,#3b1608,#170702 68%);
  border:2px solid rgba(255,214,135,.5);
  box-shadow:
    inset 0 4px 8px rgba(0,0,0,.65),
    0 2px 5px rgba(255,232,160,.18);
  cursor:pointer;
  display:flex;
  align-items:center;
  justify-content:center;
}

.point.legal{
  box-shadow:
    0 0 0 4px rgba(255,226,143,.85),
    0 0 24px rgba(255,226,143,.65),
    inset 0 4px 8px rgba(0,0,0,.65);
}

.point.selected{
  box-shadow:
    0 0 0 4px rgba(255,255,255,.95),
    0 0 24px rgba(255,255,255,.58),
    inset 0 4px 8px rgba(0,0,0,.65);
}

.piece{
  width:82%;
  aspect-ratio:1;
  border-radius:50%;
  box-shadow:
    inset 0 6px 9px rgba(255,255,255,.25),
    inset 0 -8px 14px rgba(0,0,0,.35),
    0 8px 14px rgba(0,0,0,.38);
}

.piece.player{
  background:radial-gradient(circle at 35% 25%,#6d7480,#11151c 60%,#020203);
  border:1px solid rgba(255,255,255,.5);
}

.piece.ai{
  background:radial-gradient(circle at 35% 25%,#fff,#ded7c7 58%,#968770);
  border:1px solid rgba(0,0,0,.4);
}

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

.status-box{
  width:min(94vw,680px);
  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;
  font-size:1.04rem;
}

.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:720px){
  .top-bar{
    flex-direction:column;
    align-items:flex-start;
  }

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

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

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

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

  .morris-board{
    width:94vw;
    border-radius:22px;
  }

  .point{
    width:8.2%;
  }
}
