:root {
  --ink: #192b3e;
  --muted: #574e43;
  --cream: #fffaee;
  --line: #e3c791;
  color: var(--ink);
}
body { background: radial-gradient(ellipse at top, #eefaff 10%, #dceff1 58%, #f1edda); }
main { width: min(100%, 1000px); padding: 12px; }
.status:empty { display: none; }
.status:not(:empty) { background: white; border: 1px solid #d1bf9c; padding: 9px; border-radius: 9px; }
.lobby { max-width: 805px; margin: 28px auto 14px; background: var(--cream); border: 1px solid #bea277; border-radius: 24px; overflow: hidden; box-shadow: 0 14px 38px #2b536227; }
.lobby-hero, .banner { background: #82d6f5 url("online/landscape.webp") center center / cover no-repeat; }
.lobby-hero { height: clamp(95px, 22vw, 175px); }
.lobby-body { padding: clamp(13px, 3vw, 26px); }
.lobby-intro { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 12px; }
.lobby-intro h2 { margin: 0; font-size: clamp(1.25rem, 4vw, 1.72rem); }
.lobby-intro span { color: #264968; background: #eaf4fc; border: 1px solid #bbd4e7; padding: 5px 11px; font-weight: 750; border-radius: 20px; white-space: nowrap; }
.name-field { display: flex; flex-wrap: wrap; gap: 8px 12px; align-items: center; font-weight: 700; }
.name-field input { padding: 10px; width: min(100%, 260px); }
#lobby fieldset { border: 0; margin: 14px 0; padding: 0; min-width: 0; }
#lobby legend { font-weight: 700; margin-bottom: 7px; }
.room-controls, .join-controls, .invite { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; }
.room-controls button, .join-controls input { min-height: 43px; }
.join-controls input { width: 10rem; text-transform: uppercase; padding-inline: 10px; }
#invite-code { font-family: ui-monospace, monospace; letter-spacing: .08em; padding: 7px 10px; background: #f2e1ba; border-radius: 7px; }
#npc-form { margin-bottom: 12px; }
#npc-form select { min-height: 43px; }
.remove-npc { margin-top: 3px; padding: .15em .55em; font-size: .74rem; }
#waiting-hint { color: var(--muted); margin-bottom: 0; }
.seat-list { list-style: none; display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 6px; margin: 14px 0; padding: 0; }
.seat { display: flex; align-items: center; gap: 6px; padding: 6px; min-height: 45px; border: 1px solid #ead7b1; border-radius: 8px; background: #fdf0d7; overflow-wrap: anywhere; }
.seat:has(img) { border-left: 3px solid var(--seat); }
.seat[aria-current] { outline: 2px solid var(--seat); outline-offset: -2px; background: white; }
.seat img { width: 34px; height: 38px; object-fit: contain; border-radius: 4px; flex: none; }
.seat strong, .seat small { display: block; }
.seat small { font-size: .73rem; color: #5e5345; }
.seat-list.compact { margin: 0; }
.seat-list.compact .seat { font-size: .81rem; min-height: 36px; }
.seat-list.compact img { width: 29px; height: 31px; }
.room-bar { display: flex; align-items: center; flex-wrap: wrap; gap: 7px 15px; margin: 0 3px 6px; font-size: .88rem; }
.room-bar strong { flex: 1; color: #154369; overflow-wrap: anywhere; }
.room-bar button { padding: .35em .65em; }
.game { grid-template-rows: repeat(11, minmax(49px, 1fr)); background: #e8c579; border-color: #ad813c; }
.dashboard { background: var(--cream); }
.banner { height: clamp(77px, 13vw, 127px); background-size: 100% 100%; }
.game .tile { display: block; padding: 0; background: #fff5df; overflow: visible; }
.game .tile:nth-child(5n) { background: #e7f3d9; }
.game .tile:nth-child(5n + 1) { background: #e8f5fc; }
.game .tile:nth-child(5n + 2) { background: #f7eafb; }
.tile-rule { border: 0; width: 100%; height: 100%; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 1px; border-radius: inherit; background: none; padding: 3px 2px; position: relative; }
.tile-rule small { background: #fff9e9; padding: 2px 3px; border-radius: 4px; }
.tile-rule b { background: #fff9edda; border-radius: 3px; padding: 1px 3px; max-width: 100%; overflow-wrap: anywhere; }
.tile-art { width: 38px; height: 24px; object-fit: cover; border-radius: 4px; }
.token-stack { position: absolute; bottom: 0; right: 0; display: grid; grid-template-columns: repeat(2, auto); align-items: center; gap: 1px; pointer-events: none; z-index: 1; }
.online-token { border: 2px solid var(--seat); width: clamp(16px, 2.6vw, 25px); height: clamp(16px, 2.6vw, 25px); border-radius: 50%; background: var(--cream); position: relative; box-shadow: 0 1px 3px #0005; }
.online-token img { width: 100%; height: 100%; border-radius: 50%; object-fit: cover; }
.online-token small { top: auto; left: auto; right: -4px; bottom: -2px; padding: 0 2px; color: white; background: var(--seat); border-radius: 3px; font-size: .57rem; }
#facilities img { width: 66px; height: 34px; }
#roll { color: #492a06; background: linear-gradient(#ffe98e 5%, #ffbf42 48%, #f2a320); border-color: #9d571a; }
#roll:disabled { background: #ebdfca; }
.dice { min-width: 78px; }
.dice-flip { animation: flip 280ms steps(1, end) both; }
@keyframes flip {
  0% { transform: translateY(-4px) rotate(-12deg); }
  50%, 100% { transform: translateY(2px) rotate(12deg); }
}
@media (max-width: 620px) {
  main { padding: 6px; }
  .lobby { margin: 7px auto; }
  .game { grid-template-rows: repeat(11, 35px) auto; }
  .game::before { background: url("online/landscape.webp") center 32% / 100% auto no-repeat, url("online/town.webp") bottom / 100% auto no-repeat, linear-gradient(#a4dbf0, #fdf1d7 65%); }
  .tile-rule b { padding: 1px; }
  .tile-art { width: 28px; height: 13px; }
  .tile-rule small { padding: 1px; }
  .token-stack { right: -1px; bottom: 0; }
  .seat-list:not(.compact) { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .seat-list.compact .seat { padding: 3px; gap: 2px; }
  .seat-list.compact .seat strong { font-size: .68rem; }
  .seat-list.compact img { width: 18px; height: 23px; }
  .seat-list.compact small { font-size: .64rem; }
}
@media (prefers-reduced-motion: reduce) {
  .dice-flip { animation: none; }
}
.dice[aria-label="주사위 결과 없음"] { background: url("online/dice.webp") center / contain no-repeat; color: transparent; }
