@import url("https://fonts.googleapis.com/css2?family=Poppins:wght@300;400;500;600;700;800;900&display=swap");
*{margin:0;padding:0;box-sizing:border-box;font-family:"Poppins",sans-serif}

:root{
  --bg:#0b1220;
  --card:rgba(255,255,255,.06);
  --border:rgba(255,255,255,.12);
  --text:#eaf0ff;
  --muted:rgba(234,240,255,.75);
  --accent:#38bdf8;
  --accent2:#60a5fa;
  --danger:#ff6b6b;
  --ok:#34d399;
  --warn:#fbbf24;
}

body{
  min-height:100vh;
  display:flex;
  align-items:center;
  justify-content:center;
  padding:18px;
  color:var(--text);
  background:
    radial-gradient(1100px 600px at 20% 10%, rgba(56,189,248,.20), transparent 55%),
    radial-gradient(900px 520px at 80% 25%, rgba(96,165,250,.18), transparent 55%),
    var(--bg);
}

.wrapper{
  width:min(900px, 96vw);
  background:var(--card);
  border:1px solid var(--border);
  border-radius:18px;
  padding:22px;
  box-shadow:0 30px 90px rgba(0,0,0,.55);
  position:relative;
  overflow:hidden;
}

.header h1{font-size:24px;font-weight:900;letter-spacing:.2px}
.header p{margin-top:6px;color:var(--muted);font-size:13px}

.top-row{
  margin-top:16px;
  display:grid;
  grid-template-columns: 1.25fr .75fr;
  gap:12px;
}

.controls{
  display:flex;
  flex-wrap:wrap;
  gap:10px;
  align-items:flex-end;
  padding:12px;
  border-radius:14px;
  background:rgba(255,255,255,.04);
  border:1px solid rgba(255,255,255,.10);
}

.control{
  display:flex;
  flex-direction:column;
  gap:6px;
  min-width: 180px;
}

.control label{font-size:12px;color:var(--muted)}

select{
  padding:10px 12px;
  border-radius:12px;
  background:rgba(255,255,255,.06);
  border:1px solid rgba(255,255,255,.12);
  color:var(--text);
  outline:none;
}

.chip{
  border:1px solid rgba(255,255,255,.14);
  background:rgba(255,255,255,.06);
  color:var(--text);
  border-radius:12px;
  padding:10px 12px;
  font-weight:800;
  cursor:pointer;
  transition:transform .18s ease, background .18s ease, box-shadow .18s ease;
}
.chip:hover{transform:translateY(-1px);background:rgba(255,255,255,.10)}
.chip.primary{
  background:linear-gradient(135deg, rgba(56,189,248,.25), rgba(96,165,250,.18));
  border-color:rgba(56,189,248,.25);
}

.side{display:flex;flex-direction:column;gap:12px}

.stats{
  padding:12px;
  border-radius:14px;
  background:rgba(255,255,255,.04);
  border:1px solid rgba(255,255,255,.10);
  display:grid;
  grid-template-columns: 1fr 1fr;
  gap:10px;
}

.stat{
  display:flex;
  align-items:center;
  justify-content:space-between;
  padding:10px 12px;
  border-radius:12px;
  background:rgba(255,255,255,.05);
  border:1px solid rgba(255,255,255,.10);
}

.stat .k{font-size:12px;color:var(--muted)}
.stat .v{font-weight:900;font-size:16px}

.hangman-card{
  padding:12px;
  border-radius:14px;
  background:rgba(255,255,255,.04);
  border:1px solid rgba(255,255,255,.10);
  display:flex;
  align-items:center;
  justify-content:center;
}

.hangman{width:100%;max-width:220px;height:auto}
.frame{stroke:rgba(234,240,255,.65);stroke-width:5;stroke-linecap:round}
.part{
  stroke:var(--danger);
  stroke-width:5;
  stroke-linecap:round;
  fill:none;
  opacity:0;
  transition: opacity .25s ease;
}

.content{margin-top:14px}
.type-input{position:absolute;opacity:0;pointer-events:none}

