







:root {
  --fc-paper: #FBF5E4;
  --fc-card: #FFFDF6;
  --fc-ink: #17150F;
  --fc-inkSoft: #4A4438;
  --fc-green: #1B6B3A;
  --fc-gold: #8A5A00;
  --fc-red: #A8321E;
  --fc-blue: #1D4E89;
  --fc-wood: #E9D3A8;
  --fc-woodShade: #C4A874;
  --fc-lacquer: #7A2318;
  --fc-paperDim: rgba(246, 241, 230, 0.78);
  --fc-font: Verdana, "DejaVu Sans", Tahoma, "Segoe UI", "Microsoft JhengHei", "Microsoft YaHei", "PingFang TC", "Hiragino Sans", system-ui, sans-serif;
  --wq-line: #2B1A08;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  min-height: 100%;
  background: var(--fc-paper);
  color: var(--fc-ink);
  font-family: var(--fc-font);
  font-size: 18px;
}
body { display: flex; flex-direction: column; }

.studio-bar {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 12px;
  height: 52px;
  background: var(--fc-ink);
  color: var(--fc-paper);
}
.studio-home {
  display: flex;
  align-items: center;
  gap: 10px;
  color: inherit;
  text-decoration: none;
  min-width: 0;
  font-family: Georgia, 'Times New Roman', serif;
  font-weight: 700;
  font-size: 19px;
}
.studio-home img { display: block; flex: 0 0 auto; }
.studio-home span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.studio-back {
  margin-left: auto;
  flex: 0 1 auto;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  color: var(--fc-paperDim);
  text-decoration: none;
  font-size: 17px;
  padding: 10px 6px;
  white-space: nowrap;
}
.studio-back:hover, .studio-back:focus-visible { color: var(--fc-paper); text-decoration: underline; }
.studio-home:focus-visible, .studio-back:focus-visible { outline: 3px solid var(--fc-blue); outline-offset: 2px; }
.studio-music {
  margin-left: 2px; flex: 0 0 auto; display: inline-flex; align-items: center; justify-content: center;
  width: 48px; height: 44px; padding: 0; border: 0; border-radius: 8px; background: transparent;
  color: var(--fc-paper); cursor: pointer;
}
.studio-music[hidden] { display: none; }
.studio-music .mg-slash { display: none; }
.studio-music[aria-pressed="false"] .mg-slash { display: block; }
@media (max-width: 560px) {
  .studio-bar { height: 44px; gap: 8px; }
  .studio-home img { width: 30px; height: 30px; }
  .studio-home span { width: 0; overflow: hidden; }
}

.wq {
  flex: 1 1 auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  padding: 12px 16px 24px;
}
.wq h1 { margin: 2px 0 0; font-size: 22px; font-family: Georgia, 'Times New Roman', serif; text-align: center; }
.wq-row { display: flex; flex-wrap: wrap; justify-content: center; align-items: center; gap: 8px; }
.wq-row[hidden] { display: none; }
.wq-label { font-size: 15px; color: var(--fc-inkSoft); margin-right: 2px; }
.wq-btn {
  min-height: 44px; padding: 8px 14px; border: 3px solid var(--fc-ink); border-radius: 8px;
  background: var(--fc-card); color: var(--fc-ink); font: inherit; font-size: 16px; cursor: pointer;
}
.wq-btn[aria-pressed="true"] { background: var(--fc-ink); color: var(--fc-paper); }
.wq-btn:focus-visible, .wq-code-input:focus-visible { outline: 4px solid var(--fc-blue); outline-offset: 2px; }
.wq-btn:disabled { opacity: 0.45; cursor: default; }
.wq-btn[hidden] { display: none; }
.wq-code-input {
  min-height: 44px; padding: 6px 10px; border: 3px solid var(--fc-ink); border-radius: 8px;
  background: var(--fc-card); color: var(--fc-ink); font: inherit; font-size: 16px;
  width: 9.5em; text-transform: uppercase; letter-spacing: 0.08em;
}
.wq-room {
  display: flex; flex-direction: column; align-items: center; gap: 12px;
  padding: 16px; border: 3px dashed var(--fc-woodShade); border-radius: 12px; background: var(--fc-card);
}
.wq-room[hidden] { display: none; }
#room-live { gap: 12px; }
.wq-watchers {
  font-size: 14px; font-weight: 700; color: var(--fc-inkSoft);
  padding: 4px 12px; border-radius: 999px; background: var(--fc-paper); border: 2px solid var(--fc-woodShade);
}
.wq-watchers[hidden] { display: none; }
.wq-code { font-size: 26px; font-weight: 700; letter-spacing: 0.12em; font-family: "Courier New", monospace; }


