/* 左メニューのアフィリエイト枠：幅960px以上・編集画面以外で追従。
   左記事メニューは320pxにし、画像はメニュー幅に収めます。 */
@media screen and (min-width: 960px) {
  body:not(.atwiki_pedit) #atwiki-jp-bg2 .atwiki-container > .atwiki-left-column {
    width: 320px;
    flex: 0 0 320px;
    align-self: stretch;
    display: flex;
    flex-direction: column;
  }

  body:not(.atwiki_pedit) #atwiki-jp-bg2 .atwiki-container > .atwiki-main-column {
    width: auto;
    min-width: 0;
    flex: 1 1 0;
  }

  body:not(.atwiki_pedit) #menubar {
    flex: 1 1 auto;
    display: flex;
    flex-direction: column;
    overflow: visible;
  }

  body:not(.atwiki_pedit) #menubar > .atwiki-contents {
    flex: 1 1 auto;
    overflow: visible;
  }

  body:not(.atwiki_pedit) #menubar .affiliatebox {
    position: sticky;
    top: 80px;
    box-sizing: border-box;
    max-height: calc(100vh - 100px);
    overflow: auto;
    margin-top: 16px;
    padding: 10px;
  }

  body:not(.atwiki_pedit) #menubar .affiliatebox img {
    box-sizing: border-box;
    max-width: 100%;
    height: auto;
  }
}

/* 右メニュー：各項目の更新履歴が0件なら見出しごと非表示。 */
#menubar2 .recentarmiosion:not(:has(li a[href])),
#menubar2 .recentothers:not(:has(li a[href])) {
  display: none;
}

/* 右メニューの更新履歴：「アルミオシオンの医術師/」を省略。
   ページを追加・改名した際は、短縮名と下の対象URL一覧も更新してください。 */
#menubar2 .plugin_recent_child a[href$="/16.html"] { --short-name: "Q&A"; }
#menubar2 .plugin_recent_child a[href$="/23.html"] { --short-name: "行き詰りやすいところ"; }
#menubar2 .plugin_recent_child a[href$="/18.html"] { --short-name: "MAP"; }
#menubar2 .plugin_recent_child a[href$="/25.html"] { --short-name: "フィールドボス"; }
#menubar2 .plugin_recent_child a[href$="/30.html"] { --short-name: "地下闘技場"; }
#menubar2 .plugin_recent_child a[href$="/31.html"] { --short-name: "旧市街"; }
#menubar2 .plugin_recent_child a[href$="/40.html"] { --short-name: "メンテナンスポート"; }
#menubar2 .plugin_recent_child a[href$="/22.html"] { --short-name: "メインストーリー"; }
#menubar2 .plugin_recent_child a[href$="/17.html"] { --short-name: "エンディング種類"; }
#menubar2 .plugin_recent_child a[href$="/13.html"] { --short-name: "クエスト"; }
#menubar2 .plugin_recent_child a[href$="/19.html"] { --short-name: "サブイベント"; }
#menubar2 .plugin_recent_child a[href$="/20.html"] { --short-name: "装備"; }
#menubar2 .plugin_recent_child a[href$="/21.html"] { --short-name: "特技・パッシブスキル"; }
#menubar2 .plugin_recent_child a[href$="/46.html"] { --short-name: "戦術"; }
#menubar2 .plugin_recent_child a[href$="/26.html"] { --short-name: "アイテム・大事なもの"; }
#menubar2 .plugin_recent_child a[href$="/45.html"] { --short-name: "調合・武器強化"; }
#menubar2 .plugin_recent_child a[href$="/44.html"] { --short-name: "ショップ"; }
#menubar2 .plugin_recent_child a[href$="/24.html"] { --short-name: "システム"; }
#menubar2 .plugin_recent_child a[href$="/29.html"] { --short-name: "Tips"; }
#menubar2 .plugin_recent_child a[href$="/39.html"] { --short-name: "回想"; }
#menubar2 .plugin_recent_child a[href$="/42.html"] { --short-name: "使用BGM"; }

