/* ===================================
   Webフォントの読み込み
   =================================== */
@import url("https://fonts.googleapis.com/css2?family=Noto+Sans+JP:wght@400;500;700&display=swap");

/* ===================================
   :root - 配色と基本設定
   =================================== */
:root {
  --font-family-base: "Noto Sans JP", -apple-system, BlinkMacSystemFont,
    "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --color-primary: #4a69bd;
  --color-primary-dark: #3c5699;
  --color-danger: #e53e3e;
  --color-success: #2ecc71;
  --color-final: #0d571ea0;
  --color-published: #2f507ca0;
  --color-edit: #d69e2e;
  --color-detail: #3498db;
  --color-background: #f4f7fa;
  --color-surface: #ffffff;
  --color-dark-surface: #2d3748;
  --color-text-base: #2d3748;
  --color-text-light: #edf2f7;
  --color-text-muted: #718096;
  --border-color: #e2e8f0;
  --border-radius: 0.375rem; /* 6px */
  --shadow-sm: 0 1px 3px 0 rgba(0, 0, 0, 0.05), 0 1px 2px 0 rgba(0, 0, 0, 0.03);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.07),
    0 2px 4px -1px rgba(0, 0, 0, 0.04);
}

/* ===================================
   グローバル & 基本スタイル
   =================================== */
*,
*::before,
*::after {
  box-sizing: border-box;
}
html {
  height: 100%;
  font-size: 12pt;
}
html::-webkit-scrollbar {
  width: 0.75rem; /* スクロールバーの横幅 */
}
html::-webkit-scrollbar-track-piece {
  background-color: #f4f6f9; /* Safari スクロールバーの背景色 */
}
html::-webkit-scrollbar-thumb {
  background-color: #84909a;
  border-radius: 1rem;
  background-clip: content-box;
}
body {
  margin: 0;
  font-family: var(--font-family-base);
  background-color: var(--color-background);
  color: var(--color-text-base);
  font-size: 15px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  min-height: 100%;
  display: flex;
  flex-direction: column;
  overflow-y: scroll;
  overscroll-behavior: none;
}
img,
picture,
video,
canvas {
  display: block;
  max-width: 100%;
}
svg {
  display: inline-block;
  max-width: 100%;
}
p,
h1,
h2,
h3,
h4,
h5,
h6 {
  overflow-wrap: break-word;
}

.user-select-none {
  -ms-user-select: none;
  -webkit-user-select: none;
  user-select: none;
}

/* ===================================
   レイアウト
   =================================== */
header {
  background-color: var(--color-dark-surface);
  height: 4rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  width: 100%;
  z-index: 1000;
  padding: 0 1.5rem;
  box-shadow: var(--shadow-md);

  h1 {
    color: var(--color-text-light);
    margin: 0;
    font-size: 1.3rem;
  }

  nav {
    display: flex;
    align-items: center;
    gap: 1.25rem;

    a {
      color: var(--color-text-light);
      text-decoration: none;
      font-weight: 500;
      transition: color 0.2s;
      &:hover {
        color: var(--color-primary);
      }
    }

    .user-info {
      display: flex;
      align-items: center;
      gap: 0.5rem;
      color: var(--color-text-light);
      font-weight: 500;
      svg {
        width: 1.25rem;
        height: 1.25rem;
      }
    }
  }
}

footer {
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 0.5rem 1rem;
  color: #959595;
}

main {
  overflow: auto;
  flex-grow: 1;
  position: relative;
}

main:has(aside#admin-sidebar) + footer {
  padding-left: 240px;
}

#main {
  flex-grow: 1;
  padding: 1.5rem 2rem;
  max-width: 100rem;
  margin: 0 auto;

  > h1 {
    font-size: 1.8rem;
    font-weight: 700;
    margin-top: 0;
    margin-bottom: 1.5rem;
    color: var(--color-dark-surface);
  }

  .action-btns {
    display: flex;
    gap: 0.5rem 1rem;
    margin-bottom: 0;
    justify-content: flex-end;
    flex-wrap: wrap;

    .btn-group {
      width: 100%;
      display: flex;
      gap: 1rem;
      justify-content: flex-end;
    }

    .a-form {
      display: block;
      button[type="submit"] {
        font-size: 1rem;
        line-height: 1.5;
        height: 100%;
        padding: 0.5rem 1.125rem;
      }
    }
  }

  td {
    .action-btns {
      justify-content: flex-start;
      margin-bottom: 0;
    }
  }
}

/* ===================================
   フォーム全般
   =================================== */
form,
.detail-view {
  background-color: var(--color-surface);
  padding: 2rem;
  border-radius: var(--border-radius);
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--border-color);
}

#login-container {
  background-color: var(--color-surface);
  padding: 2rem;
  border-radius: var(--border-radius);
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--border-color);
}

