:root {
  color-scheme: dark;
  --bg: #111318;
  --panel: #1b1f27;
  --panel-2: #222835;
  --line: #343b49;
  --text: #f4f6f8;
  --muted: #aeb7c4;
  --faint: #747e8d;
  --green: #53a86b;
  --yellow: #c8a64d;
  --gray: #4b5565;
  --red: #e06c68;
  --blue: #69a8d7;
  --key: #d8dde5;
  --key-text: #171b22;
  --shadow: 0 24px 70px rgba(0, 0, 0, 0.28);
}

* {
  box-sizing: border-box;
}

body {
  min-height: 100vh;
  margin: 0;
  background:
    linear-gradient(180deg, rgba(105, 168, 215, 0.12), transparent 340px),
    radial-gradient(circle at top right, rgba(83, 168, 107, 0.16), transparent 320px),
    var(--bg);
  color: var(--text);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

button,
input {
  font: inherit;
}

button {
  cursor: pointer;
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.48;
}

.site-header {
  position: sticky;
  top: 0;
  z-index: 30;
  width: 100%;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(17, 19, 24, 0.94);
  backdrop-filter: blur(10px);
}

.primary-nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  width: min(1120px, calc(100% - 40px));
  min-height: 60px;
  margin: 0 auto;
}

.brand-link,
.nav-links a {
  color: var(--text);
  text-decoration: none;
}

.brand-link {
  flex: 0 0 auto;
  font-size: 1.15rem;
  font-weight: 900;
}

.nav-links {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  flex-wrap: wrap;
  gap: 8px;
}

.nav-links a {
  padding: 8px 10px;
  border-radius: 8px;
  color: var(--muted);
  font-size: 0.96rem;
  font-weight: 800;
}

.nav-links .nav-play {
  min-width: 74px;
  background: var(--key);
  color: var(--key-text);
  text-align: center;
}

.nav-links a:hover,
.nav-links a:focus-visible,
.brand-link:hover,
.brand-link:focus-visible {
  color: var(--text);
}

.nav-links .nav-play:hover,
.nav-links .nav-play:focus-visible {
  background: white;
  color: var(--key-text);
}

.nav-links .nav-active:not(.nav-play) {
  background: rgba(105, 168, 215, 0.14);
  color: #d5ecff;
}

.nav-links .nav-play.nav-active {
  background: white;
  color: var(--key-text);
}

.app-shell {
  width: min(1120px, calc(100% - 32px));
  min-height: 100vh;
  margin: 0 auto;
  padding: 22px 0 36px;
}

.topbar {
  display: flex;
  justify-content: center;
  margin-bottom: 16px;
  text-align: center;
}

.topbar p {
  width: min(680px, 100%);
  margin: 0;
  color: var(--muted);
  font-size: 1rem;
  line-height: 1.5;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  border: 0;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
}

h1 {
  margin: 0;
  max-width: 720px;
  font-size: clamp(2rem, 4vw, 3.25rem);
  line-height: 1.02;
  letter-spacing: 0;
}

.hidden {
  display: none;
}

.board {
  display: flex;
  justify-content: center;
  width: 100%;
}

.game-panel {
  display: flex;
  flex-direction: column;
  gap: 16px;
  width: 100%;
  max-width: 560px;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(27, 31, 39, 0.94);
  box-shadow: var(--shadow);
}

.game-panel > * {
  min-width: 0;
}

.game-head,
.control-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.eyebrow {
  margin: 0 0 4px;
  color: var(--blue);
  font-size: 0.78rem;
  font-weight: 900;
  letter-spacing: 0;
  text-transform: uppercase;
}

.game-title {
  margin: 0;
  font-size: clamp(1.6rem, 4vw, 2.35rem);
  font-weight: 950;
  line-height: 1;
}

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

.stats-row div {
  min-height: 64px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel-2);
}

.stats-row div > span {
  display: block;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 800;
}

.stats-row strong {
  display: block;
  margin-top: 5px;
  color: var(--text);
  font-size: 1.35rem;
}

