:root {
  color-scheme: dark;
  --bg: #080b16;
  --panel: rgba(17, 24, 45, 0.78);
  --panel-strong: rgba(24, 34, 62, 0.92);
  --text: #f6f8ff;
  --muted: #99a5c8;
  --cyan: #5ee7ff;
  --violet: #a78bfa;
  --pink: #ff5f9e;
  --green: #58f5a5;
  --amber: #ffd166;
  --danger: #ff4d6d;
  --shadow: 0 30px 90px rgba(0, 0, 0, 0.45);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  min-height: 100vh;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background:
    radial-gradient(circle at 20% 12%, rgba(94, 231, 255, 0.22), transparent 28%),
    radial-gradient(circle at 80% 2%, rgba(255, 95, 158, 0.16), transparent 32%),
    linear-gradient(135deg, #080b16 0%, #10142a 54%, #070815 100%);
  color: var(--text);
  overflow-x: hidden;
}

button, select { font: inherit; }

.app-shell {
  width: min(1220px, calc(100% - 32px));
  min-height: 100vh;
  margin: 0 auto;
  display: grid;
  grid-template-columns: 0.82fr 1.18fr;
  gap: 24px;
  align-items: center;
  padding: 28px 0;
}

.hero-panel, .game-panel {
  position: relative;
  border: 1px solid rgba(255, 255, 255, 0.11);
  background: var(--panel);
  backdrop-filter: blur(26px);
  box-shadow: var(--shadow);
  border-radius: 34px;
  overflow: hidden;
}

.hero-panel { padding: 34px; min-height: 720px; }
.game-panel { padding: 28px; }

.orb {
  position: absolute;
  border-radius: 999px;
  filter: blur(12px);
  opacity: 0.75;
  animation: float 8s ease-in-out infinite;
}
.orb-one { width: 190px; height: 190px; background: rgba(94, 231, 255, 0.23); right: -70px; top: 60px; }
.orb-two { width: 250px; height: 250px; background: rgba(167, 139, 250, 0.18); left: -90px; bottom: 20px; animation-delay: -3s; }

.brand-row { position: relative; display: flex; align-items: center; gap: 18px; }
.logo-mark {
  width: 64px; height: 64px; display: grid; place-items: center;
  border-radius: 20px;
  background: linear-gradient(135deg, var(--cyan), var(--violet));
  color: #08101f; font-weight: 950; font-size: 2rem;
  box-shadow: 0 18px 50px rgba(94, 231, 255, 0.28);
}
.eyebrow { margin: 0 0 6px; letter-spacing: 0.16em; text-transform: uppercase; color: var(--cyan); font-size: 0.72rem; font-weight: 800; }
h1 { margin: 0; font-size: clamp(2.55rem, 6vw, 5.5rem); line-height: 0.92; letter-spacing: -0.07em; }
h2 { margin: 0; font-size: clamp(1.45rem, 3vw, 2.4rem); letter-spacing: -0.045em; }
.subtitle { position: relative; color: var(--muted); font-size: 1.07rem; line-height: 1.75; margin: 34px 0; max-width: 38ch; }

.stats-grid { position: relative; display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; margin: 34px 0; }
.stats-grid div {
  padding: 18px 14px;
  border-radius: 20px;
  background: rgba(255,255,255,0.06);
  border: 1px solid rgba(255,255,255,0.1);
}
.stats-grid span { display: block; font-size: 1.8rem; font-weight: 900; }
.stats-grid small { color: var(--muted); }

.controls-card {
  position: relative;
  display: grid;
  gap: 12px;
  margin-top: 42px;
  padding: 20px;
  border-radius: 24px;
  background: rgba(3, 7, 18, 0.42);
  border: 1px solid rgba(255,255,255,0.1);
}
label { color: var(--muted); font-size: 0.78rem; text-transform: uppercase; letter-spacing: 0.12em; font-weight: 800; }
select {
  width: 100%; color: var(--text); background: rgba(255,255,255,0.08); border: 1px solid rgba(255,255,255,0.12);
  border-radius: 16px; padding: 13px 14px; outline: none;
}

.primary-btn, .ghost-btn {
  cursor: pointer;
  border: 0;
  border-radius: 16px;
  padding: 14px 18px;
  font-weight: 900;
  transition: transform 0.2s ease, box-shadow 0.2s ease, background 0.2s ease;
}
.primary-btn { color: #07101e; background: linear-gradient(135deg, var(--cyan), var(--green)); box-shadow: 0 16px 38px rgba(94, 231, 255, 0.25); }
.ghost-btn { color: var(--text); background: rgba(255,255,255,0.08); border: 1px solid rgba(255,255,255,0.12); }
button:hover:not(:disabled) { transform: translateY(-2px); box-shadow: 0 18px 40px rgba(0,0,0,0.28); }
button:disabled { cursor: not-allowed; opacity: 0.42; }

.top-bar, .meta-row, .action-row { display: flex; align-items: center; justify-content: space-between; gap: 14px; }
.score-pill { padding: 13px 16px; border-radius: 999px; background: rgba(94, 231, 255, 0.12); border: 1px solid rgba(94, 231, 255, 0.22); color: var(--cyan); font-weight: 900; }

.play-zone { display: grid; grid-template-columns: 300px 1fr; gap: 20px; margin: 24px 0; }
.gallows-card, .word-card {
  border-radius: 26px;
  background: var(--panel-strong);
  border: 1px solid rgba(255,255,255,0.1);
  padding: 20px;
}
.hangman-svg { width: 100%; filter: drop-shadow(0 22px 30px rgba(0,0,0,0.25)); }
.beam { stroke: rgba(246,248,255,0.55); stroke-width: 10; stroke-linecap: round; }
.body-part { opacity: 0; stroke: var(--danger); stroke-width: 9; fill: none; stroke-linecap: round; transform-origin: center; transition: opacity 0.28s ease, transform 0.28s ease; }
.body-part.visible { opacity: 1; animation: drawIn 0.32s ease both; }
.danger-meter { height: 10px; border-radius: 999px; background: rgba(255,255,255,0.08); overflow: hidden; }
.danger-meter span { display: block; height: 100%; width: 0%; background: linear-gradient(90deg, var(--green), var(--amber), var(--danger)); transition: width 0.35s ease; }
#livesText { color: var(--muted); text-align: center; margin-bottom: 0; }

.word-card { display: flex; flex-direction: column; justify-content: center; gap: 24px; }
.hint-box { padding: 18px; border-radius: 20px; background: rgba(255,255,255,0.06); border: 1px solid rgba(255,255,255,0.1); }
.hint-box span { color: var(--pink); font-size: 0.75rem; letter-spacing: 0.14em; text-transform: uppercase; font-weight: 900; }
.hint-box p { margin: 8px 0 0; color: #dbe4ff; line-height: 1.55; }
.word-display { display: flex; flex-wrap: wrap; gap: 10px; justify-content: center; }
.letter-slot {
  min-width: 44px; height: 58px; display: grid; place-items: center;
  border-radius: 14px;
  background: rgba(255,255,255,0.07);
  border: 1px solid rgba(255,255,255,0.12);
  border-bottom: 3px solid rgba(94, 231, 255, 0.8);
  font-size: 1.5rem; font-weight: 950;
  transition: transform 0.25s ease, background 0.25s ease;
}
.letter-slot.revealed { background: rgba(88, 245, 165, 0.12); transform: translateY(-3px); }
.letter-slot.space { min-width: 18px; background: transparent; border: 0; }
.meta-row span { color: var(--muted); padding: 8px 11px; border-radius: 999px; background: rgba(255,255,255,0.06); font-size: 0.82rem; }

.keyboard { display: grid; grid-template-columns: repeat(13, 1fr); gap: 9px; }
.key {
  min-height: 48px;
  color: var(--text);
  background: rgba(255,255,255,0.08);
  border: 1px solid rgba(255,255,255,0.11);
  border-radius: 14px;
  font-weight: 950;
  cursor: pointer;
  transition: all 0.18s ease;
}
.key.correct { background: rgba(88, 245, 165, 0.18); border-color: rgba(88,245,165,0.4); color: var(--green); }
.key.wrong { background: rgba(255, 77, 109, 0.16); border-color: rgba(255,77,109,0.42); color: var(--danger); }
.action-row { justify-content: center; margin-top: 18px; }
.message { margin-top: 18px; min-height: 32px; color: #dbe4ff; text-align: center; font-weight: 700; }

.modal { position: fixed; inset: 0; display: grid; place-items: center; background: rgba(2, 6, 23, 0.74); backdrop-filter: blur(14px); padding: 20px; }
.modal.hidden { display: none; }
.modal-card { width: min(440px, 100%); padding: 30px; border-radius: 30px; text-align: center; background: linear-gradient(145deg, rgba(18,25,48,0.98), rgba(32,36,76,0.98)); border: 1px solid rgba(255,255,255,0.14); box-shadow: var(--shadow); animation: pop 0.28s ease both; }
.modal-card p:not(.eyebrow) { color: var(--muted); line-height: 1.6; }

@keyframes float { 0%,100% { transform: translate3d(0,0,0); } 50% { transform: translate3d(14px,-18px,0); } }
@keyframes drawIn { from { transform: scale(0.82); } to { transform: scale(1); } }
@keyframes pop { from { transform: scale(0.94); opacity: 0; } to { transform: scale(1); opacity: 1; } }

@media (max-width: 980px) {
  .app-shell { grid-template-columns: 1fr; }
  .hero-panel { min-height: auto; }
}
@media (max-width: 720px) {
  .play-zone { grid-template-columns: 1fr; }
  .keyboard { grid-template-columns: repeat(7, 1fr); }
  .top-bar, .meta-row { align-items: flex-start; flex-direction: column; }
  .letter-slot { min-width: 34px; height: 48px; }
}