form {
  display: flex;
  flex-direction: column;
  gap: 1.25rem;

  /* 💡 selectのスタイルをinput, textareaと統合 */
  input:not([type="checkbox"], [type="radio"]),
  textarea,
  select {
    appearance: none;
    -webkit-appearance: none;
    width: 100%;
    font-family: inherit;
    font-size: 0.95rem;
    padding: 0.625rem; /* 10px */
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    transition: border-color 0.2s, box-shadow 0.2s;
    background-color: #fff;
    color: #000;

    &:focus {
      outline: none;
      border-color: var(--color-primary);
      box-shadow: 0 0 0 3px rgba(90, 103, 216, 0.2);
    }
  }

  textarea {
    resize: vertical;
    line-height: 1.5;
  }

  select {
    background-image: url('data:image/svg+xml;charset=UTF-8,<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="%23718096" viewBox="0 0 16 16"><path fill-rule="evenodd" d="M1.646 4.646a.5.5 0 0 1 .708 0L8 10.293l5.646-5.647a.5.5 0 0 1 .708.708l-6 6a.5.5 0 0 1-.708 0l-6-6a.5.5 0 0 1 0-.708z"/></svg>');
    background-repeat: no-repeat;
    background-position: right 0.625rem center; /* 10px */
    background-size: 1rem; /* 16px */
    padding-right: 2.5rem; /* 40px */
    cursor: pointer;
  }

  fieldset {
    border: 1px solid #e0e0e0;
    padding: 1rem 1.5rem 1.5rem 1.5rem;
    margin: 0;
    border-radius: var(--border-radius);
    max-height: max-content;

    legend {
      font-size: 1.1rem;
      font-weight: 600;
      padding: 0 0.5rem;
      margin-left: -0.5rem;
      color: var(--color-dark-surface);
    }
  }

  > .form-field {
    > label {
      font-size: 1.1rem;
      font-weight: 600;
      display: block;
    }
  }
  .field-description {
    font-size: 0.85rem;
    color: var(--color-text-muted);
    margin-top: 0;
    margin-bottom: 0.5rem;
  }

  .choice-item-wrapper {
    display: flex;
    gap: 0.5rem 1rem;
    flex-wrap: wrap;
    padding-top: 0.25rem;
  }
  .choice-item {
    display: flex;
    align-items: center;
    gap: 0.4rem;
  }
  .group-flex-wrapper {
    display: flex;
    gap: 1rem;
    > .form-field {
      flex-grow: 1;
      min-width: 0;
    }
  }
}
/* ===================================
   フォーム内のリスト項目
   =================================== */

/* リストの各行（item） */
form .list-item {
  display: flex;
  align-items: flex-start; /* ラベルと入力欄が多い場合に備えて上揃えに */
  gap: 1rem;
  padding: 1rem;
  background-color: #fdfdfd;
  border: 1px solid var(--border-color);
  border-radius: var(--border-radius);
}
form .list-item + .list-item {
  margin-top: 1rem;
}
form .list-item-fields {
  flex-grow: 1;
  display: flex;
  flex-direction: column;
  gap: 1rem;

  > label {
    font-size: 1.1rem;
    font-weight: 600;
    display: block;
  }
}

/* 「追加」ボタンのスタイル */
form .add-item-btn {
  margin-top: 1rem;
  background-color: var(--color-surface);
  color: var(--color-primary);
  border: 1px solid var(--color-primary);
  padding: 0.375rem 1rem; /* 少し小さめに */
  font-weight: 500;
}
form .add-item-btn:hover {
  background-color: var(--color-primary);
  color: white;
}

/* 「削除」ボタンのスタイル */
form .delete-btn {
  flex-shrink: 0; /* ボタンが縮まないように */
  padding: 0.25rem 0.6rem;
  font-size: 0.8rem;
  background-color: var(--color-danger);
}

/* ===================================
   汎用コンポーネント (ボタンなど)
   =================================== */
.button {
  display: inline-block;
  padding: 0.35rem 1.125rem;
  background-color: var(--color-primary);
  color: white;
  text-decoration: none;
  border: none;
  border-radius: var(--border-radius);
  cursor: pointer;
  font-weight: 500;
  text-align: center;
  transition: all 0.2s;
  &:hover {
    background-color: var(--color-primary-dark);
    box-shadow: var(--shadow-sm);
  }

  &.detail {
    background-color: var(--color-detail);
  }
  &.edit {
    background-color: var(--color-edit);
  }
  &.delete {
    background-color: var(--color-danger);
  }

  &.final {
    background-color: var(--color-final);
  }
}
form button[type="submit"] {
  font-size: 1rem;
  padding: 0.85rem 1.25rem;
}
.page-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1rem;
  height: max-content;
  h1 {
    margin: 0;
    border: none;
    padding: 0;
    font-size: 1.8rem;
  }
  h2 {
    border: none;
    padding: 0;
    font-size: 1.5rem;
  }
  .action-btns {
    display: flex;
    gap: 0.5rem 1rem;
    margin-bottom: 0;
    justify-content: flex-end;
    flex-wrap: wrap;

    .btn-group {
      width: 100%;
      display: flex;
      gap: 1rem;
      justify-content: flex-end;
    }

    .a-form {
      display: block;
      button[type="submit"] {
        font-size: 1rem;
        line-height: 1.5;
        height: 100%;
        padding: 0.35rem 1.125rem;
      }
    }
  }
}

