:root {
  --ink: #2a2118;
  --paper: rgba(255, 247, 238, 0.9);
  --line: rgba(90, 58, 36, 0.2);
  --ember: #d24b24;
  --moss: #2f6a4a;
  --shadow: 0 18px 50px rgba(42, 24, 12, 0.28);
  color: var(--ink);
  font-family: "Noto Sans KR", sans-serif;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  min-height: 100vh;
  background-image: url("/assets/bg.jpg?v=1");
  background-size: cover;
  background-position: center;
  background-attachment: fixed;
  background-repeat: no-repeat;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  background:
    radial-gradient(ellipse at 72% 38%, rgba(255, 196, 120, 0.2), transparent 52%),
    linear-gradient(180deg, rgba(28, 18, 12, 0.08), rgba(28, 18, 12, 0.42));
}

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

#app {
  position: relative;
  z-index: 1;
  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: 28px;
  box-shadow: var(--shadow);
  padding: 28px 24px;
  backdrop-filter: blur(8px);
}
.panel.wide { width: min(720px, 100%); }
.mark {
  width: 84px;
  height: 84px;
  object-fit: cover;
  border-radius: 22px;
  box-shadow: 0 8px 18px rgba(42, 24, 12, 0.25);
}
.eyebrow {
  margin: 10px 0 0;
  letter-spacing: 0.18em;
  font-size: 12px;
  font-weight: 700;
  color: var(--ember);
}
.lead, .me, .empty, .hint { color: #5c4636; }
.hint { margin: 0 0 12px; font-size: 13px; }
label { display: grid; gap: 6px; margin: 16px 0; font-weight: 700; }
input {
  border: 1px solid var(--line);
  background: rgba(255, 250, 244, 0.92);
  border-radius: 12px;
  padding: 12px 14px;
  color: var(--ink);
}
.primary, .ghost {
  border-radius: 12px;
  padding: 12px 16px;
  border: 1px solid transparent;
}
.primary { background: var(--ember); color: #fffaf2; 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; flex-wrap: wrap; }
.row { justify-content: space-between; }
.create-row { margin: 12px 0; }
.create-row input { flex: 1; margin: 0; min-width: 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: rgba(255, 250, 244, 0.78);
  border-radius: 14px;
  padding: 12px;
}
.rooms button {
  border: 0;
  background: var(--ember);
  color: #fffaf2;
  border-radius: 999px;
  padding: 8px 14px;
}
.rooms button:disabled { opacity: 0.45; }
.wait-players { display: grid; gap: 8px; margin: 14px 0; }
.person, .seat {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  align-items: center;
  background: rgba(255, 250, 244, 0.82);
  border-radius: 16px;
  padding: 10px 12px;
}
.swatch {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  display: inline-block;
  margin-right: 6px;
  vertical-align: -2px;
}
.rules { margin: 8px 0 16px; }
.rules ul { margin: 8px 0 0; padding-left: 18px; color: #5c4636; }

.play {
  width: min(1120px, 100%);
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(260px, 320px);
  gap: 16px;
  align-items: stretch;
}
.stage {
  min-height: 520px;
  display: grid;
  grid-template-rows: auto 1fr auto;
  justify-items: center;
  align-items: center;
  gap: 14px;
  padding: 8px;
}
.result {
  margin: 0;
  padding: 10px 16px;
  border-radius: 18px;
  background: rgba(36, 22, 14, 0.5);
  color: #fffaf3;
  font-size: 28px;
  text-align: center;
  text-shadow: 0 2px 12px rgba(20, 10, 4, 0.45);
}
.seats {
  width: 100%;
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  align-content: end;
  gap: 10px;
  align-self: end;
}
.seat {
  width: min(168px, 46%);
  min-height: 92px;
  flex-direction: column;
  align-items: flex-start;
  position: relative;
  border: 1px solid rgba(255, 247, 238, 0.35);
  box-shadow: 0 10px 24px rgba(42, 24, 12, 0.18);
}
.seat strong { font-size: 16px; }
.seat span, .seat em { font-style: normal; color: #6a5344; font-size: 13px; }
.seat.me { box-shadow: inset 0 0 0 2px rgba(210, 75, 36, 0.45); }
.seat.holder { outline: 3px solid var(--ember); background: rgba(255, 228, 210, 0.92); }
.seat.loser { outline: 3px solid #8a2a22; }
.seat.winner { outline: 3px solid var(--moss); }
.mini-bomb {
  position: absolute;
  right: 8px;
  bottom: 8px;
  width: 42px;
  height: 42px;
  object-fit: cover;
  border-radius: 50%;
}
.pass {
  position: relative;
  width: 168px;
  height: 168px;
  border: 0;
  padding: 0;
  border-radius: 50%;
  background: transparent;
}
.pass img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 50%;
  box-shadow: 0 14px 30px rgba(20, 10, 4, 0.4);
}
.pass span {
  position: absolute;
  left: 50%;
  bottom: 12px;
  transform: translateX(-50%);
  background: rgba(42, 24, 16, 0.82);
  color: #fff8f0;
  border-radius: 999px;
  padding: 4px 12px;
  font-size: 14px;
  font-weight: 700;
  white-space: nowrap;
}
.pass:disabled { cursor: default; }
.pass:disabled img { filter: saturate(0.7); }
.pass.hot img { animation: bob 1.6s ease-in-out infinite; }
.pass:focus-visible { outline: 3px solid #fff4e4; outline-offset: 4px; }
@keyframes bob {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-6px); }
}

.side {
  background: var(--paper);
  border-radius: 28px;
  padding: 18px;
  box-shadow: var(--shadow);
  backdrop-filter: blur(8px);
}
.status { font-weight: 700; min-height: 3em; }
.log { margin: 12px 0 0; padding-left: 18px; color: #5c4636; display: grid; gap: 4px; }
.toast {
  position: fixed;
  z-index: 2;
  left: 50%;
  bottom: 24px;
  transform: translateX(-50%);
  background: rgba(42, 24, 16, 0.92);
  color: #fffaf3;
  border-radius: 999px;
  padding: 10px 16px;
  margin: 0;
}

@media (max-width: 860px) {
  .play { grid-template-columns: 1fr; }
  .stage { min-height: 420px; }
  .result { font-size: 22px; }
  #app { padding: 12px; }
}

@media (prefers-reduced-motion: reduce) {
  .pass.hot img { animation: none; }
}
