:root {
  color-scheme: light dark;

  --bg-light: #e9f7e1;
  --font-light: #1b2621;
  --forest-bg-light: #c5d9bf;
  --tree-bg-select: #a2b39d;
  --tree-node-bg-light: #c5d9bf;
  --node-border: #baccb4;
  --node-highlight: #475945;

  --bg-dark: #1d251f;
  --font-dark: #baccc0;
  --forest-bg-dark: #171f19;
  --tree-bg-select-dark: #2a382d;
  --tree-node-bg-dark: #2a382d;
  --node-border-dark: #475945;
  --node-highlight-dark: #baccb4;
}

body {
  background-color: var(--bg-light);
  color: var(--font-light);
}

html.light-mode body {
  background-color: var(--bg-light);
  color: var(--font-light);
}

html.light-mode .nav {
  background-image: linear-gradient(var(--bg-light) 25%, rgba(233, 247, 225, 0));
}

html.light-mode .account, html.light-mode .account-menu {
  background-color: var(--forest-bg-light);
  border: 1px solid var(--node-border);
}

html.light-mode .account-menu-item.highlight {
  background: var(--tree-bg-select);
}

html.light-mode .forest {
  background-color: var(--forest-bg-light);
  border: 1px solid var(--node-border);
}

html.light-mode .chat-tree-gradient {
  background-image: linear-gradient(to left, var(--forest-bg-light) 0%, rgba(0, 0, 0, 0));
}

html.light-mode .chat-tree.highlight {
  background: var(--tree-bg-select);
}

html.light-mode .chat-user {
  background-color: var(--forest-bg-light);
}

html.light-mode .chat-assistant {
  background-color: #ddebd5;
}

html.light-mode .chat-interface {
  background-color: var(--forest-bg-light);
}

html.light-mode .system-input {
  background-color: var(--forest-bg-light);
  color: var(--font-light);
}

html.light-mode .message-input {
  background-color: var(--forest-bg-light);
  color: var(--font-light);
}

html.light-mode .minimap {
  background-color: var(--bg-light);
}

html.light-mode .tree-node {
  background-color: var(--tree-node-bg-light);
}

html.light-mode .tree-node.highlight {
  border-color: var(--node-highlight);
}

html.light-mode .tree-line {
  border-color: var(--node-border);
}

html.light-mode .tree-line.highlight {
  border-color: var(--node-highlight);
}

html.light-mode #color-mode-switch label {
  background: var(--tree-bg-select);
}

html.dark-mode body {
  background-color: var(--bg-dark);
  color: var(--font-dark);
}

html.dark-mode .nav {
  background-image: linear-gradient(var(--bg-dark) 25%, rgba(233, 247, 225, 0));
}

html.dark-mode .account, .account-menu {
  background-color: var(--forest-bg-dark);
  border: 1px solid var(--node-border-dark);
}

html.dark-mode .account-menu-item.highlight {
  background: var(--tree-bg-select-dark);
}

html.dark-mode .forest {
  background-color: var(--forest-bg-dark);
  border: 1px solid var(--node-border-dark);
}

html.dark-mode .chat-tree-gradient {
  background-image: linear-gradient(to left, var(--forest-bg-dark) 0%, rgba(0, 0, 0, 0));
}

html.dark-mode .chat-tree.highlight {
  background: var(--tree-bg-select-dark);
}

html.dark-mode .chat-user {
  background-color: var(--forest-bg-dark);
}

html.dark-mode .chat-assistant {
  background-color: var(--tree-bg-select-dark);
}

html.dark-mode .chat-interface {
  background-color: var(--forest-bg-dark);
}

html.dark-mode .system-input {
  background-color: var(--forest-bg-dark);
  color: var(--font-dark);
}

html.dark-mode .message-input {
  background-color: var(--forest-bg-dark);
  color: var(--font-dark);
}

html.dark-mode .minimap {
  background-color: var(--bg-dark);
  border-color: var(--node-border-dark);
}

html.dark-mode .tree-node {
  background-color: var(--tree-node-bg-dark);
  border-color: var(--node-border-dark);
}

html.dark-mode .tree-node.highlight {
  border-color: var(--node-highlight-dark);
}

html.dark-mode .tree-line {
  border-color: var(--node-border-dark);
}