.word{
  display:flex;
  gap:10px;
  flex-wrap:wrap;
  padding:14px;
  border-radius:14px;
  background:rgba(255,255,255,.04);
  border:1px solid rgba(255,255,255,.10);
  justify-content:center;
}

.letter{
  width:36px;height:46px;border-radius:12px;
  display:flex;align-items:center;justify-content:center;
  background:rgba(255,255,255,.06);
  border:1px solid rgba(255,255,255,.10);
  font-size:18px;font-weight:1000;
}
.letter.empty{color:rgba(234,240,255,.25)}

.info{margin-top:12px}
.info p{font-size:13px;color:var(--muted);margin:8px 0}
.wrong-letters{color:#ffb4b4;font-weight:800}
.hint-text{font-weight:800}

.keyboard{
  margin-top:14px;
  display:grid;
  grid-template-columns: repeat(10, 1fr);
  gap:8px;
}

.key{
  padding:10px 0;
  border-radius:12px;
  border:1px solid rgba(255,255,255,.14);
  background:rgba(255,255,255,.06);
  color:var(--text);
  font-weight:900;
  cursor:pointer;
  user-select:none;
  transition: transform .15s ease, background .15s ease, opacity .15s ease, box-shadow .15s ease;
}

.key:hover{transform:translateY(-1px);background:rgba(255,255,255,.10)}
.key:active{transform:translateY(0px) scale(.98)}

.key.disabled{opacity:.35;cursor:not-allowed}

/* keyboard feedback glow */
.key.good{
  background: rgba(52,211,153,.18);
  border-color: rgba(52,211,153,.35);
  box-shadow: 0 0 0 6px rgba(52,211,153,.08);
}
.key.bad{
  background: rgba(255,107,107,.18);
  border-color: rgba(255,107,107,.35);
  box-shadow: 0 0 0 6px rgba(255,107,107,.08);
}

@media (max-width: 900px){
  .top-row{grid-template-columns:1fr}
  .control{min-width:160px}
  .keyboard{grid-template-columns: repeat(7, 1fr)}
}

/* MODAL */
.modal{
  position:fixed;inset:0;display:none;align-items:center;justify-content:center;
  background:rgba(0,0,0,.55);padding:18px;z-index:999;
}
.modal.show{display:flex}
.modal-card{
  width:min(420px, 92vw);
  border-radius:18px;
  background:#0f172a;
  border:1px solid rgba(255,255,255,.14);
  box-shadow:0 30px 90px rgba(0,0,0,.55);
  padding:18px;
  text-align:center;
}
.modal-title{font-size:20px;font-weight:1000;margin-bottom:6px}
.modal-text{color:rgba(234,240,255,.75);font-size:13px}
.modal-word{
  margin-top:10px;
  font-size:26px;
  font-weight:1000;
  letter-spacing:1px;
  background:linear-gradient(90deg, var(--accent), var(--accent2));
  -webkit-background-clip:text;
  background-clip:text;
  color:transparent;
}
.modal-actions{display:flex;gap:10px;margin-top:16px}
.modal-actions button{
  flex:1;padding:11px 14px;border-radius:12px;
  border:1px solid rgba(255,255,255,.14);
  background:rgba(255,255,255,.06);
  color:var(--text);font-weight:900;cursor:pointer;
  transition:transform .18s ease, background .18s ease;
}
.modal-actions button:hover{transform:translateY(-1px);background:rgba(255,255,255,.10)}
.play-again{
  background:linear-gradient(135deg, rgba(56,189,248,.25), rgba(96,165,250,.18)) !important;
  border-color:rgba(56,189,248,.25) !important;
}

/* CONFETTI */
.confetti{
  position:fixed;inset:0;pointer-events:none;overflow:hidden;z-index:998;
}
.confetti .piece{
  position:absolute;top:-20px;width:10px;height:16px;border-radius:3px;opacity:.95;
  animation: fall linear forwards;
}
@keyframes fall{
  to{transform: translateY(110vh) rotate(720deg);opacity:0.95;}
}
