:root {
  --ink: #2a241c;
  --muted: #5c5146;
  --paper: rgba(255, 249, 240, 0.9);
  --line: rgba(42, 36, 28, 0.16);
  --seal: #8c3a2f;
  --shadow: 0 18px 40px rgba(48, 36, 24, 0.18);
  color: var(--ink);
  font-family: "Noto Sans KR", sans-serif;
  background-image: url("/assets/bg.jpg?v=1");
  background-position: center;
  background-size: cover;
  background-repeat: no-repeat;
  background-attachment: fixed;
}

* { box-sizing: border-box; }
html, body { min-height: 100%; }
body { margin: 0; }
button, input { font: inherit; color: inherit; }
button { cursor: pointer; }
button:disabled { opacity: 0.45; cursor: default; }
:focus-visible { outline: 2px solid #6b4a32; outline-offset: 2px; }
h1, h2, .need-char, .used li, .result {
  font-family: "Gowun Batang", serif;
  font-weight: 700;
}
h1, h2 { margin: 0; font-weight: 400; }
h1 { font-size: 40px; }
.hidden { display: none !important; }

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

.panel, .sheet, .side {
  background: var(--paper);
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
}

.panel {
  width: min(440px, 100%);
  border-radius: 28px;
  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;
  font-weight: 700;
  color: var(--seal);
}
.lead, .me, .empty, .rules { color: var(--muted); }
label { display: grid; gap: 6px; margin: 16px 0; font-weight: 700; }
input {
  border: 1px solid var(--line);
  background: rgba(255, 252, 247, 0.92);
  border-radius: 12px;
  padding: 12px 14px;
}
.primary, .ghost {
  border-radius: 12px;
  padding: 12px 16px;
  border: 1px solid transparent;
}
.primary { background: var(--ink); color: #f6f0e4; font-weight: 700; }
.ghost { background: transparent; border-color: var(--line); }
.row, .create-row, .actions, .word-form { display: flex; gap: 10px; align-items: center; }
.row { justify-content: space-between; }
.create-row, .word-form { margin: 12px 0; }
.create-row input, .word-form input { flex: 1; margin: 0; }
.actions { flex-wrap: wrap; }
.rooms { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.rooms li, .person, .player {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
  background: rgba(255, 252, 247, 0.72);
  border-radius: 14px;
  padding: 12px;
}
.rooms button {
  border: 0;
  background: var(--ink);
  color: #f6f0e4;
  border-radius: 999px;
  padding: 8px 14px;
}
.wait-players, .players { display: grid; gap: 8px; margin: 14px 0; }
.rules { margin: 8px 0 16px; }
.rules ul { margin: 8px 0 0; padding-left: 18px; }

.play {
  width: min(1040px, 100%);
  display: grid;
  grid-template-columns: minmax(280px, 1.4fr) minmax(240px, 0.8fr);
  gap: 16px;
  align-items: start;
}
.sheet, .side { border-radius: 28px; padding: 22px; }
.need-label, .prev-word, .timer-num, .status { text-align: center; }
.need-label { margin: 18px 0 0; color: var(--muted); font-weight: 700; }
.need-char {
  width: 124px;
  height: 124px;
  margin: 10px auto;
  display: grid;
  place-items: center;
  border: 3px solid var(--ink);
  border-radius: 50%;
  font-size: 68px;
  line-height: 1;
  background: rgba(255, 250, 242, 0.55);
}
.need-char.open { font-size: 36px; }
.prev-word { margin: 0 0 12px; min-height: 1.4em; }
.timer {
  height: 8px;
  border-radius: 999px;
  background: rgba(42, 36, 28, 0.12);
  overflow: hidden;
}
#timerBar {
  display: block;
  height: 100%;
  width: 100%;
  transform-origin: left center;
  background: var(--ink);
}
.timer-num {
  margin: 8px 0 0;
  font-variant-numeric: tabular-nums;
  font-weight: 700;
}
.status { min-height: 1.5em; font-weight: 700; }
.result {
  margin: 8px 0;
  text-align: center;
  font-size: 32px;
}
.result.win { color: var(--ink); }
.result.lose { color: var(--seal); }
.used, .log { list-style: none; margin: 0; padding: 0; }
.used { display: flex; flex-wrap: wrap; gap: 8px; }
.used li, .log li {
  background: rgba(255, 252, 247, 0.78);
  border-radius: 999px;
  padding: 6px 12px;
}
.used li.latest { box-shadow: inset 0 0 0 1.5px var(--ink); }
.log { display: grid; gap: 6px; margin-top: 12px; max-height: 240px; overflow: auto; }
.log li { border-radius: 12px; }
.player { align-items: flex-start; }
.player .who { display: grid; }
.player .meta { color: var(--muted); font-size: 13px; }
.player.turn { box-shadow: inset 0 0 0 2px var(--ink); }
.player.out { opacity: 0.48; }
.toast {
  position: fixed;
  left: 50%;
  bottom: 24px;
  transform: translateX(-50%);
  margin: 0;
  background: var(--ink);
  color: #f6f0e4;
  border-radius: 999px;
  padding: 12px 16px;
  box-shadow: var(--shadow);
}

@media (max-width: 800px) {
  .play { grid-template-columns: 1fr; }
  h1 { font-size: 34px; }
  .need-char { width: 104px; height: 104px; font-size: 56px; }
}
