/* トップとゲーム中の「遊び方」で共用するスライド。 */
.howto {
  --ink: #23211f; --paper: #fffaf1; --spot: #ffd456;
  display: flex; flex-direction: column; min-width: 0;
}
.howto[data-chapter="1"] { --spot: #ffab85; }
.howto[data-chapter="2"] { --spot: #a0dfc0; }
.howto[data-chapter="3"] { --spot: #c5b8fa; }
.ht-top, .ht-pager, .ht-tabs { display: flex; align-items: center; gap: clamp(8px, 1vw, 22px); }
.ht-tabs { flex: 1; justify-content: flex-end; }
.ht-tabs button, .ht-prev, .ht-next { border-radius: .65em; font-weight: 800; line-height: 1.2; }
.ht-tabs button { padding: .65em .85em; min-height: 2.4em; font-size: clamp(15px, 1.6vw, 32px); background: #303038; color: #f5f3ef; }
.ht-tabs button[aria-selected=true], .ht-next { background: var(--spot); color: var(--ink); }
.howto button:focus-visible, body[data-input=key] .howto button:focus { outline: 3px solid white; outline-offset: 3px; }
.ht-panel { flex: 1; min-height: 0; display: grid; grid-template-rows: auto minmax(0, 1fr) auto; border-radius: clamp(16px, 1.5vw, 30px); overflow: hidden; background: var(--paper); color: var(--ink); }
.ht-panel header { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 2.3vh 3vw 1.5vh; border-top: clamp(7px, .7vw, 14px) solid var(--spot); }
.ht-panel h2 { margin: 0; font-size: calc(clamp(23px, 2.8vw, 55px) * var(--fs, 1)); font-weight: 900; line-height: 1.45; overflow-wrap: break-word; }
.ht-counter { color: #58534e; font: 750 clamp(15px, 1.65vw, 32px)/1.1 system-ui, sans-serif; font-variant-numeric: tabular-nums; white-space: nowrap; }
.ht-figure { font-family: system-ui, sans-serif; min-height: 0; container-type: size; display: grid; grid-template: minmax(0, 1fr) / minmax(0, 1fr); place-items: center; margin: 0 2.4vw;
  background: radial-gradient(circle, #d8d0c2 1.1px, transparent 1.6px) center / clamp(12px, 1.2vw, 24px) clamp(12px, 1.2vw, 24px); }
.ht-figure > div { width: max-content; font-size: min(3.7cqw, 9.1cqh); }
.ht-flow, .ht-row, .ht-stack, .ht-people { display: flex; align-items: center; justify-content: center; }
.ht-flow { gap: .8em; }
.ht-row { gap: .44em; }
.ht-stack { flex-direction: column; gap: .36em; }
.ht-row > .ht-stack + .ht-stack { margin-inline-start: .5em; }
.ht-arrow { color: #65594c; }
.ht-symbol, .ht-yes, .ht-no, .ht-count, .ht-code, .ht-digits, .ht-prize { display: inline-grid; place-items: center; white-space: nowrap; line-height: 1.2; font-variant-numeric: tabular-nums; }
.ht-symbol { font-size: 1.4em; }
.ht-prize { font-size: 3.4em; color: #b8860b; }
.ht-yes, .ht-no { font-size: 1.35em; min-width: 1.6em; height: 1.6em; border-radius: 50%; color: white; background: #267650; }
.ht-no { background: #a83c3c; }
.ht-ico { display: inline-block; width: 1.4em; height: 1.4em; background: currentColor; mask: var(--ico) center / contain no-repeat; -webkit-mask: var(--ico) center / contain no-repeat; }
.ht-ico[data-icon="arrow_forward"] { --ico: url('/images/icons/arrow_forward.svg'); width: 1.6em; height: 1.6em; }
.ht-ico[data-icon="emoji_events"] { --ico: url('/images/icons/emoji_events.svg'); width: 1em; height: 1em; }
.ht-ico[data-icon="lock"] { --ico: url('/images/icons/lock.svg'); }
.ht-ico[data-icon="casino"] { --ico: url('/images/icons/casino.svg'); }
.ht-ico[data-icon="play_arrow"] { --ico: url('/images/icons/play_arrow.svg'); }
.ht-ico[data-icon="check"] { --ico: url('/images/icons/check.svg'); }
.ht-ico[data-icon="refresh"] { --ico: url('/images/icons/refresh.svg'); }
.ht-ico[data-icon="swap_vert"] { --ico: url('/images/icons/swap_vert.svg'); }
.ht-ico[data-icon="close"] { --ico: url('/images/icons/close.svg'); }
.ht-glyph { width: 1em; height: 1em; }
.ht-count, .ht-code, .ht-digits { font-weight: 900; letter-spacing: .04em; }
.ht-count, .ht-code { padding: .18em .55em; border-radius: .4em; color: var(--paper); background: var(--ink); }
.ht-code { background: #3d3451; }
.ht-people { gap: .12em; }
.ht-person { display: grid; place-items: center; width: 2.35em; height: 2.35em; border: .065em solid var(--ink); border-radius: 50%; }
.ht-person .character-icon { width: 74%; height: 74%; }
.ht-board { display: grid; gap: .065em; padding: .11em; background: #242329; border-radius: .23em; width: 7.25em; box-shadow: .075em .11em 0 #25212536; }
.ht-board .tier-row { grid-template-columns: 1.85em 1fr; min-height: 1.18em; outline-width: .055em; outline-offset: -.055em; border-radius: .12em; background: #44424b; }
.ht-board .tier-row.hl { background: #625435; }
.ht-board .tier-words { padding: .08em .2em; gap: .12em; font-size: 1em; }
.ht-rank { min-width: 1.5em; border-radius: .14em; font: 900 1.22em/1.14 system-ui, sans-serif; }
.ht-board .ht-rank { min-width: 0; font-size: .88em; border-radius: 0; }
.ht-board:has(.tier-row:nth-child(7)) { font-size: .79em; width: 12em; }
.ht-figure .ht-card { display: inline-grid; place-items: center; min-width: 2em; font: 900 1.28em/1.23 system-ui, sans-serif; padding: .16em .45em; border: .055em solid var(--ink); border-radius: .32em; box-shadow: .065em .09em 0 var(--ink); }
.ht-card[data-suit="♥"] { color: #a33c3e; }
.ht-board .ht-card { font-size: .64em; border-radius: .3em; padding: .05em .3em; }
.ht-card.start { color: #393d49; }
.ht-pc, .ht-phone { display: grid; justify-items: center; }
.ht-display { border: .13em solid #2e2c30; border-radius: .27em; background: #eeece8; display: grid; place-content: center; padding: .22em; }
.ht-pc .ht-display { width: 5.6em; height: 3.55em; }
.ht-pc::after { content: ''; width: 2.2em; height: .55em; background: linear-gradient(90deg, transparent 29%, #343238 29% 71%, transparent 71%); border-bottom: .12em solid #343238; }
.ht-display .ht-board { font-size: .57em; }
.ht-display .ht-digits { font: 800 .85em/1.4 system-ui, sans-serif; }
.ht-phone .ht-display { width: 1.9em; height: 3.25em; border-width: .18em .09em .26em; }
.ht-phone .ht-rank { font-size: .7em; }
.ht-phone .ht-digits { font-size: .37em; }
.ht-caption { margin: 0; display: grid; align-content: center; text-align: center; padding: 1.7vh 2.8vw;
  min-height: 13vh; font-size: calc(clamp(18px, 2vw, 40px) * var(--fs, 1)); line-height: 1.4; font-weight: 720; text-wrap: balance; overflow-wrap: break-word; }
.ht-pager { justify-content: space-between; gap: 8px; }
.ht-prev, .ht-next { min-height: 44px; padding: .58em 1.25em; font-size: clamp(18px, 1.55vw, 30px); }
.ht-prev { background: #35343b; color: #fff; }
.ht-dots { display: flex; align-items: center; justify-content: center; }
.ht-dot { display: grid; place-items: center; background: transparent; width: clamp(24px, 2vw, 39px); height: 44px; padding: 0; border-radius: 8px; }
.ht-dot::before { content: ''; width: 30%; height: auto; aspect-ratio: 1; background: #96939b; border-radius: 20px; }
.ht-dot[aria-current]::before { width: 86%; height: clamp(7px, .6vw, 12px); aspect-ratio: auto; background: var(--spot); }
@media (max-width: 740px) and (orientation: portrait) {
  .ht-top { flex-direction: column; align-items: stretch; }
  .ht-tabs { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 6px; }
  .ht-tabs button { font-size: 14px; min-height: 44px; padding: 4px; }
  .ht-panel header { padding: 14px 14px 8px; }
  .ht-panel h2 { font-size: calc(22px * var(--fs, 1)); }
  .ht-caption { min-height: 80px; padding: 10px 10px 16px; font-size: calc(16px * var(--fs, 1)); font-weight: 630; }
  .ht-figure > div { font-size: min(6cqw, 6.25cqh); }
  .ht-flow { flex-direction: column; gap: .45em; }
  .ht-flow > .ht-arrow { transform: rotate(90deg); line-height: 1.3; font-size: 1.35em; }
  .ht-figure > .ht-row { font-size: min(4.4cqw, 6cqh); }
  .ht-figure > .ht-flow > .ht-stack:has(> .ht-card) { flex-direction: row; }
  .ht-figure > .ht-flow > .ht-board:has(.tier-row:nth-child(7)) { font-size: min(1.2em, 5cqh); }
  .ht-pager { flex-wrap: wrap; }
  .ht-dots { order: -1; width: 100%; }
  .ht-prev, .ht-next { font-size: 16px; }
  .ht-dot { height: 26px; width: 25px; }
}

/* 対局中も帯・図・操作が同じ枠内に収まる。大きな文字や短い窓では本文だけを縦に送れる。 */
.help-box { height: min(90dvh, 800px); }
.help-head { padding-block: 14px 8px; }
.help-body {
  display: flex; flex: 1; flex-direction: column; min-height: 0;
  gap: 12px; padding: 4px 28px 8px; overflow: auto; overscroll-behavior: contain;
}
.help-now {
  flex: none; display: flex; align-items: baseline; gap: 6px 14px;
  padding: 10px 14px; border-inline-start: 4px solid var(--accent);
  border-radius: 8px; background: var(--panel2);
  font-size: calc(clamp(14px, 1.25vw, 21px) * var(--fs, 1)); line-height: 1.5;
}
.help-now h3 { margin: 0; color: var(--accent); font-size: 1em; }
.help-now p { margin: 0; min-width: 0; overflow-wrap: anywhere; }
.help-deck { display: flex; flex: 1; min-height: 320px; }
.help-deck .howto { width: 100%; gap: 10px; }
.help-deck .ht-tabs { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; }
.help-deck .ht-tabs button {
  height: 100%; min-height: 44px; padding: 6px 10px; overflow-wrap: anywhere;
  font-size: calc(clamp(14px, 1.2vw, 21px) * var(--fs, 1));
}
.help-deck .ht-panel { grid-template-rows: auto minmax(72px, 1fr) auto; flex: 1 0 auto; }
.help-deck .ht-panel header { padding: 10px 18px 8px; border-width: 6px; }
.help-deck .ht-panel h2 { font-size: calc(clamp(20px, 2vw, 32px) * var(--fs, 1)); }
.help-deck .ht-counter { font-size: clamp(14px, 1.3vw, 22px); }
.help-deck .ht-figure { margin-inline: 16px; }
.help-deck .ht-caption {
  min-height: 0; padding: 10px 18px 14px; gap: 3px;
  font-size: calc(clamp(15px, 1.35vw, 23px) * var(--fs, 1));
}
.help-deck .ht-prev, .help-deck .ht-next { font-size: calc(clamp(14px, 1.25vw, 21px) * var(--fs, 1)); }
.help-deck .ht-dots { min-width: 0; flex: 0 1 auto; }
.help-deck .ht-dot { flex: 0 1 28px; min-width: 0; }
.ht-named-rank { display: grid; place-items: center; width: 4.2em; min-height: 1.5em; container-type: inline-size; }
.ht-named-rank .custom-rank-name { font-size: clamp(12px, 90cqi / var(--name-columns), .82em); }

@media (max-width: 740px) {
  .help-box { max-height: 94dvh; }
  .help-phone .help-box { height: 88dvh; }
  .help-head { padding: 10px 16px 6px; }
  .help-head h2 { font-size: calc(20px * var(--fs, 1)); }
  .help-x { width: 40px; height: 40px; font-size: 26px; }
  .help-body { padding-inline: 14px; gap: 8px; }
  .help-now { display: block; padding: 7px 10px; }
  .help-now p { margin-top: 2px; }
  .help-deck .ht-tabs { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 5px; }
  .help-deck .ht-panel header { padding-inline: 12px; }
  .help-deck .ht-caption { padding-inline: 12px; }
  .help-deck .ht-figure { margin-inline: 10px; }
  .help-deck .ht-pager { display: grid; grid-template-columns: 1fr 1fr; gap: 4px 8px; }
  .help-deck .ht-dots { grid-column: 1 / -1; grid-row: 1; }
  .help-deck .ht-dot { height: 24px; }
  .help-foot { padding: 5px 14px 12px; font-size: calc(12px * var(--fs, 1)); }
}