.status-line {
  min-height: 25px;
  margin: 0;
  color: var(--muted);
  font-weight: 800;
  line-height: 1.45;
  text-align: center;
}

.status-line[data-tone="good"] {
  color: #a7e0b8;
}

.status-line[data-tone="warn"] {
  color: #f1d889;
}

.status-line[data-tone="bad"] {
  color: #f3aaa7;
}

.word-board {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 7px;
  width: 100%;
}

.word-row {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 7px;
  width: 100%;
  max-width: 360px;
}

.word-cell {
  display: grid;
  place-items: center;
  aspect-ratio: 1;
  border: 2px solid var(--line);
  border-radius: 4px;
  background: #141820;
  color: var(--text);
  font-size: clamp(1.35rem, 8vw, 2.05rem);
  font-weight: 950;
  line-height: 1;
  text-transform: uppercase;
}

.word-cell.absent {
  border-color: var(--gray);
  background: var(--gray);
}

.word-cell.present {
  border-color: var(--yellow);
  background: var(--yellow);
  color: #17130a;
}

.word-cell.correct {
  border-color: var(--green);
  background: var(--green);
  color: #07150c;
}

.shake {
  animation: shake 0.36s ease;
}

@keyframes shake {
  0%,
  100% {
    transform: translateX(0);
  }

  20%,
  60% {
    transform: translateX(-7px);
  }

  40%,
  80% {
    transform: translateX(7px);
  }
}

.control-row {
  justify-content: center;
}

.control-row button,
.ghost-button,
.feedback-actions button {
  min-height: 42px;
  border: 0;
  border-radius: 8px;
  font-weight: 900;
}

.control-row button,
.ghost-button {
  padding: 9px 14px;
  background: var(--key);
  color: var(--key-text);
}

.ghost-button {
  min-width: 124px;
  background: transparent;
  color: var(--text);
  box-shadow: inset 0 0 0 1px var(--line);
}

.keyboard {
  display: grid;
  gap: 7px;
  width: 100%;
}

.keyboard-row {
  display: flex;
  justify-content: center;
  gap: 5px;
}

.key {
  display: grid;
  place-items: center;
  min-width: 0;
  width: clamp(27px, 8vw, 43px);
  height: 48px;
  border: 0;
  border-radius: 6px;
  background: var(--key);
  color: var(--key-text);
  font-size: 0.92rem;
  font-weight: 950;
}

.key.wide {
  width: clamp(54px, 15vw, 76px);
  font-size: 0.78rem;
}

.key.absent {
  background: var(--gray);
  color: var(--text);
}

.key.present {
  background: var(--yellow);
  color: #17130a;
}

.key.correct {
  background: var(--green);
  color: #07150c;
}

.key.ready {
  background: #58d98f;
  color: #06140b;
  animation: enter-breathe 1.05s ease-in-out infinite;
}

@keyframes enter-breathe {
  0%,
  100% {
    box-shadow:
      0 0 0 0 rgba(88, 217, 143, 0.18),
      0 0 0 2px rgba(88, 217, 143, 0.45);
    transform: translateY(0);
  }

  50% {
    box-shadow:
      0 0 0 8px rgba(88, 217, 143, 0.18),
      0 0 18px rgba(88, 217, 143, 0.58);
    transform: translateY(-2px);
  }
}

.feedback {
  position: fixed;
  inset: 0;
  z-index: 40;
  display: grid;
  place-items: center;
  padding: 20px;
  background: rgba(7, 9, 12, 0.68);
  backdrop-filter: blur(6px);
}

.feedback.hidden {
  display: none;
}

.feedback-panel {
  width: min(520px, 100%);
  border: 2px solid var(--line);
  border-radius: 8px;
  background: rgba(27, 31, 39, 0.98);
  box-shadow: var(--shadow);
  padding: 24px;
  color: var(--text);
  text-align: center;
}

.feedback.good .feedback-panel {
  border-color: rgba(83, 168, 107, 0.9);
}

