:root {
  /* Bootstrap font-family をカスタマイズ */
  --bs-font-sans-serif: "メイリオ", Meiryo, "Hiragino Kaku Gothic ProN", "ヒラギノ角ゴ ProN W3", "ＭＳ Ｐゴシック", "MS PGothic", Helvetica, Arial, sans-serif;
  --bs-body-font-family: var(--bs-font-sans-serif);
  --bs-font-monospace: SFMono-Regular, "SF Mono", "Monaco", "Inconsolata", "Roboto Mono", "Source Code Pro", Menlo, Consolas, "DejaVu Sans Mono", monospace;

  /* Typographyのカスタマイズ */
  --bs-body-line-height: 1.8;
  --bs-body-font-size: 1.1rem;
  

  /* Bootstrap primary color をカスタマイズ */
  --bs-primary: #188ce1;
  --bs-hover-bg: #157abf; /* 少し暗いシェード */
  --bs-active-bg: #126799; /* さらに暗いシェード */

  --manatomo-navbar-bg: #f7f7ff;
  --manatomo-body-bg-color: #c1e0f7;
  --manatomo-main-bg-color: #fffdfd;
  --ai-message-color: #c3a041;
  --ai-message-bg-color: #fbf5e4;
  /* --ai-message-color: #f4c649; */
  /* --ai-message-bg-color: #fff9e9; */
  --user-message-color: #aaa;
  --user-message-bg-color: #fefefe;
  --faq-mark-color: #294f87;
}

body {
  background-color: var(--manatomo-body-bg-color);
}

header {
  .bg-manatomo-navbar {
    background-color: var(--manatomo-navbar-bg) !important;
  }

  .navbar-brand {
    img {
      height: 32px;
    }
  }

  .head-logo {
    margin-left: auto;
    border: solid 1px #ccc;
    border-radius: 3px;
    padding: 5px 10px;

    a img {
      width: 100px;
    }
  }
}

main {
  position: relative;
  /*height: calc(100dvh - 124px);*/
  background-color: var(--manatomo-main-bg-color);
  border-radius: 0.7em;
  margin-top: 10px;
  margin-bottom: 10px;
  /*overflow-y: scroll;*/

}

footer {
  p {
    font-size: 10px;
    color: #666;
  }

  height: 24px;
}

.container {
  --bs-gutter-x: 2.5rem;
}

main.container {
  padding: 1.5rem 1.5rem;
}

h2.book-title {
  font-family: "M PLUS 1p", sans-serif;
  font-weight: 700;
  font-size: 1.5rem;
  padding: 0.2em 0 10px 0;
}

h2.question-title {
  font-family: "M PLUS 1p", sans-serif;
  font-weight: 600;
  font-size: 1.6rem;
  padding: 0.2em 0 10px 0;
  margin-bottom: 1em;
  top: -1.5rem;
  border-bottom: solid 1px #ccc;
  background-color: var(--manatomo-main-bg-color);

  span.book-title {
    font-weight: 400;
    font-size: 1rem;
    line-height: 2;
  }
}

.faq {
  h3 {
    font-size: 1.4rem;
    font-weight: 600;
  }

  ul {
    list-style-type: none;
    padding-left: 0;
  }

  li {
    position: relative;
    padding-left: 1.8em;
    margin-bottom: 0.5em;
  }

  li::before {
    content: "\f134"; /* bi-question-circle のUnicodeコード */
    font-family: "bootstrap-icons";
    position: absolute;
    left: 0;
    top: 0;
    color: var(--faq-mark-color); /* Bootstrap primary color */
    font-size: 1em;
  }

  a:hover, a:link, a:visited, a:active {
    color: #000;
    text-decoration: underline dotted 1px;
  }
}

.message {
  position: relative;
  border-radius: 0.5em;
  padding: 1em;
  flex-grow: 2;
}

.user-message {
  border: solid 2px var(--user-message-color);
  background-color: var(--user-message-bg-color);

  img {
    max-width: 100%;
  }
}

.user-message::before {
  content: "";
  position: absolute;
  width: 15px;
  height: 18px;
  background-color: var(--user-message-bg-color);
  top: 10px;
  right: -13px;
  clip-path: polygon(0 0, 100% 50%, 0 100%);
  margin: auto;
  z-index: 2;
}

.user-message::after {
  content: "";
  position: absolute;
  width: 15px;
  height: 18px;
  background-color: var(--user-message-color);
  top: 10px;
  right: -15px;
  clip-path: polygon(0 0, 100% 50%, 0 100%);
  margin: auto;
}

.ai-message {
  border: solid 2px var(--ai-message-color);
  background-color: var(--ai-message-bg-color);
}

