







: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;
  --xq-serif: "Kaiti TC", "Kaiti SC", STKaiti, KaiTi, "BiauKai", "DFKai-SB", "Noto Serif TC", "Noto Serif CJK TC", "Songti TC", "SimSun", "Hiragino Mincho ProN", serif;
  --xq-line: #3A2410;
}

* { 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; }
}

.xq {
  flex: 1 1 auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  padding: 12px 16px 24px;
}
.xq h1 { margin: 2px 0 0; font-size: 22px; font-family: Georgia, 'Times New Roman', serif; text-align: center; }
.xq-row { display: flex; flex-wrap: wrap; justify-content: center; align-items: center; gap: 8px; }
.xq-row[hidden] { display: none; }
.xq-label { font-size: 15px; color: var(--fc-inkSoft); margin-right: 2px; }
.xq-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;
}
.xq-btn[aria-pressed="true"] { background: var(--fc-ink); color: var(--fc-paper); }
.xq-btn:focus-visible, .xq-code-input:focus-visible { outline: 4px solid var(--fc-blue); outline-offset: 2px; }
.xq-btn:disabled { opacity: 0.45; cursor: default; }
.xq-btn[hidden] { display: none; }
.xq-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;
}
.xq-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);
}
.xq-room[hidden] { display: none; }
#room-live { gap: 12px; }
.xq-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);
}
.xq-watchers[hidden] { display: none; }
.xq-code { font-size: 26px; font-weight: 700; letter-spacing: 0.12em; font-family: "Courier New", monospace; }


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





.xq-table {
  --cell: calc(clamp(28px, min(calc((100vw - 76px) / 9), calc((100svh - 330px) / 11)), 60px) * 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) {
  

  .xq-table { --cell: calc(clamp(28px, min(calc((100vw - 76px) / 9), calc((100svh - 470px) / 11)), 60px) * var(--fit, 1)); }
  .xq-table { flex-direction: row; align-items: stretch; gap: 20px; padding: 16px 20px; }
  .xq-tray { width: max-content; min-width: calc(var(--cell) * 3); max-width: calc(var(--cell) * 4.2); }
  .xq-tray-head { white-space: nowrap; }
  .xq-them { align-self: flex-start; }
  .xq-me { align-self: flex-end; }
}
.xq-boardwrap { display: flex; flex-direction: column; align-items: center; gap: 2px; }
.xq-files { display: grid; grid-template-columns: repeat(9, var(--cell)); }
.xq-files span {
  display: flex; align-items: center; justify-content: center; height: 16px;
  font-size: 12px; font-weight: 700; color: var(--fc-paper); text-shadow: 0 1px 2px rgba(0, 0, 0, 0.8);
}



.xq-board {
  position: relative;
  display: grid;
  grid-template-columns: repeat(9, var(--cell));
  grid-template-rows: repeat(10, var(--cell));
  border-radius: 6px;
  
  background: linear-gradient(rgba(226, 176, 98, 0.45), rgba(214, 160, 84, 0.45)), #D9A85C url(../assets/levels/board-wood.webp) center / 512px;
  box-shadow: 0 0 0 4px #9A6A2E, 0 0 0 6px #2B1B08, 0 14px 32px rgba(0, 0, 0, 0.45);
  margin: 8px;
}
.xq-lines { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; overflow: visible; }
.xq-lines line, .xq-lines rect, .xq-lines path { stroke: var(--xq-line); vector-effect: non-scaling-stroke; fill: none; }
.xq-lines .frame { stroke-width: 2.5; }
.xq-lines .grid { stroke-width: 1.2; }
.xq-lines .mark { stroke-width: 1.2; }
.xq-river {
  position: absolute; left: 0; right: 0; top: calc(var(--cell) * 4.5); height: var(--cell);
  display: flex; align-items: center; justify-content: space-around; pointer-events: none;
  font-family: var(--xq-serif); font-size: calc(var(--cell) * 0.5); font-weight: 700; letter-spacing: 0.3em;
  color: rgba(58, 36, 16, 0.78);
}
.xq-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;
}
.xq-pt.movable, .xq-pt.target { cursor: pointer; }