.feedback.bad .feedback-panel {
  border-color: rgba(224, 108, 104, 0.9);
}

.feedback-kicker {
  margin: 0 0 8px;
  color: var(--muted);
  font-weight: 900;
}

.feedback.good .feedback-kicker,
.feedback.good .feedback-title {
  color: #a7e0b8;
}

.feedback.bad .feedback-kicker,
.feedback.bad .feedback-title {
  color: #f3aaa7;
}

.feedback-title {
  min-height: 0;
  margin: 0 0 12px;
  font-size: clamp(2rem, 7vw, 3.8rem);
  font-weight: 900;
  line-height: 1.08;
}

.feedback p {
  overflow-wrap: anywhere;
}

.feedback-stats {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  margin: 18px 0;
}

.feedback-stats span {
  display: grid;
  gap: 4px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--muted);
}

.feedback-stats strong {
  color: var(--text);
  font-size: 1.45rem;
}

.feedback-actions {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.feedback-actions button:first-child {
  background: var(--key);
  color: var(--key-text);
}

.feedback-actions button:last-child {
  background: #2d3340;
  color: white;
}

.seo-content,
.content-shell {
  width: min(920px, 100%);
  margin: 42px auto 0;
}

.content-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(27, 31, 39, 0.9);
  box-shadow: var(--shadow);
  padding: 20px;
}

.seo-content h2,
.content-card h1,
.content-card h2 {
  margin: 0 0 12px;
}

.seo-content h3,
.content-card h3 {
  margin: 18px 0 8px;
}

.seo-content p,
.seo-content li,
.content-card p,
.content-card li {
  color: var(--muted);
  line-height: 1.65;
}

.seo-content a,
.content-card a {
  color: #d5ecff;
}

.faq-accordion {
  width: min(1080px, 100%);
  padding: 18px 0 0;
  color: var(--text);
}

.faq-accordion h2 {
  margin: 0 0 18px;
  color: #f4f6f8;
  font-size: clamp(1.8rem, 3vw, 2.4rem);
  line-height: 1.1;
}

.faq-item summary h3 {
  margin: 0;
  color: inherit;
  font-size: 1rem;
  line-height: 1.25;
}

.faq-item {
  border: 1px solid rgba(105, 168, 215, 0.22);
  border-radius: 8px;
  background: rgba(27, 31, 39, 0.92);
  color: var(--text);
  overflow: hidden;
  box-shadow: 0 14px 38px rgba(0, 0, 0, 0.18);
  transition: border-color 0.18s ease, background 0.18s ease, transform 0.18s ease;
}

.faq-item + .faq-item {
  margin-top: 10px;
}

.faq-item:hover {
  border-color: rgba(88, 217, 143, 0.42);
  background: rgba(34, 40, 53, 0.96);
}

.faq-item summary {
  position: relative;
  display: flex;
  align-items: center;
  min-height: 52px;
  padding: 13px 18px 13px 36px;
  color: var(--text);
  font-weight: 900;
  list-style: none;
  outline: 0;
  cursor: pointer;
}

.faq-item summary::-webkit-details-marker {
  display: none;
}

.faq-item summary::before {
  content: "";
  position: absolute;
  left: 17px;
  width: 0;
  height: 0;
  border-top: 6px solid transparent;
  border-bottom: 6px solid transparent;
  border-left: 9px solid #58d98f;
  transition: transform 0.18s ease;
  filter: drop-shadow(0 0 7px rgba(88, 217, 143, 0.45));
}

.faq-item[open] summary::before {
  transform: rotate(90deg);
}

.faq-body {
  padding: 0 36px 18px;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
}

.faq-body h3 {
  margin: 14px 0 8px;
  color: #8fc6ef;
  font-size: 0.9rem;
  font-weight: 900;
  text-transform: uppercase;
}

.faq-body p {
  margin: 10px 0 0;
  color: var(--muted);
  line-height: 1.65;
}

.faq-body a {
  color: #b7e9c8;
  font-weight: 800;
}

.content-cta {
  margin-top: 24px;
}

