/* ===== 第4版: 1画面に収まる盤面・アイコン・案内とごほうび ===== */
.av svg { width: 100%; height: 100%; display: block; }
.av.lg2 { width: 56px; height: 56px; border-radius: 16px; border-width: 3.5px; box-shadow: 0 3px 0 var(--ink); }
.av-grid { grid-template-columns: repeat(4, 1fr); gap: 6px; }
.hero-av { position: relative; margin-left: auto; padding: 0; border: 0; background: none; }
.hero .av.md { margin: 0; }

/* 動く枠の外に出した dock を、画面に張り付かせる */
.scr:has(.dock), .scr:has(.pad-dock) { padding-bottom: 48px; }
.scr.with-dock { padding-bottom: calc(var(--dockh, 118px) + 26px + env(safe-area-inset-bottom)); }
.scr.with-dock[data-screen="board"] { padding-bottom: 0; }
#app > .dock, #app > .pad-dock { position: fixed; }

/* 招待の帯（QRは「招待」を押したときだけ） */
.istrip { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border: 3px solid var(--ink); border-radius: 14px; background: #fff; }
.istrip.on { background: #e4f5d4; }
.istrip.off { background: var(--paper); border-style: dashed; }
.is-main { flex: 1; min-width: 0; }
.is-main b { display: block; font-size: 15px; font-weight: 800; }
.is-main small { display: block; font-size: 12px; color: var(--ink-soft); font-weight: 800; }
.is-main em { letter-spacing: .12em; color: var(--ink); }
.istrip .mini-btn { display: inline-flex; align-items: center; gap: 4px; flex: none; }
.istrip .mini-btn svg { width: 18px; height: 18px; }
.qr { width: 168px; height: 168px; margin: 8px auto; }
.invite .code-big { font-size: 38px; }

/* マスコット・ヒント・ごほうび */
.mascot { flex: none; display: block; }
.greet { display: flex; align-items: center; gap: 12px; }
.bubble { position: relative; flex: 1; min-width: 0; padding: 10px 14px; background: #fff; border: 3px solid var(--ink); border-radius: 16px; display: grid; gap: 2px; box-shadow: 0 4px 0 var(--ink); }
.bubble::before { content: ""; position: absolute; left: -10px; top: 50%; width: 14px; height: 14px; margin-top: -7px; background: #fff; border-left: 3px solid var(--ink); border-bottom: 3px solid var(--ink); transform: rotate(45deg); }
.bubble b { font-size: 15px; font-weight: 800; }
.bubble span { font-size: 13px; line-height: 1.6; color: var(--ink-soft); font-weight: 800; }
.tip { position: relative; display: flex; align-items: center; gap: 10px; padding: 10px 40px 10px 10px; border: 3px dashed var(--ink); border-radius: 14px; background: #fffbea; animation: rise .35s both; }
.tip p { font-size: 13px; line-height: 1.7; font-weight: 800; }
.tip-x { position: absolute; top: 4px; right: 4px; width: 34px; height: 34px; border: 0; background: none; font-size: 22px; font-weight: 800; color: var(--ink-soft); }
.prog-card { position: relative; display: flex; align-items: center; gap: 12px; width: 100%; padding: 12px 14px; border: 3px solid var(--ink); border-radius: 18px; background: #fff; text-align: left; box-shadow: 0 5px 0 var(--ink); transition: transform .2s var(--pop), box-shadow .2s var(--pop); }
.prog-card:active { transform: translateY(4px); box-shadow: 0 1px 0 var(--ink); }
.pg-lv { display: grid; place-items: center; flex: none; width: 52px; height: 52px; border: 3px solid var(--ink); border-radius: 50%; background: var(--yellow); line-height: 1; }
.pg-lv small { font-size: 9px; font-weight: 800; margin-bottom: -2px; }
.pg-lv b { font-size: 22px; font-weight: 800; }
.pg-lv.big { width: 64px; height: 64px; } .pg-lv.big b { font-size: 28px; }
.pg-main { flex: 1; min-width: 0; display: grid; gap: 2px; }
.pg-main b { font-size: 15px; font-weight: 800; }
.pg-main small { font-size: 11px; color: var(--ink-soft); font-weight: 800; }
.pg-main .track { height: 12px; margin: 2px 0; }
.prog-top { display: flex; align-items: center; gap: 14px; margin: 6px 0 14px; }
.badge-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.bd { display: grid; gap: 2px; padding: 10px; border: 3px dashed var(--ink-soft); border-radius: 12px; background: #fff; opacity: .7; }
.bd.on { border-style: solid; border-color: var(--ink); background: var(--yellow); opacity: 1; animation: pop-in .4s var(--pop) both; }
.bd i { font-size: 18px; font-weight: 800; color: var(--red); } .bd.on i { color: var(--ink); }
.bd b { font-size: 13px; font-weight: 800; } .bd small { font-size: 11px; line-height: 1.5; color: var(--ink-soft); font-weight: 800; }
.banner.good { background: var(--grass-deep); }
.choice.rec { background: #fffbea; }
.tag.g { background: var(--grass-deep); }

/* ---- 盤面: 基本は1画面に収める。くわしくは詳細画面で ---- */
.board { gap: 10px; }
.turn-strip { position: relative; display: flex; align-items: center; gap: 10px; width: 100%; margin-top: 10px; padding: 10px 12px; border: 3.5px solid var(--ink); border-radius: 20px; background: var(--yellow); text-align: left; box-shadow: 0 5px 0 var(--ink); }
.turn-strip:active { transform: translateY(3px); box-shadow: 0 2px 0 var(--ink); }
.turn-strip.swap { animation: swap .45s cubic-bezier(.2, .9, .3, 1) both; }
.ts-main { flex: 1; min-width: 0; display: grid; gap: 1px; }
.ts-main small { display: flex; align-items: center; font-size: 11px; font-weight: 800; color: var(--ink-soft); }
.ts-main small .tbadge { width: 18px; height: 18px; margin-right: 5px; border-radius: 6px; font-size: 10px; border-width: 2px; }
.ts-name { font-size: clamp(22px, 7.4vw, 30px); font-weight: 800; line-height: 1.15; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ts-name i { margin-left: 3px; font-size: 12px; font-weight: 800; }
.ts-pips { display: flex !important; align-items: center; gap: 4px; margin-top: 2px; }
.ts-pips .pip { width: 12px; height: 12px; border-width: 2px; }
.ts-pips small { margin-left: 4px; }
.ts-rem { flex: none; display: grid; justify-items: center; line-height: 1; padding: 6px 10px; border: 3px solid var(--ink); border-radius: 14px; background: #fff; }
.ts-rem small { font-size: 10px; font-weight: 800; } .ts-rem b { font-size: 32px; font-weight: 800; font-variant-numeric: tabular-nums; margin: 1px 0; }
.ts-more { flex: none; font-size: 24px; font-weight: 800; color: var(--ink-soft); }
.scores { gap: 8px; }
.srow.c { padding: 8px 12px; gap: 10px; border-radius: 14px; box-shadow: 0 4px 0 var(--ink); }
.srow.c .tbadge { width: 28px; height: 28px; font-size: 14px; }
.srow.c .s-name { display: flex; align-items: center; font-size: 14px; }
.s-avs { display: flex; margin: 2px 0 4px; }
.s-avs .av.xs { width: 20px; height: 20px; margin-right: -4px; border-width: 2px; border-radius: 7px; }
.srow.c .track { height: 9px; margin-top: 0; border-width: 2px; }
.srow.c .s-score { font-size: clamp(38px, 11vw, 50px); }
.srow.cur { outline: 3px solid var(--orange); outline-offset: 1px; }
.order { display: grid; gap: 6px; list-style: none; }
.order li { display: flex; align-items: center; gap: 8px; padding: 8px 10px; border: 3px solid var(--ink); border-radius: 12px; background: #fff; font-size: 14px; }
.order li.now { background: var(--yellow); }
.order li b { flex: 1; min-width: 0; font-weight: 800; } .order li small { color: var(--ink-soft); font-weight: 800; }
.dt-sec { margin: 4px 0 14px; } .dt-sec h4 { margin-bottom: 6px; font-size: 12px; font-weight: 800; letter-spacing: .08em; color: var(--ink-soft); }
.dt-team { display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 4px 8px; padding: 8px 10px; margin-bottom: 8px; border: 3px solid var(--ink); border-radius: 12px; background: #fff; }
.dt-team b { font-weight: 800; } .dt-team em { font-size: 22px; font-weight: 800; }
.dt-team .chips, .dt-team small { grid-column: 1 / -1; margin: 0; } .dt-team small { font-size: 11px; color: var(--ink-soft); font-weight: 800; }
.hints { display: grid; gap: 6px; padding-left: 0; list-style: none; } .hints li { padding: 8px 10px; border-radius: 10px; background: #fff; border: 2px solid var(--paper-line); font-size: 13px; line-height: 1.6; font-weight: 800; }
.steps { display: grid; gap: 8px; counter-reset: st; list-style: none; }
.steps li { position: relative; display: grid; gap: 2px; padding: 10px 10px 10px 46px; border: 3px solid var(--ink); border-radius: 12px; background: #fff; counter-increment: st; }
.steps li::before { content: counter(st); position: absolute; left: 10px; top: 10px; width: 26px; height: 26px; display: grid; place-items: center; border: 2.5px solid var(--ink); border-radius: 50%; background: var(--yellow); font-size: 13px; font-weight: 800; }
.steps b { font-size: 15px; font-weight: 800; } .steps span { font-size: 13px; color: var(--ink-soft); font-weight: 800; }

/* 入力パッドは、画面の高さに合わせて縮む */
.pad-dock { gap: 6px; padding-top: 8px; }
.pad-dock .pin { height: clamp(34px, 5.8vh, 46px); font-size: clamp(18px, 3vh, 22px); }
.pad-dock .counts button { height: clamp(34px, 5.8vh, 46px); }
.pad-dock .acts button { min-height: clamp(38px, 6vh, 48px); }
.pad-dock .acts small { display: none; }
.pad-dock .acts b { font-size: 15px; }
.pad-dock .pd-top .seg button, .back-btn.mini, .menu-btn { min-height: clamp(38px, 6vh, 44px); }
.board.land .turn-strip { margin-top: 6px; }
.board.land .ts-name { font-size: min(10vh, 8vw); }
.board.land .ts-rem b { font-size: min(9vh, 8vw); }
.board.land .ts-more, .board.land .ts-pips { display: none !important; }
.board.land .s-avs { justify-content: center; }

/* 画面を開いたときだけ動かす（タップのたびに作り直しても、ちらつかない） */
.panel, .tab-body, .tip, .resume, .invite, .team.settle, .bd.on { animation: none; }
.scr.in-fwd .panel, .scr.in-back .panel { animation: rise .35s both; }
.mode-card.group { min-height: 142px; } .mode-card.solo { min-height: 108px; }
.mc-num { font-size: clamp(64px, 20vw, 88px); }
ol { margin: 0; padding: 0; }
.board { gap: 7px; padding-bottom: calc(var(--dockh, 300px) + 10px + env(safe-area-inset-bottom)); }
.turn-strip { margin-top: 6px; padding: 8px 10px; }
.srow.c { padding: 6px 10px; }
.s-avs { margin: 1px 0 3px; }
.srow.c .s-score { font-size: clamp(34px, 10vw, 46px); }
.scores { gap: 6px; }
/* 4チームでも1画面に: 入力パッドをもう一段コンパクトに */
.pad-dock { gap: 5px; padding: 6px 8px calc(8px + env(safe-area-inset-bottom)); }
.pad-dock .pin-row, .pad-dock .pins { gap: 5px; }
.pad-dock .pin, .pad-dock .counts button { height: clamp(30px, 5vh, 42px); box-shadow: 0 3px 0 var(--ink); border-radius: 11px; }
.pad-dock .acts button { min-height: clamp(34px, 5.2vh, 44px); box-shadow: 0 3px 0 var(--ink); }
.pad-dock .pd-top .seg button, .back-btn.mini, .menu-btn { min-height: clamp(34px, 5.2vh, 40px); }
.srow.c .track { height: 7px; }
.turn-strip .av.lg2 { width: 48px; height: 48px; }
.ts-rem b { font-size: 28px; }
