body {
  margin: 0;
  scrollbar-gutter: stable;
  overflow: scroll;
  background-color: #ffffff;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='100%25'%3E%3Cdefs%3E%3ClinearGradient id='a' gradientUnits='userSpaceOnUse' x1='0' x2='0' y1='0' y2='100%25' gradientTransform='rotate(117,960,472)'%3E%3Cstop offset='0' stop-color='%23ffffff'/%3E%3Cstop offset='1' stop-color='%23F1F3F4'/%3E%3C/linearGradient%3E%3Cpattern patternUnits='userSpaceOnUse' id='b' width='704' height='586.7' x='0' y='0' viewBox='0 0 1080 900'%3E%3Cg fill-opacity='0.04'%3E%3Cpolygon fill='%23444' points='90 150 0 300 180 300'/%3E%3Cpolygon points='90 150 180 0 0 0'/%3E%3Cpolygon fill='%23AAA' points='270 150 360 0 180 0'/%3E%3Cpolygon fill='%23DDD' points='450 150 360 300 540 300'/%3E%3Cpolygon fill='%23999' points='450 150 540 0 360 0'/%3E%3Cpolygon points='630 150 540 300 720 300'/%3E%3Cpolygon fill='%23DDD' points='630 150 720 0 540 0'/%3E%3Cpolygon fill='%23444' points='810 150 720 300 900 300'/%3E%3Cpolygon fill='%23FFF' points='810 150 900 0 720 0'/%3E%3Cpolygon fill='%23DDD' points='990 150 900 300 1080 300'/%3E%3Cpolygon fill='%23444' points='990 150 1080 0 900 0'/%3E%3Cpolygon fill='%23DDD' points='90 450 0 600 180 600'/%3E%3Cpolygon points='90 450 180 300 0 300'/%3E%3Cpolygon fill='%23666' points='270 450 180 600 360 600'/%3E%3Cpolygon fill='%23AAA' points='270 450 360 300 180 300'/%3E%3Cpolygon fill='%23DDD' points='450 450 360 600 540 600'/%3E%3Cpolygon fill='%23999' points='450 450 540 300 360 300'/%3E%3Cpolygon fill='%23999' points='630 450 540 600 720 600'/%3E%3Cpolygon fill='%23FFF' points='630 450 720 300 540 300'/%3E%3Cpolygon points='810 450 720 600 900 600'/%3E%3Cpolygon fill='%23DDD' points='810 450 900 300 720 300'/%3E%3Cpolygon fill='%23AAA' points='990 450 900 600 1080 600'/%3E%3Cpolygon fill='%23444' points='990 450 1080 300 900 300'/%3E%3Cpolygon fill='%23222' points='90 750 0 900 180 900'/%3E%3Cpolygon points='270 750 180 900 360 900'/%3E%3Cpolygon fill='%23DDD' points='270 750 360 600 180 600'/%3E%3Cpolygon points='450 750 540 600 360 600'/%3E%3Cpolygon points='630 750 540 900 720 900'/%3E%3Cpolygon fill='%23444' points='630 750 720 600 540 600'/%3E%3Cpolygon fill='%23AAA' points='810 750 720 900 900 900'/%3E%3Cpolygon fill='%23666' points='810 750 900 600 720 600'/%3E%3Cpolygon fill='%23999' points='990 750 900 900 1080 900'/%3E%3Cpolygon fill='%23999' points='180 0 90 150 270 150'/%3E%3Cpolygon fill='%23444' points='360 0 270 150 450 150'/%3E%3Cpolygon fill='%23FFF' points='540 0 450 150 630 150'/%3E%3Cpolygon points='900 0 810 150 990 150'/%3E%3Cpolygon fill='%23222' points='0 300 -90 450 90 450'/%3E%3Cpolygon fill='%23FFF' points='0 300 90 150 -90 150'/%3E%3Cpolygon fill='%23FFF' points='180 300 90 450 270 450'/%3E%3Cpolygon fill='%23666' points='180 300 270 150 90 150'/%3E%3Cpolygon fill='%23222' points='360 300 270 450 450 450'/%3E%3Cpolygon fill='%23FFF' points='360 300 450 150 270 150'/%3E%3Cpolygon fill='%23444' points='540 300 450 450 630 450'/%3E%3Cpolygon fill='%23222' points='540 300 630 150 450 150'/%3E%3Cpolygon fill='%23AAA' points='720 300 630 450 810 450'/%3E%3Cpolygon fill='%23666' points='720 300 810 150 630 150'/%3E%3Cpolygon fill='%23FFF' points='900 300 810 450 990 450'/%3E%3Cpolygon fill='%23999' points='900 300 990 150 810 150'/%3E%3Cpolygon points='0 600 -90 750 90 750'/%3E%3Cpolygon fill='%23666' points='0 600 90 450 -90 450'/%3E%3Cpolygon fill='%23AAA' points='180 600 90 750 270 750'/%3E%3Cpolygon fill='%23444' points='180 600 270 450 90 450'/%3E%3Cpolygon fill='%23444' points='360 600 270 750 450 750'/%3E%3Cpolygon fill='%23999' points='360 600 450 450 270 450'/%3E%3Cpolygon fill='%23666' points='540 600 630 450 450 450'/%3E%3Cpolygon fill='%23222' points='720 600 630 750 810 750'/%3E%3Cpolygon fill='%23FFF' points='900 600 810 750 990 750'/%3E%3Cpolygon fill='%23222' points='900 600 990 450 810 450'/%3E%3Cpolygon fill='%23DDD' points='0 900 90 750 -90 750'/%3E%3Cpolygon fill='%23444' points='180 900 270 750 90 750'/%3E%3Cpolygon fill='%23FFF' points='360 900 450 750 270 750'/%3E%3Cpolygon fill='%23AAA' points='540 900 630 750 450 750'/%3E%3Cpolygon fill='%23FFF' points='720 900 810 750 630 750'/%3E%3Cpolygon fill='%23222' points='900 900 990 750 810 750'/%3E%3Cpolygon fill='%23222' points='1080 300 990 450 1170 450'/%3E%3Cpolygon fill='%23FFF' points='1080 300 1170 150 990 150'/%3E%3Cpolygon points='1080 600 990 750 1170 750'/%3E%3Cpolygon fill='%23666' points='1080 600 1170 450 990 450'/%3E%3Cpolygon fill='%23DDD' points='1080 900 1170 750 990 750'/%3E%3C/g%3E%3C/pattern%3E%3C/defs%3E%3Crect x='0' y='0' fill='url(%23a)' width='100%25' height='100%25'/%3E%3Crect x='0' y='0' fill='url(%23b)' width='100%25' height='100%25'/%3E%3C/svg%3E");
  background-attachment: fixed;
  background-size: cover;
  background-color: #9fa5b2;
  font-family: "Helvetica Neue", Arial, "Hiragino Kaku Gothic ProN",
    "Hiragino Sans", Meiryo, sans-serif;
}

