/* @media (prefers-color-scheme: dark) { */
body {
  background-color: #333;
  color: #fff;
}

button {
  color: #fff;
  border: none;

  &:hover {
    cursor: pointer;
    background-color: #555;
  }
}

/* } */

html,
body {
  height: 100%;
  margin: 0;
  padding: 0;
}

body {
  display: flex;
  flex-direction: column;
  height: auto;
  min-height: 100%;
}

button {
  background: none;
}

.footer-icon-button {
  color: #fff;
  padding: 2px 6px;
  text-decoration: none;

  &:hover {
    cursor: pointer;
    background-color: #555;
  }
}

#app {
  display: flex;
  flex-direction: column;
  flex: 1;
}

header,
footer {
  position: sticky;
  flex: 0 0 2.5%;
  background-color: #333;
}

header {
  display: flex;
  justify-content: space-between;
  top: 0;
  color: #fff;
}

footer {
  bottom: 0;

  & input {
    flex: 1;
  }
}

main {
  flex: 1;
  overflow-y: auto;
  padding: 1rem;
}

.chat-container {
  display: flex;
  flex-direction: column;
}

details {
  background-color: transparent;
  border-radius: 4px;

  &.included {
    border: 1px dashed #70dbbb;
  }

  & summary {
    padding: 0.25rem;
    cursor: pointer;
    list-style: none;
    display: block;
    border-radius: 4px;

    &::-webkit-details-marker {
      display: none;
    }

    &:hover {
      background-color: rgba(128, 128, 128, 0.1);
    }
  }

  & a,
  span {
    color: #999;
    font-size: 0.75rem;
  }

  & .bot-response {
    background-color: #444;
    color: #fff;
    word-wrap: break-word;
    white-space: pre-wrap;
    font-family: "Segoe UI", sans-serif;
    font-size: 1.25rem;
    padding: 0.5rem;
    margin-top: 0.5rem;
    border-radius: 4px;
  }

  & .bot-message-text {
    line-height: 1.85;
  }

  & .bot-message-text,
  & .bot-message-text span,
  & .bot-message-text ruby {
    color: inherit;
    font-size: inherit;
  }

  & .bot-message-text rt,
  & .bot-message-text rp {
    -webkit-user-select: none;
    user-select: none;
  }

  & .message-preview {
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    margin: 0;
  }
}

.show-all-container {
  text-align: center;
  margin: 10px 0;

  & button {
    background-color: #444;
    color: #fff;
    padding: 5px 10px;
    border-radius: 4px;
    border: 1px solid #555;
    cursor: pointer;
  }
}

.thread-selector {
  position: relative;
  display: inline-block;
  flex: 1;
  margin: 0 10px;
}

.thread-selector select {
  background-color: #444;
  color: #fff;
  padding: 5px 10px;
  border-radius: 4px;
  border: 1px solid #555;
  cursor: pointer;
  width: 100%;
}

.thread-delete-btn {
  position: absolute;
  right: 5px;
  top: 50%;
  transform: translateY(-50%);
  background: none;
  border: none;
  color: #ff7f7f;
  font-weight: bold;
  cursor: pointer;
  padding: 0 5px;
}

.hidden-message-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: black;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 999;
  color: #666;
  font-size: 1.5rem;
  user-select: none;
  text-align: center;
  touch-action: manipulation;
}
.secret-unlock-target {
  cursor: pointer;
  touch-action: manipulation;
  -webkit-user-select: none;
  user-select: none;
  -webkit-touch-callout: none;
}

.furigana-toggle {
  background: transparent;
  border: 0;
  bottom: calc(2.75rem + env(safe-area-inset-bottom, 0px));
  color: #888;
  cursor: pointer;
  font: inherit;
  font-size: 0.8rem;
  padding: 0;
  position: fixed;
  right: 0.75rem;
  z-index: 100;
}

.furigana-toggle.active {
  color: #fff;
}

.furigana-toggle:disabled {
  cursor: default;
  opacity: 0.65;
}

.furigana-blur-toggle {
  background: transparent;
  border: 0;
  bottom: calc(4.5rem + env(safe-area-inset-bottom, 0px));
  color: #888;
  cursor: pointer;
  font: inherit;
  font-size: 0.8rem;
  padding: 0;
  position: fixed;
  right: 0.75rem;
  z-index: 100;
}

.furigana-blur-toggle.active {
  color: #fff;
}

.furigana-chunk.converting {
  opacity: 0.75;
}

.bot-message-text .token-kana {
  display: none;
}

.furigana-blur-active .bot-message-text .token {
  text-decoration: underline solid;
  text-decoration-color: rgba(255, 255, 255, 0.18);
  text-decoration-thickness: 2px;
  text-underline-offset: 0.2em;
}

.furigana-blur-active .bot-message-text .token + .token {
  margin-left: 0.18em;
}

.furigana-blur-active .bot-message-text .token-with-kanji {
  cursor: pointer;
  text-decoration: underline dotted;
  text-decoration-color: currentColor;
  text-decoration-thickness: 2px;
  text-underline-offset: 0.2em;
}

.furigana-blur-active .bot-message-text .token-with-kanji .token-kana {
  display: inline;
}

.furigana-blur-active .bot-message-text .token-with-kanji .token-furigana {
  display: none;
}

.furigana-blur-active .bot-message-text .token-with-kanji.revealed .token-kana {
  display: none;
}

.furigana-blur-active .bot-message-text .token-with-kanji.revealed .token-furigana {
  display: inline;
}

.bot-message-text .pos-noun {
  color: #82C5E0;
}

.bot-message-text .pos-verb {
  color: #F0A98E;
}

.bot-message-text .pos-adj {
  color: #B5DD8C;
}

.bot-message-text .pos-adv {
  color: #C9A0E0;
}

rt {
  color: #bbb;
  font-size: 0.55em;
}