/* ===================================
   一覧テーブル
   =================================== */
.submission-table {
  font-size: 0.875rem; /* 14px */
  background-color: var(--color-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--border-radius);
  box-shadow: var(--shadow-sm);
  table-layout: fixed; /* 💡 固定レイアウト */
  overflow-wrap: break-word; /* 💡 長い単語の改行を許可 */
  display: grid;
  width: 100%;
  grid-template-columns: 7rem 1fr 15rem 15rem auto auto auto;

  &.badges {
    grid-template-columns: 7rem 10rem 1fr 15rem 15rem auto auto;
  }

  &.users {
    grid-template-columns: 4rem 7rem 15rem 10rem 1fr 12rem 12rem auto;
  }

  &.groups {
    grid-template-columns: 4rem 15rem 15rem 1fr;
  }

  &.admin {
    grid-template-columns: 4rem 15rem 15rem 1fr;
  }

  &.group-users {
    grid-template-columns: 4rem 7rem 15rem 1fr 1fr auto;
  }

  &.group-content {
    grid-template-columns: 7rem 1fr 15rem 10rem 10rem 7rem auto;
  }

  &.my {
    grid-template-columns: 15rem 8rem 1fr 12rem auto auto;
  }

  &.myschedule {
    grid-template-columns: 1fr 15rem 15rem 15rem 15rem;
  }

  thead,
  tbody,
  tr {
    display: contents;
  }

  thead th {
    padding: 0.75rem 0.9375rem;
    text-align: left;
    font-weight: 600;
    color: var(--color-text-muted);
    border-bottom: 2px solid var(--border-color);
  }
  tbody td {
    padding: 0.75rem 0.9375rem;
    border-bottom: 1px solid var(--border-color);
    vertical-align: middle;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: normal;
    overflow-wrap: break-word;
  }
  tbody tr:last-child td {
    border-bottom: none;
  }
  tbody tr:hover {
    background-color: #f8f9fa;
  }

  td {
    .actions {
      display: inline-flex;
      gap: 0.5rem;
      flex-wrap: wrap;
    }

    &.full-width {
      grid-column: 1 / -1;
    }
  }

  th.badge,
  td.badge {
    text-align: center;
    border-left: 1px solid var(--border-color);
  }

  .actions .button {
    padding: 0.25rem 0.625rem;
    font-size: 0.75rem; /* 12px */
    box-shadow: none;
    &:hover {
      box-shadow: none;
      opacity: 0.8;
    }
    &.detail {
      background-color: var(--color-detail);
    }
    &.edit {
      background-color: var(--color-edit);
    }
    &.delete {
      background-color: var(--color-danger);
    }
    &.badge-register {
      background-color: #6c757d; /* グレー系の色 */
    }
    &.badge-edit {
      background-color: var(--color-edit);
    }
    &.badge-final {
      background-color: var(--color-final);
    }
  }
}

/* ===================================
   ログイン・サインアップ
   =================================== */
#login-container {
  width: max-content;
  margin: 4rem auto;
  padding: 2rem;
  h1 {
    text-align: center;
  }
  button {
    width: 100%;
    padding: 0.75rem;
  }
}

/* ===================================
   詳細表示ページ
   =================================== */
.detail-view {
  .detail-item {
    margin-bottom: 1.5rem;
    padding-bottom: 0.5rem;
    border-bottom: 1px solid var(--border-color);
    &:last-child {
      margin-bottom: 0;
      padding-bottom: 0;
      border-bottom: none;
    }
  }
  .detail-label {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--color-dark-surface);
    margin-bottom: 0.75rem;
  }
  .detail-value {
    padding-left: 1rem;
    line-height: 1.6;
    img {
      max-width: 12.5rem; /* 200px */
    }
  }
  .detail-group,
  .detail-list-item {
    background: #fafbfe;
    border: 1px solid #f0f2f5;
    padding: 1rem;
    border-radius: var(--border-radius);
  }
  .detail-group {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
  }
  .detail-list {
    list-style: none;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
  }
}

/* ===================================
   ユーティリティ
   =================================== */
