:root {
  --ink: #1b2b33;
  --paper: rgba(244, 251, 255, 0.94);
  --line: rgba(27, 43, 51, 0.14);
  --red: #e23b3b;
  --shadow: 0 18px 50px rgba(20, 48, 72, 0.22);
  color: var(--ink);
  font-family: "Noto Sans KR", sans-serif;
  background: #c5ecff;
}

* { box-sizing: border-box; }
body { margin: 0; min-height: 100vh; }
button, input { font: inherit; }
button { cursor: pointer; }
h1, h2 { font-family: "Gowun Batang", serif; margin: 0; }
.hidden { display: none !important; }

#app { min-height: 100vh; display: grid; place-items: center; padding: 24px; }

.panel {
  width: min(440px, 100%);
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 22px;
  box-shadow: var(--shadow);
  padding: 28px 24px;
}
.panel.wide { width: min(720px, 100%); }
.mark { width: 84px; height: 84px; object-fit: cover; border-radius: 18px; }
.eyebrow {
  margin: 10px 0 0;
  letter-spacing: 0.18em;
  font-size: 12px;
  color: var(--red);
  font-weight: 700;
}
.lead, .me, .empty { color: #4d6570; }
label { display: grid; gap: 6px; margin: 16px 0; font-weight: 700; }
input {
  border: 1px solid var(--line);
  background: #fff;
  border-radius: 12px;
  padding: 12px 14px;
  color: var(--ink);
}
.primary, .ghost {
  border-radius: 12px;
  padding: 12px 16px;
  border: 1px solid transparent;
}
.primary { background: var(--red); color: #fff; font-weight: 700; }
.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; }
.row { justify-content: space-between; }
.create-row { margin: 12px 0; }
.create-row input { flex: 1; margin: 0; }
.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: #fff;
  border-radius: 14px;
  padding: 12px;
}
.rooms button { border: 0; background: var(--ink); color: #fff; border-radius: 10px; padding: 8px 12px; }
.wait-players { display: grid; gap: 8px; margin: 14px 0; }
.person {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  align-items: center;
  background: #fff;
  border-radius: 14px;
  padding: 10px 12px;
}
.swatch { width: 14px; height: 14px; border-radius: 50%; display: inline-block; margin-right: 6px; }
.rules { margin: 8px 0 16px; }
.rules li { margin: 4px 0; }

.play { width: min(980px, 100%); display: grid; gap: 10px; }
.stage-wrap { width: 100%; }
.stage {
  position: relative;
  width: 100%;
  aspect-ratio: 960 / 540;
  border-radius: 18px;
  overflow: hidden;
  box-shadow: var(--shadow);
  background: #8fd0ea;
}
canvas { width: 100%; height: 100%; display: block; touch-action: none; }
.result {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  align-content: center;
  gap: 8px;
  background: rgba(18, 32, 42, 0.46);
  color: #fff;
  text-align: center;
  padding: 20px;
}
.result .eyebrow { color: #ffd0c8; }
.result .ghost { color: #fff; border-color: rgba(255, 255, 255, 0.45); }
.pads { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.pad {
  height: 64px;
  border: 0;
  border-radius: 16px;
  background: #1b2b33;
  color: #fff;
  font-weight: 700;
  touch-action: none;
  user-select: none;
}
.pad.on { background: var(--red); }
.hint { margin: 0; text-align: center; color: #3e6274; font-size: 13px; }

.toast {
  position: fixed;
  left: 50%;
  bottom: 20px;
  transform: translateX(-50%);
  background: #1b2b33;
  color: #fff;
  border-radius: 999px;
  padding: 10px 16px;
  margin: 0;
}

@media (max-width: 640px) {
  #app { padding: 12px; }
  .hint { display: none; }
}
