/* =========================================================
   Hangman — tool-specific styles.
   Layered on /tools/_shared/tool.css.
   ========================================================= */

/* ---------- Setup form ---------- */
.hm-setup {
  display: flex;
  flex-direction: column;
  gap: var(--space-5);
}

.hm-field {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}
.hm-field-header {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: var(--space-3);
}
.hm-field label,
.hm-field > label {
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
  letter-spacing: 0.01em;
}
.hm-status {
  font-size: 12px;
  color: var(--text-muted);
  font-variant-numeric: tabular-nums;
}

.hm-field textarea {
  width: 100%;
  font: inherit;
  font-size: 14px;
  line-height: 1.55;
  padding: var(--space-3) var(--space-4);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text);
  resize: vertical;
  min-height: 140px;
  transition: var(--transition-colors);
}
.hm-field textarea:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-ring);
}

.hm-field select {
  width: 100%;
  font: inherit;
  font-size: 14px;
  padding: var(--space-3) var(--space-4);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text);
  appearance: none;
  -webkit-appearance: none;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%2371717A' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'><polyline points='6 9 12 15 18 9'/></svg>");
  background-repeat: no-repeat;
  background-position: right 12px center;
  background-size: 16px;
  padding-right: 36px;
  cursor: pointer;
  transition: var(--transition-colors);
}
.hm-field select:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-ring);
}

.hm-textarea-actions {
  display: flex;
  gap: var(--space-2);
  flex-wrap: wrap;
}
.hm-textarea-actions .btn {
  min-height: 36px;
  padding: var(--space-2) var(--space-4);
  font-size: 13px;
  flex: 1;
  min-width: 120px;
}

/* ---------- Guess-count fieldset ---------- */
.hm-mode {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: var(--space-3) var(--space-4) var(--space-4);
  background: var(--surface-inset);
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}
.hm-mode legend {
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
  padding: 0 var(--space-2);
}
.hm-radio {
  display: flex;
  align-items: flex-start;
  gap: var(--space-3);
  padding: var(--space-2);
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-size: 14px;
  color: var(--text-secondary);
  transition: background 0.12s ease;
}
.hm-radio:hover { background: var(--surface-2); }
.hm-radio input[type="radio"] {
  accent-color: var(--accent);
  margin-top: 3px;
  flex-shrink: 0;
}
.hm-radio strong { color: var(--text); font-weight: 600; }
.hm-radio-hint { color: var(--text-muted); font-weight: 400; }

.hm-hint {
  font-size: 13px;
  color: var(--text-muted);
  margin: 0;
}
.hm-hint.is-error { color: var(--danger); }

/* ---------- Game stats ---------- */
.hm-stats {
  display: flex;
  justify-content: center;
  gap: var(--space-6);
  margin-bottom: var(--space-5);
  background: var(--surface-inset);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: var(--space-3) var(--space-4);
}
.hm-stat {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  min-width: 72px;
}
.hm-stat-num {
  font-size: 26px;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
  color: var(--text);
  line-height: 1.1;
}
.hm-stat-num.is-low { color: var(--warning); }
.hm-stat-num.is-critical { color: var(--danger); }
.hm-stat-label {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.16em;
  color: var(--text-muted);
  margin-top: 4px;
}

/* ---------- Kite visual ---------- */
.hm-kite {
  display: flex;
  justify-content: center;
  align-items: center;
  margin-bottom: var(--space-4);
}
.hm-kite svg {
  width: 100%;
  max-width: 260px;
  height: auto;
  display: block;
}

/* Kite parts pull color from CSS vars so they re-theme cleanly. */
.hm-kite .hm-kite-frame {
  fill: var(--accent);
  stroke: var(--accent-hover);
  stroke-width: 2;
  stroke-linejoin: round;
  transition: fill 0.2s ease, opacity 0.2s ease, transform 0.3s ease;
}
.hm-kite .hm-kite-spar {
  stroke: var(--accent-hover);
  stroke-width: 1.5;
  stroke-linecap: round;
  opacity: 0.7;
}
.hm-kite .hm-kite-string {
  stroke: var(--text-muted);
  stroke-width: 1.5;
  stroke-linecap: round;
  fill: none;
  opacity: 0.85;
}
.hm-kite .hm-kite-tail {
  stroke: var(--accent-hover);
  stroke-width: 1.8;
  stroke-linecap: round;
  fill: none;
  opacity: 0.85;
}
.hm-kite .hm-kite-bow {
  fill: var(--accent-soft-bg);
  stroke: var(--accent-hover);
  stroke-width: 1;
}
.hm-kite .hm-ground {
  stroke: var(--border);
  stroke-width: 2;
  stroke-linecap: round;
}
.hm-kite .hm-grass {
  stroke: var(--border-strong);
  stroke-width: 1.2;
  stroke-linecap: round;
  opacity: 0.6;
}
.hm-kite .hm-shard {
  fill: var(--danger);
  opacity: 0.7;
}

