/* ===================
 全体への装飾
=================== */

:root {
  interpolate-size: allow-keywords;

  --min-width768: 95%;
  --max-width768: 85%;
  --address-first-mark: "";
  --address-last-mark: "";

  color-scheme: light only;
}

* {
  margin: 0;
  padding: 0;
}

@font-face {
  font-family: saitamaar;
  src: url('https://oxymoronic.neocities.org/Font/saitamaar-regular.woff2') format('woff2'),
    url('https://oxymoronic.neocities.org/Font/saitamaar-regular') format('woff'),
    url('https://oxymoronic.neocities.org/Font/saitamaar-regular.ttf') format('ttf');
  font-display: swap;
}

@font-face {
  font-family: "UDEV Gothic HSNFLG";
  src: url("/txt/UDEVGothicHSNFLG-Regular.woff2") format("woff2");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: "UDEV Gothic HSNFLG";
  src: url("/txt/UDEVGothicHSNFLG-Bold.woff2") format("woff2");
  font-weight: 700;
  font-style: normal;
  font-display: swap;
}

.saitamaar-light {
  font-family: saitamaar, sans-serif;
  white-space: pre;
  font-size: 16px;
  line-height: 18px;
}

html {
  width: 100%;
  height: 100%;
  overflow: hidden;
}

body {
  width: 100%;
  height: 100%;
  font-size: 11pt;
  font-family: saitamaar, PikoA, "Helvetica Neue", Helvetica, Arial, system-ui, sans-serif;
  word-break: auto-phrase;
  transition: background-color 0.3s, color 0.3s;
}

#wrapper {
  padding-left: 40px;
}

img {
  width: 100%;
  height: auto;
  image-rendering: pixelated;
}

::selection {
  color: #fff;
  background-color: light-dark(#00f, #ccc);
}

h1,
h2 {
  padding-top: 1.5rem;
  scale: 1 0.8;
}

h1.title {
  font-size: 1.5rem;
  text-align: right;
  line-height: 24px;
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  white-space: nowrap;
  border: 0;
  clip-path: inset(50%);
}

/* デフォルト状態：ぼかし効果 */
.nsfw img {
  filter: blur(20px);
  display: block;
  width: 100%;
  height: auto;
  pointer-events: auto;
  user-select: none;
}

a {
  color: light-dark(black, #fff);
  transition: color 0.1s linear(0, 0.45, 0.48, 0.52, 0.55, 1), background-color 0.1s linear(0, 0.45, 0.48, 0.52, 0.55, 1);

  &:hover {
    color: #fff;
    background-color: light-dark(black, #888);
    
    img {
      font-size: 0;
      color: transparent;
      background-color: transparent;
    }
  }
}

button {
  appearance: none;
  border: 0;
  border-radius: 0;
  background: none;
}

/* 外部リンクアイコンのスタイル */
a[href^="http"]::after {
  content: "";
  display: inline-block;
  background-image: url("external_link-icon1x2.png");
  image-rendering: auto;
  margin-left: 3px;
  margin-right: 1px;
  vertical-align: middle;
  transform: translateY(-2px);
  background-size: contain;
  background-repeat: no-repeat;
  background-position: inherit;
}

a[href^="http"]:hover::after {
  filter: invert(1);
}

.article-body a[href^="http"]::after {
  width: 12px;
  height: 20px;
  transform: translateY(-3px);
}

#galleryspace a[href^="http"]::after {
  width: 12px;
  height: 20px;
  margin-left: 2px;
}

#textblock a[href^="http"]::after {
  width: 12px;
  height: 20px;
}

#footerhtml a[href^="http"]::after {
  width: 10px;
  height: 14px;
}

/* ===================
  headerBlock
=================== */

#header-flex {
  display: flex;
  position: absolute;
  align-items: center;
  width: 100%;
  will-change: transform;
}

a#backicon,
a.addressbar {
  color: light-dark(black, #ddd);
  overflow: auto;
  text-decoration: none;
  
  &:hover {
    background-color: transparent;
  }
}

#back,
#address {
  position: relative;
  top: -3px;
  font-size: large;
  background-color: light-dark(transparent, #444);
  backdrop-filter: blur(4px);
  filter: grayscale(100%);
  font-weight: bold;
  line-height: 18px;
  z-index: 10;
}

#back {
  width: 30px;
  margin-right: 20px;
}

