:root {
  color-scheme: light;
  --canvas: #f8f8f8;
  --sidebar: #ededed;
  --surface: #fff;
  --surface-muted: #f1f1f1;
  --surface-highlight: #dedede;
  --ink: #222;
  --muted: #595959;
  --line: #ccc;
  --line-strong: #858585;
  --action-hover: #3b3b3b;
  --focus: #525252;
  font-family: system-ui, sans-serif;
  color: var(--ink);
  background: var(--canvas);
  -webkit-tap-highlight-color: #0002;
}

::selection {
  color: var(--surface);
  background: var(--ink);
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

html:has(.workspace.is-chat) {
  overflow: hidden;
  overscroll-behavior: none;
}

body {
  min-height: 100vh;
  min-height: 100svh;
  margin: 0;
  display: grid;
  grid-template-columns: 220px minmax(0, 1fr);
  grid-template-rows: auto minmax(0, 1fr);
  grid-template-areas:
    "sidebar controls"
    "sidebar workspace";
}

body:has(.is-chat) {
  height: 100vh;
  height: 100dvh;
  min-height: 0;
}

button,
input,
textarea {
  color: inherit;
  font: inherit;
}

button,
summary {
  cursor: pointer;
}

:focus-visible {
  outline: none;
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

.sidebar {
  grid-area: sidebar;
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  grid-template-rows: auto auto minmax(0, 1fr);
  min-height: 0;
  max-height: 100vh;
  max-height: 100dvh;
  padding: 1.5rem 1rem;
  background: var(--sidebar);
  border-inline-end: 1px solid var(--line);
}

.sidebar-toggle,
.drawer-close {
  display: none;
}

.wordmark {
  display: inline-flex;
  align-items: center;
  justify-self: start;
  gap: .6rem;
  min-height: 2.75rem;
  padding: 0 .4rem 0 0;
  border: 0;
  border-radius: .6rem;
  background: transparent;
  font-weight: 750;
  letter-spacing: -.035em;
  white-space: nowrap;
}

.wordmark:hover:not(:disabled) {
  background: var(--surface-highlight);
}

.brand-mark,
.response-mark {
  display: inline-grid;
  place-items: center;
  flex: 0 0 auto;
  color: var(--ink);
  background: var(--surface-highlight);
  border-radius: .5rem;
  line-height: 1;
}

.brand-mark {
  width: 2rem;
  height: 2rem;
  font-size: 1.15rem;
}

.new-draft {
  width: 100%;
  min-height: 2.75rem;
  margin-top: 0;
  display: flex;
  align-items: center;
  gap: .55rem;
  padding: .45rem .75rem;
  color: var(--ink);
  background: none;
  border: none;
  border-radius: .6rem;
  font-size: .875rem;
  font-weight: 650;
  text-align: start;
  white-space: nowrap;
}

.new-draft span {
  font-size: 1.25rem;
  line-height: 1;
}

.new-draft:hover:not(:disabled) {
  background: var(--surface-muted);
  border-color: var(--line-strong);
}

.wordmark:disabled,
.new-draft:disabled,
.history-list button:disabled {
  cursor: default;
  opacity: .65;
}

.history {
  min-height: 0;
  margin-top: 0;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: .875rem;
  overflow-y: auto;
  overscroll-behavior: contain;
  scroll-padding-block-start: 3rem;
  scrollbar-gutter: stable;
}

.history summary {
  position: sticky;
  top: 0;
  z-index: 1;
  min-height: 2.75rem;
  padding-block: .75rem;
  color: var(--ink);
  background: var(--sidebar);
  font-weight: 650;
}

.history-empty {
  margin: 0 .25rem;
}

.history-list {
  margin: 0;
  padding: .25rem;
  list-style: none;
}

.history-list li {
  display: flex;
  align-items: center;
  gap: .15rem;
  margin-bottom: .2rem;
  border-radius: .5rem;
}

.history-list li:has(> .history-open[aria-current="true"]),
.history-list li:hover:has(> button:enabled) {
  background: var(--surface-highlight);
}

.history-list button {
  min-height: 2rem;
  border: 0;
  border-radius: .5rem;
  background: transparent;
}

.history-open {
  flex: 1;
  min-width: 0;
  padding: .4rem .5rem;
  color: var(--ink);
  line-height: 1.25;
  text-align: start;
}

.history-title {
  display: block;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: clip;
}

.history-title-text {
  display: inline-block;
}

.history-title-text[data-overflow] {
  animation: var(--history-title-animation, none) var(--history-title-duration) linear infinite alternate;
}

@media (prefers-reduced-motion: no-preference) {
  .history-open:focus-visible {
    --history-title-animation: history-title-marquee;
  }
}

@media (hover: hover) and (prefers-reduced-motion: no-preference) {
  .history-list li:hover {
    --history-title-animation: history-title-marquee;
  }
}

@keyframes history-title-marquee {
  0%, 12% { transform: translateX(0); }
  88%, 100% { transform: translateX(var(--history-title-shift)); }
}

.history-list button:focus-visible {
  outline: 2px solid var(--focus);
  outline-offset: -2px;
}

.history-open[aria-current="true"] {
  font-weight: 650;
}

.history-delete {
  flex: 0 0 2.25rem;
  color: var(--muted);
  font-size: 1.15rem;
}

.history-delete:hover:not(:disabled) {
  color: var(--ink);
}

@media (hover: hover) and (pointer: fine) and (not (any-pointer: coarse)) {
  .history-list li:not(:hover, :has(:focus-visible)) .history-delete {
    opacity: 0;
    pointer-events: none;
  }
}

.chat-tools {
  grid-area: controls;
  display: flex;
  justify-content: flex-end;
  padding: .75rem 1.25rem .25rem;
}

.chat-tools button {
  min-height: 2.75rem;
  padding: .4rem .85rem;
  border: 1px solid var(--line);
  border-radius: .75rem;
  color: var(--ink);
  background: var(--surface);
  font-size: .875rem;
  font-weight: 650;
}

.chat-tools button:hover:not(:disabled) {
  border-color: var(--line-strong);
  background: var(--surface-highlight);
}

.chat-tools button:disabled {
  cursor: default;
  opacity: .65;
}

#temporary-toggle {
  display: grid;
  place-items: center;
  width: 2.75rem;
  padding: 0;
  border: 0;
  background: transparent;
}

#temporary-toggle:focus-visible {
  outline: 2px solid var(--focus);
  outline-offset: -2px;
}