.text-center {
  text-align: center;
}
.error,
.success {
  font-weight: 500;
  padding: 0.75rem 1.25rem;
  border-radius: var(--border-radius);
  margin-bottom: 1.5rem;
  border: 1px solid;
}
.error {
  color: #721c24;
  background-color: #f8d7da;
  border-color: #f5c6cb;
}
.success {
  color: #155724;
  background-color: #d4edda;
  border-color: #c3e6cb;
}
.required-mark {
  color: var(--color-danger, #dc3545);
  font-weight: bold;
  margin-left: 0.25rem;
}
.validation-error {
  margin-top: 0.75rem;
  padding: 0.5rem 0.75rem;
  font-size: 0.9em;
}
/* ステータス表示用バッジ */
.status-badge {
  display: inline-block;
  padding: 0.2rem 0.6rem;
  font-size: 0.75rem;
  font-weight: 600;
  line-height: 1;
  text-align: center;
  white-space: nowrap;
  vertical-align: baseline;
  border-radius: 0.5rem;
  color: #fff;
}

.status-draft {
  background-color: var(--color-text-muted, #718096);
}

.status-final {
  background-color: var(--color-final, #718096);
}

.status-published {
  background-color: var(--color-published, #718096);
}

.a-form {
  margin: 0;
  padding: 0;
  background: none;
  box-shadow: none;
  border: none;
  display: flex;

  .button {
    padding: 0.4rem 0.8rem;
    font-size: 0.9rem;
    flex-grow: 1;
  }
}

/* ===================================
   ページネーション
   =================================== */
.pagination {
  list-style: none;
  margin: 2rem 0;
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 0.5rem;
}

.pagination a,
.pagination span {
  display: inline-block;
  padding: 0.5rem 0.85rem;
  min-width: 2.5rem;
  text-align: center;
  border-radius: var(--border-radius);
  text-decoration: none;
  font-weight: 500;
}

.pagination a {
  color: var(--color-primary);
  background-color: var(--color-surface);
  border: 1px solid var(--border-color);
  transition: background-color 0.2s, color 0.2s;
}

.pagination a:hover {
  background-color: var(--color-primary);
  color: white;
  border-color: var(--color-primary);
}

.pagination .current-page {
  background-color: var(--color-primary);
  color: white;
  border: 1px solid var(--color-primary);
}

.jvc-content {
  .langs {
    display: flex;
    gap: 0;
    button {
      display: inline-block;
      padding: 0.35rem 1.125rem;
      background-color: #acacac;
      color: white;
      text-decoration: none;
      border: none;
      cursor: pointer;
      font-weight: 500;
      text-align: center;

      &[data-target-lang="ja"] {
        border-radius: var(--border-radius) 0 0 var(--border-radius);
      }
      &[data-target-lang="en"] {
        border-radius: 0 var(--border-radius) var(--border-radius) 0;
      }

      &:disabled {
        background-color: var(--color-primary-dark);
      }
    }
  }

  padding: 0;
  .__header {
    padding: 1rem 2rem;
    .__logos-wrapper {
      display: flex;
      justify-content: space-between;
      margin-bottom: 1rem;
    }
    .__logos {
      display: flex;
      align-items: center;
      gap: 2rem;

      h1.logo {
        display: inline-block;
        margin: 0;
        height: 5rem;
        img {
          object-fit: contain;
          height: 100%;
          max-width: max-content;
          max-height: max-content;
        }
      }
    }

    > .__top {
      display: flex;
      justify-content: space-between;
      margin: 0.5rem 0;
      .fields {
        display: flex;
        gap: 0.5rem;
        span {
          font-size: 1.1rem;
          font-weight: bold;
          color: #168caf;
          &::after {
            content: "|";
            margin-left: 0.5rem;
            font-weight: bold;
          }
        }
        ul {
          list-style: none;
          display: flex;
          padding: 0;
          margin: 0;
          li {
            font-size: 1.1rem;
            color: #168caf;
            font-weight: bold;
          }
        }
      }
      .content-types {
        list-style: none;
        display: flex;
        gap: 0.5rem;
        margin: 0;
        padding: 0;

        li {
          font-size: 1rem;

          &.learning {
            color: #fff;
            background-color: rgba(245, 120, 51, 1);
            padding: 0 1.5rem;
            border-radius: 4px;
          }

          &.information {
            color: #fff;
            background-color: rgba(55, 181, 114, 1);
            padding: 0 1.5rem;
            border-radius: 4px;
          }
        }
      }
    }

    .__main {
      display: flex;
      gap: 1rem;
      align-items: self-start;

      .__meta {
        width: 100%;
        display: flex;
        flex-direction: column;
        justify-content: space-between;

        .__top {
          width: 100%;
          .title {
            font-size: 1.8rem;
            margin: 0 0 0.5em 0;
          }
          .keywords {
            list-style: none;
            margin: 0;
            padding: 0;
            display: flex;
            flex-wrap: wrap;
            gap: 0.5rem;
            color: #168caf;
            margin: 1.5rem 0;

            li {
              border: 1px solid;
              border-radius: 2rem;
              padding: 0 1.5rem;
              &::before {
                content: "#";
              }
            }
          }
          .description {
            font-size: 1rem;
          }
        }

        .__bottom {
          dl {
            display: flex;
            flex-wrap: wrap;
            gap: 1rem 1.5rem;
            div:not(:last-child) {
              border-right: 1px solid #ddd;
              padding-right: 1.5rem;
            }

            dt {
              color: #168caf;
            }
            dd {
              font-size: 1.1rem;
              font-weight: bold;
              margin: 0;
            }
          }
        }
      }
      .__sub {
        width: 100%;

        .thumbnail {
          position: relative;
          aspect-ratio: 16 / 9;
          width: 100%;
          height: auto;
          box-shadow: 0 0 3px 0 rgb(0 0 0 / 12%), 0 2px 3px 0 rgb(0 0 0 / 22%);

          img {
            height: 100%;
            width: 100%;
            object-fit: cover;
          }

          button.download-btn {
            background-image: url(../icon/download.svg);
            background-size: 80%;
            background-position: center;
            background-repeat: no-repeat;
            background-color: #ffffff80;
            box-shadow: 0 4px 8px rgba(0, 0, 0, 0.3);
            width: 2rem;
            height: 2rem;
            border-radius: 2rem;
            position: absolute;
            bottom: 5px;
            right: 5px;
            border: 0;
            cursor: pointer;

            &:active {
              /* クリック時に沈み込む効果（より立体的に見せる） */
              transform: translateY(1px);
              box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
            }
          }
        }

        > .__bottom {
          margin-top: 2rem;
          display: flex;
          flex-direction: column;
          gap: 1rem;

          .__badges {
            flex-grow: 1;
            width: 100%;
          }

          .__buttons {
            flex-grow: 1;
            width: 100%;

            .action-btns {
              display: flex;
              flex-direction: column;
              gap: 0.5rem;

              .button-enroll {
                font-size: 1.5rem;
                padding: 0.5em;
                background-color: #168caf;
              }
            }
          }
        }
      }
    }
  }
  .content-copyright {
    margin-top: 3rem;
    background-color: #b3b3b3;
    color: #fff;
    display: flex;
    justify-content: center;
    align-items: center;
    height: 2.5rem;
    font-size: 1rem;
  }
  .__body {
    padding: 1rem 2rem;
    .menu {
      list-style: none;
      margin: 0;
      padding: 0;
      display: flex;
      gap: 1rem 3rem;

      .__label {
        padding-bottom: 0.75rem;
        display: flex;
        flex-direction: column;
        gap: 0;
        justify-content: flex-start;
        align-items: center;
        cursor: pointer;

        &.selected {
          border-bottom: 5px solid #168caf;
        }

        &:hover {
          opacity: 0.8;
          border-bottom: 5px solid #168caf80;
        }

        .main {
          font-size: 1.6rem;
          font-weight: bold;
        }
        .sub {
          font-weight: bold;
          color: #168caf;
        }
      }
    }
    > .__main {
      margin: 2rem 0;

      section {
        > h2 {
          font-size: 2rem;
          color: #168caf;
          border-bottom: 2px solid;

          .sub {
            font-size: 0.65em;
          }
        }

        section.subsection {
          > h3 {
            font-size: 1.3rem;
            border-left: 0.5rem solid #168caf;
            line-height: 1.2;
            padding-left: 0.5rem;
            color: #168caf;
          }
        }

        .staffs {
          display: flex;
          flex-wrap: wrap;
          gap: 1rem;
          list-style: none;
          padding: 0;
          margin: 0;

          .staff {
            display: flex;
            gap: 1rem;
            background-color: rgb(245, 245, 245);
            width: calc(50% - 0.5rem);
            border-left: 5px solid #168caf;
            padding: 1rem;

            &:has(.__career) {
              width: calc(100%);

              .__main {
                width: 100%;
              }
              .__career {
                width: 100%;
              }
            }

            .__main {
              display: flex;
              gap: 2rem;
              .__image {
                width: 10rem;
                min-width: 10rem;
                height: 10rem;
                min-height: 10rem;
                border-radius: 100rem;
                overflow: hidden;
                img {
                  object-fit: cover;
                  width: 100%;
                  height: 100%;
                }
              }
              .__meta {
                flex-grow: 1;

                .role {
                  list-style: none;
                  padding: 0;
                  margin: 0;
                  display: flex;
                  flex-wrap: wrap;
                  gap: 0.5rem;
                  margin-bottom: 0.75rem;

                  li {
                    background-color: #168caf;
                    color: #fff;
                    border-radius: 1rem;
                    padding: 0.1rem 1.5rem;
                  }
                }
                .name {
                  font-size: 1.2rem;
                  font-weight: normal;
                  color: #168caf;
                  margin: 0;
                  margin-bottom: 0.5rem;
                }
                p {
                  margin: 0;
                }
              }
            }
          }
        }
      }
    }
  }

  ul.competency_tag {
    list-style: none;
    padding: 0;
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem 1rem;
    margin-top: -0.5rem;

    li {
      background-color: #168caf;
      padding: 0rem 1.5rem;
      border-radius: 4px;
      font-size: 1.1rem;
      color: #fff;
    }
  }
}

#main:has(#markdown-editor) {
  padding-bottom: 0;
}
#markdown-editor {
  display: flex;
  height: calc(100vh - 8rem);
  align-items: stretch;

  #editor-area {
    display: flex;
    flex-direction: column;
    height: 100%;
    width: 50%;
    .action-btns {
      .button {
        font-size: 1rem;

        &.help {
          background-color: #d69e2e;
        }
      }
    }
  }
  #editor {
    height: 100%;
    width: 100%;
    padding: 1rem;
    font-family: "SF Mono", "Consolas", "Menlo", monospace;
    font-size: 1rem;
    line-height: 1.6;
    border: none;
    resize: none;
    outline: none;
    background-color: #d6d6d6;
    tab-size: 2;
    -moz-tab-size: 2;
  }
  #preview-area {
    display: flex;
    flex-direction: column;
    height: 100%;
    width: 50%;

    #toggle-preview-btn {
      padding: 0.5rem;
      width: calc(2rem + 1px);
      height: calc(2rem + 1px);
      border: none;
      display: flex;
      align-items: center;
      justify-content: center;
      margin-bottom: 1px;
    }

    #toggle-preview-btn svg {
      width: 1.5rem;
      height: 1.5rem;
    }
  }
  #preview {
    flex-grow: 1;
    width: 100%;
    background-color: #fff;
    padding: 1rem;
    overflow-y: auto;
    font-family: "Noto Sans JP", sans-serif;
  }

  &.preview-mode {
    #editor-area {
      display: none;
    }
    #preview-area {
      width: 100%;
    }
  }
}

