/* ==========================================================================
   fun.css — 趣味互动类页面的共用样式（v3.58.0）
   只放多个页面共用的骨架；单个页面独有的块仍写在页面 <style> 里。
   颜色一律走 app.css 的变量，深浅色自动跟随。
   ========================================================================== */

/* ---------- 展示舞台 ---------- */
.fx-stage {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 220px;
  padding: 18px;
  background: var(--panel-sunken);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}
.fx-stage.flush { padding: 0; }
.fx-stage.tall { min-height: 320px; }

/* 舞台左上角的模式标 */
.fx-tag {
  position: absolute;
  top: 10px;
  left: 10px;
  z-index: 3;
  padding: 2px 8px;
  font-size: 11px;
  color: var(--text-dim);
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 999px;
}

/* ---------- 大数字 ---------- */
.fx-big {
  font-family: var(--mono);
  font-size: 46px;
  font-weight: 600;
  line-height: 1.05;
  font-variant-numeric: tabular-nums;
  letter-spacing: -.02em;
}
.fx-big small {
  margin-left: 5px;
  font-size: 13px;
  font-weight: 400;
  letter-spacing: 0;
  color: var(--text-dim);
}
.fx-big.sm { font-size: 30px; }
.fx-cap {
  margin-top: 6px;
  font-size: 12.5px;
  color: var(--text-dim);
  text-align: center;
  line-height: 1.6;
}

/* ---------- 胶囊按钮组 ---------- */
.fx-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.fx-chip {
  padding: 5px 12px;
  font-size: 12.5px;
  font-family: inherit;
  color: var(--text-dim);
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 999px;
  cursor: pointer;
  transition: color .12s, border-color .12s, background .12s;
}
.fx-chip:hover { color: var(--text); border-color: var(--border-strong); }
.fx-chip.on {
  color: var(--accent-dark);
  background: var(--accent-soft);
  border-color: var(--accent);
  font-weight: 600;
}

/* ---------- 选项编辑（转盘 / 抽奖 / 卡片池共用） ---------- */
.fx-opts {
  display: flex;
  flex-direction: column;
  gap: 6px;
  max-height: 300px;
  overflow-y: auto;
}
.fx-opt {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 8px;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
}
.fx-opt .sw {
  flex: none;
  width: 12px;
  height: 12px;
  border-radius: 3px;
  border: 1px solid rgba(0, 0, 0, .12);
}
.fx-opt input[type="text"] {
  flex: 1 1 auto;
  min-width: 0;
  padding: 4px 6px;
  font-size: 13px;
  color: var(--text);
  background: transparent;
  border: 0;
  border-bottom: 1px dashed transparent;
  border-radius: 0;
}
.fx-opt input[type="text"]:focus {
  outline: none;
  border-bottom-color: var(--accent);
}
.fx-opt .w {
  flex: none;
  width: 54px;
  padding: 3px 5px;
  font-size: 12px;
  font-family: var(--mono);
  color: var(--text-dim);
  background: var(--panel-sunken);
  border: 1px solid var(--border);
  border-radius: 5px;
  text-align: center;
}
.fx-opt .del {
  flex: none;
  width: 24px;
  height: 24px;
  font-size: 15px;
  line-height: 1;
  color: var(--text-faint);
  background: transparent;
  border: 0;
  border-radius: 5px;
  cursor: pointer;
}
.fx-opt .del:hover { color: var(--err); background: var(--err-soft); }
.fx-opts-foot {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 8px;
  font-size: 12px;
  color: var(--text-dim);
}

