* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

body {
  margin: 0;
  min-height: 100vh;
  background: #151515;
  color: #f7f1e3;
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

button,
input {
  height: 42px;
  border: 1px solid #3e3a33;
  border-radius: 8px;
  background: #24231f;
  color: #f7f1e3;
  font: inherit;
}

button {
  padding: 0 14px;
  cursor: pointer;
}

button:hover:not(:disabled) {
  border-color: #ffd166;
  background: #302d25;
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.45;
}

input {
  min-width: 190px;
  padding: 0 12px;
}

.auth-shell {
  display: grid;
  min-height: 100vh;
  place-items: center;
  padding: 20px;
}

.auth-panel {
  display: grid;
  gap: 20px;
  width: min(100%, 400px);
  padding: 24px;
  border: 1px solid #35322d;
  border-radius: 8px;
  background: #1d1c19;
}

.auth-brand {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 16px;
}

.auth-brand h1 {
  margin: 0;
  font-size: 1.7rem;
  letter-spacing: 0;
}

.auth-brand span,
.auth-form label {
  color: #b9b1a1;
  font-size: 0.75rem;
  text-transform: uppercase;
}

.auth-tabs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
}

.auth-tabs button[aria-selected="true"] {
  border-color: #70c1b3;
  background: #20322f;
}

.auth-form {
  display: grid;
  gap: 8px;
}

.auth-form label:not(:first-child) {
  margin-top: 6px;
}

.auth-form input,
.auth-form button {
  width: 100%;
  min-width: 0;
}

.auth-form button {
  margin-top: 8px;
}

.auth-notice {
  padding: 10px 12px;
  border: 1px solid #b55d4c;
  border-radius: 8px;
  background: #35221f;
  color: #ffd7ce;
}

.shell {
  display: flex;
  flex-direction: column;
  gap: 14px;
  min-height: 100vh;
  padding: 18px;
}

.topbar,
.rooms-panel,
.game-panel,
.score-panel {
  border: 1px solid #35322d;
  border-radius: 8px;
  background: #1d1c19;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  min-height: 72px;
  padding: 14px 16px;
}

.brand,
.identity,
.panel-heading,
.room-strip,
.score-row,
.result-row {
  display: flex;
  align-items: center;
}

.brand {
  gap: 12px;
  flex-wrap: wrap;
}

.brand strong {
  font-size: 1.4rem;
}

.brand span,
.panel-heading span,
.room-strip span,
.result-row em {
  color: #b9b1a1;
  font-size: 0.78rem;
  font-style: normal;
  text-transform: uppercase;
}

.identity {
  gap: 8px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.account-name {
  color: #ffd166;
  font-weight: 700;
}

.workspace {
  display: grid;
  grid-template-columns: minmax(220px, 260px) minmax(400px, 1fr) minmax(300px, 340px);
  gap: 14px;
  min-height: 0;
  flex: 1;
}

.rooms-panel,
.score-panel {
  display: flex;
  flex-direction: column;
  gap: 12px;
  min-height: 0;
  padding: 14px;
}

.panel-heading {
  justify-content: space-between;
}

.rooms-list,
.score-list,
.vote-list,
.results-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.score-list {
  flex: 1;
  min-height: 0;
  overflow: auto;
}

.rooms-list {
  flex: 1;
  min-height: 0;
  overflow: auto;
}

.room-card,
.answer-card {
  display: grid;
  align-content: center;
  gap: 4px;
  width: 100%;
  height: auto;
  min-height: 74px;
  padding: 10px 12px;
  text-align: left;
}

.room-card.active,
.answer-card.selected {
  border-color: #70c1b3;
  background: #20322f;
}

.room-card span {
  color: #b9b1a1;
  font-size: 0.85rem;
}

.game-panel {
  display: flex;
  flex-direction: column;
  gap: 18px;
  min-height: 0;
  overflow: hidden;
  padding: 16px;
}

.room-strip {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
}

.room-strip div {
  display: grid;
  gap: 4px;
  min-height: 58px;
  padding: 10px;
  border: 1px solid #35322d;
  border-radius: 8px;
  background: #24231f;
}

.prompt-zone {
  display: grid;
  place-items: center;
  gap: 10px;
  min-height: 190px;
  border: 1px solid #35322d;
  border-radius: 8px;
  background:
    linear-gradient(135deg, rgba(112, 193, 179, 0.15), transparent 42%),
    #20201d;
}

.prompt-zone span {
  color: #ffd166;
  font-weight: 700;
  text-transform: uppercase;
}

#acronym {
  font-size: clamp(3.2rem, 10vw, 8rem);
  letter-spacing: 0;
}