#address {
  margin-left: max(calc(50% - 350px), 11.5%);
  margin-right: 40px;
  transform: scale(1.15, 0.85);
}

.breadcrumb {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  column-gap: 0.5em;
  flex-wrap: wrap;

  a {
    text-decoration: none;

    &:hover {
      background-color: transparent;
      color: #000;
    }
  }
}

.breadcrumb li::after {
  content: "/";
  margin-left: 0.5em;
}

.breadcrumb li:first-child::after {
  content: "::";
}

.breadcrumb li:last-child::after {
  content: "";
  margin-left: 0;
}

.breadcrumb li[aria-current="page"] {
  font-weight: bold;

  &::before {
    content: var(--address-first-mark);
  }

  &::after {
    content: var(--address-last-mark);
  }
}

/* ===================
 mainBlock
=================== */

/* カテゴリヘッダー */
#category-header {
  .main-category,
  .sub-category {
    list-style: none;
    line-height: 1;
    display: flex;
    flex-direction: row;
    flex-wrap: wrap;
    column-gap: 1rem;
    font-size: 0.8em;

    &.main-category {
      margin-bottom: 5px;
      text-wrap: nowrap;

      a::before {
        content: "";
        background-image: url("/favicon.svg");
        background-size: contain;
        background-repeat: no-repeat;
        background-position: center;
        display: inline-block;
        width: 11px;
        height: 11px;
        vertical-align: bottom;
        margin-right: 3px;
      }
      
      a:hover::before {
        filter: invert(1);
      }
    }

    &.sub-category {      
      margin-bottom: 5px;

      a::before {
        content: "♥";
        margin-right: 1px;
      }
    }

    li {
      background-color: #ddd;
      padding-top: 1px;

      a {
        text-decoration: none;
      }
    }

    span {
      margin-left: 0.5rem;

      &::before {
        content: "-";
        margin-right: 0.5rem;
      }
    }
  }

  nav:not(:has(.main-category)) ol.sub-category:first-child {
    margin-top: calc(1rem + 2px);
  }

  #toc-list {
    margin-top: 1rem;
    margin-left: 5px;
    list-style: none;
    display: inline-flex;
    flex-direction: column;
    gap: 5px;
    font-size: 0.8em;
    z-index: -10;

    li a {
      padding-top: 2px;
      padding-right: 2px;
      margin-right: 0!important;
      background-color: transparent;
      text-decoration: none;
    }

    li::before {
      content: "§";
      padding-top: 2px;
      padding-right: 2px;
      background-color: transparent;
    }
  }
}

#main,
#main-footer {
  width: 100%;
  max-width: none;
}
}

.header-link {
  opacity: 0.2;
  padding: 0 1em;
  margin-left: 1em;
  text-decoration: none;
  color: black;
  transition: opacity 0.2s;
}

.header-link:hover {
  color: black;
  background-color: transparent;
  opacity: 1;
}

.youtube {
  width: 100%;
  height: 400px;
}

.card {
  margin-bottom: 40px;
}

.piccard {
  a:hover {
    text-decoration: none;
    background-color: transparent;
  }
}

