/* 奇想Fun · 双人数学对战游戏公共样式（拔河、赛跑、擂台、搭塔、菜园攻防……） */
body { padding: 8px 8px 20px; }
.nf-stage.duel { max-width: 1100px; min-height: 0; background: linear-gradient(180deg, #fef6e4 0%, #fff 100%); }
#arena { display: block; width: 100%; height: auto; }
.timer { height: 8px; margin: 0 8px; border-radius: 4px; background: #eee; overflow: hidden; }
.timer i { display: block; height: 100%; width: 100%; background: linear-gradient(90deg, #ffd23f, #ff7a3d); transform-origin: left; }
.boards { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; padding: 8px; }
.pb { border-radius: 20px; padding: 10px 10px 12px; position: relative; }
.pb.p1 { background: #ffe3e6; border: 4px solid #ff6b81; }
.pb.p2 { background: #e0efff; border: 4px solid #4f9dff; }
.pb .who { display: flex; align-items: center; justify-content: space-between; font-weight: 900; font-size: 16px; }
.pb.p1 .who { color: #d6334f; } .pb.p2 .who { color: #1f6fd1; }
.pb .q { text-align: center; font-size: clamp(28px, 5.2vw, 46px); font-weight: 900; color: #3b2a5c; margin: 4px 0 8px; letter-spacing: 1px; }
.opts { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.opts.n3 { grid-template-columns: 1fr 1fr 1fr; }
.opts.n2 { grid-template-columns: 1fr 1fr; }
.opts button { position: relative; border: 0; border-radius: 16px; background: #fff; font: inherit; font-weight: 900; font-size: clamp(24px, 4.4vw, 38px);
  color: #3b2a5c; padding: 12px 6px; cursor: pointer; box-shadow: 0 5px 0 rgba(0,0,0,.14); touch-action: manipulation; }
.opts button:active { transform: translateY(4px); box-shadow: 0 1px 0 rgba(0,0,0,.14); }
.opts button .key { position: absolute; left: 8px; top: 6px; font-size: 13px; color: #9b8fb8; font-weight: 800; }
.opts button.right { background: #c8f7d4; } .opts button.wrong { background: #ffd0d0; animation: duel-shake .35s; }
.opts button.act { background: #fff6d6; font-size: clamp(18px, 3.4vw, 28px); }
.pb.locked .opts button { opacity: .45; }
.pb .lock { position: absolute; inset: 0; border-radius: 16px; display: none; align-items: center; justify-content: center; font-weight: 900;
  font-size: 22px; color: #fff; background: rgba(60,40,90,.55); }
.pb.locked .lock { display: flex; }
.pb.win { animation: duel-glow 1s infinite alternate; }
@keyframes duel-glow { from { box-shadow: 0 0 0 rgba(255,210,63,0); } to { box-shadow: 0 0 24px rgba(255,190,40,.9); } }
@keyframes duel-shake { 25% { transform: translateX(-6px); } 50% { transform: translateX(6px); } 75% { transform: translateX(-3px); } }
/* 竖屏：两人面对面，蓝队面板倒过来放在最上面，战斗画面在中间 */
@media (orientation: portrait) and (max-width: 820px) {
  .nf-stage.duel { display: flex; flex-direction: column; }
  .boards { display: contents; }
  .pb { margin: 8px; }
  .pb.p2 { order: 0; transform: rotate(180deg); }
  #arena { order: 1; } .timer { order: 2; } .pb.p1 { order: 3; }
}
#setupP, #endP { position: fixed; z-index: 50; }
.setup h2 { margin-bottom: 4px; }
.setup .row { margin: 10px 0; text-align: left; }
.setup .row > b { display: block; font-size: 15px; margin-bottom: 6px; color: #6b5a8f; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chips button { border: 3px solid #eadff7; background: #fff; border-radius: 14px; font: inherit; font-weight: 800; font-size: 15px; padding: 6px 10px; cursor: pointer; color: #3b2a5c; }
.chips button.on { border-color: #ff4f8b; background: #fff0f5; color: #d6336c; }
.chips.pets button { font-size: 26px; padding: 2px 6px; }
.teams { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.teams > div { border-radius: 16px; padding: 8px; }
.teams .t1 { background: #ffe3e6; } .teams .t2 { background: #e0efff; }
.teams input { width: 100%; font: inherit; font-weight: 800; font-size: 16px; padding: 6px 8px; border-radius: 10px; border: 2px solid #fff; margin-bottom: 6px; text-align: center; }
.hint { font-size: 13px; color: #8b7fb0; margin-top: 6px; line-height: 1.5; }
.res-row { display: grid; grid-template-columns: 1fr auto 1fr; gap: 6px; align-items: center; margin: 8px 0; font-weight: 800; }
.res-row span:nth-child(2) { color: #8b7fb0; font-size: 13px; }
.res-row .a { color: #d6334f; } .res-row .b { color: #1f6fd1; }
/* Q 版角色小图 */
.pet-ico { width: auto; height: 1.6em; vertical-align: middle; margin: -6px 0; }
.pet-big { width: auto; height: 84px; vertical-align: middle; }
/* 顶栏的暂停 / 重来 */
.nf-ctl { font-weight: 900; }
/* 开局面板：一屏内放下 */
#setupP .nf-card.setup { width: min(560px, 100%); padding: 14px 16px 12px; }
.setup h2 { font-size: 24px; margin: 0 0 4px; }
.setup details.intro { font-size: 13px; color: #8b7fb0; margin: 0 0 6px; }
.setup details.intro summary { cursor: pointer; font-weight: 800; color: #ff7a3d; list-style: none; }
.setup details.intro summary::before { content: '💡 '; }
.setup details.intro p { font-size: 13px; line-height: 1.5; margin: 4px 0; text-align: left; }
.setup .row.lv { display: flex; align-items: center; gap: 8px; margin: 6px 0 8px; }
.setup .row.lv > b { display: inline; margin: 0; white-space: nowrap; font-size: 14px; }
.setup .row.lv .chips { gap: 4px; }
.setup .row.lv .chips button { font-size: 13px; padding: 4px 8px; border-width: 2px; border-radius: 12px; }
.setup .teams > div { padding: 6px; }
.setup .teams input { font-size: 15px; padding: 4px 6px; margin: 0 0 6px; border: 2px solid #fff; }
.chips.pets { display: grid; grid-template-columns: repeat(5, 1fr); gap: 4px; }
.chips.pets button { padding: 2px 0; border-width: 2px; border-radius: 12px; line-height: 0; }
.chips.pets button img { height: 40px; width: auto; max-width: 100%; }
.setup .nf-btns { margin-top: 8px; }
.setup .nf-btn { padding: 9px 34px; font-size: 19px; }
/* 暂停：不弹窗，只在战斗画面上浮一条暂停栏，下面还能翻看规则 */
.nf-stage.duel { position: relative; }
.pausebar { position: absolute; left: 50%; transform: translateX(-50%); z-index: 30; display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 6px;
  max-width: calc(100% - 16px); background: rgba(255,255,255,.96); border: 3px solid #ffd23f; border-radius: 22px; padding: 6px 10px; box-shadow: 0 8px 24px rgba(60,40,90,.25); }
.pausebar b { font-size: 16px; color: #3b2a5c; margin-right: 2px; white-space: nowrap; }
.pausebar button { border: 0; border-radius: 16px; font: inherit; font-weight: 900; font-size: 14px; padding: 7px 11px; cursor: pointer; background: #efe8ff; color: #3b2a5c; white-space: nowrap; }
.pausebar .pb-go { background: linear-gradient(180deg, #ff9a3d, #ff5d8f); color: #fff; font-size: 16px; padding: 7px 16px; }
.nf-stage.duel.is-paused #arena, .nf-stage.duel.is-paused .boards, .nf-stage.duel.is-paused .timer { filter: saturate(.55) brightness(.92); }
.backgame { position: fixed; left: 50%; bottom: 18px; transform: translateX(-50%); z-index: 60; border: 0; border-radius: 30px; font: inherit; font-weight: 900; font-size: 17px;
  padding: 12px 24px; color: #fff; background: linear-gradient(180deg, #ff9a3d, #ff5d8f); box-shadow: 0 6px 18px rgba(255,93,143,.45); cursor: pointer; }
.backgame.hidden, .pausebar.hidden { display: none; }
/* 分数、钟面等图形选项 */
.frac { display: inline-flex; flex-direction: column; align-items: center; line-height: 1.02; vertical-align: middle; font-size: .82em; }
.frac i { font-style: normal; padding: 0 .18em; }
.frac i:first-child { border-bottom: .09em solid currentColor; }
.opts button svg.clk { width: clamp(54px, 8.5vw, 84px); height: auto; display: block; margin: 0 auto; }
.opts button.emo { font-family: "Apple Color Emoji", "Segoe UI Emoji", "Noto Color Emoji", sans-serif; }
.pb .q svg.pz { width: clamp(64px, 10vw, 96px); height: auto; vertical-align: middle; margin-right: 8px; }
.pb .q small { font-size: .5em; color: #8b7fb0; font-weight: 800; }
.pb .q .hl { color: #ff3b6b; text-decoration: underline; text-underline-offset: 6px; }
.pb .q .num { font-variant-numeric: tabular-nums; letter-spacing: 2px; }