#menubar2 .plugin_recent_child a:is(
  [href$="/16.html"],
  [href$="/23.html"],
  [href$="/18.html"],
  [href$="/25.html"],
  [href$="/30.html"],
  [href$="/31.html"],
  [href$="/40.html"],
  [href$="/22.html"],
  [href$="/17.html"],
  [href$="/13.html"],
  [href$="/19.html"],
  [href$="/20.html"],
  [href$="/21.html"],
  [href$="/46.html"],
  [href$="/26.html"],
  [href$="/45.html"],
  [href$="/44.html"],
  [href$="/24.html"],
  [href$="/29.html"],
  [href$="/39.html"],
  [href$="/42.html"]
) {
  font-size: 0;
}

#menubar2 .plugin_recent_child a:is(
  [href$="/16.html"],
  [href$="/23.html"],
  [href$="/18.html"],
  [href$="/25.html"],
  [href$="/30.html"],
  [href$="/31.html"],
  [href$="/40.html"],
  [href$="/22.html"],
  [href$="/17.html"],
  [href$="/13.html"],
  [href$="/19.html"],
  [href$="/20.html"],
  [href$="/21.html"],
  [href$="/46.html"],
  [href$="/26.html"],
  [href$="/45.html"],
  [href$="/44.html"],
  [href$="/24.html"],
  [href$="/29.html"],
  [href$="/39.html"],
  [href$="/42.html"]
)::after {
  content: var(--short-name);
  font-size: 14px;
}

/* 左右の記事メニュー：行間を少し詰める */
#menubar .atwiki-contents,
#menubar2 .atwiki-contents,
#menubar .atwiki-contents :is(p, li, dt, dd),
#menubar2 .atwiki-contents :is(p, li, dt, dd) {
  line-height: 1.25;
}

/* コンテンツ領域の外側余白 */
.atwiki-contents {
  margin: 0;
}


/* Bootstrap版「ページ一覧」用。前のページ一覧用CSSと差し替えて使用。 */

#wikibody > h3:has(+ .cmd_pagelist_search) {
  display: none;
  margin: 16px 0 12px;
  padding: 10px 8px;
  border: 0;
  border-left: 2px solid #f90;
  border-radius: 0;
  background: #404040;
  color: #fff;
  font-size: 20px;
  font-weight: 700;
  line-height: 1.5;
}

#wikibody .cmd_pagelist_search {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px;
  margin: 10px 0;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  color: #404040;
  font-size: 14px;
}

#wikibody .cmd_pagelist_search input[type="text"] {
  box-sizing: border-box;
  flex: 0 1 50%;
  width: 50%;
  min-width: 0;
  height: 25px;
  margin: 4px 0;
  padding: 1px 2px;
  border: 1px solid #bbb;
  border-radius: 4px;
  background: #fff;
  color: #404040;
  font: inherit;
}

#wikibody .cmd_pagelist_search button {
  flex: 0 0 auto;
  width: auto;
  min-height: 25px;
  margin: 0;
  padding: 1px 6px;
  border: 1px solid #999;
  border-radius: 2px;
  background: #efefef;
  color: #404040;
  font: inherit;
  cursor: pointer;
}

#wikibody .cmd_pagelist_search button:hover {
  background: #eaeaea;
}

#wikibody div.pagelist {
  color: #404040;
  font-size: 14px;
  line-height: 1.5;
}

#wikibody div.pagelist::before {
  content: "一覧から探す";
  display: block;
  margin: 16px 0 12px;
  padding: 10px 8px;
  border-left: 2px solid #f90;
  background: #404040;
  color: #fff;
  font-size: 20px;
  font-weight: 700;
  line-height: 1.5;
}

/* 並び替えは元のリンクをそのまま使用。 */
#wikibody div.pagelist > p:first-child {
  display: flex;
  flex-wrap: wrap;
  gap: 0;
  margin: 0;
  padding: 8px 0;
  background: #f8f8f8;
  color: transparent;
  font-size: 0;
  line-height: 1.5;
}

#wikibody div.pagelist > p:first-child a {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 24px;
  margin: 0;
  padding: 0 10px;
  border-right: 1px solid #d9d9d9;
  color: #404040;
  font-size: 0;
  font-weight: 400;
  text-decoration: none;
}

