:root {
  --bg-a: #f5f0e6;
  --bg-b: #d5e7ee;
  --card: #fffdf8;
  --ink: #1f2a30;
  --muted: #5a6a73;
  --accent: #ef6c2f;
  --accent-2: #0c8f80;
  --danger: #bd2e22;
  --ring: #dae7ec;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  height: 100vh;
  font-family: system-ui, -apple-system, sans-serif;
  color: var(--ink);
  background: var(--bg-a);
  display: grid;
  place-items: center;
  padding: 0.5rem;
  overflow: hidden;
}

.app-shell {
  width: min(980px, 100%);
  max-height: calc(100vh - 1rem);
}

.card {
  background: var(--card);
  border: 2px solid #f1dfc8;
  border-radius: 1.25rem;
  box-shadow: 0 20px 45px rgba(31, 42, 48, 0.12);
  padding: 1rem;
  max-height: 100%;
}

.hidden {
  display: none !important;
}

h1,
h2 {
  margin: 0;
  letter-spacing: 0.5px;
}

.intro-card {
  text-align: center;
}

.intro-text {
  max-width: 540px;
  margin: 0.7rem auto 1.5rem;
  color: var(--muted);
}

.difficulty-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.75rem;
}

.difficulty-btn,
.secondary-btn {
  border: 0;
  border-radius: 0.9rem;
  cursor: pointer;
}

.difficulty-btn {
  background: #fff7ea;
  color: var(--ink);
  padding: 1rem;
  text-align: left;
  border: 2px solid #f3ceb5;
  transition: transform 120ms ease, box-shadow 120ms ease;
}

.difficulty-btn:hover,
.difficulty-btn:focus-visible {
  transform: translateY(-2px);
  box-shadow: 0 8px 20px rgba(239, 108, 47, 0.24);
}

.difficulty-btn:focus-visible {
  outline: 2px solid var(--color-primary, #2563EB);
  outline-offset: 2px;
}

.difficulty-btn .title {
  display: block;
  font-weight: 800;
}

.difficulty-btn .subtitle {
  font-size: 0.88rem;
  color: var(--muted);
}

.game-card {
  display: grid;
  gap: 1rem;
}

.hud {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 0.7rem;
}

.hud > div {
  background: #f7f3ec;
  border: 1px solid #eadbc6;
  border-radius: 0.75rem;
  padding: 0.65rem 0.8rem;
}

.label {
  margin: 0;
  color: var(--muted);
  font-size: 0.82rem;
  text-transform: uppercase;
  letter-spacing: 0.4px;
}

.value {
  margin: 0.15rem 0 0;
  font-weight: 800;
}

.play-area {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.8rem;
  align-items: center;
}

.circle-board {
  width: min(340px, 100%);
  aspect-ratio: 1 / 1;
  margin: 0 auto;
  border: 2px dashed var(--ring);
  border-radius: 50%;
  position: relative;
  touch-action: none;
  user-select: none;
  background: #fffdf8;
}

.danger {
  color: var(--danger);
}

.letter-node {
  position: absolute;
  width: 54px;
  height: 54px;
  border-radius: 50%;
  border: 2px solid #c7d8de;
  background: #f5fbfd;
  color: #103f46;
  display: grid;
  place-items: center;
  font-weight: 800;
  transform: translate(-50%, -50%);
  transition: background 120ms ease, border-color 120ms ease, transform 120ms ease;
}

.letter-node.active {
  background: #dff4ef;
  border-color: var(--accent-2);
  transform: translate(-50%, -50%) scale(1.05);
}

.letter-node:focus-visible {
  outline: 2px solid var(--color-primary, #2563EB);
  outline-offset: 2px;
}

.status-area {
  background: #f7f3ec;
  border: 1px solid #eadbc6;
  border-radius: 0.9rem;
  padding: 0.9rem;
}

.guess-label {
  min-height: 2rem;
  font-weight: 800;
  font-size: 1.1rem;
  letter-spacing: 2px;
  margin: 0.2rem 0 0.7rem;
}

.status-label {
  margin: 0;
  color: var(--muted);
}

.status-label.success {
  color: var(--accent-2);
  font-weight: 700;
}

.status-label.error {
  color: var(--danger);
  font-weight: 700;
}

.actions {
  display: flex;
  gap: 0.6rem;
  justify-content: flex-end;
  flex-wrap: wrap;
}

.secondary-btn {
  background: #edf3f5;
  border: 1px solid #c7d8de;
  color: #0f4d57;
  padding: 0.65rem 0.95rem;
  font-weight: 700;
  min-height: 44px;
}

.secondary-btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.secondary-btn:focus-visible {
  outline: 2px solid var(--color-primary, #2563EB);
  outline-offset: 2px;
}

.win-card {
  text-align: center;
}

.difficulty-btn.single {
  text-align: center;
}

@media (max-width: 760px) {
  .difficulty-grid {
    grid-template-columns: 1fr;
  }

  .hud {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .play-area {
    grid-template-columns: 1fr;
  }

  .circle-board {
    width: min(290px, 100%);
  }

  .actions {
    justify-content: stretch;
    flex-direction: column;
  }
}

@media (max-height: 720px) {
  body {
    overflow: auto;
  }

  .card {
    overflow: auto;
  }

  .circle-board {
    width: min(270px, 100%);
  }
}