.course-content {
  h1 {
    font-size: 1.5em;
    .heading-number {
      color: #168caf;
      margin-right: 0.25em;
    }
  }
  h2 {
    font-size: 1.2em;
    .heading-number {
      color: #168caf;
      margin-right: 0.25em;
    }
  }
  h2.__label {
    margin-top: 0;
    margin-bottom: 1rem;
    font-size: 2em;
    color: #168caf;
    border-bottom: 2px solid;

    .sub {
      font-size: 0.65em;
    }
  }
  h3 {
    font-size: 1em;
    .heading-number {
      color: #168caf;
      margin-right: 0.25em;
    }
  }
  a {
    text-decoration: none;
    color: #ff8444;
    font-weight: bold;
  }
  table {
    width: 100%;
    margin: 1.5em 0;
    border-collapse: collapse;
    border: 1px solid #ddd;
    border-radius: 6px;
    box-shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.05), 0 1px 2px 0 rgba(0, 0, 0, 0.03);
    overflow: hidden; /* 角丸を有効にするため */

    th,
    td {
      padding: 0.75em 1em;
      text-align: left;
      border-bottom: 1px solid #ddd;
    }

    thead th {
      background-color: #f8f9fa;
      font-weight: 600;
      color: #168caf;
    }

    tbody tr:last-child td {
      border-bottom: none;
    }

    th[align="center"],
    td[align="center"] {
      text-align: center;
    }

    th[align="right"],
    td[align="right"] {
      text-align: right;
    }
  }

  ol {
    padding-left: 2.5em;
    margin: 0;
    word-break: break-all;
    li::marker {
      color: #168caf; /* :rootで定義した色 */
      font-weight: 700; /* 太字にする */
    }
  }
  ul {
    margin: 0;
    padding-left: 1.25em;
    list-style: none;
    word-break: break-all;

    li {
      position: relative;
      padding-left: 1em;
      margin-bottom: 0.25em;

      &::before {
        content: "";
        position: absolute;
        left: 0;
        top: 0;
        transform: translateY(0.5em);
        width: 0;
        height: 0;
        border-top: 0.4em solid transparent;
        border-bottom: 0.4em solid transparent;
        border-left: 0.6em solid #168caf;
      }
    }
  }

  hr {
    color: #ddd;
  }

  .custom-note {
    margin: 1em 0;
    padding: 0.5em;
    border-left-width: 4px;
    border-left-style: solid;
    border-radius: 4px;
    display: flex; /* 💡 アイコンとテキストを横並びに */
    align-items: flex-start; /* 上揃え */
    gap: 0.5em; /* アイコンとテキストの間隔 */
  }

  /* アイコンのスタイル */
  .custom-note-icon svg {
    width: 1.2em;
    height: 1.2em;
    stroke-width: 2.5;
    transform: translateY(0.2em);
  }

  /* テキスト部分のスタイル */
  .custom-note-content > p:first-child {
    margin-top: 0;
    font-weight: 500;
  }
  .custom-note-content > p:last-child {
    margin-bottom: 0;
  }

  /* タイプごとの色分け */
  .custom-note.info {
    background-color: #eef2ff;
    border-color: #6366f1;
    color: #4338ca;
  }
  .custom-note.info .custom-note-icon {
    color: #6366f1;
    min-width: 1.3em;
    width: 1.3em;
    transform: translateY(0.2em);
  }

  .custom-note.warn {
    background-color: #fffbeb;
    border-color: #f59e0b;
    color: #b45309;
  }
  .custom-note.warn .custom-note-icon {
    color: #f59e0b;
    min-width: 1.3em;
    width: 1.3em;
    transform: translateY(0.2em);
  }

  .custom-note.alert {
    background-color: #fee2e2;
    border-color: #ef4444;
    color: #b91c1c;
  }
  .custom-note.alert .custom-note-icon {
    color: #ef4444;
    min-width: 1.3em;
    width: 1.3em;
    transform: translateY(0.2em);
  }
}