.caption {
  p {
    margin-bottom: 1rem;

    &:last-child {
      margin-bottom: 0;
    }
  }

  a:hover {
    background-color: light-dark(black, #444);
  }

  details {
    &::details-content {
      @media (prefers-reduced-motion: no-preference) {
        overflow: clip;
        transition-duration: 35ms;
        transition-property: content-visibility, block-size;
        transition-behavior: allow-discrete;
      }
    }

    &:not([open])::details-content {
      block-size: 0;
    }
  }

  summary {
    display: inline-block;
    list-style: none;

    &::before {
      display: inline;
      content: "+";
      margin-right: 5px;
      background-color: #888;
      color: #fff;
      padding: 2px 4px;
    }

    [open] &::before {
      display: inline;
      content: "-";
      background-color: #888;
      color: #fff;
      padding: 2px 4px;
    }
  }
}

.youtube-16-9 {
  width: 100%;
  aspect-ratio: 16 / 9;
}

.youtube-16-9 iframe {
  width: 100%;
  height: 100%;
}

p.date {
  display: block;
  text-align: right;
  font-size: 0.8em;
  color: light-dark(#aaa, #aaa);
  white-space: nowrap;
  overflow: hidden;
}

nav {  
  &.childpagearrow {
    text-align: right;
    
    a {
      background-color: #000;
      color: #fff;
      text-decoration: none;
    }
  }
}

.rowarrow {
  display: flex;
  flex-direction: row;
  justify-content: space-between;
  
  a {
    background-color: #000;
    color: #fff;
    text-decoration: none;
    padding: 2px 4px;
  }

  .rightarrow {
    padding-right: 2px!important;
    padding-left: 5px!important;
  }
}

.lum-lightbox-inner img {
  max-width: 100%;
  width: auto;
  height: auto;
  object-fit: contain;
}

/* Firefox専用の追加修正 */
@-moz-document url-prefix() {
  .lum-lightbox-inner img {
    max-width: 100% !important;
    width: auto !important;
    height: auto !important;
    display: block;
    margin: 0 auto;
  }
}

/* ================================
   NSFWフィルター機能（piccardベース・caption問題解決版）
================================ */

/* NSFWフィルター基本設定 */
.nsfw {
  position: relative;
}

/* ぼかしはみ出し防止のための画像コンテナ設定 */
.nsfw > a {
  display: block;
  overflow: hidden;
  border-radius: inherit;
}

.related-item.nsfw img{
  filter: blur(5px);
}

/* フィルター解除状態 */
.nsfw.revealed img {
  filter: none;
  transition: filter 0.15s ease-out;
}

/* 警告オーバーレイ */
.nsfw::before {
  content: "閲覧注意\Aクリックして表示";
  white-space: pre;
  position: absolute;
  top: 44%;
  left: 50%;
  transform: translate(-50%, -50%);
  background: rgb(0 0 0 / 20%);
  color: white;
  padding: 8px 4px;
  border-radius: 4px;
  text-align: center;
  font-size: 12px;
  line-height: 1.4;
  cursor: pointer;
  z-index: 10;
  pointer-events: auto;

  /* iOS向けタッチ対応 */
  user-select: none;
  -webkit-touch-callout: none;
}

.related-item.nsfw::before {
  top: 44%;
  font-size: 9px;
}

/* フィルター解除状態 */
.nsfw.revealed::before {
  display: none;
}

/* フィルター復活ボタン */
.nsfw.revealed::after {
  content: "隠す";
  position: absolute;
  top: -30px;
  right: 0;
  background: rgb(0 0 0 / 5%);
  color: black;
  padding: 6px 12px;
  border-radius: 2px;
  font-size: 12px;
  cursor: pointer;
  z-index: 10;
  backdrop-filter: blur(5px);
  transition: background-color 0.2s ease;

  /* iOS向けタッチ対応 */
  user-select: none;
  -webkit-touch-callout: none;
}

/* ライトボックス表示時は通常状態の「隠す」ボタンを非表示 */
.lum-lightbox .nsfw.revealed::after {
  display: none;
}

.related-item.nsfw.revealed::after {
  top: -14px;
  padding: 3px 8px;
  font-size: 9px;
}

.nsfw.revealed::after:hover {
  background: rgb(85 85 85 / 90%);
  color: white;
}

/* iOS向けタッチ対応：related-itemは例外 */
.nsfw:not(.revealed) > a {
  cursor: pointer;
  pointer-events: none; /* NSFWフィルター未解除時はリンククリックを無効化 */
}

.related-item.nsfw:not(.revealed) > a {
  pointer-events: auto;
}

/* ライトボックス内NSFWフィルター */
.lum-lightbox .lum-img {
  filter: blur(20px);
}

.lum-lightbox .lum-lightbox-image-wrapper:not(.nsfw-filtered) .lum-img {
  filter: none !important;
}

.lum-lightbox .lum-lightbox-image-wrapper.nsfw-filtered::before {
  content: "閲覧注意\Aクリックして表示";
  white-space: pre;
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  background: rgb(0 0 0 / 20%);
  color: white;
  padding: 14px 10px;
  border-radius: 4px;
  text-align: center;
  font-size: 12px;
  line-height: 1.4;
  cursor: pointer;
  z-index: 10005;
  pointer-events: auto;
  display: block;

  /* iOS向けタッチ対応 */
  user-select: none;
  -webkit-touch-callout: none;
}

/* ライトボックス内でフィルター解除状態の「隠す」ボタン */
.lum-lightbox .lum-lightbox-image-wrapper:not(.nsfw-filtered).nsfw-revealed::after {
  content: "隠す";
  position: absolute;
  top: 20px;
  right: 20px;
  background: rgb(0 0 0 / 30%);
  color: white;
  padding: 8px 14px;
  border-radius: 3px;
  font-size: 12px;
  cursor: pointer;
  z-index: 10005;
  backdrop-filter: blur(5px);
  transition: background-color 0.2s ease;

  /* iOS向けタッチ対応 */
  user-select: none;
  -webkit-touch-callout: none;
  pointer-events: auto;
}

.lum-lightbox .lum-lightbox-image-wrapper:not(.nsfw-filtered).nsfw-revealed::after:hover {
  background: rgb(0 0 0 / 60%);
}

/* レスポンシブ対応 */
@media screen and (width <= 768px) {
  .nsfw::before,
  .lum-lightbox .lum-lightbox-image-wrapper.nsfw-filtered::before {
    font-size: 11px;
    padding: 12px 8px;
  }
  
  .nsfw.revealed::after {
    font-size: 10px;
    padding: 4px 6px;
    top: -28px;
  }
}

/* iOS Safari向け追加対応 */
@supports (-webkit-touch-callout: none) {
  .nsfw::before,
  .nsfw.revealed::after,
  .lum-lightbox .lum-lightbox-image-wrapper.nsfw-filtered::before {
    /* タッチ時のハイライトを無効化 */
    -webkit-tap-highlight-color: transparent;
  }
}

/* ===================
 galleryhtml
=================== */
.topborder {
  height: 1px;
  position: relative;
  
  &::before {
    content: "";
    background-image: linear-gradient(to right, light-dark(#000, #fff), light-dark(#000, #fff) 10px, transparent 3px, transparent 8px);
    background-size: 20px 1px;
    background-repeat: repeat-x;
    position: absolute;
    inset: 0;
  }
}

#gallerymaphtml {
  details {
    margin-bottom: 2px;

    &::details-content {
      @media (prefers-reduced-motion: no-preference) {
        overflow: clip;
        transition-duration: 35ms;
        transition-property: content-visibility, block-size;
        transition-behavior: allow-discrete;
      }
    }

    &:not([open])::details-content {
      block-size: 0;
    }
  }
  
  summary {
    display: inline-block;
    list-style: none;
    color: light-dark(#fff, #ccc);
    background-color: light-dark(#000, #555);
    padding-left: 3px;
    line-height: 1rem;
    transition: color 0.1s linear(0, 0.45, 0.48, 0.52, 0.55, 1), background-color 0.1s linear(0, 0.45, 0.48, 0.52, 0.55, 1);;

    &:hover {
      color: light-dark(#000, #ddd);
      background-color: light-dark(#fff, #444);
    }

    &::before {
      display: inline;
      content: "+";
      margin-right: 5px;
    }

    [open] &::before {
      display: inline;
      content: "-";
      margin-right: 5px;
    }

    h3 {
      display: inline-block;
      font-weight: normal;
      font-size: 1rem;
    }

    a {
      background-color: #fff;
      color: #000;
      text-decoration: none;
      padding-left: 5px;
      font-size: 1.1rem;
      transition: 0.1s linear(0, 0.45, 0.48, 0.52, 0.55, 1), background-color 0.1s linear(0, 0.45, 0.48, 0.52, 0.55, 1);

      &:hover {
        color: #fff;
        background-color: #000;
        padding-left: 2px;
        margin-left: 3px;
      }
    }
  }
}

#rootbox {
  padding-left: 1px;
}

.summary-boxes {
  border-left: dotted 2px light-dark(#000, #555);
  padding-left: 10px;
  margin: 5px 0 5px 5px;

  a {
    margin-right: 0.5rem;
  }
}

.lowerbox {
  text-indent: -33px;
  padding-left: 32px;
  margin-top: 3px;
  margin-left: -0.14rem;
}

#works-content {
  p::before {
    content: ">";
    margin-right: 2px;
  }

  .boxes {
    margin-bottom: 5px;
  }
}

.boxes {
  line-height: 20px;
  font-size: 18px;
  text-decoration: none;
  
  > p {
    display: inline;
    letter-spacing: -0.05em;
  }
  
  a {
    text-decoration: none;
  }
}

/* ===================
  linksBlock
=================== */
.nav-links,
#foot-links {
  font-size: 0.8em;
  margin-top: 30px;

  a {
    text-decoration: none;
  }

  li {
    white-space: nowrap;
    margin-top: -0.5rem;
  }

  ul {
    display: flex;
    flex-wrap: wrap;
    column-gap: 1rem;
    list-style: none;

    li a , button:first-child {
      margin-right: 14px;
    }

    li:first-child::after {
      content: "|";
    }
  }
}

.nav-links li::before {
  content: "";
  background-image: url("/favicon.svg");
  background-size: contain;
  background-repeat: no-repeat;
  background-position: center;
  display: inline-block;
  width: 11px;
  height: 11px;
  vertical-align: middle;
  margin-right: 3px;
}

#foot-links li::before {
  content: "♥";
  margin-right: 2px;
}

#foot-links {
  max-width: 600px;
  margin-top: 20px;
}

#favorite-links {
  padding-left: 0.5em;
  margin-bottom: 60px;
  margin-right: 50px;
}

.footer-button {
  background: none;
  border: none;
  padding: 0;
  font: inherit;
  color: inherit;
  text-decoration: inherit;
  cursor: pointer;
  
  &:hover {
    text-decoration: underline;
  }
}

/* ===================
  footerBlock
=================== */
#footer {
  display: flex;
  align-items: flex-end;
  position: relative;
  justify-content: space-between;
  width: 100%;
  background-color: transparent;
  will-change: transform;
}

#foot-comment {
  display: inline;
  font-size: 0.8em;
  margin-top: 23px;
  line-height: 1.4;
}