html.dark-mode .tree-line.highlight {
  border-color: var(--node-highlight-dark);
}

html.dark-mode #color-mode-switch label {
  background: var(--tree-bg-select-dark);
}

body {
  font-family: sans-serif;
}

a {
  color: inherit;
}

.nav {
  z-index: 5;
  display: block;
  position: fixed;
  right: 0;
  top: 0;
  width: 100vw;
  height: 50px;
  text-align: center;
  box-sizing: border-box;
}

.fractor {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  position: absolute;
  top: 5px;
  left: 10px;
  font-size: 1.1rem;
  cursor: pointer;
  user-select: none;
  -webkit-user-select: none;
}

.tree-title {
  margin-top: 5px;
  font-size: 1.1rem;
}

.account {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  position: absolute;
  top: 5px;
  right: 10px;
  font-size: 0.9rem;
  border-radius: 5px;
  padding: 0.2rem 10px;
  cursor: pointer;
  user-select: none;
  -webkit-user-select: none;
}

.account-menu {
  position: absolute;
  width: 150px;
  z-index: 6;
  border-radius: 5px;
  padding: 5px 10px;
}

.account-menu-item {
  cursor: pointer;
  margin: 5px 0;
  padding: 4px 8px;
  border-radius: 5px;
}

.container {
  display: none;
  justify-content: space-between;
  height: calc(100vh - 25px);
}

.forest {
  flex: 1;
  padding: 1rem;
  min-width: 100px;
  max-width: 13rem;
  max-height: calc(100% - 2rem);
  border-radius: 20px; /* Rounds the corners */
  margin-right: 10px;
  margin-top: 50px;
  overflow-y: auto;
}

.chat-tree {
  cursor: pointer;
  margin: 5px 0;
  padding: 4px;
  border-radius: 5px;
  position: relative;
  white-space: nowrap;
  overflow: hidden;
}

.chat-tree.new-tree {
  font-weight: bold;
}

.chat-tree-gradient {
  position: absolute;
  width: 48px;
  height: 32px;
  top: 0;
  right: 0;
}

.chat-wrapper {
  flex: 2;
  display: flex;
  flex-direction: column;
  align-items: center;
  max-height: 100%;
  margin-right: 10px;
}

.chat-history {
  overflow-y: auto;
  max-width: 40rem;
  width: 90%;
  height: 100%;
  margin-inline: auto;
  white-space: pre-wrap;
  padding: 20px;
}

.chat-user {
  border-radius: 10px;
  padding: 10px;
  margin: 10px 0;
  width: fit-content;
  max-width: 80%;
  float: right;
}

.chat-assistant {
  border-radius: 10px;
  padding: 10px;
  clear: both;
  width: fit-content;
  max-width: 85%;
}

.chat-loading {
  animation: pulse 1.5s infinite;
  border-radius: 10px;
  padding: 10px;
  clear: both;
  width: fit-content;
  max-width: 85%;
}

.chat-interface {
  position: relative;
  padding: 10px;
  border-radius: 20px; /* Rounds the corners */
  min-width: 250px;
  width: 95%;
  max-width: 42rem;
  margin-inline: auto;
}

.system-input {
  font-family: inherit;
  font-size: inherit;
  width: 88%;
  margin-bottom: 10px;
  border: none;
  outline: none;
  border-radius: 10px;
  /* Set the initial height of the textarea */
  height: auto;
  resize: none;
}

.message-input {
  font-family: inherit;
  font-size: inherit;
  width: 88%;
  margin-bottom: 10px;
  border: none;
  outline: none;
  border-radius: 10px;
  /* Set the initial height of the textarea */
  height: auto;
  resize: none;
}

button {
  cursor: pointer;
  padding: 5px 10px;
}

#send-button {
  position: absolute;
  top: 15px;
  right: 15px;
}

.model-choice {
  display: flex;
  flex-wrap: wrap; /* Prevent wrapping of items */
  gap: 15px;
  overflow-y: auto; /* Enable horizontal scrolling */
  height: 120px;
}

.model-family-container {
  flex: 0 0 auto; /* Ensure items do not grow or shrink */
  min-width: 100px;
}