.content-card .content-cta a {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  padding: 10px 18px;
  border-radius: 8px;
  background: var(--key);
  color: var(--key-text);
  font-weight: 900;
  text-decoration: none;
}

.content-shell {
  padding-bottom: 36px;
  padding-top: 10px;
}

.content-card {
  max-width: 860px;
  margin: 0 auto;
}

.content-card h1 {
  max-width: none;
  font-size: clamp(2rem, 4vw, 3.2rem);
}

.content-meta {
  margin-top: -4px;
  color: var(--muted);
  font-size: 0.92rem;
}

.content-card ul,
.content-card ol {
  padding-left: 1.35rem;
}

@media (max-width: 900px) {
  .primary-nav {
    align-items: center;
    gap: 14px;
    min-height: 64px;
    padding: 8px 0;
  }

  .nav-links {
    flex-wrap: nowrap;
    justify-content: flex-start;
    gap: 8px;
    min-width: 0;
    overflow-x: auto;
    overscroll-behavior-x: contain;
    padding: 4px 0 8px;
    scrollbar-width: none;
  }

  .nav-links::-webkit-scrollbar {
    display: none;
  }

  .nav-links a {
    display: inline-flex;
    align-items: center;
    flex: 0 0 auto;
    min-height: 44px;
  }

  .faq-accordion {
    width: 100%;
  }
}

@media (max-width: 540px) {
  .primary-nav {
    width: min(1120px, calc(100% - 24px));
    gap: 10px;
    min-height: 56px;
    padding: 4px 0;
  }

  .brand-link {
    display: inline-flex;
    align-items: center;
    min-height: 40px;
  }

  .nav-links a {
    min-height: 40px;
    padding: 6px 9px;
    font-size: 0.88rem;
  }

  .app-shell {
    width: min(1120px, calc(100% - 8px));
    padding-top: 8px;
  }

  .topbar {
    margin-bottom: 10px;
  }

  .topbar p {
    font-size: 0.94rem;
    line-height: 1.38;
  }

  .game-panel {
    gap: 9px;
    padding: 10px;
  }

  .game-head {
    align-items: flex-start;
    gap: 8px;
  }

  .eyebrow {
    margin-bottom: 3px;
    font-size: 0.7rem;
  }

  .game-title {
    font-size: clamp(1.45rem, 6vw, 1.85rem);
  }

  .ghost-button {
    min-width: 104px;
    padding: 8px 9px;
    font-size: 0.86rem;
  }

  .stats-row {
    gap: 5px;
  }

  .stats-row div {
    min-height: 52px;
    padding: 7px;
  }

  .stats-row div > span {
    font-size: 0.68rem;
    line-height: 1.16;
  }

  .stats-row strong {
    margin-top: 3px;
    font-size: 1.05rem;
  }

  .status-line {
    min-height: 22px;
    font-size: 0.9rem;
    line-height: 1.3;
  }

  .word-board {
    gap: 5px;
  }

  .word-row {
    gap: 5px;
    max-width: 290px;
  }

  .word-cell {
    border-width: 2px;
    font-size: clamp(1.25rem, 7vw, 1.75rem);
  }

  .control-row {
    gap: 9px;
  }

  .control-row button {
    min-height: 40px;
    padding: 8px 12px;
  }

  .keyboard-row {
    gap: 3px;
  }

  .key {
    width: clamp(26px, 7.6vw, 34px);
    height: 44px;
    font-size: 0.82rem;
  }

  .key.wide {
    width: clamp(52px, 14vw, 62px);
  }

  .feedback-actions,
  .feedback-stats {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 380px) {
  .primary-nav {
    gap: 8px;
  }

  .brand-link {
    font-size: 1.04rem;
  }

  .nav-links a {
    padding-inline: 8px;
  }

  .topbar p {
    font-size: 0.9rem;
  }

  .word-row {
    max-width: 270px;
  }

  .key {
    width: clamp(24px, 7.2vw, 30px);
  }

  .key.wide {
    width: clamp(48px, 14vw, 56px);
  }
}
