/* P04 プレイ画面（墨）。設計 3.4。ゲームがいちばん大きい。上の帯は高さ 44 の 1 本だけ */
@layer page {
  body.is-play { min-height: 0; height: 100dvh; overflow: hidden; }
  body.is-play main { display: flex; flex-direction: column; min-height: 0; }
  .pl { display: flex; flex-direction: column; height: 100dvh; min-height: 0; }

  /* ---------- ① 上の帯 ---------- */
  .pl-bar { position: relative; display: flex; align-items: center; gap: var(--es-space-13); height: calc(44px + env(safe-area-inset-top)); padding-top: env(safe-area-inset-top); padding-left: max(var(--es-space-13), env(safe-area-inset-left)); padding-right: max(var(--es-space-8), env(safe-area-inset-right)); border-bottom: var(--es-line-1) solid var(--es-rule); flex: 0 0 auto; }
  .pl-back { display: inline-flex; align-items: center; gap: var(--es-space-5); min-height: 44px; min-width: 0; color: var(--es-text-strong); flex: 0 1 auto; }
  .pl-name { font-size: var(--es-text-16); line-height: var(--es-lh-16); font-weight: var(--es-fw-medium); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; }
  @media (hover: hover) and (pointer: fine) { .pl-back:hover .pl-name { text-decoration: underline; text-underline-offset: 0.25em; } }
  .pl-maker { font-size: var(--es-text-13); line-height: var(--es-lh-13); color: var(--es-text-sub); white-space: nowrap; flex: 0 0 auto; }
  /* C-5：帯の流れの中に置く（真ん中に重ねると、いつも出す「新しいタブで遊ぶ」と 987〜1400 で重なったため）。狭くなったら題を … で省く */
  .pl-c5 { display: flex; flex: 0 0 auto; margin-left: auto; }
  @media (min-width: 987px) { .pl-c5 { flex: 0 1 auto; min-width: 0; overflow: hidden; } }
  .pl-c5 + .pl-tools { margin-left: 0; }
  @media (min-width: 987px) and (max-width: 1279px) { .pl-c5 { flex-shrink: 0; overflow: visible; } .pl-c5 .cmini__title { display: none; } } /* 題を出さない幅は、残りの時間を切らない（作品名の方を … で省く） */
  .pl.is-loading .pl-c5 { visibility: hidden; }
  .pl-tools { display: flex; align-items: center; gap: var(--es-space-5); margin-left: auto; flex: 0 0 auto; }
  .pl-tool { display: inline-flex; align-items: center; gap: var(--es-space-8); min-height: 44px; padding: 0 var(--es-space-13); border-radius: var(--es-radius-full); font-size: var(--es-text-13); line-height: var(--es-lh-13); color: var(--es-text-strong); white-space: nowrap; }
  .pl-tool--panel[aria-expanded="true"] { box-shadow: inset 0 0 0 var(--es-line-2) var(--es-accent); }
  .pl-tool--extra > span { text-decoration: underline; text-underline-offset: 0.25em; text-decoration-thickness: 1px; color: var(--es-accent); }
  @media (hover: hover) and (pointer: fine) { .pl-tool--panel:hover { background: color-mix(in srgb, var(--es-text-strong) 10%, transparent); } .pl-tool--extra:hover > span { text-decoration-thickness: 2px; } }
  .pl-chat-m { display: none; }
  /* 新しいタブで遊ぶ：いつも出しておく（読み込みの load だけでは、埋め込みに成功したか分からないため。A6） */
  .pl-tool--tab > .pl-tool__t { white-space: nowrap; }
  .pl-fab { display: none; }

  /* ---------- 横にする案内（横の作品を縦に持っているとき） ---------- */
  .pl-rotate { display: flex; align-items: center; gap: var(--es-space-8); min-height: 44px; padding: 0 var(--es-space-5) 0 var(--es-space-13); background: var(--es-surface); font-size: var(--es-text-13); line-height: var(--es-lh-13); color: var(--es-text); flex: 0 0 auto; }
  .pl-rotate p { flex: 1 1 auto; min-width: 0; }

  /* ---------- ② ゲームと ③ 面 ---------- */
  .pl-body { flex: 1 1 auto; min-height: 0; display: grid; grid-template-columns: minmax(0, 1fr); }
  .pl-body.is-panel { grid-template-columns: minmax(0, 1fr) 377px; }
  .pl-game { position: relative; min-width: 0; min-height: 0; background: var(--es-bg); display: grid; place-items: center; }
  .pl-frame { width: 100%; height: 100%; }
  /* 縦の作品：中央に縦長の枠（高さいっぱい・9:16）。幅が足りない端末では幅いっぱい */
  .pl-game[data-orient="portrait"] .pl-frame { height: 100%; width: min(100%, calc((100dvh - 44px) * 9 / 16)); }
  .pl-frame iframe { display: block; width: 100%; height: 100%; border: 0; background: var(--es-bg); }
  .pl-frame iframe:focus-visible { outline-offset: calc(var(--es-line-2) * -1); } /* ゲームに入力先がある印（Tab で入ったとき）。外の枠は帯や画面の端で切れるので内側に描く */
  .pl-loading { position: absolute; inset: 0; display: grid; place-items: center; background: var(--es-bg); }
  .pl:not(.is-loading) .pl-loading { display: none; }
  .pl-fail { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: var(--es-space-21); padding: var(--es-space-21); text-align: center; background: var(--es-bg); }
  .js .pl-fail:not(.is-on) { display: none; }
  .js .pl.is-failed .pl-frame { visibility: hidden; }
  @media (max-width: 609px) { .pl-fail.is-bar .pl-fail__t { flex: 1 0 100%; } .pl-fail.is-bar .tlink { display: none; } }
  /* 13 秒たっても load が来ないとき：ゲームは消さず、下に帯で「新しいタブで遊ぶ」 */
  .pl-fail.is-bar { inset: auto 0 0 0; flex-direction: row; flex-wrap: wrap; justify-content: center; gap: var(--es-space-8) var(--es-space-21); padding: var(--es-space-13) var(--es-space-21) calc(var(--es-space-13) + env(safe-area-inset-bottom)); background: var(--es-surface); border-top: var(--es-line-1) solid var(--es-rule); }
  .pl-fail.is-bar .pl-fail__poster, .pl-fail.is-bar .pl-fail__t:not(.pl-fail__t--bar), .pl-fail:not(.is-bar) .pl-fail__t--bar { display: none; }
  .pl-fail.is-bar .pl-fail__t { font-size: var(--es-text-16); line-height: var(--es-lh-16); font-weight: var(--es-fw-medium); }
  .pl-fail.is-bar .btn { min-height: 44px; padding: 0 var(--es-space-21); font-size: var(--es-text-16); }
  .pl-fail__poster { width: 233px; max-width: 50%; aspect-ratio: 2 / 3; height: auto; border: var(--es-line-1) solid var(--es-border); }
  .pl-fail__t { font-size: var(--es-text-21); line-height: var(--es-lh-21); font-weight: var(--es-fw-bold); color: var(--es-text-strong); }

  .pl-panel { display: flex; flex-direction: column; min-height: 0; min-width: 0; background: var(--es-surface); border-left: var(--es-line-1) solid var(--es-rule); }
  .pl-panel[hidden] { display: none; }
  .pl-panel__head { display: flex; align-items: center; justify-content: space-between; gap: var(--es-space-8); padding: var(--es-space-5) var(--es-space-5) 0 var(--es-space-21); }
  .pl-panel__h { font-size: var(--es-text-16); line-height: var(--es-lh-16); }
  .pl-panel__tabs { padding: 0 0 var(--es-space-5); border-bottom: var(--es-line-1) solid var(--es-rule); }
  .pl-panel__tabs .cm-tabs { flex-wrap: nowrap; flex: 0 0 auto; }
  .pl-panel__tabs .cm-bar__scroll { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; padding: var(--es-space-5) var(--es-space-21); }
  .pl-panel__tabs .cm-bar__scroll::-webkit-scrollbar { display: none; }
  .pl-panel__tabs .chip { height: 30px; font-size: var(--es-text-13); }
  .pl-panel__scroll { flex: 1 1 auto; min-height: 0; overflow-y: auto; padding: 0 var(--es-space-21) var(--es-space-21); overscroll-behavior: contain; }
  .pl-panel__scroll .cm-notice { margin-top: var(--es-space-13); }
  .pl-panel__scroll .cm-feed { margin-top: var(--es-space-8); }
  .pl-panel__scroll .cm-list { border-top: 0; }
  .pl-panel__scroll .cm-post:last-child { border-bottom: 0; }
  .pl-panel__scroll .cm-more__list { min-width: 0; width: max-content; max-width: 233px; }
  .pl-panel__write { flex: 0 0 auto; padding: var(--es-space-13) var(--es-space-21) calc(var(--es-space-13) + env(safe-area-inset-bottom)); border-top: var(--es-line-1) solid var(--es-rule); background: var(--es-surface); }
  .pl-panel .cm-gate, .pl-panel .cm-only, .pl-panel .cm-form { background: var(--es-bg); }
  .pl-panel .cm-form { grid-template-columns: minmax(0, 1fr); }
  .pl-panel .cm-form__me { display: none; }
  .pl-panel .cm-to .chip { height: 30px; font-size: var(--es-text-13); }

  /* ---------- 狭い幅：作り手と「エクストラステージ」を出さず、面は開かない（メインステージへのリンク） ---------- */
  @media (max-width: 986px) {
    .pl-maker, .pl-tool--extra, .pl-tool--panel { display: none; }
    .pl-tool--tab { padding: 0; width: 44px; justify-content: center; }
    .pl-tool--tab > .pl-tool__t { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; } /* 狭い幅は記号だけ（名前は aria-label） */
    .pl-chat-m { display: inline-flex; padding: 0 var(--es-space-8); gap: var(--es-space-5); } /* 字の無いアイコンだけにしない（G-C R2 の 4）：「メインステージ」と読める名前を付ける */
    .pl-body.is-panel { grid-template-columns: minmax(0, 1fr); }
    .pl-panel { display: none; }
    .pl-c5 .cmini__state, .pl-c5 .cmini__title { display: none; }
  }
  /* 端末を横にしていて、高さが 500 未満：帯をたたみ、左上に戻る丸だけ */
  /* 390：作品名は 2 行まで（16／20。帯の高さ 44 の中に入る）。折る所は作品名の決まり（gname）だけ */
  @media (max-width: 609px) {
    .pl-name { white-space: normal; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; line-height: 20px; }
    .pl-bar { gap: var(--es-space-8); }
    .pl-chat-m > .ico { display: none; } /* 狭い幅は字だけ（名前を残す幅を作る） */
    /* C-5 は開催中の点だけ（熾の点＝開催中。W-3）。残りの時間・題は読み上げにだけ残す（作品名と「メインステージ」の字を削らないため） */
    .pl-c5 .cmini { min-width: 24px; justify-content: center; gap: 0; }
    .pl-c5 .cmini__state, .pl-c5 .cmini__title, .pl-c5 .cmini .num { display: inline; position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
  }
  @media (orientation: landscape) and (max-height: 499px) {
    .pl-bar, .pl-rotate { display: none; }
    .pl-fab { display: inline-flex; align-items: center; justify-content: center; position: fixed; left: max(var(--es-space-8), env(safe-area-inset-left)); top: max(var(--es-space-8), env(safe-area-inset-top)); z-index: 20; width: 44px; height: 44px; border-radius: 50%; background: var(--es-bg); box-shadow: inset 0 0 0 var(--es-line-1) var(--es-border); color: var(--es-text-strong); }
  }
  /* 全画面の間 */
  .pl-game:fullscreen { width: 100vw; height: 100vh; }
}
@layer page {
  /* 面（消炭）の上のメンバーの丸（消炭）は見えないため、墨に */
  .pl-panel .mark--member { background: var(--es-color-sumi); }
  /* 運営の板（16 の 2.3）：面が消炭なので、板は一段ちがう墨にする（消炭の上の消炭では板が見えない） */
  .pl-panel .cm-post__body { background: var(--es-bg); }
}
