/* =====================================================================
   3D表示（3D仕様書）。色・寸法はトークンと8の倍数だけ
   ===================================================================== */
:root { --tab-h: calc(56px + env(safe-area-inset-bottom)); --band-h: 120px; }
@media (min-width: 960px) { :root { --tab-h: 0px; } }

/* 見出し行と切替 */
.hrow { display: flex; align-items: center; justify-content: space-between; gap: var(--s1); flex-wrap: wrap; }
.vsw { display: inline-grid; grid-template-columns: repeat(2, auto); gap: 4px; flex: none; }
.vsw[hidden] { display: none; }
.vsw button { min-width: 48px; padding: 0 12px; }

/* お知らせ帯 */
.notice { display: flex; align-items: center; gap: var(--s1); min-height: 48px; margin-top: var(--s2); padding: 0 0 0 var(--s2); background: var(--surface); border-radius: var(--r); font-size: var(--fs-note); line-height: 1.6; color: var(--ink); }
.notice[hidden] { display: none; }
.notice span { flex: 1; min-width: 0; }
.notice button { border: 0; background: none; min-width: 48px; height: 48px; padding: 0 var(--s1); font-size: var(--fs-note); font-weight: 700; display: flex; align-items: center; justify-content: center; }

/* 3Dのとき: ページは動かさない */
html.v3d, html.v3d body { overflow: hidden; overscroll-behavior: none; height: 100%; }
html.v3d body { padding-bottom: 0; }
html.v3d .band { position: fixed; top: 0; left: 0; right: 0; z-index: 18; }
html.v3d .head { padding: 0 0 var(--s1); }
html.v3d .head .meta { display: none; }
html.v3d .head .lead { margin-top: 0; font-size: var(--fs-note); line-height: 1.6; color: var(--sub); }
html.v3d main > :not(.sheet):not(.sheet-bg) { display: none; }
html:not(.v3d) .stage { display: none; }

.stage { position: fixed; left: 0; right: 0; top: var(--band-h); bottom: var(--tab-h); z-index: 10; background: var(--mint); overflow: hidden; touch-action: none; overscroll-behavior: none; -webkit-user-select: none; user-select: none; }
.stage[hidden] { display: none; }
.stage .cv { position: absolute; inset: 0; }
.stage canvas { position: absolute; inset: 0; width: 100%; height: 100%; display: block; touch-action: none; outline: none; }
.stage .wait { position: absolute; left: var(--s2); right: var(--s2); top: var(--s3); margin: 0; font-size: var(--fs-note); line-height: 1.6; color: var(--sub); }
.lbl-layer { position: absolute; inset: 0; pointer-events: none; overflow: hidden; }
.lbl { position: absolute; left: 0; top: 0; height: 24px; display: none; align-items: center; padding: 0 var(--s1); background: var(--base); border: 1px solid var(--line); border-radius: var(--r); font-size: var(--fs-note); font-weight: 700; line-height: 1; color: var(--ink); white-space: nowrap; pointer-events: none; will-change: transform; }
.lbl em { font-style: normal; font-weight: 400; color: var(--sub); margin-left: 4px; }
.lbl.on { display: flex; }

/* 絞り込みチップ */
.chips { position: absolute; left: calc(var(--s2) + env(safe-area-inset-left)); right: calc(var(--s2) + env(safe-area-inset-right)); bottom: var(--s1); display: flex; gap: var(--s1); }
.chip { flex: 1 1 0; min-width: 0; height: 56px; background: var(--base); border: 1px solid var(--line); border-radius: var(--r); display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; padding: 0 4px; color: var(--ink); }
.chip .c1 { display: flex; align-items: center; gap: var(--s1); font-size: var(--fs-body); font-weight: 700; line-height: 20px; }
.chip .c2 { font-size: var(--fs-note); line-height: 16px; white-space: nowrap; color: inherit; }
.chip[aria-pressed="true"] { background: var(--ink); border-color: var(--ink); color: var(--base); }
.chip[aria-disabled="true"] { background: var(--surface); color: var(--sub); cursor: default; }
.sw { display: inline-block; width: 16px; height: 16px; background: var(--c); outline: 2px solid var(--base); flex: none; }
.sw.plate { height: 8px; margin: 4px 0; }
.sw.cyl { border-radius: 8px / 4px; }
.sw.sph { border-radius: 50%; }
.sw.dia { transform: rotate(45deg) scale(.72); }

