﻿:root {
  color-scheme: light;
  --board: #21342c;
  --board-dark: #15231e;
  --paper: #f5e7c8;
  --paper-light: #fcf2d9;
  --ink: #34251a;
  --muted: #614b37;
  --brass: #9e783e;
  --gold: #e6ca8c;
  --wine: #853d32;
  --heading: "Batang", "AppleMyungjo", "Noto Serif CJK KR", "STIX Two Text", Georgia, serif;
  font-family: "Malgun Gothic", "Apple SD Gothic Neo", system-ui, sans-serif;
}
* { box-sizing: border-box; }
body {
  min-height: 100vh;
  margin: 0;
  padding-bottom: 38px;
  color: var(--ink);
  background: radial-gradient(ellipse at 40% 0%, #3c5748, transparent 65%),
    repeating-linear-gradient(115deg, #ffffff05 0 1px, transparent 1px 4px), var(--board-dark);
}
button, input, select { font: inherit; }
button { cursor: pointer; }
button:disabled { opacity: .62; cursor: default; }
[hidden] { display: none !important; }
body[data-mode="portal"] .host-only,
body[data-mode="host"] .portal-only { display: none; }
:focus-visible { outline: 3px solid #98511b; outline-offset: 3px; }
.shell { width: min(1040px, calc(100% - 56px)); margin-inline: auto; }
.top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 75px;
  gap: 10px;
  color: #f2dfb1;
  border-bottom: 3px double #a48d5e80;
}
.logo {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  font: 900 29px/1 var(--heading);
  letter-spacing: -.07em;
  color: inherit;
  text-decoration: none;
}
.logo:focus-visible { outline-color: var(--gold); }
.mark {
  display: inline-block;
  position: relative;
  width: 21px;
  height: 21px;
  margin: 0 6px 5px 1px;
  border: 3px double #ebcc86;
  border-radius: 50%;
  box-shadow: 0 0 0 1px #0c1812;
  background: #c1dfc929;
}
.mark::after {
  content: "";
  position: absolute;
  width: 11px;
  height: 5px;
  right: -9px;
  bottom: -4px;
  border-radius: 2px;
  background: #e2bc6d;
  transform: rotate(48deg);
}
.top-label { font-size: 13px; font-weight: 700; }
.top-label span { color: #ba9857; font-size: 9px; margin-inline: 5px; vertical-align: 2px; }
.entry { display: grid; grid-template-columns: 1.47fr 1fr; gap: 20px; margin-top: 28px; }
.card {
  background: radial-gradient(ellipse at 20% 15%, #fff7e4a8, transparent 65%),
    repeating-linear-gradient(0deg, #7d5c3410 0 1px, transparent 1px 5px), var(--paper);
  border: 1px solid #ba985a;
  border-radius: 12px;
  box-shadow: 0 7px 0 #101b15aa, inset 0 0 0 4px #ecd3a1, inset 0 0 0 5px #b99b624f;
}
.intro {
  overflow: hidden;
  padding: 7px;
  background: #463121;
  border-color: #b99751;
  box-shadow: 0 7px 0 #101b15aa, inset 0 0 0 1px #ebd29b6b;
}
.village {
  aspect-ratio: 2.65;
  border-radius: 6px 6px 0 0;
  background: linear-gradient(0deg, #38281b83, transparent 45%), url('/village.webp') center 36% / cover, #7a633e;
}
.intro-copy {
  position: relative;
  background: radial-gradient(ellipse at top, var(--paper-light), var(--paper));
  border: 3px double #a98046;
  border-radius: 0 0 6px 6px;
  padding: 19px 24px 22px;
}
h1, h2, h3 { font-family: var(--heading); font-weight: 900; letter-spacing: -.055em; overflow-wrap: anywhere; }
h1 { margin: 0; font-size: clamp(37px, 5.4vw, 64px); line-height: 1.04; color: #3b281a; }
h1 span { color: var(--wine); }
h2 { margin: 0 0 15px; font-size: clamp(24px, 3.4vw, 33px); line-height: 1.22; }
h3 { margin: 23px 0 9px; font-size: 19px; }
p { line-height: 1.6; word-break: keep-all; overflow-wrap: anywhere; }
.intro p { color: var(--muted); max-width: 450px; margin: 10px 0 0; font-size: 14px; }
.entry-card { display: flex; flex-direction: column; justify-content: center; padding: clamp(24px, 3.2vw, 36px); }
.entry-card h2, .roster h2 {
  color: var(--wine);
  padding-bottom: 12px;
  border-bottom: 3px double #b18d56;
  margin-bottom: 18px;
}
label { display: block; margin-bottom: 7px; color: var(--muted); font-size: 13px; font-weight: 800; }
input, select {
  width: 100%;
  min-width: 0;
  height: 46px;
  border: 1px solid #a17d48;
  border-radius: 6px;
  background: #fff7e3;
  box-shadow: inset 0 2px 3px #84582920;
  color: var(--ink);
  padding: 0 11px;
}
input::placeholder { color: #76604c; }
.button {
  min-height: 44px;
  padding: 9px 15px;
  border: 1px solid transparent;
  border-radius: 7px;
  font-weight: 800;
  box-shadow: inset 0 0 0 1px #ffedba54, 0 2px 0 #60432945;
  transition: filter .12s ease, transform .12s ease;
}
.button:hover:not(:disabled) { filter: brightness(1.09); }
.button:active:not(:disabled) { transform: translateY(1px); }
.primary { background: linear-gradient(#a35b49, #723026); border-color: #60291e; color: #fff5de; }
.secondary { background: linear-gradient(#47604e, #2b4436); border-color: #24392d; color: #fff6df; }
.ghost { background: #efe0bd; color: var(--muted); border-color: #a88b59; }
.entry-card [value="create"], .host-open { margin-top: 10px; width: 100%; display: flex; align-items: center; justify-content: space-between; }
.entry-card [value="create"] span, .host-open span { font: 700 23px/1 Georgia, serif; }
.host-help { color: var(--muted); font-size: 13px; }
.join { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 8px; }
#entry-code { text-transform: uppercase; letter-spacing: .10em; }
.divider { display: flex; align-items: center; gap: 10px; margin: 19px 0 15px; color: var(--muted); font-size: 12px; }
.divider::before, .divider::after { content: ""; height: 1px; flex: 1; background: #b79865; }
.error { color: #802c22; margin: 9px 0 0; font-size: 14px; overflow-wrap: anywhere; }
.error:empty { display: none; }
.rules {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  margin-top: 22px;
  border: 1px solid #b39159;
  border-radius: 9px;
  background: #283c32;
  color: #fbebc5;
  box-shadow: inset 0 0 0 3px #ffffff0e;
}
.rules > div { display: flex; align-items: center; padding: 15px; gap: 12px; }
.rules > div + div { border-left: 1px solid #a08b5f80; }
.rule-icon {
  flex: 0 0 31px;
  display: grid;
  place-items: center;
  aspect-ratio: 1;
  border: 3px double #b29356;
  border-radius: 50%;
  color: #ebcc89;
  font: 700 13px Georgia, serif;
}
.rules strong { font-size: 14px; }
.rules p { margin: 3px 0 0; color: #e8dab8; font-size: 13px; }
#room { margin-top: 24px; }
.room-bar { display: flex; justify-content: space-between; align-items: center; padding: 13px 20px; gap: 10px; }
.eyebrow { color: var(--muted); font-size: 13px; font-weight: 800; }
#room-code { display: block; color: var(--wine); font: 900 26px Georgia, serif; letter-spacing: .15em; }
.toolbar { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.invite-dialog { width: min(470px, calc(100% - 32px)); padding: 24px; color: var(--ink); }
.invite-dialog::backdrop { background: #121e18cc; }
.invite-dialog p { color: var(--muted); }
.invite-dialog .toolbar, #invite-link { margin-top: 9px; }
#invite-status:empty { display: none; }
#room-message { background: var(--paper-light); border-radius: 6px; padding: 7px 12px; }
.room-layout { display: grid; grid-template-columns: minmax(0, 2fr) minmax(245px, 1fr); align-items: start; gap: 16px; margin-top: 17px; }
.stage, .roster { padding: clamp(19px, 3vw, 28px); min-width: 0; overflow-wrap: anywhere; }
.stage-heading { display: flex; align-items: center; flex-wrap: wrap; justify-content: space-between; gap: 8px; padding-bottom: 10px; border-bottom: 3px double #b18d56; margin-bottom: 15px; }
.phase-track { list-style: none; padding: 0; margin: 0; display: flex; flex-wrap: wrap; gap: 4px; }
.phase-track li { border: 1px solid #b79b69; border-radius: 4px; padding: 3px 9px; color: var(--muted); font-size: 12px; font-weight: 800; }
.phase-track [aria-current] { color: #fff3d3; background: var(--wine); border-color: #753629; }
.stage p { color: var(--muted); }
.stage .word {
  margin: 0 0 17px;
  padding: 14px 17px;
  border: 4px double #9b783e;
  border-radius: 8px;
  background: #2d4638;
  color: #fff0c9;
  box-shadow: inset 0 0 14px #172b21b8;
}
.word .eyebrow { color: #e6ca90; }
.word strong { display: block; font: 900 clamp(28px, 6vw, 44px)/1.22 var(--heading); letter-spacing: -.05em; margin-top: 6px; }
.clues { padding: 0; list-style: none; display: grid; gap: 7px; }
.clues li, .player { background: #fff5dc98; border: 1px solid #bf9f66; border-radius: 6px; padding: 9px 10px; }
.clues strong { color: var(--wine); margin-right: 8px; }
.actions { margin-top: 16px; }
.actions .primary { margin-top: 8px; }
.stage .ghost { margin-top: 18px; }
.roster h2 { font-size: 24px; }
#players { list-style: none; padding: 0; margin: 0; display: grid; gap: 7px; }
#size { color: var(--muted); font: 800 15px Georgia, serif; margin-left: 4px; }
.player { display: flex; align-items: center; gap: 7px; }
.player.current { background: #f8df9c; border-color: #9c7432; }
.player strong { min-width: 0; flex: 1; }
.player .score { color: #39523e; font-weight: 900; white-space: nowrap; }
.player .button { min-height: 36px; margin: 0; padding: 4px 7px; font-size: 12px; }
.tag { font-size: 11px; font-weight: 800; color: var(--muted); margin-left: 4px; display: inline-block; }
.candidates, .reveal { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.candidates .button { min-width: 0; overflow-wrap: anywhere; }
.candidates [aria-pressed=true] { border-color: #673b1a; background: #e6bf76; box-shadow: inset 0 0 0 2px #734c27, 0 2px 0 #60432945; color: #34251a; }
.reveal > div { padding: 13px; border: 3px double #bb9350; border-radius: 7px; background: #fff5dc98; }
.reveal > div + div { border-color: #a6614e; background: #f6dec3; }
.reveal strong { display: block; color: var(--wine); font: 900 24px/1.3 var(--heading); margin-top: 4px; }
@media (max-width: 720px) {
  .shell { width: calc(100% - 28px); }
  .top { min-height: 58px; }
  .entry { grid-template-columns: 1fr; gap: 14px; margin-top: 15px; }
  .village { aspect-ratio: 3; }
  .intro-copy { padding: 14px 15px 16px; }
  h1 { font-size: clamp(29px, 7.9vw, 44px); }
  .intro p { font-size: 13px; }
  .entry-card { padding: 18px; }
  .rules { grid-template-columns: 1fr; margin-top: 17px; }
  .rules > div { padding: 10px 13px; }
  .rules > div + div { border-left: 0; border-top: 1px solid #a08b5f80; }
  .room-layout { grid-template-columns: 1fr; }
  .room-bar { padding: 12px; }
  .room-bar .button { padding-inline: 8px; font-size: 12px; }
}
@media (prefers-reduced-motion: reduce) { .button { transition: none; } }