.temporary-icon {
  position: relative;
  width: 1.25rem;
  height: 1.15rem;
}

.temporary-icon::before {
  content: "";
  position: absolute;
  inset: 0 .2rem auto;
  height: .55rem;
  border: 1.5px solid currentColor;
  border-bottom: 0;
  border-radius: .27rem .27rem 0 0;
}

.temporary-icon::after {
  content: "";
  position: absolute;
  inset: .5rem 0 auto;
  height: 2px;
  border-radius: 1px;
  background: currentColor;
}

.temporary-glasses {
  position: absolute;
  inset: auto .08rem 0;
  height: .43rem;
  display: flex;
  justify-content: space-between;
  background: linear-gradient(currentColor, currentColor) center / .35rem 1px no-repeat;
}

.temporary-glasses::before,
.temporary-glasses::after {
  content: "";
  box-sizing: border-box;
  width: .43rem;
  height: 100%;
  border: 1.5px solid currentColor;
  border-radius: 50%;
}

#temporary-toggle[aria-pressed="true"] .temporary-icon::before,
#temporary-toggle[aria-pressed="true"] .temporary-glasses::before,
#temporary-toggle[aria-pressed="true"] .temporary-glasses::after {
  background: currentColor;
}

.workspace {
  grid-area: workspace;
  width: min(calc(100% - 3rem), 45rem);
  margin-inline: auto;
  padding-block: 2rem 4rem;
  align-self: center;
}

.workspace.is-chat {
  display: flex;
  flex-direction: column;
  align-self: stretch;
  min-height: 0;
  padding-block: 0 max(.75rem, env(safe-area-inset-bottom));
}

h1 {
  margin: 0 0 1.65rem;
  font-size: clamp(1.75rem, 3.2vw, 2.4rem);
  line-height: 1.15;
  letter-spacing: -.045em;
  font-weight: 650;
  text-align: center;
  text-wrap: balance;
}

#greeting {
  margin-bottom: .65rem;
}