/* 丸ボタン */
.rbtns { position: absolute; right: calc(var(--s2) + env(safe-area-inset-right)); bottom: 80px; display: flex; flex-direction: column; gap: var(--s1); }
.rb { width: var(--tap); height: var(--tap); border: 1px solid var(--line); border-radius: 50%; background: var(--base); color: var(--ink); display: flex; align-items: center; justify-content: center; font-size: var(--fs-h2); font-weight: 700; line-height: 1; padding: 0; }
.rb.help { position: absolute; left: calc(var(--s2) + env(safe-area-inset-left)); bottom: 80px; }
.stage.has-card .rbtns, .stage.has-card .rb.help { bottom: 192px; }
.stage.has-card .chips { display: none; }
.hint { position: absolute; left: 50%; bottom: 88px; transform: translateX(-50%); background: var(--base); border: 1px solid var(--line); border-radius: var(--r); padding: 4px var(--s2); font-size: var(--fs-note); line-height: 1.6; color: var(--sub); white-space: nowrap; pointer-events: none; }
.hint[hidden], .stage.has-card .hint { display: none; }

/* ミニカード */
.mcard { position: absolute; left: calc(var(--s2) + env(safe-area-inset-left)); right: calc(var(--s2) + env(safe-area-inset-right)); bottom: var(--s1); height: 176px; padding: var(--s2); background: var(--base); border: 1px solid var(--line); border-radius: var(--r); display: grid; gap: var(--s1); align-content: start; overflow: hidden; }
.mcard[hidden] { display: none; }
.mc1 { display: flex; align-items: center; justify-content: space-between; gap: var(--s1); }
.mc1 .mt { font-size: var(--fs-h2); font-weight: 700; line-height: 28px; min-width: 0; overflow-wrap: anywhere; }
.mc2 { font-size: var(--fs-body); line-height: 24px; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.mc3 { font-size: var(--fs-note); line-height: 20px; color: var(--sub); overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.mc-w .mt { font-size: var(--fs-body); line-height: 24px; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; word-break: keep-all; }
.mc-w .mc1 { align-items: flex-start; }
.mcb { display: flex; gap: var(--s1); }
.mcb .btn { padding: 0 var(--s2); flex: 1 1 0; }
.mcb .btn.sq { flex: none; width: var(--tap); padding: 0; }
.mcb .btn.primary { flex: 2 1 0; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* 読み方シート */
.helplist { list-style: none; margin: 0; padding: 0; display: grid; gap: var(--s2); }
.helplist li { display: flex; align-items: center; gap: var(--s2); }
.helplist .sw { margin: 0 4px; }
.helplist .sw.plate { margin: 4px 4px; }
.helplist span.tx { min-width: 0; overflow-wrap: anywhere; word-break: keep-all; }
.sheet-foot .btn + .btn { margin-top: var(--s1); }

@media (min-width: 640px) {
  .chips { left: 50%; right: auto; width: min(720px, calc(100% - 48px)); transform: translateX(-50%); }
}
@media (min-width: 960px) {
  .chips { width: 560px; bottom: var(--s2); }
  .rbtns { bottom: var(--s2); }
  .rb.help { left: auto; right: calc(var(--s2) + env(safe-area-inset-right)); bottom: 176px; }
  .mcard { right: auto; width: 360px; bottom: var(--s2); }
  .stage.has-card .rbtns { bottom: var(--s2); }
  .stage.has-card .rb.help { bottom: 176px; }
  .stage.has-card .chips { display: flex; }
  .hint { bottom: 88px; }
}
/* 横持ち（高さが低い） */
@media (max-height: 499px) and (max-width: 959px) {
  html.v3d .head .lead { display: none; }
  .chip { height: 48px; }
  .chip .c1 { line-height: 16px; }
  .rbtns, .rb.help { bottom: 64px; }
  .mcard { left: auto; width: 320px; right: calc(var(--s2) + env(safe-area-inset-right)); bottom: var(--s1); top: var(--s1); height: auto; }
  .stage.has-card .rbtns, .stage.has-card .rb.help { bottom: 64px; }
  .stage.has-card .chips { display: flex; right: 352px; }
}

.skip { position: absolute; left: var(--s1); top: -64px; z-index: 50; background: var(--ink); color: var(--base); padding: 0 var(--s2); height: var(--tap); display: flex; align-items: center; border-radius: var(--r); text-decoration: none; font-weight: 700; }
.skip:focus { top: var(--s1); }
html:not(.can3d) .skip { display: none; }
.see3d-btn { display: none; justify-self: start; }
html.can3d .see3d-btn { display: inline-flex; }
.wbody2 { display: grid; gap: var(--s2); }
.wbody2 .wmemo { margin: 0; }

.mc2 .star, .chip .c2 { display: inline-flex; align-items: center; gap: 4px; }
.chip .c2 { justify-content: center; }
.mc2 .star { vertical-align: middle; }
@media (min-width: 960px) {
  .stage.has-card .chips { left: 392px; transform: none; width: min(560px, calc(100% - 392px - 80px)); }
}
