/* 新手教程浮层 + 首次开局询问 + 游戏内提示气泡。结构见 src/ui/tutorial.js。
   - 面板/标题牌/按钮直接沿用大厅皮肤（lobby.css 的 .lb-panel / .lb-title / .lb-btn，切片值不变）；
   - 示例场景全部是 .tu-* 独立类，只复用素材变量（--asset-tile_*、pawn_*、card_back…），不影响主界面布局；
   - 与大厅同一套缩放：--s = 1 设计像素（1920×1080 基准）。 */
#tutorial {
  --s: min(calc(100vw / 1920), calc(100vh / 1080));
  --ss: var(--s);
  --gold: #d9b45c; --gold-d: #b8913f; --ink: #ecdcb4; --ink-on: #fff3cf;
  position: fixed; inset: 0; z-index: 80; overflow: hidden;
  background: radial-gradient(ellipse at 50% 40%, #2a1a0ecc, #0b0603f2 75%);
  font-family: "PingFang SC", "Microsoft YaHei", "Noto Sans CJK SC", system-ui, sans-serif; color: var(--ink);
}
#tutorial[hidden] { display: none; }
html.lb-has-lobby_bg #tutorial:not(.tu-asking) { background: linear-gradient(#0b0603b3, #0b0603b3), #1a110a var(--lb-lobby-bg) center / cover no-repeat; }
#tutorial.tu-asking { background: #0008; }
#tutorial .tu-stage { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; }

/* 面板：沿用大厅九宫格，只改尺寸 */
#tutorial .tu-panel { margin: calc(40 * var(--s)) 0 0; width: calc(1660 * var(--s)); padding: calc(96 * var(--s)) calc(92 * var(--s)) calc(60 * var(--s)); font-size: max(12px, calc(22 * var(--s))); display: flex; flex-direction: column; }
#tutorial .lb-btn:hover:not(:disabled) { filter: brightness(1.15) drop-shadow(0 calc(6 * var(--s)) calc(8 * var(--s)) #0009); }
#tutorial .lb-btn:active:not(:disabled) { filter: brightness(.9) drop-shadow(0 calc(4 * var(--s)) calc(6 * var(--s)) #0009); transform: translateY(1px); }
#tutorial .lb-btn:disabled { filter: saturate(.2) brightness(.7); cursor: default; }
#tutorial .lb-btn:focus-visible { outline: none; filter: brightness(1.1) drop-shadow(0 0 calc(4 * var(--s)) #ffe08a) drop-shadow(0 0 calc(10 * var(--s)) #ffd060aa); }
#tutorial .lb-r { gap: .45em; }