i {
  font-family: "Noto Sans", sans-serif;
  font-style: italic;
}

a {
  color: #4e4e5f;
}

a:hover {
  color: #7d7c92;
}

.container {
  margin: 150px auto auto;
  padding: 2%;
  width: 50%;
  background-color: #ffffffad;
  border: outset;
  max-width: 80%;
  z-index: -2;
}

input[type="submit"] {
  background: #7d7c92;
  border: none;
  padding: 10px 20px;
  margin: 20px 5px auto;
  max-width: 200px;
  padding: 10px 25px;
  color: #ffffff;
  cursor: pointer;
}

.btn {
  background: #7d7c92;
  border: none;
  padding: 10px 20px;
  margin: 20px 5px auto;
  max-width: 200px;
  padding: 10px 25px;
  color: #ffffff;
  cursor: pointer;
}

.formatting-buttons button {
  color: #000000;
  vertical-align: middle;
  background: none;
  border: none;
  margin-bottom: 10px;
  height: 30px;
  cursor: pointer;
  border-radius: 4px;
}

.formatting-buttons input[type="submit"] {
  color: #000000;
  vertical-align: middle;
  background: none;
  border: none;
  margin-bottom: 10px;
  height: 30px;
  cursor: pointer;
  border-radius: 4px;
}