.xq-pt.last::before {
  content: ""; position: absolute; left: 50%; top: 50%; width: 92%; height: 92%; border-radius: 50%;
  transform: translate(-50%, -50%); background: rgba(255, 196, 64, 0.5); pointer-events: none;
}
.xq-pt.sel .xq-piece { box-shadow: 0 0 0 3px #7FD18F; }
.xq-pt.check .xq-piece { box-shadow: 0 0 0 3px #E0402A, 0 0 14px 4px rgba(224, 64, 42, 0.8); }
.xq-pt.target::after {
  content: ""; position: absolute; left: 50%; top: 50%; width: 28%; height: 28%;
  transform: translate(-50%, -50%); border-radius: 50%;
  background: rgba(27, 107, 58, 0.8); pointer-events: none; z-index: 3;
}
.xq-pt.capture::after { width: 90%; height: 90%; background: transparent; border: 3px solid rgba(27, 107, 58, 0.9); }
.xq-pt:focus-visible { outline: 3px solid var(--fc-blue); outline-offset: -3px; z-index: 4; }
.xq-pt.echo .xq-piece { opacity: 0.7; }




.xq-piece {
  position: relative; display: block; border-radius: 50%;
  width: calc(var(--cell) * 0.88); height: calc(var(--cell) * 0.88);
  


  background:
    radial-gradient(circle, rgba(250, 236, 204, 0.93) 0 52%, rgba(240, 214, 162, 0.72) 70%, rgba(214, 170, 100, 0.25) 100%),
    #E8C98E url(../assets/levels/disc-wood.webp) center / cover;
  box-shadow: 0 2px 3px rgba(30, 18, 4, 0.6), inset 0 -3px 0 rgba(120, 80, 20, 0.35);
}
.xq-piece::before {
  content: ""; position: absolute; inset: 9%; border-radius: 50%;
  border: max(1.5px, calc(var(--cell) * 0.035)) solid currentColor; opacity: 0.85;
}
.xq-piece.red { color: #B0201A; }
.xq-piece.black { color: #1A1208; }
.xq-glyph {
  position: absolute; inset: 0; display: flex; align-items: center; justify-content: center;
  font-family: var(--xq-serif); font-size: calc(var(--cell) * 0.56); font-weight: 900; line-height: 1;
}


.xq-dot, .xq-bar {
  position: absolute; pointer-events: none;
  left: calc(50% + var(--dx) * 21%); top: calc(50% + var(--dy) * 21%);
  transform: translate(-50%, -50%);
  background: #1B6B3A;
}
.xq-dot { width: 4px; height: 4px; border-radius: 50%; }
.xq-dot.xq-jump { width: 5px; height: 5px; background: transparent; border: 1.5px solid #1B6B3A; }
.xq-bar { --dx: 0; --dy: 0; width: 3px; height: 8px; border-radius: 2px; transform: translate(-50%, -50%) rotate(var(--rot, 0deg)); }


.xq-tray {
  display: flex; flex-direction: column; gap: 8px;
  width: min(100%, calc(var(--cell) * 9 + 28px));
  min-height: calc(var(--cell) * 0.7 + 44px);
  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;
}
.xq-tray.turn { box-shadow: inset 0 0 0 3px #F2C14E, 0 8px 20px rgba(0, 0, 0, 0.35); transition: box-shadow 300ms ease; }
.xq-tray-head { font-size: 13px; font-weight: 700; }
.xq-tray-row { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.xq-tray .xq-piece { --cell: 30px; }
.xq-tray .xq-piece.fresh { animation: xq-arrive 520ms cubic-bezier(.2, .9, .3, 1.3); }


.xq-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, var(--xq-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: xq-pop 380ms cubic-bezier(.2, .9, .3, 1.35) both;
}
.xq-banner[hidden] { display: none; }
.xq-banner.check { background: linear-gradient(#C23A22, #7E1A0E); font-size: 30px; animation: xq-pop 300ms cubic-bezier(.2, .9, .3, 1.35) both, xq-shake 360ms 300ms ease-in-out; }
.xq-banner.win { border-color: #F2C14E; color: #FFE7A0; }
.xq-banner.none { background: linear-gradient(#3B302A, #1E1814); font-size: 18px; }


.xq-flash { min-height: 1.3em; margin: 0; font-size: 16px; text-align: center; }
.xq-flash:empty { display: none; }
.xq-foot { display: flex; flex-wrap: wrap; justify-content: center; gap: 12px; }
.xq-foot [hidden] { display: none; }
.xq-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] .xq-help { padding: 12px 16px; }






.xq-seg { display: inline-flex; flex-wrap: nowrap; align-items: center; gap: 8px; }
#opts-row { gap: 12px 20px; }
.xq 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);
}
.xq-pt .xq-piece { transition: transform 160ms cubic-bezier(.2, .7, .2, 1), box-shadow 160ms; }
.xq-pt.sel .xq-piece { transform: translateY(-4px) scale(1.07); box-shadow: 0 0 0 3px #7FD18F, 0 8px 6px rgba(30, 18, 4, 0.45); }
.xq-pt.target::after { animation: xq-ink 220ms cubic-bezier(.2, .9, .3, 1.4) both; animation-delay: calc(var(--i, 0) * 18ms); }
.xq-pt.capture::after { animation-name: xq-ring-in; }
.xq-pt.landed .xq-piece::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: xq-land 520ms ease-out;
}
@keyframes xq-ink { from { transform: translate(-50%, -50%) scale(0); opacity: 0; } to { transform: translate(-50%, -50%) scale(1); opacity: 1; } }
@keyframes xq-ring-in { from { transform: translate(-50%, -50%) scale(1.3); opacity: 0; } to { transform: translate(-50%, -50%) scale(1); opacity: 1; } }
@keyframes xq-land { 0% { transform: translate(-50%, -50%) scale(0.7); opacity: 0.9; } 100% { transform: translate(-50%, -50%) scale(1.3); opacity: 0; } }
@keyframes xq-arrive { 0% { transform: scale(0.4) rotate(-20deg); opacity: 0; } 60% { transform: scale(1.12) rotate(4deg); opacity: 1; } 100% { transform: none; } }
@keyframes xq-pop { 0% { transform: translate(-50%, -50%) scale(0.6); opacity: 0; } 100% { transform: translate(-50%, -50%) scale(1); opacity: 1; } }
@keyframes xq-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) {
  .xq-pt .xq-piece, .xq-tray.turn { transition: none; }
  .xq-pt.target::after, .xq-pt.landed .xq-piece::after, .xq-tray .xq-piece.fresh, .xq-banner, .xq-banner.check { animation: none; }
}





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