#acronym.idle {
  font-size: 4rem;
}

.answer-form {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px;
}

.answer-form input {
  width: 100%;
}

.game-notice {
  min-height: 42px;
  padding: 10px 12px;
  border: 1px solid #b55d4c;
  border-radius: 8px;
  background: #35221f;
  color: #ffd7ce;
}

.answer-card {
  font-size: 1rem;
  overflow-wrap: anywhere;
}

.answer-card.mine {
  opacity: 0.65;
}

.score-row {
  justify-content: space-between;
  min-height: 42px;
  padding: 0 10px;
  border: 1px solid #35322d;
  border-radius: 8px;
  background: #24231f;
}

.score-row.me {
  border-color: #70c1b3;
}

.score-row.finalist {
  box-shadow: inset 3px 0 #ffd166;
}

.score-row.offline {
  opacity: 0.55;
}

.score-row > span {
  min-width: 0;
  overflow-wrap: anywhere;
}

.score-row > strong {
  flex: none;
  margin-left: 8px;
  font-size: 0.84rem;
}

.score-row small {
  display: block;
  margin-top: 2px;
  color: #b9b1a1;
  font-size: 0.68rem;
  text-transform: uppercase;
}

.score-actions {
  display: grid;
  gap: 8px;
  margin-top: auto;
}

.chat-section {
  display: flex;
  flex: 1;
  flex-direction: column;
  gap: 8px;
  min-height: 180px;
  padding-top: 12px;
  border-top: 1px solid #35322d;
}

.chat-heading {
  gap: 10px;
}

.chat-tabs {
  display: flex;
  gap: 2px;
  padding: 2px;
  border: 1px solid #35322d;
  border-radius: 8px;
  background: #181816;
}

.chat-tabs button {
  height: 30px;
  padding: 0 11px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: #b9b1a1;
  font-size: 0.78rem;
}

.chat-tabs button[aria-selected="true"] {
  background: #2b3a36;
  color: #f7f1e3;
}

.game-panel .chat-section {
  flex: none;
  height: 230px;
  margin-top: auto;
}

.vote-list,
.results-list {
  min-height: 0;
  overflow-y: auto;
}

.chat-list {
  display: flex;
  flex: 1;
  flex-direction: column;
  gap: 2px;
  min-height: 100px;
  overflow-y: auto;
  overscroll-behavior: contain;
}

.chat-message {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: baseline;
  gap: 8px;
  padding: 8px 4px;
  border-bottom: 1px solid #302e29;
}

.chat-message time {
  font-size: 0.72rem;
}

.chat-message time {
  flex: none;
  color: #817b70;
}

.chat-message.mine strong {
  color: #70c1b3;
}

.chat-message p {
  min-width: 0;
  margin: 0;
  font-size: 0.86rem;
  line-height: 1.35;
  overflow-wrap: anywhere;
}

.chat-empty {
  margin: auto 0;
  padding: 14px 4px;
  color: #817b70;
  font-size: 0.85rem;
  text-align: center;
}

.chat-form {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 6px;
}

.chat-form input {
  width: 100%;
  min-width: 0;
}

.chat-form button {
  padding-inline: 10px;
}

.result-row {
  display: grid;
  grid-template-columns: 44px 1fr 130px;
  gap: 10px;
  min-height: 48px;
  padding: 10px;
  border: 1px solid #35322d;
  border-radius: 8px;
  background: #24231f;
}

.result-row strong {
  color: #ffd166;
}

.result-row span,
.result-row em {
  min-width: 0;
  overflow-wrap: anywhere;
}

.empty {
  padding: 16px;
  color: #b9b1a1;
  border: 1px dashed #3e3a33;
  border-radius: 8px;
}

@media (max-width: 980px) {
  .workspace {
    grid-template-columns: 1fr;
  }

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

  .identity {
    justify-content: stretch;
  }

  .identity input,
  .identity button {
    flex: 1;
  }

  .account-name {
    flex-basis: 100%;
  }

  .rooms-list {
    max-height: 280px;
  }

  .score-list {
    flex: none;
    max-height: 280px;
  }

  .chat-section {
    flex: none;
  }

  .chat-list {
    height: 220px;
  }

  .game-panel {
    overflow: visible;
  }

  .game-panel .chat-section {
    height: auto;
    min-height: 310px;
    margin-top: 0;
  }
}

@media (max-width: 620px) {
  #acronym.idle {
    font-size: 2.5rem;
  }

  .shell {
    padding: 10px;
  }

  .room-strip,
  .answer-form,
  .result-row {
    grid-template-columns: 1fr;
  }
}
