/* ===== Hangman — game UI ===== */
html, body { overflow-x: hidden; }
.wrap {
  max-width: 560px;
  margin: 0 auto;
  min-height: 100vh;
  display: flex; flex-direction: column; align-items: center;
  gap: 10px;
  padding: clamp(18px, 5vw, 34px) 14px 40px;
}
.head { width: 100%; display: flex; align-items: baseline; justify-content: space-between; gap: 12px; }
.title { margin: 0; font-size: clamp(24px, 6vw, 30px); letter-spacing: -.02em; }
.meta { display: flex; gap: 14px; font-size: 13.5px; color: var(--gc-text-muted); }
.meta__item b { color: var(--gc-text); font-variant-numeric: tabular-nums; }

.stage { width: min(64vw, 220px); color: var(--gc-text); }
.stage svg { width: 100%; height: auto; display: block; }
.hm-gallows { color: var(--gc-text-muted); opacity: .8; }
.hm-figure { color: var(--gc-accent); }
.hm-part { opacity: 0; transition: opacity .2s ease; }
.hm-part--on { opacity: 1; }

.hint { margin: 2px 0 0; font-size: 13.5px; color: var(--gc-text-muted); }
.hint b { color: var(--gc-text); font-weight: 600; }

.word {
  display: flex; flex-wrap: wrap; gap: 10px; justify-content: center;
  margin: 6px 0;
}
.slot {
  width: 30px; height: 40px;
  display: flex; align-items: center; justify-content: center;
  font-size: 26px; font-weight: 800; text-transform: uppercase;
  color: var(--gc-text);
  border-bottom: 3px solid var(--gc-accent);
}
.slot--space { border-bottom-color: transparent; }
.slot--reveal { animation: slotin .25s ease; }
@keyframes slotin { from { transform: translateY(-6px); opacity: .3; } }
.word--lose .slot { color: #e5484d; border-bottom-color: #e5484d; }

.lives { margin: 0; font-size: 14px; color: var(--gc-text-muted); }
.lives #lives { color: var(--gc-text); font-weight: 700; font-variant-numeric: tabular-nums; }

/* Keyboard */
.kb { width: 100%; max-width: 500px; display: flex; flex-direction: column; gap: 7px; margin-top: 4px; }
.kb__row { display: flex; gap: 6px; justify-content: center; }
.key {
  appearance: none; cursor: pointer; font: inherit;
  flex: 1; max-width: 40px; height: 48px;
  border-radius: 8px; border: 1px solid var(--gc-border);
  background: var(--gc-surface-2); color: var(--gc-text);
  font-size: 16px; font-weight: 700; text-transform: uppercase;
  display: flex; align-items: center; justify-content: center;
  transition: transform .06s ease, background .15s ease, color .15s ease, opacity .15s ease;
}
.key:hover:not(:disabled) { border-color: var(--gc-accent); }
.key:active:not(:disabled) { transform: translateY(1px); }
.key:focus-visible { outline: none; box-shadow: var(--gc-ring); }
.key:disabled { cursor: default; }
.key--hit { background: #12a06e; border-color: #12a06e; color: #fff; }
.key--miss { background: var(--gc-surface); color: var(--gc-text-muted); opacity: .5; }

.actions { width: 100%; max-width: 500px; margin-top: 6px; display: flex; gap: 8px; }
.btn {
  appearance: none; cursor: pointer; font: inherit; font-size: 14px; font-weight: 600;
  padding: 11px 16px; border-radius: 10px; width: auto; flex: 1; white-space: nowrap;
  border: 1px solid var(--gc-border); background: var(--gc-surface); color: var(--gc-text);
  transition: transform .06s ease, border-color .15s ease;
}
.btn:hover { border-color: var(--gc-accent); }
.btn:active { transform: translateY(1px); }
.btn:focus-visible { outline: none; box-shadow: var(--gc-ring); }
.btn--primary { background: var(--gc-accent); border-color: var(--gc-accent); color: var(--gc-on-accent); }

/* Overlay */
.overlay { position: fixed; inset: 0; z-index: 500; display: flex; align-items: center; justify-content: center; background: rgba(6, 12, 20, .55); backdrop-filter: blur(3px); padding: 16px; }
.overlay[hidden] { display: none; }
.overlay__card { width: min(92vw, 360px); text-align: center; padding: 26px 24px; border-radius: 16px; background: var(--gc-surface); border: 1px solid var(--gc-border); box-shadow: var(--gc-shadow-hi); animation: cardpop .3s ease; }
@keyframes cardpop { from { transform: scale(.9); opacity: 0; } }
.overlay__card h2 { margin: 0 0 6px; font-size: 26px; }
.overlay__card p { margin: 0 0 18px; color: var(--gc-text-muted); }
.overlay__actions { display: flex; gap: 10px; justify-content: center; }
.overlay__actions .btn { width: auto; }

/* Rules modal — the full-screen overlay scrolls, never the card itself. */
.rules { position: fixed; inset: 0; z-index: 600; display: flex; padding: 16px; overflow-y: auto; overscroll-behavior: contain; }
.rules[hidden] { display: none; }
.rules__backdrop { position: fixed; inset: 0; background: rgba(6, 12, 20, .55); backdrop-filter: blur(3px); }
.rules__panel { position: relative; z-index: 1; margin: auto; width: min(92vw, 460px); padding: 24px 26px; border-radius: 16px; background: var(--gc-surface); border: 1px solid var(--gc-border); box-shadow: var(--gc-shadow-hi); }
.rules__title { margin: 0 0 12px; font-size: 22px; letter-spacing: -.01em; }
.rules__panel p { margin: 0 0 12px; color: var(--gc-text-muted); font-size: 14px; line-height: 1.55; }
.rules__panel p b { color: var(--gc-text); }
.rules__actions { display: flex; justify-content: center; margin-top: 4px; }
.rules__actions .btn { width: auto; flex: none; }

@media (prefers-reduced-motion: reduce) {
  .hm-part, .slot--reveal, .key, .btn, .overlay__card { transition: none; animation: none; }
}