.model-family-container p {
  margin: 2px 0 0 20px;
  position: relative;
  font-weight: bold;
}

.model-checkbox-container {
  margin-top: 5px;
}

label[for=model-select] {
 display: none;
}

#model-select {
  flex: 1;
}

.token-gauge {
  display: flex;
  flex: 3;
  gap: 2px;
  font-size: .8rem;
  margin-left: 16px;
  align-items: center;
}

.minimap {
  position: relative;
  min-width: 360px;
  max-width: 30%;
  border: 1px solid var(--node-border);
  border-radius: 20px;
  margin-top: 50px;
  overflow: auto;
  user-select: none;
  -webkit-user-select: none;
}

.tree-node {
  cursor: pointer;
  position: absolute;
  width: 30px;
  height: 30px;
  border: 1px solid var(--node-border);
  display: flex;
  align-items: center;
  justify-content: center;
  color: transparent;
  overflow: hidden;
  z-index: 1;
}

.tree-root-node {
  padding: 5px 0px;
  border: 0px;
  border-bottom: 1px solid var(--node-highlight);
}

.tree-system-node {
  border-radius: 50%;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' version='1.1' height='50px' width='50px'><text x='3' y='23' fill='black' font-size='24'>🤖</text></svg>");
}

.tree-user-node {
  border-radius: 50%;
}

.tree-assistant-node {
  border-radius: 20%;
  background-repeat: no-repeat;
  background-position: center;
}

.tree-loading-node {
  animation: pulse 1.5s infinite;
  border-radius: 20%;
  background-repeat: no-repeat;
  background-position: center;
}

.tree-line {
  position: absolute;
  border: 0.5px solid var(--node-border);
  height: 0px;
  transform-origin: left center;
}

.tree-loading-line {
  animation: pulse 1.5s infinite;
}

#tree-bottom-spacer {
  position: absolute;
  width: 100%;
  height: 1px;
}

.chatgpt-node {
  background-image: url("images/OpenAI.svg");
}

.claude-node {
  background-image: url("images/Anthropic.svg");
}

.llama-node {
  background-image: url("images/Meta.svg");
}

.mistral-node {
  background-image: url("images/Mistral.svg");
}

.gemini-node {
  background-image: url("images/Google.svg");
}

.parrot-node {
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' version='1.1' height='50px' width='50px'><text x='13' y='35' fill='black' font-size='24'>🦜</text></svg>");
}

@keyframes pulse {
    0% { opacity: 0.25; }
    50% { opacity: 1; }
    100% { opacity: 0.25; }
}

@media (max-width: 900px) {
  .container {
    flex-direction: column;
  }

  .forest {
    order: 1;
    min-width: 0;
    max-width: 100%;
    min-height: 10vh;
    max-height: 10vh;
    margin-right: 0;
  }

  .minimap {
    order: 2;
    margin-top: 10px;
    min-width: 0;
    max-width: 100%;
    min-height: 20vh;
    max-height: 20vh;
  }

  .chat-wrapper {
    order: 3;
    min-width: 0;
    max-width: 100%;
    height: 100%;
    margin-top: 0px;
    padding: 0px;
  }

}

/*
  Color Scheme Toggle Switch
  - Styled checkbox with slight animation when toggling
*/
#color-mode-switch {
  display: none;
  align-items: center;
}

#color-mode-switch > span {
  font-size: 30px;
  display: inline-block;
  margin-right: 8px;
}

#color-mode-switch svg {
  width: 24px;
  height: 24px;
  margin: 0 4px;
}

#color-mode-switch input[type=checkbox] {
  display: none;
}

#color-mode-switch label {
  cursor: pointer;
  text-indent: -9999px;
  width: 42px;
  height: 21px;
  border-radius: 30px;
  display: block;
  position: relative;
  margin: 0;
  user-select: none;
  -webkit-user-select: none;
}

#color-mode-switch label:after {
  content: '';
  position: absolute;
  top: 3px;
  left: 3px;
  width: 15px;
  height: 15px;
  background: #fff;
  border-radius: 90px;
  transition: 0.3s;
}

#color-mode-switch input:checked + label:after {
  left: calc(100% - 3px);
  transform: translateX(-100%);
}

#color-mode-switch label:active:after {
  width: 30px;
}

