@import url("https://fonts.googleapis.com/css2?family=Space+Grotesk:wght@400;500;600&display=swap");

:root {
  --bg-dark: #0f172a;
  --bg-panel: #172847;
  --bg-panel-light: #1e3661;
  --accent: #58d6ff;
  --accent-strong: #2de1c2;
  --text-main: #f8fbff;
  --text-muted: #9db3d8;
  --wrong: #ff6b81;
  --shadow: 0 20px 45px rgba(7, 12, 22, 0.55);
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: "Space Grotesk", "Segoe UI", system-ui, -apple-system, sans-serif;
  background: radial-gradient(circle at top, #143089, #050b18 60%);
  color: var(--text-main);
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 2rem 1rem 3rem;
}

.page {
  width: min(1100px, calc(100% - 1rem));
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

.hero {
  text-align: center;
  background: linear-gradient(120deg, rgba(35, 71, 133, 0.8), rgba(18, 31, 51, 0.9));
  border-radius: 18px;
  padding: 2rem clamp(1rem, 3vw, 3rem);
  box-shadow: var(--shadow);
}

.hero h1 {
  font-size: clamp(2.4rem, 4vw, 3.4rem);
  margin: 0 0 0.5rem;
  letter-spacing: -0.03em;
}

.hero p {
  margin: 0;
  color: var(--text-muted);
  font-size: 1rem;
}

.dashboard {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 1rem;
}

.stat {
  background: var(--bg-panel);
  border-radius: 16px;
  padding: 1rem;
  text-align: center;
  border: 1px solid rgba(255, 255, 255, 0.05);
}

.stat .label {
  margin: 0;
  color: var(--text-muted);
  font-size: 0.9rem;
}

.stat .value {
  margin: 0.4rem 0 0;
  font-size: 2rem;
  font-weight: 600;
}

.game-area {
  display: grid;
  grid-template-columns: 0.9fr 1.1fr;
  gap: 1.5rem;
  align-items: stretch;
}

.gallows {
  background: var(--bg-panel);
  border-radius: 20px;
  padding: 1rem;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: var(--shadow);
}

.gallows svg {
  width: 100%;
  max-width: 360px;
  height: auto;
  stroke: var(--text-main);
  stroke-width: 6;
  stroke-linecap: round;
  fill: transparent;
}

.gallows svg .base,
.gallows svg .pole,
.gallows svg .beam,
.gallows svg .rope {
  stroke: rgba(255, 255, 255, 0.6);
}

.gallows svg .part {
  transition: opacity 0.3s ease;
}

.word-panel {
  background: var(--bg-panel-light);
  border-radius: 20px;
  padding: clamp(1.2rem, 3vw, 2rem);
  display: flex;
  flex-direction: column;
  gap: 1rem;
  box-shadow: var(--shadow);
}

.hint-label {
  margin: 0;
  text-transform: uppercase;
  letter-spacing: 0.25em;
  font-size: 0.8rem;
  color: var(--text-muted);
}

.hint-text {
  margin: 0;
  font-size: 1.1rem;
}

.word {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  min-height: 3.5rem;
}

.word span {
  min-width: 2.5rem;
  border-bottom: 4px solid rgba(255, 255, 255, 0.2);
  text-align: center;
  font-size: 2rem;
  padding-bottom: 0.3rem;
}

.wrong-letters {
  background: rgba(0, 0, 0, 0.15);
  border-radius: 14px;
  padding: 0.75rem 1rem;
}

.wrong-letters .label {
  margin: 0 0 0.3rem;
  font-size: 0.85rem;
  color: var(--text-muted);
}

.wrong-letters #wrong {
  margin: 0;
  min-height: 1.2rem;
  color: var(--wrong);
  letter-spacing: 0.15em;
}

.controls {
  display: flex;
  gap: 0.75rem;
  flex-wrap: wrap;
}

button {
  border: none;
  border-radius: 999px;
  padding: 0.85rem 1.8rem;
  font-size: 1rem;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  background: var(--accent);
  color: #002b33;
  transition: transform 0.12s ease, filter 0.2s ease;
}

button:hover:not(:disabled) {
  transform: translateY(-2px);
  filter: brightness(1.08);
}

button:disabled {
  cursor: not-allowed;
  filter: grayscale(0.3);
  opacity: 0.6;
}

.ghost {
  background: transparent;
  border: 1px solid rgba(255, 255, 255, 0.3);
  color: var(--text-main);
}

.keyboard {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(42px, 1fr));
  gap: 0.4rem;
  background: rgba(12, 21, 38, 0.85);
  border-radius: 18px;
  padding: 1rem;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.08);
}

.keyboard button {
  padding: 0.6rem 0;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.08);
  color: var(--text-main);
  border: 1px solid transparent;
}

.keyboard button.correct {
  background: rgba(45, 225, 194, 0.3);
  border-color: rgba(45, 225, 194, 0.6);
}

.keyboard button.wrong {
  background: rgba(255, 107, 129, 0.15);
  border-color: rgba(255, 107, 129, 0.8);
}

.site-footer {
  text-align: center;
  color: var(--text-muted);
  font-size: 0.95rem;
  margin-top: 0.5rem;
  letter-spacing: 0.05em;
}

.hidden {
  opacity: 0;
}

dialog {
  border: none;
  border-radius: 20px;
  padding: 2rem 2.5rem;
  background: #07152f;
  color: var(--text-main);
  box-shadow: var(--shadow);
  text-align: center;
}

dialog::backdrop {
  background: rgba(2, 6, 23, 0.78);
  backdrop-filter: blur(4px);
}

dialog h2 {
  margin-top: 0;
  font-size: 2rem;
}

dialog p {
  margin-bottom: 1.5rem;
  color: var(--text-muted);
}

dialog button {
  min-width: 180px;
}

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

  .gallows {
    order: 2;
  }

  .word-panel {
    order: 1;
  }
}

@media (max-width: 540px) {
  .word span {
    min-width: 2rem;
    font-size: 1.5rem;
  }

  button {
    width: 100%;
    justify-content: center;
  }
}
