:root {
  --ink: #2c2118;
  --paper: rgba(255, 248, 239, 0.92);
  --line: rgba(90, 58, 36, 0.22);
  --seal: #9c3428;
  --shadow: 0 18px 48px 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: url("/assets/bg.jpg") center / cover no-repeat fixed;
}
button, input { font: inherit; color: inherit; }
button { cursor: pointer; }
h1, h2, .status { font-family: "Gowun Batang", serif; font-weight: 700; margin: 0; }
h1 { font-size: 46px; letter-spacing: -0.03em; }
.hidden { display: none !important; }

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

.panel, .side {
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 28px;
  box-shadow: var(--shadow);
  backdrop-filter: blur(8px);
}
.panel { width: min(440px, 100%); padding: 28px 24px; }
.panel.wide { width: min(720px, 100%); }
.mark {
  display: block;
  width: 84px;
  height: 84px;
  object-fit: cover;
  border-radius: 22px;
  box-shadow: 0 8px 18px rgba(42, 24, 12, 0.25);
}
.eyebrow {
  margin: 12px 0 0;
  letter-spacing: 0.18em;
  font-size: 12px;
  font-weight: 700;
  color: var(--seal);
}
.lead, .me, .empty { color: #5c4636; line-height: 1.55; }
label { display: grid; gap: 6px; margin: 16px 0; font-weight: 700; }
input {
  border: 1px solid var(--line);
  background: rgba(255, 252, 247, 0.9);
  border-radius: 12px;
  padding: 12px 14px;
}
.primary, .ghost {
  border-radius: 12px;
  padding: 12px 16px;
  border: 1px solid transparent;
}
.primary { background: #2a211c; color: #fff8ef; font-weight: 700; }
.primary:hover { filter: brightness(1.12); }
.primary:disabled { opacity: 0.45; cursor: default; filter: none; }
.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; min-width: 0; 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, 252, 247, 0.78);
  border-radius: 14px;
  padding: 12px;
}
.rooms li div { display: grid; gap: 2px; }
.rooms button { border: 0; background: #2a211c; color: #fff8ef; border-radius: 999px; padding: 8px 14px; font-weight: 700; }
.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, 252, 247, 0.78);
  border-radius: 14px;
  padding: 10px 12px;
}
.who { display: flex; align-items: center; gap: 8px; }
.dot {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  display: inline-block;
  flex: none;
}
.dot.black {
  background: radial-gradient(circle at 32% 30%, #666, #161616 62%, #000);
  box-shadow: inset 0 -1px 2px rgba(255, 255, 255, 0.25);
}
.dot.white {
  background: radial-gradient(circle at 32% 30%, #fff, #efeae2 70%);
  box-shadow: inset 0 0 0 1px rgba(80, 60, 40, 0.25);
}
.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(280px, 720px) minmax(240px, 320px);
  gap: 16px;
  align-items: start;
}
.board-card {
  background:
    radial-gradient(ellipse at 18% 0%, rgba(255, 236, 204, 0.45), transparent 42%),
    repeating-linear-gradient(90deg, rgba(92, 52, 20, 0.05) 0 1px, transparent 1px 7px),
    linear-gradient(160deg, #e4c48b 0%, #d09a52 46%, #b67d38 100%);
  border-radius: 22px;
  padding: 14px;
  box-shadow: var(--shadow), inset 0 1px 0 rgba(255, 248, 236, 0.45);
}
.table {
  display: grid;
  grid-template-columns: 1.35rem 1fr;
  grid-template-rows: 1.15rem 1fr;
  gap: 2px;
}
.col-labels, .row-labels { display: grid; color: #4e3826; font-size: 11px; font-weight: 700; }
.col-labels { grid-template-columns: repeat(15, 1fr); }
.row-labels { grid-template-rows: repeat(15, 1fr); }
.col-labels span, .row-labels span { display: grid; place-items: center; }
.goban {
  display: grid;
  grid-template-columns: repeat(15, 1fr);
  grid-template-rows: repeat(15, 1fr);
  aspect-ratio: 1;
  width: 100%;
  user-select: none;
  touch-action: manipulation;
}
.cross {
  position: relative;
  border: 0;
  background: transparent;
  padding: 0;
}
.cross .h, .cross .v, .star, .stone, .last { position: absolute; pointer-events: none; }
.cross .h {
  top: 50%;
  left: 50%;
  right: -50%;
  height: 1.5px;
  background: #2b2118;
  transform: translateY(-50%);
}
.cross .v {
  left: 50%;
  top: 50%;
  bottom: -50%;
  width: 1.5px;
  background: #2b2118;
  transform: translateX(-50%);
}
.cross.edge-r .h, .cross.edge-b .v { display: none; }
.star {
  left: 50%;
  top: 50%;
  width: 16%;
  height: 16%;
  transform: translate(-50%, -50%);
  border-radius: 50%;
  background: #2b2118;
}
.stone {
  inset: 9%;
  border-radius: 50%;
  z-index: 1;
}
.stone.black {
  background: radial-gradient(circle at 32% 28%, #6d6d6d 0%, #2a2a2a 36%, #111 68%, #050505 100%);
  box-shadow: inset 0 -2px 3px rgba(255, 255, 255, 0.16), 0 2px 3px rgba(0, 0, 0, 0.4);
}
.stone.white {
  background: radial-gradient(circle at 32% 28%, #fff 0%, #f4f0e8 46%, #ddd6ca 100%);
  box-shadow: inset 0 -2px 3px rgba(90, 70, 40, 0.16), 0 2px 3px rgba(0, 0, 0, 0.28);
}
.stone.ghost { opacity: 0.42; }
.last {
  left: 50%;
  top: 50%;
  width: 22%;
  height: 22%;
  transform: translate(-50%, -50%);
  border-radius: 50%;
  background: #e24b3a;
  z-index: 2;
  box-shadow: 0 0 0 1px rgba(255, 248, 239, 0.7);
}
.cross.live { cursor: pointer; }
.side { padding: 18px; }
.status { min-height: 1.5em; font-size: 28px; line-height: 1.35; margin-top: 8px; }
.player.turn { box-shadow: inset 0 0 0 2px var(--seal); }
.player.you { background: rgba(255, 244, 230, 0.95); }
.log { margin: 12px 0 0; padding-left: 18px; color: #5c4636; max-height: 180px; overflow: auto; }
.toast {
  position: fixed;
  left: 50%;
  bottom: 18px;
  transform: translateX(-50%);
  background: rgba(42, 28, 20, 0.94);
  color: #fff6ea;
  border-radius: 999px;
  padding: 10px 16px;
  z-index: 5;
}

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