.game-page {
  padding-bottom: 4rem;
}

.game-header,
.game-main {
  width: min(94%, 1180px);
  margin: 0 auto;
}

body.game-page .game-main {
  opacity: 1 !important;
  animation: none !important;
  transform: none !important;
}

.game-header {
  position: relative;
  padding: 2.5rem 0 2rem;
  text-align: center;
}

.game-header h1 {
  margin: 0.25rem 0;
}

.game-header > p:last-of-type {
  margin: 0;
}

.back-link {
  position: absolute;
  top: 2.5rem;
  left: 0;
  color: var(--blue);
  text-decoration: none;
}

.back-link:hover {
  color: var(--soft-blue);
  text-shadow: 0 0 10px var(--neon-blue);
}

.connection-status {
  display: inline-block;
  margin-top: 1rem;
  padding: 0.25rem 0.7rem;
  border: 1px solid rgb(0 170 255 / 35%);
  border-radius: 999px;
  color: var(--muted-blue);
  font-size: 0.8rem;
}

.connection-status.connected {
  color: #7ce8ae;
  border-color: rgb(124 232 174 / 55%);
}

.connection-status.disconnected {
  color: #ff8e9e;
  border-color: rgb(255 142 158 / 55%);
}

.game-dashboard,
.lobby-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1.25rem;
}

.panel {
  padding: 1.5rem;
  border: 1px solid var(--neon-blue);
  border-radius: 10px;
  background-color: rgb(6 18 37 / 88%);
  box-shadow:
    0 0 10px rgb(0 170 255 / 42%),
    inset 0 0 18px rgb(0 170 255 / 9%);
}

.panel h2,
.panel h3 {
  margin: 0.4rem 0 1.25rem;
}

.panel-heading,
.lobby-topbar,
.room-item,
.player-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

label {
  display: grid;
  gap: 0.4rem;
  margin-bottom: 1rem;
  color: var(--soft-blue);
  font-size: 0.9rem;
}

input,
textarea,
select {
  width: 100%;
  padding: 0.75rem;
  border: 1px solid rgb(0 170 255 / 55%);
  border-radius: 5px;
  color: var(--soft-blue);
  background: #020b18;
  font: inherit;
  outline: none;
  transition:
    border-color 180ms ease,
    box-shadow 180ms ease;
}

input:focus,
textarea:focus,
select:focus {
  border-color: var(--neon-blue);
  box-shadow: 0 0 12px rgb(0 170 255 / 45%);
}

textarea {
  resize: vertical;
}

small {
  color: var(--muted-blue);
}

.form-row {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1rem;
}

.primary-button {
  font-weight: bold;
  box-shadow: 0 0 15px rgb(0 170 255 / 70%);
}

.subtle-button {
  margin-top: 0;
  opacity: 0.85;
}

.icon-button {
  display: grid;
  width: 2.6rem;
  height: 2.6rem;
  padding: 0.65rem;
  border: 1px solid rgb(0 170 255 / 55%);
  border-radius: 50%;
  place-items: center;
  color: var(--soft-blue);
  background: #061a34;
  cursor: pointer;
}

.icon-button svg {
  display: block;
  width: 100%;
  fill: currentcolor;
}

.refresh-button.is-refreshing svg {
  animation: refresh-spin 650ms cubic-bezier(0.4, 0, 0.2, 1);
}

.join-code-form {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  align-items: end;
  gap: 0.75rem;
  margin-bottom: 1.25rem;
}

.join-code-form label {
  margin: 0;
}

.join-code-button {
  width: 100%;
  height: 49px;
  align-self: end;
  margin-top: 0;
  text-align: center;
}

.room-list,
.player-list {
  display: grid;
  gap: 0.75rem;
}

.room-item,
.player-item {
  padding: 0.9rem;
  border: 1px solid rgb(0 170 255 / 30%);
  border-radius: 7px;
  background: rgb(2 11 24 / 75%);
}