/* ===================================
   モーダルウィンドウ
   =================================== */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0, 0, 0, 0.6);
  display: none; /* 普段は隠しておく */
  align-items: center;
  justify-content: center;
  z-index: 2000;
}

.modal-overlay.is-open {
  display: flex; /* is-openクラスが付いたら表示 */
}

.modal-content {
  background: var(--color-surface, #fff);
  padding: 2rem;
  border-radius: var(--border-radius, 8px);
  box-shadow: var(--shadow-md);
  width: 90%;
  max-width: 700px;
  max-height: 80vh;
  overflow-y: auto;
  position: relative;
}

.modal-close-btn {
  position: absolute;
  top: 1rem;
  right: 1rem;
  font-size: 2rem;
  line-height: 1;
  background: none;
  border: none;
  cursor: pointer;
  color: var(--color-text-muted);
}

.modal-content pre {
  background-color: #f4f4f4;
  padding: 1rem;
  border-radius: var(--border-radius);
  white-space: pre-wrap;
  word-break: break-all;
}

#pdf4download {
  /* 💡 PDFの背景が透明にならないように背景色を指定 */
  background-color: white;
  font-size: 16pt;

  mjx-math[display="block"] {
    display: block !important;
    font-size: 1.2em !important; /* 通常より少し大きく見せる */
    margin: 1em 0 !important;
  }
}

