:root {
  --ink: #2c2118;
  --paper: rgba(255, 248, 236, 0.94);
  --line: rgba(92, 62, 36, 0.28);
  --wood: #8d5a32;
  --shadow: 0 18px 44px rgba(20, 16, 8, 0.28);
  color: var(--ink);
  font-family: "Noto Sans KR", sans-serif;
}

* { box-sizing: border-box; }
body {
  margin: 0;
  min-height: 100vh;
  background: url("/assets/bg.jpg?v=1") center / cover no-repeat fixed;
}
button, input { font: inherit; }
button { cursor: pointer; }
h1, h2 { 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%);
  min-width: 0;
  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: 22px; }
.eyebrow {
  margin: 10px 0 0;
  letter-spacing: 0.22em;
  font-size: 12px;
  color: var(--wood);
}
.lead, .me, .empty { color: #5c4636; }
label { display: grid; gap: 6px; margin: 16px 0; font-weight: 700; }
input {
  min-width: 0;
  border: 1px solid var(--line);
  background: #fffaf3;
  border-radius: 12px;
  padding: 12px 14px;
  color: var(--ink);
}
.primary, .ghost {
  border-radius: 12px;
  padding: 12px 16px;
  border: 1px solid transparent;
}
.primary { background: #2f6a45; color: #f7f3ea; 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: #2f6a45;
  color: #f7f3ea;
  border-radius: 999px;
  padding: 8px 14px;
}
.rooms button:disabled { background: #b7a898; }
.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;
  vertical-align: -2px;
  box-shadow: inset 0 -2px 3px rgba(0, 0, 0, 0.28);
}
.swatch.black { background: radial-gradient(circle at 35% 35%, #5c5c5c, #111 70%); }
.swatch.white { background: radial-gradient(circle at 35% 35%, #fff, #d9d2c5 72%); border: 1px solid #c8bfb0; }
.rules { margin: 8px 0 16px; }
.rules ul { margin: 8px 0 0; padding-left: 18px; color: #5c4636; }

.play {
  width: min(1100px, 100%);
  min-width: 0;
  display: grid;
  grid-template-columns: minmax(280px, 680px) minmax(240px, 320px);
  gap: 18px;
  align-items: start;
}
.board-frame {
  background: rgba(62, 38, 20, 0.9);
  border-radius: 22px;
  padding: 14px;
  box-shadow: var(--shadow);
}
.board {
  display: grid;
  grid-template-columns: 1.5rem repeat(8, 1fr);
  grid-template-rows: 1.5rem repeat(8, 1fr);
  aspect-ratio: 1;
  width: 100%;
}
.label {
  display: grid;
  place-items: center;
  color: #f3e6d0;
  font-size: 12px;
  font-weight: 700;
}
.cell {
  display: grid;
  place-items: center;
  min-width: 0;
  min-height: 0;
  border: 1px solid rgba(62, 36, 18, 0.45);
  background: #d7b07a;
  padding: 0;
  appearance: none;
}
.cell.dark { background: #c4965c; }
.cell:disabled { cursor: default; }
.cell.hot:not(:disabled) { cursor: pointer; }
.cell.last { box-shadow: inset 0 0 0 3px rgba(232, 196, 92, 0.95); }
.disc {
  width: 78%;
  aspect-ratio: 1;
  border-radius: 50%;
  pointer-events: none;
}
.disc.black {
  background: radial-gradient(circle at 32% 30%, #6a6a6a, #1a1a1a 58%, #050505);
  box-shadow: inset 0 -4px 6px rgba(255, 255, 255, 0.08), 0 3px 4px rgba(0, 0, 0, 0.35);
}
.disc.white {
  background: radial-gradient(circle at 32% 30%, #fff, #efe8dc 60%, #cfc6b6);
  box-shadow: inset 0 -4px 6px rgba(90, 70, 40, 0.18), 0 3px 4px rgba(0, 0, 0, 0.28);
}
.cell.hot::after {
  content: "";
  width: 26%;
  aspect-ratio: 1;
  border-radius: 50%;
  background: rgba(20, 16, 12, 0.38);
}
.cell.hot.as-white::after { background: rgba(255, 250, 240, 0.72); }
.side {
  background: var(--paper);
  border-radius: 28px;
  padding: 18px;
  box-shadow: var(--shadow);
}
.scores { display: flex; gap: 14px; margin: 12px 0; }
.score { margin: 0; font-weight: 700; }
.score strong { font-family: "Gowun Batang", serif; font-size: 28px; }
.status { min-height: 1.4em; font-weight: 700; }
.log { margin: 12px 0 0; padding-left: 18px; color: #5c4636; max-height: 180px; overflow: auto; }
.player.turn { box-shadow: inset 0 0 0 2px #2f6a45; }
.toast {
  position: fixed;
  left: 50%;
  bottom: 18px;
  transform: translateX(-50%);
  background: #2f6a45;
  color: #f7f3ea;
  border-radius: 999px;
  padding: 10px 16px;
}

@media (max-width: 860px) {
  .play { grid-template-columns: 1fr; }
  #app { padding: 12px; }
  .row, .create-row, .actions { flex-wrap: wrap; }
  .row { align-items: flex-start; }
  .create-row input, .create-row button, .actions button { flex: 1 1 auto; }
}
