* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  height: 100%;
  overflow: hidden;
  background: #12141c;
  color: #e8e8f0;
  font-family: system-ui, 'Segoe UI', sans-serif;
}

canvas {
  display: block;
  width: 100vw;
  height: 100vh;
}

[hidden] {
  display: none !important;
}

.overlay {
  position: fixed;
  z-index: 10;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(10, 11, 16, 0.75);
  backdrop-filter: blur(3px);
}

.panel {
  width: min(580px, calc(100vw - 32px));
  max-height: calc(100vh - 32px);
  overflow-y: auto;
  padding: 28px;
  background: #1d2030;
  border: 1px solid #343852;
  border-radius: 14px;
  text-align: center;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
}

h1 {
  margin: 0 0 6px;
  font-size: clamp(28px, 7vw, 38px);
  letter-spacing: 4px;
  color: #ff7a59;
}

h2 {
  margin: 18px 0 8px;
  font-size: 15px;
  text-transform: uppercase;
  letter-spacing: 2px;
  color: #9aa0c0;
}

.tagline {
  margin: 0 0 20px;
  color: #9aa0c0;
}

form {
  display: flex;
  gap: 8px;
}

input {
  flex: 1;
  min-width: 0;
  padding: 10px 12px;
  font-size: 16px;
  color: inherit;
  background: #12141c;
  border: 1px solid #343852;
  border-radius: 8px;
}

button {
  padding: 10px 18px;
  font-size: 16px;
  font-weight: 600;
  color: #12141c;
  background: #ff7a59;
  border: none;
  border-radius: 8px;
  cursor: pointer;
}

button:hover {
  background: #ff9575;
}

#start-btn,
#lobby-btn {
  width: 100%;
  margin-top: 14px;
}

ul {
  margin: 0;
  padding: 0;
  list-style: none;
}

#player-list li,
#gameover-scores li {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 6px 10px;
  margin: 4px 0;
  background: #12141c;
  border-radius: 6px;
  text-align: left;
}

.dot {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  flex: none;
}

.score {
  margin-left: auto;
  color: #9aa0c0;
}

.hint {
  margin: 10px 0 0;
  font-size: 13px;
  color: #9aa0c0;
}

.help {
  margin-top: 22px;
  font-size: 13px;
  line-height: 1.7;
  color: #9aa0c0;
}

#levelup {
  position: fixed;
  left: 50%;
  bottom: 24px;
  transform: translateX(-50%);
  width: min(760px, calc(100vw - 32px));
  pointer-events: none;
}

.levelup-title {
  margin-bottom: 8px;
  text-align: center;
  font-weight: 700;
  font-size: 18px;
  color: #ffe082;
  text-shadow: 0 2px 6px #000;
}

#choices {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 10px;
}

.choice {
  padding: 12px 14px;
  text-align: left;
  font-size: 14px;
  font-weight: 400;
  line-height: 1.4;
  color: #e8e8f0;
  background: rgba(29, 32, 48, 0.94);
  border: 1px solid #ffe08266;
  border-radius: 10px;
  pointer-events: auto;
}

.choice:hover {
  background: #2a2e45;
  border-color: #ffe082;
}

.choice b {
  display: block;
  margin-bottom: 4px;
  font-size: 15px;
  color: #ffe082;
}

.choice .key {
  float: right;
  padding: 0 6px;
  font-size: 12px;
  color: #12141c;
  background: #ffe082;
  border-radius: 4px;
}

#status {
  position: fixed;
  left: 50%;
  top: 40%;
  transform: translate(-50%, -50%);
  font-size: 22px;
  font-weight: 700;
  text-align: center;
  text-shadow: 0 2px 8px #000;
  pointer-events: none;
}

.classes {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 8px;
  margin-bottom: 16px;
}

.class-card {
  display: flex;
  gap: 10px;
  align-items: center;
  padding: 8px 10px;
  text-align: left;
  font-size: 12px;
  font-weight: 400;
  line-height: 1.35;
  color: #c5cae9;
  background: #12141c;
  border: 2px solid #343852;
}

.class-card:hover {
  background: #1a1d2b;
}

.class-card.selected {
  border-color: #ff7a59;
  background: #241c22;
}

.class-card b {
  font-size: 14px;
  color: #ffffff;
}

.class-card small {
  color: #ffb199;
}

.class-card canvas {
  flex: none;
  width: 48px;
  height: 48px;
  image-rendering: pixelated;
}

.cls {
  margin-left: 6px;
  color: #9aa0c0;
}

.records {
  margin: 0;
  padding: 0;
  list-style: none;
  font-size: 13px;
}

.records li {
  display: flex;
  gap: 6px;
  padding: 5px 10px;
  margin: 3px 0;
  text-align: left;
  background: #12141c;
  border-radius: 6px;
}

.records li.mine {
  background: #3a2f12;
  color: #ffe082;
}

.records li.empty {
  color: #6b7090;
}

.rank {
  margin: 0;
  font-size: 18px;
  font-weight: 700;
  color: #ffe082;
}
