:root {
  --sand: #f4d7b0;
  --ink: #2a1a12;
  --coral: #e85d4c;
  --teal: #1f8a7a;
  --gold: #f2b84b;
  --glass: rgba(255, 247, 232, 0.86);
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  height: 100%;
  background: #1a0f0a;
  color: var(--ink);
  font-family: "Noto Sans KR", sans-serif;
}

body {
  display: grid;
  place-items: center;
  min-height: 100%;
}

#stage {
  position: relative;
  width: min(100vw, calc(100vh * 16 / 9));
  height: min(100vh, calc(100vw * 9 / 16));
  overflow: hidden;
  box-shadow: 0 24px 80px rgba(0, 0, 0, 0.45);
}

#game {
  width: 100%;
  height: 100%;
  display: block;
  background: #f0c48a;
}

#overlay {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  background: linear-gradient(180deg, rgba(20, 10, 6, 0.18), rgba(20, 10, 6, 0.42));
  padding: 24px;
}

#overlay.dim {
  pointer-events: none;
  background: transparent;
}

#overlay.dim .panel {
  display: none !important;
}

.panel {
  width: min(520px, 100%);
  background: var(--glass);
  backdrop-filter: blur(14px);
  border: 1px solid rgba(255, 255, 255, 0.55);
  border-radius: 28px;
  padding: 28px 28px 24px;
  box-shadow: 0 18px 50px rgba(80, 30, 10, 0.22);
}

.panel.wide {
  width: min(640px, 100%);
}

.eyebrow {
  margin: 0 0 6px;
  letter-spacing: 0.18em;
  font-size: 12px;
  font-weight: 800;
  color: var(--teal);
}

h1,
h2 {
  font-family: "Jua", sans-serif;
  margin: 0 0 10px;
  letter-spacing: -0.02em;
}

h1 {
  font-size: 52px;
  color: #c4452d;
  text-shadow: 0 4px 0 rgba(255, 210, 140, 0.8);
}

.lead {
  margin: 0 0 22px;
  line-height: 1.55;
  color: #5a3b2a;
}

label {
  display: flex;
  flex-direction: column;
  gap: 8px;
  font-size: 13px;
  font-weight: 700;
  margin-bottom: 16px;
}

input {
  height: 48px;
  border: 0;
  border-radius: 14px;
  padding: 0 14px;
  font: inherit;
  background: #fff8ee;
  box-shadow: inset 0 0 0 2px rgba(232, 93, 76, 0.18);
  outline: none;
}

input:focus {
  box-shadow: inset 0 0 0 2px var(--coral);
}

button {
  font: inherit;
  font-weight: 800;
  border: 0;
  cursor: pointer;
  border-radius: 14px;
  height: 48px;
  padding: 0 18px;
}

.primary {
  width: 100%;
  background: linear-gradient(180deg, #ff7a66, #e24b3a);
  color: white;
  box-shadow: 0 8px 0 #b13327;
}

.primary:hover {
  filter: brightness(1.05);
}

.ghost {
  background: transparent;
  color: #7a4b38;
  height: auto;
  padding: 10px 12px;
}

.lobby-head {
  display: flex;
  justify-content: space-between;
  align-items: end;
  gap: 12px;
  margin-bottom: 16px;
}

.me {
  margin: 0;
  font-size: 14px;
}

.create-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px;
  margin-bottom: 16px;
}

.create-row .primary {
  width: auto;
  min-width: 132px;
}

.rooms {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-height: 280px;
  overflow: auto;
}

.rooms li {
  display: grid;
  grid-template-columns: 1fr auto auto;
  align-items: center;
  gap: 12px;
  background: #fff8ee;
  border-radius: 16px;
  padding: 12px 12px 12px 16px;
}

.rooms .meta {
  font-size: 13px;
  color: #7a4b38;
}

.rooms .join {
  height: 38px;
  background: var(--teal);
  color: white;
  box-shadow: 0 4px 0 #14685c;
}

.rooms .join:disabled {
  background: #cbb6a4;
  box-shadow: none;
  cursor: default;
}

.empty {
  margin: 8px 0 0;
  color: #7a4b38;
}

.wait-players {
  display: flex;
  gap: 10px;
  margin: 8px 0 18px;
}

.chip {
  background: #fff;
  border-radius: 999px;
  padding: 8px 14px;
  font-weight: 800;
}

.chip.ghost {
  opacity: 0.55;
}

#hud {
  position: absolute;
  inset: 0;
  pointer-events: none;
}

#hud .scoreboard {
  pointer-events: none;
  position: absolute;
  top: 18px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  align-items: center;
  gap: 22px;
  background: rgba(255, 247, 232, 0.88);
  border-radius: 999px;
  padding: 8px 22px;
  box-shadow: 0 10px 30px rgba(80, 30, 10, 0.2);
}

.scoreboard .side {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 900;
}

.scoreboard .pts {
  font-family: "Jua", sans-serif;
  font-size: 34px;
  min-width: 28px;
  text-align: center;
}

.scoreboard .left .pts {
  color: #d44832;
}

.scoreboard .right .pts {
  color: #5b3d9a;
}

.scoreboard .mid {
  font-family: "Jua", sans-serif;
  color: #c4452d;
}

.banner {
  position: absolute;
  top: 42%;
  left: 50%;
  transform: translate(-50%, -50%);
  font-family: "Jua", sans-serif;
  font-size: 64px;
  color: #fff;
  text-shadow: 0 6px 0 rgba(80, 20, 10, 0.35);
  letter-spacing: 0.04em;
}

#leaveGame {
  pointer-events: auto;
  position: absolute;
  right: 16px;
  top: 16px;
  background: rgba(255, 247, 232, 0.8);
  border-radius: 12px;
}

.hint {
  pointer-events: none;
  position: absolute;
  left: 50%;
  bottom: 14px;
  transform: translateX(-50%);
  margin: 0;
  padding: 6px 14px;
  border-radius: 999px;
  background: rgba(32, 16, 8, 0.45);
  color: #fff8ee;
  font-size: 13px;
  font-weight: 700;
  white-space: nowrap;
}

.hidden {
  display: none !important;
}

@media (max-width: 700px) {
  h1 {
    font-size: 40px;
  }
  .create-row {
    grid-template-columns: 1fr;
  }
  .banner {
    font-size: 42px;
  }
}