.wq-hud, .wq-seat {
  display: flex; flex-direction: column; align-items: center; gap: 12px;
  width: min(100%, 980px);
}
html[data-scene] main > .wq-hud, html[data-scene] main > .wq-seat { padding: 12px 16px; }
.wq-status { min-height: 1.4em; margin: 0; font-weight: 700; font-size: 18px; text-align: center; }






.wq-table {
  --n: 9;
  --cell: calc(clamp(14px, min(calc((100vw - 76px) / var(--n)), calc((100svh - 330px) / (var(--n) + 1))), 56px) * var(--fit, 1));
  position: relative;
  display: flex; flex-direction: column; align-items: center; gap: 12px;
  padding: 12px;
  border-radius: 18px;
  background: rgba(23, 21, 15, 0.34);
}
@media (min-width: 900px) {
  
  .wq-table { --cell: calc(clamp(14px, min(calc((100vw - 76px) / var(--n)), calc((100svh - 470px) / (var(--n) + 1))), 56px) * var(--fit, 1)); }
  .wq-table { flex-direction: row; align-items: stretch; gap: 20px; padding: 16px 20px; }
  .wq-bowl { width: 190px; }
  .wq-them { align-self: flex-start; }
  .wq-me { align-self: flex-end; }
}
.wq-boardwrap { display: flex; flex-direction: column; align-items: center; }



.wq-board {
  position: relative;
  display: grid;
  grid-template-columns: repeat(var(--n), var(--cell));
  grid-template-rows: repeat(var(--n), var(--cell));
  border-radius: 6px;
  padding: calc(var(--cell) * 0.35);
  background: linear-gradient(rgba(232, 184, 96, 0.28), rgba(214, 160, 70, 0.28)), #DDAA58 url(../assets/levels/board-kaya.webp) center / 512px;
  box-shadow: 0 0 0 3px #8A5A22, 0 0 0 5px #2B1B08, 0 14px 32px rgba(0, 0, 0, 0.45);
  margin: 8px;
}
.wq-lines {
  position: absolute; pointer-events: none; overflow: visible;
  left: calc(var(--cell) * 0.35); top: calc(var(--cell) * 0.35);
  width: calc(var(--cell) * var(--n)); height: calc(var(--cell) * var(--n));
}
.wq-lines line, .wq-lines rect { stroke: var(--wq-line); vector-effect: non-scaling-stroke; fill: none; }
.wq-lines .frame { stroke-width: 2; }
.wq-lines .grid { stroke-width: 1; }
.wq-lines .hoshi { fill: var(--wq-line); stroke: none; }
.wq-pt {
  position: relative; z-index: 1;
  display: flex; align-items: center; justify-content: center;
  width: var(--cell); height: var(--cell);
  margin: 0; padding: 0; border: 0;
  background: transparent; color: inherit; font: inherit; cursor: default;
}
.wq-pt.can { cursor: pointer; }
.wq-pt:focus-visible { outline: 3px solid var(--fc-blue); outline-offset: -3px; z-index: 4; border-radius: 50%; }




