:root {
  --ink: #1c2818;
  --paper: rgba(255, 250, 242, 0.9);
  --line: rgba(72, 58, 28, 0.2);
  --seal: #9d3418;
  --shadow: 0 18px 44px rgba(20, 36, 12, 0.28);
  color: var(--ink);
  font-family: "Noto Sans KR", sans-serif;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  font-family: "Noto Sans KR", sans-serif;
  background:
    linear-gradient(180deg, rgba(16, 32, 14, 0.16), rgba(16, 32, 14, 0.4)),
    url("/assets/bg.jpg?v=1") center / cover no-repeat fixed;
}

button, input { font: inherit; color: inherit; }
button { cursor: pointer; }
h1, h2, .status, .wind-read, .sight {
  font-family: "Gowun Batang", serif;
  font-weight: 700;
  margin: 0;
}
h1 { font-size: 48px; letter-spacing: -0.04em; }
.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 {
  width: 84px;
  height: 84px;
  object-fit: cover;
  border-radius: 22px;
  box-shadow: 0 8px 18px rgba(20, 36, 12, 0.28);
}
.eyebrow {
  margin: 12px 0 0;
  letter-spacing: 0.16em;
  font-size: 12px;
  font-weight: 700;
  color: var(--seal);
}
.lead, .me, .empty, .hint, .legend, .last { color: #4d5a3e; line-height: 1.55; }
label { display: grid; gap: 6px; margin: 16px 0 8px; font-weight: 700; }
input[type="text"], input:not([type]) {
  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: #24331c; color: #f7f3e8; 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); }
.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: #24331c;
  color: #f7f3e8;
  border-radius: 999px;
  padding: 8px 14px;
  font-weight: 700;
}
.rooms button:disabled { opacity: 0.45; }
.wait-players, .scoreboard { 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;
}
.rules { margin: 8px 0 16px; }
.rules ul { margin: 8px 0 0; padding-left: 18px; color: #4d5a3e; }

.play {
  width: min(1080px, 100%);
  display: grid;
  grid-template-columns: minmax(280px, 1fr) minmax(280px, 380px);
  gap: 18px;
  align-items: center;
}
.range { text-align: center; }
.range .eyebrow { margin-bottom: 8px; }
.face {
  position: relative;
  width: min(420px, 78vw);
  aspect-ratio: 1;
  margin: 0 auto;
  border-radius: 50%;
  background:
    radial-gradient(circle at 50% 50%,
      #f0c53e 0 20%,
      #d23b32 20% 40%,
      #2a6ec4 40% 60%,
      #171717 60% 80%,
      #f6f1e6 80% 100%);
  box-shadow:
    inset 0 0 0 2px rgba(255, 255, 255, 0.35),
    0 0 0 14px #d7b56a,
    0 0 0 22px #8d6232,
    0 18px 36px rgba(20, 36, 12, 0.35);
}
.face::before {
  content: "";
  position: absolute;
  left: 6%;
  right: 6%;
  top: 50%;
  height: 1px;
  background: rgba(255, 255, 255, 0.28);
}
.stand {
  width: 28%;
  height: 22px;
  margin: 8px auto 0;
  background: linear-gradient(#c48a45, #6b431f);
  clip-path: polygon(18% 0, 82% 0, 100% 100%, 0 100%);
}
.sight { margin-top: 10px; font-size: 28px; color: #fffaf0; text-shadow: 0 2px 10px rgba(12, 24, 8, 0.55); }
.legend {
  margin: 6px 0 0;
  color: #f7f3e8;
  text-shadow: 0 1px 6px rgba(12, 24, 8, 0.65);
}
.arrow {
  position: absolute;
  top: 50%;
  left: 50%;
  z-index: 2;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 35%, #fff, #f4efe4 42%, #b7a27a);
  box-shadow: 0 0 0 2px #24180f, 0 2px 6px rgba(0, 0, 0, 0.4);
  transform: translate(-50%, -50%);
  pointer-events: none;
}
.arrow.ghost {
  background: rgba(255, 255, 255, 0.15);
  box-shadow: 0 0 0 2px #fff, 0 0 14px rgba(255, 248, 220, 0.95);
}
.arrow.miss { background: #6d6458; }
.pin {
  position: absolute;
  top: 8%;
  bottom: 8%;
  left: 50%;
  z-index: 3;
  width: 3px;
  background: #fffaf0;
  box-shadow: 0 0 8px rgba(255, 250, 240, 0.9);
  transform: translateX(-50%);
  pointer-events: none;
}
.mark {
  position: absolute;
  top: 50%;
  left: 50%;
  z-index: 2;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: #fff6c8;
  box-shadow: 0 0 0 3px #9a6a12;
  transform: translate(-50%, -50%);
  pointer-events: none;
}

.side {
  padding: 22px 20px;
  max-height: calc(100vh - 48px);
  overflow: auto;
}
.wind {
  margin-top: 12px;
  padding: 12px 14px;
  border-radius: 16px;
  background:
    linear-gradient(90deg, rgba(42, 110, 196, 0.16), rgba(240, 197, 62, 0.28));
}
.wind-kicker { margin: 0; font-size: 12px; letter-spacing: 0.14em; font-weight: 700; color: var(--seal); }
.wind-read { font-size: 34px; }
.status { margin-top: 12px; font-size: 26px; }
.last { margin: 6px 0 0; }
.player {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 4px 10px;
  align-items: center;
}
.player .who { display: flex; gap: 8px; align-items: baseline; }
.player .who span { color: #66735a; font-size: 13px; }
.player.you { box-shadow: inset 0 0 0 1px rgba(157, 52, 24, 0.35); }
.player.turn { outline: 2px solid var(--seal); }
.player.win { background: rgba(240, 197, 62, 0.55); }
.pips { display: flex; gap: 6px; }
.pips span {
  min-width: 28px;
  text-align: center;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.72);
  font-weight: 700;
  font-size: 13px;
}
.player b {
  font-family: "Gowun Batang", serif;
  font-size: 26px;
}
.aim label { margin-top: 12px; }
input[type="range"] { width: 100%; accent-color: #9d3418; }
.scale {
  display: flex;
  justify-content: space-between;
  color: #66735a;
  font-size: 12px;
}
.hint { margin: 8px 0 12px; font-size: 13px; }
.side .actions { margin-top: 8px; }

.toast {
  position: fixed;
  left: 50%;
  bottom: 18px;
  transform: translateX(-50%);
  margin: 0;
  padding: 10px 16px;
  border-radius: 999px;
  background: rgba(28, 24, 16, 0.92);
  color: #fff8ef;
  z-index: 5;
}

@media (max-width: 800px) {
  h1 { font-size: 38px; }
  .play { grid-template-columns: 1fr; }
  .side { max-height: none; }
  .wind-read, .status { font-size: 26px; }
}