/* ---------- Status message ---------- */
.hm-message {
  text-align: center;
  font-size: 15px;
  font-weight: 600;
  color: var(--text-secondary);
  min-height: 1.5em;
  margin-bottom: var(--space-4);
}
.hm-message.is-win  { color: var(--success); }
.hm-message.is-lose { color: var(--danger); }

/* ---------- Hidden word display ---------- */
.hm-word {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: var(--space-2);
  margin-bottom: var(--space-5);
  font-variant-numeric: tabular-nums;
}
.hm-word-letter {
  display: inline-flex;
  align-items: flex-end;
  justify-content: center;
  min-width: 28px;
  height: 40px;
  padding: 0 4px 4px;
  border-bottom: 3px solid var(--border-strong);
  font-size: 24px;
  font-weight: 700;
  letter-spacing: 0.04em;
  color: var(--text);
  transition: border-color 0.2s ease, color 0.2s ease;
}
.hm-word-letter.is-revealed {
  border-bottom-color: var(--accent);
}
.hm-word-letter.is-space {
  border-bottom-color: transparent;
  min-width: 16px;
}
.hm-word-letter.is-reveal-loss {
  color: var(--danger);
  border-bottom-color: var(--danger);
}
@media (min-width: 480px) {
  .hm-word-letter { min-width: 32px; height: 44px; font-size: 28px; }
}

/* ---------- Wrong-guess list ---------- */
.hm-wrong-line {
  display: flex;
  align-items: baseline;
  gap: var(--space-3);
  justify-content: center;
  margin-bottom: var(--space-5);
  font-size: 14px;
  color: var(--text-muted);
  flex-wrap: wrap;
}
.hm-wrong-label {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.16em;
  color: var(--text-muted);
}
.hm-wrong-list {
  font-family: var(--font-mono);
  font-size: 16px;
  font-weight: 600;
  color: var(--danger);
  letter-spacing: 0.12em;
}
.hm-wrong-list:empty::before { content: "—"; color: var(--text-subtle); }

/* ---------- On-screen keyboard ---------- */
.hm-keyboard {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-2);
  margin-bottom: var(--space-5);
}
.hm-keyboard-row {
  display: flex;
  justify-content: center;
  gap: 4px;
  width: 100%;
  flex-wrap: nowrap;
}
.hm-key {
  flex: 1 1 0;
  min-width: 0;
  max-width: 44px;
  height: 44px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--surface);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  font-family: var(--font-sans);
  font-size: 15px;
  font-weight: 700;
  color: var(--text);
  cursor: pointer;
  padding: 0;
  -webkit-tap-highlight-color: transparent;
  transition: background 0.12s ease,
              border-color 0.12s ease,
              color 0.12s ease,
              transform 0.06s ease;
}
.hm-key:hover:not(:disabled) {
  background: var(--surface-2);
  border-color: var(--accent);
  color: var(--accent);
}
.hm-key:active:not(:disabled) { transform: translateY(1px); }
.hm-key:disabled {
  cursor: default;
  opacity: 1;
}
.hm-key.is-correct {
  background: var(--accent-soft-bg);
  border-color: var(--accent);
  color: var(--accent-soft-fg);
}
.hm-key.is-wrong {
  background: var(--surface-inset);
  border-color: var(--border);
  color: var(--text-subtle);
  text-decoration: line-through;
  text-decoration-thickness: 2px;
}

@media (max-width: 480px) {
  .hm-key { height: 38px; font-size: 14px; }
  .hm-keyboard { gap: 4px; }
}
@media (max-width: 360px) {
  .hm-key { height: 34px; font-size: 13px; }
}

/* ---------- Game actions ---------- */
.hm-game-actions {
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
}
.hm-game-actions-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: var(--space-3);
}
.btn-link {
  background: none;
  border: none;
  padding: var(--space-2) var(--space-1);
  font-size: 13px;
  font-weight: 600;
  color: var(--text-muted);
  cursor: pointer;
  text-decoration: underline;
  text-decoration-color: transparent;
  text-underline-offset: 3px;
  transition: color 0.12s ease, text-decoration-color 0.12s ease;
}
.btn-link:hover {
  color: var(--accent);
  text-decoration-color: var(--accent);
}