.landing-subtitle {
  margin: 0 0 1.65rem;
  color: var(--muted);
  line-height: 1.5;
  text-align: center;
  text-wrap: balance;
}

#model-subtitle {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: .25rem 1rem;
}

.landing-subtitle a {
  color: inherit;
}

.landing-subtitle a:focus-visible {
  outline: 2px solid var(--focus);
  outline-offset: 3px;
}

#conversation-title {
  flex: 0 0 auto;
  margin: 0;
  padding: 1.1rem 0 .8rem;
  border-bottom: 1px solid var(--line);
  font-size: 1.15rem;
  line-height: 1.3;
  letter-spacing: -.025em;
  text-align: start;
  overflow-wrap: anywhere;
}

.is-chat #composer {
  flex: 0 0 auto;
}

.composer-card {
  position: relative;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: .65rem;
  padding: .5rem .55rem .5rem 1rem;
  border: 1px solid var(--line-strong);
  border-radius: 1.4rem;
  background: var(--surface);
  box-shadow: 0 6px 20px #00000010;
}

.composer-input {
  display: flex;
  align-items: center;
  gap: .5rem;
  flex: 1 1 11rem;
  min-width: 0;
}

#seed {
  flex: 1;
  min-width: 0;
  min-height: 2.75rem;
  max-height: calc(5lh + 1.25rem);
  padding: .625rem .25rem;
  border: 0;
  border-radius: .4rem;
  background: transparent;
  line-height: 1.5;
  overflow-y: auto;
  resize: none;
}

#seed::placeholder {
  color: var(--muted);
}

.attachment-controls {
  position: relative;
  flex: 0 0 auto;
}

.attachment-toggle,
.attachment-remove {
  display: grid;
  place-items: center;
  padding: 0;
  border: 0;
  border-radius: 50%;
  font-size: 1.35rem;
  line-height: 1;
}

.attachment-toggle {
  width: 2.75rem;
  height: 2.75rem;
  background: none;
}

.attachment-toggle:hover:not(:disabled),
.attachment-toggle[aria-expanded="true"] {
  background: var(--surface-highlight);
}

.attachment-toggle:disabled,
.attachment-remove:disabled {
  cursor: default;
  opacity: .65;
}

.attachment-menu {
  position: absolute;
  z-index: 1;
  inset-inline-start: 0;
  top: calc(100% + .6rem);
  width: max-content;
  max-width: calc(100vw - 3rem);
  padding: .35rem;
  border: 1px solid var(--line);
  border-radius: .85rem;
  background: var(--surface);
  box-shadow: 0 8px 24px #00000020;
}

.is-chat .attachment-menu {
  top: auto;
  bottom: calc(100% + .6rem);
}

.attachment-pick {
  position: relative;
  display: flex;
  align-items: center;
  min-height: 2.75rem;
  padding: .4rem .65rem;
  border-radius: .55rem;
  cursor: pointer;
}

.attachment-pick:hover {
  background: var(--surface-muted);
}

.attachment-pick:has(:focus-visible) {
  outline: 2px solid var(--focus);
  outline-offset: -2px;
}

/* Let a tap hit the actual file control and open the browser's native picker. */
#attachment-file {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  margin: 0;
  opacity: 0;
  cursor: pointer;
}

#attachment-file::file-selector-button {
  width: 100%;
  height: 100%;
  cursor: inherit;
}

.attachment-preview {
  display: grid;
  justify-items: start;
  gap: .3rem;
  flex: 0 0 100%;
  min-width: 0;
}

.attachment-tile {
  position: relative;
  display: grid;
  place-items: center;
  width: 5.5rem;
  height: 5.5rem;
  border: 1px solid var(--line);
  border-radius: .75rem;
  background: var(--surface-muted);
}

.attachment-image {
  position: absolute;
  inset: 0;
  border-radius: inherit;
  overflow: hidden;
  pointer-events: none;
}

.attachment-image img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.attachment-icon {
  width: 1.4rem;
  height: 1.8rem;
  border: 2px solid var(--muted);
  border-radius: .2rem;
  background: repeating-linear-gradient(
    to bottom,
    var(--muted) 0 1px,
    transparent 1px 4px
  ) center / .65rem .55rem no-repeat;
}

.attachment-remove {
  position: absolute;
  inset-block-start: .2rem;
  inset-inline-end: .2rem;
  width: 2rem;
  height: 2rem;
  background: var(--ink);
  color: var(--surface);
}

