/* Hangman — sits on the Daniel.tf home theme. */

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

[hidden] {
  display: none !important;
}

.game-page .topbar-link {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
}

.game-hero {
  margin-bottom: clamp(1.6rem, 4vw, 2.4rem);
}

.game-title {
  font-size: clamp(3.2rem, 8vw, 5.2rem);
}

.game-page.is-playing .game-hero {
  margin-bottom: 1.25rem;
}

.game-page.is-playing .game-title {
  font-size: clamp(2.4rem, 6vw, 3.5rem);
}

.game-page.is-playing .eyebrow {
  margin-bottom: 0.85rem;
}

.lang-switch {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 0.45rem;
  margin: -0.4rem auto 1.15rem;
}

.lang-label {
  margin-right: 0.25rem;
  color: var(--text-muted);
  font-size: 0.75rem;
  font-weight: 650;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.lang-btn {
  border: 1px solid var(--border);
  border-radius: var(--radius-pill);
  background: rgba(255, 255, 255, 0.035);
  color: var(--text-soft);
  font: inherit;
  font-size: 0.82rem;
  font-weight: 600;
  padding: 0.38rem 0.85rem;
  cursor: pointer;
  transition: border-color 0.2s var(--ease), background-color 0.2s var(--ease), color 0.2s var(--ease);
}

.lang-btn.is-on {
  border-color: rgba(159, 145, 255, 0.45);
  background: rgba(159, 145, 255, 0.16);
  color: #e4e0ff;
}

.lang-btn:hover {
  border-color: var(--border-strong);
  color: #fff;
}

html.is-joining .lang-switch,
html.is-joining #lobby {
  display: none;
}

.joining {
  display: none;
  margin: 0 auto 1rem;
  color: var(--text-soft);
  text-align: center;
}

html.is-joining .joining {
  display: block;
}

.notice {
  margin: 0 auto 1rem;
  max-width: 36rem;
  padding: 0.75rem 1rem;
  border: 1px solid rgba(251, 113, 133, 0.35);
  border-radius: var(--radius-md);
  background: rgba(251, 113, 133, 0.1);
  color: #fecdd3;
  text-align: center;
  font-size: 0.9rem;
}

.notice.is-ok {
  border-color: rgba(94, 234, 212, 0.32);
  background: rgba(94, 234, 212, 0.1);
  color: #c8fff6;
}

.game-page button.card {
  width: 100%;
  font: inherit;
  color: inherit;
  cursor: pointer;
  appearance: none;
}

.card--join {
  cursor: default;
}

.card--join:hover {
  transform: none;
}

.join-row {
  display: flex;
  gap: 0.55rem;
  margin-top: 0.35rem;
}

.join-row input,
.game-page input[type="text"] {
  width: 100%;
  min-width: 0;
  padding: 0.82rem 1rem;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 13px;
  outline: none;
  background: rgba(5, 6, 12, 0.45);
  color: var(--text);
  font: inherit;
  transition: border-color 0.2s var(--ease), box-shadow 0.2s var(--ease);
}

.game-page input::placeholder {
  color: rgba(226, 226, 245, 0.42);
}

.game-page input:focus {
  border-color: rgba(159, 145, 255, 0.7);
  box-shadow: 0 0 0 4px rgba(159, 145, 255, 0.14);
}

.join-row .btn {
  flex: 0 0 auto;
}

.glass {
  position: relative;
  padding: clamp(1.2rem, 3vw, 1.7rem);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background:
    linear-gradient(165deg, rgba(255, 255, 255, 0.055), rgba(255, 255, 255, 0.018)),
    rgba(10, 12, 23, 0.62);
  box-shadow: var(--shadow-card);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  animation: rise 0.7s var(--ease) backwards;
}

.panel-head,
.board-actions,
.share-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.65rem;
}

.panel-head {
  justify-content: space-between;
  margin-bottom: 1.2rem;
}

.game-kicker {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  color: #cec7ff;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.game-kicker-dot {
  width: 0.42rem;
  height: 0.42rem;
  border-radius: 50%;
  background: var(--violet);
  box-shadow: 0 0 12px rgba(159, 145, 255, 0.8);
}

.panel-title {
  margin-top: 0.35rem;
  font-size: clamp(1.4rem, 3vw, 1.85rem);
  letter-spacing: -0.035em;
}

.field-label {
  display: block;
  margin-bottom: 0.45rem;
  color: var(--text-muted);
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.field-hint,
.share-lead {
  margin: 0.65rem 0 1rem;
  color: var(--text-muted);
  font-size: 0.85rem;
  line-height: 1.5;
}

#createForm .btn {
  margin-top: 0.2rem;
}

.share-box {
  margin-top: 1.3rem;
  padding: 1.1rem;
  border: 1px solid rgba(94, 234, 212, 0.24);
  border-radius: var(--radius-md);
  background:
    radial-gradient(120% 140% at 0% 0%, rgba(94, 234, 212, 0.14), transparent 55%),
    rgba(94, 234, 212, 0.05);
}

.share-lead {
  margin-top: 0;
  color: rgba(190, 255, 246, 0.78);
}

.code-value {
  margin: 0 0 1rem;
  color: var(--teal);
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: clamp(1.6rem, 4vw, 2.1rem);
  font-weight: 750;
  letter-spacing: 0.18em;
}

.link-value {
  margin-bottom: 1rem;
  text-align: left !important;
  font-size: 0.92rem;
}