h2 {
  font-family: "Montserrat Subrayada", sans-serif;
  text-align: left;
  line-height: 1.5;
  position: relative;
  padding-bottom: 10px;
  margin-bottom: 20px;
}

h2::after {
  content: "";
  position: absolute;
  top: 59%;
  left: 0;
  bottom: 0;
  width: 100%;
  height: 3px; /* Adjust thickness of the line */
  background-color: black; /* Or use 'solid' with border properties */
}

h2:first-letter {
  font-size: 1.5em;
  color: #2f5597;
  margin-left: 10px;
}

/* latin */
@font-face {
  font-family: "Montserrat Subrayada";
  font-style: normal;
  font-weight: 400;
  src: url(https://fonts.gstatic.com/s/montserratsubrayada/v22/U9MD6c-o9H7PgjlTHThBnNHGVUORwteQQH8MaOY.woff2)
    format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA,
    U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193,
    U+2212, U+2215, U+FEFF, U+FFFD;
}

h3 {
  position: relative;
  margin: 0 20px;
}

h3::before {
  content: "";
  position: absolute;
  background: #7d7c925b;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  top: 50%;
  left: -10px;
  transform: translateY(-50%);
  z-index: -1;
}

h4 {
  font-size: 1.5em;
  position: relative;
  padding: 0 0.5em 0 1.2em;
  border-bottom: 1px solid #4e4e5f;
}

h4:first-letter {
  font-size: 1.5em;
}

h4::before,
h4::after {
  position: absolute;
  content: "";
  border-radius: 100%;
}

h4::before {
  top: 0.2em;
  left: 0.2em;
  width: 18px;
  height: 18px;
  background-color: #3a3c45a2;
  z-index: 2;
}

h4::after {
  top: 0.7em;
  left: 0.7em;
  width: 13px;
  height: 13px;
  background-color: #7d7c925b;
}

h5 {
  font-size: 1em;
  font-family: "Montserrat Subrayada", sans-serif;
  text-align: left;
  margin: 0 0 0 10px;
}

h5:first-letter {
  font-size: 1.5em;
  color: #2f5597;
}

a h1 {
  color: #ccc;
}

h1 {
  font-family: "Trebuchet MS", sans-serif;
  position: relative;
  font-size: 1em;
  padding: 10px;
  border-bottom: 2px solid #ccc;
  border-left: 2px solid #ccc;
  border-radius: 0 0 0 20px;
}

h1:before {
  position: absolute;
  right: 50px;
  bottom: -21px;
  width: 0;
  height: 0;
  content: "";
  border-width: 21px 21px 0 0;
  border-style: solid;
  border-color: #ccc transparent transparent transparent;
}

h1:after {
  position: absolute;
  right: 54px;
  bottom: -14px;
  width: 0;
  height: 0;
  content: "";
  border-width: 14px 14px 0 0;
  border-style: solid;
  border-color: #333 transparent transparent transparent;
}

hr {
  border-top: 1px dotted #8c8b8b;
  border-bottom: 1px dotted #fff;
}

.txt_center {
  text-align: center;
}

.txt_small {
  font-size: smaller;
  color: #1d1d20;
}

/* ===============================
 * トースト通知関連のスタイル
 * =============================== */

/* トーストの表示エリア (画面右下などに固定) */
.toast-display-area {
  position: fixed;
  bottom: 20px;
  right: 20px;
  z-index: 1000; /* 他の要素の上に表示 */
  display: flex;
  flex-direction: column;
  gap: 10px; /* メッセージ間のスペース */
  align-items: flex-end; /* 右寄せ */
}

/* 個別のトーストメッセージ */
.toast {
  padding: 12px 20px;
  border-radius: 8px;
  color: #fff;
  font-size: 14px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
  opacity: 0;
  transform: translateX(100%); /* 初期状態は見えない位置 */
  transition: opacity 0.5s ease-in-out, transform 0.5s ease-in-out;
  max-width: 300px;
  word-break: break-word; /* 長いメッセージに対応 */
}

/* 表示時のスタイル */
.toast.show {
  opacity: 1;
  transform: translateX(0);
}

/* 非表示時のスタイル */
.toast.hide {
  opacity: 0;
  transform: translateX(100%);
}

/* 成功時のトーストカラー */
.toast-success {
  background-color: #4caf50; /* 緑 */
  border-left: 5px solid #2e7d32;
}

/* エラー時のトーストカラー */
.toast-error {
  background-color: #f44336; /* 赤 */
  border-left: 5px solid #c62828;
}

@media screen and (max-width: 810px) {
  body {
    font-size: smaller;
  }

  .container {
    width: 95%;
    max-width: 100%;
    margin: 170px auto auto;
  }
}

/* ナビゲーションバーの全体的なスタイル */
#navbar {
  width: 100%;
  background-color: #333;
  color: #fff;
  height: 120px;
  padding: 10px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  top: 0;
  box-sizing: border-box;
  flex-wrap: wrap; /* スマホで折り返す可能性を考慮 */
  position: fixed; /* ページ上部に固定 */
  z-index: 100;
}