.room-item h3,
.room-item p,
.player-item p {
  margin: 0;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.room-meta {
  color: var(--muted-blue);
  font-size: 0.82rem;
}

.host-badge {
  padding: 0.15rem 0.5rem;
  border: 1px solid var(--neon-blue);
  border-radius: 999px;
  color: var(--soft-blue);
  font-size: 0.72rem;
  text-transform: uppercase;
}

.empty-state {
  padding: 1.5rem;
  border: 1px dashed rgb(0 170 255 / 35%);
  border-radius: 7px;
  color: var(--muted-blue);
  text-align: center;
}

.lobby-topbar {
  margin-bottom: 1.25rem;
}

.lobby-topbar h2 {
  margin: 0.25rem 0 0;
}

.start-area {
  margin-top: 1.25rem;
  padding: 1.25rem;
  border: 1px solid rgb(0 170 255 / 35%);
  border-radius: 10px;
  text-align: center;
  background: rgb(6 18 37 / 70%);
}

.start-area p {
  margin-top: 0;
}

.round-status {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1rem;
}

.round-status h2,
.round-status p {
  margin: 0;
}

.round-progress {
  color: var(--muted-blue);
  font-size: 0.85rem;
}

.timer {
  min-width: 5rem;
  padding: 0.55rem 0.9rem;
  border: 1px solid var(--neon-blue);
  border-radius: 999px;
  color: var(--soft-blue);
  box-shadow: 0 0 14px rgb(0 170 255 / 55%);
  font-size: 1.35rem;
  font-weight: bold;
  text-align: center;
}

.timer.urgent {
  color: #ff9ca9;
  border-color: #ff5670;
  box-shadow: 0 0 18px rgb(255 86 112 / 70%);
  animation: timer-pulse 700ms ease-in-out infinite alternate;
}

.letter-reveal {
  display: grid;
  min-height: 430px;
  place-items: center;
  align-content: center;
  border: 1px solid rgb(0 170 255 / 40%);
  border-radius: 14px;
  background:
    radial-gradient(circle, rgb(0 170 255 / 18%), transparent 42%),
    rgb(2 11 24 / 72%);
  overflow: hidden;
}

.letter-reveal p {
  margin: 1.5rem 0 0;
  color: var(--muted-blue);
  letter-spacing: 0.2em;
  text-transform: uppercase;
}

.letter-orbit {
  display: grid;
  width: 190px;
  height: 190px;
  border: 1px solid var(--neon-blue);
  border-radius: 50%;
  place-items: center;
  box-shadow:
    0 0 24px rgb(0 170 255 / 60%),
    inset 0 0 32px rgb(0 170 255 / 25%);
  animation: orbit-breathe 1.2s ease-in-out infinite alternate;
}

.letter-orbit span {
  color: var(--soft-blue);
  font-size: 7rem;
  font-weight: bold;
  line-height: 1;
  text-shadow:
    0 0 12px var(--neon-blue),
    0 0 34px var(--neon-blue);
}

.letter-reveal.revealed .letter-orbit {
  animation: letter-land 850ms cubic-bezier(0.18, 0.89, 0.32, 1.28) both;
}

.answer-form {
  display: grid;
  gap: 1rem;
}

.answer-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1rem;
}

.answer-card {
  padding: 1rem;
  border: 1px solid rgb(0 170 255 / 40%);
  border-radius: 8px;
  background: rgb(6 18 37 / 78%);
}

.answer-card label {
  margin: 0;
}

.answer-card span {
  color: var(--muted-blue);
  font-size: 0.75rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}

.answer-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 1rem;
  border: 1px solid rgb(0 170 255 / 35%);
  border-radius: 8px;
  background: rgb(2 11 24 / 80%);
}

.answer-actions p {
  margin: 0;
}

.waiting-panel {
  min-height: 350px;
  padding: 2rem;
  border: 1px solid rgb(0 170 255 / 40%);
  border-radius: 12px;
  text-align: center;
  background: rgb(6 18 37 / 78%);
}

.waiting-pulse {
  width: 80px;
  height: 80px;
  margin: 3rem auto 1.5rem;
  border: 2px solid var(--neon-blue);
  border-radius: 50%;
  box-shadow: 0 0 20px var(--neon-blue);
  animation: waiting-pulse 1.2s ease-in-out infinite;
}