/* ===================================
   管理ダッシュボード
   =================================== */
.dashboard-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr); /* 2つのカードを横並びに */
  gap: 2rem;
  margin-bottom: 2rem;
}

.dashboard-card {
  background-color: var(--color-surface);
  padding: 1.5rem;
  border-radius: var(--border-radius);
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--border-color);
  display: flex;
  flex-direction: column; /* 中の要素を縦に並べる */

  &.full-width {
    grid-column: 1 / -1;
  }

  .__header {
    display: flex;
    justify-content: space-between;
  }
}

.dashboard-card h2 {
  margin: 0;
  font-size: 1.2rem;
}

.dashboard-card p {
  color: var(--color-text-muted);
}

.dashboard-card .button {
  align-self: flex-start; /* ボタンを左下に配置 */
}

/* グラフ用のインナーカード */
.chart-card {
  margin-top: 1.5rem;
  padding: 1rem;
  border: 1px solid var(--border-color);
  border-radius: var(--border-radius);
}

.chart-card h3 {
  text-align: center;
  margin-top: 0;
  margin-bottom: 1rem;
  font-size: 1rem;
  color: var(--color-text-muted);
}

.chart-container {
  position: relative;
}
/* 💡 円グラフのコンテナの高さを指定して間延びを防ぐ */
.chart-container.pie-chart {
  height: 200px;
  margin: 0 auto;
}

.chart-container.pie-chart {
  height: 200px;
  margin: 0 auto;
}
/* 💡【追加】折れ線グラフのコンテナの高さ */
.chart-container.line-chart {
  height: 250px;
}

