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

:root {
  color-scheme: dark;
  font-family: "DM Sans", sans-serif;
  color: #eef2ff;
  background: #10131d;
  font-synthesis: none;
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  --surface: #191e2b;
  --surface-raised: #222939;
  --muted: #929bad;
  --accent: #b7f36b;
  --border: rgba(215, 225, 255, 0.1);
}

* {
  box-sizing: border-box;
}

body {
  min-width: 320px;
  min-height: 100vh;
  margin: 0;
  background:
    radial-gradient(ellipse at 50% 0%, rgba(86, 113, 75, 0.15), transparent 38rem),
    #10131d;
}

button,
input {
  font: inherit;
}

button {
  color: inherit;
}

.site-header {
  width: min(1120px, calc(100% - 48px));
  min-height: 82px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid rgba(215, 225, 255, 0.08);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 11px;
  color: #f5f7fc;
  font-family: "Space Grotesk", sans-serif;
  font-size: 17px;
  font-weight: 500;
  text-decoration: none;
}

.brand strong {
  color: var(--accent);
  font-weight: 600;
}

.brand-mark {
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  border-radius: 11px;
  background: var(--accent);
  color: #171d16;
  font-weight: 700;
}

.header-label,
.eyebrow,
.panel-topline,
.small-label {
  color: var(--muted);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.15em;
}

.new-game-button {
  min-height: 40px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 0 14px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.04);
  color: #e7ebf5;
  cursor: pointer;
  font-size: 12px;
  font-weight: 600;
  transition: background 160ms ease, border-color 160ms ease, transform 160ms ease;
}

.new-game-button span {
  color: var(--accent);
  font-size: 18px;
  line-height: 1;
}

.new-game-button:hover {
  transform: translateY(-1px);
  border-color: rgba(183, 243, 107, 0.45);
  background: rgba(183, 243, 107, 0.08);
}

.page-shell {
  width: min(1000px, calc(100% - 48px));
  margin: 55px auto 72px;
}

.game-card {
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: 22px;
  background: linear-gradient(145deg, rgba(30, 36, 51, 0.98), rgba(23, 28, 40, 0.98));
  box-shadow: 0 28px 80px rgba(0, 0, 0, 0.28);
}

.game-heading {
  min-height: 158px;
  padding: 30px 38px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  border-bottom: 1px solid var(--border);
}

.eyebrow {
  margin: 0 0 9px;
  color: var(--accent);
}

.game-heading h1 {
  margin: 0;
  font-family: "Space Grotesk", sans-serif;
  font-size: clamp(24px, 3.2vw, 34px);
  letter-spacing: -0.045em;
}

.game-heading h1 span {
  color: var(--accent);
}

.game-subtitle {
  margin: 8px 0 0;
  color: var(--muted);
  font-size: 13px;
}

.game-status {
  max-width: 265px;
  margin: 0;
  padding: 11px 14px;
  display: flex;
  align-items: center;
  gap: 9px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.035);
  color: #c4ccda;
  font-size: 11px;
  line-height: 1.4;
}

.status-dot {
  width: 7px;
  height: 7px;
  flex: 0 0 auto;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 12px rgba(183, 243, 107, 0.55);
}

.game-layout {
  padding: 28px;
  display: grid;
  grid-template-columns: minmax(245px, 0.8fr) minmax(0, 1.2fr);
  gap: 26px;
}

.hangman-panel {
  min-height: 470px;
  padding: 19px;
  display: flex;
  flex-direction: column;
  border: 1px solid var(--border);
  border-radius: 16px;
  background:
    radial-gradient(ellipse at 50% 46%, rgba(183, 243, 107, 0.07), transparent 55%),
    #151a25;
}

.panel-topline {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 9px;
}

.round-label {
  padding: 6px 8px;
  border: 1px solid var(--border);
  border-radius: 999px;
  color: #8791a3;
  font-size: 8px;
  letter-spacing: 0.1em;
}

.hangman-panel figure {
  min-height: 300px;
  margin: 12px 0 0;
  display: flex;
  flex: 1;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}

#hangman {
  width: min(100%, 220px);
  max-height: 260px;
  overflow: visible;
  color: var(--accent);
}

