:root {
  --ink: #2a1a12;
  --red: #e23b2f;
  --sand: #fff6ec;
  --glass: rgba(255, 246, 236, 0.94);
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  height: 100%;
  background: #1a120e;
  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;
  background: #24160f;
  box-shadow: 0 24px 80px rgba(0, 0, 0, 0.45);
}

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

#overlay {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 24px;
  pointer-events: none;
}

#overlay .panel {
  pointer-events: auto;
}

.panel {
  width: min(440px, 100%);
  background: var(--glass);
  border-radius: 28px;
  padding: 22px 24px 18px;
  box-shadow: 0 18px 50px rgba(40, 16, 8, 0.28);
}

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

.title-panel {
  text-align: center;
}

.hero {
  width: 100%;
  height: 150px;
  object-fit: cover;
  border-radius: 18px;
  margin-bottom: 12px;
}

.eyebrow {
  margin: 0 0 4px;
  letter-spacing: 0.16em;
  font-size: 11px;
  font-weight: 800;
  color: var(--red);
}

h1,
h2 {
  font-family: "Jua", sans-serif;
  margin: 0 0 8px;
}

h1 {
  font-size: 56px;
  line-height: 1;
  color: #c43222;
}

.lead {
  margin: 0 0 14px;
  line-height: 1.5;
  color: #6d5348;
}

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

input {
  height: 46px;
  border: 0;
  border-radius: 14px;
  padding: 0 14px;
  font: inherit;
  background: #fff;
  box-shadow: inset 0 0 0 2px rgba(226, 59, 47, 0.2);
  outline: none;
}

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

button:disabled {
  opacity: 0.45;
  cursor: default;
}

.primary {
  width: 100%;
  background: linear-gradient(180deg, #ff6a4a, #d83224);
  color: white;
  box-shadow: 0 7px 0 #8e2418;
}

.primary + .primary {
  margin-top: 8px;
}

.ghost {
  background: transparent;
  color: #8a5a48;
  width: 100%;
  margin-top: 8px;
}

.hidden {
  display: none !important;
}

.lobby-head,
.create-row {
  display: flex;
  gap: 8px;
}

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

.create-row {
  margin-bottom: 12px;
}

.create-row input {
  flex: 1;
}

.create-row .primary {
  width: auto;
}

.me,
.empty {
  margin: 0;
  color: #8a5a48;
}

.empty {
  text-align: center;
}

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

.rooms li {
  display: grid;
  grid-template-columns: 1fr auto auto;
  gap: 10px;
  align-items: center;
  background: rgba(255, 255, 255, 0.72);
  border-radius: 16px;
  padding: 10px 12px;
}

.rooms .meta {
  font-size: 12px;
  color: #8a5a48;
}

.join {
  height: 36px;
  background: #2f9e78;
  color: white;
  border-radius: 10px;
}

.track-picker {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  margin-bottom: 12px;
}

.track-btn {
  height: auto;
  padding: 6px;
  background: white;
  border-radius: 14px;
  color: var(--ink);
}

.track-btn canvas {
  width: 100%;
  height: 68px;
  border-radius: 8px;
  display: block;
  background: #6d6a90;
}

.track-btn span {
  display: block;
  margin-top: 4px;
  font-size: 13px;
}

.track-btn.on {
  box-shadow: inset 0 0 0 3px var(--red);
}

.color-picker {
  display: flex;
  gap: 8px;
  margin-bottom: 12px;
}

.swatch {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  box-shadow: inset 0 0 0 2px rgba(0, 0, 0, 0.2);
}

.swatch.on {
  outline: 3px solid #2a1a12;
  outline-offset: 2px;
}

.wait-players {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 12px;
}

.chip {
  min-width: 120px;
  padding: 8px 10px;
  border-radius: 14px;
  background: white;
  font-weight: 800;
}

.chip .sub {
  display: block;
  margin-top: 2px;
  font-size: 11px;
  font-weight: 700;
  color: #8a5a48;
}

.chip.cpu {
  opacity: 0.7;
}

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

#hud button {
  pointer-events: auto;
}

.places {
  position: absolute;
  top: 12px;
  left: 12px;
  margin: 0;
  padding: 8px 10px;
  list-style: none;
  background: rgba(20, 12, 8, 0.72);
  color: white;
  border-radius: 12px;
  min-width: 140px;
}

.places li {
  display: flex;
  gap: 8px;
  align-items: center;
  font-weight: 800;
  font-size: 14px;
  padding: 2px 0;
}

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

.places .me {
  color: #ffd36a;
}

.board {
  position: absolute;
  top: 10px;
  right: 10px;
  background: #f7f4ee;
  border: 3px solid #161616;
  border-radius: 6px;
  padding: 6px 8px 8px;
  min-width: 210px;
}

.board-title {
  font-family: "Jua", sans-serif;
  text-align: center;
  color: #d42323;
  font-size: 28px;
  line-height: 1;
}

.board-time {
  text-align: center;
  font-weight: 900;
  font-size: 13px;
  margin-bottom: 4px;
}

.board-row {
  display: grid;
  grid-template-columns: 52px 1fr;
  align-items: center;
  gap: 6px;
  margin-top: 3px;
}

.board-row .k {
  font-size: 12px;
  font-weight: 900;
}

.cells {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 3px;
}

.cells span {
  display: grid;
  place-items: center;
  height: 22px;
  color: #111;
  font-weight: 900;
  font-size: 13px;
  border-radius: 2px;
}

.count {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  font-family: "Jua", sans-serif;
  font-size: 140px;
  color: white;
  text-shadow: 0 6px 0 rgba(0, 0, 0, 0.35);
}

.hud-bottom {
  position: absolute;
  left: 12px;
  right: 12px;
  bottom: 10px;
  display: flex;
  justify-content: space-between;
  align-items: end;
  gap: 12px;
}

.hint {
  margin: 0;
  color: white;
  font-weight: 700;
  text-shadow: 0 2px 0 rgba(0, 0, 0, 0.5);
}

.hud-bottom .ghost {
  width: auto;
  margin: 0;
  color: white;
  background: rgba(0, 0, 0, 0.35);
}

.result {
  list-style: none;
  margin: 0 0 12px;
  padding: 0;
  display: grid;
  gap: 6px;
}

.result li {
  display: grid;
  grid-template-columns: 28px 16px 1fr auto;
  gap: 8px;
  align-items: center;
  background: white;
  border-radius: 12px;
  padding: 8px 10px;
  font-weight: 800;
}

.toast {
  position: absolute;
  left: 50%;
  bottom: 18px;
  transform: translateX(-50%);
  background: #2a1a12;
  color: white;
  padding: 8px 14px;
  border-radius: 999px;
  font-weight: 700;
}