.badge-preview {
  display: flex;
  gap: 1rem;

  .__left {
    width: max-content;

    .badge-wrapper {
      position: relative;
      width: 400px;
      min-width: 400px;
      aspect-ratio: 1;

      .badge-image {
        position: absolute;
        top: 0;
        left: 0;
        width: 100%;
        height: 100%;
        background-size: contain;
        background-position: center;
        background-repeat: no-repeat;
      }

      .badge-title {
        position: absolute;
        width: 72%;
        height: 55%;
        top: 20%;
        left: 50%;
        transform: translateX(-50%);
        display: flex;
        justify-content: center;
        align-items: center;
        font-size: 36px;
        text-align: center;
        font-family: "Lato", sans-serif;
        overflow: hidden;
        word-break: keep-all;
      }
      button.download-btn {
        background-image: url(../icon/download.svg);
        background-size: 80%;
        background-position: center;
        background-repeat: no-repeat;
        background-color: #ffffff80;
        box-shadow: 0 4px 8px rgba(0, 0, 0, 0.3);
        width: 2rem;
        height: 2rem;
        border-radius: 2rem;
        position: absolute;
        bottom: 5px;
        right: 5px;
        border: 0;
        cursor: pointer;

        &:active {
          /* クリック時に沈み込む効果（より立体的に見せる） */
          transform: translateY(1px);
          box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
        }
      }
    }
    #alert_overfolw {
      margin-top: 1rem;
      text-align: center;
      color: red;
    }

    .title {
      font-size: 1.8rem;
      line-height: 1.2;
    }
  }

  .__right {
    flex-grow: 1;

    table.badge-metadata {
      th {
        min-width: 5.5rem;
        text-align: right;
        vertical-align: top;

        .copy-btn {
          cursor: copy;
          -ms-user-select: none;
          -webkit-user-select: none;
          user-select: none;
        }
      }
      td {
        font-family: "Noto Sans Mono", "Noto Sans JP", sans-serif;
        padding-bottom: 1em;
        white-space: pre-wrap;
      }
      td.separator {
        font-weight: bold;
        vertical-align: top;
      }
    }
  }
}

.info-table {
  width: 100%;
  margin-top: 1rem;
  background-color: #fff;
  border-radius: var(--border-radius);
  box-shadow: var(--shadow-sm);
}
.info-table th,
.info-table td {
  padding: 0.75rem;
  text-align: left;
}
.info-table th {
  width: 10rem;
  background-color: #f8f9fa;
}

a {
  color: rgb(27, 75, 164);
}

.rel-link {
  list-style: none;
  padding: 0 1rem;
  display: flex;
  align-items: flex-start;
  gap: 0.5rem 5rem;

  > li {
    width: 100%;
  }

  ul {
    margin: 0.5rem 0;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;

    &.sublist {
      gap: 0.5rem 3rem;
      display: grid;
      grid-template-columns: repeat(auto-fill, minmax(20rem, 1fr));
    }
  }
}

ul.news {
  padding: 0;
  margin: 0;
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;

  li {
    display: flex;
    gap: 1rem;
    align-items: center;
  }
  time {
    color: #75798b;
  }

  span.tag {
    background-color: #bebebe;
    font-size: 0.85em;
    border-radius: 1rem;
    min-width: 5rem;
    display: flex;
    justify-content: center;
    align-items: center;
  }
}

.range-input-container {
  display: flex;
  align-items: center;
  gap: 15px;
}

.range-input-container input[type="range"] {
  flex-grow: 1;
  width: 100%;
  background-color: #e0e0e0;
  padding: 0;
}

.range-value-display {
  font-weight: bold;
  font-family: monospace;
  background-color: #f1f3f5;
  padding: 4px 8px;
  border-radius: 4px;
  min-width: 3em; /* 幅を固定してガタつきを防ぐ */
  text-align: center;
}

.my-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 1rem;

  .my-card {
    background-color: var(--color-surface);
    padding: 1.5rem;
    border-radius: var(--border-radius);
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--border-color);
    display: flex;
    flex-direction: column; /* 中の要素を縦に並べる */
    gap: 1rem;

    h3 {
      margin: 0;
      display: flex;
      flex-direction: column;
      padding-bottom: 0.7rem;
      border-bottom: 1px solid #e9ecef;
      span {
        &.role {
          font-size: 0.8rem;
          color: #6c757d;
        }
      }
    }
  }
  .dashboard-links {
    display: flex;
    flex-direction: column;
    gap: 12px;

    a {
      display: flex;
      align-items: center;
      gap: 12px;
      padding: 12px 16px;
      background-color: #f8f9fa;
      border-radius: 6px;
      text-decoration: none;
      color: #495057;
      font-weight: 500;
      transition: background-color 0.2s ease, color 0.2s ease;

      &:hover {
        background-color: #e2e6ea;
        color: #212529;
      }

      img {
        width: 20px;
        height: 20px;
        flex-shrink: 0;
        color: #6c757d;
      }
    }
  }
}

.mypage {
  display: flex;
  flex-direction: column;
  gap: 2rem;

  .page-header {
    margin-bottom: 0;
  }
}
