/* ==========================================================================
   アプリ型レイアウト（lib/nettoge/inc/platform/app-layout.php。記事のメタ nettoge_layout = app）。2026-09-26
   依頼主「シミュレータ用レイアウトとして汎用化する、攻略メニューまわりはアクセスしやすくし、サイドバーなくして
   シミュレータとしてちゃんとしたものに」。道具（シミュレータなど）は本文の幅いっぱいを使い、地の文は読み幅に絞る。
   道具の側の見た目は道具の持ち主（NettogeCore の各モジュール）が書く。ここは外枠・帯・攻略メニューの引き出しだけ
   ========================================================================== */

#body_wrap.-ntg-app {
  --nettoge-content-width: 100%;
  --block_max_width: 100%;
  --ntg-app-measure: 820px;
  --ntg-app-top: calc(var(--swl-adminbarH, 0px) + var(--ntg2-header-h) + 1px);
}

/* サイドバーが無いときの記事の幅（SWELL の .l-article の 900px）を外し、入れ物（--container_size）いっぱいにする */
#body_wrap.-ntg-app #main_content.l-article {
  max-width: none;
}

/* 地の文は読み幅に絞って真ん中に。道具（.ntg-app-wide を付けた物）と広い表・図は幅いっぱい */
#body_wrap.-ntg-app .post_content > :not(.ntg-app-wide):not(.alignwide):not(.alignfull) {
  max-width: var(--ntg-app-measure);
  margin-left: auto;
  margin-right: auto;
}

#body_wrap.-ntg-app .p-articleHead,
#body_wrap.-ntg-app .p-articleMetas {
  max-width: var(--ntg-app-measure);
  margin-left: auto;
  margin-right: auto;
}

/* ---- 記事の上の帯（ロゴ・道具の欄・攻略メニュー） ---- */
.ntg-app-bar {
  position: sticky;
  top: var(--ntg-app-top);
  z-index: 20;
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 52px;
  margin: 0 0 16px;
  padding: 6px 12px;
  background: var(--ntg2-surface);
  border: 1px solid var(--ntg2-line);
  border-radius: var(--ntg2-radius);
}

.ntg-app-bar__brand {
  display: inline-flex;
  flex: none;
  align-items: center;
  min-height: 40px;
  color: var(--ntg2-text);
  text-decoration: none;
}

.ntg-app-bar__logo img {
  display: block;
  width: auto;
  height: 28px;
  max-width: 140px;
  object-fit: contain;
}

#body_wrap .ntg-app-bar__logo img.ntg2-logo-light,
#body_wrap .ntg-app-bar__logo img.ntg2-logo-dark {
  height: 28px;
}

/* ロゴがあるときのゲーム名は読み上げだけ（SWELL の u-screen-reader-text はここでは効かないので自前で隠す） */
.ntg-app-bar__brand .u-screen-reader-text {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

.ntg-app-bar__game {
  font-size: 14px;
  font-weight: 700;
}

.ntg-app-bar__tools {
  display: flex;
  flex: 1 1 auto;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 12px;
  min-width: 0;
}

.ntg-app-bar__guide,
.ntg-app-dock__guide,
.ntg-app-guide__close {
  font: inherit;
  cursor: pointer;
}

.ntg-app-bar__guide {
  flex: none;
  min-height: 36px;
  padding: 0 14px;
  color: var(--ntg2-text);
  font-size: 13px;
  font-weight: 700;
  background: var(--ntg2-bg);
  border: 1px solid var(--ntg2-line-2);
  border-radius: 999px;
}

.ntg-app-bar__guide:hover {
  border-color: var(--ntg2-accent);
}

.ntg-app-bar__guide:focus-visible,
.ntg-app-dock__guide:focus-visible,
.ntg-app-guide__close:focus-visible {
  outline: 2px solid var(--ntg2-accent);
  outline-offset: 2px;
}

/* ---- スマホの下の帯（攻略・道具の操作） ---- */
.ntg-app-dock {
  display: none;
}

@media (max-width: 959px) {
  #body_wrap.-ntg-app {
    --ntg-app-top: calc(var(--swl-adminbarH, 0px) + var(--ntg2-header-h-sp) + 1px);
    padding-bottom: calc(64px + env(safe-area-inset-bottom, 0px));
  }

  .ntg-app-bar {
    min-height: 44px;
    margin: 0 0 10px;
    padding: 4px 10px;
    border-radius: var(--ntg2-radius-sm);
  }

  .ntg-app-bar__logo img,
  #body_wrap .ntg-app-bar__logo img.ntg2-logo-light,
  #body_wrap .ntg-app-bar__logo img.ntg2-logo-dark {
    height: 22px;
    max-width: 96px;
  }

  .ntg-app-bar__guide {
    display: none;
  }

  .ntg-app-dock {
    position: fixed;
    right: 0;
    bottom: 0;
    left: 0;
    z-index: 997;
    display: flex;
    gap: 6px;
    padding: 8px 10px calc(8px + env(safe-area-inset-bottom, 0px));
    background: var(--ntg2-surface);
    border-top: 1px solid var(--ntg2-line-2);
  }

  .ntg-app-dock__guide {
    flex: 1 1 0;
    min-height: 44px;
    color: var(--ntg2-text);
    font-size: 14px;
    font-weight: 700;
    background: var(--ntg2-bg);
    border: 1px solid var(--ntg2-line-2);
    border-radius: var(--ntg2-radius-sm);
  }

  .ntg-app-dock__tools {
    display: flex;
    flex: 2 1 0;
    gap: 6px;
  }

  .ntg-app-dock__tools:empty {
    display: none;
  }
}

/* ---- 攻略メニューの引き出し（右から。スマホは画面いっぱい） ---- */
/* ログイン時の管理バー（z-index 99999）より前に出す。開いている間は管理バーが隠れてよい */
.ntg-app-guide {
  position: fixed;
  inset: 0;
  z-index: 100000;
}

.ntg-app-guide[hidden] {
  display: none;
}

.ntg-app-guide__back {
  position: absolute;
  inset: 0;
  background: rgb(0 0 0 / 0.35);
}

.ntg-app-guide__panel {
  position: absolute;
  top: 0;
  right: 0;
  bottom: 0;
  display: flex;
  flex-direction: column;
  width: min(360px, 100%);
  background: var(--ntg2-bg);
  border-left: 1px solid var(--ntg2-line-2);
  box-shadow: var(--ntg2-shadow-float);
}

.ntg-app-guide__head {
  display: flex;
  flex: none;
  align-items: center;
  justify-content: flex-end;
  min-height: 48px;
  padding: calc(env(safe-area-inset-top, 0px) + 2px) 6px 2px 16px;
  color: var(--ntg2-text);
  font-size: 15px;
  font-weight: 700;
  border-bottom: 1px solid var(--ntg2-line);
}

.ntg-app-guide__close {
  width: 44px;
  height: 44px;
  color: var(--ntg2-text);
  font-size: 22px;
  line-height: 1;
  background: none;
  border: 0;
  border-radius: 50%;
}

.ntg-app-guide__body {
  flex: 1 1 auto;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 12px 12px calc(16px + env(safe-area-inset-bottom, 0px));
}

@media (max-width: 599px) {
  .ntg-app-guide__panel {
    width: 100%;
    border-left: 0;
  }
}