.scoreboard {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 0.75rem;
  margin-bottom: 1.25rem;
}

.score-item {
  padding: 1rem;
  border: 1px solid rgb(0 170 255 / 40%);
  border-radius: 8px;
  background: rgb(6 18 37 / 78%);
  text-align: center;
}

.score-item strong {
  display: block;
  overflow: hidden;
  color: var(--soft-blue);
  font-size: 1.8rem;
  text-shadow: 0 0 12px var(--neon-blue);
  text-overflow: ellipsis;
  white-space: nowrap;
}

.review-list {
  display: grid;
  gap: 1rem;
}

.review-player {
  padding: 1rem;
  border: 1px solid rgb(0 170 255 / 45%);
  border-radius: 10px;
  background: rgb(6 18 37 / 82%);
}

.review-player h3 {
  margin-top: 0;
}

.review-answers {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
  gap: 0.75rem;
}

.review-answer {
  padding: 0.8rem;
  border: 1px solid rgb(0 170 255 / 30%);
  border-radius: 7px;
  background: rgb(2 11 24 / 72%);
}

.review-answer.invalid {
  border-color: rgb(255 86 112 / 70%);
  opacity: 0.68;
}

.review-answer p {
  margin: 0.2rem 0 0.7rem;
  color: var(--soft-blue);
  word-break: break-word;
}

.vote-button {
  width: 100%;
  padding: 0.45rem;
  border: 1px solid rgb(255 86 112 / 60%);
  border-radius: 5px;
  color: #ff9ca9;
  background: rgb(60 8 20 / 45%);
  cursor: pointer;
}

.vote-button.active {
  color: white;
  background: rgb(150 22 48 / 70%);
  box-shadow: 0 0 12px rgb(255 86 112 / 55%);
}

.hidden {
  display: none;
}

.toast {
  position: fixed;
  z-index: 100;
  right: 1rem;
  bottom: 1rem;
  max-width: min(420px, calc(100% - 2rem));
  padding: 0.9rem 1rem;
  border: 1px solid var(--neon-blue);
  border-radius: 7px;
  color: var(--soft-blue);
  background: #061225;
  box-shadow: 0 0 18px rgb(0 170 255 / 60%);
  opacity: 0;
  pointer-events: none;
  transform: translateY(12px);
  transition:
    opacity 180ms ease,
    transform 180ms ease;
}

.toast.visible {
  opacity: 1;
  transform: translateY(0);
}

fieldset:disabled,
input:disabled,
textarea:disabled,
select:disabled,
button:disabled {
  cursor: not-allowed;
  opacity: 0.55;
}

@media (max-width: 800px) {
  .game-dashboard,
  .lobby-grid,
  .form-row,
  .join-code-form {
    grid-template-columns: 1fr;
  }

  .back-link {
    position: static;
    display: block;
    margin-bottom: 1rem;
  }

  .lobby-topbar {
    align-items: flex-start;
    flex-direction: column;
  }

  .answer-grid {
    grid-template-columns: 1fr;
  }

  .answer-actions,
  .round-status {
    align-items: stretch;
    flex-direction: column;
  }
}

@keyframes orbit-breathe {
  to {
    box-shadow:
      0 0 42px rgb(0 170 255 / 85%),
      inset 0 0 44px rgb(0 170 255 / 34%);
    transform: scale(1.05);
  }
}

@keyframes letter-land {
  from {
    filter: blur(10px);
    opacity: 0;
    transform: rotate(540deg) scale(0.2);
  }

  to {
    filter: blur(0);
    opacity: 1;
    transform: rotate(0) scale(1);
  }
}

@keyframes waiting-pulse {
  50% {
    opacity: 0.45;
    transform: scale(1.2);
  }
}

@keyframes timer-pulse {
  to {
    transform: scale(1.06);
  }
}

@keyframes refresh-spin {
  to {
    transform: rotate(360deg);
  }
}