#hangman > g:first-of-type {
  color: #697489;
}

#hangman > g:last-of-type {
  color: #ff7b78;
}

#hangman-caption {
  width: 100%;
  margin-top: 6px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  color: var(--muted);
  font-size: 11px;
}

#hangman-caption strong {
  color: #f2f4f8;
  font-family: "Space Grotesk", sans-serif;
  font-size: 15px;
}

.mistakes-divider {
  color: #788295;
  font-weight: 400;
}

.life-indicators {
  display: flex;
  gap: 7px;
}

.life-indicators span {
  height: 4px;
  flex: 1;
  border-radius: 4px;
  background: var(--accent);
  box-shadow: 0 0 8px rgba(183, 243, 107, 0.18);
  transition: background 180ms ease, box-shadow 180ms ease;
}

.life-indicators span.is-lost {
  background: #394152;
  box-shadow: none;
}

.panel-hint {
  margin: 12px 0 0;
  color: #798397;
  font-size: 10px;
  text-align: center;
}

.game-controls {
  min-width: 0;
  padding: 5px 4px;
}

.section-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.section-heading h2,
.wrong-letters-section h2 {
  margin: 0;
  color: #e6eaf2;
  font-size: 13px;
  font-weight: 600;
}

.small-label {
  font-size: 8px;
}

.mode-section {
  padding-bottom: 19px;
  border-bottom: 1px solid var(--border);
}

.mode-selector {
  margin-top: 12px;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 9px;
}

.mode-button {
  min-width: 0;
  min-height: 58px;
  padding: 9px 12px;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  justify-content: center;
  gap: 3px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: rgba(15, 19, 29, 0.56);
  color: #e7ebf5;
  cursor: pointer;
  text-align: left;
  transition: background 160ms ease, border-color 160ms ease;
}

.mode-button strong {
  font-size: 12px;
}

.mode-button span {
  color: var(--muted);
  font-size: 10px;
}

.mode-button:hover {
  border-color: rgba(183, 243, 107, 0.45);
}

.mode-button[aria-pressed="true"] {
  border-color: rgba(183, 243, 107, 0.65);
  background: rgba(183, 243, 107, 0.1);
}

.mode-button[aria-pressed="true"] strong {
  color: var(--accent);
}

.word-pair.is-solo {
  grid-template-columns: minmax(0, 1fr);
}

.word-card[hidden] {
  display: none;
}

.word-section {
  padding-bottom: 22px;
  border-bottom: 1px solid var(--border);
}

.word-pair {
  margin-top: 16px;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.word-card {
  min-width: 0;
  padding: 14px 10px 12px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: rgba(15, 19, 29, 0.56);
}

.word-card h3 {
  margin: 0;
  color: var(--muted);
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-align: center;
  text-transform: uppercase;
}

.word-display {
  min-height: 58px;
  margin: 12px 0 0;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  align-content: center;
  gap: 5px;
  color: var(--accent);
  font-family: "Space Grotesk", sans-serif;
  font-weight: 700;
  text-align: center;
}

.letter-slot {
  width: clamp(16px, 3vw, 23px);
  height: 29px;
  display: grid;
  flex: 0 1 auto;
  place-items: center;
  border-bottom: 2px solid rgba(183, 243, 107, 0.55);
  color: var(--accent);
  font-family: "Space Grotesk", sans-serif;
  font-size: clamp(13px, 2vw, 17px);
  line-height: 1;
}

.letter-slot:not(:empty) {
  border-bottom-color: var(--accent);
}

.guess-form {
  margin: 20px 0 24px;
}

.guess-form label {
  display: block;
  margin-bottom: 9px;
  color: #dce1eb;
  font-size: 11px;
  font-weight: 600;
}

.input-row {
  display: flex;
  gap: 8px;
}

#letter {
  width: 54px;
  height: 43px;
  border: 1px solid var(--border);
  border-radius: 10px;
  outline: none;
  background: #151a25;
  color: var(--accent);
  font-size: 18px;
  font-weight: 700;
  text-align: center;
  text-transform: uppercase;
  transition: border-color 160ms ease, box-shadow 160ms ease;
}

#letter:focus {
  border-color: rgba(183, 243, 107, 0.75);
  box-shadow: 0 0 0 3px rgba(183, 243, 107, 0.12);
}