.ai-message::before {
  content: "";
  position: absolute;
  width: 15px;
  height: 18px;
  background-color: var(--ai-message-bg-color);
  top: 10px;
  left: -13px;
  clip-path: polygon(0 50%, 100% 0, 100% 100%);
  margin: auto;
  z-index: 2;
}

.ai-message::after {
  content: "";
  position: absolute;
  width: 15px;
  height: 18px;
  background-color: var(--ai-message-color);
  top: 10px;
  left: -15px;
  clip-path: polygon(0 50%, 100% 0, 100% 100%);
  margin: auto;
}

.face {
  width: 48px;

  p {
    font-size: 40px;
    color: white;
    text-align: center;
    display: inline-block;
    border-radius: 50%;
    width: 48px;
    height: 48px;
    padding: 0;
    margin: 0;
    line-height: 1;
  }
}

.user-face {
  margin-left: 20px;

  p {
    background-color: var(--user-message-color);
  }
}

.ai-face {
  margin-right: 20px;

  p {
    img {
      width: 48px;
      height: 48px;
    }
  }
}

.student-message-canvas-wrapper {
  position: relative;

  .student-message-canvas {
    border: solid 1px lightgray;
    border-radius: 8px;
    touch-action: none;
  }
}

@media (min-width: 768px) {
  .student-message-btn {
    width: 15em;
  }
}

/* より詳細な制御が必要な場合 */
.btn-primary {
  --bs-btn-bg: var(--bs-primary);
  --bs-btn-border-color: var(--bs-primary);
  --bs-btn-hover-bg: var(--bs-hover-bg); /* 少し暗いシェード */
  --bs-btn-hover-border-color: var(--bs-hover-bg);
  --bs-btn-active-bg: var(--bs-active-bg); /* さらに暗いシェード */
  --bs-btn-active-border-color: var(--bs-active-bg);
}

.btn-lg {
  --bs-btn-font-size: 1rem;
  --bs-btn-padding-y: 0.8rem;
  --bs-btn-padding-x: 1.8rem;
  --bs-btn-border-radius: 0.3rem;
}

.btn-secondary {
  --bs-btn-font-size: 1rem;
  --bs-btn-padding-y: 0.8rem;
  --bs-btn-padding-x: 1.8rem;
  --bs-btn-border-radius: 0.3rem;
}

.loading-back {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background-color: rgba(255, 255, 255, 0.5);
  z-index: 2;
  display: flex;
  justify-content: center;
  align-items: center;

  .loading {
    padding: 2em 3em;
    background-color: rgba(11, 65, 151, 0.6);
    border-radius: 1em;
    color: white;

    .thinking-imagae-wrapper {
      img {
        border-radius: 50%;
      }
    }
  }
}

.question-image-wrapper {
  max-width: 640px;
  margin-bottom: 0.5em;

  img.question-image {
    border: solid 1px lightgray;
    max-width: 100%;
  }
}

.form-check-label {
  text-decoration: underline dotted gray 2px;
}

.help-content {
  font-family: "メイリオ", Meiryo, "Hiragino Kaku Gothic ProN", "ヒラギノ角ゴ ProN W3", "ＭＳ Ｐゴシック", "MS PGothic", Helvetica, Arial, sans-serif;

  h1 {
    font-size: 1.8rem;
    font-weight: bold;
    position: relative;
    padding-bottom: 10px;
    margin-bottom: 30px;
    margin-top: 60px;
  }

  h1:first-child {
    margin-top: 20px;
  }

  h1:before {
    right: 0;
    background-color: #d6d6d6;
    height: 1px;
    position: absolute;
    left: 0;
    bottom: 0;
    content: "";
  }

  h1:after {
    width: 60px;
    height: 4px;
    background-color: #00afec;
    position: absolute;
    left: 0;
    bottom: 0;
    content: "";
  }

  h2 {
    font-size: 1.5rem;
    font-weight: bold;
    position: relative;
    background-color: #e0f5fd;
    padding: 12px 15px;
    margin-bottom: 15px;
    margin-top: 20px;
  }

  h2:before {
    position: absolute;
    content: "";
    background-color: #00afec;
    width: 4px;
    top: 0;
    bottom: 0;
    left: 0;
  }

  h3 {
    font-size: 1.3rem;
    font-weight: bold;
  }

  img.screen {
    max-width: 100%;;
  }

  img.btn-img {
    width: 48px;
    margin-right: 0.5em;
  }

  .index-box {
    font-size: 80%;
    background-color: #eee;

    ul {
      margin: 0;
    }

    a, a:link, a:visited, a:hover, a:active {
      color: #333;
      text-decoration: underline dotted 1px;
    }
  }
}