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

html,
body{
  width:100%;
  min-height:100%;
  overflow-x:hidden;
  background:
    radial-gradient(circle at top,#243b2d 0%,#0e1712 52%,#030504 100%);
  color:white;
}

body,
button,
a{
  font-family:"Space Grotesk",sans-serif;
}

.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,.36);
  border-bottom:1px solid rgba(255,255,255,.08);
  backdrop-filter:blur(14px);
  position:sticky;
  top:0;
  z-index:100;
}

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

.title-wrap h1{
  font-size:clamp(1.35rem,3vw,2.55rem);
  letter-spacing:.12em;
}

.subtitle{
  opacity:.72;
  margin-top:5px;
}

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

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

.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,.11),rgba(255,255,255,.045));
  border:1px solid rgba(255,255,255,.08);
}

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

.hud-value{
  font-size:1.15rem;
  font-weight:1000;
}

.game-area{
  flex:1;
  display:grid;
  grid-template-columns:minmax(320px,760px) minmax(280px,420px);
  justify-content:center;
  align-items:start;
  gap:22px;
  padding:22px;
}

.chalkboard{
  position:relative;
  min-height:640px;
  border-radius:28px;
  padding:24px;
  overflow:hidden;
  background:
    radial-gradient(circle at 30% 20%,rgba(255,255,255,.07),transparent 34%),
    linear-gradient(135deg,#1f4f3a,#123528 55%,#092016);
  border:14px solid #8b5a2b;
  box-shadow:
    0 28px 80px rgba(0,0,0,.5),
    inset 0 0 0 4px rgba(255,255,255,.05),
    inset 0 0 80px rgba(0,0,0,.35);
}

.chalk-dust{
  position:absolute;
  inset:0;
  pointer-events:none;
  opacity:.13;
  background:
    radial-gradient(circle at 15% 20%,#fff 0 1px,transparent 2px),
    radial-gradient(circle at 65% 44%,#fff 0 1px,transparent 2px),
    radial-gradient(circle at 35% 78%,#fff 0 1px,transparent 2px),
    radial-gradient(circle at 82% 20%,#fff 0 1px,transparent 2px);
  background-size:90px 90px,130px 130px,110px 110px,150px 150px;
}

.drawing-zone{
  display:flex;
  justify-content:center;
  align-items:center;
}

.hangman-svg{
  width:min(100%,420px);
  height:auto;
  filter:drop-shadow(0 0 2px rgba(255,255,255,.45));
}

.chalk-line{
  fill:none;
  stroke:#f6f2df;
  stroke-width:7;
  stroke-linecap:round;
  stroke-linejoin:round;
  opacity:.9;
}

.gallows{
  stroke-dasharray:8 5;
  opacity:.72;
}

.hidden-part{
  display:none;
}

.word-display{
  margin-top:20px;
  min-height:92px;
  display:flex;
  flex-wrap:wrap;
  justify-content:center;
  align-items:center;
  gap:12px;
  font-family:"Schoolbell",cursive;
}

.word-letter{
  min-width:44px;
  height:62px;
  display:flex;
  align-items:center;
  justify-content:center;
  border-bottom:5px solid rgba(255,255,255,.82);
  font-size:2.65rem;
  color:#f8f4df;
  text-shadow:0 0 4px rgba(255,255,255,.35);
}

.message-text{
  margin-top:18px;
  text-align:center;
  font-family:"Schoolbell",cursive;
  color:#f8f4df;
  font-size:1.65rem;
  line-height:1.35;
}

.keyboard-panel{
  display:flex;
  flex-direction:column;
  gap:16px;
}

.keyboard{
  display:grid;
  grid-template-columns:repeat(4,1fr);
  gap:10px;
  padding:18px;
  border-radius:24px;
  background:linear-gradient(180deg,rgba(255,255,255,.11),rgba(255,255,255,.045));
  border:1px solid rgba(255,255,255,.08);
}

.key{
  min-height:58px;
  border:none;
  border-radius:16px;
  cursor:pointer;
  color:#f8f4df;
  background:
    linear-gradient(180deg,rgba(255,255,255,.13),rgba(255,255,255,.04));
  border:1px solid rgba(255,255,255,.1);
  font-family:"Schoolbell",cursive;
  font-size:2rem;
  font-weight:900;
  box-shadow:0 10px 18px rgba(0,0,0,.24);
}

.key.correct{
  background:linear-gradient(180deg,rgba(132,255,183,.36),rgba(132,255,183,.13));
}

.key.wrong{
  opacity:.38;
  text-decoration:line-through;
}

.key:disabled{
  cursor:not-allowed;
}

.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,820px);
  max-height:86vh;
  overflow:auto;
  border-radius:28px;
  background:
    radial-gradient(circle at top,rgba(246,242,223,.16),transparent 40%),
    #0c2118;
  border:1px solid rgba(255,255,255,.12);
  padding:28px;
  position:relative;
}

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

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

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

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

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

  .chalkboard,
  .keyboard-panel{
    width:min(94vw,760px);
    margin:0 auto;
  }

  .chalkboard{
    min-height:auto;
  }

  .keyboard{
    grid-template-columns:repeat(7,1fr);
  }
}

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

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

  .top-actions{
    width:100%;
  }

  .top-btn{
    flex:1;
  }

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

  .game-area{
    padding:14px;
  }

  .chalkboard{
    border-width:9px;
    padding:16px;
    border-radius:22px;
  }

  .word-letter{
    min-width:30px;
    height:48px;
    font-size:2rem;
  }

  .message-text{
    font-size:1.35rem;
  }

  .keyboard{
    grid-template-columns:repeat(6,1fr);
    gap:7px;
    padding:12px;
  }

  .key{
    min-height:46px;
    border-radius:12px;
    font-size:1.55rem;
  }
}

.difficulty-panel{
  padding:16px;
  border-radius:22px;
  background:linear-gradient(180deg,rgba(255,255,255,.11),rgba(255,255,255,.045));
  border:1px solid rgba(255,255,255,.08);
}

.difficulty-label{
  margin-bottom:12px;
  font-size:.85rem;
  text-transform:uppercase;
  letter-spacing:.08em;
  opacity:.75;
  font-weight:1000;
}

.difficulty-row{
  display:grid;
  grid-template-columns:repeat(2,1fr);
  gap:10px;
}

.difficulty-btn{
  min-height:46px;
  border:none;
  border-radius:16px;
  cursor:pointer;
  color:#f8f4df;
  background:linear-gradient(180deg,rgba(255,255,255,.13),rgba(255,255,255,.04));
  border:1px solid rgba(255,255,255,.1);
  font-weight:1000;
}

.difficulty-btn.active{
  color:#102017;
  background:linear-gradient(180deg,#f8f4df,#c9b977);
}

.game-area{
  grid-template-columns:minmax(320px,620px) minmax(260px,360px) !important;
  gap:16px !important;
  padding:14px 18px 24px !important;
  align-items:start !important;
}

.chalkboard{
  min-height:auto !important;
  padding:16px !important;
  border-width:10px !important;
}

.hangman-svg{
  width:min(100%,300px) !important;
}

.word-display{
  margin-top:10px !important;
  min-height:58px !important;
  gap:8px !important;
}

.word-letter{
  min-width:32px !important;
  height:44px !important;
  font-size:2rem !important;
  border-bottom-width:4px !important;
}

.message-text{
  margin-top:8px !important;
  font-size:1.25rem !important;
}

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

.difficulty-panel{
  padding:10px !important;
}

.difficulty-label{
  margin-bottom:8px !important;
}

.difficulty-row{
  gap:7px !important;
}

.difficulty-btn{
  min-height:38px !important;
}

.keyboard{
  grid-template-columns:repeat(4,1fr) !important;
  gap:7px !important;
  padding:12px !important;
}

.key{
  min-height:43px !important;
  border-radius:12px !important;
  font-size:1.45rem !important;
}

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

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

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

.title-wrap h1{
  font-size:clamp(1.25rem,2.4vw,2rem) !important;
}

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

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

  .keyboard{
    grid-template-columns:repeat(7,1fr) !important;
  }
}

@media (max-width:720px){
  .keyboard{
    grid-template-columns:repeat(6,1fr) !important;
  }

  .key{
    min-height:42px !important;
    font-size:1.35rem !important;
  }
}
