*{
  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,#123a6b 0%,#071321 50%,#02060b 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.45rem,3vw,2.65rem);
  letter-spacing:.12em;
}

.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.2rem;
  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;
}

.connect-board{
  width:min(92vw,720px);
  aspect-ratio:7 / 6;
  display:grid;
  grid-template-columns:repeat(7,1fr);
  grid-template-rows:repeat(6,1fr);
  gap:10px;
  padding:18px;
  border-radius:32px;
  background:
    radial-gradient(circle at 50% 10%,rgba(255,255,255,.18),transparent 34%),
    linear-gradient(180deg,#1268d8,#063b8f);
  border:4px solid rgba(129,190,255,.55);
  box-shadow:
    0 30px 80px rgba(0,0,0,.58),
    inset 0 0 0 12px rgba(0,0,0,.18),
    inset 0 0 45px rgba(255,255,255,.14);
}

.slot{
  position:relative;
  border:none;
  border-radius:50%;
  background:
    radial-gradient(circle at 50% 45%,#031b43 0 54%,#031125 56% 100%);
  box-shadow:
    inset 0 7px 16px rgba(0,0,0,.85),
    0 2px 4px rgba(255,255,255,.13);
  cursor:pointer;
  overflow:hidden;
}

.slot.preview{
  box-shadow:
    inset 0 7px 16px rgba(0,0,0,.85),
    0 0 0 4px rgba(255,232,128,.75),
    0 0 20px rgba(255,232,128,.45);
}

.chip{
  position:absolute;
  inset:7%;
  border-radius:50%;
  animation:dropIn .22s ease both;
  box-shadow:
    inset 0 7px 10px rgba(255,255,255,.28),
    inset 0 -9px 15px rgba(0,0,0,.35),
    0 8px 13px rgba(0,0,0,.35);
}

.chip.player{
  background:radial-gradient(circle at 35% 25%,#ffd2d2,#e92828 58%,#710606);
}

.chip.ai{
  background:radial-gradient(circle at 35% 25%,#fff0a6,#f0bd23 58%,#7b5000);
}

.slot.win{
  box-shadow:
    inset 0 7px 16px rgba(0,0,0,.85),
    0 0 0 5px rgba(83,255,161,.92),
    0 0 28px rgba(83,255,161,.65);
}

@keyframes dropIn{
  from{
    transform:translateY(-140%) scale(.9);
    opacity:.5;
  }
  to{
    transform:translateY(0) scale(1);
    opacity:1;
  }
}

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

.status-box{
  width:min(92vw,720px);
  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(28,106,216,.28),transparent 40%),
    #071321;
  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.05rem;
}

.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;
  }

  .connect-board{
    width:94vw;
    gap:6px;
    padding:10px;
    border-radius:22px;
  }
}