/* ---------- 历史记录 ---------- */
.fx-hist {
  display: flex;
  flex-direction: column;
  gap: 1px;
  max-height: 240px;
  overflow-y: auto;
  font-size: 12.5px;
}
.fx-hist-item {
  display: flex;
  align-items: baseline;
  gap: 10px;
  padding: 6px 8px;
  border-radius: 5px;
}
.fx-hist-item:nth-child(odd) { background: var(--panel-sunken); }
.fx-hist-item .t {
  flex: none;
  font-family: var(--mono);
  font-size: 11px;
  color: var(--text-faint);
}
.fx-hist-item .v {
  flex: 1 1 auto;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.fx-hist-item .v b { color: var(--accent-dark); }
.fx-hist-item .n {
  flex: none;
  font-size: 11px;
  color: var(--text-dim);
  font-family: var(--mono);
}
.fx-empty {
  padding: 18px 10px;
  font-size: 12.5px;
  color: var(--text-faint);
  text-align: center;
}

/* ---------- 抽奖滚动 ---------- */
.fx-roll {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  width: 100%;
  text-align: center;
}
.fx-roll-name {
  font-size: clamp(28px, 6vw, 54px);
  font-weight: 600;
  line-height: 1.15;
  color: var(--accent-dark);
  word-break: break-all;
  max-width: 100%;
}
.fx-roll-name.settled { color: var(--text); }
.fx-roll-sub {
  font-size: 12.5px;
  color: var(--text-dim);
  font-family: var(--mono);
}

/* ---------- 记分板 ---------- */
.fx-scores {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 10px;
}
.fx-score {
  padding: 12px 14px;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  text-align: center;
}
.fx-score .nm {
  font-size: 13px;
  color: var(--text-dim);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.fx-score .pt {
  margin: 4px 0 8px;
  font-family: var(--mono);
  font-size: 32px;
  font-weight: 600;
  line-height: 1;
  font-variant-numeric: tabular-nums;
}
.fx-score .ops { display: flex; gap: 5px; justify-content: center; }
.fx-score .ops button {
  flex: 1 1 0;
  min-width: 0;
  padding: 5px 0;
  font-size: 13px;
  font-family: var(--mono);
  color: var(--text-dim);
  background: var(--panel-sunken);
  border: 1px solid var(--border);
  border-radius: 5px;
  cursor: pointer;
}
.fx-score .ops button:hover { color: var(--text); border-color: var(--border-strong); }
.fx-score .ops button.minus:hover { color: var(--err); border-color: var(--err); }
.fx-score .ops button.plus:hover { color: var(--ok); border-color: var(--ok); }
.fx-score.lead { border-color: var(--accent); }
.fx-score.lead .pt { color: var(--accent-dark); }

/* ---------- 打字 / 输入区 ---------- */
.fx-type {
  padding: 16px 18px;
  font-size: 17px;
  line-height: 1.9;
  letter-spacing: .01em;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  user-select: none;
}
.fx-type .ch { color: var(--text-dim); }
.fx-type .ch.done { color: var(--text); }
.fx-type .ch.bad {
  color: var(--err);
  background: var(--err-soft);
  border-radius: 2px;
}
.fx-type .ch.cur {
  border-bottom: 2px solid var(--accent);
  color: var(--text);
}
.fx-input {
  width: 100%;
  min-height: 82px;
  padding: 12px 14px;
  font-family: inherit;
  font-size: 15px;
  line-height: 1.7;
  color: var(--text);
  background: var(--panel);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  resize: vertical;
}
.fx-input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }

/* ---------- 指标格 ---------- */
.fx-metrics {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(96px, 1fr));
  gap: 1px;
  overflow: hidden;
  background: var(--border);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
}
.fx-metrics div {
  padding: 10px 8px;
  background: var(--panel);
  text-align: center;
}
.fx-metrics dt {
  font-size: 11.5px;
  color: var(--text-dim);
}
.fx-metrics dd {
  margin: 3px 0 0;
  font-family: var(--mono);
  font-size: 20px;
  font-weight: 600;
  line-height: 1.1;
  font-variant-numeric: tabular-nums;
}
.fx-metrics dd small { font-size: 11px; font-weight: 400; color: var(--text-dim); }

/* ---------- 卡片式结果（答案之书 / 任务卡 / 题卡） ---------- */
.fx-card {
  width: 100%;
  max-width: 460px;
  min-height: 168px;
  padding: 26px 24px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  text-align: center;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}
.fx-card .kind {
  font-size: 11.5px;
  letter-spacing: .12em;
  color: var(--accent-dark);
  text-transform: uppercase;
}
.fx-card .body {
  font-size: 19px;
  line-height: 1.6;
  color: var(--text);
}
.fx-card .body.lg { font-size: 22px; font-weight: 600; }
.fx-card .foot {
  font-size: 12px;
  color: var(--text-dim);
}