/* フッター統計情報のスタイル */
#foot-comment #last-update {
  font-feature-settings: "tnum";
  white-space: nowrap;
}

#foot-comment #random-msg {
  display: inline-block;
  position: relative;
  cursor: pointer;
  user-select: none;
  text-align: center;
  min-width: 1em;
}

.logo {
  .logo-button {
    background: none;
    border: none;
    padding: 0;
    margin: 0;
    cursor: pointer;
    display: inline-block;
    
    &:hover {
      background-color: transparent;
    }
  }

  &::before {
    content: "";
    display: inline-block;
    width: 35px;
    height: 12px;
    background-image: url("heart_3.webp");
    background-repeat: no-repeat;
    background-size: contain;
    vertical-align: middle;
    image-rendering: pixelated;
    pointer-events: none;
  }

  @media (prefers-color-scheme: dark) {
    &::before {
      filter: invert(1);
    }
  }
}

#logo-footer {
  width: 35px;
  min-width: 35px;
  padding: 0;
  image-rendering: pixelated;
}

/* ===================
  ダークモード対応予定
@media (prefers-color-scheme: dark) {
  #logo-footer {
    filter: invert(1);
    mix-blend-mode: lighten;
  }
}
================== */

/* ===================
  シークレットモーダル
=================== */
#secret-modal {
  border: none;
  padding: 0;
  background-color: transparent;
  max-width: 90%;
  max-height: 90%;
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);

  .modal-content {
    display: inline-flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background-color: transparent;
    text-align: center;
    min-width: 280px;
  }

  &::backdrop {
    background-color: light-dark(rgb(0 0 0 / 10%), rgb(255 255 255 / 50%));
    backdrop-filter: saturate(0);
  }

  h2 {
    display: inline-block;
    margin: 0 0 8px;
    font-size: 1rem;
    background-color: white;
    color: black;
    clip-path: inset(2px 1px 3px 0);
  }

  p {
    display: inline-block;
    margin: 0 0 20px;
    font-size: 0.8rem;
    background-color: white;
    color: black;
    line-height: 1.4;
    clip-path: inset(3px 1px 3px 0);
  }

  .secret-link-and-button {
    display: inline-flex;
    flex-direction: row;
    align-items: center;
    justify-content: center;
  }

  a {
    display: inline-block;
    font-size: 0.8rem;
    background-color: blue;
    color: white;
    clip-path: inset(2px 1px 1px 0);

    &:hover {
      background-color: blue;
      color: white;
    }
  }

  #close-secret-modal {
    font-family: saitamaar, sans-serif;
    background-color: black;
    color: white;
    padding: 1px 1px 0 3px;
    border: none;
    margin: 0 0 0 8px;
    cursor: pointer;
    font-size: 0.8rem;
    clip-path: inset(2px 1px 1px 2px);

    &:hover {
      background-color: white;
      color: black;
    }
  }
}

