:root {
  --ink: #2f528a;
  --paper: #eaf3ff;
  --panel: rgba(255, 255, 255, 0.94);
  --line: rgba(91, 141, 217, 0.42);
  --red: #f78fb8;
  --gold: #ffd94a;
  --blue: #5b8dd9;
  --teal: #7cc4f0;
  --shadow: 0 18px 45px rgba(47, 82, 138, 0.2);
  /* 主题变量：默认主色调（浅蓝），万圣夜在 body[data-theme="halloween"] 覆盖 */
  --bg-body: #9cc0ee;
  --bg-shell: #a9c8f2;
  --frame-bg: #dcecfd;
  --bar-grad: linear-gradient(92deg, #6d9ce8 0%, #8fb4f2 52%, #6d9ce8 100%);
  --bar-grad-2: linear-gradient(92deg, #6d9ce8, #8fb4f2);
  --stroke: #5f92dd;
  --board-1: #cfe2fa;
  --board-2: #dbeafc;
  --board-3: #c3dbfa;
  --accent: #8fb4f2;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  overflow: hidden;
  color: var(--ink);
  font-family: "Microsoft YaHei", "PingFang SC", system-ui, sans-serif;
  background: var(--bg-body);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

button,
input,
select,
textarea {
  font: inherit;
}

button {
  cursor: pointer;
}

.app-shell {
  width: 100vw;
  height: 100vh;
  display: grid;
  place-items: stretch;
  padding: 0;
  background:
    linear-gradient(135deg, rgba(122, 165, 232, 0.28), transparent 36%),
    linear-gradient(225deg, rgba(255, 255, 255, 0.3), transparent 38%),
    var(--bg-shell);
}

body[data-theme="halloween"] .app-shell {
  background:
    radial-gradient(ellipse at 50% -20%, rgba(255, 145, 56, 0.16), transparent 55%),
    linear-gradient(135deg, rgba(122, 76, 205, 0.28), transparent 40%),
    var(--bg-shell);
}

.broadcast-frame {
  width: 100vw;
  height: 100vh;
  max-height: 100vh;
  display: grid;
  grid-template-rows: 8.5% 91.5%;
  border-radius: 0;
  position: relative;
  overflow: hidden;
  background: var(--frame-bg);
  box-shadow: none;
}

/* 参考图样式：页面最外圈白色虚线装饰框 */
.broadcast-frame::after {
  content: "";
  position: absolute;
  inset: 5px;
  border: 2px dashed rgba(255, 255, 255, 0.85);
  border-radius: 14px;
  pointer-events: none;
  z-index: 60;
}

.topbar {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 1vw;
  padding: 0.7% 1.3%;
  background: var(--bar-grad);
  border-bottom: 2px solid rgba(255, 255, 255, 0.7);
}

.topbar h1 {
  color: #fff;
  text-shadow: 0 1px 2px rgba(47, 82, 138, 0.35);
}

.brand-block p {
  color: rgba(255, 255, 255, 0.88);
}

.brand-block {
  display: flex;
  align-items: center;
  gap: 0.75vw;
  min-width: 0;
}

.brand-mark {
  width: clamp(34px, 3vw, 54px);
  aspect-ratio: 1;
  border-radius: 50%;
  display: block;
  object-fit: cover;
  border: 3px solid rgba(255, 255, 255, 0.95);
  box-shadow: 0 6px 14px rgba(47, 82, 138, 0.25);
}

.brand-block h1 {
  margin: 0;
  font-size: clamp(18px, 1.55vw, 30px);
  line-height: 1;
}

.brand-block p {
  margin: 0.25em 0 0;
  color: rgba(47, 82, 138, 0.58);
  font-size: clamp(10px, 0.72vw, 14px);
  font-weight: 700;
}

.game-tabs {
  display: flex;
  gap: 0.18vw;
  padding: 0.22vw;
  border: 1px solid rgba(255, 255, 255, 0.65);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.22);
}

.tab-button {
  height: clamp(31px, 2.75vw, 48px);
  padding: 0 0.42vw;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: rgba(255, 255, 255, 0.92);
  font-weight: 900;
  font-size: clamp(10px, 0.66vw, 14px);
}

.tab-button.is-active {
  color: #3f6bb5;
  background: #fff;
  box-shadow: 0 2px 6px rgba(47, 82, 138, 0.28);
}

.screen-badge {
  position: relative;
  justify-self: end;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 0.4vw 0.75vw;
  background: rgba(255, 255, 255, 0.62);
  color: rgba(47, 82, 138, 0.62);
  font-size: clamp(10px, 0.72vw, 14px);
  font-weight: 900;
  width: clamp(118px, 8.6vw, 168px);
  height: clamp(34px, 2.85vw, 52px);
  display: grid;
  place-items: center;
  overflow: hidden;
}

.screen-badge img {
  position: absolute;
  inset: 5% 7%;
  display: block;
  width: 86%;
  height: 90%;
  object-fit: contain;
}

.game-view {
  position: relative;
  min-height: 0;
}

.game-panel {
  position: absolute;
  inset: 0;
  opacity: 0;
  visibility: hidden;
}

.game-panel.is-active {
  opacity: 1;
  visibility: visible;
}

.monopoly-panel {
  overflow: hidden;
}

.monopoly-scroll {
  height: 100%;
  /* 禁止左右滑动：只允许纵向滚动 */
  overflow-x: hidden;
  overflow-y: auto;
  scroll-snap-type: none;
}

.monopoly-layout,
.bomb-layout,
.cards-layout,
.lottery-layout {
  height: 100%;
  min-height: 100%;
  display: grid;
  gap: 0;
  padding: 0.85%;
  scroll-snap-align: start;
}

.monopoly-layout {
  grid-template-columns: clamp(232px, 13.6vw, 312px) minmax(0, 1fr) clamp(172px, 12vw, 232px) clamp(180px, 10.4vw, 236px);
}

/* ---------- 棋盘与右侧设置之间的竖列 UI「玩法」 ---------- */
.vertical-ui {
  padding: 0 0.25vw;
}

.panel-section.vertical-ui-card {
  height: 100%;
  position: relative;
  overflow: hidden;
  /* 标题 / 礼物上传位 / 历史步数列表：列表占剩余高度，从上往下排 */
  grid-template-rows: auto auto minmax(0, 1fr);
  /* 底色纯白：背景图单独画在顶部区域（见 ::after） */
  background: #ffffff;
}

/* 背景图层：只显示图片底部 1/3 区域（对齐卡片最下方） */
.panel-section.vertical-ui-card.has-uploaded-bg::after {
  content: "";
  position: absolute;
  inset: 66.67% 0 0 0;
  background: var(--board-bg, none) bottom center / cover no-repeat;
  z-index: 0;
}

.panel-section.vertical-ui-card.has-uploaded-bg::before {
  content: "";
  position: absolute;
  inset: 0;
  background: rgba(255, 255, 255, 0.87);
  pointer-events: none;
  z-index: 1;
}

/* 卡片内容压在蒙层之上 */
.vertical-ui-card > * {
  position: relative;
  z-index: 2;
}

.vertical-ui-title {
  justify-content: center;
  padding: 0.42vw 0.4vw;
}

.vertical-ui-title h2 {
  font-size: clamp(11px, 0.85vw, 16px);
}

.vertical-ui-body {
  min-height: 0;
  padding: 0.4vw 0.3vw;
  overflow-y: auto;
}

/* ---------- 顶栏居中的礼物图标（可上传透明底图片） ---------- */
.topbar-center {
  display: flex;
  align-items: center;
  gap: 0.5vw;
  min-width: 0;
}

.gift-slot {
  position: relative;
  flex: none;
  width: clamp(44px, 3.6vw, 64px);
  height: clamp(31px, 2.75vw, 48px);
  display: grid;
  place-items: center;
  border: 1px dashed rgba(255, 255, 255, 0.85);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.12);
}

.gift-slot.has-image {
  border-style: solid;
  border-color: rgba(255, 255, 255, 0.55);
  background: transparent;
}

.gift-slot img {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  display: block;
}

.gift-upload {
  border: 0;
  background: transparent;
  color: #fff;
  font-weight: 900;
  font-size: clamp(9px, 0.62vw, 13px);
  line-height: 1.05;
  padding: 0;
  cursor: pointer;
  text-shadow: 0 1px 2px rgba(47, 82, 138, 0.4);
}

.gift-slot.has-image .gift-upload {
  display: none;
}

.gift-clear {
  position: absolute;
  top: -6px;
  right: -6px;
  width: 18px;
  height: 18px;
  display: none;
  place-items: center;
  border: 2px solid #fff;
  border-radius: 50%;
  background: #f2728c;
  color: #fff;
  font-size: 10px;
  line-height: 1;
  padding: 0;
  cursor: pointer;
}

.gift-slot.has-image .gift-clear {
  display: grid;
}

/* 编辑模式下：顶栏只保留 live 输出用的礼物展示位（上传入口在「玩法」栏） */
body:not(.live-output) .gift-slot.gift-live {
  display: none;
}

/* 「玩法」栏内的礼物上传位：透明底 PNG */
.vertical-ui-card .gift-slot.gift-slot-card {
  width: clamp(56px, 4.4vw, 82px);
  height: clamp(56px, 4.4vw, 82px);
  margin: 0.55vw auto 0;
  border: 1.5px dashed #b9d2f2;
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.78);
}

.vertical-ui-card .gift-slot.gift-slot-card.has-image {
  border-style: solid;
  border-color: #9dbef0;
  background: transparent;
}

.vertical-ui-card .gift-slot .gift-upload {
  color: #5b83c9;
  text-shadow: none;
  font-size: clamp(10px, 0.66vw, 13px);
}

.vertical-ui-card .gift-slot .gift-clear {
  border-color: #fff;
}

.board-area,
.bomb-stage,
.cards-stage,
.lottery-stage {
  min-width: 0;
  min-height: 0;
}

/* 棋盘与左右 UI 卡片同高，紧贴左侧操作台，边缘一圈蓝色描边 */
.board-area {
  display: grid;
  align-items: stretch;
  /* 棋盘横向撑满自己的列，右侧不留空隙，竖栏正好贴住棋盘右边缘 */
  justify-items: stretch;
  /* 右侧留白收窄，让棋盘向右适度扩展 */
  padding: 0 0.45vw 0 0.75vw;
}

.monopoly-layout .board-surface {
  width: auto;
  height: 100%;
  max-width: 100%;
  aspect-ratio: 1.36;
  border: 4px solid var(--stroke);
  border-radius: 18px;
  box-shadow:
    inset 0 0 0 3px rgba(255, 255, 255, 0.9),
    0 10px 26px rgba(47, 82, 138, 0.22);
}

.board-surface {
  --board-bg: none;
  container-type: size;
  position: relative;
  width: 100%;
  height: 100%;
  border-radius: 16px;
  overflow: hidden;
  border: 3px solid #fff;
  background:
    var(--board-bg) center / cover no-repeat,
    linear-gradient(160deg, var(--board-1) 0%, var(--board-2) 60%, var(--board-3) 100%);
}

/* 白色磨砂层：透出底下垫图的颜色（纯半透明，不做模糊，保证画面锐利） */
.board-surface::before {
  content: "";
  position: absolute;
  inset: 0;
  background: rgba(255, 255, 255, 0.35);
  pointer-events: none;
  z-index: 0;
}

/* 上传棋盘背景图后：固定 87% 白蒙层，图片像在白纸后面透出一点颜色（朦胧） */
.board-surface.has-uploaded-bg::before {
  background: rgba(255, 255, 255, 0.87);
}

/* 图片本体更实，保证上传后图能清楚显示（底色仍是白色垫底） */
.board-surface.has-uploaded-bg {
  background:
    var(--board-bg) center / cover no-repeat,
    #ffffff;
}

.tile-layer,
.peg-layer {
  position: absolute;
  inset: 0;
  z-index: 1;
}

.dice-console {
  z-index: 3;
}

.tile-layer,
.peg-layer {
  position: absolute;
  inset: 0;
}

.peg-layer {
  pointer-events: none;
}

.board-tile {
  position: absolute;
  /* 以原中心等比缩小约 20%（位置不变） */
  width: calc(8.3cqw + 5px);
  height: 6.7cqw;
  transform: translate(-50%, -50%);
  border: 0;
  background: transparent;
  color: var(--ink);
  z-index: 2;
  padding: 0;
  /* 静止时不留 3D 透视上下文，避免每个格子被栅格化成模糊层（翻转时才启用） */
  perspective: none;
}

.board-tile.is-flipped {
  perspective: 420px;
}

.tile-card {
  position: absolute;
  inset: 0;
  display: block;
  overflow: visible;
  transform-style: preserve-3d;
  transition: transform 0.42s cubic-bezier(0.22, 0.86, 0.34, 1);
}

.board-tile.is-flipped .tile-card {
  transform: rotateY(180deg);
}

.tile-face {
  position: absolute;
  inset: 0;
  border-radius: clamp(18px, 2.35vw, 40px);
  border: 3px solid #ffb23c;
  box-shadow:
    inset 0 0 0 2px rgba(255, 255, 255, 0.96),
    0 0 0 2px rgba(255, 178, 60, 0.12);
  display: grid;
  place-items: start end;
  padding: 0.32vw;
  backface-visibility: hidden;
  overflow: visible;
}

.tile-front {
  background: var(--tile-color);
}

.tile-back {
  background: rgba(255, 248, 232, 0.96);
  transform: rotateY(180deg);
  color: var(--ink);
  border-color: #ee6c80;
  place-items: center;
  padding: 0.5vw;
  overflow: hidden;
}

/* 起点 / 终点：星星形状（金色渐变 + 外发光） */
.board-tile.is-start,
.board-tile.is-finish {
  width: calc(9.2cqw + 5px);
  height: 8.3cqw;
  z-index: 4;
}

.board-tile.is-start .tile-card,
.board-tile.is-finish .tile-card {
  filter: drop-shadow(0 2px 0 rgba(122, 165, 224, 0.55)) drop-shadow(0 0 4px rgba(160, 196, 245, 0.5));
}