/* ---------- 全屏层（弹幕 / 记分板 / 假装升级） ---------- */
.fx-full {
  position: fixed;
  inset: 0;
  z-index: 9000;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #05070a;
  color: #f2f5fa;
  overflow: hidden;
}
.fx-full[hidden] { display: none; }
.fx-exit {
  position: absolute;
  top: 12px;
  right: 12px;
  z-index: 20;
  padding: 5px 12px;
  font-size: 12px;
  color: #fff;
  background: rgba(0, 0, 0, .45);
  border: 1px solid rgba(255, 255, 255, .22);
  border-radius: 999px;
  cursor: pointer;
}
.fx-exit:hover { background: rgba(0, 0, 0, .65); }

/* 弹幕滚动条 */
.fx-dm-line {
  position: absolute;
  top: 50%;
  left: 100%;
  margin-top: -.6em;
  line-height: 1.2;
  white-space: nowrap;
  font-weight: 700;
  will-change: transform;
}
@keyframes fxDanmu {
  from { transform: translateX(0); }
  to { transform: translateX(calc(-100vw - 100%)); }
}

/* ---------- 说明块里的手工表格 ---------- */
.fx-mini {
  width: 100%;
  border-collapse: collapse;
  font-size: 12.5px;
}
.fx-mini th,
.fx-mini td {
  padding: 5px 8px;
  text-align: left;
  border-bottom: 1px solid var(--border);
}
.fx-mini th {
  font-size: 11.5px;
  font-weight: 600;
  color: var(--text-dim);
  border-bottom-color: var(--border-strong);
}
.fx-mini td.num { font-family: var(--mono); text-align: right; }

/* ---------- 游戏壳（2048 / 棋类 / 华容道 / 翻牌 / 扫雷共用） ---------- */
.gm-hud {
  display: flex; flex-wrap: wrap; gap: 8px; align-items: stretch;
  margin-bottom: 12px;
}
.gm-stat {
  min-width: 70px; padding: 7px 10px 8px; border-radius: 9px;
  background: var(--panel-sunken);
}
.gm-stat span { display: block; font-size: 11px; letter-spacing: .4px; color: var(--text-faint); }
.gm-stat b {
  display: block; margin-top: 2px; font-family: var(--mono); font-size: 18px;
  font-variant-numeric: tabular-nums; line-height: 1.2;
}
.gm-stat.hi b { color: var(--accent-dark); }
.gm-stat.wide { min-width: 118px; }
.gm-bar { display: flex; flex-wrap: wrap; gap: 8px; margin-left: auto; align-items: center; }

.gm-stage { display: flex; justify-content: center; }
.gm-stage canvas {
  display: block; width: 100%; max-width: 540px; height: auto;
  border-radius: 12px; background: var(--panel-sunken); touch-action: none;
}

.gm-msg {
  margin-top: 12px; padding: 11px 14px; border-radius: 9px;
  background: var(--panel); border: 1px solid var(--border);
  border-left: 3px solid var(--accent); font-size: 14px; line-height: 1.7;
}
.gm-msg.ok { border-left-color: var(--ok); }
.gm-msg.warn { border-left-color: var(--warn); }
.gm-msg.err { border-left-color: var(--err); }
.gm-msg b { font-variant-numeric: tabular-nums; }

.gm-keys {
  margin-top: 12px; font-size: 12.5px; line-height: 1.9; color: var(--text-dim);
}
.gm-keys kbd {
  display: inline-block; min-width: 20px; padding: 1px 6px; margin: 0 1px;
  border: 1px solid var(--border-strong); border-bottom-width: 2px; border-radius: 5px;
  background: var(--panel); font-family: var(--mono); font-size: 11.5px;
  color: var(--text); text-align: center;
}

/* ---------- 窄屏 ---------- */
@media (max-width: 560px) {
  .gm-stat, .gm-stat.wide { flex: 1 1 0; min-width: 0; }
  .fx-stage { padding: 12px; min-height: 190px; }
  .fx-big { font-size: 34px; }
  .fx-big.sm { font-size: 24px; }
  .fx-type { padding: 12px 13px; font-size: 15px; line-height: 1.85; }
  .fx-card { padding: 20px 16px; min-height: 150px; }
  .fx-card .body { font-size: 17px; }
  .fx-card .body.lg { font-size: 19px; }
  .fx-scores { grid-template-columns: repeat(auto-fill, minmax(132px, 1fr)); gap: 8px; }
  .fx-score { padding: 10px; }
  .fx-score .pt { font-size: 26px; }
  .fx-metrics { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .fx-opts { max-height: 240px; }
  .fx-opt .w { width: 46px; }
}