/* レスポンシブ対応 */
@media screen and (width <= 768px) {
  #foot-comment {
    font-size: 0.75em;
    line-height: 1.5;
  }
}

@media screen and (width <= 576px) {
  #secret-modal .modal-content {
    padding: 15px;
    min-width: 240px;
  }
  
  #secret-modal h2 {
    font-size: 1.1rem;
  }
}

@media screen and (width <= 480px) {
  #foot-comment {
    display: block;
    text-align: center;
    font-size: 0.7em;
  }
}

/* ===================
  @media
=================== */
@media screen and (width >= 900px) {
  #header-flex {
    position: absolute;
  }
  
  #back {
    position: relative;
  }
  
  #address {
    position: relative;

    /* left: calc((18.5% * 2) - 313px); */
  }
}

@media screen and (width <= 768px) {
  #address {
    margin-left: calc(11% - 4.8vw);
  }

  #main,
  #main-footer {
    width: 80%;
  }
}

/* スマホサイズ */
@media screen and (width <= 576px) {
  #category-header {
    margin-top: 20px;
    width: 75%;

    .main-category,
    .sub-category {
      justify-content: space-evenly;
      column-gap: 5px;
    }

    nav:not(:has(.main-category)) ol.sub-category:first-child {
      margin-top: calc(2rem + 5px);
    }
  }


  body {
    font-size: 0.9rem;
    line-height: 20px;
  }

  h1 {
    font-size: 1.5rem;
    font-weight: bold;
    text-align: right;
    background-image: linear-gradient(to bottom, #ccc);
    background-size: 100% 1.5rem;
    background-repeat: no-repeat;
    background-position: 0 8px;
    padding-top: 10px;
  }

  #back {
    width: 0;
  }
  
  #wrapper {
    border: 5px solid #000;
    border-top: none;
    border-right: none;
    border-bottom: none;
  }

  #main {
    margin-left: calc(auto - 20px);
  }
  
  #main,
  #main-footer {
  width: 100%;
  max-width: none;
}
  
  #address {
    font-size: medium;
  }

  #foot-links {
    margin-top: 10px;
  }
  
  .nav-links li::before {
    vertical-align: -2px;
  }


