:root {
  --ease-out: cubic-bezier(0.23, 1, 0.32, 1);
  --ease-spring-soft: cubic-bezier(0.34, 1.56, 0.64, 1);
  --ease-spring-layout: cubic-bezier(0.22, 1.2, 0.36, 1);
  color-scheme: light;
}

[data-theme="dark"] {
  color-scheme: dark;
}

body {
  min-width: 320px;
  transition: background-color 180ms ease, color 180ms ease;
}

button,
input {
  font: inherit;
}

button {
  -webkit-tap-highlight-color: transparent;
}

.top-controls {
  top: 20px;
  right: 20px;
  gap: 8px;
}

.lang-toggle {
  gap: 0;
  padding: 5px 0;
}

.lang-btn,
.theme-toggle,
.collapsible-toggle,
.send-button {
  border: 0;
  color: inherit;
  background: transparent;
}

.lang-btn {
  padding: 0;
  cursor: pointer;
  opacity: 0.58;
  transition: color 140ms ease, opacity 140ms ease, transform 180ms var(--ease-spring-soft);
}

.lang-btn.active {
  color: var(--keyword-color);
  opacity: 1;
}

.separator {
  display: inline;
}

.theme-toggle {
  position: relative;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  transition: opacity 140ms ease, transform 180ms var(--ease-spring-soft);
}

.toggle-icon {
  position: absolute;
  top: 50%;
  left: 50%;
  display: block;
  opacity: 0;
  pointer-events: none;
  transform: translate(-50%, -50%) rotate(-22deg) scale(0.86);
  transition: none;
}

#moon-icon[data-active="false"] {
  transform: translate(-50%, -50%) rotate(22deg) scale(0.86);
}

.theme-toggle[data-animate="true"] .toggle-icon {
  transition: opacity 100ms linear, transform 160ms var(--ease-out);
}

.theme-toggle[data-animate="true"] .toggle-icon[data-active="true"] {
  transition: opacity 120ms linear, transform 240ms var(--ease-spring-soft);
}

.toggle-icon[data-active="true"] {
  opacity: 1;
  transform: translate(-50%, -50%) rotate(0deg) scale(1);
}

.root-container {
  min-height: 100svh;
  justify-content: center;
}

main {
  width: 90%;
  max-width: 800px;
  padding: 20px;
}

.code-container {
  max-width: 500px;
  padding: 40px;
  border: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
  animation: none;
}

.code-line,
.code-line.visible {
  width: 100%;
  visibility: visible;
  opacity: 1;
  overflow: visible;
  white-space: pre-wrap;
  animation: none;
  transition: none;
}

.code-line.indent-1,
.code-line.indent-1.visible,
.code-line.indent-2,
.code-line.indent-2.visible,
.code-line.indent-3,
.code-line.indent-3.visible,
.code-line.indent-4,
.code-line.indent-4.visible {
  width: 100%;
}

[torph-root] {
  vertical-align: baseline;
}

.section-gap {
  height: 18px;
}

.section-gap--small {
  height: 8px;
}

.collapsible-toggle {
  display: inline-flex;
  align-items: center;
  margin: -3px -2px;
  padding: 3px 2px;
  border-radius: 3px;
  cursor: pointer;
  line-height: inherit;
  text-align: left;
  transition: opacity 140ms ease, transform 180ms var(--ease-spring-soft);
}

.chevron {
  transition: transform 160ms var(--ease-out);
  transform-origin: center;
}

.collapsible-toggle[aria-expanded="true"] .chevron {
  transform: rotate(90deg);
  transition-duration: 240ms;
  transition-timing-function: var(--ease-spring-soft);
}

.collapsible-content {
  height: 0;
  overflow: hidden;
  opacity: 0;
  transform: translateY(-4px) scale(0.985);
  transform-origin: top left;
  transition: height 160ms var(--ease-out), opacity 100ms linear, transform 160ms var(--ease-out);
}

.collapsible-content[data-expanded="true"] {
  opacity: 1;
  transform: translateY(0) scale(1);
  transition: height 260ms var(--ease-spring-layout), opacity 140ms ease, transform 240ms var(--ease-spring-soft);
}

.collapsible-content[hidden],
.collapsed-indicator[hidden] {
  display: none;
}

.chat-container {
  margin: 0;
  padding: 0;
  border: 0;
  animation: none;
}

.chat-message {
  margin: 0 0 14px;
  padding: 0;
  border: 0;
}

.assistant-message {
  opacity: 0.88;
}

.terminal-form {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 8px;
  min-height: 40px;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
}

.prompt-mark {
  color: var(--comment-color);
  font-size: 1rem;
  font-weight: 500;
}

.text-input {
  min-width: 0;
  padding: 9px 0;
  opacity: 1;
  transform: none;
  animation: none;
}

.text-input:focus {
  outline: none;
}

.text-input:disabled {
  cursor: wait;
  opacity: 0.58;
}

.send-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  padding: 0;
  color: var(--comment-color);
  cursor: pointer;
  opacity: 0.72;
  transition: color 140ms ease, opacity 140ms ease, transform 120ms var(--ease-out);
}

.send-button:disabled {
  cursor: wait;
  opacity: 0.35;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

@media (hover: hover) and (pointer: fine) {
  .lang-btn:hover,
  .theme-toggle:hover,
  .collapsible-toggle:hover,
  .send-button:hover {
    color: var(--text-color);
    opacity: 1;
  }
}

.lang-btn:active,
.theme-toggle:active,
.collapsible-toggle:active,
.send-button:active {
  transform: scale(0.97);
}

.lang-btn:focus-visible,
.theme-toggle:focus-visible,
.collapsible-toggle:focus-visible,
.send-button:focus-visible,
a:focus-visible {
  outline: 2px solid var(--link-color);
  outline-offset: 3px;
}

@media screen and (max-width: 768px) {
  .top-controls {
    top: 10px;
    right: 10px;
  }

  main {
    width: 100%;
    padding: 5px;
  }

  .code-container {
    max-width: 100%;
    padding: 64px 10px 24px;
  }

  .code-line {
    font-size: 0.9rem;
  }

  .indent-1 {
    padding-left: 14px;
  }

  .indent-2 {
    padding-left: 28px;
  }

  .indent-3 {
    padding-left: 42px;
  }

  .indent-4 {
    padding-left: 56px;
  }
}

@media (prefers-reduced-motion: reduce) {
  body,
  .lang-btn,
  .theme-toggle,
  .collapsible-toggle,
  .send-button,
  .chevron {
    animation: none;
    transition-duration: 0.01ms;
  }

  .theme-toggle[data-animate="true"] .toggle-icon {
    transition: opacity 120ms linear;
  }

  .toggle-icon,
  #moon-icon[data-active] {
    transform: translate(-50%, -50%);
  }

  .collapsible-content {
    transition: opacity 120ms linear;
    transform: none;
  }
}
