:root {
  font-family: system-ui, sans-serif;
  color-scheme: dark;
}

body {
  margin: 0;
  background: #151827;
  color: #f5f7ff;
}

main {
  width: min(980px, calc(100% - 24px));
  margin: 20px auto;
}

.card {
  background: #24283d;
  border: 1px solid #444b6b;
  border-radius: 18px;
  padding: 20px;
}

.hidden {
  display: none !important;
}

label {
  display: grid;
  gap: 6px;
  margin: 12px 0;
}

input,
select,
button {
  box-sizing: border-box;
  width: 100%;
  min-height: 46px;
  border-radius: 10px;
  border: 1px solid #59617d;
  font: inherit;
  padding: 9px 12px;
}

input,
select {
  background: #171a29;
  color: inherit;
}

button {
  background: #8291ff;
  color: #0b1020;
  font-weight: 800;
  cursor: pointer;
  margin: 5px 0;
}

.danger {
  background: #ff9095;
}

header,
.row {
  display: flex;
  justify-content: space-between;
  gap: 10px;
}

.row input {
  flex: 1;
}

.row button {
  width: auto;
}

#word {
  text-align: center;
  font-size: clamp(1.5rem, 6vw, 3rem);
  letter-spacing: .08em;
  padding: 25px 5px;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

#alphabet {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(45px, 1fr));
  gap: 5px;
}

.hangman-players-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 12px;
  margin-top: 12px;
}

.hangman-player-card {
  background: #171a29;
  border: 1px solid #3f4665;
  border-radius: 14px;
  padding: 10px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.hangman-player-card.is-self {
  border-color: #7b8cff;
  box-shadow: 0 0 0 2px rgb(123 140 255 / 18%);
}

.hangman-player-card.is-solved {
  border-color: #66d18f;
}

.hangman-player-card.is-hanged {
  border-color: #ff8a8a;
}

.hangman-player-card.is-creator {
  border-color: #e6d37a;
}

.hangman-player-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
}

.hangman-player-name {
  font-weight: 700;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.hangman-player-score {
  white-space: nowrap;
  font-weight: 700;
}

.hangman-player-image {
  display: flex;
  justify-content: center;
  align-items: center;
  min-height: 175px;
  background: #efefef;
  border-radius: 10px;
  padding: 6px;
}

.hangman-figure {
  width: 100%;
  max-width: 170px;
  height: auto;
  color: #5a5a5a;
}

.sketch {
  fill: none;
  stroke: currentColor;
  stroke-width: 4.2;
  stroke-linecap: round;
  stroke-linejoin: round;
  opacity: .95;
}

.sketch-2 {
  opacity: .55;
  stroke-width: 3.5;
}

.sketch-3 {
  opacity: .32;
  stroke-width: 3;
}

.hangman-player-status {
  text-align: center;
  font-weight: 650;
  min-height: 22px;
}

#message {
  margin-top: 12px;
  color: #ffd694;
}

@media (max-width: 760px) {
  main {
    width: min(100%, calc(100% - 20px));
  }

  .hangman-players-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
  }

  .hangman-player-card {
    padding: 8px;
  }

  .hangman-player-image {
    min-height: 135px;
  }

  .hangman-figure {
    max-width: 140px;
  }
}

@media (max-width: 520px) {
  .row {
    display: grid;
  }

  .row button {
    width: 100%;
  }
}

.creator-image {
  background: #fff8d9;
}

.creator-card-visual {
  min-height: 155px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  gap: 10px;
  color: #44412f;
  text-align: center;
}

.creator-card-visual span {
  font-size: 3rem;
  line-height: 1;
}

#alphabet button.letter-correct,
#alphabet button.letter-correct:disabled {
  background: #4fc77a;
  border-color: #75e39a;
  color: #071b0e;
  opacity: 1;
}

#alphabet button.letter-wrong,
#alphabet button.letter-wrong:disabled {
  background: #ee7078;
  border-color: #ff9a9f;
  color: #260608;
  opacity: 1;
}

#alphabet button:disabled:not(.letter-correct):not(.letter-wrong) {
  opacity: .45;
  cursor: not-allowed;
}