.tu-head { display: flex; align-items: center; justify-content: space-between; gap: calc(24 * var(--s)); height: calc(58 * var(--s)); flex: none; border-bottom: 1px solid rgba(201, 162, 77, .25); margin-bottom: calc(18 * var(--s)); }
.tu-ptitle { margin: 0; display: flex; align-items: center; gap: .5em; font-size: max(15px, calc(32 * var(--s))); color: #f3d48a; text-shadow: 0 2px 3px #000; white-space: nowrap; }
.tu-pnum { display: inline-grid; place-items: center; width: 1.35em; height: 1.35em; border-radius: 50%; background: radial-gradient(circle at 35% 35%, #ffe9a8, #b8862a); color: #2a1c10; font-size: .8em; box-shadow: 0 1px 3px #000; }
.tu-mode { display: flex; gap: calc(28 * var(--s)); white-space: nowrap; font-size: max(12px, calc(21 * var(--s))); }

.tu-bubble { position: relative; flex: 1 1 auto; min-height: 0; margin: 0; padding: calc(20 * var(--s)) calc(24 * var(--s)); border-radius: calc(16 * var(--s)); background: linear-gradient(#f6ead0, #ead7ad); color: #2a1c10; box-shadow: 0 calc(6 * var(--s)) calc(16 * var(--s)) #000a, inset 0 0 0 2px #b8913f; line-height: 1.5; overflow: hidden; }
.tu-bubble b { color: #6b3a07; }
.tu-chip { display: inline-flex; align-items: center; gap: .2em; padding: 0 .35em 0 .15em; border-radius: 1em; background: var(--tc, #555); color: var(--ti, #fff); font-weight: 700; line-height: 1.35; vertical-align: .05em; font-size: .92em; }
.tu-ticon { display: inline-block; width: 1.05em; height: 1.05em; border-radius: 50%; background: center / contain no-repeat; }
.tu-ticon.theme-E { background-image: var(--asset-icon_cui, none); } .tu-ticon.theme-G { background-image: var(--asset-icon_shuang, none); }
.tu-ticon.theme-R { background-image: var(--asset-icon_fu, none); } .tu-ticon.theme-T { background-image: var(--asset-icon_sha, none); }
.tu-lock { width: 1.1em; height: 1.1em; vertical-align: -.2em; filter: drop-shadow(0 1px 1px #000a); }
.tu-runner { display: inline-block; width: 1.1em; height: 1.1em; vertical-align: -.2em; padding: 0 .1em; border-radius: 3px; background: #b8913f; }
.tu-runner svg, .tu-pcap svg, .tu-cap svg { width: 100%; height: 100%; display: block; }

/* 场景区：深色桌布小窗 */

/* ---- 迷你 Market 轨道（与主界面同一套素材：悬挂牌 + 平面瓷砖 + 上下砖栏 + 棋子） ---- */
/* 底部留给 +分 标签：标签字号有 9px 下限，格子很小时按字高（1.75em）留位，不按格宽，否则标签会压到下面的图注 */
.tu-track { --th: calc(var(--cw) / 1.07); --rh: calc(var(--th) * .22); --top: calc(var(--cw) * 2.05); --bot: calc(var(--cw) * .08); position: relative; flex: none; height: calc(var(--top) + 2 * var(--rh) + var(--th) + var(--bot)); font-size: max(9px, calc(var(--cw) * .2)); }
/* 有格下标注（+分）时才留标注行；不画悬挂牌时上方只留棋子的高度 */
.tu-track.tu-marked { --bot: max(calc(var(--cw) * .42), 1.75em); }
.tu-track.tu-nohang { --top: calc(var(--cw) * .1); }
.tu-more { position: absolute; top: calc(var(--top) + var(--rh)); width: var(--cw); height: var(--th); display: grid; place-items: center; color: #c9a86a; font: 800 max(9px, calc(var(--cw) * .42))/1 system-ui, sans-serif; letter-spacing: .05em; font-style: normal; }
.tu-track .theme-E, .tu-scene .theme-E { --tc: #2f9e6e; --ti: #fff; } .tu-track .theme-G, .tu-scene .theme-G { --tc: #5ab0e8; --ti: #06293f; }
.tu-track .theme-R, .tu-scene .theme-R { --tc: var(--theme-fu); --ti: var(--theme-fu-ink); } .tu-track .theme-T, .tu-scene .theme-T { --tc: #d9ad4f; --ti: #3a2a05; }
.tu-bubble .tu-chip.theme-E { --tc: #2f9e6e; --ti: #fff; } .tu-bubble .tu-chip.theme-G { --tc: #5ab0e8; --ti: #06293f; }
.tu-bubble .tu-chip.theme-R { --tc: var(--theme-fu); --ti: var(--theme-fu-ink); } .tu-bubble .tu-chip.theme-T { --tc: #d9ad4f; --ti: #3a2a05; }
.tu-hang { position: absolute; top: 0; height: var(--top); width: calc(var(--n) * var(--cw)); display: flex; flex-direction: column; justify-content: flex-end; align-items: center; pointer-events: none; }
.tu-pc { position: relative; flex: none; width: calc(var(--cw) * clamp(1.2, var(--n) * .9, 1.3)); aspect-ratio: 636 / 890; border: max(2px, calc(var(--cw) * .035)) solid var(--tc); border-radius: calc(var(--cw) * .1); overflow: hidden; background: #111; box-shadow: 0 0 0 1px #000a, 0 calc(var(--cw) * .1) calc(var(--cw) * .14) #000d; }
.tu-pc img { width: 100%; height: 100%; display: block; object-fit: cover; }
.tu-pcap { position: absolute; left: 0; right: 0; bottom: 0; display: flex; align-items: center; justify-content: center; gap: .15em; height: 1.35em; font-weight: 800; background: var(--tc); color: var(--ti); }
.tu-pcap svg { width: 1em; height: 1em; flex: none; }
.tu-link { position: relative; flex: none; align-self: flex-start; margin-left: calc(var(--cw) * .02); width: calc(var(--span, var(--n)) * var(--cw) - var(--cw) * .04); height: calc(var(--cw) * .2); }
.tu-link::before { content: ""; position: absolute; left: 0; right: 0; top: 46%; bottom: 0; border: max(2px, calc(var(--cw) * .045)) solid var(--tc); border-bottom: 0; border-radius: 6px 6px 0 0; }
.tu-link::after { content: ""; position: absolute; left: calc(var(--n) * var(--cw) / 2 - var(--cw) * .02); top: 0; height: 46%; width: max(2px, calc(var(--cw) * .045)); transform: translateX(-50%); background: var(--tc); }
.tu-rail { position: absolute; left: 0; height: var(--rh); background: var(--asset-rail_top, linear-gradient(#7a4a24, #4a2a14)) left / auto 100% repeat-x; }
.tu-rail-top { top: var(--top); }
.tu-rail-bot { top: calc(var(--top) + var(--rh) + var(--th)); background-image: var(--asset-rail_bottom, linear-gradient(#5a3418, #2e1a0a)); box-shadow: inset 0 calc(var(--rh) * .45) calc(var(--rh) * .4) -2px #000a; }
.tu-tile { position: absolute; top: calc(var(--top) + var(--rh)); width: var(--cw); height: var(--th); display: block; background: var(--face, #2a3f39) center / 100% 100% no-repeat; }
.tu-tile.theme-E { --face: var(--asset-tile_cui, linear-gradient(#3fb07e, #1f7a52)); } .tu-tile.theme-G { --face: var(--asset-tile_shuang, linear-gradient(#7cc4f0, #3b8cc4)); }
.tu-tile.theme-R { --face: var(--asset-tile_fu, linear-gradient(#cbd2d6, #7d8b94)); } .tu-tile.theme-T { --face: var(--asset-tile_sha, linear-gradient(#e6c06a, #b88a2c)); }
.tu-tile.tu-start { --face: var(--asset-track_start, repeating-linear-gradient(45deg, #2a3f39 0 5px, #22352f 5px 10px)); }
.tu-num { position: absolute; left: 0; right: 0; bottom: 6%; text-align: center; font-weight: 700; color: #ffe9b0; text-shadow: 0 0 2px #000, 0 0 3px #000; }
.tu-glow.tu-tile { box-shadow: inset 0 0 0 max(2px, calc(var(--cw) * .05)) #ffd35c; animation: tuPulse 1s ease-in-out infinite alternate; }
.tu-hang.tu-glow .tu-pc { outline: max(2px, calc(var(--cw) * .05)) solid #ffd35c; outline-offset: 1px; animation: tuPulse 1s ease-in-out infinite alternate; }
@keyframes tuPulse { from { filter: brightness(1); } to { filter: brightness(1.25); } }
.tu-flag { position: absolute; top: 0; left: 50%; transform: translate(-50%, 0); padding: .05em .5em; border-radius: 1em; background: #ffd35c; color: #2a1c10; font-size: 1.05em; white-space: nowrap; box-shadow: 0 1px 3px #000; z-index: 2; }
.tu-pawn { --pb: calc(var(--th) * .957); position: absolute; top: calc(var(--top) + var(--rh) + var(--th) * (.69 + var(--py))); width: calc(var(--pb) * var(--ps)); height: calc(var(--pb) * var(--ps)); transform: translate(-50%, -100%); background: center bottom / contain no-repeat; filter: drop-shadow(1px 3px 2px #0008); pointer-events: none; }
.tu-pawn.pawn-red { background-image: var(--asset-pawn_red, radial-gradient(circle at 50% 70%, #e0453a 40%, transparent 42%)); }
.tu-pawn.pawn-blue { background-image: var(--asset-pawn_blue, radial-gradient(circle at 50% 70%, #3b7de0 40%, transparent 42%)); }
.tu-pawn.pawn-green { background-image: var(--asset-pawn_green, radial-gradient(circle at 50% 70%, #3fae4a 40%, transparent 42%)); }
.tu-pawn.tu-ghost { opacity: .38; filter: grayscale(.3); }
.tu-place { position: absolute; top: calc(var(--top) + var(--rh)); width: var(--cw); height: var(--th); display: flex; align-items: flex-start; justify-content: center; font-style: normal; z-index: 40; }
.tu-arrow { color: #fff; font: 900 max(10px, calc(var(--cw) * .5))/1 system-ui, sans-serif; -webkit-text-stroke: calc(var(--cw) * .02) #7fd4ff; text-shadow: 0 0 3px #1a0c06, 0 2px 4px #000, 0 0 8px #000;  padding-top: 4%; }
/* 只让箭头字形上下跳，格子位置（标签的目标）不动 */
.tu-arrow > span { display: inline-block; animation: tuArw 1s ease-in-out infinite; }
@keyframes tuArw { 0%, 100% { opacity: .45; transform: translateY(-8%); } 50% { opacity: 1; transform: translateY(6%); } }
.tu-lockbox { align-items: center; border: 2px solid rgba(255, 107, 94, .85); border-radius: 6px; background: rgba(40, 8, 4, .45); box-sizing: border-box; }
.tu-lockbox .tu-lock { width: 46%; height: 46%; }
.tu-mark { position: absolute; top: calc(var(--top) + 2 * var(--rh) + var(--th) + var(--cw) * .04); transform: translateX(-50%); padding: 0 .4em; line-height: 1.4; border-radius: 1em; background: #2a1c10; color: #f0dfb4; font-size: 1.05em; white-space: nowrap; box-shadow: inset 0 0 0 1px #b8913f; }
.tu-mark.good { background: #ffd35c; color: #2a1c10; box-shadow: 0 0 calc(var(--cw) * .15) #ffd35c99; }
@media (prefers-reduced-motion: reduce) { .tu-arrow, .tu-arrow > span, .tu-glow, .tu-hang.tu-glow .tu-pc { animation: none !important; } }

/* ---- 卡牌（手牌 / 公共市场 / 牌库的小号版本） ---- */
.tu-cards { display: flex; gap: calc(10 * var(--s)); align-items: flex-end; }
.tu-card { --cwid: calc(96 * var(--s)); position: relative; flex: none; width: var(--cwid); aspect-ratio: 636 / 890; border: max(2px, calc(var(--cwid) * .03)) solid var(--tc, #6b4a1f); border-radius: calc(var(--cwid) * .08); overflow: hidden; background: #111; box-shadow: 0 2px 3px #0008, 0 calc(6 * var(--s)) calc(10 * var(--s)) #0007; }
.tu-card img { width: 100%; height: 100%; display: block; object-fit: cover; }
.tu-cap { position: absolute; left: 0; right: 0; bottom: 0; height: 18%; display: flex; align-items: center; justify-content: center; gap: .15em; background: var(--tc); color: var(--ti); font-weight: 800; font-size: max(9px, calc(var(--cwid) * .15)); }
.tu-cap svg { width: 1em; height: 1em; flex: none; }
.tu-back { --tc: #6b4a1f; background: var(--asset-card_back, linear-gradient(#3a2a18, #1a120a)) center / cover no-repeat; }
.tu-back .tu-badge { position: absolute; right: 6%; top: 4%; min-width: 1.6em; padding: 0 .3em; border-radius: 1em; background: #1a0c06e0; color: #ffe9b0; font-size: max(9px, calc(var(--cwid) * .15)); text-align: center; box-shadow: inset 0 0 0 1px #b8913f; }
.tu-back.tu-flip { outline: 3px solid #ffd35c; outline-offset: 2px; }
.tu-slot { --tc: #8a6a2f; background: repeating-linear-gradient(45deg, #2a1c10 0 6px, #22170c 6px 12px); border-style: dashed; display: grid; place-items: center; color: #c9a86a; font-size: max(9px, calc(var(--cwid) * .18)); overflow: hidden; box-shadow: none; }
.tu-new { outline: 3px solid #ffd35c; outline-offset: 2px; }

/* 第 1 页：计分构成 */
.tu-score { display: flex; align-items: stretch; justify-content: center; gap: calc(12 * var(--s)); width: 100%; }
.tu-sc { flex: 0 1 calc(210 * var(--s)); display: flex; flex-direction: column; align-items: center; gap: calc(8 * var(--s)); padding: calc(16 * var(--s)) calc(12 * var(--s)); border-radius: calc(14 * var(--s)); background: linear-gradient(#1f4a3c, #0d2b21); box-shadow: inset 0 0 0 2px #b8913f, 0 calc(6 * var(--s)) calc(12 * var(--s)) #0009; text-align: center; }
.tu-sc b { color: #ffd77a; font-size: 1.15em; white-space: nowrap; }
.tu-sc span { font-size: .82em; line-height: 1.35; color: #f0dfb4; }
.tu-sc-ic { width: calc(74 * var(--s)); height: calc(74 * var(--s)); background: center / contain no-repeat; }
.tu-sc-match .tu-sc-ic { background-image: var(--asset-tile_cui, none); border-radius: 8px; }
.tu-sc-pos .tu-sc-ic { background-image: var(--asset-pawn_red, none); }
.tu-sc-coll .tu-sc-ic { background-image: var(--asset-marker_collect, none); }
.tu-sc-aw .tu-sc-ic { background-image: var(--asset-icon_hand, none); }
.tu-plus { align-self: center; color: #ffd35c; font-size: 1.3em; }
/* 欢迎页另一种排法：计分框竖排在路的右边（矮屏 / 经典规则四个框时更省高度） */
.tu-wrow { display: flex; align-items: center; justify-content: center; gap: calc(24 * var(--s)); max-width: 100%; }
.tu-score.tu-scol { flex-direction: column; align-items: stretch; gap: calc(4 * var(--s)); }
.tu-scol .tu-plus { line-height: .8; font-size: 1.3em; }

/* 第 2 页：三选一 */
.tu-actbtn { --aw: calc(225 * var(--s)); flex: none; display: flex; align-items: center; justify-content: center; width: var(--aw); height: calc(var(--aw) / 3); padding: 0 calc(var(--aw) * .04) 0 calc(var(--aw) * .3); box-sizing: border-box; border-radius: 10px; background: #2f5b4e center / 100% 100% no-repeat; color: #fff; font-weight: 800; text-shadow: 0 1px 2px #000c; white-space: nowrap; font-size: 1.05em; }
.tu-actbtn.btn-promotion { background-image: var(--asset-btn_promotion_default, none); }
.tu-actbtn.btn-development { background-image: var(--asset-btn_development_default, none); }
.tu-actbtn.btn-draw { background-image: var(--asset-btn_draw_default, none); }
.tu-actbtn.btn-collection { background-image: var(--asset-btn_collection_default, none); --aw: calc(250 * var(--s)); }
.tu-actbtn span { overflow: hidden; text-overflow: clip; }

.tu-slot-s { display: none; }
}
@container (max-width: 380px) { .tu-slot-l { display: none; } .tu-slot-s { display: inline; } }

/* 第 7 页：人气表 + 终局条件 */
.tu-poprow { display: flex; align-items: center; gap: calc(30 * var(--s)); }
.tu-pop { border-collapse: collapse; font-size: .92em; }
.tu-pop th, .tu-pop td { padding: calc(5 * var(--s)) calc(16 * var(--s)); border-bottom: 1px solid #b8913f44; text-align: center; white-space: nowrap; }
.tu-pop th { color: #c9a86a; font-weight: 400; font-size: .85em; }
.tu-pop td b { color: #ffd77a; font-size: 1.15em; }
.tu-end { display: flex; flex-direction: column; gap: calc(10 * var(--s)); padding: calc(14 * var(--s)) calc(18 * var(--s)); border-radius: calc(12 * var(--s)); background: #0d2b21; box-shadow: inset 0 0 0 1px #b8913f; }
.tu-end > b { color: #ffd77a; }
.tu-end > div { display: flex; align-items: center; gap: calc(8 * var(--s)); }
.tu-endc { display: flex; flex-direction: column; align-items: center; gap: calc(6 * var(--s)); width: calc(118 * var(--s)); font-size: .78em; text-align: center; line-height: 1.25; color: #f0dfb4; }
.tu-endc i { width: calc(54 * var(--s)); height: calc(54 * var(--s)); background: center / contain no-repeat; opacity: .9; }
.tu-end-hand i { background-image: var(--asset-icon_hand, none); }
.tu-end-pm i { background-image: var(--asset-card_back, none); filter: grayscale(1) brightness(.6); border-radius: 4px; }
.tu-end-deck i { background-image: var(--asset-icon_deck, none); }
.tu-end-round i { background-image: var(--asset-pawn_red, none); }
.tu-endop { color: #ffd35c; font-style: normal; font-size: 1.3em; }

/* 按钮：高度至少 40px（触屏点击区），三段式端帽宽 = 高 × 源图比例（主 100/95 : 224，次 83 : 180），任何高度都不变形 */
#tutorial .lb-secondary { --bh: max(40px, calc(64 * var(--s))); height: var(--bh); }
#tutorial .lb-primary { --bh: max(42px, calc(84 * var(--s))); height: var(--bh); }
html.lb-has-btn_secondary #tutorial .lb-secondary { border-image-width: 0 calc(var(--bh) * .4611); padding: 0 calc(var(--bh) * .4611 + 8px); }
html.lb-has-btn_primary #tutorial .lb-primary { border-image-width: 0 calc(var(--bh) * .4241) 0 calc(var(--bh) * .4464); padding: 0 calc(var(--bh) * .4241 + 8px) 0 calc(var(--bh) * .4464 + 8px); }

/* 底栏 */
.tu-foot { display: flex; align-items: center; justify-content: space-between; gap: calc(20 * var(--s)); margin-top: calc(26 * var(--s)); flex: none; height: calc(84 * var(--s)); }
.tu-dots { display: flex; align-items: center; gap: calc(12 * var(--s)); }
.tu-dot { width: calc(16 * var(--s)); height: calc(16 * var(--s)); min-width: 8px; min-height: 8px; padding: 0; border-radius: 50%; border: max(1.5px, calc(2 * var(--s))) solid var(--gold-d); background: #0a1a1466; cursor: pointer; }
.tu-dot.on { background: radial-gradient(circle at 35% 35%, #ffe9a8, #c9962e); border-color: var(--gold); }
.tu-dot:focus-visible { outline: 2px solid #ffe9a8; outline-offset: 3px; }
.tu-count { margin-left: calc(8 * var(--s)); color: #f0dfb4; font-size: max(12px, .9em); white-space: nowrap; }
.tu-nav { display: flex; gap: calc(22 * var(--s)); align-items: center; }
#tutorial .tu-nav .lb-primary { min-width: calc(280 * var(--s)); }
#tutorial .tu-nav .lb-secondary, #tutorial .tu-skip { min-width: calc(190 * var(--s)); }

/* 首次开局询问 */
#tutorial .tu-ask { width: calc(900 * var(--s)); padding: calc(100 * var(--s)) calc(90 * var(--s)) calc(64 * var(--s)); }
.tu-askrow { --gh: max(72px, calc(190 * var(--s))); display: flex; align-items: flex-end; }
.tu-askrow .tu-guide-art { flex: none; width: var(--gh); height: var(--gh); margin: 0 calc(var(--gh) * -.12) calc(-20 * var(--s)) calc(var(--gh) * -.15); background: var(--asset-pawn_red, var(--asset-avatar_red, none)) center bottom / contain no-repeat; filter: drop-shadow(2px 6px 6px #000c); position: relative; z-index: 2; }
.tu-askrow .tu-bubble::before { content: ""; position: absolute; left: -.6em; bottom: 1.2em; border: .6em solid transparent; border-left: 0; border-right-color: #b8913f; }
.tu-askrow .tu-bubble { flex: 1; }

.tu-asktips { display: flex; align-items: center; justify-content: center; gap: .55em; width: max-content; min-height: 44px; margin: calc(26 * var(--s)) auto 0; padding: 0 .8em; color: #f0dfb4; font-size: max(14px, calc(24 * var(--s))); cursor: pointer; user-select: none; }
.tu-asktips .lb-chk { font-size: 1.15em; }
.tu-askbtns { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: calc(18 * var(--s)); margin-top: calc(14 * var(--s)); }
#tutorial .tu-askbtns .lb-primary { width: 100%; min-width: 0; min-height: 44px; height: auto; padding: 14px 12px; font-size: max(14px, calc(26 * var(--s))); letter-spacing: 0; }
#tutorial .tu-askbtns #tuAskNo { grid-column: 1 / -1; justify-self: center; }

/* ---- 游戏内提示气泡 ---- */
.tu-tip { position: fixed; z-index: 70; max-width: min(360px, 34vw); min-width: 220px; padding: 10px 12px 10px 14px; border-radius: 12px; background: linear-gradient(#f6ead0, #ead7ad); color: #2a1c10; box-shadow: 0 6px 18px #000b, inset 0 0 0 2px #b8913f; font: 14px/1.45 "PingFang SC", "Microsoft YaHei", system-ui, sans-serif; display: flex; flex-direction: column; gap: 6px; animation: tuTipIn .25s ease-out; pointer-events: none; }
.tu-tip-ok { pointer-events: auto; }
.tu-tip[hidden] { display: none; }
.tu-tip p { margin: 0; }
.tu-tip-ok { align-self: flex-end; padding: 3px 14px; border: 0; border-radius: 999px; background: linear-gradient(#2f6b55, #174535); color: #ffe9b0; font-weight: 700; cursor: pointer; box-shadow: inset 0 0 0 1px #d9b45c; }
.tu-tip-ok:hover { filter: brightness(1.15); }
.tu-tip-ok:focus-visible { outline: 2px solid #2a1c10; outline-offset: 2px; }
.tu-tip-arrow[hidden] { display: none; }
.tu-tip-arrow { position: absolute; width: 14px; height: 14px; background: #f3e4c3; box-shadow: 2px 2px 0 #b8913f; transform: translate(-50%, 0) rotate(45deg); pointer-events: none; }
.tu-tip[data-side="below"] .tu-tip-arrow { top: -7px !important; box-shadow: -2px -2px 0 #b8913f; }
.tu-tip[data-side="above"] .tu-tip-arrow { top: auto !important; bottom: -7px; }
.tu-tip[data-side="right"] .tu-tip-arrow { left: -7px !important; transform: translate(0, -50%) rotate(45deg); box-shadow: -2px 2px 0 #b8913f; }
.tu-tip[data-side="left"] .tu-tip-arrow { left: auto !important; right: -7px; transform: translate(0, -50%) rotate(45deg); box-shadow: 2px -2px 0 #b8913f; }
@keyframes tuTipIn { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
@media (max-width: 1100px) { .tu-tip { font-size: 13px; max-width: 320px; } }
@media (prefers-reduced-motion: reduce) { .tu-tip { animation: none; } }

/* 大厅的「游戏内提示」行 */
.lb-hint { color: #c9b07a; font-size: .82em; white-space: nowrap; }

/* ===== 主体：图示区占满面板内容宽度。图示区 = 示例场景（.tu-art，容器单位）+ 左下角向导与一句话（.tu-narr）
   + 标注标签（.tu-tag，JS 按目标坐标排布）+ 虚线引线（.tu-leads）。--ss = 面板缩放；--s = 场景内容缩放（×--sk） ===== */
.tu-body { display: flex; height: calc(640 * var(--s)); flex: none; min-height: 0; }
.tu-pan { display: none; }
.tu-scene { --s: calc(var(--ss) * var(--sk, 1.25)); --av: max(56px, calc(110 * var(--ss))); --px: max(10px, calc(32 * var(--ss))); --py: var(--px); position: relative; flex: 1 1 0; min-width: 0; display: flex; flex-direction: column; padding: var(--py) var(--px); border-radius: calc(16 * var(--ss)); background: radial-gradient(ellipse at 50% 42%, #3a2414cc, #150c06ee 80%); box-shadow: inset 0 0 0 1px #b8913f55, inset 0 calc(4 * var(--ss)) calc(18 * var(--ss)) #000c; overflow: hidden; }
/* 示例场景铺满图示区；--s（px）由 tutorial.js fitArt 设定：在不压人物台词、标签排得下的前提下取最大 */
.tu-art { position: absolute; inset: var(--py) var(--px); display: flex; flex-direction: column; align-items: center; justify-content: center; gap: calc(26 * var(--s)); }
.tu-art[data-al="tc"] { justify-content: flex-start; } .tu-art[data-al="ce"] { align-items: flex-end; } .tu-art[data-al="te"] { justify-content: flex-start; align-items: flex-end; }
.tu-art[data-al="cs"] { align-items: flex-start; } .tu-art[data-al="ts"] { justify-content: flex-start; align-items: flex-start; }
/* 人物 + 一句话：压在图示区左下角（不再单独占一行），示例场景让开它 */
.tu-narr { position: absolute; left: var(--px); bottom: var(--py); z-index: 4; display: flex; align-items: flex-end; gap: calc(10 * var(--ss)); pointer-events: none; }
.tu-narr .tu-guide-art { flex: none; width: var(--av); height: var(--av); background: var(--asset-pawn_red, var(--asset-avatar_red, none)) center bottom / contain no-repeat; filter: drop-shadow(2px 6px 6px #000c); }
.tu-say { position: relative; margin: 0 0 calc(var(--av) * .2) calc(var(--av) * .02); max-width: min(calc(500 * var(--ss)), calc(var(--iw, 100vw) - var(--av) - 24px)); padding: .45em .85em; border-radius: .6em; background: linear-gradient(#f6ead0, #ead7ad); color: #2a1c10; box-shadow: inset 0 0 0 2px #b8913f, 0 4px 12px #000a; font-size: calc(10px + 11 * var(--ss)); line-height: 1.4; }
.tu-scene[data-nw="m"] .tu-say { max-width: min(calc(700 * var(--ss)), calc(var(--iw, 100vw) - var(--av) - 24px)); }
.tu-scene[data-nw="w"] .tu-say { max-width: min(calc(1040 * var(--ss)), calc(var(--iw, 100vw) - var(--av) - 24px)); }
.tu-say::before { content: ""; position: absolute; left: -.6em; bottom: .7em; border: .6em solid transparent; border-left: 0; border-right-color: #b8913f; }
.tu-say::after { content: ""; position: absolute; left: -.45em; bottom: calc(.7em + 2px); border: calc(.6em - 2px) solid transparent; border-left: 0; border-right-color: #f6ead0; }
.tu-say b { color: #6b3a07; }
.tu-cls { display: block; margin-top: .35em; padding: .3em .6em; border-radius: .45em; background: #234a3c; color: #f4e6c4; font-size: .9em; }
.tu-cls b { color: #ffe9b0; }
.tu-leads { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; overflow: visible; z-index: 5; }
.tu-leads line { stroke: #f2d27a; stroke-width: 2px; stroke-dasharray: 5 4; filter: drop-shadow(0 0 1px #000); }
.tu-leads circle { fill: #f2d27a; stroke: #2a1c10; stroke-width: 1.5px; }
.tu-tag { position: absolute; z-index: 6; width: max-content; max-width: 34%; padding: .4em .7em; line-height: 1.35; background: #fff6dd; color: #2a1c10; border-radius: .45em; box-shadow: inset 0 0 0 1.5px #d9ad4f, 0 3px 8px #000b; font-size: calc(10px + 9 * var(--ss)); pointer-events: none; }
.tu-tag b { color: #8a4b08; }
/* 折行时各行等长，不留单字 / 单词的尾行 */
.tu-tag { text-wrap: balance; }
/* 中文标签只在空格 / 标点 / <wbr> 处折行，不把词拆开 */
html[lang^="zh"] .tu-tag { word-break: keep-all; overflow-wrap: anywhere; }
/* 锁图标浮在左边，和第一行字在一起（不单独占一行） */
.tu-tag .tu-lock { float: left; width: 1.05em; height: 1.05em; margin: .15em .35em 0 0; }
/* 牌面图解的锚点：金色描边框圈出被讲解的部位（不填充，不挡数字 / 图标） */
.tu-an { position: absolute; box-sizing: border-box; border: 2px solid #ffd35c; border-radius: max(3px, calc(5 * var(--s))); box-shadow: 0 0 0 1px #0009, inset 0 0 0 1px #0007; pointer-events: none; }

/* 第 1 页：计分构成（按内容自然宽度） */
.tu-score { display: flex; align-items: center; justify-content: center; gap: calc(6 * var(--s)); width: auto; }
.tu-sc { flex: none; display: flex; flex-direction: row; align-items: center; gap: .4em; padding: .3em .75em .3em .4em; border-radius: calc(12 * var(--s)); background: linear-gradient(#1f4a3c, #0d2b21); box-shadow: inset 0 0 0 2px #b8913f, 0 calc(4 * var(--s)) calc(10 * var(--s)) #0009; font-size: max(12px, calc(13 * var(--s))); }
.tu-sc > span { display: flex; flex-direction: column; line-height: 1.2; font-size: 1em; }
.tu-sc b { color: #ffd77a; white-space: nowrap; }
.tu-sc-ic { flex: none; width: 1.8em; height: 1.8em; background: center / contain no-repeat; }
/* 第 2 页：牌面（放大的一张真牌 + 底部跑步小人条） */
.tu-anat { position: relative; flex: none; height: calc(500 * var(--s)); aspect-ratio: 636 / 1010; }
.tu-anat-card { position: absolute; left: 0; top: 0; width: 100%; height: 88.1%; border: max(2px, calc(4 * var(--s))) solid var(--tc); border-radius: calc(16 * var(--s)); overflow: hidden; background: #111; box-shadow: 0 calc(6 * var(--s)) calc(16 * var(--s)) #000c; }
.tu-anat-card img { width: 100%; height: 100%; display: block; object-fit: cover; }
.tu-anat-cap { position: absolute; left: 0; bottom: 0; width: 100%; height: 9.5%; display: flex; align-items: center; justify-content: center; gap: .2em; border-radius: calc(8 * var(--s)); background: var(--tc); color: var(--ti); font-weight: 800; font-size: max(11px, calc(30 * var(--s))); }
.tu-anat-cap svg { width: 1em; height: 1em; }

/* ===== 手机横屏（667×375 / 740×360 / 844×390 等）：面板铺满屏、固定像素字号，插图仍按容器缩放 ===== */
@media (orientation: landscape) and (max-height: 540px) {
  #tutorial .tu-stage { align-items: flex-start; }
  #tutorial .tu-panel { width: calc(100vw - 8px); height: calc(100vh - 17px); margin: 14px 0 0; padding: 30px 26px 10px; font-size: 12px; }
  #tutorial .lb-title h2 { font-size: 15px; }
  .tu-head { height: 26px; margin-bottom: 6px; gap: 10px; }
  .tu-ptitle { font-size: 15px; }
  .tu-mode { font-size: 12px; gap: 14px; }
  .tu-body { flex: 1 1 0; height: auto; }
  .tu-scene { --av: 60px; --px: 12px; --py: 10px; border-radius: 10px; }
  .tu-narr { gap: 6px; }
  .tu-say { font-size: 13px; padding: 4px 9px; line-height: 1.35; max-width: min(250px, calc(var(--iw, 100vw) - var(--av) - 20px)); }
  .tu-scene[data-nw="m"] .tu-say { max-width: min(380px, calc(var(--iw, 100vw) - var(--av) - 20px)); }
  .tu-scene[data-nw="w"] .tu-say { max-width: calc(var(--iw, 100vw) - var(--av) - 20px); }
  .tu-tag, .tu-side { font-size: 12px; }
  .tu-tag { max-width: 40%; }
  /* 铺路页两条规则说明较长：放宽，少折几行 */
  #tutorial .lb-btn { font-size: 13px; letter-spacing: .04em; min-width: 0; }
  #tutorial .tu-nav .lb-primary { font-size: 15px; min-width: 110px; }
  .tu-foot { height: 44px; margin-top: 6px; gap: 8px; }
  .tu-dots .tu-dot { display: none; }
  .tu-count { margin: 0; font-size: 12px; }
  .tu-nav { gap: 8px; }
  #tutorial .tu-ask { width: min(560px, calc(100vw - 20px)); height: auto; margin: auto 0; padding: 40px 30px 16px; }
  #tutorial.tu-asking .tu-stage { align-items: center; }
  .tu-askbtns { margin-top: 6px; gap: 16px; }
  .tu-asktips { margin-top: 8px; font-size: 14px; }
  .tu-askrow .tu-bubble { font-size: 13px; }
  .tu-tip { flex-direction: row; align-items: flex-end; font-size: 11.5px; line-height: 1.35; max-width: min(380px, 52vw); min-width: 0; padding: 6px 8px 6px 10px; gap: 8px; }
  .tu-tip p { flex: 1; }
  .tu-tip-ok { flex: none; min-height: 30px; padding: 2px 12px; }
}
/* ===== 竖屏（iPad 820×1180 等）：按宽度缩放，图示区占满 ===== */
@media (orientation: portrait) {
  #tutorial { --s: min(calc(100vw / 1180), calc(100vh / 1800)); }
  #tutorial .tu-panel { width: calc(1160 * var(--s)); }
  .tu-body { height: calc(830 * var(--s)); }
  .tu-tag { max-width: 44%; }
}
@media (pointer: coarse) { .tu-dots .tu-dot { display: none; } }
@media (max-width: 900px) { .tu-dots .tu-dot { display: none; } #tutorial .tu-skip, #tutorial .tu-nav .lb-secondary { min-width: 0; } }



/* ---- 第 10 页：收藏分算式 / 第 11 页：计分总表 ---- */
.tu-formula { display: flex; align-items: center; gap: calc(14 * var(--s)); color: #ffe9b0; font-size: max(11px, calc(22 * var(--s))); }
.tu-formula .tu-card { --cwid: max(22px, calc(52 * var(--s))); }
.tu-formula .tu-cap { display: none; }
.tu-formula .tu-cards { gap: calc(6 * var(--s)); }
.tu-sum { max-width: 100%; }
.tu-sum { font-size: max(12px, calc(20 * var(--s))); }
.tu-sum td { white-space: normal; text-align: left; line-height: 1.3; }
.tu-sum th, .tu-sum td { padding: .55em 1em; }
.tu-sum td b { font-size: 1em; }
.tu-sum td:first-child { white-space: nowrap; color: #ffd77a; }
.tu-sum th { text-align: left; }

/* ---- 前进 / 匹配示例：左侧「你打出的手牌」 ---- */
.tu-figrow { display: flex; align-items: center; justify-content: center; gap: calc(10 * var(--s)); max-width: 100%; }
.tu-played { flex: none; display: flex; flex-direction: column; align-items: center; gap: calc(4 * var(--s)); padding: calc(6 * var(--s)); border-radius: calc(10 * var(--s)); border: 1px dashed #ffd35c99; background: #ffd35c14; }
.tu-played small { color: #ffe9b0; font-size: max(9px, calc(15 * var(--s))); line-height: 1.15; text-align: center; text-wrap: balance; max-width: max(4.6em, calc(80 * var(--s))); }
.tu-played .tu-cards { gap: calc(6 * var(--s)); padding-top: max(6px, calc(10 * var(--s))); }
.tu-played .tu-card { --cwid: calc(58 * var(--s)); }
.tu-played .tu-cap { font-size: max(9px, calc(var(--cwid) * .2)); height: auto; min-height: 18%; line-height: 1.2; }
.tu-pl { position: relative; display: block; flex: none; }
.tu-pl > .tu-card { display: block; }
.tu-ord { position: absolute; z-index: 2; left: 50%; top: 0; transform: translate(-50%, -55%); color: #ffe9b0; font-size: max(10px, calc(20 * var(--s))); text-shadow: 0 0 3px #000, 0 0 3px #000; line-height: 1; }
.tu-figrow > .tu-arrowr { flex: none; color: #ffd35c; font-size: max(12px, calc(26 * var(--s))); }
.tu-pl-s { display: none; }
@media (orientation: landscape) and (max-height: 540px) {
  .tu-played .tu-cap svg { display: none; } .tu-pl-l { display: none; } .tu-pl-s { display: inline; }
  /* 手机横屏高度最紧：「打出的牌」写在牌的左边（竖排两字一行），不占高度 */
  .tu-played { flex-direction: row; align-items: center; }
  .tu-played small { width: 2.3em; }
  html[lang="en"] .tu-played small { width: auto; }
  .tu-p-move .tu-art { gap: calc(10 * var(--s)); }
}

.tu-tag .tu-run svg { width: 1em; height: 1em; vertical-align: -.12em; fill: currentColor; }

/* ===== 示例场景（--s 由 fitArt 设定，全部按 --s 缩放）===== */
/* 人气页 / 计分总结：表格字号与宽度的下限（1920 下 ≥ 22px、宽 ≥ 图示区 50%；手机 ≥ 13px） */
.tu-sum { font-size: max(calc(13px + 9 * var(--ss)), calc(24 * var(--s))); }
/* 人气表 / 收藏页人气表：字号跟面板走（1920 ≈ 23px），不跟示例一起放大，让路和牌拿到更多空间 */
.tu-ptab { font-size: calc(13px + 10 * var(--ss)); }
/* 收藏页人气表是这一页的重点：1920 下 ≥ 24px，宽 ≥ 图示区 25% */
.tu-cpop { font-size: max(12px, calc(12px + 13 * var(--ss))); min-width: calc(var(--iw, 0px) * .28); }
.tu-ptab, .tu-sum { min-width: 50%; }
.tu-ptab th, .tu-ptab td { padding: 0 .9em; line-height: 1.2; }
.tu-ptab .tu-chip { padding-top: 0; padding-bottom: 0; }
.tu-pbox { width: 100%; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: calc(12 * var(--s)); }
.tu-p-pop .tu-ptab { align-self: flex-end; }
.tu-art[data-al="ts"] .tu-pbox, .tu-art[data-al="cs"] .tu-pbox { align-items: flex-start; }
.tu-pbox.tu-prow { flex-direction: row; gap: calc(20 * var(--s)); }
/* 人气页：悬挂的牌只用来数张数，画小一点，把高度让给格子 */
.tu-p-pop .tu-track { --top: calc(var(--cw) * 1.2); }
.tu-p-pop .tu-pc { width: calc(var(--cw) * .7); }
.tu-p-pop .tu-pbox { gap: calc(6 * var(--s)); }
.tu-p-pop .tu-ptab th, .tu-p-pop .tu-ptab td { padding: 0 .6em; line-height: 1.15; }
/* 收藏页：悬挂牌略小，格子更大；人气表行距收紧 */
.tu-p-collect .tu-track { --top: calc(var(--cw) * 1.42); }
.tu-p-collect .tu-pc { width: calc(var(--cw) * .86); }
/* 计分总结：表格字号封顶，免得在大屏上撑得过大 */
.tu-sum { font-size: max(calc(13px + 9 * var(--ss)), min(calc(24 * var(--s)), calc(12px + 27 * var(--ss)))); }
.tu-sum td:first-child { display: flex; align-items: center; gap: .45em; }
.tu-sum .tu-sc-ic { width: 1.7em; height: 1.7em; }
.tu-sc-match.tu-sc-ic, .tu-sc-match .tu-sc-ic { background-image: var(--asset-tile_cui, none); border-radius: 6px; }
.tu-sc-pos.tu-sc-ic, .tu-sc-pos .tu-sc-ic { background-image: var(--asset-pawn_red, none); }
.tu-sc-coll.tu-sc-ic, .tu-sc-coll .tu-sc-ic { background-image: var(--asset-marker_collect, none); }
.tu-sc-aw.tu-sc-ic, .tu-sc-aw .tu-sc-ic { background-image: var(--asset-icon_hand, none); }
@media (orientation: landscape) and (max-height: 540px) {
  .tu-ptab { font-size: 13px; }
  .tu-ptab th, .tu-ptab td { padding: 0 .5em; line-height: 1.2; }
  .tu-ptab .tu-chip { padding-top: 0; padding-bottom: 0; }
  .tu-p-pop .tu-track { --top: calc(var(--cw) * 1.35); }
  .tu-p-pop .tu-pc { width: calc(var(--cw) * .82); }
  .tu-cpop { font-size: 14px; }
  .tu-p-collect .tu-track { --top: calc(var(--cw) * 1.28); }
  .tu-p-collect .tu-pc { width: calc(var(--cw) * .78); }
  .tu-cpop th, .tu-cpop td { padding: 0 .6em; line-height: 1.3; }
  .tu-crow { gap: calc(24 * var(--s)); }
  .tu-sum { font-size: max(13px, min(calc(24 * var(--s)), 20px)); }
  .tu-sum th, .tu-sum td { padding: .2em .9em; line-height: 1.25; }
}

.tu-move-examples { display: flex; flex-direction: column; align-items: flex-end; gap: calc(12 * var(--s)); }
.tu-move-example { display: flex; align-items: center; gap: calc(20 * var(--s)); }
.tu-move-example .tu-played small { display: none; }
.tu-move-example .tu-step { max-width: 15em; }
.tu-overflow-examples { display: flex; flex-direction: column; align-items: center; gap: calc(16 * var(--s)); }
.tu-overflow-panels { display: flex; flex-direction: column; gap: calc(16 * var(--s)); align-items: center; }
.tu-overflow-columns .tu-overflow-panels { flex-direction: row; align-items: flex-start; gap: calc(28 * var(--s)); }
.tu-overflow-columns { width: 100%; }
.tu-overflow-columns .tu-overflow-panels { width: 100%; justify-content: space-between; }
.tu-overflow-columns .tu-overflow-row { flex-direction: column; }
.tu-overflow-row .tu-played .tu-card { --cwid: max(24px, calc(58 * var(--s))); }
.tu-overflow-row .tu-cap { height: auto; min-height: 18%; line-height: 1.2; }
.tu-p-overflow .tu-step { font-size: calc(9px + 7 * var(--ss)); }
.tu-overflow-row { display: flex; align-items: center; gap: calc(14 * var(--s)); }
.tu-overflow-row .tu-played small { display: none; }
.tu-overflow-row .tu-step { max-width: 17em; }
.tu-overflow-choices { align-self: flex-end; padding: .4em .6em; border: 1px solid #ad8b45; border-radius: .6em; background: #193b30; font-size: calc(10px + 8 * var(--ss)); }
.tu-overflow-choices p { margin: 0 0 .4em; text-align: center; color: #f5dda0; }
.tu-overflow-choice { display: flex; align-items: center; gap: .5em; max-width: 15em; }
.tu-move-value { display: grid; place-items: center; min-width: 1.4em; height: 1.7em; border: 1px solid currentColor; border-radius: .2em; font-size: 1.1em; }
.tu-overflow-choice.good { color: #bde8a0; }
.tu-overflow-choice.bad { color: #f3b4a1; }
@media (orientation: landscape) and (max-width: 700px) {
  .tu-p-overflow .tu-ovcard { display: none; }
}
.tu-sub { display: flex; align-items: center; justify-content: center; gap: calc(16 * var(--s)); max-width: 100%; }
/* 字号与标注标签一致 */
.tu-side { flex: none; display: block; margin: 0; width: max-content; max-width: 11em; font-size: calc(10px + 9 * var(--ss)); line-height: 1.35; }
.tu-ovcard { position: relative; flex: none; align-self: center; display: flex; flex-direction: column; align-items: center; gap: .25em; margin-left: calc(12 * var(--s)); font-size: max(10px, calc(15 * var(--s))); }
.tu-ovcard .tu-card { display: block; --cwid: max(30px, calc(64 * var(--s))); }
.tu-ovcard .tu-flag { position: static; transform: none; font-size: 1em; }
.tu-tile.tu-ovt { box-shadow: inset 0 0 0 max(2px, calc(var(--cw) * .06)) #ffd35c; }

/* 摸牌：左 = 牌库 + 公共市场，右 = 手牌；两条弧形箭头 */
.tu-dr { position: relative; display: flex; align-items: center; justify-content: center; gap: calc(100 * var(--s)); padding: calc(66 * var(--s)) calc(6 * var(--s)); }
.tu-dsrc { display: flex; align-items: flex-end; gap: calc(26 * var(--s)); }
.tu-ddeck { display: flex; }
.tu-dr .tu-card { --cwid: calc(100 * var(--s)); }
/* 被摸走的那张：原位只留半透明虚影 */
.tu-dr .tu-card.tu-taken { opacity: .32; filter: grayscale(.6); outline: 2px dashed #ffd35c; outline-offset: 2px; box-shadow: none; }
/* 上下两排：牌库 + 公共市场在上，手牌在下（靠右，左下角留给人物和台词） */
.tu-dr.tu-dstack { width: 100%; box-sizing: border-box; flex-direction: column; align-items: stretch; gap: calc(52 * var(--s)); padding: calc(4 * var(--s)) calc(6 * var(--s)); }
.tu-dstack .tu-dsrc { align-self: flex-start; }
.tu-dstack .tu-dhand { align-self: flex-end; flex-direction: row; align-items: flex-end; }
.tu-dr .tu-cards { gap: calc(10 * var(--s)); }
/* 左右并排时手牌叠放（像拿在手里），省出宽度把牌画大；新摸到的两张在最右、完整可见 */
.tu-dr:not(.tu-dstack) .tu-handrow { gap: 0; }
.tu-dr:not(.tu-dstack) .tu-handrow .tu-card + .tu-card { margin-left: calc(-30 * var(--s)); }
.tu-dr .tu-dhand { display: flex; flex-direction: column; align-items: center; gap: calc(6 * var(--s)); color: #f0dfb4; font-size: max(11px, calc(18 * var(--s))); }
.tu-arcs { position: absolute; left: 0; top: 0; overflow: visible; pointer-events: none; }
.tu-arc { fill: none; stroke: #ffd35c; stroke-width: max(2px, calc(3 * var(--s))); stroke-linecap: round; filter: drop-shadow(0 1px 2px #000c); }

/* 收藏：左 = 路，右 = 收藏后的人气表 + 收藏分算式；算式里的人气与表中同色那一格同样描金 */
.tu-crow { display: flex; align-items: center; justify-content: center; gap: calc(40 * var(--s)); max-width: 100%; }
.tu-ccol { flex: none; display: flex; flex-direction: column; align-items: center; gap: calc(18 * var(--s)); }
.tu-cpop th, .tu-cpop td { padding: 0 .6em; line-height: 1.2; }
.tu-cpop thead th { font-size: .78em; line-height: 1.1; }
.tu-cpop .tu-chip { padding-top: 0; padding-bottom: 0; }
.tu-cpop .val { white-space: nowrap; }
.tu-cpop .val s { color: #c9a86a; text-decoration-thickness: 2px; }
.tu-cpop .val i { font-style: normal; margin: 0 .25em; color: #c9a86a; }
.tu-cpop tr.tu-chg td { background: #a8402a40; }
.tu-cpop tr.tu-up td { background: #2f9e6e33; }
/* 路占满一行、表格和算式在下（靠右，左下角留给人物和台词） */
.tu-cstack { align-items: stretch; }
.tu-cstack > .tu-track { align-self: center; }
.tu-ctrk-r > .tu-track { align-self: flex-end; }
.tu-cbot { align-self: flex-end; align-items: center; }
/* 算式在左上（台词之上）、人气表在右：路可以占满整行、格子更大 */
.tu-cbot.tu-csplit { align-self: stretch; justify-content: space-between; align-items: flex-start; }
/* 算式靠右，左下角留给人物和台词 */
.tu-cform > .tu-formula { align-self: flex-end; }
.tu-p-collect .tu-crow { gap: calc(14 * var(--s)); }
/* 英文表头「Popularity」太宽：收藏页省掉表头（标签和算式里已经写了 Popularity） */
html[lang="en"] .tu-cpop thead { display: none; }
.tu-p-collect .tu-formula { font-size: max(12px, min(calc(24 * var(--s)), calc(13px + 10 * var(--ss)))); gap: .5em; }
.tu-p-collect .tu-formula .tu-card { --cwid: max(22px, calc(34 * var(--s))); }
/* 收藏页：算式压在台词上方，台词放宽到两行，把高度让给路 */
.tu-p-collect .tu-scene[data-nw="n"] .tu-say { max-width: min(calc(580 * var(--ss)), calc(var(--iw, 100vw) - var(--av) - 24px)); }
.tu-p-collect .tu-csplit { gap: calc(10 * var(--s)); }
/* 算式和人气表都靠右：左边（台词上方）留给标签 */
.tu-cbot.tu-csplit.tu-cright { justify-content: flex-end; gap: calc(28 * var(--s)); }
.tu-cpop tr.tu-hl .val b, .tu-fpop { display: inline-block; padding: 0 .25em; border-radius: .25em; box-shadow: 0 0 0 2px #ffd35c; }
.tu-formula { font-size: max(11px, calc(24 * var(--s))); }

/* 竖屏（iPad 820×1180）：图示区窄而高 → 并排的部分改成上下叠，格子 / 牌画大 */
@media (orientation: portrait) {
  .tu-figrow, .tu-crow, .tu-dr { flex-direction: column; }
  .tu-figrow > .tu-arrowr { transform: rotate(90deg); }
  .tu-sub { flex-direction: column; }
  .tu-played { flex-direction: row; align-items: center; }
  .tu-played small { width: 3.2em; }
}

/* 加粗的术语不拆开换行（如「收藏」） */
.tu-tag b, .tu-say b, .tu-cls b { white-space: nowrap; }

/* ===== 贴在图上的说明牌（不用引线）：①②③ 步骤号 + 一到两行字，样式同标注标签 ===== */
.tu-step { display: inline-flex; align-items: flex-start; gap: .4em; width: max-content; max-width: 100%; box-sizing: border-box; padding: .4em .7em; line-height: 1.35; background: #fff6dd; color: #2a1c10; border-radius: .45em; box-shadow: inset 0 0 0 1.5px #d9ad4f, 0 3px 8px #000b; font-size: calc(10px + 9 * var(--ss)); font-weight: 400; text-align: left; white-space: normal; }
.tu-step .tu-sn { flex: none; font-style: normal; font-weight: 800; color: #8a4b08; }
.tu-step .tu-sb { display: flex; flex-direction: column; }
.tu-step .tu-sl { display: block; text-wrap: balance; }
html[lang^="zh"] .tu-step .tu-sl { word-break: keep-all; overflow-wrap: anywhere; }

/* 第 3 页 人气：悬挂牌上的颜色计数徽标（①）；并列的牌与表格行加虚线框（②） */
.tu-hbadge { position: absolute; left: 50%; bottom: 1.5em; transform: translateX(-50%); z-index: 2; padding: 0 .4em; border-radius: 1em; background: var(--tc, #555); color: var(--ti, #fff); font-size: max(10px, calc(var(--cw) * .17)); line-height: 1.35; font-weight: 800; white-space: nowrap; box-shadow: 0 0 0 1.5px #fff8, 0 1px 3px #000c; }
.tu-hbadge .s { display: none; }
.tu-hang.tu-tie .tu-pc { outline: max(2px, calc(var(--cw) * .04)) dashed #fff; outline-offset: max(2px, calc(var(--cw) * .04)); }
.tu-ptab tr.tu-tierow td { background: #ffffff14; box-shadow: inset 0 1px 0 #fff4, inset 0 -1px 0 #fff4; }
.tu-ptab tr.tu-tierow td:first-child { box-shadow: inset 2px 0 0 #fff8, inset 0 1px 0 #fff4, inset 0 -1px 0 #fff4; }
.tu-pbox.tu-pb-c .tu-ptab { align-self: center; }
.tu-pbox.tu-pb-l .tu-ptab { align-self: flex-start; }
/* 手机横屏：②③ 是表格右边一列（绝对定位，不撑高行）：② 居中在并列的两行旁，③ 从表头那一行往下 */
.tu-ptab td.tu-tnote, .tu-ptab th.tu-tnote { position: relative; width: 15em; padding: 0; border: 0; background: none !important; box-shadow: none !important; }
.tu-ptab .tu-tnote .tu-step { position: absolute; font-size: calc(10px + 9 * var(--ss)); left: .4em; top: 50%; transform: translateY(-50%); display: block; width: max-content; white-space: nowrap; font-weight: 400; line-height: 1.12; padding: .1em .5em; }
.tu-ptab th.tu-tn3 .tu-step { top: -3px; transform: none; }
.tu-pcol { flex: none; display: flex; flex-direction: column; align-items: stretch; gap: 4px; width: calc(var(--iw, 600px) * .5); }
.tu-pcol .tu-ptab { width: 100%; min-width: 0; }
.tu-pnotes { display: flex; flex-direction: column; gap: 4px; }
.tu-pnotes .tu-step { font-weight: 400; line-height: 1.15; padding: .15em .5em; }
html[lang="en"] .tu-ptab td.tu-tnote, html[lang="en"] .tu-ptab th.tu-tnote { width: 13.6em; }
@media (orientation: landscape) and (max-height: 540px) { .tu-p-pop .tu-ptab th, .tu-p-pop .tu-ptab td { padding: 0 .4em; } .tu-ptab .tu-tnote .tu-step { font-size: 12px; } }
.tu-pbox.tu-pb-r { flex-direction: row; gap: calc(20 * var(--s)); }
.tu-pbox.tu-pb-r .tu-ptab { align-self: center; }

/* 第 4 页 你的回合：三个按钮一行、说明在正下方；括号从铺路、前进下面汇合，箭头指向第二行的收藏 */
.tu-turn { --aw: calc(225 * var(--s)); --col: calc(300 * var(--s)); --g: calc(28 * var(--s)); display: grid; grid-template-columns: repeat(3, var(--col)); column-gap: var(--g); row-gap: 0; justify-items: center; align-items: start; }
.tu-act { display: flex; flex-direction: column; align-items: center; gap: calc(10 * var(--s)); width: 100%; }
.tu-actcap, .tu-actx { margin: 0; text-align: center; color: #f0dfb4; line-height: 1.3; font-size: max(12px, calc(19 * var(--s))); text-wrap: balance; }
html[lang^="zh"] .tu-actcap, html[lang^="zh"] .tu-actx { word-break: keep-all; overflow-wrap: anywhere; }
.tu-brk { grid-column: 1 / 3; grid-row: 2; position: relative; justify-self: stretch; height: calc(58 * var(--s)); }
.tu-brk-u { position: absolute; left: calc(var(--col) / 2); right: calc(var(--col) / 2); top: calc(10 * var(--s)); height: calc(18 * var(--s)); border: max(2px, calc(3 * var(--s))) solid #d9ad4f; border-top: 0; border-radius: 0 0 10px 10px; }
.tu-brk-stem { position: absolute; left: 50%; top: calc(28 * var(--s)); bottom: calc(10 * var(--s)); width: max(2px, calc(3 * var(--s))); transform: translateX(-50%); background: #d9ad4f; }
.tu-brk-stem::after { content: ""; position: absolute; left: 50%; top: 100%; transform: translateX(-50%); border: solid transparent; border-width: calc(10 * var(--s)) calc(8 * var(--s)) 0; border-top-color: #d9ad4f; }
.tu-actx { grid-column: 3; grid-row: 2; align-self: center; color: #c9a86a; font-style: italic; font-size: max(12px, calc(17 * var(--s))); }
.tu-actcoll { grid-column: 1 / 4; grid-row: 3; justify-self: start; display: flex; align-items: center; gap: calc(16 * var(--s)); margin-left: calc(var(--col) + var(--g) / 2 - 125 * var(--s)); }
.tu-actcoll .tu-actcap { text-align: left; max-width: calc(var(--col) * 1.3); }

/* 第 5 页 铺路：铺之前 → 铺之后的人气表 + 变化的由来 */
.tu-mbox { flex: none; display: flex; flex-direction: column; align-items: center; gap: calc(10 * var(--s)); }
.tu-mbox.tu-mrow { flex-direction: row; align-items: center; }
.tu-mpop { font-size: max(12px, min(calc(20 * var(--s)), calc(12px + 9 * var(--ss)))); }
.tu-mpop th, .tu-mpop td { padding: 0 .6em; line-height: 1.2; text-align: center; }
.tu-mpop thead th { font-size: .8em; line-height: 1.1; }
.tu-mpop .tu-chip { padding-top: 0; padding-bottom: 0; }
.tu-mpop td.pre { color: #c9a86a; }
.tu-mpop tr.tu-up td { background: #2f9e6e33; }
.tu-mpop tr.tu-chg td { background: #a8402a40; }
.tu-mbox .tu-step { max-width: 15.5em; }
@media not ((orientation: landscape) and (max-height: 540px)) { html[lang="en"] .tu-mbox .tu-step, html[lang="en"] .tu-mnote { max-width: 17.5em; } }
.tu-mcol { display: flex; flex-direction: column; align-items: stretch; gap: calc(8 * var(--s)); }
.tu-mnote { margin: 0; max-width: 15.5em; box-sizing: border-box; font-size: calc(10px + 8 * var(--ss)); line-height: 1.35; }
/* 铺路页：悬挂牌只用来看「哪张被覆盖」，画小一点，把高度让给格子 */
.tu-p-promote .tu-track { --top: calc(var(--cw) * 1.45); }
.tu-p-promote .tu-pc { width: calc(var(--cw) * .82); }

@media (orientation: landscape) and (max-height: 540px) {
  .tu-step { font-size: 12px; }
  .tu-hbadge .l { display: none; } .tu-hbadge .s { display: inline; }
  .tu-mbox .tu-step { max-width: 15em; }
}

/* iPad 竖屏：第 4 页 图示区高而窄 → 行距、括号拉高，说明字放大 */
@media (orientation: portrait) {
  /* 第 1 页：路和计分框之间留出放「路」标签的空（竖屏高度富余） */
  .tu-p-welcome .tu-score:not(.tu-scol) { margin-top: max(44px, calc(70 * var(--s))); }
  /* 第 7 页：两排之间留出放两条标签的空 */
  .tu-dr.tu-dstack { gap: max(64px, calc(84 * var(--s))); }
  .tu-turn { row-gap: calc(40 * var(--s)); }
  .tu-act { gap: calc(24 * var(--s)); }
  .tu-brk { height: calc(150 * var(--s)); }
  .tu-brk-u { height: calc(50 * var(--s)); }
  .tu-brk-stem { top: calc(60 * var(--s)); }
  .tu-actcap, .tu-actx { font-size: max(13px, calc(26 * var(--s))); }
  /* 第 3 页：路已占满宽度，表格字放大、行距拉开，把高度用上 */
  .tu-p-pop .tu-ptab { font-size: max(15px, calc(26 * var(--s))); }
  .tu-p-pop .tu-ptab th, .tu-p-pop .tu-ptab td { line-height: 1.6; }
}

/* ---- Engine-backed interactive practice ---- */
body.tutorial-practice #logPanel .panel-title { pointer-events: none; cursor: default; }
body.tutorial-practice #scorePanel .score-row:disabled { cursor: default; }
body.tutorial-practice #modal { z-index: 1200; }
body.practice-modal .tp-panel { visibility: hidden; }
body.practice-modal .tp-target, body.practice-modal .tp-leader { z-index: 1201; }
html:is([data-appearance="expedition"], [data-appearance="frost"]) #actionPanel .over-box .hint { color: #493524; }
.tp-copy > [data-practice="next"] { margin-top: 6px; min-height: 36px; }
.tp-panel {
  position: fixed;
  z-index: 1200;
  top: max(8px, env(safe-area-inset-top));
  right: max(8px, env(safe-area-inset-right));
  box-sizing: border-box;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 12px;
  width: min(520px, 45vw);
  padding: 12px 14px;
  border: 1px solid #c9a24d;
  border-radius: 12px;
  background: linear-gradient(145deg, #18372deF, #0d211cf5);
  color: #f0dfb4;
  box-shadow: 0 6px 20px #000b, inset 0 0 0 1px #e4c87933;
  font: 14px/1.4 "PingFang SC", "Microsoft YaHei", system-ui, sans-serif;
}
.tp-panel[hidden] { display: none; }
.tp-compact-toggle { display: block; grid-column: 1 / -1; min-height: 40px; }
.tp-compact-toggle span { font-size: 10px; }
.tp-panel:not(.tp-expanded) { width: min(110px, calc(100vw - 16px)); padding: 0; }
.tp-panel:not(.tp-expanded) .tp-copy, .tp-panel:not(.tp-expanded) .tp-controls { display: none; }
.tp-panel:not(.tp-expanded) .tp-compact-toggle { width: 100%; padding: 2px; line-height: 1.15; }
.tp-panel:not(.tp-expanded) .tp-compact-toggle span { display: block; }
.tp-score-help { margin-top: 12px; }
.tp-score-help details { margin: 6px 0; border: 1px solid currentColor; border-radius: 6px; }
.tp-score-help summary { padding: 10px; min-height: 40px; box-sizing: border-box; cursor: pointer; font-weight: 700; }
.tp-score-help p { margin: 0; padding: 0 10px 10px; font-size: 14px; line-height: 1.5; }
.tp-copy { min-width: 0; }
.tp-heading { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; color: #f3d48a; }
.tp-heading strong { font-size: 15px; }
.tp-heading span, .tp-copy small { color: #d7c69f; font-size: 12px; white-space: nowrap; }
.tp-copy p { margin: 4px 0 0; }
.tp-copy .tp-goal { margin-top: 7px; padding-top: 6px; border-top: 1px solid #c9a24d55; color: #d7c69f; font-size: 13px; }
.tp-goal b { color: #f3d48a; }
.tp-bubble, .tp-target, .tp-leader, .tp-shade { position: fixed; pointer-events: none; box-sizing: border-box; }
.tp-bubble[hidden], .tp-target[hidden], .tp-leader[hidden], .tp-shade[hidden] { display: none; }
.tp-shade { inset: 0; z-index: 1198; }
.tp-shade svg { display: block; width: 100%; height: 100%; }
.tp-bubble.tp-observation { max-width: min(320px, calc(100vw - 16px)); white-space: pre-line; }
.tp-bubble { z-index: 1203; width: max-content; max-width: min(250px, calc(100vw - 16px)); padding: 10px 14px; border: 2px solid #b8913f; border-radius: 12px; background: linear-gradient(#fff3d4, #ead7ad); color: #302112; box-shadow: 0 4px 14px #0009; font: 600 14px/1.45 "PingFang SC", "Microsoft YaHei", system-ui, sans-serif; }
.tp-bubble > [data-practice="next"] { display: block; margin-top: 6px; min-height: 36px; color: #f0dfb4; pointer-events: auto; }
.tp-target { z-index: 1199; border: 3px solid #ffe08a; border-radius: 8px; box-shadow: 0 0 0 2px #382612, 0 0 16px #ffcf6777; }
.tp-leader { inset: 0; z-index: 1199; }
.tp-leader svg { display: block; width: 100%; height: 100%; overflow: visible; }
.tp-leader path { fill: none; stroke: #ffe08a; stroke-width: 3px; filter: drop-shadow(0 1px 2px #24170c); }
.tp-leader circle { fill: #ffe08a; stroke: #604018; stroke-width: 1px; }
.tp-controls { display: flex; gap: 6px; }
.tp-controls .btn { min-height: 40px; padding: 0 12px; white-space: nowrap; }
html:is([data-appearance="expedition"], [data-appearance="frost"]) .tp-panel {
  border-color: #a88a53;
  background: linear-gradient(125deg, #483226f5, #291e18f7), url("../../assets/ui/expedition-paper.webp?v=cdd3820fb6") center / cover;
  color: #eddfc3;
  box-shadow: inset 0 0 0 1px #c5a26b40, inset 0 0 0 4px #20150f80, 0 4px 14px #38281980;
}
html:is([data-appearance="expedition"], [data-appearance="frost"]) .tp-heading { color: #efd39a; }
html:is([data-appearance="expedition"], [data-appearance="frost"]) .tp-heading span,
html:is([data-appearance="expedition"], [data-appearance="frost"]) .tp-copy small { color: #d8c6a5; }
html:is([data-appearance="expedition"], [data-appearance="frost"]) .tp-controls .btn.secondary {
  background: linear-gradient(115deg, #eee1c8, #cbb591);
  color: #493524;
  border-color: #917048;
}
@media (max-width: 760px) {
  .tp-panel { width: min(520px, calc(100vw - 16px)); right: 8px; }
}
@media (orientation: portrait) {
  .tp-panel.tp-cpu-turn { top: auto; bottom: max(8px, env(safe-area-inset-bottom)); }
}
@media (orientation: landscape) and (max-height: 500px) {
  .tp-panel { top: max(6px, env(safe-area-inset-top)); width: min(520px, 68vw); padding: 8px 10px; gap: 8px; font-size: 12px; }
  .tp-panel:not(.tp-expanded) {
    top: max(4px, env(safe-area-inset-top)) !important;
    left: max(6px, env(safe-area-inset-left));
    right: auto !important;
    bottom: auto;
    width: clamp(70px, 11vw, 110px);
    max-width: none !important;
    padding: 0;
  }
  .tp-heading strong { font-size: 13px; }
  .tp-copy .tp-goal { font-size: 12px; margin-top: 4px; padding-top: 4px; }
  .tp-bubble { max-width: 190px; font-size: 12px; padding: 8px 10px; }
  .tp-bubble.tp-observation { max-width: min(260px, calc(100vw - 16px)); }
  .tp-controls .btn { padding: 0 8px; }
}
@media (max-width: 500px) and (orientation: portrait) {
  #tutorial:not(.tu-asking) .tu-panel { box-sizing: border-box; width: calc(100vw - 16px); height: calc(100dvh - 40px); margin-top: 16px; padding: 28px 14px 14px; }
  #tutorial:not(.tu-asking) .tu-body { display: block; flex: 1 1 0; height: auto; overflow: auto; overscroll-behavior: contain; }
  #tutorial .tu-pan { display: block; flex: none; margin: 0 0 6px; font-size: 12px; }
  #tutorial .tu-body .tu-scene { --ss: .6px; box-sizing: border-box; width: 720px; height: 600px; }
  #tutorial .tu-head { height: auto; min-height: 60px; flex-direction: column; align-items: flex-start; gap: 6px; margin-bottom: 8px; }
  #tutorial .tu-mode { gap: 16px; }
  #tutorial .tu-foot { flex-wrap: wrap; height: auto; gap: 6px; margin-top: 8px; }
  #tutorial .tu-dots { order: -1; flex-basis: 100%; justify-content: center; }
  #tutorial .tu-nav { flex: 1; justify-content: flex-end; gap: 6px; }
  #tutorial .tu-foot .lb-btn { min-width: 0; height: 44px; padding: 0 12px; font-size: 13px; letter-spacing: 0; }
  #tutorial .tu-foot .lb-btn::after { inset: 5px; }
  .tp-panel { grid-template-columns: 1fr; gap: 6px; padding: 8px 10px; font-size: 12px; }
  .tp-heading strong { font-size: 13px; }
  .tp-copy .tp-goal { font-size: 12px; margin-top: 4px; padding-top: 4px; }
  .tp-bubble { font-size: 12px; padding: 8px 10px; }
  .tp-controls { flex-direction: row; }
  .tp-controls .btn { flex: 1; }
}
