:root {
  --ink: #3d2a1c;
  --paper: rgba(255, 248, 236, 0.92);
  --line: rgba(120, 78, 42, 0.28);
  --red: #b4332a;
  --gold: #e0a106;
  --shadow: 0 18px 40px rgba(40, 24, 10, 0.28);
  color: var(--ink);
  font-family: "Noto Sans KR", sans-serif;
  background: url("/assets/bg.jpg") center / cover fixed;
}

* { box-sizing: border-box; }
body { margin: 0; min-height: 100vh; }
button, input { font: inherit; }
button { cursor: pointer; }
h1, h2, .status {
  font-family: "Gowun Batang", serif;
  font-weight: 700;
  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: 28px;
  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.22em;
  font-size: 12px;
  color: var(--red);
}
.lead, .me, .empty { color: #5c4636; }
label { display: grid; gap: 6px; margin: 16px 0; font-weight: 700; }
input {
  border: 1px solid var(--line);
  background: rgba(255, 250, 242, 0.96);
  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: #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; }
.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: rgba(255, 250, 242, 0.8);
  border-radius: 14px;
  padding: 12px;
}
.rooms button { border: 0; background: var(--red); color: #fffaf2; border-radius: 999px; padding: 8px 14px; }
.rooms button:disabled { opacity: 0.45; }
.wait-players, .players { display: grid; gap: 8px; margin: 14px 0; }
.person, .player {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  align-items: center;
  background: rgba(255, 250, 242, 0.76);
  border-radius: 14px;
  padding: 10px 12px;
}
.player.turn { outline: 2px solid var(--gold); }
.swatch { width: 14px; height: 14px; border-radius: 50%; display: inline-block; margin-right: 6px; vertical-align: -1px; }
.rules { margin: 8px 0 16px; }
.rules ul { margin: 8px 0 0; padding-left: 18px; color: #5c4636; }

.play {
  width: min(1080px, 100%);
  display: grid;
  grid-template-columns: minmax(280px, 640px) minmax(240px, 320px);
  gap: 18px;
  align-items: start;
}
.board-wrap { width: 100%; }
.columns {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 8px;
  margin-bottom: 8px;
}
.col-btn {
  border: 0;
  border-radius: 12px;
  padding: 8px 0;
  background: rgba(255, 248, 236, 0.88);
  color: var(--ink);
  font-weight: 700;
}
.col-btn:disabled { opacity: 0.4; }
.board {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 8px;
  padding: 14px;
  border-radius: 28px;
  background:
    linear-gradient(180deg, rgba(92, 58, 32, 0.2), rgba(62, 36, 18, 0.28)),
    url("/assets/bg.jpg") center / cover;
  box-shadow: var(--shadow);
}
.cell {
  aspect-ratio: 1;
  border: 0;
  border-radius: 50%;
  padding: 0;
  background: rgba(18, 48, 32, 0.55);
  box-shadow: inset 0 6px 10px rgba(0, 0, 0, 0.35);
  display: grid;
  place-items: center;
}
.cell:disabled { cursor: default; }
.disc {
  width: 78%;
  height: 78%;
  border-radius: 50%;
  display: block;
  box-shadow: inset 0 -6px 8px rgba(0, 0, 0, 0.25), 0 4px 6px rgba(0, 0, 0, 0.25);
}
.disc.red { background: radial-gradient(circle at 35% 30%, #f0a090, #c0392b 55%, #7d1d16); }
.disc.yellow { background: radial-gradient(circle at 35% 30%, #ffe08a, #e0a106 55%, #a86d08); }
.disc.last { outline: 3px solid rgba(255, 248, 236, 0.95); outline-offset: 2px; }
.disc.win { animation: pulse 0.9s ease-in-out infinite alternate; }
@keyframes pulse { from { transform: scale(0.92); } to { transform: scale(1); } }

.side {
  background: var(--paper);
  border-radius: 28px;
  padding: 18px;
  box-shadow: var(--shadow);
}
.status { font-size: 22px; margin: 10px 0; }
.log { margin: 12px 0 0; padding-left: 18px; color: #5c4636; }
.toast {
  position: fixed;
  left: 50%;
  bottom: 24px;
  transform: translateX(-50%);
  background: rgba(61, 42, 28, 0.92);
  color: #fffaf2;
  border-radius: 999px;
  padding: 10px 16px;
}

@media (max-width: 800px) {
  .play { grid-template-columns: 1fr; }
  .row, .create-row, .actions { flex-wrap: wrap; }
}