.wq-stone {
  position: relative; display: block; border-radius: 50%;
  width: calc(var(--cell) * 0.94); height: calc(var(--cell) * 0.94);
}
.wq-stone.b {
  background:
    radial-gradient(circle at 34% 30%, rgba(255, 255, 255, 0.42) 0 6%, rgba(255, 255, 255, 0.08) 22%, rgba(0, 0, 0, 0) 40%),
    radial-gradient(circle at 50% 50%, rgba(10, 10, 12, 0.35), rgba(0, 0, 0, 0.75) 100%),
    #1B1B1E url(../assets/levels/stone-slate.webp) center / cover;
  box-shadow: 1px 2px 3px rgba(20, 10, 0, 0.55);
}
.wq-stone.w {
  background:
    radial-gradient(circle at 34% 30%, rgba(255, 255, 255, 0.95) 0 8%, rgba(255, 255, 255, 0) 38%),
    radial-gradient(circle at 50% 50%, rgba(255, 253, 246, 0.3), rgba(176, 168, 150, 0.55) 100%),
    #F1ECE0 url(../assets/levels/stone-shell.webp) center / cover;
  box-shadow: 1px 2px 3px rgba(20, 10, 0, 0.45);
}

.wq-stone.last::after {
  content: ""; position: absolute; inset: 30%; border-radius: 50%;
  border: max(1.5px, calc(var(--cell) * 0.07)) solid rgba(240, 236, 224, 0.9);
}
.wq-stone.w.last::after { border-color: rgba(23, 21, 15, 0.85); }
.wq-pt.echo .wq-stone { opacity: 0.7; }
.wq-pt.dead .wq-stone { opacity: 0.38; transform: scale(0.86); }