/* 参考デザインと同じ3項目。操作は元の並び替えリンク。 */
#wikibody div.pagelist > p:first-child a:nth-child(3),
#wikibody div.pagelist > p:first-child a:nth-child(5),
#wikibody div.pagelist > p:first-child a:nth-child(6) {
  display: none;
}

#wikibody div.pagelist > p:first-child a::before {
  content: "";
  box-sizing: border-box;
  width: 13px;
  height: 13px;
  border: 1px solid #999;
  border-radius: 50%;
  background: #fff;
}

#wikibody div.pagelist > p:first-child a::after {
  font-size: 12px;
}

#wikibody div.pagelist > p:first-child a:nth-child(1)::after { content: "人気順"; }
#wikibody div.pagelist > p:first-child a:nth-child(2)::after { content: "更新順"; }
#wikibody div.pagelist > p:first-child a:nth-child(4)::after { content: "作成日時順"; }
#wikibody div.pagelist > p:first-child a:nth-child(4) { border-right: 0; }

/* 検索フォームに保持されている実際の並び順を表示。 */
#wikibody:has(.cmd_pagelist_search input[name="sort"][value=""]) div.pagelist > p:first-child a:nth-child(2)::before,
#wikibody:has(.cmd_pagelist_search input[name="sort"][value="update"]) div.pagelist > p:first-child a:nth-child(2)::before,
#wikibody:has(.cmd_pagelist_search input[name="sort"][value="popular"]) div.pagelist > p:first-child a:nth-child(1)::before,
#wikibody:has(.cmd_pagelist_search input[name="sort"][value="create_desc"]) div.pagelist > p:first-child a:nth-child(4)::before {
  border-color: #1684e8;
  background: #1684e8;
  box-shadow: inset 0 0 0 3px #fff;
}

#wikibody div.pagelist > p:first-child a:last-child {
  border-right: 0;
}

#wikibody div.pagelist > hr {
  display: none;
}

#wikibody div.pagelist > p:not(:first-child) {
  display: none;
  margin: 0;
  color: #666;
  font-size: 12px;
}

#wikibody table.pagelist {
  width: 100%;
  margin: 12px 0;
  border: 1px solid #ddd;
  border-collapse: collapse;
  table-layout: fixed;
  background: #fff;
}

/* データ行をリスト風にし、更新時間・ページ名・削除の順に配置。 */
#wikibody table.pagelist tr:first-child {
  display: none;
}

#wikibody table.pagelist tr {
  background: transparent;
}

#wikibody table.pagelist td {
  display: grid;
  grid-template-columns: 64px minmax(0, 1fr) auto;
  align-items: baseline;
  gap: 0 4px;
  margin: 0;
  padding: 10px;
  border: 0;
  border-bottom: 1px solid #e5e5e5;
  background: #fff;
  color: #999;
  font-size: 12px;
  font-weight: 400;
  line-height: 1.5;
  overflow-wrap: anywhere;
}

#wikibody table.pagelist tr:nth-child(odd):not(:first-child) td {
  background: #f8f8f8;
}

#wikibody table.pagelist tr:last-child td {
  border-bottom: 0;
}

#wikibody table.pagelist td > a:first-child {
  order: 1;
  grid-column: 2;
  grid-row: 1;
  flex: 1 1 120px;
  min-width: 0;
  margin: 0;
  color: #0066dc;
  font-size: 14px;
  font-weight: 700;
  text-decoration: none;
}

#wikibody table.pagelist td > a[href*="action=delete"] {
  order: 2;
  grid-column: 3;
  grid-row: 1;
  flex: 0 0 auto;
  margin: 0;
  color: #666;
  font-size: 12px;
  font-weight: 400;
}

#wikibody div.pagelist a:hover {
  text-decoration: underline;
}

#wikibody .cmd_pagelist_search :is(input, button):focus-visible,
#wikibody div.pagelist a:focus-visible {
  outline: 2px solid #0066dc;
  outline-offset: 2px;
}

@media screen and (max-width: 480px) {
  #wikibody .cmd_pagelist_search > span {
    flex-basis: 100%;
  }

  #wikibody .cmd_pagelist_search input[type="text"] {
    flex: 1 1 180px;
    font-size: 16px;
  }

  #wikibody .cmd_pagelist_search .random_page_link {
    width: 100%;
  }
}