/* P03 メインステージ（墨）。設計 3.3。看板は共通の .bb を使い、ここで中身と寸法を足す */
@layer page {
  /* ---------- ① 看板（1440：高さ 520／390：420） ---------- */
  /* 名前を字で組む作品は、名前が長いと積んだ中身が看板より高くなる → 高さは最小として持ち、中身に合わせて伸ばす（中身は下から積む） */
  .st-bb { height: auto; min-height: var(--bb-h, 520px); display: flex; flex-direction: column; justify-content: flex-end; }
  .st-bb .bb__info { position: relative; left: auto; bottom: auto; padding: var(--es-space-89) 0 var(--es-space-55) max(var(--es-margin), env(safe-area-inset-left)); }
  @media (max-width: 986px) {
    .st-bb { min-height: var(--bb-h-m, 420px); }
    /* 看板の中身は名前・ひとこと・作り手・「遊ぶ」で縦に長い：明るい絵でも名札と名前が読めるよう、幕を中身の上端まで伸ばす（E-9・E-12 の幕） */
    .st-bb .bb__veil { background: linear-gradient(0deg, var(--es-color-sumi) 0%, var(--es-color-sumi) 48%, color-mix(in srgb, var(--es-color-sumi) 88%, transparent) 62%, color-mix(in srgb, var(--es-color-sumi) 0%, transparent) 90%); }
    .st-bb .bb__info { left: auto; right: auto; padding: var(--es-space-89) max(var(--es-margin), env(safe-area-inset-right)) var(--es-space-21) max(var(--es-margin), env(safe-area-inset-left)); }
  }
  .st-bb .bb__title:has(.st-name) { width: 610px; }
  .st-name--d55 { font-size: var(--es-text-55); line-height: var(--es-lh-55); }
  .st-name--d42 { font-size: var(--es-text-42); line-height: var(--es-lh-42); }
  .st-name--d34 { font-size: var(--es-text-34); line-height: var(--es-lh-34); }
  @media (max-width: 986px) {
    .st-bb .bb__title:has(.st-name) { width: auto; }
    .st-name--m34 { font-size: var(--es-text-34); line-height: var(--es-lh-34); }
    .st-name--m26 { font-size: var(--es-text-26); line-height: var(--es-lh-26); }
    .st-name--m21 { font-size: var(--es-text-21); line-height: var(--es-lh-21); }
  }
  .st-meta { align-items: center; row-gap: var(--es-space-5); }
  .st-meta__maker { display: inline-flex; align-items: center; gap: var(--es-space-8); }
  .st-meta__maker a { color: var(--es-color-hakunetsu); text-decoration: underline; text-decoration-color: color-mix(in srgb, var(--es-color-hakunetsu) 40%, transparent); text-underline-offset: 0.25em; }
  @media (hover: hover) and (pointer: fine) { .st-meta__maker a:hover { text-decoration-color: currentColor; } }
  .st-act { align-items: center; }
  .st-early { background: var(--es-color-sumi); color: var(--es-color-hakunetsu); }
  @media (max-width: 609px) { .st-act__about { display: none; } }
  .st-ingame { margin-top: var(--es-space-13); font-size: var(--es-text-13); line-height: var(--es-lh-13); color: var(--es-color-kaihaku); }

  /* ---------- ③ 残る帯：1440 は上（ヘッダーの下）、986 までは下 ---------- */
  .st-dock { position: fixed; left: 0; right: 0; z-index: 40; background: var(--es-bg); }
  .st-dock__in { display: flex; align-items: center; gap: var(--es-space-21); height: 55px; padding-left: max(var(--es-margin), env(safe-area-inset-left)); padding-right: max(var(--es-margin), env(safe-area-inset-right)); }
  .st-dock__who { display: flex; align-items: baseline; gap: var(--es-space-13); min-width: 0; flex: 1 1 auto; }
  .st-dock__name { font-size: var(--es-text-16); line-height: var(--es-lh-16); font-weight: var(--es-fw-bold); color: var(--es-text-strong); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; }
  .st-dock__maker { font-size: var(--es-text-13); line-height: var(--es-lh-13); color: var(--es-text-sub); white-space: nowrap; }
  .st-dock__play { flex: 0 0 auto; }
  @media (min-width: 987px) {
    .st-dock { top: var(--hh); border-bottom: var(--es-line-1) solid var(--es-rule); }
    .st-dock__write { display: none; }
  }
  @media (max-width: 986px) {
    .st-dock { bottom: 0; border-top: var(--es-line-1) solid var(--es-rule); padding-bottom: env(safe-area-inset-bottom); }
    .st-dock__in { gap: var(--es-space-8); }
    .st-dock__who { display: none; }
    .st-dock__play { flex: 1 1 auto; order: 1; }
    .st-dock__write { flex: 0 0 110px; order: 2; padding: 0; }
    body.has-dock .demo { bottom: calc(55px + var(--es-space-13) + env(safe-area-inset-bottom)); }
    [data-page="stage"] .ftr { padding-bottom: calc(var(--es-space-55) + 55px + env(safe-area-inset-bottom)); }
  }

  /* ---------- ④〜⑦ 左 5 列にメインステージ、右 3 列に作品について ---------- */
  .st-main { display: grid; grid-template-columns: repeat(var(--es-columns), minmax(0, 1fr)); column-gap: var(--es-gutter); padding-top: var(--es-space-55); }
  .st-cm { grid-column: 1 / -1; min-width: 0; }
  .st-about { grid-column: 1 / -1; min-width: 0; }
  @media (min-width: 987px) {
    .st-cm { grid-column: 1 / span 5; grid-row: 1; }
    .st-about { grid-column: 6 / span 3; grid-row: 1; align-self: start; position: sticky; top: 144px; }
    .st-about.is-flow { position: static; }
  }
  .st-cm__h { font-size: var(--es-text-34); line-height: var(--es-lh-34); margin-bottom: var(--es-space-21); }
  @media (max-width: 986px) { .st-cm__h { font-size: var(--es-text-26); line-height: var(--es-lh-26); } }
  @media (max-width: 986px) { .st-main { padding-top: var(--es-space-34); } }

  /* ジャンルの行：986 までは上に残る（ヘッダーの下）・横にスクロール。「エクストラステージへ」は行のいちばん右の線の選択肢 */
  @media (max-width: 986px) {
    .st-cm .cm-bar { position: sticky; top: var(--hh); z-index: 30; background: var(--es-bg); margin: 0 calc(var(--es-margin) * -1); padding: var(--es-space-5) 0; border-bottom: var(--es-line-1) solid var(--es-rule); }
    .st-cm .cm-tabs { flex-wrap: nowrap; flex: 0 0 auto; } /* 横スクロールの行では折り返さない（community.css の折り返しを戻す） */
    .st-cm .cm-bar__scroll { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; padding: 0 var(--es-margin); scroll-padding: 0 var(--es-margin); }
    .st-cm .cm-bar__scroll::-webkit-scrollbar { display: none; }
    .st-cm .cm-bar__extra { margin-left: 0; height: 34px; min-height: 34px; padding: 0 var(--es-space-13); border-radius: var(--es-radius-full); box-shadow: inset 0 0 0 var(--es-line-1) var(--es-border); color: var(--es-text-strong); position: relative; }
    .st-cm .cm-bar__extra::before { content: ""; position: absolute; inset: -5px 0; }
    .st-cm .cm-bar__extra > span { text-decoration: none; }
    .st-cm .cm-bar__extra .ico { width: 16px; height: 16px; }
  }

  /* ---------- ⑦ 作品について ---------- */
  .st-about__sum { display: flex; align-items: center; justify-content: space-between; gap: var(--es-space-13); list-style: none; }
  .st-about__sum::-webkit-details-marker { display: none; }
  .st-about__h { font-size: var(--es-text-21); line-height: var(--es-lh-21); }
  @media (min-width: 987px) {
    .st-about__sum { pointer-events: none; }
    .st-about__sum > .ico { display: none; }
  }
  @media (max-width: 986px) {
    .st-about { order: -1; margin-bottom: var(--es-space-34); border-top: var(--es-line-1) solid var(--es-rule); border-bottom: var(--es-line-1) solid var(--es-rule); }
    .st-about__sum { min-height: 55px; cursor: pointer; }
    .st-about__h { font-size: var(--es-text-16); line-height: var(--es-lh-16); }
    .st-about__d[open] .st-about__sum > .ico { transform: rotate(180deg); }
    .st-about__body { padding-bottom: var(--es-space-34); }
  }
  .st-about__body { display: flex; flex-direction: column; }
  .st-summary { margin-top: var(--es-space-13); font-size: var(--es-text-16); line-height: var(--es-lh-16); color: var(--es-text-strong); }
  .st-desc { margin-top: var(--es-space-13); display: flex; flex-direction: column; align-items: flex-start; gap: var(--es-space-13); }
  .st-desc p { font-size: var(--es-text-16); line-height: var(--es-lh-16); color: var(--es-text); }
  .js .st-desc:not(.is-open) .st-more-p { display: none; }
  .st-readmore { font-size: var(--es-text-13); }
  .st-readmore[aria-expanded="true"] { display: none; }
  .st-h3 { display: block; margin-top: var(--es-space-34); font-size: var(--es-text-13); line-height: var(--es-lh-13); font-weight: var(--es-fw-medium); color: var(--es-text-sub); }
  .st-feats { margin-top: var(--es-space-8); border-top: var(--es-line-1) solid var(--es-rule); }
  .st-feats li { padding: var(--es-space-8) 0; border-bottom: var(--es-line-1) solid var(--es-rule); font-size: var(--es-text-16); line-height: var(--es-lh-16); color: var(--es-text); }
  .st-spec { margin-top: var(--es-space-34); }
  .st-spec > div { display: grid; grid-template-columns: 7em minmax(0, 1fr); column-gap: var(--es-space-13); padding: var(--es-space-8) 0; border-bottom: var(--es-line-1) solid var(--es-rule); }
  .st-spec > div:first-child { border-top: var(--es-line-1) solid var(--es-rule); }
  .st-spec dt { font-size: var(--es-text-13); line-height: var(--es-lh-16); color: var(--es-text-sub); }
  .st-spec dd { margin: 0; font-size: var(--es-text-16); line-height: var(--es-lh-16); color: var(--es-text-strong); min-width: 0; }
  .st-sep { color: var(--es-text-sub); }
  .st-controls { margin-top: var(--es-space-21); border-bottom: var(--es-line-1) solid var(--es-rule); }
  .st-controls > summary { display: flex; align-items: center; justify-content: space-between; min-height: 44px; cursor: pointer; list-style: none; }
  .st-controls > summary::-webkit-details-marker { display: none; }
  .st-controls > summary .st-h3 { margin-top: 0; }
  .st-controls > summary .ico { color: var(--es-text-sub); }
  .st-controls[open] > summary .ico { transform: rotate(180deg); }
  .st-ctl { padding-bottom: var(--es-space-21); }
  .st-controls:not([open]) > :not(summary), .st-about__d:not([open]) > :not(summary) { display: none; }
  .st-ctl__d { font-size: var(--es-text-13); line-height: var(--es-lh-13); font-weight: var(--es-fw-bold); color: var(--es-text-strong); margin-bottom: var(--es-space-5); }
  .st-ctl__t { width: 100%; font-size: var(--es-text-13); line-height: var(--es-lh-13); }
  .st-ctl__t th { text-align: left; font-weight: var(--es-fw-medium); color: var(--es-text-sub); padding: var(--es-space-5) var(--es-space-8) var(--es-space-5) 0; border-bottom: var(--es-line-1) solid var(--es-rule); }
  .st-ctl__t td { padding: var(--es-space-5) var(--es-space-8) var(--es-space-5) 0; border-bottom: var(--es-line-1) solid var(--es-rule); vertical-align: top; color: var(--es-text); overflow-wrap: anywhere; }
  .st-ctl__t td:first-child { width: 45%; color: var(--es-text-strong); }
  .st-notes { margin-top: var(--es-space-8); display: flex; flex-direction: column; gap: var(--es-space-8); }
  .st-notes li { font-size: var(--es-text-13); line-height: var(--es-lh-13); color: var(--es-text); }
  .st-shots { margin-top: var(--es-space-8); display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--es-space-8); align-items: start; }
  .st-shot { display: block; outline-offset: 2px; }
  .st-shot img { width: 100%; height: auto; border: var(--es-line-1) solid var(--es-border); background: var(--es-surface); }
  @media (hover: hover) and (pointer: fine) { .st-shot:hover img { border-color: var(--es-accent); } }
  .st-maker { margin-top: var(--es-space-13); }
  .st-maker__row { display: flex; align-items: center; gap: var(--es-space-13); margin-top: var(--es-space-8); }
  .st-maker__name { font-size: var(--es-text-16); line-height: var(--es-lh-16); font-weight: var(--es-fw-bold); color: var(--es-text-strong); }
  .st-extra { margin-top: var(--es-space-34); padding: var(--es-space-21); border-radius: var(--es-radius-l); }
  .st-extra__t { font-size: var(--es-text-16); line-height: var(--es-lh-16); font-weight: var(--es-fw-bold); color: var(--es-text-strong); }

  /* ---------- ⑧ ほかの作品（上 144・下 89） ---------- */
  .st-others { display: grid; grid-template-columns: repeat(var(--es-columns), minmax(0, 1fr)); column-gap: var(--es-gutter); row-gap: var(--es-space-21); padding-top: var(--es-space-144); padding-bottom: var(--es-space-89); }
  .st-others__h, .st-others__list { grid-column: 1 / -1; min-width: 0; }
  .st-others__h { font-size: var(--es-text-26); line-height: var(--es-lh-26); }
  .st-others__list .rcard + .rcard { border-top: var(--es-line-1) solid var(--es-rule); }
  @media (min-width: 987px) { .st-others__h { grid-column: 1 / span 3; } .st-others__list { grid-column: 4 / span 5; } }
  @media (max-width: 609px) { .st-others { padding-top: var(--es-space-89); padding-bottom: var(--es-space-55); } }

  /* ---------- 画面の絵を大きく（<dialog>） ---------- */
  .st-lb { position: fixed; inset: 0; width: 100vw; height: 100dvh; max-width: none; max-height: none; margin: 0; padding: 0; border: 0; background: var(--es-bg); color: var(--es-text); }
  .st-lb::backdrop { background: var(--es-bg); }
  .st-lb[open] { display: grid; grid-template-columns: 55px minmax(0, 1fr) 55px; grid-template-rows: 55px minmax(0, 1fr) 55px; align-items: center; justify-items: center; }
  .st-lb__top { grid-column: 1 / -1; grid-row: 1; justify-self: end; padding-right: var(--es-space-8); }
  .st-lb__fig { grid-column: 2; grid-row: 2; display: flex; flex-direction: column; align-items: center; gap: var(--es-space-13); width: 100%; height: 100%; justify-content: center; min-height: 0; }
  .st-lb__fig img { max-width: 100%; max-height: calc(100dvh - 55px * 2 - 55px); width: auto; height: auto; object-fit: contain; border: var(--es-line-1) solid var(--es-border); }
  .st-lb__cap { font-size: var(--es-text-13); line-height: var(--es-lh-13); color: var(--es-text); text-align: center; max-width: 42em; }
  .st-lb__prev { grid-column: 1; grid-row: 2; }
  .st-lb__next { grid-column: 3; grid-row: 2; }
  @media (max-width: 609px) {
    .st-lb[open] { grid-template-columns: 0 minmax(0, 1fr) 0; grid-template-rows: 55px minmax(0, 1fr) 55px; }
    .st-lb__prev, .st-lb__next { grid-row: 3; }
    .st-lb__prev { grid-column: 2; justify-self: start; }
    .st-lb__next { grid-column: 2; justify-self: end; }
    .st-lb__fig { padding: 0 var(--es-space-13); }
  }
}