.home-title-row {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 18px;
}
.account-box {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  align-items: center;
  gap: 7px;
  max-width: 420px;
}
.account-box span { width: 100%; text-align: right; }
.small-button { width: auto; min-height: 38px; padding: 6px 10px; }
.secondary { background: #cbd0e6; }
.auth-panel {
  margin: 18px 0;
  padding: 15px;
  background: #171a29;
  border: 1px solid #4b5270;
  border-radius: 12px;
}
.home-game-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
  margin-top: 18px;
}
.home-action-card {
  border: 1px solid #444b6b;
  border-radius: 14px;
  padding: 14px;
  background: #1b1f31;
}
#reservedPasswordWrap small { display: block; margin-top: -5px; color: #ffd694; }
.message { min-height: 24px; color: #ffd694; }
@media (max-width: 700px) {
  .home-title-row { display: grid; }
  .account-box { justify-content: flex-start; max-width: none; }
  .account-box span { text-align: left; }
  .home-game-grid { grid-template-columns: 1fr; }
}


.site-footer {
  width: min(980px, calc(100% - 24px));
  margin: 0 auto 24px;
  padding: 14px 0;
  color: #aeb5d0;
  text-align: center;
  font-size: .92rem;
}

.site-footer p {
  margin: 0;
}


.stats-panel,
.leaderboard-panel {
  margin: 18px 0;
  padding: 16px;
  background: #1b1f31;
  border: 1px solid #444b6b;
  border-radius: 14px;
}

.stats-heading-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.stats-heading-row h2 {
  margin: 0;
}

.stats-heading-row .small-button {
  width: auto;
  min-height: 38px;
  margin: 0;
}

.stats-cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(135px, 1fr));
  gap: 10px;
  margin-top: 14px;
}

.stat-card {
  background: #131726;
  border: 1px solid #3f4665;
  border-radius: 12px;
  padding: 12px;
  text-align: center;
}

.stat-card strong {
  display: block;
  font-size: 1.65rem;
  line-height: 1.1;
  margin-bottom: 4px;
}

.stat-card span {
  color: #c8cceb;
  font-size: .92rem;
}

.leaderboard-table-wrap {
  overflow-x: auto;
  margin-top: 14px;
}

.leaderboard-table {
  width: 100%;
  border-collapse: collapse;
}

.leaderboard-table th,
.leaderboard-table td {
  padding: 10px 8px;
  border-bottom: 1px solid #3b405c;
  text-align: left;
}

.leaderboard-table th:first-child,
.leaderboard-table td:first-child {
  width: 60px;
  text-align: center;
}

.leaderboard-table th:last-child,
.leaderboard-table td:last-child {
  text-align: right;
  white-space: nowrap;
}

.leaderboard-table tr.is-current-user td {
  background: rgb(123 140 255 / 12%);
  font-weight: 700;
}


.round-results {
  margin: 16px 0;
  padding: 16px;
  border: 1px solid #4b5377;
  border-radius: 14px;
  background: #171b2b;
}
.round-results h2 { margin-top: 0; }
#guesserResults { display: grid; gap: 10px; }
.guesser-result {
  display: grid;
  grid-template-columns: minmax(120px, 1fr) minmax(120px, 1fr);
  gap: 6px 12px;
  padding: 10px 12px;
  border: 1px solid #3f4665;
  border-radius: 10px;
  background: #111522;
}
.guesser-result code {
  grid-column: 1 / -1;
  font-size: 1.05rem;
  white-space: pre-wrap;
  color: #f4f5ff;
}
.guesser-result small { grid-column: 1 / -1; color: #c8cceb; }
#forceFinish { margin: 14px 0; }

.scoring-info {
  margin: 18px 0;
  padding: 16px 18px;
  background: #191d2e;
  border: 1px solid #414866;
  border-radius: 14px;
}

.scoring-info h2 {
  margin: 0 0 10px;
}

.scoring-info ul {
  margin: 0;
  padding-left: 22px;
}

.scoring-info li + li {
  margin-top: 7px;
}

.scoring-info p {
  margin: 12px 0 0;
  color: #cfd5ef;
}
