:root {
  --ink: #1d2a1c;
  --muted: #3e5340;
  --paper: rgba(255, 251, 245, 0.9);
  --line: rgba(29, 42, 28, 0.14);
  --leaf: #2f7a3a;
  --berry: #c73b3b;
  color: var(--ink);
  font-family: "Noto Sans KR", sans-serif;
}

* { box-sizing: border-box; }
html, body { min-height: 100%; }
body {
  margin: 0;
  min-height: 100vh;
  background: url("/assets/bg.jpg") center / cover no-repeat fixed;
}
button, input { font: inherit; }
button { cursor: pointer; }
h1, h2 { font-family: "Gowun Batang", serif; margin: 0; }
.hidden { display: none !important; }

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

.panel {
  width: min(440px, 100%);
  background: var(--paper);
  border: 1px solid rgba(255, 255, 255, 0.55);
  border-radius: 22px;
  box-shadow: 0 18px 50px rgba(20, 40, 16, 0.28);
  backdrop-filter: blur(8px);
  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.18em;
  font-size: 12px;
  color: var(--berry);
  font-weight: 700;
}
.lead, .me, .empty, .status { color: var(--muted); }
label { display: grid; gap: 6px; margin: 16px 0; font-weight: 700; }
input {
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 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(--leaf); color: #fff; font-weight: 700; }
.primary:disabled { opacity: 0.45; cursor: default; }
.ghost { background: rgba(255, 255, 255, 0.55); 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, .person, .scoreboard li {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
  background: rgba(255, 255, 255, 0.82);
  border-radius: 14px;
  padding: 12px;
}
.rooms button {
  border: 0;
  background: var(--ink);
  color: #fff;
  border-radius: 10px;
  padding: 8px 12px;
}
.rooms button:disabled { opacity: 0.45; cursor: default; }
.wait-players, .scoreboard { display: grid; gap: 8px; margin: 14px 0; }
.scoreboard { list-style: none; margin: 0; padding: 0; }
.rules { margin: 8px 0 16px; }
.rules li { margin: 4px 0; }
.seat { font-weight: 700; }
.seat-0 { color: #c43636; }
.seat-1 { color: #1d6fbe; }
.seat-2 { color: #b47b00; }
.seat-3 { color: #6a3cbc; }
.dead { opacity: 0.55; }

.play {
  width: min(860px, 100%);
  display: grid;
  gap: 12px;
}
.play-top, .play-bottom {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: center;
  background: var(--paper);
  border-radius: 18px;
  padding: 12px 16px;
  backdrop-filter: blur(8px);
}
.play-bottom { align-items: end; }
.play-top h2, .play-top .eyebrow { margin: 0; }
.status { margin: 0; font-weight: 700; text-align: right; }
.board-wrap {
  position: relative;
  border-radius: 18px;
  overflow: hidden;
  box-shadow: 0 16px 40px rgba(20, 40, 16, 0.35);
}
canvas { width: 100%; height: auto; display: block; background: transparent; }
.result {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  align-content: center;
  gap: 8px;
  text-align: center;
  padding: 16px;
  background: rgba(18, 36, 16, 0.55);
  color: #fff;
}
.result .eyebrow { color: #ffe1a8; }
.result .ghost { color: #fff; border-color: rgba(255, 255, 255, 0.5); background: transparent; }
.hint { margin: 0; text-align: center; color: #fff; text-shadow: 0 1px 3px rgba(0, 0, 0, 0.65); }

.pad {
  display: grid;
  grid-template-columns: 72px 72px 72px;
  grid-template-areas:
    ". up ."
    "left down right";
  gap: 6px;
  flex: none;
}
.pad-btn {
  min-height: 52px;
  border: 0;
  border-radius: 14px;
  background: #234628;
  color: #fff;
  font-weight: 700;
  touch-action: manipulation;
}
.pad-btn.up { grid-area: up; }
.pad-btn.left { grid-area: left; }
.pad-btn.down { grid-area: down; }
.pad-btn.right { grid-area: right; }
.pad-btn:active { background: var(--leaf); }
.pad-btn:disabled { opacity: 0.4; cursor: default; }

.toast {
  position: fixed;
  left: 50%;
  bottom: 20px;
  transform: translateX(-50%);
  background: #1d2a1c;
  color: #fff;
  border-radius: 999px;
  padding: 10px 16px;
  margin: 0;
  z-index: 5;
}

@media (max-width: 720px) {
  #app { padding: 12px; }
  .play-top, .play-bottom, .actions, .row { flex-wrap: wrap; }
  .status { text-align: left; }
  .result .actions { justify-content: center; }
}