/* ヘッダー左上部 (アイコン、ENo、ロゴ) */
.naver-leftup {
  display: flex;
}

/* キャラクター表示エリア (navbar-logo) */
#navbar-logo {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-right: 20px;
  flex-shrink: 0;
}

/* 選択中キャラクターアイコン */
#navbar-logo img {
  width: 50px; /* home.cssの値を採用 */
  height: 50px;
  border-radius: 50%;
  border: 3px solid #9fa5b2; /* ロゴカラーに合わせる */
  object-fit: cover;
}

/* ENo表示 (WP/ccは削除) */
#navbar-points {
  color: #fff;
  font-size: 0.9em;
}

/* サイトタイトル */
.site-title-link {
  text-decoration: none;
  color: white;
  font-size: 1.5em;
  font-weight: bold;
  margin-right: auto; /* ナビゲーションとの間にスペースを空ける */
}

/* ハンバーガーボタン (PCでは非表示) */
.navbar-toggle {
  display: none;
  cursor: pointer;
  flex-direction: column;
  justify-content: space-around;
  width: 30px;
  height: 25px;
  margin-left: 10px; /* ロゴからの間隔 */
}

.navbar-toggle .bar {
  display: block;
  width: 100%;
  height: 3px;
  background-color: #fff;
  transition: all 0.3s ease-in-out;
}

/* ナビゲーションメニュー */
#nav-menu {
  flex-grow: 1; /* PC時は残りのスペースを使用 */
}

.navbar-list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex; /* PCでは横並び */
  justify-content: flex-end; /* 右寄せ */
  gap: 5px;
}

.navbar-item {
  width: 50px;
  position: relative;
  font-weight: bold;
}

.navbar-link {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-decoration: none;
  color: #ccc;
  font-size: 0.9em;
  padding: 5px 0;
}

.navbar-link:hover,
.navbar-item.active .navbar-link {
  color: #9fa5b2;
}

.navbar-link img {
  width: 30px;
  height: 30px;
  margin-bottom: 3px;
}

/* =========================================================
 * スマートフォン対応 (768px以下)
 * ========================================================= */
@media (max-width: 810px) {
  #navbar {
    padding: 8px 15px;
    height: 120px;
  }

  .naver-leftup {
    flex-wrap: nowrap;
  }

  /* ハンバーガーボタンを表示 */
  .navbar-toggle {
    display: flex;
    order: 3;
    background: none;
    border: none;
    padding: 0;
  }

  /* ナビゲーションメニュー全体を非表示 (オーバーレイ) */
  #nav-menu {
    position: fixed;
    top: 120px; /* 調整後のヘッダーの高さに合わせて */
    left: 0;
    width: 100%;
    height: 80%;
    background-color: #333;
    display: none;
    z-index: 99;
    overflow-y: auto;
    transform: translateX(100%);
    transition: transform 0.3s ease-out;
    flex-basis: 100%; /* PC時に占めていた領域は解放 */
  }

  /* JSでアクティブになった時 */
  #nav-menu.active {
    display: block;
    transform: translateX(0);
  }

  /* Xマークへのアニメーション */
  .navbar-toggle.active .bar:nth-child(2) {
    opacity: 0;
  }
  .navbar-toggle.active .bar:nth-child(1) {
    transform: translateY(8px) rotate(45deg);
  }
  .navbar-toggle.active .bar:nth-child(3) {
    transform: translateY(-8px) rotate(-45deg);
  }

  .navbar-list {
    flex-direction: column; /* 縦並び */
    padding: 0;
    gap: 0;
  }

  .navbar-item {
    border-bottom: 1px solid #444;
    width: 100%;
  }

  .navbar-link {
    flex-direction: row; /* スマホではアイコンと文字を横並び */
    justify-content: flex-start;
    padding: 15px 20px;
    font-size: 1.1em;
  }

  .navbar-link img {
    margin-right: 15px;
    margin-bottom: 0;
  }
}

