:root {
  --ink: #5a4032;
  --paper: #fff6ea;
  --line: rgba(196, 140, 110, 0.35);
  --red: #e07a68;
  --shadow: 0 16px 40px rgba(120, 72, 40, 0.18);
  color: var(--ink);
  font-family: "Noto Sans KR", sans-serif;
  background: #f3e0c4 url("/assets/table.jpg?v=3") center / cover fixed;
}

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

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

.panel {
  width: min(440px, 100%);
  background: rgba(255, 246, 234, 0.94);
  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: #fffaf2;
  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: #e07a68; color: #fffaf2; border-radius: 999px; padding: 8px 14px; }
.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;
}
.swatch { width: 14px; height: 14px; border-radius: 50%; display: inline-block; margin-right: 6px; }
.rules { margin: 8px 0 16px; }
.rules ul { margin: 8px 0 0; padding-left: 18px; color: #5c4636; }

.play {
  width: min(1180px, 100%);
  display: grid;
  grid-template-columns: minmax(280px, 680px) minmax(260px, 360px);
  gap: 18px;
  align-items: start;
}
.board-wrap { width: 100%; }
.board {
  position: relative;
  width: 100%;
  aspect-ratio: 1;
  background: url("/assets/board.jpg?v=3") center / cover;
  border-radius: 40px;
  overflow: hidden;
  box-shadow: var(--shadow);
}
.tracks {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
}
#pieces { position: absolute; inset: 0; }
.spot {
  position: absolute;
  width: 11%;
  height: 13%;
  transform: translate(-50%, -100%);
  border: 0;
  background: transparent;
  padding: 0;
}
.spot img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  filter: drop-shadow(0 6px 4px rgba(0, 0, 0, 0.35));
  pointer-events: none;
}
.spot .count {
  position: absolute;
  right: 0;
  top: 8%;
  min-width: 1.3em;
  background: #e07a68;
  color: #fffaf2;
  border-radius: 999px;
  font-size: 12px;
  line-height: 1.3;
}
.spot.hot { outline: 3px solid rgba(224, 122, 104, 0.9); outline-offset: -6px; border-radius: 12px; }
.side {
  background: rgba(255, 246, 234, 0.94);
  border-radius: 28px;
  padding: 18px;
  box-shadow: var(--shadow);
}
.sticks { display: flex; flex-wrap: wrap; gap: 6px; min-height: 42px; align-items: center; margin: 8px 0; }
.sticks img { height: 18px; width: auto; max-width: 68px; transform: rotate(var(--tilt)); }
.sticks strong { margin-left: 6px; font-family: "Jua", sans-serif; font-weight: 400; font-size: 28px; }
.pending { display: flex; flex-wrap: wrap; gap: 6px; }
.pending button, .token {
  border: 1px solid var(--line);
  background: #fffaf2;
  border-radius: 999px;
  padding: 6px 10px;
}
.pending button.on { background: var(--red); color: #fffaf2; border-color: var(--red); }
.pending button:disabled { opacity: 0.4; }
.bases { display: flex; gap: 4px; }
.token { width: 42px; height: 42px; padding: 2px; }
.token img { width: 100%; height: 100%; object-fit: contain; }
.token.hot { outline: 2px solid var(--red); }
.status { min-height: 1.4em; font-weight: 700; }
.log { margin: 12px 0 0; padding-left: 18px; color: #5c4636; max-height: 160px; overflow: auto; }
.player { flex-wrap: wrap; }
.player > div:first-child { display: flex; justify-content: space-between; width: 100%; gap: 8px; }
.player.turn { box-shadow: inset 0 0 0 2px var(--red); }
.toast {
  position: fixed;
  left: 50%;
  bottom: 18px;
  transform: translateX(-50%);
  background: #e07a68;
  color: #fffaf2;
  border-radius: 999px;
  padding: 10px 16px;
}

@media (max-width: 860px) {
  .play { grid-template-columns: 1fr; }
  #app { padding: 12px; }
}
