:root {
  --ink: #e7f7fb;
  --muted: #b7d0da;
  --line: rgba(180, 236, 255, 0.28);
  --cyan: #3ee0ff;
  --magenta: #ff4f9a;
  font-family: "Noto Sans KR", sans-serif;
  color: var(--ink);
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  min-height: 100%;
}

body {
  min-height: 100vh;
}

body::before {
  content: "";
  position: fixed;
  inset: -28px;
  z-index: 0;
  background: url("/assets/bg.jpg") center / cover no-repeat;
  filter: blur(16px) brightness(0.72) saturate(1.15);
  transform: scale(1.06);
}

#app {
  position: relative;
  z-index: 1;
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 22px 16px 32px;
}

button, input { font: inherit; color: inherit; }
button { cursor: pointer; }
h1, h2, h3 { font-family: "Gowun Batang", serif; margin: 0; font-weight: 700; }
.hidden { display: none !important; }

.panel {
  width: min(440px, 100%);
  background: rgba(4, 16, 26, 0.78);
  border: 1px solid var(--line);
  border-radius: 24px;
  box-shadow: 0 22px 60px rgba(0, 0, 0, 0.4);
  backdrop-filter: blur(10px);
  padding: 28px 24px;
}

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

.mark {
  width: 84px;
  height: 84px;
  object-fit: cover;
  border-radius: 20px;
  border: 1px solid var(--line);
}

.eyebrow {
  margin: 12px 0 0;
  letter-spacing: 0.16em;
  font-size: 12px;
  color: var(--cyan);
  font-weight: 700;
}

.lead, .me, .empty, .hint {
  color: var(--muted);
  line-height: 1.55;
}

label { display: grid; gap: 6px; margin: 16px 0; font-weight: 700; }

input {
  border: 1px solid var(--line);
  background: rgba(2, 10, 16, 0.65);
  border-radius: 12px;
  padding: 12px 14px;
}

.primary, .ghost {
  border-radius: 999px;
  padding: 12px 16px;
  border: 1px solid transparent;
  font-weight: 700;
}

.primary {
  background: linear-gradient(180deg, #7af0ff, #14b7d6);
  color: #042028;
}

.primary:disabled { opacity: 0.45; cursor: default; }

.ghost {
  background: transparent;
  border-color: var(--line);
  color: var(--ink);
}

.row, .create-row, .actions {
  display: flex;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
}

.row { justify-content: space-between; }
.create-row { margin: 14px 0; }
.create-row input { flex: 1; min-width: 180px; }
.actions { margin-top: 16px; }
.actions.center { justify-content: center; }

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

.rooms li {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: 14px;
  padding: 12px;
}

.rooms button {
  border: 0;
  background: #12323c;
  color: var(--ink);
  border-radius: 999px;
  padding: 8px 14px;
  font-weight: 700;
}

.rooms button:disabled { opacity: 0.45; }

.persons {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-top: 8px;
}

.person {
  min-height: 92px;
  padding: 14px;
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.04);
  display: grid;
  align-content: space-between;
  gap: 8px;
}

.person.left { box-shadow: inset 3px 0 0 var(--cyan); }
.person.right { box-shadow: inset -3px 0 0 var(--magenta); }
.person.me { outline: 1px solid rgba(62, 224, 255, 0.7); }
.person .who { font-weight: 700; }
.person .meta { color: var(--muted); font-size: 14px; }

.rules { margin-top: 14px; color: var(--muted); }
.rules summary { cursor: pointer; color: var(--ink); font-weight: 700; }
.rules ul { margin: 8px 0 0; padding-left: 18px; }

.stage {
  width: min(1080px, 96vw, calc((100vh - 168px) * 16 / 9));
}

.hud {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  gap: 12px;
  align-items: center;
  margin-bottom: 10px;
}

.hud .side {
  display: flex;
  gap: 10px;
  align-items: baseline;
  font-weight: 700;
}

.hud .side.right { justify-content: flex-end; }
.hud .side.left strong { color: var(--cyan); }
.hud .side.right strong { color: var(--magenta); }
.hud strong { font-family: "Gowun Batang", serif; font-size: 32px; }
.hud p { margin: 0; color: var(--muted); }

.frame {
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 9;
  background: url("/assets/bg.jpg") center / 100% 100% no-repeat;
  border-radius: 18px;
  box-shadow: 0 18px 50px rgba(0, 0, 0, 0.45);
  overflow: hidden;
}

.frame canvas {
  position: absolute;
  left: 19.6%;
  top: 19.15%;
  width: 61.5%;
  height: 60.15%;
  touch-action: none;
  cursor: crosshair;
}

.result {
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  width: min(320px, 70%);
  text-align: center;
  background: rgba(4, 14, 22, 0.88);
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 18px 16px;
}

.result p { color: var(--muted); }

.hint { text-align: center; margin: 10px 0 0; }

.toast {
  position: fixed;
  left: 50%;
  bottom: 18px;
  transform: translateX(-50%);
  z-index: 3;
  background: rgba(4, 12, 18, 0.92);
  border: 1px solid var(--line);
  color: var(--ink);
  border-radius: 999px;
  padding: 10px 16px;
  margin: 0;
}

@media (max-width: 640px) {
  .persons { grid-template-columns: 1fr; }
  .hud strong { font-size: 26px; }
}
