/* 棋盘游戏 · Board Game Maker — prefix bg- */
.bg-page { background: #f6f3ea; }
.bg-wrap { max-width: 1360px; margin: 0 auto; padding: 24px 20px 48px; color: #1f2d27; }
.bg-header { margin-bottom: 22px; }
.bg-header h1 { margin: 6px 0 8px; color: #194f45; }
.bg-header p { max-width: 780px; margin: 0; color: #4b5f56; }
.bg-header .back-btn { display: inline-block; margin-bottom: 12px; color: #356e57; font-weight: 700; text-decoration: none; }
.bg-eyebrow { margin: 0; color: #bf7f35 !important; font-size: .8rem; font-weight: 800; letter-spacing: .05em; text-transform: uppercase; }

.bg-layout { display: grid; grid-template-columns: minmax(310px, 390px) minmax(0, 1fr); gap: 22px; align-items: start; }
.bg-builder { display: flex; flex-direction: column; gap: 14px; }
.bg-panel { padding: 16px 18px; border: 1px solid #d9e3d2; border-radius: 14px; background: #fffdf7; }
.bg-kicker { display: flex; align-items: center; gap: 8px; margin: 0 0 10px; color: #194f45; font-weight: 800; }
.bg-step { display: inline-grid; place-items: center; width: 24px; height: 24px; border-radius: 50%; background: #356e57; color: #fff; font-size: .8rem; }
.bg-panel label { display: block; margin: 10px 0 5px; font-weight: 700; font-size: .92rem; }
.bg-panel label small { color: #6b7d74; font-weight: 400; }
.bg-panel textarea, .bg-panel input[type=text], .bg-panel select { box-sizing: border-box; width: 100%; padding: 9px 11px; border: 1px solid #c9d6c2; border-radius: 9px; background: #fff; font: inherit; }
.bg-panel input[type=range] { width: 100%; accent-color: #356e57; }
.bg-two { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.bg-check { display: flex !important; align-items: flex-start; gap: 8px; font-weight: 500 !important; }
.bg-check input { margin-top: 3px; }
.bg-check[hidden], .bg-sub[hidden] { display: none !important; }
.bg-note { margin: 6px 0 0; color: #5d7168; font-size: .85rem; }
.bg-sub { margin-top: 6px; padding-top: 4px; border-top: 1px dashed #d9e3d2; }

.bg-boards { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.bg-boards button { display: flex; flex-direction: column; gap: 2px; padding: 10px 11px; border: 1px solid #c9d6c2; border-radius: 11px; background: #fff; text-align: left; cursor: pointer; font: inherit; font-size: 1rem; }
.bg-boards button b { font-size: .95rem; }
.bg-boards button small { color: #5d7168; font-size: .78rem; }
.bg-boards button[aria-checked=true], .bg-seg button[aria-checked=true] { border-color: #356e57; background: #edf5df; box-shadow: inset 0 0 0 1px #356e57; }
.bg-seg { display: flex; flex-wrap: wrap; gap: 6px; }
.bg-seg button { flex: 1 1 auto; padding: 8px 10px; border: 1px solid #c9d6c2; border-radius: 10px; background: #fff; cursor: pointer; font: inherit; font-size: .9rem; }

.bg-picks { display: grid; grid-template-columns: 1fr 1fr; gap: 2px 10px; margin-top: 8px; max-height: 260px; overflow: auto; }
.bg-pick { display: flex !important; align-items: center; gap: 6px; margin: 0 !important; padding: 3px 0; font-weight: 500 !important; font-size: .88rem !important; }
.bg-pick small { color: #6b7d74; }

.bg-btn { padding: 10px 18px; border: 0; border-radius: 10px; background: #c8553d; color: #fff; font: inherit; font-weight: 700; cursor: pointer; }
.bg-btn:hover { filter: brightness(1.05); }
.bg-btn:disabled { opacity: .5; cursor: not-allowed; }
.bg-btn-ghost { background: #fff; color: #194f45; border: 1px solid #c9d6c2; }
#bgShuffle { margin-top: 10px; }
.bg-actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 14px; }

.bg-preview { position: sticky; top: 12px; min-width: 0; }
.bg-status { min-height: 1.3em; margin: 0 0 8px; color: #5d7168; font-size: .88rem; }
.bg-stage { max-height: calc(100vh - 70px); overflow: auto; padding: 12px; border-radius: 14px; background: #e4e0d4; }
.bg-sheets { display: flex; flex-direction: column; align-items: center; gap: 14px; }
.bg-empty { padding: 40px; color: #5d7168; text-align: center; }

/* ---------- sheets (real paper size) ---------- */
.bg-sheet { box-sizing: border-box; flex-shrink: 0; background: #fff; box-shadow: 0 3px 14px rgba(0,0,0,.14); color: #1f2d27; font-family: "Microsoft YaHei", "PingFang SC", sans-serif; }
.bg-sheet-inner { display: flex; flex-direction: column; height: 100%; overflow: hidden; }
.bg-sheet-inner > * { flex-shrink: 0; }
.bg-sheet-head { display: flex; justify-content: space-between; align-items: baseline; gap: 6mm; height: 12mm; }
.bg-sheet-head h2 { margin: 0; color: #194f45; font-size: 17pt; }
.bg-sheet-head span { color: #5d7168; font-size: 10pt; }
.bg-board { display: flex; justify-content: center; }
.bg-svg { display: block; }
.bg-sheet-foot { display: flex; justify-content: space-between; margin-top: auto; padding-top: 2mm; border-top: .3mm solid #dfe6db; color: #8a968f; font-size: 7.5pt; }

.bg-cards { display: grid; grid-template-columns: repeat(3, 1fr); grid-auto-rows: 80mm; }
.bg-card { position: relative; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2mm; padding: 4mm; border: .35mm dashed #6b7d74; background: #fdfaf2; text-align: center; }
.bg-card.is-bw { background: #fff; }
.bg-card-star { position: absolute; top: 3mm; left: 3.5mm; color: #8a6d1d; font-size: 8pt; font-weight: 700; }
.bg-card-icon { font-size: 22mm; line-height: 1; }
.bg-card b { font-family: "KaiTi", "STKaiti", "Kaiti SC", serif; font-size: 16pt; }
.bg-card-py { font-family: Andika, sans-serif; font-size: 10pt; color: #4b5f56; }
.bg-card small { color: #7b8a83; font-size: 8pt; }

.bg-kit { display: flex; flex-direction: column; gap: 7mm; }
.bg-kit h3 { margin: 0 0 3mm; color: #194f45; font-size: 12pt; }
.bg-rule { padding: 5mm 6mm; border: .5mm solid #356e57; border-radius: 3mm; background: #fffdf7; }
.bg-rule ol { margin: 0; padding-left: 6mm; }
.bg-rule li { margin-bottom: 2.4mm; }
.bg-rule li b { display: block; font-family: "KaiTi", "STKaiti", "Kaiti SC", serif; font-size: 13pt; font-weight: 600; }
.bg-rule li small { color: #5d7168; font-size: 9pt; }
.bg-rule p { margin: 2mm 0 0; font-size: 10.5pt; }

@media (max-width: 960px) {
  .bg-layout { grid-template-columns: 1fr; }
  .bg-preview { position: static; }
}

@media print {
  html, body.bg-page { margin: 0; padding: 0 !important; background: #fff !important; }
  body > *:not(.bg-wrap), .bg-header, .bg-builder, .bg-toolbar, .bg-status { display: none !important; }
  html, body.bg-page, .bg-wrap, .bg-layout, .bg-preview, .bg-stage { height: auto !important; min-height: 0 !important; }
  .bg-wrap, .bg-layout, .bg-preview { display: block; max-width: none; margin: 0; padding: 0; }
  .bg-stage { max-height: none; overflow: visible; padding: 0; background: none; border-radius: 0; }
  .bg-sheets { display: block; zoom: 1 !important; }
  /* A sheet exactly as tall as the paper can round a hair over it and push a blank page after it,
     so print each sheet 1mm short of the paper (the footer just sits 1mm higher). */
  .bg-sheet { box-shadow: none; height: calc(var(--sheet-h) - 1mm) !important; overflow: hidden; break-inside: avoid; }
  /* Break before each later sheet, never after the last one: a forced break after it makes a blank last page. */
  .bg-sheet + .bg-sheet { break-before: page; page-break-before: always; }
  .bg-sheet.is-port { page: port; }
  .bg-sheet.is-land { page: land; }
  .bg-sheet, .bg-sheet * { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
}

/* ---------- projector play (pl-) ---------- */
.bg-toolbar { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; margin-bottom: 8px; }
.bg-toolbar .bg-status { flex: 1; margin: 0; }
.pl-overlay { position: fixed; inset: 0; z-index: 2000; background: #fbf8ef; color: #1f2d27; font-family: "Microsoft YaHei", "PingFang SC", sans-serif; overflow: auto; }
.pl-overlay[hidden] { display: none; }
.pl-close { position: absolute; top: 12px; right: 14px; border: 0; background: none; font-size: 26px; color: #4b5f56; cursor: pointer; }
.pl-setup { position: relative; max-width: 560px; margin: 8vh auto; padding: 28px 32px; border-radius: 18px; background: #fff; box-shadow: 0 8px 30px rgba(0,0,0,.12); }
.pl-setup h2 { margin: 0 0 14px; color: #194f45; }
.pl-count { display: flex; gap: 8px; margin-bottom: 14px; }
.pl-count button { width: 52px; height: 44px; border: 1px solid #c9d6c2; border-radius: 10px; background: #fff; font-family: inherit; font-weight: 700; font-size: 1.1rem; cursor: pointer; }
.pl-count button[aria-pressed=true] { border-color: #356e57; background: #edf5df; box-shadow: inset 0 0 0 1px #356e57; }
.pl-names { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-bottom: 14px; }
.pl-names label { display: flex; align-items: center; gap: 8px; padding: 6px 10px; border: 2px solid var(--team); border-radius: 10px; }
.pl-names span { color: var(--team); font-size: 1.3rem; }
.pl-names input { flex: 1; min-width: 0; border: 0; font: inherit; font-size: 1rem; outline: none; }
.pl-opt { display: flex; align-items: center; gap: 8px; margin: 6px 0; }
.pl-start { margin-top: 14px; padding: 12px 28px; border: 0; border-radius: 12px; background: #c8553d; color: #fff; font-family: inherit; font-weight: 700; font-size: 1.1rem; cursor: pointer; }

.pl-game { position: relative; display: grid; grid-template-columns: 1fr minmax(220px, 300px); gap: 2vh; height: 100vh; box-sizing: border-box; padding: 2vh 2vw; }
.pl-board { display: flex; align-items: center; justify-content: center; min-height: 0; }
.pl-board svg { width: 100%; height: 100%; max-height: 96vh; }
.pl-side { position: relative; display: flex; flex-direction: column; align-items: stretch; gap: 1.6vh; padding: 2vh 18px; border-radius: 16px; background: #fff; box-shadow: 0 4px 18px rgba(0,0,0,.08); overflow: auto; }
.pl-side h2 { margin: 0 30px 0 0; color: #194f45; font-size: 1.3rem; }
.pl-teams { display: flex; flex-direction: column; gap: 8px; margin: 0; padding: 0; list-style: none; }
.pl-teams li { display: grid; grid-template-columns: auto 1fr; column-gap: 10px; align-items: center; padding: 8px 10px; border: 2px solid transparent; border-radius: 12px; background: #f6f3ea; }
.pl-teams li.is-turn { border-color: var(--team); background: #fff; box-shadow: 0 0 0 4px color-mix(in srgb, var(--team) 25%, transparent); }
.pl-teams small { grid-column: 2; color: #5d7168; }
.pl-chip { grid-row: span 2; display: grid; place-items: center; width: 34px; height: 34px; border-radius: 50%; background: var(--team); color: #fff; font-size: 1.1rem; }
.pl-die { font-size: 92px; line-height: 1; text-align: center; color: #194f45; transition: transform .07s; }
.pl-die.is-shake { transform: rotate(14deg) scale(1.06); }
.pl-rollstage { position: fixed; inset: 0; z-index: 6; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3vh; background: rgba(20,40,32,.28); pointer-events: none; }
.pl-bigdie { width: min(34vh, 34vw); height: min(34vh, 34vw); border-radius: 18%; background: #fff; border: max(6px, .9vh) solid var(--team, #194f45); box-shadow: 0 2.4vh 5vh rgba(0,0,0,.3); }
.pl-bigdie svg { display: block; width: 100%; height: 100%; }
.pl-rollnum { margin: 0; padding: .5em 1.2em; border-radius: 999px; background: #fff; color: #194f45; font-weight: 800; font-size: clamp(1.2rem, 3.6vh, 2.2rem); box-shadow: 0 6px 18px rgba(0,0,0,.18); opacity: 0; transform: translateY(1vh); transition: opacity .2s, transform .2s; }
.pl-rollnum.is-in { opacity: 1; transform: none; }
.pl-rollnum b { color: #c8553d; font-size: 1.3em; }
.pl-roll { padding: 14px; border: 0; border-radius: 14px; background: #c8553d; color: #fff; font-family: inherit; font-weight: 800; font-size: 1.3rem; cursor: pointer; }
.pl-roll:hover { filter: brightness(1.06); }
.pl-msg { min-height: 2.6em; margin: 0; color: #194f45; font-weight: 700; font-size: 1.05rem; }
.pl-hint { margin: 0; color: #5d7168; }
.pl-small { margin-top: auto; padding: 8px; border: 1px solid #c9d6c2; border-radius: 10px; background: #fff; font: inherit; cursor: pointer; }
.pl-pawn { transition: transform .22s ease-out; }
.pl-pawn circle { filter: drop-shadow(0 .4px .6px rgba(0,0,0,.4)); }
.pl-hit { fill: transparent; cursor: pointer; }
.pl-hit:hover { fill: rgba(53,110,87,.12); }

.pl-pop { position: fixed; inset: 0; z-index: 5; display: grid; place-items: center; background: rgba(20,40,32,.45); }
.pl-pop[hidden] { display: none; }
.pl-card { min-width: min(560px, 90vw); max-width: 90vw; padding: 4vh 4vw; border-radius: 24px; background: #fff; text-align: center; box-shadow: 0 20px 60px rgba(0,0,0,.3); animation: pl-in .25s ease-out; }
@keyframes pl-in { from { transform: scale(.85); opacity: 0; } }
@media (prefers-reduced-motion: reduce) { .pl-card { animation: none; } .pl-pawn { transition: none; } }
.pl-word, .pl-action, .pl-cardback { display: flex; flex-direction: column; align-items: center; gap: 1.2vh; }
.pl-word img { width: 18vh; height: 18vh; }
.pl-word b, .pl-action b, .pl-cardback b { font-family: "KaiTi", "STKaiti", "Kaiti SC", serif; font-size: 13vh; line-height: 1.1; }
.pl-action b, .pl-cardback b { font-size: 8vh; }
.pl-py { font-family: Andika, sans-serif; font-size: 5vh; color: #4b5f56; }
.pl-word small, .pl-action small { color: #7b8a83; font-size: 2.6vh; }
.pl-icon, .pl-cardback { font-size: 16vh; line-height: 1; }
.pl-task { display: flex; flex-direction: column; align-items: center; margin: 2vh 0 0; padding: 1.4vh 2vw; border-radius: 14px; background: #fff3c4; font-size: 4.4vh; font-weight: 700; color: #6a4500; }
.pl-task small { font-size: 2.4vh; font-weight: 400; }
.pl-buttons { display: flex; justify-content: center; gap: 2vw; margin-top: 3.5vh; }
.pl-buttons button { min-width: 200px; padding: 1.6vh 2vw; border: 2px solid #c9d6c2; border-radius: 16px; background: #fff; font-family: inherit; font-weight: 800; font-size: 3vh; cursor: pointer; }
.pl-buttons .is-main { border-color: #356e57; background: #356e57; color: #fff; }
.pl-buttons .is-yes { border-color: #2f9e44; background: #2f9e44; }
.pl-buttons .is-no { color: #c8553d; border-color: #e8b3a8; }
.pl-win { display: flex; flex-direction: column; align-items: center; gap: 1vh; font-size: 18vh; line-height: 1; }
.pl-win b { font-size: 9vh; color: var(--team); }
.pl-win span { font-size: 6vh; }
@media (max-width: 820px) { .pl-game { grid-template-columns: 1fr; height: auto; } }

/* ---------- online rooms (rm-) ---------- */
.rm-note { color: #5d7168; font-size: .92rem; }
.rm-error { color: #b42318; font-weight: 700; }
.rm-error a { color: #b42318; }
.rm-code { display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 12px; border-radius: 14px; background: #194f45; color: #fff; text-align: center; }
.rm-code span { font-size: .85rem; opacity: .85; }
.rm-code b { font-size: 2.6rem; letter-spacing: .12em; line-height: 1.1; }
.rm-code small { font-size: .8rem; opacity: .9; word-break: break-all; }
.rm-qr { margin-top: 8px; padding: 6px; border-radius: 8px; background: #fff; }
.rm-qr:empty { display: none; }
.rm-members { grid-column: 2; display: flex; flex-wrap: wrap; gap: 4px; }
.rm-members i { padding: 1px 7px; border-radius: 999px; background: #fff; font-style: normal; font-size: .78rem; border: 1px solid #e0e6dc; }
.rm-members i.is-active { border-color: var(--team); background: var(--team); color: #fff; font-weight: 700; }
.pl-teams li.is-mine { outline: 2px dashed var(--team); outline-offset: 2px; }
.rm-who { margin: 0 0 1vh; color: #5d7168; font-weight: 700; font-size: 2.4vh; }
.rm-ask { margin: 1vh 0 0; color: #194f45; font-weight: 700; font-size: 2.8vh; }
.rm-choices { display: grid; gap: 1.4vh; margin-top: 2.4vh; }
.rm-choices button { padding: 1.8vh 2vw; border: 2px solid #c9d6c2; border-radius: 16px; background: #fff; font-size: 3.4vh; font-weight: 700; cursor: pointer; }
.rm-choices button:hover:not(:disabled) { border-color: #356e57; background: #edf5df; }
.rm-choices button:disabled { cursor: default; color: #1f2d27; }
.rm-choices button.is-answer { border-color: #2f9e44; background: #d3f9d8; }

.rm-page { margin: 0; min-height: 100vh; background: #fbf8ef; color: #1f2d27; font-family: "Microsoft YaHei", "PingFang SC", sans-serif; }
.rm-join { max-width: 440px; margin: 0 auto; padding: 32px 18px; display: flex; flex-direction: column; gap: 12px; }
.rm-join h1 { margin: 0 0 6px; color: #194f45; font-size: 1.6rem; }
.rm-join label { display: flex; flex-direction: column; gap: 4px; font-weight: 700; }
.rm-join input { padding: 12px; border: 1px solid #c9d6c2; border-radius: 10px; font: inherit; font-size: 1.2rem; }
.rm-teams { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.rm-teams p { grid-column: 1 / -1; margin: 4px 0 0; font-weight: 700; }
.rm-teams button { display: flex; align-items: center; gap: 6px; padding: 10px; border: 2px solid var(--team); border-radius: 12px; background: #fff; font: inherit; cursor: pointer; }
.rm-teams button span { color: var(--team); font-size: 1.2rem; }
.rm-teams button small { margin-left: auto; color: #5d7168; }
.rm-teams button[aria-pressed=true] { background: var(--team); color: #fff; }
.rm-teams button[aria-pressed=true] span { color: #fff; }
.rm-join .pl-start { text-align: center; text-decoration: none; }
.rm-student { display: flex; flex-direction: column; gap: 10px; max-width: 900px; margin: 0 auto; padding: 10px; }
.rm-top { display: flex; align-items: center; gap: 10px; font-size: 1.1rem; }
.rm-top .pl-chip { width: 30px; height: 30px; }
.rm-board svg { width: 100%; height: auto; max-height: 60vh; }
.rm-panel { display: flex; flex-direction: column; gap: 10px; }
.rm-big { margin: 0; font-size: 1.3rem; font-weight: 700; text-align: center; }
.rm-you { color: #c8553d; }
.rm-roll { font-size: 1.6rem; padding: 18px; }
.rm-die { font-size: 64px; }
.rm-page .pl-card { min-width: 0; width: min(560px, 92vw); padding: 24px 18px; }
.rm-page .pl-word b { font-size: 4.2rem; }
.rm-page .pl-word img { width: 96px; height: 96px; }
.rm-page .pl-py { font-size: 1.6rem; }
.rm-page .rm-choices button { font-size: 1.4rem; padding: 14px; }
.rm-page .rm-ask, .rm-page .rm-who { font-size: 1.1rem; }
.rm-page .pl-action b { font-size: 2.4rem; }
.rm-page .pl-icon { font-size: 4.5rem; }
.rm-page .pl-task { font-size: 1.3rem; }