/* ================================================
   BBCode & Editor Styles
   ================================================ */

/* BBCode変換後の表示スタイル */
.preview-content,
.profile-text,
.npc-talk-body,
#preview,
.user-talk-text {
  line-height: 1.8;
  word-wrap: break-word;
}
.preview-content b,
.profile-text b,
.npc-talk-body b,
#preview b,
.user-talk-text b {
  font-weight: bold;
}
.preview-content i,
.profile-text i,
.npc-talk-body i,
#preview i,
.user-talk-text i {
  font-style: italic;
}
.preview-content u,
.profile-text u,
.npc-talk-body u,
#preview u,
.user-talk-text u {
  text-decoration: underline;
}
.preview-content s,
.profile-text s,
.npc-talk-body s,
#preview s,
.user-talk-text s {
  text-decoration: line-through;
}
.preview-content large,
.profile-text large,
.npc-talk-body large,
#preview large,
.user-talk-text large {
  font-size: 1.2em;
}
.preview-content small,
.profile-text small,
.npc-talk-body small,
#preview small,
.user-talk-text small {
  font-size: 0.8em;
}
.preview-content summary,
.profile-text summary,
.npc-talk-body summary,
#preview summary,
.user-talk-text summary {
  cursor: pointer;
}

.preview-content .serif-box,
.profile-text .serif-box,
.npc-talk-body .serif-box,
#preview .serif-box,
.user-talk-text .serif-box {
  border: 1px solid #ddd;
  padding: 10px;
  display: flex;
  align-items: flex-start;
  border-radius: 5px;
  gap: 5px;
  margin-bottom: 5px;
  background-color: #fff;
}
.preview-content .serif-icon,
.profile-text .serif-icon,
.npc-talk-body .serif-icon,
#preview .serif-icon,
.user-talk-text .serif-icon {
  width: 60px;
  height: 60px;
  border-radius: 5px;
  object-fit: cover;
  flex-shrink: 0;
}
.preview-content .serif-text,
.profile-text .serif-text,
.npc-talk-body .serif-text,
#preview .serif-text,
.user-talk-text .serif-text {
  flex-grow: 1;
}

.preview-content .user-image,
.profile-text .user-image,
.npc-talk-body .user-image,
#preview .user-image,
.user-talk-text .user-image {
  max-width: 100%;
  height: auto;
  border-radius: 4px;
}

/* アイコン選択モーダルのスタイル */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0, 0, 0, 0.6);
  z-index: 1000;
  display: none;
  justify-content: center;
  align-items: center;
}
.modal-content {
  background-color: #fff;
  padding: 20px;
  border-radius: 8px;
  width: 90%;
  max-width: 600px;
  max-height: 80vh;
  overflow-y: auto;
  position: relative;
}
.modal-close-btn {
  position: absolute;
  top: 10px;
  right: 15px;
  font-size: 24px;
  font-weight: bold;
  cursor: pointer;
  border: none;
  background: none;
}
.icon-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(80px, 1fr));
  gap: 10px;
  margin-top: 15px;
}
.icon-item {
  text-align: center;
  cursor: pointer;
  padding: 5px;
  border-radius: 5px;
}
.icon-item:hover {
  background-color: #f0f0f0;
}
.icon-item img {
  width: 60px;
  height: 60px;
  object-fit: cover;
  border-radius: 4px;
}
.icon-item p {
  font-size: 0.8em;
  margin: 5px 0 0;
  color: #333;
  word-break: break-all;
}
