*{
  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,#34185d 0%,#10071f 50%,#040208 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.55rem,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.15rem;
  font-weight:900;
}

.game-area{
  flex:1;
  display:grid;
  grid-template-columns:minmax(320px,1fr) 330px;
  gap:24px;
  padding:24px 24px 100px;
  align-items:start;
}

.board-panel{
  display:flex;
  flex-direction:column;
  align-items:center;
  gap:16px;
}

.secret-code,
.current-guess{
  display:grid;
  grid-template-columns:repeat(4,1fr);
  gap:12px;
  width:min(92vw,420px);
  padding:14px;
  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);
}

.secret-hole,
.guess-hole{
  aspect-ratio:1;
  border-radius:50%;
  display:flex;
  align-items:center;
  justify-content:center;
  font-size:1.25rem;
  font-weight:900;
  background:radial-gradient(circle at 50% 38%,#241136,#0a0412 72%);
  border:2px solid rgba(255,255,255,.16);
  box-shadow:inset 0 7px 15px rgba(0,0,0,.72);
}

.guess-board{
  width:min(92vw,620px);
  display:flex;
  flex-direction:column-reverse;
  gap:10px;
  padding:18px;
  border-radius:30px;
  background:
    radial-gradient(circle at 50% 10%,rgba(255,255,255,.14),transparent 34%),
    linear-gradient(135deg,#4c2382,#201043 58%,#0a0415);
  border:1px solid rgba(255,255,255,.14);
  box-shadow:
    0 30px 80px rgba(0,0,0,.58),
    inset 0 0 0 10px rgba(0,0,0,.16),
    inset 0 0 42px rgba(255,255,255,.08);
}

.guess-row{
  display:grid;
  grid-template-columns:1fr auto;
  gap:12px;
  align-items:center;
}

.guess-pegs{
  display:grid;
  grid-template-columns:repeat(4,1fr);
  gap:8px;
}

.feedback{
  width:72px;
  display:grid;
  grid-template-columns:repeat(2,1fr);
  gap:7px;
}

.feedback-peg{
  aspect-ratio:1;
  border-radius:50%;
  background:rgba(255,255,255,.16);
  border:1px solid rgba(255,255,255,.18);
}

.feedback-peg.black{
  background:#050505;
}

.feedback-peg.white{
  background:#f7f7f7;
}

.control-panel{
  display:flex;
  flex-direction:column;
  gap:16px;
  position:sticky;
  top:106px;
}

.color-picker{
  display:grid;
  grid-template-columns:repeat(3,1fr);
  gap:12px;
  padding:16px;
  border-radius:24px;
  background:linear-gradient(180deg,rgba(255,255,255,.12),rgba(255,255,255,.045));
  border:1px solid rgba(255,255,255,.1);
}

.color-btn,
.color-peg{
  aspect-ratio:1;
  border-radius:50%;
  border:none;
  cursor:pointer;
  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);
}

.color-peg{
  width:100%;
}

.red{background:radial-gradient(circle at 35% 25%,#ffd2d2,#e92828 58%,#710606);}
.blue{background:radial-gradient(circle at 35% 25%,#d7ebff,#1f75ff 58%,#082c70);}
.green{background:radial-gradient(circle at 35% 25%,#d8ffd7,#1eaf47 58%,#08511d);}
.yellow{background:radial-gradient(circle at 35% 25%,#fff0a6,#f0bd23 58%,#7b5000);}
.purple{background:radial-gradient(circle at 35% 25%,#f0d7ff,#9141ff 58%,#3c1178);}
.orange{background:radial-gradient(circle at 35% 25%,#ffe0bf,#ff8f1f 58%,#7a3c00);}

.action-row{
  display:grid;
  grid-template-columns:1fr 1fr;
  gap:12px;
}

.action-btn{
  border:none;
  border-radius:20px;
  padding:16px;
  cursor:pointer;
  font-size:1rem;
  font-weight:900;
  color:#10071f;
  background:linear-gradient(180deg,#ffe28f,#ffb92f);
}

.action-btn.secondary{
  color:white;
  background:linear-gradient(180deg,rgba(255,255,255,.2),rgba(255,255,255,.08));
}

.status-box{
  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(104,42,190,.28),transparent 40%),
    #10071f;
  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:900px){
  .game-area{
    grid-template-columns:1fr;
  }

  .control-panel{
    position:relative;
    top:auto;
  }
}

@media (max-width:680px){
  .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;
  }

  .guess-board{
    padding:12px;
  }

  .feedback{
    width:52px;
  }
}

.game-area{
  grid-template-columns:minmax(320px,1fr) 300px !important;
  gap:16px !important;
  padding:14px 20px 32px !important;
}

.hud{
  padding:10px 20px 0 !important;
}

.top-bar{
  padding:10px 18px !important;
}

.guess-board{
  max-width:520px !important;
  gap:6px !important;
  padding:12px !important;
}

.guess-row{
  gap:8px !important;
}

.secret-code,
.current-guess{
  max-width:340px !important;
  padding:10px !important;
  gap:8px !important;
}

.guess-hole{
  min-width:0 !important;
}

.feedback{
  width:52px !important;
  gap:5px !important;
}

.control-panel{
  gap:10px !important;
}

.color-picker{
  padding:10px !important;
  gap:8px !important;
}

.action-btn{
  padding:12px !important;
}

.status-box{
  padding:12px !important;
  font-size:.92rem !important;
}

@media (max-width:900px){
  .game-area{
    grid-template-columns:1fr !important;
  }

  .control-panel{
    max-width:520px !important;
    width:100% !important;
    margin:0 auto !important;
  }
}


html,
body{
  overflow:hidden !important;
}

.game-shell{
  height:100vh !important;
  overflow:hidden !important;
}

.top-bar{
  padding:8px 14px !important;
}

.title-wrap h1{
  font-size:1.5rem !important;
}

.subtitle{
  font-size:.82rem !important;
  margin-top:2px !important;
}

.hud{
  padding:8px 14px 0 !important;
  gap:8px !important;
}

.hud-card{
  padding:8px 10px !important;
}

.hud-label{
  font-size:.7rem !important;
  margin-bottom:2px !important;
}

.hud-value{
  font-size:.95rem !important;
}

.game-area{
  grid-template-columns:minmax(260px,1fr) 250px !important;
  gap:12px !important;
  padding:10px 14px 14px !important;
  height:calc(100vh - 132px) !important;
  overflow:hidden !important;
  align-items:start !important;
}

.board-panel{
  gap:8px !important;
  overflow:hidden !important;
}

.secret-code,
.current-guess{
  max-width:260px !important;
  gap:6px !important;
  padding:6px !important;
}

.secret-hole,
.guess-hole{
  width:34px !important;
  height:34px !important;
  min-width:34px !important;
  min-height:34px !important;
}

.guess-board{
  width:min(90vw,470px) !important;
  gap:4px !important;
  padding:8px !important;
  border-radius:20px !important;
}

.guess-row{
  gap:6px !important;
}

.guess-pegs{
  gap:5px !important;
}

.feedback{
  width:42px !important;
  gap:3px !important;
}

.feedback-peg{
  width:16px !important;
  height:16px !important;
}

.color-picker{
  padding:8px !important;
  gap:6px !important;
}

.color-btn{
  width:48px !important;
  height:48px !important;
  justify-self:center !important;
}

.control-panel{
  gap:8px !important;
  top:auto !important;
}

.action-row{
  gap:6px !important;
}

.action-btn{
  padding:10px !important;
  font-size:.9rem !important;
}

.status-box{
  padding:10px !important;
  font-size:.84rem !important;
  line-height:1.35 !important;
}

.instructions-modal{
  max-height:84vh !important;
}

@media (max-width:900px){

  html,
  body{
    overflow:auto !important;
  }

  .game-shell{
    height:auto !important;
    overflow:visible !important;
  }

  .game-area{
    grid-template-columns:1fr !important;
    height:auto !important;
    overflow:visible !important;
  }

}

.secret-code,
.current-guess{
  max-width:360px !important;
  gap:10px !important;
  padding:10px !important;
}

.secret-hole,
.guess-hole{
  width:56px !important;
  height:56px !important;
  min-width:56px !important;
  min-height:56px !important;
}

.guess-board{
  width:min(90vw,600px) !important;
  gap:7px !important;
  padding:12px !important;
}

.feedback{
  width:62px !important;
  gap:5px !important;
}

.feedback-peg{
  width:25px !important;
  height:25px !important;
}

.color-btn{
  width:76px !important;
  height:76px !important;
}

.game-area{
  grid-template-columns:minmax(320px,1fr) 320px !important;
  gap:16px !important;
}

.status-box{
  font-size:.95rem !important;
}

@media (max-width:900px){
  html,
  body{
    overflow-x:hidden !important;
    overflow-y:auto !important;
  }

  .game-shell{
    min-height:100vh !important;
    height:auto !important;
    overflow:visible !important;
  }

  .top-bar{
    padding:10px 14px !important;
  }

  .top-left{
    width:100% !important;
    gap:14px !important;
    flex-wrap:wrap !important;
  }

  .title-wrap h1{
    font-size:clamp(1.35rem,5vw,2.1rem) !important;
  }

  .subtitle{
    font-size:.85rem !important;
  }

  .top-actions{
    width:100% !important;
    display:grid !important;
    grid-template-columns:1fr 1fr !important;
    gap:10px !important;
  }

  .top-btn{
    width:100% !important;
    min-height:44px !important;
    padding:10px 12px !important;
    font-size:.95rem !important;
  }

  .hud{
    grid-template-columns:repeat(3,1fr) !important;
    padding:10px 14px 0 !important;
    gap:8px !important;
  }

  .hud-card{
    padding:9px !important;
  }

  .hud-label{
    font-size:.65rem !important;
  }

  .hud-value{
    font-size:.9rem !important;
  }

  .game-area{
    display:flex !important;
    flex-direction:column !important;
    align-items:center !important;
    gap:12px !important;
    padding:12px 12px 80px !important;
  }

  .board-panel{
    width:100% !important;
    gap:10px !important;
  }

  .secret-code{
    width:min(92vw,380px) !important;
    max-width:380px !important;
  }

  .guess-board{
    width:min(94vw,620px) !important;
    max-width:620px !important;
  }

  .control-panel{
    width:min(94vw,620px) !important;
    max-width:620px !important;
    position:relative !important;
    top:auto !important;
  }

  .current-guess{
    width:min(92vw,380px) !important;
    max-width:380px !important;
    margin:0 auto !important;
  }

  .color-picker{
    grid-template-columns:repeat(6,1fr) !important;
    width:100% !important;
  }

  .color-btn{
    width:clamp(42px,11vw,70px) !important;
    height:clamp(42px,11vw,70px) !important;
  }

  .action-row{
    grid-template-columns:1fr 1fr !important;
  }

  .status-box{
    font-size:.9rem !important;
  }
}

@media (max-width:520px){
  .hud{
    grid-template-columns:1fr !important;
  }

  .secret-hole,
  .guess-hole{
    width:clamp(38px,11vw,52px) !important;
    height:clamp(38px,11vw,52px) !important;
    min-width:clamp(38px,11vw,52px) !important;
    min-height:clamp(38px,11vw,52px) !important;
  }

  .guess-board{
    gap:5px !important;
    padding:8px !important;
  }

  .guess-row{
    gap:5px !important;
  }

  .guess-pegs{
    gap:4px !important;
  }

  .feedback{
    width:46px !important;
    gap:4px !important;
  }

  .feedback-peg{
    width:18px !important;
    height:18px !important;
  }

  .color-picker{
    grid-template-columns:repeat(3,1fr) !important;
  }

  .color-btn{
    width:clamp(56px,18vw,76px) !important;
    height:clamp(56px,18vw,76px) !important;
  }
}