.game-page button.btn {
  font: inherit;
  cursor: pointer;
}

.game-page button.btn:disabled {
  cursor: progress;
  opacity: 0.7;
}

.board {
  display: grid;
  grid-template-columns: minmax(11rem, 15rem) minmax(0, 1fr);
  gap: clamp(1rem, 3vw, 2rem);
  align-items: center;
}

.board.is-won {
  border-color: rgba(94, 234, 212, 0.35);
}

.board.is-lost {
  border-color: rgba(251, 113, 133, 0.35);
}

.gallows-wrap {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.8rem;
}

.figure {
  width: min(100%, 13.5rem);
  color: rgba(206, 199, 255, 0.88);
  filter: drop-shadow(0 12px 28px rgba(124, 108, 240, 0.28));
}

.figure .gallows {
  opacity: 0.55;
}

.figure .part {
  opacity: 0;
  transition: opacity 0.35s var(--ease);
}

.figure .part.on {
  opacity: 1;
}

.figure.is-lost {
  color: #fda4af;
}

.figure.is-won {
  color: var(--teal);
}

.lives {
  display: flex;
  gap: 0.35rem;
}

.lives i {
  width: 0.48rem;
  height: 0.48rem;
  border-radius: 50%;
  background: rgba(94, 234, 212, 0.85);
  box-shadow: 0 0 10px rgba(94, 234, 212, 0.35);
}

.lives i.off {
  background: rgba(255, 255, 255, 0.16);
  box-shadow: none;
}

.board-main {
  min-width: 0;
  text-align: center;
}

.status-line {
  color: var(--text-soft);
  font-size: 0.95rem;
}

.status-line strong {
  color: #fff;
  font-weight: 700;
}

.tiles {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.4rem 0.35rem;
  min-height: 3.1rem;
  margin: 1rem 0 0.85rem;
}

.tile {
  display: grid;
  place-items: center;
  min-width: 1.85rem;
  height: 2.55rem;
  padding: 0 0.15rem;
  border-bottom: 2px solid rgba(159, 145, 255, 0.55);
  color: #fff;
  font-size: clamp(1.25rem, 3vw, 1.55rem);
  font-weight: 750;
  line-height: 1;
  text-transform: uppercase;
}

.tile.is-hidden {
  color: transparent;
}

.tile.is-space,
.tile.is-mark {
  min-width: 0.7rem;
  border-bottom-color: transparent;
}

.tile.is-mark {
  color: var(--text-soft);
  text-transform: none;
}

.board.is-won .tile {
  border-bottom-color: rgba(94, 234, 212, 0.7);
  color: #d9fff8;
}

.board.is-lost .tile.is-missed {
  border-bottom-color: rgba(251, 113, 133, 0.65);
  color: #fecdd3;
}

.attempts {
  display: inline-flex;
  margin-bottom: 1.1rem;
  padding: 0.35rem 0.75rem;
  border: 1px solid rgba(94, 234, 212, 0.28);
  border-radius: var(--radius-pill);
  background: rgba(94, 234, 212, 0.08);
  color: #c8fff6;
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.attempts.is-low {
  border-color: rgba(251, 113, 133, 0.4);
  background: rgba(251, 113, 133, 0.1);
  color: #fecdd3;
}

.keyboard {
  display: grid;
  gap: 0.4rem;
  width: min(100%, 34rem);
  margin: 0 auto 1.15rem;
}

.key-row {
  display: flex;
  justify-content: center;
  gap: 0.32rem;
}

.key {
  flex: 1 1 0;
  max-width: 2.55rem;
  aspect-ratio: 1;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.045);
  color: var(--text);
  font: inherit;
  font-size: 0.82rem;
  font-weight: 700;
  text-transform: uppercase;
  cursor: pointer;
  transition: transform 0.15s var(--ease), border-color 0.15s var(--ease), background-color 0.15s var(--ease);
}

.key:hover:not(:disabled) {
  transform: translateY(-1px);
  border-color: var(--border-strong);
}

.key:disabled {
  cursor: default;
}

.key.is-hit {
  border-color: rgba(94, 234, 212, 0.45);
  background: rgba(94, 234, 212, 0.16);
  color: #d9fff8;
}

.key.is-miss {
  border-color: rgba(251, 113, 133, 0.28);
  background: rgba(251, 113, 133, 0.08);
  color: rgba(254, 205, 211, 0.55);
}

.board-actions {
  justify-content: center;
}

.board.is-shake {
  animation: shake 0.4s var(--ease);
}

@keyframes shake {
  20% { transform: translateX(-4px); }
  40% { transform: translateX(4px); }
  60% { transform: translateX(-2px); }
  80% { transform: translateX(2px); }
}

@media (max-width: 760px) {
  .board {
    grid-template-columns: minmax(0, 1fr);
  }

  .figure {
    width: min(100%, 10.5rem);
  }

  .card--join {
    grid-column: 1 / -1;
  }
}

@media (max-width: 520px) {
  .game-page .topbar-link {
    display: inline-flex;
  }

  .join-row,
  .share-actions,
  .board-actions {
    flex-direction: column;
    align-items: stretch;
  }

  .join-row .btn,
  .share-actions .btn,
  .board-actions .btn,
  #createForm .btn {
    width: 100%;
  }

  .key {
    max-width: none;
    border-radius: 8px;
    font-size: 0.74rem;
  }
}

@media (prefers-reduced-motion: reduce) {
  .board.is-shake {
    animation: none;
  }
}
