*{
  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,#12335c 0%,#07192e 52%,#020712 100%);
  color:white;
}

body{
  min-height:100vh;
}

button,
a,
input{
  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:14px 20px;
  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:24px;
  flex:1;
}

.title-wrap h1{
  font-size:clamp(1.35rem,3vw,2.45rem);
  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:12px;
  padding:14px 20px 0;
}

.hud-card,
.status-box,
.input-card,
.difficulty-card{
  padding:14px;
  border-radius:20px;
  background:linear-gradient(180deg,rgba(255,255,255,.12),rgba(255,255,255,.045));
  border:1px solid rgba(255,255,255,.09);
}

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

.hud-value{
  font-size:1.25rem;
  font-weight:1000;
  letter-spacing:.08em;
}

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

.ladder-panel{
  min-height:560px;
  border-radius:28px;
  padding:18px;
  background:
    radial-gradient(circle at top,rgba(255,255,255,.14),transparent 35%),
    linear-gradient(135deg,#176fb7,#0a3d72 58%,#041a33);
  border:1px solid rgba(255,255,255,.12);
  box-shadow:
    0 28px 70px rgba(0,0,0,.5),
    inset 0 0 0 10px rgba(0,0,0,.16);
}

.ladder-list{
  display:flex;
  flex-direction:column;
  gap:12px;
}

.ladder-word{
  display:flex;
  justify-content:center;
  gap:8px;
  padding:12px;
  border-radius:20px;
  background:rgba(0,0,0,.24);
  border:1px solid rgba(255,255,255,.08);
}

.ladder-letter{
  width:52px;
  height:58px;
  display:flex;
  align-items:center;
  justify-content:center;
  border-radius:14px;
  background:linear-gradient(180deg,#ffffff,#cfe7ff);
  color:#07192e;
  font-size:1.8rem;
  font-weight:1000;
  box-shadow:
    inset 0 5px 8px rgba(255,255,255,.5),
    inset 0 -6px 10px rgba(0,0,0,.18),
    0 8px 14px rgba(0,0,0,.25);
}

.ladder-letter.changed{
  background:linear-gradient(180deg,#fff36d,#ffb52f);
}

.ladder-word.target .ladder-letter{
  background:linear-gradient(180deg,#7effc8,#1fb487);
}

.control-panel{
  display:flex;
  flex-direction:column;
  gap:14px;
}

.status-box{
  line-height:1.5;
  font-weight:900;
}

.input-card{
  display:flex;
  flex-direction:column;
  gap:10px;
}

.input-card label{
  font-size:.85rem;
  text-transform:uppercase;
  letter-spacing:.08em;
  opacity:.75;
  font-weight:1000;
}

.word-input{
  min-height:58px;
  border:none;
  border-radius:18px;
  padding:0 16px;
  background:rgba(255,255,255,.12);
  border:1px solid rgba(255,255,255,.12);
  color:white;
  font-size:1.5rem;
  font-weight:1000;
  letter-spacing:.16em;
  text-transform:uppercase;
}

.action-btn{
  min-height:54px;
  border:none;
  border-radius:18px;
  background:linear-gradient(180deg,#7effc8,#1fb487);
  color:#041a17;
  font-weight:1000;
  font-size:1rem;
  cursor:pointer;
  box-shadow:0 12px 24px rgba(0,0,0,.28);
}

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

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

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

.difficulty-btn{
  min-height:44px;
  border:none;
  border-radius:14px;
  background:linear-gradient(180deg,rgba(255,255,255,.16),rgba(255,255,255,.06));
  color:white;
  font-weight:1000;
  cursor:pointer;
}

.difficulty-btn.active{
  color:#07192e;
  background:linear-gradient(180deg,#fff36d,#ffb52f);
}

.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(126,255,200,.18),transparent 40%),
    #07192e;
  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;
  }

  .ladder-panel,
  .control-panel{
    width:min(94vw,560px);
    margin:0 auto;
  }

  .ladder-panel{
    min-height:360px;
  }
}

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

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

  .top-actions{
    width:100%;
  }

  .top-btn{
    flex:1;
  }

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

  .game-area{
    padding:14px;
  }

  .ladder-letter{
    width:40px;
    height:48px;
    font-size:1.45rem;
  }

  .difficulty-row{
    grid-template-columns:1fr;
  }
}
