:root {
  color-scheme: light;
  font-family: Inter, "Microsoft YaHei", system-ui, sans-serif;
  color: #1f2933;
}

* {
  box-sizing: border-box;
}

body {
  background:
    linear-gradient(135deg, rgba(19, 50, 67, 0.9), rgba(36, 74, 84, 0.82)),
    repeating-linear-gradient(45deg, rgba(255, 255, 255, 0.08) 0 1px, transparent 1px 18px),
    #143241;
  margin: 0;
  min-height: 100vh;
}

button,
input,
select {
  border: 1px solid #c6cbd1;
  border-radius: 6px;
  font: inherit;
  min-height: 42px;
  padding: 0 12px;
}

button {
  background: #176b87;
  border-color: #176b87;
  color: white;
  cursor: pointer;
  font-weight: 700;
}

button.ghost {
  background: transparent;
  border-color: #c6cbd1;
  color: #31434f;
}

.shell {
  margin: 0 auto;
  max-width: 980px;
  padding: 48px 20px;
}

.gate,
.lobby,
.room-form,
.panel,
.game-room {
  background: white;
  border: 1px solid #d9dde2;
  border-radius: 8px;
  padding: 24px;
}

.gate form,
.room-form,
#ask-form {
  display: grid;
  gap: 12px;
}

.gate label {
  font-weight: 700;
}

.gate-error {
  color: #b42318;
  font-size: 14px;
  margin: 0;
}

.lobby-header,
.panel-heading {
  align-items: center;
  display: flex;
  justify-content: space-between;
  gap: 16px;
}

.lobby-header p,
.muted,
.copy-status {
  color: #687782;
  margin: 6px 0 0;
}

.action-grid {
  display: grid;
  gap: 12px;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  margin: 16px 0 20px;
}

.game-list {
  display: grid;
  gap: 10px;
  grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
  margin: 16px 0;
}

.game-choice {
  background: #f8fafb;
  border: 1px solid #d9dde2;
  border-radius: 8px;
  color: #1f2933;
  padding: 16px;
  text-align: left;
}

.game-choice.selected {
  background: #e8f3f7;
  border-color: #176b87;
  color: #0f556b;
}

.hidden {
  display: none;
}

.code-row {
  align-items: stretch;
  display: grid;
  gap: 0;
  grid-template-columns: minmax(0, 1fr) auto;
  margin-top: 14px;
  max-width: 420px;
}

.room-code {
  background: #101820;
  border-radius: 8px 0 0 8px;
  color: #f8fafb;
  font-size: clamp(20px, 5vw, 34px);
  font-weight: 800;
  letter-spacing: 0;
  padding: 14px 16px;
  text-align: left;
  word-break: break-all;
}

#copy-code {
  border-radius: 0 8px 8px 0;
  min-width: 76px;
}

.players-box {
  border: 1px solid #d9dde2;
  border-radius: 8px;
  margin-top: 18px;
  padding: 16px;
}

#ready-toggle {
  margin-top: 14px;
  width: 100%;
}

.players-box h4 {
  margin: 0;
}

.player-list {
  display: grid;
  gap: 8px;
  list-style: none;
  margin: 14px 0 0;
  padding: 0;
}

.player-list li {
  align-items: center;
  background: #f8fafb;
  border: 1px solid #e3e7eb;
  border-radius: 6px;
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 12px;
}

.player-list li.is-self {
  border-color: #176b87;
  color: #0f556b;
  font-weight: 700;
}

.ready-check {
  color: #079455;
  font-size: 20px;
  font-weight: 900;
  line-height: 1;
}

#host-test-action:disabled {
  cursor: not-allowed;
  opacity: 0.45;
}

pre {
  background: #101820;
  border-radius: 6px;
  color: #e8eef4;
  overflow: auto;
  padding: 14px;
  white-space: pre-wrap;
}

@media (max-width: 640px) {
  .code-row {
    grid-template-columns: 1fr;
  }

  .room-code {
    border-radius: 8px 8px 0 0;
  }

  #copy-code {
    border-radius: 0 0 8px 8px;
  }
}