.attachment-remove:hover:not(:disabled) {
  background: var(--action-hover);
}

.attachment-name {
  max-width: min(100%, 15rem);
  overflow: hidden;
  color: var(--muted);
  font-size: .875rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.composer-actions {
  display: flex;
  align-items: center;
  gap: .5rem;
  margin-inline-start: auto;
}

.effort-button {
  min-height: 2.75rem;
  border: 1px solid transparent;
  border-radius: .9rem;
  font-size: .875rem;
}

.effort-button {
  padding: .4rem .65rem;
  color: var(--ink);
  background: none;
  white-space: nowrap;
}

.effort-button:hover:not(:disabled),
.effort-button[aria-expanded="true"] {
  background: var(--surface-highlight);
}

.effort-button:disabled {
  cursor: default;
  opacity: .65;
}

.effort-panel {
  position: absolute;
  z-index: 1;
  inset-inline-end: .25rem;
  bottom: calc(100% + .45rem);
  width: min(18rem, calc(100% - .5rem));
  padding: 1rem;
  border: 1px solid var(--line);
  border-radius: 1rem;
  background: var(--surface);
  box-shadow: 0 8px 24px #00000020;
}

#effort-selection {
  margin: 0;
  color: var(--ink);
  font-weight: 700;
  text-align: center;
}

#effort {
  appearance: none;
  display: block;
  width: 100%;
  height: 44px;
  margin: 0;
  border-radius: .55rem;
  background: transparent;
  cursor: pointer;
}

#effort:focus-visible {
  outline-offset: -2px;
}

#effort::-webkit-slider-runnable-track {
  height: 12px;
  border-radius: 6px;
  background: var(--line);
}

#effort::-moz-range-track {
  height: 12px;
  border-radius: 6px;
  background: var(--line);
}

#effort::-webkit-slider-thumb {
  appearance: none;
  box-sizing: border-box;
  width: 22px;
  height: 22px;
  margin-top: -5px;
  border: 2px solid var(--surface);
  border-radius: 50%;
  background: var(--ink);
}

#effort::-moz-range-thumb {
  box-sizing: border-box;
  width: 22px;
  height: 22px;
  border: 2px solid var(--surface);
  border-radius: 50%;
  background: var(--ink);
}

.effort-ticks {
  display: flex;
  justify-content: space-between;
  margin-inline: 9px;
}

.effort-ticks span {
  width: .25rem;
  height: .25rem;
  border-radius: 50%;
  background: var(--line-strong);
}

.generate {
  display: grid;
  place-items: center;
  width: 2.75rem;
  height: 2.75rem;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: var(--ink);
  color: var(--surface);
}

.generate-icon::before {
  display: block;
  content: "✦";
  font-size: 1.35rem;
  line-height: 1;
}

.generate[data-action="stop"] .generate-icon::before {
  content: "";
  width: .75rem;
  height: .75rem;
  border-radius: .1rem;
  background: currentColor;
}

.generate:hover:not([aria-disabled="true"]) {
  background: var(--action-hover);
}

.generate[aria-disabled="true"] {
  background: var(--surface-muted);
  color: var(--muted);
  cursor: wait;
}

.field-error {
  margin: .55rem .25rem 0;
  font-size: .875rem;
  color: var(--ink);
  font-weight: 650;
}

.presets {
  display: grid;
  gap: .25rem;
  margin-top: 1rem;
}

.presets button {
  min-height: 2.75rem;
  display: flex;
  align-items: center;
  gap: .75rem;
  padding: .25rem .6rem;
  border: 1px solid transparent;
  border-radius: .65rem;
  background: transparent;
  color: var(--muted);
  text-align: start;
}

.presets button span {
  display: grid;
  place-items: center;
  width: 1.65rem;
  height: 1.65rem;
  flex: 0 0 auto;
  background: var(--surface-muted);
  border-radius: .4rem;
  color: var(--ink);
  font-size: 1.05rem;
}

.presets button:hover {
  border-color: var(--line);
  background: var(--surface);
  color: var(--ink);
}

.transcript {
  /* Keep the absolutely positioned screen-reader labels inside the transcript. */
  position: relative;
  flex: 1 1 0;
  min-height: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
  scrollbar-width: none;
  ::-webkit-scrollbar { display: none; };
}

