/* ── Hængmand layout ───────────────────────────────────── */

.hm-screen {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 10px 8px 28px;
  width: 100%;
  max-width: 720px;
}

.hm-layout {
  display: flex;
  gap: 28px;
  align-items: flex-start;
  justify-content: center;
  width: 100%;
  flex-wrap: wrap;
  margin-top: 6px;
}

/* ── SVG illustration ──────────────────────────────────── */
.hm-illustration {
  display: flex;
  flex-direction: column;
  align-items: center;
  flex-shrink: 0;
}

#hm-svg {
  width: 200px;
  height: 245px;
  filter: drop-shadow(0 4px 12px rgba(0,0,0,0.35));
}

/* Body parts are invisible by default */
.hm-part {
  opacity: 0;
  transition: opacity 0.15s ease;
}
/* Lines use stroke-dashoffset for draw-on animation */
#hm-body, #hm-arm-l, #hm-arm-r, #hm-leg-l, #hm-leg-r {
  transition: stroke-dashoffset 0.55s cubic-bezier(.4,0,.2,1), opacity 0.15s ease;
}

.hm-part.visible {
  opacity: 1;
}
/* Trigger draw-on for lines */
#hm-body.visible   { stroke-dashoffset: 0; }
#hm-arm-l.visible  { stroke-dashoffset: 0; }
#hm-arm-r.visible  { stroke-dashoffset: 0; }
#hm-leg-l.visible  { stroke-dashoffset: 0; }
#hm-leg-r.visible  { stroke-dashoffset: 0; }

.hm-wrong-counter {
  margin-top: 8px;
  font-size: 0.95rem;
  color: var(--subtext);
  font-weight: 600;
  letter-spacing: 1px;
}
#wrong-count {
  color: #ff6b6b;
  font-size: 1.2rem;
  font-weight: 800;
}

/* ── Spil-område ───────────────────────────────────────── */
.hm-play-area {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 20px;
  flex: 1;
  min-width: 260px;
}

/* ── Ord med blanke ────────────────────────────────────── */
.hm-word {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: center;
  padding: 8px 0;
}

.hm-letter {
  width: 42px;
  height: 48px;
  border-bottom: 3px solid #818384;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.6rem;
  font-weight: 800;
  text-transform: uppercase;
  color: var(--text);
  transition: color 0.3s ease, border-color 0.3s ease;
  position: relative;
}

.hm-letter.revealed {
  border-color: var(--green);
  animation: letter-pop 0.35s ease;
}

@keyframes letter-pop {
  0%   { transform: scale(1) translateY(0); }
  40%  { transform: scale(1.25) translateY(-6px); }
  70%  { transform: scale(0.95) translateY(2px); }
  100% { transform: scale(1) translateY(0); }
}

/* ── Forkerte bogstaver ────────────────────────────────── */
.hm-wrong-letters {
  min-height: 36px;
  text-align: center;
  font-size: 0.85rem;
}
.hm-wrong-label {
  color: var(--subtext);
  display: block;
  margin-bottom: 6px;
}
.wrong-letter {
  display: inline-block;
  background: #5a1a1a;
  color: #ff8a8a;
  border-radius: 4px;
  padding: 2px 7px;
  margin: 2px;
  font-weight: 700;
  font-size: 0.9rem;
  animation: wrong-in 0.25s ease;
}
@keyframes wrong-in {
  from { transform: scale(0.5); opacity: 0; }
  to   { transform: scale(1);   opacity: 1; }
}

/* ── Bogstav-tastatur ──────────────────────────────────── */
.hm-keyboard {
  display: flex;
  flex-direction: column;
  gap: 6px;
  width: 100%;
  max-width: 400px;
}

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

.hm-key {
  background: var(--key-bg);
  border: none;
  border-radius: 4px;
  color: var(--key-text);
  cursor: pointer;
  font-size: clamp(0.65rem, 2vw, 0.82rem);
  font-weight: 700;
  height: 46px;
  flex: 1 1 0;
  min-width: 0;
  max-width: 38px;
  text-transform: uppercase;
  transition: background var(--transition), transform 0.1s, opacity var(--transition);
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
}

.hm-key:active:not(:disabled) { transform: scale(0.88); }

.hm-key.correct  { background: var(--green);  color: white; cursor: default; }
.hm-key.wrong    { background: var(--gray);   color: #555;  cursor: default; opacity: 0.5; }
.hm-key:disabled { cursor: default; }

/* ── Mobil ─────────────────────────────────────────────── */
@media (max-width: 500px) {
  .hm-layout { gap: 12px; }
  #hm-svg { width: 160px; height: 196px; }
  .hm-letter { width: 34px; height: 42px; font-size: 1.3rem; }
  .hm-key { height: 40px; }
}