@media screen and (width <= 435px) {
  #gallerymaphtml {
    width: calc(100% - 20px);
    margin-bottom: 30px;
  }
  
  a.link-img {
    span {
      display: none;
      position: absolute;
      top: 2.5em;
      left: 20px;
    }
  }
}

@media screen and (width <= 375px) {
  #wrapper {
    border: none;
  }
  
  #main,
  #main-footer {
    width: 90%;
  }
}

/* ===================
  サイドバー
=================== */
.sidebar {
  position: fixed;
  top: 10%;
  z-index: 100;
  display: flex;
  flex-direction: column;
  gap: 0;

  .sidebar-content {
    display: flex;
    flex-direction: column;
    gap: 2px;

    .sidebar-item {
      width: 40px;
      height: 40px;
      background-color: light-dark(rgb(0 0 0 / 90%), transparent);
      color: light-dark(#fff, transparent);
      display: flex;
      align-items: center;
      justify-content: center;
      cursor: pointer;
      font-family: saitamaar, PikoA, "Helvetica Neue", Helvetica, Arial, system-ui, sans-serif;
      font-size: 16px;
      transition: all 0.2s ease;

      &:hover {
        background-color: #fff;
        color: #000;
      }
    }

    .sidebar-icon {
      display: block;
      line-height: 1;
      transition: transform 0.2s ease;
      transform: rotate(90deg);
    }
  }
}


/* 目次表示エリア */
.sidebar-toc {
  position: fixed;
  top: 100px;
  left: 40px;
  width: 250px;
  max-height: 400px;
  background-color: rgb(255 255 255 / 95%);
  border: 1px solid #000;
  backdrop-filter: blur(4px);
  z-index: 200;
  font-family: saitamaar, PikoA, "Helvetica Neue", Helvetica, Arial, system-ui, sans-serif;
  font-size: 12px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.sidebar-toc-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 2px 12px 0;
  background-color: #000;
  color: #fff;
  border-bottom: 1px solid #000;
}

.sidebar-toc-title {
  font-weight: bold;
  font-size: 13px;
}

.sidebar-toc-close {
  background: none;
  border: none;
  color: #fff;
  cursor: pointer;
  font-size: 16px;
  padding: 0;
  width: 20px;
  height: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.sidebar-toc-close:hover {
  background-color: #fff;
  color: #000;
}

.sidebar-toc-content {
  display: inline-block;
  padding: 8px 0;
  overflow-y: auto;
  flex: 1;
  scrollbar-width: thin;
}

.sidebar-toc-item {
  display: inline-block;
  padding: 2px 12px;
  color: #000;
  text-decoration: none;
  cursor: pointer;
  border: none;
  background: none;
  width: 100%;
  text-align: left;
  font-family: inherit;
  font-size: inherit;
  line-height: 1.3;
  transition: background-color 0.2s ease;

  &:hover {
    background-color: #f0f0f0;
  }

  &.active {
    background-color: #000;
    color: #fff;
    font-weight: bold;
  }

  &.level-2 {
    padding-left: 30px;
    text-indent: -18px;

    &::before {
      content: "h2:";
      color: light-dark(#ccc, #aaa);
      margin-right: 4px;
    }
  }

  &.level-3 {
    padding-left: 42px;
    text-indent: -31px;

    &::before {
      content: "==h3:";
      color: light-dark(#ccc, #aaa);
      margin-right: 4px;
    }
  }

  &.level-4 {
    padding-left: 53px;
    text-indent: -42px;

    &::before {
      content: "====h4:";
      color: light-dark(#ccc, #aaa);
      margin-right: 4px;
    }
  }

  &.level-5 {
    padding-left: 65px;
    text-indent: -54px;

    &::before {
      content: "======h5:";
      color: light-dark(#ccc, #aaa);
      margin-right: 4px;
    }
  }

  &.level-6 {
    padding-left: 77px;
    text-indent: -66px;
    
    &::before {
      content: "========h6:";
      color: light-dark(#ccc, #aaa);
      margin-right: 4px;
    }
  }
}


/* 目次ボタンはデフォルトで表示 */
#sidebar-toggle-toc {
  display: flex;

  .sidebar-icon {
    /* 目次ボタンのアイコンは回転させない */
    transform: none !important;
  }
}

/* ページ情報表示エリア */
.sidebar-page-info {
  transform: rotate(-90deg);
  position: fixed;
  display: grid;
  grid-template-rows: repeat(3, 1fr);
  justify-content: start;
  gap: 0 10px;
  bottom: 300px;
  left: -229px;
  width: 500px;
  max-width: 500px;
  font-size: 10px;
  z-index: 98;
}

/* 共通のラベルスタイル */
.sidebar-info-label {
  color: #ccc;
  margin-right: 4px;
}

/* 共通の値スタイル */
.sidebar-info-value {
  color: #fff;
  letter-spacing: 0.5px;
}

/* スクロール進捗バー */
#sidebar-scroll-progress {
  grid-area: 1 / 1 / 2 / 2;
}

/* 見出し数と文字数 */
#sidebar-page-structure {
  grid-area: 2 / 1 / 3 / 2;
}

/* リンク数 */
#sidebar-page-links {
  grid-area: 3 / 1 / 4 / 2;
}

/* ページタイトル */
#sidebar-page-title {
  grid-area: 1 / 2 / 2 / 3;
}

/* 最終更新日 */
#sidebar-last-modified {
  grid-area: 2 / 2 / 3 / 3;
}

/* 現在の見出し */
.sidebar-current-heading {
  grid-area: 3 / 2 / 4 / 3;
  overflow: hidden;
  margin-top: -1px;
}

#sidebar-current-heading-value {
  overflow-wrap: break-word;
  hyphens: auto;
}


/* レスポンシブ対応 */

@media screen and (width <= 576px) {
  .sidebar {
    display: none;
  }
  
  .sidebar-toc {
    display: none !important;
  }
  
  .sidebar-current-heading {
    display: none !important;
  }
}