.transcript ol {
  margin: 0;
  padding: 1rem .3rem 1.3rem;
  list-style: none;
}

.turn + .turn {
  margin-top: 1.65rem;
}

.prompt {
  width: fit-content;
  max-width: min(82%, 32rem);
  margin-inline-start: auto;
  padding: .65rem .95rem;
  border-radius: 1.2rem 1.2rem .35rem 1.2rem;
  color: var(--surface);
  background: var(--ink);
  overflow-wrap: anywhere;
}

.prompt-text {
  white-space: pre-wrap;
}

.reply {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  align-items: start;
  gap: .65rem;
  margin-top: .85rem;
}

.response-mark {
  width: 1.65rem;
  height: 1.65rem;
}

.reply-actions {
  display: flex;
  gap: .15rem;
  margin-top: .4rem;
}

.reply-actions button {
  display: inline-grid;
  place-items: center;
  width: 2.75rem;
  height: 2.75rem;
  padding: 0;
  border: 0;
  border-radius: .65rem;
  color: var(--muted);
  background: var(--canvas);
}

.reply-actions button:hover:not([aria-disabled="true"]) {
  color: var(--ink);
  background: var(--surface-muted);
}

.reply-actions button:focus-visible {
  outline: 2px solid var(--focus);
  outline-offset: -2px;
}

.reply-actions button[aria-disabled="true"] {
  cursor: default;
  opacity: .55;
}