.board-tile.is-start .tile-front,
.board-tile.is-finish .tile-front {
  border: 0;
  border-radius: 0;
  box-shadow: none;
  padding: 0;
  place-items: center;
  /* 参考图样式：白色星星 + 淡蓝渐变 + 蓝色描边 + 蓝色文字 */
  color: #3f6bb5;
  background: radial-gradient(circle at 50% 30%, #ffffff 0%, #f4f9ff 42%, #dceaff 74%, #c4dcfd 100%);
  clip-path: polygon(50% 0%, 61.5% 34.5%, 98% 35%, 68.5% 57%, 79.5% 91%, 50% 70.5%, 20.5% 91%, 31.5% 57%, 2% 35%, 38.5% 34.5%);
  /* clip-path 无法直接加边框，用多重投影勾出蓝色轮廓 */
  filter:
    drop-shadow(0 0 1px var(--accent))
    drop-shadow(0 0 1px var(--accent))
    drop-shadow(0 1px 2px rgba(95, 146, 221, 0.5));
}

.board-tile.is-current {
  outline: 4px solid rgba(255, 212, 74, 0.92);
  z-index: 5;
}

.tile-index {
  min-width: 1.18em;
  min-height: 1.18em;
  display: grid;
  place-items: center;
  transform: translate(48%, -48%);
  border-radius: 999px;
  color: #fff;
  background: #d35a00;
  -webkit-text-stroke: 1px #fff;
  paint-order: stroke fill;
  text-shadow:
    0 1px 0 #b94b00,
    1px 0 0 #b94b00,
    -1px 0 0 #b94b00,
    0 -1px 0 #b94b00;
  font-size: clamp(10px, 0.9vw, 17px);
  font-weight: 950;
  line-height: 1;
}

.board-tile.is-start .tile-index,
.board-tile.is-finish .tile-index {
  place-self: center;
  min-width: 0;
  min-height: 0;
  transform: translateY(-6%);
  border-radius: 0;
  background: transparent;
  color: #3f6bb5;
  -webkit-text-stroke: 0;
  paint-order: stroke fill;
  text-shadow: none;
  font-size: clamp(13px, 1.1vw, 22px);
  letter-spacing: 0.02em;
}

.tile-name {
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
  font-size: clamp(7px, 0.54vw, 11px);
  font-weight: 950;
  line-height: 1.16;
  text-align: center;
  overflow-wrap: anywhere;
}

.peg {
  position: absolute;
  left: var(--x);
  top: var(--y);
  transform: translate(calc(-50% + var(--dx)), calc(-50% + var(--dy)));
  width: clamp(20px, 2.6cqw, 38px);
  aspect-ratio: 1;
  border-radius: 50% 50% 44% 44%;
  border: 3px solid #fff;
  background: var(--player-color);
  color: #fff;
  font-weight: 950;
  box-shadow: 0 6px 12px rgba(20, 20, 20, 0.25);
  z-index: 10;
  pointer-events: auto;
}

.peg::after {
  content: "";
  position: absolute;
  left: 50%;
  bottom: -22%;
  width: 44%;
  height: 34%;
  transform: translateX(-50%);
  background: inherit;
  clip-path: polygon(50% 100%, 0 0, 100% 0);
}

.peg.is-active {
  outline: 4px solid var(--gold);
}

.dice-console {
  position: absolute;
  left: 50%;
  top: 54%;
  transform: translate(-50%, -50%);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.8vw;
  z-index: 8;
  border: 0;
  background: transparent;
  box-shadow: none;
  backdrop-filter: none;
  padding: 0;
}

/* 骰子 + 点数气泡的容器 */
.dice-stage {
  position: relative;
  display: grid;
  place-items: center;
  padding: 0.2vw;
}

/* 摇骰按钮 + 队伍下拉 */
.dice-actions {
  display: flex;
  align-items: center;
  gap: 0.55vw;
}

.dice-player-pick {
  display: grid;
  gap: 0.18vw;
  min-width: 0;
}

.pick-label {
  font-size: clamp(9px, 0.66vw, 12px);
  color: rgba(47, 82, 138, 0.66);
  font-weight: 900;
}

.dice-player-pick select {
  height: clamp(36px, 2.9vw, 48px);
  min-width: clamp(96px, 8vw, 158px);
  max-width: clamp(112px, 9.4vw, 186px);
  padding: 0 0.5vw;
  border: 2px solid var(--accent);
  border-radius: 12px;
  background: #fff;
  color: var(--ink);
  font-weight: 950;
  font-size: clamp(11px, 0.8vw, 15px);
  box-shadow: 0 3px 0 rgba(91, 141, 217, 0.22);
}

/* 格子事件弹窗（骰子上方） */
.board-toast {
  position: absolute;
  left: 50%;
  bottom: calc(100% + 0.4vw);
  transform: translateX(-50%);
  min-width: clamp(150px, 13vw, 250px);
  max-width: 22vw;
  padding: 0.5vw 0.85vw;
  border-radius: 14px;
  background: #fff;
  border: 2px solid var(--accent);
  box-shadow: 0 8px 20px rgba(47, 82, 138, 0.26);
  color: var(--ink);
  font-weight: 950;
  font-size: clamp(11px, 0.82vw, 16px);
  text-align: center;
  line-height: 1.3;
  z-index: 14;
  animation: toastIn 220ms cubic-bezier(0.2, 0.9, 0.3, 1.25);
}

.board-toast[hidden] {
  display: none;
}

.board-toast::after {
  content: "";
  position: absolute;
  left: 50%;
  top: 100%;
  transform: translateX(-50%);
  border: 9px solid transparent;
  border-top-color: var(--accent);
}

.board-toast .toast-title {
  display: block;
  color: #3f6bb5;
  font-size: clamp(12px, 0.92vw, 18px);
}

.board-toast .toast-event {
  display: block;
  margin-top: 0.18vw;
  color: #d4628f;
}

.board-toast.is-out {
  animation: toastOut 240ms ease forwards;
}

@keyframes toastIn {
  from { opacity: 0; transform: translate(-50%, 10px) scale(0.94); }
  to { opacity: 1; transform: translate(-50%, 0) scale(1); }
}

@keyframes toastOut {
  to { opacity: 0; transform: translate(-50%, -10px) scale(0.96); }
}

/* ---------- 3D 立体骰子（移植自开源项目 controlDice） ---------- */
.dice-container {
  --die-size: clamp(58px, 4.9vw, 94px);
  position: relative;
  width: var(--die-size);
  height: var(--die-size);
  perspective: 900px;
  perspective-origin: 50% 44%;
  z-index: 4;
  cursor: pointer;
}

.dice-container.is-rolling {
  animation: diceHop 0.44s ease-in-out infinite;
}

.dice-cube {
  position: relative;
  width: 100%;
  height: 100%;
  transform-style: preserve-3d;
  transform: rotateX(0deg) rotateY(0deg);
  will-change: transform;
}

@keyframes spin-to-face {
  0% {
    transform: rotateX(var(--start-rotate-x)) rotateY(var(--start-rotate-y));
  }
  100% {
    transform: rotateX(var(--end-rotate-x)) rotateY(var(--end-rotate-y));
  }
}

@keyframes diceHop {
  0%, 100% { transform: scale(1); }
  50% { transform: translateY(-8%) scale(1.06); }
}

.dice-shadow {
  position: absolute;
  left: 50%;
  top: 104%;
  width: 96%;
  height: 24%;
  transform: translate(-50%, -50%);
  border-radius: 50%;
  background: radial-gradient(ellipse at center, rgba(47, 82, 138, 0.34), rgba(47, 82, 138, 0) 74%);
  z-index: -1;
  transition: opacity 300ms ease, transform 300ms ease;
}

.dice-container.is-rolling .dice-shadow {
  opacity: 0.45;
  transform: translate(-50%, -50%) scale(0.78);
}

.dice-face {
  position: absolute;
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
  border-radius: calc(var(--die-size) * 0.2);
  background: linear-gradient(150deg, #ffffff 0%, #f7f9fc 55%, #e8edf5 100%);
  border: 1.5px solid rgba(47, 82, 138, 0.22);
  box-shadow:
    inset 0 calc(var(--die-size) * 0.055) calc(var(--die-size) * 0.12) rgba(255, 255, 255, 0.98),
    inset 0 calc(var(--die-size) * -0.07) calc(var(--die-size) * 0.13) rgba(47, 82, 138, 0.14),
    0 calc(var(--die-size) * 0.03) calc(var(--die-size) * 0.09) rgba(47, 82, 138, 0.12);
  backface-visibility: hidden;
}

/* 六个面的朝向：front=1 back=6 top=3 bottom=4 right=2 left=5 */
.dice-face.front {
  transform: translateZ(calc(var(--die-size) / 2));
}

.dice-face.back {
  transform: rotateY(180deg) translateZ(calc(var(--die-size) / 2));
  background: linear-gradient(150deg, #f4f6fa 0%, #e9edf4 100%);
}

.dice-face.right {
  transform: rotateY(90deg) translateZ(calc(var(--die-size) / 2));
  background: linear-gradient(150deg, #fcfdff 0%, #eff2f8 100%);
}

.dice-face.left {
  transform: rotateY(-90deg) translateZ(calc(var(--die-size) / 2));
  background: linear-gradient(150deg, #f6f8fb 0%, #eaeef5 100%);
}

.dice-face.top {
  transform: rotateX(90deg) translateZ(calc(var(--die-size) / 2));
  background: linear-gradient(150deg, #ffffff 0%, #f8fafd 100%);
}

.dice-face.bottom {
  transform: rotateX(-90deg) translateZ(calc(var(--die-size) / 2));
  background: linear-gradient(150deg, #edf0f6 0%, #e0e5ee 100%);
}

.die-dot {
  position: absolute;
  width: 18%;
  aspect-ratio: 1;
  border-radius: 50%;
  transform: translate(-50%, -50%);
  background: radial-gradient(circle at 32% 30%, #4c5566, #14181f 78%);
  box-shadow:
    inset 0 1px 1px rgba(255, 255, 255, 0.28),
    0 1px 3px rgba(20, 24, 31, 0.28);
}

.roll-total {
  position: absolute;
  right: -34%;
  top: -14%;
  min-width: clamp(38px, 3.4vw, 54px);
  border-radius: 999px;
  background: rgba(47, 82, 138, 0.88);
  color: var(--paper);
  padding: 0.18vw 0.55vw;
  font-size: clamp(13px, 1.1vw, 20px);
  line-height: 1;
  font-weight: 950;
  text-align: center;
  z-index: 5;
}

.roll-label {
  position: absolute;
  left: 50%;
  top: 108%;
  transform: translateX(-50%);
  width: clamp(96px, 8vw, 150px);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.92);
  border: 1px solid rgba(143, 180, 242, 0.7);
  color: rgba(47, 82, 138, 0.8);
  padding: 0.22vw 0.45vw;
  font-size: clamp(9px, 0.68vw, 12px);
  line-height: 1.2;
  font-weight: 900;
  text-align: center;
  white-space: nowrap;
}

.host-panel {
  min-width: 0;
  min-height: 0;
  display: grid;
  gap: 0.6vw;
  padding: 0 1.1% 0 0.5vw;
}

.monopoly-controls {
  /* 备选玩法已改为弹窗，格子事件独占剩余高度 */
  grid-template-rows: auto minmax(0, 1fr);
}

/* 参考图风格：白色圆角卡片 + 蓝色描边 */
.panel-section {
  min-height: 0;
  display: grid;
  grid-template-rows: auto 1fr;
  overflow: hidden;
  border-radius: 16px;
  border: 2px solid var(--accent);
  background: #fff;
  box-shadow: 0 4px 0 rgba(91, 141, 217, 0.16);
}

/* ---------- 左栏：对局信息（参考图左侧栏样式） ---------- */
.side-panel {
  min-width: 0;
  min-height: 0;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  gap: 0.6vw;
  padding: 0 0.5vw 0 1.1%;
}

.info-card {
  border: 2px solid var(--accent);
  border-radius: 16px;
  background: #fff;
  box-shadow: 0 4px 0 rgba(91, 141, 217, 0.16);
  padding: 0.55vw;
  display: grid;
  gap: 0.4vw;
}

.info-head {
  display: flex;
  align-items: center;
  gap: 0.6vw;
  min-width: 0;
}

.info-avatar {
  width: clamp(52px, 4vw, 74px);
  aspect-ratio: 1;
  border-radius: 50%;
  object-fit: cover;
  border: 3px solid var(--accent);
  background: #fff;
  box-shadow: 0 4px 10px rgba(47, 82, 138, 0.22);
  flex: none;
}

.info-head-text {
  display: grid;
  gap: 0.25vw;
  min-width: 0;
}

.info-team {
  justify-self: start;
  padding: 0.24vw 0.9vw;
  border-radius: 999px;
  background: var(--bar-grad-2);
  color: #fff;
  font-weight: 950;
  font-size: clamp(13px, 1.05vw, 20px);
  line-height: 1.1;
  box-shadow: 0 3px 0 rgba(47, 82, 138, 0.18);
}

.info-sub {
  color: rgba(47, 82, 138, 0.6);
  font-size: clamp(9px, 0.7vw, 13px);
  font-weight: 900;
}

.info-rows {
  display: grid;
  gap: 0.35vw;
}

.info-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.5vw;
  padding: 0.3vw 0.55vw;
  border-radius: 10px;
  background: #eef5ff;
  border: 1px solid rgba(91, 141, 217, 0.3);
  font-size: clamp(10px, 0.78vw, 15px);
  min-width: 0;
}

.info-row span {
  color: rgba(47, 82, 138, 0.62);
  font-weight: 900;
  flex: none;
}

.info-row strong {
  color: var(--ink);
  font-weight: 950;
  text-align: right;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* ---------- 左下：VTS 画面框（只保留带爱心的窗口，正方形，可点击添加画面） ---------- */
.vts-frame {
  position: relative;
  min-height: 0;
  width: 100%;
  aspect-ratio: 1 / 1;
  max-height: 46vh;
  align-self: start;
}

.vts-window {
  position: relative;
  height: 100%;
  min-height: 0;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  gap: 0.4vw;
  padding: 0.45vw;
  border-radius: 16px;
  background: #fff;
  border: 2.5px solid #8ec4f5;
  box-shadow:
    inset 0 0 0 2.5px #fff,
    0 0 0 2px rgba(207, 230, 251, 0.95),
    0 5px 0 rgba(91, 141, 217, 0.22);
  z-index: 1;
}

.vts-titlebar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.28vw 0.55vw;
  border-radius: 10px;
  background: linear-gradient(180deg, #d5e9fc 0%, #a9d3f6 100%);
  border: 1.5px solid rgba(142, 196, 245, 0.8);
}

.vts-hearts {
  display: flex;
  gap: 0.34vw;
}

.vts-hearts i {
  font-style: normal;
  color: #fff;
  font-size: clamp(12px, 1vw, 18px);
  line-height: 1;
  text-shadow:
    1px 1px 0 #5ea6ec, -1px 1px 0 #5ea6ec, 1px -1px 0 #5ea6ec, -1px -1px 0 #5ea6ec,
    0 1.5px 0 #5ea6ec, 0 -1.5px 0 #5ea6ec, 1.5px 0 0 #5ea6ec, -1.5px 0 0 #5ea6ec;
}

.vts-win-controls {
  display: flex;
  gap: 0.3vw;
}

.vts-win-controls i {
  font-style: normal;
  width: clamp(16px, 1.3vw, 24px);
  height: clamp(16px, 1.3vw, 24px);
  display: grid;
  place-items: center;
  border-radius: 6px;
  background: #fff;
  border: 1.5px solid #5ea6ec;
  color: #4a90dd;
  font-size: clamp(9px, 0.7vw, 12px);
  font-weight: 950;
  line-height: 1;
}

/* 中间画面区：默认蓝色斜条纹；点击可捕获窗口/屏幕或上传图片 */
.vts-content {
  min-height: 0;
  width: 100%;
  padding: 0;
  cursor: pointer;
  border-radius: 12px;
  border: 2px solid #9cc8f3;
  background-color: var(--board-2);
  background-image: repeating-linear-gradient(45deg, var(--board-2) 0 10px, var(--board-3) 10px 20px);
  background-position: center;
  background-repeat: no-repeat;
  background-size: auto;
  box-shadow:
    inset 0 0 0 3px rgba(255, 255, 255, 0.95),
    inset 0 0 0 4.5px rgba(207, 230, 251, 0.9);
  display: grid;
  place-items: center;
  overflow: hidden;
}

.vts-content.has-image {
  background-size: cover;
  background-repeat: no-repeat;
  background-position: center;
  border-color: #5ea6ec;
}

.vts-content.has-image .vts-hint {
  display: none;
}

/* 实时摄像头 / 虚拟摄像头画面 */
.vts-video {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  background: transparent;
  pointer-events: none;
}

.vts-content {
  position: relative;
}

.vts-content.has-live {
  background-image: none;
  background-color: #10131a;
  border-color: #5ea6ec;
}

.vts-content.has-live .vts-hint {
  display: none;
}

.vts-hint {
  display: grid;
  gap: 0.15vw;
  justify-items: center;
  color: rgba(47, 82, 138, 0.6);
  background: rgba(255, 255, 255, 0.82);
  padding: 0.35vw 0.75vw;
  border-radius: 999px;
  font-weight: 950;
  font-size: clamp(10px, 0.8vw, 15px);
  letter-spacing: 0.08em;
  text-align: center;
  pointer-events: none;
}

.vts-hint small {
  font-size: clamp(8px, 0.62vw, 12px);
  font-weight: 900;
  color: rgba(74, 144, 221, 0.65);
  letter-spacing: 0.04em;
}

/* 捕获 / 上传 / 清除 小菜单 */
.vts-capture-menu {
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  z-index: 6;
  display: grid;
  gap: 0.34vw;
  padding: 0.5vw;
  border-radius: 12px;
  background: #fff;
  border: 2px solid var(--accent);
  box-shadow: 0 10px 24px rgba(20, 45, 85, 0.28);
}

.vts-capture-menu[hidden] {
  display: none;
}

.vts-menu-main {
  display: grid;
  gap: 0.34vw;
}

.vts-menu-main[hidden] {
  display: none;
}

.vts-cam-list {
  display: grid;
  gap: 0.3vw;
  min-width: 160px;
  max-height: 38vh;
  overflow-y: auto;
}

.vts-cam-list[hidden] {
  display: none;
}

.vts-cam-list .vts-cam-back {
  background: #fff;
  color: #7d9cc9;
}

.vts-capture-menu button {
  border: 1.5px solid #cfe1fa;
  border-radius: 8px;
  background: #f4f9ff;
  color: #35619f;
  font-weight: 950;
  font-size: clamp(10px, 0.76vw, 14px);
  padding: 0.36vw 0.7vw;
  white-space: nowrap;
}

.vts-capture-menu button:hover {
  background: #e4f0ff;
  border-color: var(--accent);
}

.vts-capture-menu button[hidden] {
  display: none;
}


/* 右栏底部的备选玩法 */
.template-section {
  grid-template-rows: auto auto minmax(0, 1fr);
}

.template-actions {
  padding: 0.5vw 0.6vw 0;
}

.template-actions .action-button {
  width: 100%;
  height: clamp(30px, 2.3vw, 42px);
  font-size: clamp(11px, 0.8vw, 15px);
}

.template-list {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0 0.7vw;
  align-content: start;
  margin: 0;
  padding: 0.35vw 0.6vw;
  overflow-y: auto;
  background: #f2f7ff;
  border-radius: 12px;
  border: 1px solid rgba(91, 141, 217, 0.28);
}

/* 单列容器：列内自上而下排列 */
.template-col {
  display: grid;
  align-content: start;
  min-width: 0;
}

.template-item {
  display: block;
  width: 100%;
  break-inside: avoid;
  min-width: 0;
  height: clamp(30px, 2.4vw, 40px);
  border: 0;
  border-bottom: 1px dashed rgba(74, 110, 168, 0.3);
  border-radius: 0;
  background: transparent;
  color: #4a6ea8;
  text-align: left;
  font-size: clamp(11px, 0.85vw, 15px);
  font-weight: 700;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.template-item:hover {
  color: var(--red);
  background: rgba(247, 143, 184, 0.08);
}

.player-section {
  grid-template-rows: auto auto 1fr;
}

.section-title {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.6vw;
  padding: 0.75vw 0.85vw;
  border-bottom: 1px solid rgba(91, 141, 217, 0.24);
  background: linear-gradient(90deg, rgba(143, 180, 242, 0.18), rgba(143, 180, 242, 0.03));
}

.section-title h2 {
  margin: 0;
  font-size: clamp(13px, 1vw, 20px);
  line-height: 1;
  color: var(--ink);
}

/* 「格子事件」等标题永远单行：宽度不足时字号自适应收缩 */
.section-title h2 {
  white-space: nowrap;
  flex: none;
  min-width: 0;
}

.event-section .section-title h2 {
  font-size: clamp(10px, 0.62vw, 13px);
  letter-spacing: -0.01em;
}

.event-section .section-title {
  gap: 0.3vw;
  padding: 0.38vw 0.35vw;
}

.event-section .title-right {
  flex: 1 1 auto;
  justify-content: flex-end;
  gap: 0.28vw;
}

.event-section .mini-status {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: clamp(9px, 0.6vw, 12px);
  flex: 1 1 auto;
  text-align: right;
}

.event-section .section-icon-button {
  font-size: clamp(8px, 0.58vw, 12px);
  padding: 0.22vw 0.35vw;
  gap: 0.15vw;
}

.mini-status {
  min-width: 0;
  color: rgba(47, 82, 138, 0.58);
  font-size: clamp(9px, 0.68vw, 13px);
  font-weight: 900;
  text-align: right;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* 标题栏右侧：状态 + 图标按钮 */
.title-right {
  display: flex;
  align-items: center;
  gap: 0.45vw;
  min-width: 0;
}

.section-icon-button {
  flex: none;
  border: 2px solid var(--accent);
  border-radius: 10px;
  background: #fff;
  color: #3f6bb5;
  font-weight: 950;
  font-size: clamp(9px, 0.66vw, 13px);
  line-height: 1;
  padding: 0.34vw 0.5vw;
  box-shadow: 0 2px 0 rgba(91, 141, 217, 0.2);
  white-space: nowrap;
}

.section-icon-button:hover {
  background: var(--paper);
}

/* ---------- 备选玩法弹窗 ---------- */
.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 60;
  display: grid;
  place-items: center;
  background: rgba(31, 58, 104, 0.42);
}

.modal-backdrop[hidden] {
  display: none;
}

.modal-card {
  width: min(680px, 84vw);
  max-height: min(78vh, 720px);
  display: grid;
  grid-template-rows: auto auto auto minmax(0, 1fr);
  gap: 0.6vw;
  padding: 0.9vw 1vw 1vw;
  border-radius: 18px;
  border: 2px solid var(--accent);
  background: #fff;
  box-shadow: 0 16px 40px rgba(20, 45, 85, 0.32);
}

.modal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.6vw;
}

.modal-head h3 {
  margin: 0;
  font-size: clamp(15px, 1.15vw, 22px);
  color: var(--ink);
}

.modal-close {
  width: clamp(26px, 2vw, 34px);
  aspect-ratio: 1;
  border-radius: 50%;
  border: 2px solid var(--accent);
  background: #fff;
  color: #3f6bb5;
  font-weight: 950;
  font-size: clamp(13px, 1vw, 18px);
  line-height: 1;
}

.modal-close:hover {
  background: #ffe9e9;
  border-color: #ee8b8b;
  color: #d9534f;
}

.modal-tip {
  margin: 0;
  font-size: clamp(10px, 0.74vw, 14px);
  font-weight: 900;
  color: rgba(47, 82, 138, 0.62);
  line-height: 1.4;
}

.modal-tip strong {
  color: #2f6fc4;
}

.modal-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.5vw;
}

.modal-actions .action-button {
  width: 100%;
  height: clamp(30px, 2.3vw, 42px);
  font-size: clamp(11px, 0.8vw, 15px);
}

/* 弹窗内列表：严格两列，超出上下滚动 */
.modal-card .template-list {
  margin: 0;
  max-height: none;
}

.modal-card .template-item {
  height: clamp(28px, 2.1vw, 36px);
  font-size: clamp(11px, 0.82vw, 15px);
}

.control-stack,
.event-editor,
.player-list,
.prize-editor {
  min-height: 0;
  overflow-y: auto;
  padding: 0.65vw;
}

/* 角色桩列表：收窄内边距，保证 5 队一屏全可见 */
.player-list {
  padding: 0.2vw 0.4vw;
}

.player-actions {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0.4vw;
  padding: 0.45vw 0.5vw 0;
}

.player-actions .action-button {
  min-width: 0;
  height: clamp(26px, 1.95vw, 34px);
  font-size: clamp(10px, 0.7vw, 13px);
}

.control-stack {
  display: grid;
  gap: 0.55vw;
  align-content: start;
}

/* ---------- 棋盘设置面板：整体压缩高度、字号缩小，把空间让给格子事件 ---------- */
.monopoly-controls {
  gap: 0.45vw;
}

.monopoly-controls .section-title {
  padding: 0.42vw 0.55vw;
}

.monopoly-controls .section-title h2 {
  font-size: clamp(11px, 0.85vw, 16px);
}

.monopoly-controls .control-stack {
  gap: 0.34vw;
  padding: 0.45vw;
}

.monopoly-controls .control-stack label {
  font-size: clamp(9px, 0.64vw, 12px);
  gap: 0.18vw;
}

.monopoly-controls .control-stack .action-button,
.monopoly-controls .control-stack input,
.monopoly-controls .control-stack select {
  height: clamp(24px, 1.75vw, 31px);
  font-size: clamp(8px, 0.56vw, 11px);
}

.monopoly-controls .color-pick-row .action-button {
  height: clamp(24px, 1.75vw, 31px);
  font-size: clamp(8px, 0.56vw, 11px);
}

/* 棋盘图片：只保留“选择文件”按钮，隐藏原生文件名/未选择文件文字 */
.monopoly-controls .control-stack .file-row input[type="file"] {
  width: 100%;
  min-width: 0;
  font-size: 0;
  padding: 0 0.2vw;
}

.monopoly-controls .control-stack .file-row input[type="file"]::file-selector-button,
.monopoly-controls .control-stack .file-row input[type="file"]::-webkit-file-upload-button {
  height: 100%;
  margin: 0;
  padding: 0 0.6vw;
  border: 0;
  border-radius: 8px;
  background: var(--paper);
  color: #3f6bb5;
  font-size: clamp(8px, 0.56vw, 11px);
  font-weight: 900;
  cursor: pointer;
}


.monopoly-controls .control-hint {
  font-size: clamp(8px, 0.54vw, 10px);
  line-height: 1.25;
}

.monopoly-controls .file-clear {
  width: clamp(22px, 1.5vw, 28px);
  height: clamp(22px, 1.5vw, 28px);
}

/* 格子数量：标签与输入框同一行 */
label.count-row {
  grid-template-columns: auto minmax(0, 1fr);
  align-items: center;
  gap: 0.5vw;
}

label.count-row input {
  width: 100%;
  text-align: center;
}

.control-hint {
  margin: 0;
  font-size: clamp(9px, 0.62vw, 12px);
  font-weight: 800;
  line-height: 1.35;
  color: rgba(47, 82, 138, 0.5);
}

label {
  min-width: 0;
  display: grid;
  gap: 0.28vw;
  font-size: clamp(10px, 0.72vw, 14px);
  color: rgba(47, 82, 138, 0.64);
  font-weight: 900;
}

/* 颜色行：文字 + 圆形颜色盘 */
label.color-row {
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 0.5vw;
}

/* 格子主色取色盘 + 换一组配色：左右分列 */
.color-pick-row {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 0.5vw;
  align-items: center;
}

.color-pick-row .action-button {
  width: 100%;
  height: clamp(34px, 2.7vw, 46px);
  font-size: clamp(10px, 0.72vw, 14px);
}

/* 棋盘图片：文件框 + 清除按钮 */
label.file-row {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 0.4vw;
}

.file-clear {
  flex: none;
  width: clamp(24px, 1.8vw, 32px);
  aspect-ratio: 1;
  border-radius: 8px;
  border: 1.5px solid #ffb3b3;
  background: #ffe9e9;
  color: #d9534f;
  font-weight: 950;
  font-size: clamp(10px, 0.7vw, 13px);
  line-height: 1;
}

.file-clear:hover {
  background: #ffd6d6;
}

input[type="color"].color-wheel {
  -webkit-appearance: none;
  appearance: none;
  width: clamp(22px, 1.7vw, 30px);
  height: clamp(22px, 1.7vw, 30px);
  min-width: 0;
  padding: 0;
  border: 2px solid #fff;
  border-radius: 50%;
  background: transparent;
  box-shadow:
    0 0 0 2px var(--accent),
    0 2px 5px rgba(47, 82, 138, 0.24);
  cursor: pointer;
  overflow: hidden;
}

input[type="color"].color-wheel::-webkit-color-swatch-wrapper {
  padding: 0;
}

input[type="color"].color-wheel::-webkit-color-swatch {
  border: 0;
  border-radius: 50%;
}

input[type="color"].color-wheel::-moz-color-swatch {
  border: 0;
  border-radius: 50%;
}

input,
select,
textarea {
  min-width: 0;
  border: 1px solid rgba(47, 82, 138, 0.14);
  border-radius: 8px;
  background: #ffffff;
  color: var(--ink);
  font-weight: 850;
}

input,
select {
  height: clamp(28px, 2.25vw, 42px);
  padding: 0 0.55vw;
}

textarea {
  resize: none;
  padding: 0.6vw;
  line-height: 1.35;
}

.control-row,
.stage-actions,
.lottery-actions {
  display: flex;
  gap: 0.48vw;
}

.dice-console .dice-actions .action-button {
  min-width: 0;
  width: clamp(50px, 4.4vw, 70px);
  height: clamp(50px, 4.4vw, 70px);
  padding: 0;
  border-radius: 18px;
  font-size: clamp(18px, 1.45vw, 28px);
  line-height: 1.08;
  white-space: nowrap;
  background: linear-gradient(150deg, #ffe27a 0%, #ffd94a 55%, #f6bf35 100%);
  border-color: #fff;
  color: #7a4c00;
  text-shadow: 0 1px 0 rgba(255, 255, 255, 0.65);
  box-shadow:
    inset 0 3px 6px rgba(255, 255, 255, 0.7),
    0 4px 0 #d99f23,
    0 8px 14px rgba(47, 82, 138, 0.22);
}


.action-button,
.step-button {
  border: 2px solid var(--accent);
  border-radius: 12px;
  background: #fff;
  color: var(--ink);
  box-shadow: 0 3px 0 rgba(91, 141, 217, 0.22);
  font-weight: 950;
}

.action-button {
  min-width: 0;
  height: clamp(31px, 2.55vw, 48px);
  padding: 0 0.72vw;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  white-space: nowrap;
  font-size: clamp(10px, 0.76vw, 15px);
}

.action-button.primary {
  background: var(--bar-grad-2);
  border-color: rgba(255, 255, 255, 0.55);
  color: #fff;
  text-shadow: 0 1px 2px rgba(47, 82, 138, 0.3);
}

.action-button.quiet {
  color: rgba(47, 82, 138, 0.72);
  border-color: rgba(143, 180, 242, 0.55);
  box-shadow: 0 3px 0 rgba(91, 141, 217, 0.12);
}

.full-button {
  width: 100%;
}

.player-row {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto auto auto auto auto;
  align-items: center;
  gap: 0.12vw;
  padding: 0.1vw 0.16vw;
  border-radius: 10px;
}

/* 清零 / 后退 / 前进：纯图标小按钮（整体收小一档，给队名让位） */
.player-tool {
  min-width: 0;
  width: clamp(19px, 1.34vw, 24px);
  height: clamp(19px, 1.34vw, 24px);
  padding: 0;
  display: grid;
  place-items: center;
  border-radius: 6px;
  border: 1.3px solid #cfe1fa;
  background: #f4f9ff;
  color: #3f6bb5;
  font-weight: 950;
  font-size: clamp(9px, 0.62vw, 12px);
  line-height: 1;
  white-space: nowrap;
}

.player-tool.reset {
  border-color: #ffe0a3;
  background: #fff7e8;
  color: #c8871b;
}

.player-tool:hover {
  background: #e4f0ff;
  border-color: var(--accent);
}

.player-tool.reset:hover {
  background: #ffefd4;
  border-color: #f2c46a;
}

.player-row.is-active {
  background: rgba(245, 190, 74, 0.22);
}

/* 实时积分徽章 */
.player-score {
  min-width: clamp(23px, 1.5vw, 28px);
  display: inline-flex;
  align-items: baseline;
  justify-content: center;
  gap: 1px;
  padding: 0.1vw 0.2vw;
  border-radius: 7px;
  background: rgba(91, 141, 217, 0.14);
  color: #3f6bb5;
  font-weight: 950;
  font-size: clamp(9px, 0.64vw, 12px);
  line-height: 1;
}

.player-score small {
  font-size: 0.6em;
  font-weight: 900;
}

/* 队伍名前的圆形色点＝取色器 */
.player-color-dot {
  -webkit-appearance: none;
  appearance: none;
  width: clamp(16px, 1.15vw, 21px);
  height: clamp(16px, 1.15vw, 21px);
  padding: 0;
  border: 2px solid #fff;
  border-radius: 50%;
  background: var(--player-color);
  box-shadow: 0 0 0 1.3px rgba(143, 180, 242, 0.85);
  cursor: pointer;
}

.player-color-dot::-webkit-color-swatch-wrapper {
  padding: 0;
}

.player-color-dot::-webkit-color-swatch {
  border: 0;
  border-radius: 50%;
}

.player-color-dot::-moz-color-swatch {
  border: 0;
  border-radius: 50%;
}

.player-row.is-active .player-color-dot {
  box-shadow: 0 0 0 2.5px #f5be4a;
}

/* 行尾删除按钮 */
/* 行内控件压矮收窄，保证 5 支队伍一屏全部可见且名字可读 */
.player-row .player-name,
.player-row .position-input {
  height: clamp(20px, 1.55vw, 28px);
  padding: 0 0.26vw;
}

/* 队名字号再收小一档 */
.player-row .player-name {
  font-size: clamp(9px, 0.6vw, 12px);
}

.player-row .position-input {
  font-size: clamp(10px, 0.7vw, 13px);
}

.player-row .position-input {
  width: clamp(24px, 1.7vw, 32px);
  text-align: center;
}

.player-remove {
  width: clamp(22px, 1.52vw, 27px);
  height: clamp(19px, 1.34vw, 24px);
  padding: 0;
  border-radius: 6px;
  border: 1.3px solid #ffb3b3;
  background: #ffe9e9;
  color: #d9534f;
  font-weight: 950;
  font-size: clamp(9px, 0.62vw, 12px);
  line-height: 1;
}

.player-remove:hover {
  background: #ffd6d6;
  border-color: #f19a9a;
}

.player-name {
  width: 100%;
}

.step-button {
  width: clamp(23px, 1.75vw, 31px);
  height: clamp(23px, 1.75vw, 31px);
  padding: 0;
}

.position-input {
  width: clamp(32px, 2.5vw, 46px);
  text-align: center;
}

.event-row.is-just-filled {
  background: rgba(245, 190, 74, 0.28);
  border-radius: 8px;
}

.event-row,
.prize-row {
  display: grid;
  grid-template-columns: clamp(26px, 1.85vw, 34px) 1fr;
  gap: 0.38vw;
  align-items: center;
  margin-bottom: 0.3vw;
}

.event-number,
.prize-number {
  height: clamp(22px, 1.5vw, 28px);
  display: grid;
  place-items: center;
  border-radius: 8px;
  background: rgba(47, 82, 138, 0.08);
  font-weight: 950;
  font-size: clamp(10px, 0.68vw, 13px);
}

/* 格子事件：字体适中，长事件名自适应换行（输入框随内容自动撑高） */
.event-row {
  align-items: start;
}

.event-row .event-number {
  margin-top: 0.1vw;
}

.event-input {
  display: block;
  width: 100%;
  height: auto;
  min-height: clamp(24px, 1.7vw, 32px);
  padding: 0.3vw 0.48vw;
  font-size: clamp(11px, 0.66vw, 14px);
  line-height: 1.3;
  resize: none;
  overflow: hidden;
}

.bomb-layout,
.cards-layout,
.lottery-layout {
  /* 与大富翁游戏界面同宽：除右侧控制台外全部给舞台，控制台列 = 大富翁控制台宽度 */
  grid-template-columns: minmax(0, 1fr) clamp(180px, 10.4vw, 236px);
}

.bomb-stage {
  display: grid;
  grid-template-rows: 42% 24% auto 1fr;
  gap: 1.2%;
  padding-right: 1.1%;
}

.bomb-core {
  position: relative;
  justify-self: center;
  align-self: center;
  width: clamp(140px, 16vw, 300px);
  aspect-ratio: 1;
  border-radius: 50%;
  background: linear-gradient(145deg, #383838, #090909);
  border: 12px solid var(--gold);
  display: grid;
  place-items: center;
  box-shadow: 0 22px 42px rgba(47, 82, 138, 0.25);
}

.bomb-number {
  font-size: clamp(58px, 8vw, 150px);
  line-height: 1;
  font-weight: 950;
  color: var(--paper);
  position: relative;
  isolation: isolate;
}

.bomb-number.is-exploding {
  animation: bombPop 0.82s cubic-bezier(0.16, 0.9, 0.24, 1.1);
}

.bomb-number.is-exploding::before,
.bomb-number.is-exploding::after {
  content: "";
  position: absolute;
  inset: -26%;
  border-radius: 50%;
  z-index: -1;
  pointer-events: none;
}

.bomb-number.is-exploding::before {
  background:
    radial-gradient(circle, rgba(255, 245, 112, 0.95) 0 18%, rgba(244, 87, 82, 0.78) 28%, transparent 62%),
    conic-gradient(from 12deg, transparent 0 8%, rgba(255, 215, 72, 0.96) 8% 13%, transparent 13% 24%, rgba(255, 104, 80, 0.9) 24% 30%, transparent 30% 42%, rgba(255, 226, 91, 0.95) 42% 49%, transparent 49% 64%, rgba(255, 99, 89, 0.88) 64% 70%, transparent 70% 100%);
  animation: blastRing 0.82s ease-out both;
}

.bomb-number.is-exploding::after {
  inset: -42%;
  background:
    radial-gradient(circle at 20% 35%, #fff2a1 0 4%, transparent 5%),
    radial-gradient(circle at 72% 18%, #ff665b 0 4%, transparent 5%),
    radial-gradient(circle at 78% 72%, #ffe36e 0 4%, transparent 5%),
    radial-gradient(circle at 28% 82%, #ff7a64 0 4%, transparent 5%);
  animation: sparkBurst 0.82s ease-out both;
}

.range-board {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 1vw;
}

.range-value {
  height: 100%;
  display: grid;
  place-items: center;
  border-radius: 14px;
  background: var(--panel);
  font-size: clamp(44px, 6vw, 114px);
  color: var(--blue);
  font-weight: 950;
}

.range-divider {
  font-weight: 950;
  font-size: clamp(20px, 2vw, 40px);
}

.bomb-message {
  justify-self: center;
  border-radius: 999px;
  background: var(--ink);
  color: var(--paper);
  padding: 0.75vw 1.2vw;
  font-size: clamp(18px, 2vw, 38px);
  font-weight: 950;
}

.guess-log {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.55vw;
  align-content: start;
  overflow: hidden;
}

.guess-pill {
  min-width: clamp(40px, 3.4vw, 64px);
  height: clamp(28px, 2.3vw, 44px);
  display: grid;
  place-items: center;
  border-radius: 999px;
  background: #ffffff;
  font-weight: 950;
}

.guess-pill.hot {
  color: var(--red);
}

.bomb-controls {
  grid-template-rows: 45% 55%;
}

.bomb-settings {
  padding: 0.7vw;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.6vw;
}

.bomb-settings label:last-child {
  grid-column: 1 / -1;
}

.guess-section {
  grid-template-rows: auto auto 1fr auto;
}

.guess-input {
  margin: 0.75vw;
  height: clamp(46px, 4vw, 72px);
  text-align: center;
  font-size: clamp(24px, 2.6vw, 48px);
}

.keypad {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.45vw;
  padding: 0 0.75vw 0.75vw;
}

.key-button {
  border: 1px solid var(--line);
  border-radius: 9px;
  background: #ffffff;
  font-size: clamp(16px, 1.3vw, 26px);
  font-weight: 950;
}

.cards-layout {
  /* 与大富翁游戏界面同宽（见 .bomb-layout 等统一规则） */
  grid-template-columns: minmax(0, 1fr) clamp(180px, 10.4vw, 236px);
  /* 配色与大富翁页面保持一致：超浅蓝底 + 白色面板 */
  background:
    linear-gradient(135deg, rgba(122, 165, 232, 0.1), transparent 36%),
    linear-gradient(225deg, rgba(255, 255, 255, 0.5), transparent 38%),
    #e6f1fe;
  padding: 1%;
  overflow: hidden;
}

.cards-stage {
  min-height: 0;
  height: 100%;
  display: grid;
  grid-template-rows: 1fr auto;
  gap: 1vw;
  padding-right: 1.4vw;
  overflow: hidden;
}

.cards-top-note {
  min-height: clamp(28px, 2.4vw, 44px);
  display: grid;
  place-items: center;
  color: rgba(47, 82, 138, 0.66);
  font-size: clamp(14px, 1.1vw, 22px);
  font-weight: 850;
}

.cards-grid {
  min-height: 0;
  height: 100%;
  display: grid;
  grid-template-columns: repeat(var(--card-cols, 8), 1fr);
  gap: clamp(7px, 0.68vw, 14px);
  align-content: start;
  padding: 0 0.7vw 0.6vw 0;
  overflow-y: auto;
  border-radius: 12px;
  /* 隐藏滚动条但保留鼠标滚轮/拖动滚动 */
  scrollbar-width: none;
}

.cards-bottom-actions {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, auto)) minmax(0, 1fr);
  align-items: center;
  min-height: clamp(38px, 3vw, 56px);
}

.cards-bottom-actions .action-button {
  background: #ffffff;
  color: var(--ink);
  border-color: var(--line);
  box-shadow: none;
}

.cards-bottom-actions .action-button.primary {
  background: var(--bar-grad-2);
  color: #fff;
}

.cards-bottom-actions strong {
  min-width: 0;
  color: var(--ink);
  font-size: clamp(13px, 1.05vw, 22px);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.flip-card {
  aspect-ratio: 3 / 4;
  padding: 0;
  border: 0;
  background: transparent;
  perspective: 1000px;
}

.flip-card.is-selected .flip-card-inner {
  outline: 4px solid rgba(245, 190, 74, 0.9);
}

.flip-card-inner {
  position: relative;
  display: block;
  width: 100%;
  height: 100%;
  transform-style: preserve-3d;
  transition: transform 0.62s cubic-bezier(0.2, 0.8, 0.2, 1);
  border-radius: 12px;
  box-shadow: 0 8px 16px rgba(47, 82, 138, 0.22);
}

.flip-card.is-flipped .flip-card-inner {
  transform: rotateY(180deg);
}

.card-face {
  position: absolute;
  inset: 0;
  border-radius: 12px;
  backface-visibility: hidden;
  display: grid;
  place-items: center;
  overflow: hidden;
}

.card-cover {
  /* 卡背配色对齐大富翁格子主色 #7fb6ee：蓝色 → 深蓝渐变 */
  background:
    linear-gradient(155deg, rgba(255, 255, 255, 0.26), transparent 34%),
    linear-gradient(145deg, #8ac2f4, #6aa3e8);
  background-size: cover;
  background-position: center;
  color: #fff;
  font-size: clamp(17px, 1.7vw, 32px);
  font-weight: 950;
  z-index: 2;
}

.card-cover::after {
  content: "";
  position: absolute;
  inset: 9%;
  border: 2px solid rgba(255, 255, 255, 0.7);
  border-radius: 8px;
}

.card-cover.has-image::after {
  display: none;
}

/* 上传卡面：图片原样完整显示（原 87% 白蒙层会把图洗成近全白导致"看不见"，已移除）；
   数字居中，改由深色半透明胶囊 + 白字阴影保证任意图片上都清晰 */
.card-cover.has-image::before {
  display: none;
}

.card-cover.has-image span {
  border-radius: 999px;
  background: rgba(15, 35, 70, 0.55);
  padding: 0.16em 0.42em;
  box-shadow: 0 2px 8px rgba(10, 25, 55, 0.28);
}

.card-cover span {
  z-index: 1;
  text-shadow: 0 4px 9px rgba(0, 0, 0, 0.32);
}

.card-content {
  transform: rotateY(180deg);
  background: #ffffff;
  border: 1px solid #cfe1fa;
  padding: 8%;
  text-align: center;
  z-index: 1;
}

.card-content b {
  position: absolute;
  left: 8%;
  top: 6%;
  font-size: clamp(9px, 0.66vw, 13px);
  color: rgba(47, 82, 138, 0.35);
}

.card-content strong {
  font-size: clamp(10px, 0.78vw, 16px);
  line-height: 1.16;
  color: var(--ink);
  word-break: break-word;
}

/* 控制台顶部：一键填充 / 打乱内容 */
.card-quick-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.4vw;
}

.card-quick-actions .action-button {
  width: 100%;
  height: clamp(26px, 1.9vw, 34px);
  padding: 0 0.3vw;
  font-size: clamp(9px, 0.64vw, 12px);
}

/* 翻牌结果文字：默认留空（不再显示“点击卡牌揭晓”），揭晓后显示结果 */
.card-controls #cardResultTitle {
  display: block;
  min-width: 0;
  min-height: 1.1em;
  color: var(--ink);
  font-size: clamp(11px, 0.8vw, 15px);
  font-weight: 950;
  text-align: center;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.card-controls {
  /* 顶部标题 + 快捷按钮 + 结果行 + 卡牌数量面板 + 事件池（事件池占余下高度） */
  grid-template-rows: auto auto auto auto minmax(0, 1fr);
  padding: 0.7vw;
  gap: 0.55vw;
  border-radius: 16px;
  border: 2px solid var(--accent);
  background: #ffffff;
  box-shadow: 0 4px 0 rgba(91, 141, 217, 0.16);
  min-height: 0;
  overflow: hidden;
}

.card-control-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5vw;
  padding: 0.28vw 0.1vw 0.42vw;
  color: var(--ink);
  border-bottom: 1px solid var(--line);
}

.card-control-title strong {
  font-size: clamp(12px, 0.9vw, 17px);
  line-height: 1.1;
}

.card-control-title span {
  border-radius: 8px;
  background: var(--paper);
  color: #3f6bb5;
  padding: 0.22vw 0.34vw;
  font-size: clamp(8px, 0.55vw, 11px);
  font-weight: 950;
  white-space: nowrap;
}

.card-control-title span.is-saved {
  color: #fff;
  background: #1f9d7a;
}

.cards-layout .panel-section {
  background: #ffffff;
  border: 2px solid var(--accent);
  color: var(--ink);
  box-shadow: 0 4px 0 rgba(91, 141, 217, 0.12);
}

.cards-layout .section-title {
  border-color: var(--line);
  padding: 0.32vw 0.4vw;
}

.cards-layout .section-title h2 {
  color: var(--ink);
  font-size: clamp(11px, 0.76vw, 15px);
}

.cards-layout .mini-status,
.cards-layout label {
  color: rgba(47, 82, 138, 0.64);
}

.cards-layout .mini-status {
  font-size: clamp(8px, 0.55vw, 11px);
}

.cards-layout label {
  font-size: clamp(8px, 0.56vw, 11px);
  gap: 0.22vw;
}

.cards-layout input,
.cards-layout select,
.cards-layout textarea {
  background: #ffffff;
  color: var(--ink);
  border-color: var(--line);
  font-size: clamp(9px, 0.62vw, 12px);
}

.card-editor-body {
  display: grid;
  grid-template-rows: auto 1fr auto;
  gap: 0.7vw;
  padding: 0.7vw;
  min-height: 0;
}

.mini-card-preview {
  justify-self: center;
  width: min(42%, 150px);
  aspect-ratio: 3 / 4;
  border-radius: 11px;
  display: grid;
  place-items: center;
  background:
    linear-gradient(155deg, rgba(255, 255, 255, 0.26), transparent 34%),
    linear-gradient(145deg, #8ac2f4, #6aa3e8);
  background-size: cover;
  background-position: center;
  color: #fff;
  font-size: clamp(20px, 1.8vw, 34px);
  font-weight: 950;
  text-shadow: 0 3px 7px rgba(47, 82, 138, 0.4);
  box-shadow: 0 8px 18px rgba(47, 82, 138, 0.24);
}

.card-pool-section textarea {
  margin: 0.5vw;
  width: calc(100% - 1vw);
  height: calc(100% - 1vw);
  min-height: 0;
}

.lottery-stage {
  display: grid;
  grid-template-rows: 1fr auto;
  align-items: center;
  padding-right: 1.1%;
}

.lottery-board {
  width: min(78%, 68vh);
  aspect-ratio: 1;
  justify-self: center;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  grid-template-rows: repeat(3, 1fr);
  gap: 1vw;
  padding: 1.2vw;
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.68);
  border: 1px solid var(--line);
}

.lottery-cell {
  border-radius: 12px;
  border: 1px solid var(--line);
  background: #ffffff;
  display: grid;
  place-items: center;
  text-align: center;
  padding: 8%;
  font-size: clamp(17px, 1.5vw, 30px);
  font-weight: 950;
  box-shadow: 0 8px 0 rgba(47, 82, 138, 0.1);
}

.lottery-cell.is-active,
.lottery-cell.is-winner {
  background: var(--red);
  color: #fff;
  outline: 5px solid var(--gold);
}

.lottery-center {
  border: 0;
  background: var(--ink);
  color: var(--paper);
}

.lottery-center span {
  display: block;
  font-size: clamp(10px, 0.75vw, 15px);
  color: rgba(255, 248, 232, 0.72);
}

.lottery-readout {
  justify-self: center;
  min-width: 44%;
  max-width: 82%;
  border-radius: 14px;
  background: var(--panel);
  border: 1px solid var(--line);
  text-align: center;
  padding: 0.8vw 1.2vw;
}

.lottery-readout span {
  color: rgba(47, 82, 138, 0.58);
  font-weight: 900;
}

.lottery-readout strong {
  display: block;
  color: var(--red);
  font-size: clamp(26px, 3vw, 58px);
  line-height: 1;
  font-weight: 950;
}

.lottery-controls {
  grid-template-rows: 30% 70%;
}

.lottery-actions {
  flex-direction: column;
  padding: 0.75vw;
}

.compare-layout {
  height: 100%;
  min-height: 100%;
  display: grid;
  /* 与大富翁游戏界面同宽（统一见 .bomb-layout 等规则） */
  grid-template-columns: minmax(0, 1fr) clamp(180px, 10.4vw, 236px);
  gap: 0;
  padding: 1.1%;
  background:
    linear-gradient(135deg, rgba(122, 165, 232, 0.14), transparent 36%),
    linear-gradient(225deg, rgba(255, 255, 255, 0.4), transparent 38%),
    var(--frame-bg);
}

.compare-table {
  min-width: 0;
  min-height: 0;
  position: relative;
  display: grid;
  grid-template-columns: 1fr minmax(160px, 18%) 1fr;
  align-items: center;
  gap: 2vw;
  padding: 2vw;
  border-radius: 18px;
  border: 4px solid var(--stroke);
  background: linear-gradient(160deg, var(--board-1) 0%, var(--board-2) 60%, var(--board-3) 100%);
  box-shadow: 0 10px 26px rgba(47, 82, 138, 0.22);
  overflow: hidden;
}

/* 内圈白色虚线（同炸弹/翻卡/九宫格棋局框） */
.compare-table::before {
  content: "";
  position: absolute;
  inset: 6px;
  border: 2px dashed rgba(255, 255, 255, 0.95);
  border-radius: 12px;
  pointer-events: none;
}

.poker-card {
  justify-self: center;
  width: min(74%, 34vh);
  aspect-ratio: 2.5 / 3.5;
  position: relative;
  padding: 0;
  border: 0;
  background: transparent;
  perspective: 1200px;
}

.poker-card .poker-back,
.poker-card .poker-face {
  position: absolute;
  inset: 0;
  border-radius: 18px;
  backface-visibility: hidden;
  transition: transform 0.58s cubic-bezier(0.2, 0.8, 0.2, 1);
  box-shadow: 0 24px 42px rgba(0, 0, 0, 0.32);
}

.poker-back {
  display: block;
  background:
    radial-gradient(circle at 50% 50%, rgba(255, 255, 255, 0.2) 0 9%, transparent 10%),
    linear-gradient(45deg, rgba(255, 255, 255, 0.12) 25%, transparent 25% 50%, rgba(255, 255, 255, 0.12) 50% 75%, transparent 75%),
    linear-gradient(145deg, #1f57a8, #102c68);
  background-size: 100% 100%, 22px 22px, 100% 100%;
  border: 10px solid #fffaf0;
}

.poker-back::after {
  content: "";
  position: absolute;
  inset: 9%;
  border-radius: 12px;
  border: 3px solid rgba(255, 255, 255, 0.78);
}

.poker-face {
  display: grid;
  grid-template-rows: auto 1fr auto;
  place-items: center;
  padding: 9%;
  background: #ffffff;
  border: 1px solid rgba(47, 82, 138, 0.14);
  color: #161616;
  transform: rotateY(180deg);
}

.poker-face b {
  justify-self: start;
  font-size: clamp(32px, 4.4vw, 86px);
  line-height: 1;
}

.poker-face i {
  font-style: normal;
  font-size: clamp(66px, 9vw, 170px);
  line-height: 0.9;
}

.poker-face strong {
  justify-self: end;
  font-size: clamp(18px, 1.6vw, 30px);
}

.poker-card.is-red .poker-face {
  color: #d7283f;
}

.poker-card:not(.is-facedown) .poker-back {
  transform: rotateY(180deg);
}

.poker-card:not(.is-facedown) .poker-face {
  transform: rotateY(360deg);
}

.compare-center {
  min-width: 0;
  display: grid;
  justify-items: center;
  gap: 1vw;
}

.compare-versus {
  width: clamp(80px, 8vw, 150px);
  aspect-ratio: 1;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: var(--paper);
  color: var(--red);
  font-size: clamp(32px, 4vw, 78px);
  font-weight: 950;
  box-shadow: 0 14px 28px rgba(0, 0, 0, 0.26);
}

.compare-result {
  width: 100%;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.92);
  color: var(--ink);
  padding: 0.75vw 1vw;
  text-align: center;
  font-size: clamp(18px, 1.45vw, 28px);
  font-weight: 950;
}

.compare-center .action-button {
  width: 100%;
  height: clamp(46px, 3.8vw, 70px);
  font-size: clamp(16px, 1.25vw, 24px);
}

.compare-controls {
  grid-template-rows: 100%;
}

.compare-help {
  padding: 0.9vw;
  display: grid;
  gap: 0.8vw;
  align-content: start;
  color: rgba(47, 82, 138, 0.7);
  font-weight: 850;
}

.compare-help p {
  margin: 0;
  line-height: 1.45;
}

.compare-readout {
  align-self: end;
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 0.7vw;
  padding: 0.9vw;
  font-weight: 950;
}

.compare-readout span {
  color: rgba(47, 82, 138, 0.54);
}

.compare-readout strong {
  min-width: 0;
  color: var(--red);
}

.sudoku-layout {
  height: 100%;
  min-height: 100%;
  display: grid;
  /* 舞台 = 大富翁游戏界面整体宽度；控制台 = 大富翁右侧控制台宽度 */
  grid-template-columns: minmax(0, 1fr) clamp(180px, 10.4vw, 236px);
  gap: 0;
  padding: 1.1%;
}

.draw-layout {
  height: 100%;
  min-height: 100%;
  display: grid;
  /* 参考我画你猜Plus：最左作画区（上下橙色条） + 中间竖排工具栏 + 右侧计时器/题库等控制栏 */
  grid-template-columns: minmax(0, 1fr) clamp(120px, 9vw, 175px) clamp(200px, 15vw, 290px);
  gap: 0.8vw;
  padding: 1.1%;
  background:
    radial-gradient(circle at 20% 20%, rgba(255, 255, 255, 0.3), transparent 30%),
    linear-gradient(135deg, var(--paper), #e8f6ff);
}

/* 列顺序：左=作画区，中=工具栏，最右=题目/题库等信息控制 */
.draw-layout > .draw-center {
  order: 1;
}

.draw-layout > .draw-tools {
  order: 2;
}

.draw-layout > .draw-side {
  order: 3;
}

.draw-center {
  min-width: 0;
  min-height: 0;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  gap: 0.7vw;
}

.draw-statusbar {
  min-height: clamp(38px, 3vw, 56px);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1vw;
  border-radius: 14px;
  background: linear-gradient(150deg, #ffcf6e, #ffab38);
  box-shadow: 0 4px 0 rgba(203, 124, 12, 0.4);
  padding: 0.45vw 1vw;
  font-weight: 950;
}

.draw-statusbar span {
  color: #7a4a00;
}

.draw-statusbar strong {
  color: #ffffff;
  font-size: clamp(15px, 1.3vw, 25px);
  text-shadow: 0 2px 4px rgba(122, 74, 0, 0.4);
}

.draw-wordbar {
  min-height: clamp(46px, 3.8vw, 70px);
  display: grid;
  place-items: center;
  border-radius: 14px;
  background: linear-gradient(150deg, #ffcf6e, #ffab38);
  box-shadow: 0 4px 0 rgba(203, 124, 12, 0.4);
  padding: 0.4vw 1vw;
}

.draw-wordbar strong {
  color: #6b3d00;
  font-size: clamp(20px, 2vw, 38px);
  font-weight: 950;
  text-align: center;
  line-height: 1.1;
}

.draw-canvas {
  width: 100%;
  height: 100%;
  min-height: 0;
  border-radius: 16px;
  background: #ffffff;
  border: 1px solid rgba(47, 82, 138, 0.14);
  box-shadow: inset 0 0 0 6px rgba(255, 255, 255, 0.7);
  touch-action: none;
}

.draw-side {
  min-width: 0;
  min-height: 0;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  gap: 0.55vw;
  padding: 0.7vw;
  border-radius: 16px;
  border: 2px solid var(--accent);
  background: #ffffff;
  box-shadow: 0 4px 0 rgba(91, 141, 217, 0.16);
  overflow: hidden;
}

.draw-side .panel-section {
  overflow-y: auto;
  scrollbar-width: thin;
  align-content: start;
}

.draw-side .panel-section label {
  margin-inline: 0.4vw;
}

.draw-side-actions {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.45vw;
  padding: 0 0.4vw;
}

.draw-side-actions .quiet,
.draw-side-actions .action-button:last-child {
  grid-column: span 2;
}

.draw-tools {
  min-width: 0;
  min-height: 0;
  display: flex;
  flex-direction: column;
  gap: 0.6vw;
  padding: 0.7vw 0.6vw;
  border-radius: 16px;
  border: 2px solid var(--accent);
  background: #ffffff;
  box-shadow: 0 4px 0 rgba(91, 141, 217, 0.16);
  overflow: hidden;
}

.draw-tool-col {
  display: grid;
  gap: 0.45vw;
}

.draw-tools .action-button {
  width: 100%;
  min-height: clamp(38px, 3vw, 54px);
  padding: 0.3vw;
  font-size: clamp(12px, 0.85vw, 16px);
}

.draw-tools label {
  display: grid;
  gap: 0.3vw;
  font-size: clamp(10px, 0.75vw, 13px);
  font-weight: 950;
  color: #2f528a;
}

.draw-tools input[type="color"] {
  width: 100%;
  height: clamp(34px, 2.8vw, 48px);
  padding: 3px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #ffffff;
  cursor: pointer;
}

.draw-tools input[type="range"] {
  width: 100%;
  accent-color: var(--red);
}

.draw-tools .quiet {
  margin-top: auto;
}

.draw-answer-card {
  margin: 0.55vw 0.75vw;
  border-radius: 12px;
  background: #ffffff;
  border: 1px solid var(--line);
  padding: 0.55vw 0.75vw;
  display: grid;
  gap: 0.2vw;
}

.draw-answer-card span {
  color: rgba(47, 82, 138, 0.56);
  font-weight: 900;
}

.draw-answer-card strong {
  color: var(--red);
  font-size: clamp(18px, 1.55vw, 30px);
  line-height: 1.1;
}

.draw-pool-section textarea {
  margin: 0.75vw;
  width: calc(100% - 1.5vw);
  height: calc(100% - 1.5vw);
  min-height: 0;
  font-size: clamp(13px, 0.9vw, 18px);
  line-height: 1.32;
}

.sudoku-layout {
  background: linear-gradient(135deg, #f7fbff, #fff8ec);
}

.sudoku-stage {
  min-width: 0;
  min-height: 0;
  display: grid;
  grid-template-rows: 1fr auto;
  align-items: center;
  justify-items: center;
  gap: 1vw;
  padding-right: 1.1%;
}

.sudoku-board {
  position: relative;
  width: min(66%, 62vh);
  aspect-ratio: 1;
  display: grid;
  grid-template-columns: repeat(9, 1fr);
  grid-template-rows: repeat(9, 1fr);
  border: 2px solid #111;
  border-radius: 0;
  overflow: hidden;
  background: #fff;
  box-shadow: 0 18px 30px rgba(47, 82, 138, 0.14);
}

.sudoku-board::before {
  content: "";
  position: absolute;
  inset: 2px;
  pointer-events: none;
  background:
    repeating-linear-gradient(to bottom, #d8d8d8 0 4px, transparent 4px 8px) calc(11.111% - 0.5px) 0 / 1px 100% no-repeat,
    repeating-linear-gradient(to bottom, #d8d8d8 0 4px, transparent 4px 8px) calc(22.222% - 0.5px) 0 / 1px 100% no-repeat,
    repeating-linear-gradient(to bottom, #d8d8d8 0 4px, transparent 4px 8px) calc(44.444% - 0.5px) 0 / 1px 100% no-repeat,
    repeating-linear-gradient(to bottom, #d8d8d8 0 4px, transparent 4px 8px) calc(55.555% - 0.5px) 0 / 1px 100% no-repeat,
    repeating-linear-gradient(to bottom, #d8d8d8 0 4px, transparent 4px 8px) calc(77.777% - 0.5px) 0 / 1px 100% no-repeat,
    repeating-linear-gradient(to bottom, #d8d8d8 0 4px, transparent 4px 8px) calc(88.888% - 0.5px) 0 / 1px 100% no-repeat,
    repeating-linear-gradient(to right, #d8d8d8 0 4px, transparent 4px 8px) 0 calc(11.111% - 0.5px) / 100% 1px no-repeat,
    repeating-linear-gradient(to right, #d8d8d8 0 4px, transparent 4px 8px) 0 calc(22.222% - 0.5px) / 100% 1px no-repeat,
    repeating-linear-gradient(to right, #d8d8d8 0 4px, transparent 4px 8px) 0 calc(44.444% - 0.5px) / 100% 1px no-repeat,
    repeating-linear-gradient(to right, #d8d8d8 0 4px, transparent 4px 8px) 0 calc(55.555% - 0.5px) / 100% 1px no-repeat,
    repeating-linear-gradient(to right, #d8d8d8 0 4px, transparent 4px 8px) 0 calc(77.777% - 0.5px) / 100% 1px no-repeat,
    repeating-linear-gradient(to right, #d8d8d8 0 4px, transparent 4px 8px) 0 calc(88.888% - 0.5px) / 100% 1px no-repeat;
  z-index: 1;
}

.sudoku-board::after {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background:
    linear-gradient(to right,
      transparent calc(33.333% - 1px),
      #111 calc(33.333% - 1px) calc(33.333% + 1px),
      transparent calc(33.333% + 1px) calc(66.666% - 1px),
      #111 calc(66.666% - 1px) calc(66.666% + 1px),
      transparent calc(66.666% + 1px)),
    linear-gradient(to bottom,
      transparent calc(33.333% - 1px),
      #111 calc(33.333% - 1px) calc(33.333% + 1px),
      transparent calc(33.333% + 1px) calc(66.666% - 1px),
      #111 calc(66.666% - 1px) calc(66.666% + 1px),
      transparent calc(66.666% + 1px));
  z-index: 2;
}

.sudoku-cell {
  width: 100%;
  height: 100%;
  min-width: 0;
  min-height: 0;
  border: 0;
  border-radius: 0;
  background: #fff;
  text-align: center;
  font-family: Arial, "Microsoft YaHei", sans-serif;
  font-size: clamp(20px, 2.55vw, 48px);
  font-weight: 500;
  color: #0832c7;
  padding: 0;
  outline: none;
  box-shadow: none;
  appearance: none;
}

.sudoku-cell:nth-child(3n) {
  border-right: 0;
}

.sudoku-cell:nth-child(n + 19):nth-child(-n + 27),
.sudoku-cell:nth-child(n + 46):nth-child(-n + 54) {
  border-bottom: 0;
}

.sudoku-cell:nth-child(9n) {
  border-right: 0;
}

.sudoku-cell:nth-child(n + 73):nth-child(-n + 81) {
  border-bottom: 0;
}

.sudoku-cell.is-fixed {
  background: #fff;
  color: #5f5f5f;
}

.sudoku-cell.is-user {
  color: #001fb8;
  font-weight: 650;
}

.sudoku-cell.is-error {
  background: #ffe8ec;
  color: var(--red);
}

.sudoku-message {
  border-radius: 999px;
  background: var(--ink);
  color: var(--paper);
  padding: 0.75vw 1.2vw;
  font-size: clamp(16px, 1.35vw, 26px);
  font-weight: 950;
}

.sudoku-controls {
  grid-template-rows: 100%;
}

.sudoku-stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.55vw;
  padding: 0.75vw;
}

.sudoku-stats div {
  border-radius: 10px;
  background: #ffffff;
  border: 1px solid var(--line);
  padding: 0.65vw;
  display: grid;
  gap: 0.2vw;
}

.sudoku-stats span {
  color: rgba(47, 82, 138, 0.55);
  font-weight: 900;
}

.sudoku-stats strong {
  color: var(--red);
  font-size: clamp(16px, 1.4vw, 28px);
}

.sudoku-actions {
  display: grid;
  gap: 0.65vw;
  padding: 0.75vw;
}

@keyframes bombPop {
  0% { transform: scale(1); color: var(--paper); text-shadow: none; }
  28% { transform: scale(1.22) rotate(-4deg); color: #ffe35e; text-shadow: 0 0 18px rgba(255, 224, 68, 0.82); }
  58% { transform: scale(0.92) rotate(3deg); color: #ff6b5d; }
  100% { transform: scale(1); color: var(--paper); }
}

@keyframes blastRing {
  0% { opacity: 0; transform: scale(0.34) rotate(0deg); filter: blur(0); }
  28% { opacity: 1; transform: scale(1.1) rotate(18deg); }
  100% { opacity: 0; transform: scale(1.85) rotate(42deg); filter: blur(2px); }
}

@keyframes sparkBurst {
  0% { opacity: 0; transform: scale(0.35); }
  24% { opacity: 1; }
  100% { opacity: 0; transform: scale(1.75); }
}

/* ---------- 直播输出模式（?live=1）：画面只保留左栏 + 棋盘，铺满 1920x1080 供哔哩哔哩直播姬捕捉 ---------- */
body.live-output .topbar {
  /* 直播输出时顶栏变成透明浮层，只保留居中的礼物图标 */
  position: absolute;
  inset: 0 0 auto 0;
  display: grid;
  grid-template-columns: 1fr;
  padding: 1.1% 1.3% 0;
  background: transparent;
  border-bottom: 0;
  pointer-events: none;
  z-index: 30;
}

body.live-output .topbar .brand-block,
body.live-output .topbar .game-tabs,
body.live-output .topbar .screen-badge {
  display: none;
}

body.live-output .topbar-center {
  justify-content: center;
}

/* 直播输出时：没上传礼物图标就整块隐藏，不出现在画面里 */
body.live-output .gift-slot:not(.has-image) {
  display: none;
}

body.live-output .broadcast-frame {
  grid-template-rows: 100%;
}

/* ================= 2026-10-09 Round 5 ================= */

/* ---------- 玩法栏：只保留礼物图标上传口 ---------- */
.vertical-ui-card .vertical-ui-body {
  padding: 0.45vw 0.4vw 0.5vw;
}

/* ---------- 数字炸弹：引线点燃 / 爆炸 ---------- */
.bomb-fuse {
  --fuse-base: clamp(34px, 3.4vw, 66px);
  --fuse-ratio: 1;
  position: absolute;
  left: 50%;
  bottom: calc(100% - 8px);
  width: clamp(5px, 0.45vw, 8px);
  height: calc(var(--fuse-base) * var(--fuse-ratio));
  transform: translateX(-50%) rotate(-7deg);
  transform-origin: bottom center;
  border-radius: 999px;
  background: linear-gradient(180deg, #cdb896, #8c7a5c);
  box-shadow: 0 0 0 2px rgba(255, 255, 255, 0.28);
  transition: height 0.4s cubic-bezier(0.2, 0.8, 0.2, 1), opacity 0.3s ease, transform 0.3s ease;
  z-index: 3;
}

.bomb-fuse::after {
  content: "";
  position: absolute;
  left: 50%;
  top: 0;
  width: clamp(11px, 0.9vw, 16px);
  aspect-ratio: 1;
  border-radius: 50%;
  transform: translate(-50%, -50%) scale(0.4);
  background: radial-gradient(circle, #fff7b8 0 26%, #ffb63c 52%, rgba(255, 112, 62, 0) 72%);
  opacity: 0;
  transition: opacity 0.25s ease, transform 0.25s ease;
}

/* 点燃中：火花闪烁 + 轻微闪烁 */
.bomb-fuse.is-lit {
  animation: fuseFlicker 0.5s ease-in-out infinite;
}

.bomb-fuse.is-lit::after {
  opacity: 1;
  transform: translate(-50%, -50%) scale(1);
  animation: fuseSpark 0.42s ease-in-out infinite alternate;
}

/* 爆炸：引线燃尽 */
.bomb-fuse.is-gone {
  opacity: 0;
  transform: translateX(-50%) rotate(-7deg) scaleY(0.1);
}

@keyframes fuseFlicker {
  0%, 100% { filter: brightness(1); }
  50% { filter: brightness(1.3); }
}

@keyframes fuseSpark {
  from { transform: translate(-50%, -50%) scale(0.82); opacity: 0.82; }
  to { transform: translate(-50%, -58%) scale(1.18); opacity: 1; }
}

/* ---------- 2026-10-09 Round 8 ---------- */
/* 数字炸弹猜数区：清空/确认 居中 */
.guess-section .control-row {
  justify-content: center;
}

/* 翻卡牌局：WebKit 内核下也隐藏滚动条（保留滚动能力） */
.cards-grid::-webkit-scrollbar {
  display: none;
}

body.live-output .broadcast-frame::after {
  display: none;
}

body.live-output .monopoly-panel .monopoly-layout {
  grid-template-columns: clamp(280px, 19vw, 400px) minmax(0, 1fr);
}

body.live-output .monopoly-panel .vertical-ui {
  display: none;
}

body.live-output .monopoly-panel .host-panel {
  display: none;
}

/* 直播模式下 VTS 画面框按宽度取正方形，玩家列表吃剩余高度 */
body.live-output .side-panel {
  grid-template-rows: auto minmax(0, 1fr) auto;
}

body.live-output .vts-frame {
  max-height: 50vh;
}

/* 直播输出时不出现操作类浮层 */
body.live-output .modal-backdrop,
body.live-output .vts-capture-menu {
  display: none !important;
}


@media (max-aspect-ratio: 16 / 10) {
  .app-shell {
    padding: 0;
  }

  .broadcast-frame {
    width: 100vw;
  }

  .screen-badge {
    display: none;
  }
}

/* ---------- 数字炸弹 / 翻卡 / 九宫格：棋局外框（对齐大富翁棋盘） ---------- */
/* 外层深蓝描边 + 圆角，内圈一圈白色虚线 */
.bomb-stage,
.cards-stage,
.lottery-stage,
.sudoku-stage {
  position: relative;
  border: 4px solid var(--stroke);
  border-radius: 18px;
  background: linear-gradient(160deg, var(--board-1) 0%, var(--board-2) 60%, var(--board-3) 100%);
  box-shadow: 0 10px 26px rgba(47, 82, 138, 0.22);
  padding: 1.2%;
  overflow: hidden;
}

.bomb-stage::before,
.cards-stage::before,
.lottery-stage::before,
.sudoku-stage::before {
  content: "";
  position: absolute;
  inset: 6px;
  border: 2px dashed rgba(255, 255, 255, 0.95);
  border-radius: 12px;
  pointer-events: none;
  z-index: 4;
}

/* ---------- 翻卡控制台：卡牌数量/统一卡面上传 两行紧凑，剩余高度给事件池 ---------- */
.cards-layout .card-count-row,
.cards-layout .card-face-row {
  grid-template-columns: auto minmax(0, 1fr);
  align-items: center;
  gap: 0.5vw;
  padding: 0.12vw 0.45vw;
}

.cards-layout .card-count-row input {
  width: 100%;
  min-width: 0;
  height: clamp(24px, 1.75vw, 31px);
  text-align: center;
}

.cards-layout .card-face-row input[type="file"] {
  width: 100%;
  min-width: 0;
  font-size: 0;
  height: clamp(24px, 1.75vw, 31px);
}

.cards-layout .card-face-row input[type="file"]::file-selector-button,
.cards-layout .card-face-row input[type="file"]::-webkit-file-upload-button {
  height: 100%;
  margin: 0;
  padding: 0 0.6vw;
  border: 0;
  border-radius: 8px;
  background: var(--paper);
  color: #3f6bb5;
  font-size: clamp(8px, 0.56vw, 11px);
  font-weight: 900;
  cursor: pointer;
}

/* 卡牌数量面板：标题+两行内容紧凑排列，面板收缩后剩余高度全部留给事件池 */
.cards-layout .panel-section:not(.card-pool-section) {
  grid-template-rows: auto auto auto;
  align-content: start;
}

/* ===== 你画我猜：左侧圆形倒计时（参考我画你猜Plus） ===== */
.draw-board-wrap {
  position: relative;
  min-width: 0;
  min-height: 0;
  display: grid;
}

.draw-timer {
  position: absolute;
  top: 1%;
  left: 0.9%;
  z-index: 6;
  display: grid;
  justify-items: center;
  gap: 0.35vw;
}

.draw-timer-ring {
  --p: 0%;
  width: clamp(64px, 6.2vw, 106px);
  aspect-ratio: 1;
  border-radius: 50%;
  background: conic-gradient(#ff9f2e var(--p), rgba(255, 255, 255, 0.65) 0);
  padding: 7%;
  box-shadow: 0 10px 22px rgba(20, 45, 85, 0.22);
}

.draw-timer.is-urgent .draw-timer-ring {
  background: conic-gradient(#f4503e var(--p), rgba(255, 255, 255, 0.65) 0);
}

.draw-timer:not(.is-running) .draw-timer-ring {
  background: conic-gradient(#b9c9e4 var(--p), rgba(255, 255, 255, 0.65) 0);
}

.draw-timer-core {
  width: 100%;
  height: 100%;
  border-radius: 50%;
  background: #ffffff;
  display: grid;
  place-content: center;
  justify-items: center;
  row-gap: 2%;
  box-shadow: inset 0 0 0 2px #ffe1b8;
}

.draw-timer-core strong {
  font-size: clamp(20px, 2vw, 34px);
  font-weight: 950;
  color: #2f528a;
  line-height: 1;
}

.draw-timer.is-urgent .draw-timer-core strong {
  color: #f4503e;
}

.draw-timer-core span {
  font-size: clamp(9px, 0.65vw, 12px);
  font-weight: 900;
  color: rgba(47, 82, 138, 0.6);
}

.draw-timer-stop {
  border: 0;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.9);
  color: #2f528a;
  font-size: clamp(9px, 0.6vw, 12px);
  font-weight: 900;
  padding: 0.1vw 0.55vw;
  cursor: pointer;
  box-shadow: 0 4px 10px rgba(20, 45, 85, 0.16);
}

.draw-timer-stop:hover {
  color: #f4503e;
}

/* ===== 本局时长选择弹窗 ===== */
.draw-duration-modal {
  grid-template-rows: auto auto auto auto;
  width: min(460px, 84vw);
}

.draw-duration-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.6vw;
}

.draw-duration-grid .action-button {
  height: clamp(40px, 3.4vw, 56px);
  font-size: clamp(13px, 1vw, 18px);
}

.draw-duration-row {
  display: flex;
  align-items: center;
  gap: 0.55vw;
  font-weight: 900;
  color: #2f528a;
}

.draw-duration-row label {
  display: flex;
  align-items: center;
  gap: 0.4vw;
}

.draw-duration-row input {
  width: clamp(72px, 6vw, 110px);
  height: clamp(32px, 2.6vw, 44px);
  border-radius: 10px;
  border: 2px solid #cfe1fa;
  padding: 0 0.5vw;
  font-weight: 900;
  color: #2f528a;
  text-align: center;
}

.draw-duration-row .primary {
  margin-left: auto;
}

/* ===== 数独：右栏紧凑化（文字缩小刚好放下）+ 难度行左字右下拉 ===== */
.sudoku-controls .section-title h2 {
  font-size: clamp(13px, 0.95vw, 17px);
}

.sudoku-diff-row {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  align-items: center;
  gap: 0.45vw;
  margin: 0 0.45vw;
  font-size: clamp(11px, 0.8vw, 14px);
  font-weight: 950;
  color: #2f528a;
}

.sudoku-diff-row select {
  height: clamp(26px, 2.1vw, 34px);
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
  color: #2f528a;
  font-size: clamp(11px, 0.8vw, 14px);
  font-weight: 900;
  padding: 0 0.3vw;
}

.sudoku-stats {
  gap: 0.4vw;
  padding: 0.55vw 0.5vw;
}

.sudoku-stats div {
  gap: 0.1vw;
  padding: 0.4vw 0.3vw;
}

.sudoku-stats span {
  font-size: clamp(9px, 0.68vw, 12px);
}

.sudoku-stats strong {
  font-size: clamp(12px, 0.95vw, 18px);
}

.sudoku-actions {
  gap: 0.4vw;
  padding: 0.55vw 0.5vw;
}

.sudoku-actions .action-button {
  min-height: clamp(28px, 2.2vw, 38px);
  font-size: clamp(10px, 0.78vw, 14px);
  padding: 0.2vw 0.4vw;
}

.sudoku-actions .action-button:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

/* ---------- 主题切换：左上角下拉 ---------- */
.theme-switch {
  position: relative;
  margin-left: auto;
  flex: none;
}

.theme-toggle {
  display: flex;
  align-items: center;
  gap: 0.35em;
  height: clamp(30px, 2.6vw, 46px);
  padding: 0 0.9em;
  border: 1px solid rgba(255, 255, 255, 0.75);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.2);
  color: #fff;
  font-weight: 900;
  font-size: clamp(10px, 0.7vw, 14px);
  white-space: nowrap;
  transition: background 0.18s ease;
}

.theme-toggle:hover {
  background: rgba(255, 255, 255, 0.32);
}

.theme-caret {
  font-size: 0.85em;
  opacity: 0.85;
}

.theme-menu {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  min-width: 9.5em;
  padding: 6px;
  border-radius: 14px;
  border: 1px solid var(--line);
  background: var(--panel);
  box-shadow: 0 14px 34px rgba(20, 20, 40, 0.28);
  z-index: 300;
}

.theme-option {
  display: flex;
  align-items: center;
  gap: 0.55em;
  width: 100%;
  padding: 0.55em 0.7em;
  border: 0;
  border-radius: 10px;
  background: transparent;
  color: var(--ink);
  font-weight: 800;
  font-size: clamp(11px, 0.72vw, 14px);
  text-align: left;
  white-space: nowrap;
}

.theme-option:hover {
  background: rgba(143, 180, 242, 0.18);
}

.theme-option.is-active {
  background: var(--accent);
  color: #fff;
}

.theme-dot {
  width: 0.85em;
  height: 0.85em;
  border-radius: 50%;
  flex: none;
}

.theme-dot-default {
  background: linear-gradient(135deg, #8fb4f2, #5b8dd9);
}

.theme-dot-halloween {
  background: linear-gradient(135deg, #ff9138, #6b47a8);
}

/* ---------- 万圣夜主题 ---------- */
body[data-theme="halloween"] {
  --ink: #432c63;
  --paper: #f8eedd;
  --panel: rgba(255, 244, 226, 0.96);
  --line: rgba(255, 145, 56, 0.5);
  --shadow: 0 18px 45px rgba(10, 5, 25, 0.5);
  --bg-body: #1c1233;
  --bg-shell: #251a42;
  --frame-bg: #31234f;
  --bar-grad: linear-gradient(92deg, #4a2f7d 0%, #6b47a8 52%, #4a2f7d 100%);
  --bar-grad-2: linear-gradient(92deg, #4a2f7d, #6b47a8);
  --stroke: #ff9138;
  --board-1: #453067;
  --board-2: #3b2960;
  --board-3: #4a3273;
  --accent: #ff9138;
}

body[data-theme="halloween"] {
  background:
    radial-gradient(circle at 12% 18%, rgba(255, 145, 56, 0.08), transparent 30%),
    radial-gradient(circle at 88% 12%, rgba(255, 145, 56, 0.06), transparent 26%),
    var(--bg-body);
}

/* 夜空星星点缀 */
body[data-theme="halloween"] .app-shell {
  position: relative;
}

body[data-theme="halloween"] .app-shell::before {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  background-image:
    radial-gradient(circle 2px at 8% 30%, rgba(255, 235, 200, 0.85), transparent 100%),
    radial-gradient(circle 1.5px at 22% 64%, rgba(255, 235, 200, 0.7), transparent 100%),
    radial-gradient(circle 2px at 36% 14%, rgba(255, 235, 200, 0.8), transparent 100%),
    radial-gradient(circle 1.5px at 55% 8%, rgba(255, 235, 200, 0.65), transparent 100%),
    radial-gradient(circle 2px at 72% 22%, rgba(255, 235, 200, 0.8), transparent 100%),
    radial-gradient(circle 1.5px at 86% 58%, rgba(255, 235, 200, 0.7), transparent 100%),
    radial-gradient(circle 2px at 94% 34%, rgba(255, 235, 200, 0.8), transparent 100%),
    radial-gradient(circle 1.5px at 46% 88%, rgba(255, 235, 200, 0.55), transparent 100%),
    radial-gradient(circle 2px at 64% 92%, rgba(255, 235, 200, 0.6), transparent 100%);
  background-repeat: no-repeat;
}

body[data-theme="halloween"] .brand-block p {
  color: rgba(255, 235, 210, 0.8);
}

body[data-theme="halloween"] .tab-button.is-active {
  color: #4a2f7d;
}

body[data-theme="halloween"] .theme-option:hover {
  background: rgba(255, 145, 56, 0.16);
}

body[data-theme="halloween"] .theme-option.is-active {
  color: #fff;
}

/* 棋盘磨砂层在深色底上稍微降一点白度，保持夜色感 */
body[data-theme="halloween"] .board-surface::before {
  background: rgba(255, 240, 220, 0.3);
}

/* 南瓜色外圈虚线 */
body[data-theme="halloween"] .broadcast-frame::after {
  border-color: rgba(255, 190, 120, 0.7);
}

/* ---------- 万圣夜主题 V2（按用户参考图重做：深紫卡片 + 月夜棋盘 + 橙/紫发光格子 + 节日装饰） ---------- */

/* 深色卡片 + 米白文字 + 南瓜橙强调（--ink/--paper 整体翻转） */
body[data-theme="halloween"] {
  --ink: #f4e9d6;
  --paper: #2b1c52;
  --panel: rgba(40, 26, 76, 0.96);
  --line: rgba(255, 145, 56, 0.45);
  --shadow: 0 18px 45px rgba(8, 4, 22, 0.55);
}

/* 表单控件改米色输入位（深面板上的亮色框） */
body[data-theme="halloween"] input:not([type="color"]):not([type="range"]):not([type="file"]),
body[data-theme="halloween"] textarea,
body[data-theme="halloween"] select {
  background: #fbf1de;
  color: #3a2667;
  border-color: rgba(255, 145, 56, 0.55);
}

/* 按钮配色：次要 = 深紫底暖字，主要 = 南瓜橙渐变 */
body[data-theme="halloween"] .action-button,
body[data-theme="halloween"] .step-button {
  background: #35215f;
  color: #ffd9a8;
  border-color: rgba(255, 145, 56, 0.65);
  box-shadow: 0 3px 0 rgba(8, 4, 22, 0.5);
}

body[data-theme="halloween"] .action-button.primary {
  background: linear-gradient(150deg, #ffab3d, #f27f1c);
  border-color: rgba(255, 235, 200, 0.75);
  color: #4a2200;
  text-shadow: none;
  box-shadow: 0 4px 0 rgba(120, 55, 0, 0.45), 0 0 14px rgba(255, 150, 50, 0.35);
}

body[data-theme="halloween"] .action-button.quiet {
  color: rgba(244, 233, 214, 0.75);
  border-color: rgba(255, 145, 56, 0.35);
  box-shadow: 0 3px 0 rgba(8, 4, 22, 0.45);
}

/* 面板卡片描边转暖色 */
body[data-theme="halloween"] .host-panel {
  border-color: rgba(255, 145, 56, 0.4);
}

/* 棋盘：月夜底（满月光晕 + 星点 + 深紫夜空），磨砂层几乎去掉 */
body[data-theme="halloween"] .board-surface {
  background:
    radial-gradient(circle at 63% 16%, rgba(255, 247, 220, 0.98) 0%, rgba(255, 240, 195, 0.9) 6.5%, rgba(255, 214, 140, 0.32) 14%, rgba(255, 200, 120, 0.1) 19%, transparent 26%),
    radial-gradient(circle 1.5px at 20% 30%, rgba(255, 240, 210, 0.8), transparent 100%),
    radial-gradient(circle 1.5px at 33% 60%, rgba(255, 240, 210, 0.6), transparent 100%),
    radial-gradient(circle 2px at 47% 78%, rgba(255, 240, 210, 0.7), transparent 100%),
    radial-gradient(circle 1.5px at 72% 44%, rgba(255, 240, 210, 0.6), transparent 100%),
    radial-gradient(circle 1.5px at 85% 70%, rgba(255, 240, 210, 0.65), transparent 100%),
    radial-gradient(circle 1.5px at 12% 78%, rgba(255, 240, 210, 0.55), transparent 100%),
    radial-gradient(120% 90% at 50% 40%, #463170 0%, #3a2863 48%, #2e1d52 100%);
}

body[data-theme="halloween"] .board-surface::before {
  background: rgba(255, 235, 205, 0.12);
}

/* 格子：暗紫底 + 橙色发光环，偶数格紫色发光环 */
body[data-theme="halloween"] .tile-front {
  background: linear-gradient(155deg, #3d2a6b 0%, #31205a 60%, #3a2568 100%);
  border-color: #ffab3d;
  box-shadow:
    inset 0 0 0 2px rgba(255, 190, 110, 0.4),
    0 0 4px rgba(255, 160, 50, 0.9),
    0 0 14px rgba(255, 140, 40, 0.5);
}

body[data-theme="halloween"] .board-tile:nth-child(even) .tile-front {
  border-color: #b07bff;
  box-shadow:
    inset 0 0 0 2px rgba(176, 123, 255, 0.4),
    0 0 4px rgba(170, 110, 255, 0.9),
    0 0 14px rgba(150, 90, 255, 0.5);
}

/* 事件翻面卡：米色纸面 + 深字 + 橙描边 */
body[data-theme="halloween"] .tile-back {
  color: #432c63;
  border-color: rgba(255, 145, 56, 0.85);
}

/* 起终点星星：暖金发光 */
body[data-theme="halloween"] .board-tile.is-start .tile-card,
body[data-theme="halloween"] .board-tile.is-finish .tile-card {
  filter: drop-shadow(0 0 3px rgba(255, 190, 90, 0.9)) drop-shadow(0 0 10px rgba(255, 150, 40, 0.55));
}

/* 节日装饰层（仅万圣夜显示，不挡操作） */
.hw-deco {
  display: none;
  position: absolute;
  z-index: 0;
  pointer-events: none;
  user-select: none;
  line-height: 1;
  filter: drop-shadow(0 5px 10px rgba(5, 2, 15, 0.55));
}

body[data-theme="halloween"] .hw-deco {
  display: block;
}

.hw-web-l { top: 1%; left: 13%; font-size: clamp(24px, 2.6vw, 48px); transform: scaleX(-1); opacity: 0.85; }
.hw-web-r { top: 1%; right: 0.8%; font-size: clamp(26px, 3vw, 56px); opacity: 0.9; }
.hw-bat-l { top: 2%; left: 30%; font-size: clamp(20px, 2.2vw, 40px); transform: rotate(-12deg); }
.hw-bat-r { top: 1.2%; left: 52%; font-size: clamp(16px, 1.8vw, 32px); transform: rotate(14deg); opacity: 0.85; }
.hw-ghost-l { top: 52%; left: 16%; font-size: clamp(22px, 2.6vw, 48px); opacity: 0.9; }
.hw-ghost-r { top: 58%; right: 18%; font-size: clamp(18px, 2.1vw, 40px); opacity: 0.8; }
.hw-pumpkin-l { bottom: 1.2%; left: 1.6%; font-size: clamp(32px, 4vw, 74px); }
.hw-pumpkin-r { bottom: 1%; right: 2.2%; font-size: clamp(28px, 3.6vw, 66px); }
.hw-candy-l { bottom: 4%; left: 24%; font-size: clamp(14px, 1.6vw, 30px); }
.hw-candy-r { bottom: 3.2%; right: 22%; font-size: clamp(13px, 1.5vw, 28px); }

/* 深色底上的零散白底控件改深色 */
body[data-theme="halloween"] .card-content {
  color: #3a2667;
}

/* 玩法栏上传虚线框转暖色 */
body[data-theme="halloween"] .gift-slot {
  border-color: rgba(255, 145, 56, 0.5);
}

/* 万圣夜 V2 补充：面板卡片深紫化（panel-section/info-card 固定白底 → 深紫） */
body[data-theme="halloween"] .panel-section,
body[data-theme="halloween"] .info-card {
  background: var(--panel);
  border-color: rgba(255, 145, 56, 0.45);
  box-shadow: 0 4px 0 rgba(8, 4, 22, 0.45);
}

/* 摄像头/虚拟形象位深紫化 */
body[data-theme="halloween"] .vts-frame {
  background:
    repeating-linear-gradient(45deg, rgba(255, 145, 56, 0.08) 0 12px, transparent 12px 24px),
    rgba(40, 26, 76, 0.85);
  border-color: rgba(255, 145, 56, 0.5);
  color: rgba(244, 233, 214, 0.85);
}

/* 白色小工具条（左栏骰子快捷条）深紫化 */
body[data-theme="halloween"] .dice-mini-tools,
body[data-theme="halloween"] .vts-toolbar {
  background: rgba(40, 26, 76, 0.9);
  border-color: rgba(255, 145, 56, 0.4);
}

/* 万圣夜 V2 补充：面板内固定深色标签转暖色 */
body[data-theme="halloween"] label {
  color: rgba(244, 233, 214, 0.88);
}

body[data-theme="halloween"] .control-hint {
  color: rgba(244, 233, 214, 0.55);
}

/* 万圣夜 V2 补充：翻卡/你画我猜固定白底面板深紫化 */
body[data-theme="halloween"] .draw-side,
body[data-theme="halloween"] .draw-tools,
body[data-theme="halloween"] .card-controls {
  background: var(--panel);
  border-color: rgba(255, 145, 56, 0.45);
}

/* 万圣夜 V2 补充：翻卡卡背转紫夜色 */
body[data-theme="halloween"] .card-cover,
body[data-theme="halloween"] .mini-card-preview {
  background:
    linear-gradient(155deg, rgba(255, 255, 255, 0.26), transparent 34%),
    linear-gradient(145deg, #6b47a8, #452c78);
}

/* 万圣夜 V2 补充：九宫格奖项字与比大小说明/结果条可读性 */
body[data-theme="halloween"] .lottery-cell {
  color: #432c63;
}

body[data-theme="halloween"] .compare-result {
  color: #4a2200;
}

body[data-theme="halloween"] .compare-help {
  color: rgba(244, 233, 214, 0.85);
}

/* ---------- 万圣夜 V3：参考素材图装饰（蛛网边框/蝙蝠/木牌/恶魔翅膀/金色蛛尘） ---------- */
.hw-deco-img,
.hw-img-frame,
.hw-img-webs,
.hw-img-bat-1,
.hw-img-bat-2,
.hw-img-bat-3,
.hw-img-sign,
.hw-img-wings {
  display: none;
  position: absolute;
  z-index: 0;
  pointer-events: none;
  user-select: none;
  background-repeat: no-repeat;
  background-size: contain;
  background-position: center;
  filter: drop-shadow(0 6px 12px rgba(5, 2, 15, 0.5));
}

body[data-theme="halloween"] .hw-deco-img,
body[data-theme="halloween"] .hw-img-frame,
body[data-theme="halloween"] .hw-img-webs,
body[data-theme="halloween"] .hw-img-bat-1,
body[data-theme="halloween"] .hw-img-bat-2,
body[data-theme="halloween"] .hw-img-bat-3,
body[data-theme="halloween"] .hw-img-sign,
body[data-theme="halloween"] .hw-img-wings {
  display: block;
}

/* 全板边框：左上蛛网枯枝 + 右下鬼屋 + 左下墓碑 */
.hw-img-frame {
  inset: 0;
  background-image: url("assets/hw-frame.png");
  background-size: 100% 100%;
}

/* 全板金色蛛尘 + 顶部垂丝蜘蛛 */
.hw-img-webs {
  inset: 0;
  background-image: url("assets/hw-webs.png");
  background-size: 100% 100%;
  opacity: 0.85;
}

/* 三只蝙蝠沿顶部飞行 */
.hw-img-bat-1 {
  top: 19%;
  left: 20%;
  width: 16%;
  aspect-ratio: 404 / 360;
  background-image: url("assets/hw-bat-1.png");
  transform: rotate(-6deg);
  filter: drop-shadow(0 0 5px rgba(255, 70, 30, 0.85));
}

.hw-img-bat-2 {
  top: 20%;
  left: 58%;
  width: 14%;
  aspect-ratio: 623 / 395;
  background-image: url("assets/hw-bat-2.png");
  transform: rotate(8deg);
  filter: drop-shadow(0 0 5px rgba(255, 70, 30, 0.85));
}

.hw-img-bat-3 {
  top: 62%;
  left: 63%;
  width: 11%;
  aspect-ratio: 716 / 387;
  background-image: url("assets/hw-bat-3.png");
  transform: rotate(-4deg);
  filter: drop-shadow(0 0 5px rgba(255, 70, 30, 0.85));
}

/* 木牌（南瓜+蛛网+巫师帽）垫在底部中央 */
.hw-img-sign {
  top: 66.5%;
  left: 35%;
  width: 24%;
  aspect-ratio: 658 / 254;
  background-image: url("assets/hw-sign.png");
  transform: rotate(-2deg);
}

/* 恶魔翅膀垫在骰子台后方 */
.hw-img-wings {
  top: 46%;
  left: 50%;
  width: 42%;
  aspect-ratio: 800 / 376;
  background-image: url("assets/hw-wings.png");
  transform: translate(-50%, -50%);
  opacity: 0.9;
}

/* 蝙蝠轻微浮动动画 */
body[data-theme="halloween"] .hw-img-bat-1 { animation: hwFloat 5.2s ease-in-out infinite; }
body[data-theme="halloween"] .hw-img-bat-2 { animation: hwFloat 6.1s ease-in-out 0.6s infinite; }
body[data-theme="halloween"] .hw-img-bat-3 { animation: hwFloat 5.6s ease-in-out 1.2s infinite; }

@keyframes hwFloat {
  0%, 100% { margin-top: 0; }
  50% { margin-top: 0.6%; }
}