#letter::placeholder {
  color: #626c7e;
}

.input-row button {
  min-height: 43px;
  padding: 0 15px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  border: 0;
  border-radius: 10px;
  background: var(--accent);
  color: #172012;
  cursor: pointer;
  font-size: 11px;
  font-weight: 700;
  transition: background 160ms ease, transform 160ms ease;
}

.input-row button:hover:not(:disabled) {
  transform: translateY(-1px);
  background: #c8ff83;
}

.input-row button:disabled {
  cursor: not-allowed;
  opacity: 0.5;
}

#letter-hint {
  margin: 7px 0 0;
  color: #7f899b;
  font-size: 10px;
}

.alphabet-section {
  padding: 17px 0 21px;
  border-top: 1px solid var(--border);
}

#letter-buttons {
  margin-top: 13px;
  display: grid;
  grid-template-columns: repeat(7, minmax(30px, 1fr));
  gap: 7px;
}

#letter-buttons button {
  min-width: 0;
  min-height: 35px;
  padding: 0;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #252c3b;
  color: #d9deea;
  cursor: pointer;
  font-size: 11px;
  font-weight: 600;
  transition: border-color 140ms ease, background 140ms ease, color 140ms ease, transform 140ms ease;
}

#letter-buttons button:hover:not(:disabled) {
  transform: translateY(-2px);
  border-color: rgba(183, 243, 107, 0.65);
  background: rgba(183, 243, 107, 0.13);
  color: var(--accent);
}

#letter-buttons button:disabled {
  border-color: transparent;
  background: #1b202c;
  color: #586173;
  cursor: not-allowed;
  opacity: 0.65;
}

#letter-buttons button.is-correct:disabled {
  border-color: rgba(183, 243, 107, 0.24);
  background: rgba(183, 243, 107, 0.12);
  color: var(--accent);
  opacity: 1;
}

#letter-buttons button.is-wrong:disabled {
  border-color: rgba(255, 123, 120, 0.18);
  background: rgba(255, 123, 120, 0.1);
  color: #ff8580;
  opacity: 1;
}

.wrong-letters-section {
  min-height: 54px;
  padding-top: 16px;
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  border-top: 1px solid var(--border);
}

.wrong-letters-section h2 {
  flex: 0 0 auto;
  color: var(--muted);
  font-size: 10px;
}

#wrong-letters {
  margin: 0;
  color: #ff8580;
  font-size: 11px;
  text-align: right;
}

button:focus-visible,
a:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
}

@media (max-width: 700px) {
  .site-header {
    width: min(100% - 32px, 540px);
    min-height: 70px;
  }

  .header-label {
    display: none;
  }

  .page-shell {
    width: min(100% - 32px, 540px);
    margin: 28px auto 44px;
  }

  .game-card {
    border-radius: 17px;
  }

  .game-heading {
    min-height: auto;
    padding: 24px 21px 20px;
    align-items: flex-start;
    flex-direction: column;
    gap: 16px;
  }

  .game-status {
    max-width: none;
  }

  .game-layout {
    padding: 16px;
    grid-template-columns: 1fr;
    gap: 18px;
  }

  .hangman-panel {
    min-height: 330px;
  }

  .hangman-panel figure {
    min-height: 210px;
  }

  .word-pair {
    gap: 8px;
  }

  .word-card {
    padding-right: 7px;
    padding-left: 7px;
  }

  #hangman {
    width: 175px;
    max-height: 190px;
  }
}

@media (max-width: 380px) {
  .brand {
    font-size: 15px;
  }

  .new-game-button {
    padding: 0 10px;
    font-size: 11px;
  }

  .game-heading h1 {
    font-size: 25px;
  }

  .game-subtitle {
    font-size: 12px;
  }

  .word-pair {
    grid-template-columns: 1fr;
  }

  .word-card {
    padding: 12px 10px;
  }

  .letter-slot {
    width: 20px;
  }

  #letter-buttons {
    grid-template-columns: repeat(7, minmax(25px, 1fr));
    gap: 5px;
  }

  #letter-buttons button {
    min-height: 33px;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    transition-duration: 0.01ms !important;
  }
}