.wq-pt.atari .wq-stone { box-shadow: 0 0 0 2px #E0402A, 0 0 10px 2px rgba(224, 64, 42, 0.7); }
.wq-pt.lastlib::after, .wq-pt.lib::after {
  content: ""; position: absolute; left: 50%; top: 50%; width: 30%; height: 30%;
  transform: translate(-50%, -50%); border-radius: 50%; pointer-events: none; z-index: 3;
}
.wq-pt.lastlib::after { background: rgba(224, 64, 42, 0.85); }
.wq-pt.lib::after { background: rgba(27, 107, 58, 0.85); animation: wq-ink 220ms cubic-bezier(.2, .9, .3, 1.4) both; animation-delay: calc(var(--i, 0) * 25ms); }
.wq-pt.nogo::before {
  content: "\00d7"; position: absolute; left: 50%; top: 50%; transform: translate(-50%, -52%);
  font-size: calc(var(--cell) * 0.5); line-height: 1; color: rgba(168, 50, 30, 0.75); pointer-events: none;
}

.wq-pt.ghost::after, .wq-pt.can:hover::after {
  content: ""; position: absolute; left: 50%; top: 50%; width: 88%; height: 88%; border-radius: 50%;
  transform: translate(-50%, -50%); pointer-events: none; opacity: 0.55;
}
html[data-me="b"] .wq-pt.ghost::after, html[data-me="b"] .wq-pt.can:hover::after { background: #1B1B1E; }
html[data-me="w"] .wq-pt.ghost::after, html[data-me="w"] .wq-pt.can:hover::after { background: #F4F0E6; box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.3); }
.wq-pt.ghost::after { opacity: 0.75; animation: wq-breathe 900ms ease-in-out infinite alternate; }
@media (hover: none) { .wq-pt.can:hover:not(.ghost)::after { display: none; } }

.wq-pt.own-b::before, .wq-pt.own-w::before {
  content: ""; position: absolute; left: 50%; top: 50%; width: 34%; height: 34%;
  transform: translate(-50%, -50%); pointer-events: none; z-index: 3;
  animation: wq-ink 260ms cubic-bezier(.2, .9, .3, 1.4) both; animation-delay: calc(var(--i, 0) * 4ms);
}
.wq-pt.own-b::before { background: #1B1B1E; }
.wq-pt.own-w::before { background: #F4F0E6; box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.45); }


.wq-bowl {
  display: flex; flex-direction: column; gap: 8px;
  width: min(100%, calc(var(--cell) * var(--n) + 28px));
  min-height: 64px;
  padding: 10px 12px;
  border-radius: 12px;
  background: linear-gradient(#2A1713, #160A08);
  box-shadow: inset 0 0 0 1px #D9AE4C, 0 8px 20px rgba(0, 0, 0, 0.35);
  color: #F6E7C8;
}
.wq-bowl.turn { box-shadow: inset 0 0 0 3px #F2C14E, 0 8px 20px rgba(0, 0, 0, 0.35); transition: box-shadow 300ms ease; }
.wq-bowl-head { display: flex; align-items: center; gap: 8px; font-size: 13px; font-weight: 700; }
.wq-bowl-head .wq-stone { --cell: 20px; flex: 0 0 auto; }
.wq-bowl-row { display: flex; flex-wrap: wrap; gap: 3px; align-items: center; min-height: 16px; }
.wq-bowl-row .wq-stone { --cell: 16px; }
.wq-bowl-row .wq-stone.fresh { animation: wq-arrive 520ms cubic-bezier(.2, .9, .3, 1.3); }
.wq-bowl-more { font-size: 13px; font-weight: 700; margin-left: 4px; }


.wq-banner {
  position: absolute; left: 50%; top: 50%; z-index: 6;
  width: max-content; max-width: calc(100% - 32px); padding: 12px 24px; border-radius: 14px;
  transform: translate(-50%, -50%);
  font-family: Georgia, serif;
  font-size: 22px; font-weight: 700; text-align: center; line-height: 1.3;
  pointer-events: none;
  background: linear-gradient(#2A1713, #120806); border: 2px solid #D9AE4C; color: #F6E7C8;
  box-shadow: inset 0 0 0 4px #2A1713, inset 0 0 0 5px rgba(217, 174, 76, 0.55), 0 14px 34px rgba(0, 0, 0, 0.5);
  animation: wq-pop 380ms cubic-bezier(.2, .9, .3, 1.35) both;
}
.wq-banner[hidden] { display: none; }
.wq-banner.atari { background: linear-gradient(#C23A22, #7E1A0E); font-size: 28px; animation: wq-pop 300ms cubic-bezier(.2, .9, .3, 1.35) both, wq-shake 360ms 300ms ease-in-out; }
.wq-banner.win { border-color: #F2C14E; color: #FFE7A0; }


.wq-flash { min-height: 1.3em; margin: 0; font-size: 16px; text-align: center; }
.wq-flash:empty { display: none; }
.wq-count {
  margin: 0; padding: 10px 16px; border-radius: 10px; text-align: center; font-size: 16px; line-height: 1.5;
  background: linear-gradient(#2A1713, #160A08); color: #F6E7C8; box-shadow: inset 0 0 0 1px #D9AE4C;
}
.wq-count[hidden] { display: none; }
.wq-count strong { display: block; font-size: 18px; }
.wq-foot { display: flex; flex-wrap: wrap; justify-content: center; gap: 12px; }
.wq-foot [hidden] { display: none; }
.wq-help { max-width: 640px; margin: 0; padding: 0 16px; font-size: 15px; color: var(--fc-inkSoft); text-align: center; line-height: 1.5; }
html[data-scene] .wq-help { padding: 12px 16px; }






.wq-tip { margin: 0; font-size: 15px; font-weight: 700; line-height: 1.45; text-align: center; }
.wq-tip[hidden] { display: none; }
.wq-goal {
  display: flex; flex-direction: column; align-items: center; gap: 12px;
  width: min(100% - 32px, 520px); padding: 16px; border-radius: 12px; text-align: center;
  box-shadow: inset 0 0 0 1px var(--fc-woodShade, rgba(0, 0, 0, 0.25));
}
.wq-goal[hidden], .wq-prizes[hidden] { display: none; }
.wq-goal-head { margin: 0; font-family: Georgia, serif; font-size: 18px; }
.wq-goal-line, .wq-goal-count { margin: 0; font-size: 16px; line-height: 1.45; }
.wq-goal-count { font-size: 14px; font-weight: 700; }
.wq-goal-bar {
  width: 100%; height: 10px; border-radius: 999px; overflow: hidden;
  background: color-mix(in srgb, currentColor 15%, transparent);
}
.wq-goal-bar span { display: block; height: 100%; width: 0; border-radius: inherit; background: var(--fc-lacquer, #7A2318); transition: width 400ms ease; }
.wq-prizes { width: 100%; display: flex; flex-direction: column; gap: 12px; }
.wq-prizes ul { margin: 0; padding: 0; list-style: none; display: grid; gap: 8px; }
.wq-prizes li { padding: 8px 12px; border-radius: 8px; background: color-mix(in srgb, currentColor 8%, transparent); font-size: 15px; }
@media (prefers-reduced-motion: reduce) { .wq-goal-bar span { transition: none; } }






.wq-seg { display: inline-flex; flex-wrap: nowrap; align-items: center; gap: 8px; }
#opts-row { gap: 12px 20px; }
.wq h1 {
  padding: 6px 22px 8px; border-radius: 10px; color: #F6E7C8; letter-spacing: 0.04em;
  background: linear-gradient(#2A1713, #160A08); box-shadow: inset 0 0 0 1px #D9AE4C, 0 6px 16px rgba(0, 0, 0, 0.35);
}
.wq-pt .wq-stone { transition: transform 200ms cubic-bezier(.2, .7, .2, 1), opacity 200ms, box-shadow 160ms; }
.wq-pt.landed .wq-stone { animation: wq-drop 300ms cubic-bezier(.3, .7, .3, 1.25); }
.wq-pt.landed::after {
  content: ""; position: absolute; left: 50%; top: 50%; width: 110%; height: 110%; border-radius: 50%;
  border: 2px solid rgba(43, 27, 8, 0.55); transform: translate(-50%, -50%) scale(0.7); opacity: 0;
  pointer-events: none; animation: wq-land 520ms 120ms ease-out;
}
@keyframes wq-drop { 0% { transform: translateY(-14%) scale(1.22); opacity: 0.4; box-shadow: 6px 12px 12px rgba(20, 10, 0, 0.35); } 70% { transform: scale(0.97); opacity: 1; } 100% { transform: none; } }
@keyframes wq-ink { from { transform: translate(-50%, -50%) scale(0); opacity: 0; } to { transform: translate(-50%, -50%) scale(1); opacity: 1; } }
@keyframes wq-land { 0% { transform: translate(-50%, -50%) scale(0.7); opacity: 0.9; } 100% { transform: translate(-50%, -50%) scale(1.3); opacity: 0; } }
@keyframes wq-arrive { 0% { transform: scale(0.4); opacity: 0; } 60% { transform: scale(1.15); opacity: 1; } 100% { transform: none; } }
@keyframes wq-breathe { from { opacity: 0.55; } to { opacity: 0.85; } }
@keyframes wq-pop { 0% { transform: translate(-50%, -50%) scale(0.6); opacity: 0; } 100% { transform: translate(-50%, -50%) scale(1); opacity: 1; } }
@keyframes wq-shake { 0%, 100% { margin-left: 0; } 20% { margin-left: -8px; } 40% { margin-left: 7px; } 60% { margin-left: -5px; } 80% { margin-left: 3px; } }
@media (prefers-reduced-motion: reduce) {
  .wq-pt .wq-stone, .wq-bowl.turn { transition: none; }
  .wq-pt.landed .wq-stone, .wq-pt.landed::after, .wq-pt.lib::after, .wq-pt.own-b::before, .wq-pt.own-w::before,
  .wq-pt.ghost::after, .wq-bowl-row .wq-stone.fresh, .wq-banner, .wq-banner.atari { animation: none; }
}