.reply-actions svg {
  width: 1.25rem;
  height: 1.25rem;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.7;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.read-aloud[data-speaking]::after {
  content: "";
  width: .8rem;
  height: .8rem;
  border-radius: .15rem;
  background: currentColor;
}

.read-aloud[data-speaking] .speaker-icon {
  display: none;
}

.copy-icon {
  position: relative;
  width: 1.125rem;
  height: 1.125rem;
  background: inherit;
}

.copy-icon::before,
.copy-icon::after {
  content: "";
  position: absolute;
  width: .75rem;
  height: .75rem;
  box-sizing: border-box;
  border: 1.5px solid currentColor;
  border-radius: .2rem;
  background: inherit;
}

.copy-icon::before {
  inset: 0 auto auto 0;
}

.copy-icon::after {
  inset: auto 0 0 auto;
}

.reply-status {
  margin: 0 0 .45rem;
  color: var(--muted);
  font-size: .875rem;
  line-height: 1.4;
}

.reply-text {
  margin: 0;
  line-height: 1.65;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.rich-block {
  margin-top: 1rem;
  overflow-wrap: anywhere;
}

.rich-block h2 {
  margin: 0;
  font-size: 1.08rem;
  line-height: 1.3;
}

.rich-explanation {
  margin: .45rem 0 0;
  color: var(--muted);
  line-height: 1.6;
}

.rich-block pre,
.copy-source {
  max-width: 100%;
  padding: .7rem;
  border: 1px solid var(--line);
  border-radius: .6rem;
  background: var(--surface-muted);
  font: .875rem/1.55 ui-monospace, monospace;
}

.rich-block pre {
  margin: 0;
  overflow: auto;
}

.copy-source {
  display: block;
  width: 100%;
  margin-top: .4rem;
  resize: vertical;
}

.rich-block table {
  width: min(100%, 30rem);
  border-collapse: collapse;
  table-layout: fixed;
  font-size: .875rem;
}

.rich-block th,
.rich-block td {
  padding: .4rem .6rem;
  border: 1px solid var(--line);
  text-align: start;
}

.rich-block th {
  background: var(--surface-muted);
}

.rich-diagram {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  width: min(100%, 24rem);
  padding: .65rem;
  border: 1px solid var(--line);
  border-radius: .6rem;
  background: var(--surface-muted);
}

.diagram-node {
  margin-inline: .2rem;
  padding: .35rem .4rem;
  border: 1px solid var(--line-strong);
  border-radius: .4rem;
  background: var(--surface);
  font-size: .875rem;
  text-align: center;
}

.diagram-main {
  grid-column: 1 / -1;
  min-width: 42%;
  max-width: 85%;
  justify-self: center;
  font-weight: 650;
}

.diagram-branch {
  position: relative;
  grid-column: 1 / -1;
  height: 1.65rem;
  color: var(--muted);
}

.diagram-branch::before {
  content: "";
  position: absolute;
  inset: 0 auto 50% 50%;
  border-left: 1px solid currentColor;
}

.diagram-branch::after {
  content: "";
  position: absolute;
  inset: 50% 25% 0;
  border: 1px solid currentColor;
  border-bottom: 0;
}

.diagram-merge::before {
  inset-block: 50% 0;
}

.diagram-merge::after {
  inset-block: 0 50%;
  border-top: 0;
  border-bottom: 1px solid currentColor;
}

.diagram-straight::before {
  inset-block: 0;
}

.diagram-straight::after {
  content: none;
}

.diagram-arrow {
  position: absolute;
  bottom: .15rem;
  left: 25%;
  width: .35rem;
  height: .35rem;
  border-right: 1px solid currentColor;
  border-bottom: 1px solid currentColor;
  transform: translateX(-50%) rotate(45deg);
}

.diagram-arrow + .diagram-arrow {
  left: 75%;
}

.diagram-merge .diagram-arrow,
.diagram-straight .diagram-arrow {
  left: 50%;
}

.rich-formula {
  width: fit-content;
  max-width: 100%;
  overflow: auto;
  padding: .55rem .9rem;
  border: 1px solid var(--line);
  border-radius: .6rem;
  background: var(--surface-muted);
}

.rich-block math {
  font-size: 1.15rem;
}

.thinking {
  width: fit-content;
  max-width: 100%;
  margin-top: .85rem;
  padding: .65rem .75rem;
  border: 1px solid var(--line);
  border-radius: .45rem 1.15rem 1.15rem;
  background: linear-gradient(110deg, var(--sidebar) 22%, var(--surface) 43%, var(--surface-highlight) 61%);
  background-size: 250% 100%;
  animation: thinking-shine 2.9s ease-in-out infinite;
}

.thinking-kind {
  color: var(--ink);
  font-size: .875rem;
  font-weight: 700;
}

.thinking-report {
  margin: .2rem 0 0;
  line-height: 1.35;
  overflow-wrap: anywhere;
}

@keyframes thinking-shine {
  from { background-position: 100% 0; }
  to { background-position: -55% 0; }
}

#composer[data-galactic],
.thinking--galactic {
  --nebula: radial-gradient(ellipse at 18% 120%, #1777b8 0%, transparent 50%),
    radial-gradient(ellipse at 79% -30%, #b82896 0%, transparent 63%),
    linear-gradient(120deg, #100924 8%, #35206a 60%, #201039 100%);
  --starfield: radial-gradient(circle at 13% 27%, #fff 1px, transparent 2px) 0 0 / 73px 61px,
    radial-gradient(circle at 37% 75%, #ffd374 1px, transparent 2px) 0 0 / 109px 83px,
    radial-gradient(circle at 64% 39%, #84eaff 1px, transparent 2px) 0 0 / 53px 49px;
  --galactic-edge: #bf83ff;
  --galactic-light: #fff5fc;
  --galactic-glow: 0 0 0 1px #a477ff44, 0 0 20px #8f48f085, 0 7px 22px #d52e8c3b;
}

[data-galactic] .composer-card,
[data-galactic] .effort-panel,
.thinking--galactic {
  border-color: var(--galactic-edge);
  background: var(--nebula);
  box-shadow: var(--galactic-glow);
}

[data-galactic] .composer-card,
.thinking--galactic {
  isolation: isolate;
}

[data-galactic] .composer-card::before,
[data-galactic] .composer-card::after,
.thinking--galactic::before,
.thinking--galactic::after {
  content: "";
  position: absolute;
  z-index: -1;
  pointer-events: none;
}

[data-galactic] .composer-card::before {
  inset: .15rem .55rem;
  border-radius: inherit;
  background: var(--starfield), radial-gradient(ellipse at 6% 100%, #76eaff88, transparent 32%),
    radial-gradient(ellipse at 94% 12%, #ff75d680, transparent 32%);
  opacity: .6;
  animation: nebula-drift 11s ease-in-out infinite alternate;
}

[data-galactic] .composer-card::after {
  inset: 0;
  border-radius: inherit;
  background: repeating-conic-gradient(from 12deg at 35% 50%,
    transparent 0deg 23deg, #74ebfa 27deg, #ffe3a4 29deg, transparent 32deg 45deg);
  mask-image: radial-gradient(ellipse at 35% 50%, #000 0%, transparent 70%);
  opacity: 0;
  transform-origin: 35% 50%;
  animation: galactic-burst 850ms ease-out;
}

[data-galactic] #seed,
[data-galactic] .effort-button,
[data-galactic] .attachment-toggle {
  color: var(--galactic-light);
  background: #140f2c;
  box-shadow: inset 0 0 0 1px #8f73bb;
}

[data-galactic] #seed {
  padding-inline: .65rem;
}

[data-galactic] #seed::placeholder {
  color: #d9c4f8;
}

[data-galactic] .effort-button:hover:not(:disabled),
[data-galactic] .effort-button[aria-expanded="true"],
[data-galactic] .attachment-toggle:hover:not(:disabled),
[data-galactic] .attachment-toggle[aria-expanded="true"] {
  background: #442167;
}

[data-galactic] .effort-button:disabled,
[data-galactic] .attachment-toggle:disabled {
  opacity: 1;
}

[data-galactic] #effort-selection,
[data-galactic] .attachment-name {
  color: var(--galactic-light);
  text-shadow: 0 1px 2px #100922;
}

[data-galactic] #effort {
  --galactic-track: linear-gradient(90deg, #3be5ff, #a385ff 38%, #ff70d8 74%, #ffe598);
}

[data-galactic] #effort::-webkit-slider-runnable-track {
  background: var(--galactic-track);
}

[data-galactic] #effort::-moz-range-track {
  background: var(--galactic-track);
}

[data-galactic] .effort-ticks span {
  background: #d9c4f8;
}

[data-galactic] .generate:not([aria-disabled="true"]) {
  color: #210f39;
  background: linear-gradient(135deg, #b5f3ff, #ffb3e8);
  box-shadow: 0 0 14px #b481ffb0;
}

[data-galactic] .generate[data-action="stop"] {
  background: linear-gradient(135deg, #fff0bd, #ffb0df);
}

[data-galactic] :is(#seed, #effort, .effort-button, .attachment-toggle, .attachment-remove, .generate):focus-visible {
  outline: 2px solid #fff2b6;
  outline-offset: 2px;
}

.thinking--galactic {
  position: relative;
  width: min(17rem, 100%);
  padding-inline-end: 2rem;
  overflow: hidden;
  animation: none;
}

.thinking--galactic::before {
  inset: -30%;
  background: var(--starfield);
  opacity: .65;
  mask-image: linear-gradient(100deg, #0003 27%, #000 75%);
  animation: nebula-drift 9s ease-in-out infinite alternate;
}

.thinking--galactic::after {
  inset: -.75rem -.5rem auto auto;
  width: 5.5rem;
  height: 5.5rem;
  background: conic-gradient(#ffcb77, #fb72d7, transparent, #76f5ff, #ffcb77);
  mask-image: radial-gradient(ellipse, transparent 52%, #000 57% 61%, transparent 66%);
  opacity: .75;
  transform: rotate(-25deg) scaleY(.65);
  animation: galactic-orbit 7s linear infinite;
}

.thinking--galactic :is(.thinking-kind, .thinking-report) {
  color: var(--galactic-light);
  text-shadow: 0 1px 3px #100922, 0 0 5px #100922;
}

.thinking--galactic .thinking-kind span {
  color: #ffe598;
}

@keyframes nebula-drift {
  from { transform: translate(-1%, -2%) scale(.98); }
  to { transform: translate(1%, 2%) scale(1); }
}

@keyframes galactic-burst {
  0% { opacity: 0; transform: scale(.15); }
  28% { opacity: .55; }
  100% { opacity: 0; transform: scale(1); }
}

@keyframes galactic-orbit {
  from { transform: rotate(-25deg) scaleY(.65); }
  to { transform: rotate(335deg) scaleY(.65); }
}

@media (prefers-reduced-motion: reduce) {
  .thinking,
  [data-galactic] .composer-card::before,
  [data-galactic] .composer-card::after,
  .thinking--galactic::before,
  .thinking--galactic::after {
    animation: none;
  }
}

@media (width < 760px) {
  html:has(.sidebar-drawer[open]) {
    overflow: hidden;
    overscroll-behavior: none;
  }

  body,
  body:has(.is-chat) {
    height: 100vh;
    height: var(--mobile-viewport-height, 100dvh);
    min-height: 0;
  }

  body {
    grid-template-columns: minmax(0, 1fr);
    grid-template-rows: auto minmax(0, 1fr);
    grid-template-areas:
      "controls"
      "workspace";
  }

  body > .sidebar {
    display: none;
  }

  .sidebar-toggle,
  .drawer-close {
    display: grid;
    place-items: center;
    width: 2.75rem;
    height: 2.75rem;
    padding: 0;
    border: 0;
    border-radius: .75rem;
    color: var(--muted);
    background: transparent;
  }

  .sidebar-toggle {
    grid-area: controls;
    justify-self: start;
    margin: max(.5rem, env(safe-area-inset-top)) 0 .25rem max(.75rem, env(safe-area-inset-left));
  }

  .sidebar-icon {
    width: 1.2rem;
    height: 1rem;
    border: 1.5px solid currentColor;
    border-radius: .3rem;
    background: linear-gradient(currentColor, currentColor) .28rem center / 1.5px 100% no-repeat;
  }

  .sidebar-toggle:hover,
  .drawer-close:hover {
    background: var(--surface-muted);
  }

  .sidebar-toggle:focus-visible,
  .drawer-close:focus-visible,
  .sidebar-drawer .sidebar :focus-visible {
    outline: 2px solid var(--focus);
    outline-offset: -2px;
  }

  .sidebar-drawer {
    position: fixed;
    inset: 0 auto 0 0;
    width: min(88%, 360px);
    max-width: none;
    height: 100%;
    max-height: none;
    margin: 0;
    padding: 0;
    overflow: hidden;
    border: 0;
    background: var(--canvas);
    box-shadow: 6px 0 24px #0002;
  }

  .sidebar-drawer::backdrop {
    background: #0003;
  }

  .sidebar-drawer .sidebar {
    grid-template-columns: minmax(0, 1fr) auto;
    grid-template-rows: auto auto minmax(0, 1fr);
    align-items: center;
    gap: .85rem .5rem;
    height: 100%;
    max-height: none;
    padding: max(.75rem, env(safe-area-inset-top)) 1rem max(.75rem, env(safe-area-inset-bottom));
    border-inline-end: 0;
    background: var(--canvas);
  }

  .drawer-close {
    font-size: 1.5rem;
  }

  .new-draft {
    grid-column: 1 / -1;
    margin: 0;
  }

  .history {
    grid-column: 1 / -1;
    align-self: stretch;
    margin: 0;
    font-size: 1rem;
  }

  .history summary {
    background: var(--canvas);
  }

  .history-delete {
    flex-basis: 2.75rem;
  }

  .chat-tools {
    justify-self: end;
    padding: max(.5rem, env(safe-area-inset-top)) max(.75rem, env(safe-area-inset-right)) .25rem 0;
  }

  .chat-tools button:focus-visible {
    outline: 2px solid var(--focus);
    outline-offset: -2px;
  }

  .workspace {
    width: min(calc(100% - 2rem), 45rem);
  }

  .workspace:not(.is-chat) {
    display: flex;
    flex-direction: column;
    align-self: stretch;
    padding-block: 0 max(1rem, env(safe-area-inset-bottom));
    overflow-y: auto;
  }

  .landing {
    display: flex;
    flex-direction: column;
    flex: 1 1 auto;
    overflow-y: auto;
    overscroll-behavior: contain;
  }

  .landing-intro {
    margin-block: auto;
    padding-block: 2rem;
  }

  .landing-subtitle {
    margin-bottom: 0;
  }

  .presets {
    margin: 0 0 1rem;
  }

  #composer {
    flex: 0 0 auto;
  }

  #seed {
    font-size: 1rem;
  }

  .composer-card {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr);
    align-items: center;
    gap: .35rem;
    padding: .55rem .65rem .65rem;
  }

  .composer-input,
  .attachment-preview {
    grid-column: 1 / -1;
  }

  .composer-actions {
    justify-self: end;
  }

  .attachment-menu {
    top: auto;
    bottom: calc(100% + .6rem);
  }
}
