:root {
  color-scheme: dark;
  --bg: #091311;
  --surface: #111c19;
  --surface-2: #162420;
  --surface-3: #1c2c27;
  --ink: #edf3eb;
  --muted: #a1aca3;
  --dim: #64716a;
  --line: rgba(226, 238, 226, .12);
  --line-strong: rgba(226, 238, 226, .22);
  --accent: #72d9bd;
  --accent-rgb: 114, 217, 189;
  --gold: #e0b45f;
  --blue: #5bb8e8;
  --danger: #dd6b68;
  --sans: "DM Sans", Arial, sans-serif;
  --mono: "DM Mono", monospace;
  --serif: Georgia, "Times New Roman", serif;
}

html[data-theme="light"] {
  color-scheme: light;
  --bg: #e8ede5;
  --surface: #f5f7f1;
  --surface-2: #edf2e9;
  --surface-3: #e1e9df;
  --ink: #23312b;
  --muted: #627068;
  --dim: #839088;
  --line: rgba(31, 52, 42, .14);
  --line-strong: rgba(31, 52, 42, .24);
  --accent: #237d67;
  --accent-rgb: 35, 125, 103;
}

* {
  box-sizing: border-box;
}

html,
body {
  width: 100%;
  height: 100%;
  margin: 0;
  overflow: hidden;
}

body {
  display: grid;
  grid-template-rows: 58px auto minmax(0, 1fr);
  background: var(--bg);
  color: var(--ink);
  font-family: var(--sans);
  transition: background-color .45s ease, color .45s ease;
}

button,
input,
textarea,
select {
  font: inherit;
}

button,
summary,
select,
label {
  -webkit-tap-highlight-color: transparent;
}

button {
  color: inherit;
}

:is(button, input, textarea, select, summary):focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
}

.light-header {
  position: relative;
  z-index: 30;
  display: grid;
  grid-template-columns: auto minmax(180px, 1fr) auto;
  align-items: center;
  gap: 15px;
  min-width: 0;
  padding: 7px 12px;
  border-bottom: 1px solid var(--line);
  background: color-mix(in srgb, var(--surface) 90%, transparent);
  backdrop-filter: blur(18px);
}

.light-brand {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--ink);
  text-decoration: none;
}

.light-brand img {
  width: 36px;
  height: 36px;
  border-radius: 11px;
}

.light-brand span {
  display: grid;
  gap: 1px;
}

.light-brand b,
.light-brand small {
  font-family: var(--mono);
  line-height: 1;
  letter-spacing: .08em;
}

.light-brand b {
  font-size: 9px;
}

.light-brand small {
  color: var(--accent);
  font-size: 7px;
}

.project-identity {
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 10px;
}

.project-identity input {
  width: min(330px, 100%);
  min-width: 0;
  padding: 4px 6px;
  border: 1px solid transparent;
  border-radius: 7px;
  background: transparent;
  color: var(--ink);
  font: 500 12px var(--mono);
}

.project-identity input:is(:hover, :focus) {
  border-color: var(--line);
  background: color-mix(in srgb, var(--bg) 45%, transparent);
  outline: none;
}

.local-mark {
  white-space: nowrap;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  color: var(--muted);
  font: 7px var(--mono);
  letter-spacing: .08em;
}

.local-mark i {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 10px rgba(var(--accent-rgb), .52);
}

.header-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 6px;
  min-width: 0;
}

.header-icon,
.palette-switch > summary {
  width: 36px;
  height: 34px;
  display: grid;
  place-items: center;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: color-mix(in srgb, var(--surface-2) 84%, transparent);
  color: var(--ink);
  cursor: pointer;
}

.status-button,
.export-project {
  min-height: 34px;
  padding: 7px 11px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: color-mix(in srgb, var(--surface-2) 84%, transparent);
  color: var(--ink);
  font: 8px var(--mono);
  cursor: pointer;
}

.status-button {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  max-width: 190px;
}

.status-button i {
  width: 6px;
  height: 6px;
  flex: 0 0 auto;
  border-radius: 50%;
  background: var(--dim);
}

.status-button.is-connected i {
  background: var(--accent);
  box-shadow: 0 0 11px rgba(var(--accent-rgb), .55);
}

.status-button span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.export-project {
  background: var(--accent);
  color: #07110f;
  font-weight: 700;
}

.header-icon:hover,
.status-button:hover,
.export-project:hover,
.palette-switch > summary:hover {
  border-color: var(--accent);
}

.palette-switch {
  position: relative;
}

.view-switch {
  position: relative;
}

.view-switch > summary {
  min-height: 34px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 7px 10px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: color-mix(in srgb, var(--surface-2) 84%, transparent);
  color: var(--ink);
  font: 8px var(--mono);
  list-style: none;
  cursor: pointer;
}

.view-switch > summary b {
  min-width: 17px;
  height: 17px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: color-mix(in srgb, var(--accent) 16%, transparent);
  color: var(--accent);
  font-size: 7px;
  font-weight: 600;
}

.view-switch > summary::-webkit-details-marker {
  display: none;
}

.view-panel {
  position: absolute;
  top: calc(100% + 7px);
  right: 0;
  z-index: 80;
  width: 170px;
  display: grid;
  gap: 3px;
  padding: 8px;
  border: 1px solid var(--line-strong);
  border-radius: 11px;
  background: var(--surface);
  box-shadow: 0 18px 48px rgba(0,0,0,.3);
}

.view-panel label {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 7px 8px;
  border-radius: 7px;
  color: var(--ink);
  font: 9px var(--mono);
  cursor: pointer;
}

.view-panel label:hover {
  background: var(--surface-2);
}

.view-panel input {
  accent-color: var(--accent);
}

.view-panel label:has(input:not(:checked)) {
  color: var(--muted);
}

.palette-switch > summary {
  list-style: none;
}

.palette-switch > summary::-webkit-details-marker {
  display: none;
}

.palette-orbit {
  position: relative;
  width: 23px;
  height: 23px;
}

.palette-orbit i {
  position: absolute;
  width: 7px;
  height: 7px;
  border-radius: 50%;
}

.palette-orbit i:nth-child(1) { left: 8px; top: 0; background: var(--nyarindo-swatch-forest); }
.palette-orbit i:nth-child(2) { right: 0; top: 5px; background: var(--nyarindo-swatch-ocean); }
.palette-orbit i:nth-child(3) { right: 3px; bottom: 0; background: var(--nyarindo-swatch-amethyst); }
.palette-orbit i:nth-child(4) { left: 3px; bottom: 0; background: var(--nyarindo-swatch-ember); }
.palette-orbit i:nth-child(5) { left: 0; top: 5px; background: var(--nyarindo-swatch-rose); }
.palette-orbit i:nth-child(6) { left: 8px; top: 8px; background: var(--nyarindo-swatch-slate); }

.palette-panel {
  position: absolute;
  z-index: 40;
  top: 42px;
  right: 0;
  display: grid;
  grid-template-columns: repeat(3, 25px);
  gap: 8px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 13px;
  background: var(--surface);
  box-shadow: 0 16px 38px rgba(0, 0, 0, .25);
}

.palette-panel button {
  width: 25px;
  height: 25px;
  border: 0;
  border-radius: 50%;
}

.palette-panel button[data-palette-choice="forest"] { background: var(--nyarindo-swatch-forest); }
.palette-panel button[data-palette-choice="ocean"] { background: var(--nyarindo-swatch-ocean); }
.palette-panel button[data-palette-choice="amethyst"] { background: var(--nyarindo-swatch-amethyst); }
.palette-panel button[data-palette-choice="ember"] { background: var(--nyarindo-swatch-ember); }
.palette-panel button[data-palette-choice="rose"] { background: var(--nyarindo-swatch-rose); }
.palette-panel button[data-palette-choice="slate"] { background: var(--nyarindo-swatch-slate); }

.light-workspace {
  --library-width: clamp(210px, 17vw, 310px);
  --code-width: clamp(390px, 34vw, 620px);
  position: relative;
  min-height: 0;
  display: grid;
  grid-template-columns:
    var(--library-width)
    5px
    minmax(320px, 1fr)
    5px
    var(--code-width);
  overflow: hidden;
}

@media (min-width: 901px) {
  body:not(.library-maximized):not(.code-maximized) .chat-panel {
    display: grid;
  }

  body.library-collapsed:not(.code-collapsed) .light-workspace {
    grid-template-columns: 0 0 minmax(320px, 1fr) 5px var(--code-width);
  }

  body.code-collapsed:not(.library-collapsed) .light-workspace {
    grid-template-columns: var(--library-width) 5px minmax(320px, 1fr) 0 0;
  }

  body.library-collapsed.code-collapsed .light-workspace {
    grid-template-columns: 0 0 minmax(0, 1fr) 0 0;
  }

  body.library-collapsed .library-panel,
  body.code-collapsed .code-panel,
  body.library-collapsed #libraryResizer,
  body.code-collapsed #codeResizer {
    display: none;
  }

  body.library-maximized .light-workspace {
    grid-template-columns: minmax(0, 1fr) 0 0 0 0;
  }

  body.code-maximized .light-workspace {
    grid-template-columns: 0 0 0 0 minmax(0, 1fr);
  }

  body.library-maximized .chat-panel,
  body.library-maximized .code-panel,
  body.library-maximized .pane-resizer,
  body.code-maximized .library-panel,
  body.code-maximized .chat-panel,
  body.code-maximized .pane-resizer {
    display: none;
  }
}

.light-panel {
  min-width: 0;
  min-height: 0;
  overflow: hidden;
  border-right: 1px solid var(--line);
  background: color-mix(in srgb, var(--surface) 58%, transparent);
}

.library-panel {
  grid-column: 1;
  position: relative;
  display: block;
  overflow-y: auto;
  scrollbar-width: thin;
}

.chat-panel {
  grid-column: 3;
}

.code-panel {
  grid-column: 5;
}

#libraryResizer {
  grid-column: 2;
}

#codeResizer {
  grid-column: 4;
}

.pane-resizer {
  position: relative;
  z-index: 4;
  width: 5px;
  cursor: col-resize;
  background: transparent;
}

.pane-resizer::after {
  content: "";
  position: absolute;
  inset: 0 2px;
  background: var(--line);
  transition: background .15s ease, box-shadow .15s ease;
}

.pane-resizer:hover::after,
body.is-resizing .pane-resizer::after {
  background: var(--accent);
  box-shadow: 0 0 9px color-mix(in srgb, var(--accent) 44%, transparent);
}

.panel-expand,
.right-expand {
  width: 27px;
  height: 27px;
  display: grid;
  place-items: center;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 50%;
  background: color-mix(in srgb, var(--surface) 88%, transparent);
  color: var(--muted);
  cursor: pointer;
}

.panel-expand {
  position: sticky;
  top: 8px;
  z-index: 5;
  margin: 8px 8px -35px auto;
}

.right-panel-expand {
  position: absolute;
  top: 8px;
  right: 8px;
  z-index: 6;
  margin: 0;
}

.panel-expand:hover,
.right-expand:hover {
  border-color: var(--accent);
  color: var(--accent);
}

.chat-heading,
.code-heading {
  min-height: 48px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 10px 12px;
  border-bottom: 1px solid var(--line);
}

.chat-heading span,
.section-heading > small {
  color: var(--muted);
  font: 7px/1.4 var(--mono);
  letter-spacing: .08em;
}

.chat-heading-actions {
  display: flex;
  align-items: center;
  gap: 6px;
}

.chat-heading-actions button {
  min-height: 28px;
  padding: 5px 9px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: transparent;
  color: var(--muted);
  font: 8px var(--mono);
  cursor: pointer;
}

.chat-heading-actions .coherence-trigger {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.chat-heading-actions .voice-mode-button {
  width: 30px;
  height: 30px;
  min-height: 30px;
  display: grid;
  place-items: center;
  padding: 0;
  border-radius: 50%;
  transition:
    border-color .2s ease,
    background-color .2s ease,
    color .2s ease,
    box-shadow .2s ease;
}

.voice-mode-button svg {
  width: 14px;
  height: 14px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.65;
  stroke-linecap: round;
}

.voice-mode-button[aria-pressed="true"] {
  border-color: color-mix(in srgb, var(--accent) 68%, transparent);
  background: color-mix(in srgb, var(--accent) 12%, transparent);
  color: var(--accent);
  box-shadow: 0 0 0 4px color-mix(in srgb, var(--accent) 8%, transparent);
}

.voice-mode-button.is-listening {
  animation: voice-listening 1.2s ease-in-out infinite alternate;
}

.voice-mode-button.is-speaking {
  border-color: color-mix(in srgb, var(--blue) 70%, transparent);
  color: var(--blue);
}

.chat-heading span[data-voice-state="listening"],
.chat-heading span[data-voice-state="speaking"] {
  color: var(--accent);
}

@keyframes voice-listening {
  to {
    box-shadow:
      0 0 0 6px color-mix(in srgb, var(--accent) 9%, transparent),
      0 0 22px color-mix(in srgb, var(--accent) 32%, transparent);
  }
}

.coherence-trigger i {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 12px rgba(var(--accent-rgb), .8);
}

.coherence-trigger.is-working i {
  animation: coherence-pulse .7s ease-in-out infinite alternate;
}

.coherence-trigger:disabled {
  cursor: wait;
  opacity: .72;
}

@keyframes coherence-pulse {
  to {
    transform: scale(1.45);
    box-shadow: 0 0 22px rgba(var(--accent-rgb), .95);
  }
}

.section-actions button,
.section-actions label {
  min-width: 29px;
  min-height: 29px;
  display: grid;
  place-items: center;
  padding: 5px 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: transparent;
  color: var(--muted);
  font: 7px var(--mono);
  cursor: pointer;
}

.left-accordion {
  border-bottom: 1px solid var(--line);
}

.left-accordion > summary {
  min-height: 42px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 9px 10px;
  color: var(--muted);
  font: 7px var(--mono);
  letter-spacing: .09em;
  cursor: pointer;
  list-style: none;
}

.left-accordion > summary::-webkit-details-marker {
  display: none;
}

.left-accordion > summary::before {
  content: "›";
  color: var(--accent);
  font-size: 14px;
  transform: rotate(0);
  transition: transform .18s ease;
}

.left-accordion[open] > summary::before {
  transform: rotate(90deg);
}

.left-accordion > summary > span {
  flex: 1;
}

.left-accordion > summary strong {
  padding: 2px 6px;
  border-radius: 99px;
  background: rgba(var(--accent-rgb), .14);
  color: var(--accent);
  font: 8px var(--mono);
}

.accordion-body {
  padding: 0 8px 9px;
}

.project-controls {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 30px;
  gap: 5px;
}

.project-controls select,
.project-controls button {
  min-width: 0;
  min-height: 31px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-2);
  color: var(--ink);
  font: 8px var(--mono);
}

.project-controls button {
  padding: 0;
  color: var(--accent);
  cursor: pointer;
}

.new-chat-button {
  width: 100%;
  min-height: 33px;
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 6px 0;
  padding: 7px 9px;
  border: 1px solid color-mix(in srgb, var(--accent) 38%, var(--line));
  border-radius: 9px;
  background: color-mix(in srgb, var(--accent) 7%, var(--surface));
  color: var(--ink);
  font: 8px var(--mono);
  cursor: pointer;
}

.new-chat-button span {
  color: var(--accent);
  font-size: 14px;
}

.conversation-list {
  display: grid;
  gap: 3px;
  max-height: 190px;
  overflow-y: auto;
}

.conversation-entry {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 4px;
  border: 1px solid transparent;
  border-radius: 8px;
}

.conversation-entry.is-current {
  border-color: color-mix(in srgb, var(--accent) 34%, var(--line));
  background: color-mix(in srgb, var(--accent) 7%, var(--surface-2));
}

.conversation-open,
.conversation-delete {
  border: 0;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
}

.conversation-open {
  min-width: 0;
  padding: 7px;
  overflow: hidden;
  text-align: left;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 9px;
}

.conversation-delete {
  width: 25px;
  height: 25px;
  color: var(--dim);
}

.conversation-delete:hover {
  color: var(--danger);
}

.source-workspace {
  display: grid;
  gap: 9px;
}

.source-library,
.file-library {
  min-height: 0;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
}

.section-heading {
  min-width: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 10px 11px 5px;
}

.section-heading h2 {
  margin: 0;
  color: var(--muted);
  font: 8px var(--mono);
  letter-spacing: .09em;
  text-transform: uppercase;
}

.section-actions {
  display: flex;
  gap: 4px;
}

.source-list,
.file-tree {
  min-height: 0;
  max-height: 210px;
  overflow-y: auto;
  padding: 5px 8px 10px;
}

.source-entry,
.file-entry {
  width: 100%;
  display: grid;
  gap: 3px;
  margin-bottom: 4px;
  padding: 8px;
  border: 1px solid transparent;
  border-radius: 9px;
  background: transparent;
  color: var(--ink);
  text-align: left;
}

.source-entry {
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
}

.file-entry {
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
}

.source-entry label {
  display: contents;
  cursor: pointer;
}

.source-entry label > span {
  min-width: 0;
  display: grid;
  gap: 3px;
}

.file-open {
  min-width: 0;
  display: grid;
  gap: 3px;
  padding: 0;
  border: 0;
  background: transparent;
  color: inherit;
  text-align: left;
  cursor: pointer;
}

.source-entry input {
  accent-color: var(--accent);
}

.source-entry strong,
.file-entry strong {
  min-width: 0;
  overflow: hidden;
  font-size: 10px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.source-entry small,
.file-entry small {
  color: var(--muted);
  font: 7px var(--mono);
}

.source-remove,
.file-remove {
  width: 24px;
  height: 24px;
  display: grid;
  place-items: center;
  padding: 0;
  border: 0;
  border-radius: 7px;
  background: transparent;
  color: var(--dim);
  cursor: pointer;
}

.source-remove:hover,
.file-remove:hover {
  background: rgba(221, 107, 104, .12);
  color: var(--danger);
}

.source-entry:has(input:checked),
.file-entry.is-current {
  border-color: color-mix(in srgb, var(--accent) 38%, var(--line));
  background: color-mix(in srgb, var(--accent) 7%, var(--surface-2));
}

.source-empty,
.file-empty {
  margin: 12px 4px;
  color: var(--dim);
  font-size: 10px;
  line-height: 1.6;
}

.chat-panel {
  display: grid;
  grid-template-rows: auto auto minmax(0, 1fr) auto;
  background: color-mix(in srgb, var(--bg) 88%, var(--surface));
}

.chat-heading > div {
  display: grid;
  gap: 2px;
}

.chat-heading strong {
  font: 400 16px/1.2 var(--serif);
}

.chat-heading button {
  border: 0;
  background: transparent;
  color: var(--dim);
  font: 7px var(--mono);
  cursor: pointer;
}

.prompt-tools {
  display: flex;
  gap: 5px;
  padding: 7px 10px;
  overflow-x: auto;
  border-bottom: 1px solid var(--line);
  scrollbar-width: none;
}

.prompt-tools button {
  flex: 0 0 auto;
  min-height: 28px;
  padding: 5px 9px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: transparent;
  color: var(--muted);
  font: 7px var(--mono);
  cursor: pointer;
}

.prompt-tools button:hover {
  border-color: var(--accent);
  color: var(--accent);
}

.message-list {
  min-height: 0;
  overflow-y: auto;
  padding: 15px clamp(12px, 2vw, 22px);
}

.chat-empty {
  max-width: 430px;
  margin: 12vh auto 0;
  color: var(--muted);
  text-align: center;
}

.chat-empty b {
  display: block;
  margin-bottom: 8px;
  color: var(--ink);
  font: 400 clamp(26px, 3.4vw, 42px)/1 var(--serif);
  letter-spacing: -.035em;
}

.chat-empty p {
  margin: 0;
  font-size: 11px;
  line-height: 1.7;
}

.chat-empty-kicker {
  display: inline-block;
  margin-bottom: 12px;
  color: var(--accent);
  font: 8px var(--mono);
  letter-spacing: .11em;
}

.chat-empty-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 6px;
  margin-top: 18px;
}

.chat-empty-actions button {
  padding: 8px 11px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: color-mix(in srgb, var(--surface-2) 72%, transparent);
  color: var(--ink);
  font: 8px var(--mono);
  cursor: pointer;
}

.chat-empty-actions button:hover {
  border-color: var(--accent);
  color: var(--accent);
}

.message {
  max-width: min(680px, 94%);
  margin-bottom: 12px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 13px;
  background: var(--surface);
}

.message.user {
  margin-left: auto;
  border-color: color-mix(in srgb, var(--accent) 30%, var(--line));
  background: color-mix(in srgb, var(--accent) 6%, var(--surface));
}

.message.playem-easter-egg {
  max-width: min(720px, 96%);
  overflow: hidden;
  border-color: color-mix(in srgb, var(--gold) 44%, var(--line));
  background:
    radial-gradient(circle at 92% 7%, color-mix(in srgb, var(--blue) 22%, transparent), transparent 28%),
    radial-gradient(circle at 8% 100%, color-mix(in srgb, var(--gold) 20%, transparent), transparent 31%),
    color-mix(in srgb, var(--surface) 88%, var(--accent) 12%);
  box-shadow: 0 14px 34px color-mix(in srgb, var(--bg) 28%, transparent);
}

.message.playem-easter-egg header {
  color: var(--gold);
  letter-spacing: .12em;
}

.message.playem-easter-egg p {
  color: color-mix(in srgb, var(--ink) 94%, var(--gold));
  font: 500 clamp(12px, 1.35vw, 16px)/1.7 var(--serif);
}

.message header {
  margin-bottom: 6px;
  color: var(--accent);
  font: 7px var(--mono);
  letter-spacing: .08em;
  text-transform: uppercase;
}

.message p {
  margin: 0;
  color: var(--ink);
  font-size: 11px;
  line-height: 1.7;
  white-space: pre-wrap;
}

.message pre {
  margin: 9px 0 0;
  padding: 10px;
  overflow-x: auto;
  border-radius: 8px;
  background: color-mix(in srgb, var(--bg) 78%, #000);
  color: #dfeee8;
  font: 10px/1.6 var(--mono);
  white-space: pre-wrap;
}

.message-actions {
  display: flex;
  gap: 6px;
  margin-top: 8px;
}

.message-actions button {
  padding: 5px 8px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: transparent;
  color: var(--muted);
  font: 7px var(--mono);
  cursor: pointer;
}

.chat-composer {
  display: grid;
  gap: 6px;
  margin: 8px 10px 10px;
  padding: 9px;
  border: 1px solid var(--line-strong);
  border-radius: 13px;
  background: var(--surface);
}

.chat-composer textarea {
  width: 100%;
  min-height: 52px;
  max-height: 150px;
  resize: vertical;
  padding: 4px;
  border: 0;
  background: transparent;
  color: var(--ink);
  font-size: 11px;
  line-height: 1.55;
  outline: none;
}

.composer-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.composer-foot span {
  color: var(--dim);
  font: 7px var(--mono);
}

.composer-foot button {
  min-height: 30px;
  padding: 6px 11px;
  border: 0;
  border-radius: 8px;
  background: var(--accent);
  color: #07110f;
  font: 700 8px var(--mono);
  cursor: pointer;
}

.composer-foot button span {
  padding-left: 6px;
  color: inherit;
  font-size: 13px;
}

.code-panel {
  position: relative;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  overflow-y: auto;
}

.right-view-switch {
  min-height: 42px;
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 5px 46px 5px 9px;
  border-bottom: 1px solid var(--line);
  background: color-mix(in srgb, var(--surface-2) 70%, transparent);
}

.right-view-switch button {
  min-height: 29px;
  padding: 5px 12px;
  border: 1px solid transparent;
  border-radius: 8px;
  background: transparent;
  color: var(--muted);
  font: 8px var(--mono);
  letter-spacing: .05em;
  cursor: pointer;
}

.right-view-switch button.is-active {
  border-color: var(--line);
  background: var(--surface);
  color: var(--ink);
}

.right-view {
  min-width: 0;
  min-height: 0;
}

.right-view[hidden] {
  display: none !important;
}

.notebook-view {
  display: grid;
  grid-template-rows: auto auto auto minmax(0, 1fr) auto;
  overflow-y: auto;
}

.agent-view {
  display: grid;
  grid-template-rows: minmax(0, 1fr);
  overflow: hidden;
  background: #0b0e0d;
}

.native-browser-instance {
  width: 100%;
  height: 100%;
  min-height: 0;
  border: 0;
  background: #080b0a;
}

.image-view {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  min-height: 0;
  background:
    radial-gradient(circle at 28% 18%, rgba(var(--accent-rgb), .08), transparent 34%),
    #0d1110;
}

.image-editor-toolbar {
  min-height: 42px;
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 6px 8px;
  border-bottom: 1px solid var(--line);
  background: color-mix(in srgb, var(--surface-2) 82%, transparent);
}

.image-editor-toolbar label,
.image-editor-toolbar button,
.image-import {
  min-height: 29px;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 5px 9px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  color: var(--ink);
  font: 8px var(--mono);
  cursor: pointer;
}

.image-editor-toolbar select {
  border: 0;
  background: transparent;
  color: inherit;
  font: inherit;
}

.image-import input {
  display: none;
}

.image-editor-body {
  min-height: 0;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 230px;
  overflow: hidden;
}

.image-stage {
  position: relative;
  min-width: 0;
  min-height: 0;
  display: grid;
  place-items: center;
  overflow: hidden;
  padding: 14px;
  background:
    linear-gradient(45deg, rgba(255,255,255,.035) 25%, transparent 25%),
    linear-gradient(-45deg, rgba(255,255,255,.035) 25%, transparent 25%),
    linear-gradient(45deg, transparent 75%, rgba(255,255,255,.035) 75%),
    linear-gradient(-45deg, transparent 75%, rgba(255,255,255,.035) 75%);
  background-size: 18px 18px;
  background-position: 0 0, 0 9px, 9px -9px, -9px 0;
}

.image-stage canvas {
  max-width: 100%;
  max-height: 100%;
  background: transparent;
  box-shadow: 0 14px 50px rgba(0,0,0,.35);
}

.image-empty {
  position: absolute;
  max-width: 250px;
  color: #9aa59f;
  font: 9px/1.6 var(--mono);
  text-align: center;
}

.image-empty[hidden] {
  display: none !important;
}

.image-inspector {
  min-height: 0;
  display: grid;
  grid-template-rows: auto auto minmax(0, 1fr);
  overflow-y: auto;
  border-left: 1px solid var(--line);
  background: color-mix(in srgb, var(--surface-2) 82%, #080b0a);
}

.image-inspector-heading {
  min-height: 38px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 7px 10px;
  border-bottom: 1px solid var(--line);
  color: var(--muted);
  font: 8px var(--mono);
}

.image-layer-list {
  display: grid;
  gap: 3px;
  padding: 7px;
}

.image-layer-row {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto auto auto;
  align-items: center;
  gap: 4px;
  padding: 5px;
  border: 1px solid transparent;
  border-radius: 7px;
}

.image-layer-row.is-selected {
  border-color: var(--accent);
  background: color-mix(in srgb, var(--accent) 10%, transparent);
}

.image-layer-row button {
  min-width: 22px;
  height: 22px;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 5px;
  background: transparent;
  color: var(--muted);
  font: 8px var(--mono);
  cursor: pointer;
}

.image-layer-row button:disabled {
  opacity: .3;
  cursor: default;
}

.image-layer-name {
  overflow: hidden;
  padding: 0 3px;
  border: 0;
  background: transparent;
  color: var(--ink);
  font: 9px var(--mono);
  text-align: left;
  text-overflow: ellipsis;
  white-space: nowrap;
  cursor: pointer;
}

.image-controls {
  display: grid;
  gap: 8px;
  padding: 9px;
  border-top: 1px solid var(--line);
}

.image-controls[hidden] {
  display: none !important;
}

.image-controls label {
  display: grid;
  gap: 4px;
  color: var(--muted);
  font: 8px var(--mono);
}

.image-controls label:has(output) {
  grid-template-columns: 1fr auto;
}

.image-controls label:has(output) input {
  grid-column: 1 / -1;
}

.image-controls output {
  color: var(--ink);
}

.image-controls select {
  min-height: 28px;
  padding: 4px 6px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--surface);
  color: var(--ink);
  font: 8px var(--mono);
}

.image-controls input[type="range"] {
  width: 100%;
  accent-color: var(--accent);
}

.image-editor-modal {
  width: min(1480px, calc(100vw - 18px));
  height: min(940px, calc(100svh - 18px));
  max-width: none;
  max-height: none;
  margin: auto;
  padding: 0;
  overflow: hidden;
  border: 1px solid var(--line-strong);
  border-radius: 16px;
  background: #0b0f0e;
  color: var(--ink);
  box-shadow: 0 35px 120px rgba(0,0,0,.72);
}

.image-editor-modal::backdrop {
  background: rgba(2, 5, 4, .82);
  backdrop-filter: blur(8px);
}

.image-editor-shell {
  height: 100%;
  display: grid;
  grid-template-rows: 48px minmax(0, 1fr);
}

.image-editor-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 6px 9px 6px 14px;
  border-bottom: 1px solid var(--line);
  background: #141917;
}

.image-editor-identity {
  min-width: 0;
  display: flex;
  align-items: baseline;
  gap: 10px;
}

.image-editor-identity span {
  color: var(--accent);
  font: 8px var(--mono);
  letter-spacing: .08em;
}

.image-editor-identity strong {
  overflow: hidden;
  color: #edf3ef;
  font: 500 13px var(--sans);
  text-overflow: ellipsis;
  white-space: nowrap;
}

.image-editor-history {
  display: flex;
  align-items: center;
  gap: 5px;
}

.image-editor-history button {
  min-height: 30px;
  padding: 5px 10px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: #0f1412;
  color: #dce7e1;
  font: 8px var(--mono);
  cursor: pointer;
}

.image-editor-history .dialog-close {
  width: 30px;
  padding: 0;
  font: 18px/1 var(--sans);
}

.image-editor-main {
  min-width: 0;
  min-height: 0;
  display: grid;
  grid-template-columns: 76px minmax(0, 1fr) 265px;
  overflow: hidden;
}

.image-tool-rail {
  position: relative;
  display: grid;
  align-content: start;
  gap: 3px;
  padding: 45px 7px 8px;
  overflow-y: auto;
  border-right: 1px solid var(--line);
  background: #111614;
  transition: width .16s ease;
}

.image-tool-rail.is-collapsed {
  width: 43px;
  padding-inline: 4px;
}

.image-tool-rail.is-collapsed .image-tool span {
  display: none;
}

.image-tool-collapse {
  position: absolute;
  top: 8px;
  left: 7px;
  width: 29px;
  height: 29px;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: #0b0f0e;
  color: #dce7e1;
  cursor: pointer;
}

.image-tool {
  min-height: 45px;
  display: grid;
  grid-template-columns: 20px minmax(0, 1fr);
  align-items: center;
  gap: 5px;
  padding: 5px 6px;
  border: 1px solid transparent;
  border-radius: 7px;
  background: transparent;
  color: #b8c5be;
  font-size: 16px;
  text-align: left;
  cursor: pointer;
}

.image-tool span {
  overflow: hidden;
  font: 7px var(--mono);
  text-overflow: ellipsis;
}

.image-tool:hover,
.image-tool.is-active {
  border-color: color-mix(in srgb, var(--accent) 45%, var(--line));
  background: color-mix(in srgb, var(--accent) 10%, #111614);
  color: var(--accent);
}

.image-modal-workbench {
  min-width: 0;
  min-height: 0;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  overflow: hidden;
}

.image-tool-options {
  min-height: 42px;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 9px;
  overflow-x: auto;
  border-bottom: 1px solid var(--line);
  background: #171c1a;
}

.image-tool-options label {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  color: #92a098;
  font: 8px var(--mono);
  white-space: nowrap;
}

.image-tool-options input[type="range"] {
  width: 100px;
  accent-color: var(--accent);
}

.image-tool-options input[type="text"] {
  width: 150px;
  min-height: 27px;
  padding: 4px 7px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #0b0f0e;
  color: #e7eee9;
}

.image-tool-options input[type="color"] {
  width: 27px;
  height: 27px;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 50%;
  background: transparent;
}

.image-tool-options output {
  color: #dce7e1;
}

.image-tool-options button {
  min-height: 27px;
  padding: 4px 8px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #0b0f0e;
  color: #dce7e1;
  font: 8px var(--mono);
  cursor: pointer;
}

.image-tool-options label[hidden],
.image-tool-options button:disabled {
  display: none;
}

.image-modal-stage {
  position: relative;
  min-width: 0;
  min-height: 0;
  display: grid;
  place-items: center;
  overflow: auto;
  padding: 30px;
  background:
    radial-gradient(circle at 50% 42%, rgba(255,255,255,.045), transparent 48%),
    #090c0b;
}

.image-modal-stage canvas {
  max-width: none;
  max-height: none;
  transform-origin: center;
  background: transparent;
  box-shadow: 0 20px 70px rgba(0,0,0,.58);
  cursor: crosshair;
  touch-action: none;
}

.image-selection {
  position: absolute;
  border: 1px dashed #f4efe5;
  background: rgba(255,255,255,.08);
  pointer-events: none;
}

.image-selection[hidden] {
  display: none !important;
}

.image-modal-layers {
  min-height: 0;
  display: grid;
  grid-template-rows: auto auto auto minmax(0, 1fr);
  overflow: hidden;
  border-left: 1px solid var(--line);
  background: #111614;
}

.image-modal-layers-heading {
  min-height: 40px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 6px 9px;
  border-bottom: 1px solid var(--line);
  color: #94a199;
  font: 8px var(--mono);
}

.image-modal-layers-heading > div {
  display: flex;
  align-items: center;
  gap: 7px;
}

.image-modal-add {
  width: 27px;
  height: 27px;
  display: grid;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 6px;
  color: #dce7e1;
  cursor: pointer;
}

.image-modal-add input {
  display: none;
}

.image-layer-actions {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 4px;
  padding: 6px 7px;
  border-bottom: 1px solid var(--line);
}

.image-layer-actions button {
  min-width: 0;
  min-height: 27px;
  padding: 4px 5px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #0b0f0e;
  color: #b8c5be;
  font: 7px var(--mono);
  text-overflow: ellipsis;
  white-space: nowrap;
  cursor: pointer;
}

.image-layer-actions button:hover {
  border-color: var(--accent);
  color: var(--accent);
}

.image-layer-actions button:disabled {
  opacity: .35;
  cursor: default;
}

.image-modal-layer-list {
  max-height: 46%;
  display: grid;
  gap: 3px;
  padding: 7px;
  overflow-y: auto;
}

.image-modal-layer-list .image-layer-row {
  background: #171c1a;
}

.image-modal-properties {
  min-height: 0;
  display: grid;
  align-content: start;
  gap: 8px;
  padding: 9px;
  overflow-y: auto;
  border-top: 1px solid var(--line);
}

.image-modal-properties[hidden] {
  display: none !important;
}

.image-modal-properties label {
  display: grid;
  gap: 4px;
  color: #94a199;
  font: 8px var(--mono);
}

.image-modal-properties output {
  color: #e4ece7;
}

.image-modal-properties input[type="range"] {
  width: 100%;
  accent-color: var(--accent);
}

.image-modal-properties select {
  min-height: 28px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #0b0f0e;
  color: #e4ece7;
  font: 8px var(--mono);
}

.studio-panel {
  border-bottom: 1px solid var(--line);
  background:
    radial-gradient(circle at 8% 0, rgba(var(--accent-rgb), .08), transparent 36%),
    color-mix(in srgb, var(--surface-2) 54%, transparent);
}

.studio-heading {
  min-height: 43px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 8px 11px;
}

.studio-heading > div {
  min-width: 0;
  display: flex;
  align-items: baseline;
  gap: 10px;
}

.studio-heading span {
  color: var(--accent);
  font: 7px var(--mono);
  letter-spacing: .1em;
  white-space: nowrap;
}

.studio-heading strong {
  min-width: 0;
  overflow: hidden;
  color: var(--muted);
  font: 400 12px var(--sans);
  text-overflow: ellipsis;
  white-space: nowrap;
}

.studio-heading button {
  width: 27px;
  height: 27px;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 50%;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
}

.studio-body {
  display: grid;
  gap: 6px;
  padding: 0 10px 10px;
}

.studio-body[hidden] {
  display: none;
}

.studio-module {
  min-width: 0;
  padding-inline: 2px;
  border-radius: 10px;
  background: color-mix(in srgb, var(--surface) 24%, transparent);
  box-shadow: inset 0 -1px color-mix(in srgb, var(--line) 36%, transparent);
}

.studio-module:last-child {
  box-shadow: none;
}

.studio-module > summary {
  min-height: 31px;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 5px 2px;
  color: var(--muted);
  cursor: pointer;
  list-style: none;
}

.studio-module > summary::-webkit-details-marker {
  display: none;
}

.studio-module > summary::before {
  content: "›";
  color: var(--accent);
  font: 14px/1 var(--mono);
  transition: transform .18s ease;
}

.studio-module[open] > summary::before {
  transform: rotate(90deg);
}

.studio-module > summary span {
  color: var(--accent);
  font: 7px var(--mono);
  letter-spacing: .09em;
}

.studio-module > summary strong {
  min-width: 0;
  flex: 1;
  overflow: hidden;
  color: var(--muted);
  font: 400 9px var(--mono);
  text-overflow: ellipsis;
  white-space: nowrap;
}

.studio-module > summary b {
  min-width: 20px;
  height: 20px;
  display: grid;
  place-items: center;
  border-radius: 999px;
  background: color-mix(in srgb, var(--accent) 13%, transparent);
  color: var(--accent);
  font: 7px var(--mono);
}

.studio-module[open] > :not(summary) {
  margin-bottom: 8px;
}

.studio-actions {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 5px;
  overflow: auto;
  overscroll-behavior: contain;
  padding: 1px 2px 3px;
}

.studio-actions button {
  min-width: 0;
  display: grid;
  gap: 3px;
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: color-mix(in srgb, var(--surface) 66%, transparent);
  color: var(--ink);
  text-align: left;
  cursor: pointer;
}

.studio-actions button:hover {
  border-color: color-mix(in srgb, var(--accent) 50%, var(--line));
  background: color-mix(in srgb, var(--accent) 6%, var(--surface));
}

.studio-actions b {
  font-size: 9px;
  font-weight: 600;
}

.studio-actions small {
  overflow: hidden;
  color: var(--dim);
  font: 6px/1.35 var(--mono);
  text-overflow: ellipsis;
  white-space: nowrap;
}

.studio-artifacts {
  max-height: 155px;
  display: grid;
  gap: 4px;
  overflow-y: auto;
  padding: 1px 0 2px;
  scrollbar-width: thin;
}

.studio-artifact {
  width: 100%;
  display: flex;
  align-items: center;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
}

.studio-artifact button {
  min-height: 25px;
  padding: 4px 9px;
  border: 0;
  background: transparent;
  color: var(--muted);
  font: 7px var(--mono);
  cursor: pointer;
}

.studio-artifact button:first-child {
  min-width: 0;
  flex: 1;
  overflow: hidden;
  text-align: left;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.studio-artifact button:not(:first-child) {
  width: 28px;
  padding: 0;
  color: var(--dim);
}

.studio-artifact button:not(:first-child):hover {
  color: var(--danger);
}

.studio-empty {
  margin: 2px 0;
  color: var(--dim);
  font: 7px/1.5 var(--mono);
}

.code-heading {
  align-items: stretch;
  gap: 8px;
  padding: 0;
}

.file-tabs {
  min-width: 0;
  display: flex;
  align-items: end;
  gap: 2px;
  overflow-x: auto;
  padding: 7px 7px 0;
  scrollbar-width: none;
}

.file-tab {
  flex: 0 0 auto;
  min-height: 34px;
  padding: 7px 11px;
  border: 1px solid transparent;
  border-bottom: 0;
  border-radius: 8px 8px 0 0;
  background: transparent;
  color: var(--muted);
  font: 8px var(--mono);
  cursor: pointer;
}

.file-tab.is-current {
  border-color: var(--line);
  background: var(--surface-2);
  color: var(--ink);
}

.code-actions {
  display: flex;
  align-items: center;
  gap: 4px;
  padding-right: 8px;
}

.code-actions button {
  min-height: 27px;
  padding: 5px 7px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: transparent;
  color: var(--muted);
  font: 7px var(--mono);
  cursor: pointer;
}

.editor-tools {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 35px;
  padding: 5px 9px;
  border-bottom: 1px solid var(--line);
  color: var(--dim);
  font: 7px var(--mono);
}

.editor-tools label {
  display: flex;
  align-items: center;
  gap: 5px;
}

.editor-tools select {
  height: 24px;
  padding: 0 5px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--surface);
  color: var(--ink);
  font: 8px var(--mono);
}

.editor-tools span:last-child {
  margin-left: auto;
}

.editor-frame {
  min-height: 0;
  display: grid;
  grid-template-columns: 42px minmax(0, 1fr);
  overflow: hidden;
  background:
    radial-gradient(circle at 83% 8%, rgba(var(--accent-rgb), .045), transparent 32%),
    color-mix(in srgb, var(--bg) 90%, #000);
}

.line-numbers {
  min-height: 0;
  margin: 0;
  padding: 13px 8px;
  overflow: hidden;
  border-right: 1px solid var(--line);
  color: var(--dim);
  font: 11px/1.65 var(--mono);
  text-align: right;
  user-select: none;
}

#codeEditor {
  width: 100%;
  height: 100%;
  min-height: 0;
  padding: 13px;
  resize: none;
  border: 0;
  background: transparent;
  color: var(--ink);
  caret-color: var(--accent);
  font: 11px/1.65 var(--mono);
  tab-size: 2;
  white-space: pre;
  outline: none;
}

.editor-output {
  min-height: 34px;
  padding: 8px 10px;
  overflow-x: auto;
  border-top: 1px solid var(--line);
  color: var(--dim);
  font: 8px/1.5 var(--mono);
  white-space: nowrap;
}

.mobile-pane-switch {
  display: none;
}

.light-dialog {
  width: min(620px, calc(100vw - 24px));
  max-height: calc(100svh - 24px);
  margin: auto;
  padding: 0;
  overflow: auto;
  border: 1px solid var(--line-strong);
  border-radius: 18px;
  background: var(--surface);
  color: var(--ink);
  box-shadow: 0 30px 100px rgba(0, 0, 0, .45);
}

.light-dialog::backdrop {
  background: rgba(3, 10, 8, .65);
  backdrop-filter: blur(8px);
}

.dialog-sheet {
  position: relative;
  display: grid;
  gap: 13px;
  padding: clamp(22px, 4vw, 36px);
}

.dialog-kicker {
  margin: 0;
  color: var(--accent);
  font: 8px var(--mono);
  letter-spacing: .09em;
}

.dialog-sheet h2 {
  margin: -4px 0 6px;
  font: 400 clamp(31px, 5vw, 45px)/1 var(--serif);
  letter-spacing: -.04em;
}

.dialog-sheet > p:not(.dialog-kicker, .model-note) {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.7;
}

.dialog-sheet > label {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font: 8px/1.4 var(--mono);
  letter-spacing: .05em;
  text-transform: uppercase;
}

.dialog-sheet > label[hidden] {
  display: none !important;
}

.dialog-sheet :is(input, textarea, select) {
  width: 100%;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: var(--bg);
  color: var(--ink);
  font: 11px var(--sans);
  text-transform: none;
}

.dialog-sheet textarea {
  resize: vertical;
}

.model-field-help {
  color: var(--muted);
  font: 9px/1.55 var(--sans);
  letter-spacing: 0;
  text-transform: none;
}

.model-field-help a {
  color: var(--accent);
  text-decoration: underline;
  text-underline-offset: 2px;
}

.model-choice-note {
  margin: -4px 0 0 !important;
  color: var(--muted);
  font-size: 11px !important;
  line-height: 1.6 !important;
}

.model-switch-glyph {
  margin-left: 2px;
  font-size: 10px;
}

.dialog-close {
  position: absolute;
  z-index: 2;
  top: 11px;
  right: 11px;
  width: 32px;
  height: 32px;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 50%;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
}

.dialog-actions,
.model-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
}

.dialog-actions button,
.model-actions button {
  min-height: 38px;
  padding: 9px 14px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: var(--accent);
  color: #07110f;
  font: 700 9px var(--mono);
  cursor: pointer;
}

.quiet-dialog-button,
.model-actions button:first-child {
  background: transparent;
  color: var(--muted);
}

#modelDialog .model-actions {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(130px, auto);
}

#saveModel[data-nyarindo-symbol] {
  width: auto !important;
  min-width: 130px !important;
  height: auto !important;
  min-height: 38px !important;
  max-width: none !important;
  flex: 1 1 auto !important;
  padding: 9px 14px !important;
  border-radius: 9px !important;
  font-size: 9px !important;
}

#saveModel.nyarindo-system-control {
  border-color: var(--accent) !important;
  background: var(--accent) !important;
  color: #07110f !important;
}

#saveModel[data-nyarindo-symbol]::before {
  display: none;
}

.model-note {
  margin: 0;
  padding: 9px 11px;
  border-left: 2px solid var(--accent);
  background: rgba(var(--accent-rgb), .05);
  color: var(--muted);
  font-size: 10px;
  line-height: 1.6;
}

.check-row {
  display: flex !important;
  grid-template-columns: none !important;
  align-items: center;
  gap: 8px !important;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: var(--bg);
  color: var(--muted) !important;
  font: 9px/1.5 var(--sans) !important;
  letter-spacing: 0 !important;
  text-transform: none !important;
}

.check-row input {
  width: 15px !important;
  height: 15px;
  flex: 0 0 auto;
  margin: 0;
  padding: 0 !important;
  accent-color: var(--accent);
}

.addon-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 7px;
}

.addon-card {
  min-width: 0;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  gap: 8px;
  padding: 11px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--bg);
}

.addon-symbol {
  width: 30px;
  height: 30px;
  display: grid;
  place-items: center;
  border: 1px solid color-mix(in srgb, var(--accent) 38%, var(--line));
  border-radius: 9px;
  color: var(--accent);
  font-size: 15px;
}

.addon-card div {
  min-width: 0;
}

.addon-card strong {
  font-size: 11px;
}

.addon-card p {
  margin: 5px 0 0;
  color: var(--dim);
  font-size: 9px;
  line-height: 1.55;
}

.addon-card button,
.addon-card a,
.installed-addon button {
  min-height: 29px;
  display: inline-grid;
  place-items: center;
  padding: 5px 8px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: transparent;
  color: var(--accent);
  font: 7px var(--mono);
  text-decoration: none;
  cursor: pointer;
}

.installed-addons {
  display: grid;
  gap: 5px;
}

.installed-addon {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 9px;
}

.installed-addon div {
  min-width: 0;
  display: grid;
  gap: 3px;
}

.installed-addon strong {
  font-size: 10px;
}

.installed-addon small {
  overflow: hidden;
  color: var(--dim);
  font: 7px var(--mono);
  text-overflow: ellipsis;
  white-space: nowrap;
}

.addon-import {
  padding: 9px;
  border: 1px dashed var(--line-strong);
  border-radius: 9px;
}

.studio-document {
  max-height: min(56vh, 520px);
  margin: 0;
  padding: 15px;
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: color-mix(in srgb, var(--bg) 80%, #000);
  color: var(--ink);
  font: 10px/1.65 var(--mono);
  white-space: pre-wrap;
}

.file-pick {
  cursor: pointer;
}

.source-web-actions {
  display: flex;
  justify-content: flex-end;
}

.source-web-actions button,
.web-search-row button {
  min-height: 32px;
  padding: 6px 11px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-2);
  color: var(--ink);
  font: 8px var(--mono);
  cursor: pointer;
}

.source-dialog-divider {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--muted);
  font: 8px var(--mono);
}

.source-dialog-divider::before,
.source-dialog-divider::after {
  content: "";
  height: 1px;
  flex: 1;
  background: var(--line);
}

.web-search-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 6px;
}

.web-search-results {
  max-height: 240px;
  display: grid;
  gap: 6px;
  overflow-y: auto;
}

.web-search-result {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: start;
  gap: 10px;
  padding: 9px 10px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: color-mix(in srgb, var(--surface-2) 64%, transparent);
}

.web-search-result strong,
.web-search-result span,
.web-search-result p {
  display: block;
  min-width: 0;
}

.web-search-result strong {
  color: var(--ink);
  font: 500 12px/1.35 var(--sans);
}

.web-search-result span {
  margin-top: 3px;
  overflow: hidden;
  color: var(--muted);
  font: 7px var(--mono);
  text-overflow: ellipsis;
  white-space: nowrap;
}

.web-search-result p {
  margin: 5px 0 0;
  color: var(--muted);
  font-size: 10px;
  line-height: 1.45;
}

.web-search-result > button {
  padding: 5px 8px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: var(--surface);
  color: var(--accent);
  font: 8px var(--mono);
  cursor: pointer;
}

.web-search-empty {
  margin: 0;
  padding: 12px;
  color: var(--muted);
  font-size: 10px;
  text-align: center;
}

.file-pick input {
  padding: 7px;
}

.light-toast {
  position: fixed;
  z-index: 90;
  right: 15px;
  bottom: 15px;
  max-width: min(360px, calc(100vw - 30px));
  padding: 9px 12px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: var(--ink);
  color: var(--bg);
  font-size: 10px;
  opacity: 0;
  transform: translateY(10px);
  pointer-events: none;
  transition: opacity .18s ease, transform .18s ease;
}

.light-toast.show {
  opacity: 1;
  transform: none;
}

.button-tooltip {
  position: fixed;
  z-index: 130;
  max-width: min(240px, calc(100vw - 18px));
  padding: 6px 8px;
  border: 1px solid rgba(255,255,255,.17);
  border-radius: 8px;
  background: rgba(9, 18, 16, .95);
  color: #eff5ed;
  box-shadow: 0 9px 24px rgba(0,0,0,.28);
  font: 8px/1.4 var(--mono);
  pointer-events: none;
}

.button-tooltip[hidden] {
  display: none;
}

.light-skin-picker {
  display: flex;
  align-items: center;
  gap: 5px;
  color: var(--muted);
  font: 7px var(--mono);
}

.light-skin-picker select {
  min-height: 34px;
  max-width: 150px;
  padding: 4px 8px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: color-mix(in srgb, var(--surface-2) 84%, transparent);
  color: var(--ink);
  font: 8px var(--mono);
}

body[data-light-skin="chatgpt"] {
  --light-ui-accent: #10a37f;
}

body[data-light-skin="notebooklm"] {
  --light-ui-accent: #8b7cf6;
}

body[data-light-skin="codex"] {
  --light-ui-accent: #0ea5e9;
}

body[data-light-skin="photoshop"] {
  --light-ui-accent: #31a8ff;
}

body[data-light-skin="nyarindo"] {
  --light-ui-accent: var(--accent);
}

.light-ribbon {
  min-width: 0;
  display: block;
  border-bottom: 1px solid var(--line);
  background: color-mix(in srgb, var(--surface) 92%, #202421);
}

body[data-light-skin="chatgpt"] .light-ribbon {
  background: color-mix(in srgb, var(--surface) 91%, #18352e);
}

body[data-light-skin="notebooklm"] .light-ribbon {
  background: color-mix(in srgb, var(--surface) 90%, #302b45);
}

body[data-light-skin="codex"] .light-ribbon {
  background: color-mix(in srgb, var(--surface) 92%, #1d303a);
}

body[data-light-skin="photoshop"] .light-ribbon {
  background: color-mix(in srgb, var(--surface) 92%, #17212a);
}

.light-ribbon-tabs {
  min-width: 0;
  min-height: 31px;
  display: flex;
  align-items: end;
  gap: 1px;
  padding: 0 8px;
  overflow-x: auto;
  border-bottom: 1px solid var(--line);
  background: color-mix(in srgb, var(--surface-2) 92%, #1f2220);
  scrollbar-width: none;
}

.light-ribbon-tabs::-webkit-scrollbar {
  display: none;
}

.light-ribbon-tabs button {
  min-width: max-content;
  height: 30px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0 12px;
  border: 0;
  border-bottom: 2px solid transparent;
  border-radius: 5px 5px 0 0;
  background: transparent;
  color: color-mix(in srgb, var(--ink) 78%, transparent);
  font: 8px var(--mono);
  cursor: pointer;
}

.light-ribbon-tabs button:is(:hover, :focus-visible) {
  background: color-mix(in srgb, var(--ink) 6%, transparent);
  outline: none;
}

.light-ribbon-tabs button[aria-selected="true"] {
  border-bottom-color: var(--light-ui-accent, var(--accent));
  background: color-mix(in srgb, var(--surface) 92%, #202421);
  color: var(--ink);
}

.light-ribbon-panels {
  min-height: 82px;
  overflow-x: auto;
  overflow-y: hidden;
  scrollbar-width: thin;
}

.light-ribbon-panel {
  min-width: max-content;
  min-height: 82px;
  display: none;
  align-items: stretch;
  padding: 6px 9px 4px;
}

.light-ribbon-panel.is-active {
  display: flex;
}

.light-ribbon-group {
  min-width: max-content;
  display: grid;
  grid-template-rows: minmax(0, 1fr) auto;
  gap: 3px;
  padding: 2px 10px 3px;
  border-right: 1px solid color-mix(in srgb, var(--ink) 12%, transparent);
}

.light-ribbon-group:last-child {
  border-right: 0;
}

.light-ribbon-group > small {
  color: color-mix(in srgb, var(--ink) 52%, transparent);
  font: 7px var(--mono);
  text-align: center;
}

.light-ribbon-command-row {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  gap: 3px;
}

.light-ribbon :is(button) {
  min-width: 30px;
  height: 30px;
  display: inline-grid;
  place-items: center;
  padding: 0 8px;
  border: 1px solid transparent;
  border-radius: 5px;
  background: transparent;
  color: var(--ink);
  font: 9px var(--mono);
  cursor: pointer;
}

.light-ribbon :is(button):is(:hover, :focus-visible) {
  border-color: color-mix(in srgb, var(--light-ui-accent, var(--accent)) 42%, var(--line));
  background: color-mix(in srgb, var(--light-ui-accent, var(--accent)) 10%, transparent);
  outline: none;
}

.light-ribbon .light-ribbon-large {
  width: 66px;
  height: 54px;
  display: grid;
  place-items: center;
  align-content: center;
  gap: 3px;
  padding: 4px;
  text-align: center;
}

.light-ribbon .light-ribbon-large b {
  display: grid;
  place-items: center;
  width: 25px;
  height: 25px;
  font: 700 18px/1 var(--sans);
}

.light-ribbon .light-ribbon-large span {
  font: 7px/1.1 var(--mono);
}

body[data-light-skin="chatgpt"] .chat-panel {
  background: color-mix(in srgb, var(--bg) 92%, #0b231c);
}

body[data-light-skin="chatgpt"] .message {
  border-radius: 20px;
}

body[data-light-skin="notebooklm"] .studio-panel {
  background:
    radial-gradient(circle at 12% 0, color-mix(in srgb, #8b7cf6 11%, transparent), transparent 32%),
    color-mix(in srgb, var(--surface) 92%, transparent);
}

body[data-light-skin="codex"] .editor-frame,
body[data-light-skin="codex"] #codeEditor,
body[data-light-skin="codex"] .line-numbers {
  font-family: var(--mono);
}

body[data-light-skin="codex"] .code-panel {
  background: color-mix(in srgb, var(--bg) 92%, #07131a);
}

body[data-light-skin="photoshop"] .image-view {
  background:
    radial-gradient(circle at 24% 18%, rgba(49, 168, 255, .1), transparent 34%),
    #0d1110;
}

body[data-light-skin="photoshop"] .image-stage {
  background-color: #15191b;
}

@media (min-width: 901px) {
  :root {
    --line: rgba(226, 238, 226, .075);
    --line-strong: rgba(226, 238, 226, .14);
  }

  html[data-theme="light"] {
    --line: rgba(31, 52, 42, .085);
    --line-strong: rgba(31, 52, 42, .15);
  }

  body {
    background:
      radial-gradient(circle at 14% 18%, rgba(var(--accent-rgb), .055), transparent 34%),
      radial-gradient(circle at 88% 82%, rgba(91, 184, 232, .045), transparent 38%),
      var(--bg);
  }

  .light-header {
    border-bottom-color: transparent;
    background:
      linear-gradient(180deg, color-mix(in srgb, var(--surface) 94%, transparent), color-mix(in srgb, var(--surface) 82%, transparent));
    box-shadow: inset 0 -1px color-mix(in srgb, var(--line) 70%, transparent);
  }

  .light-workspace {
    grid-template-columns: var(--library-width) 2px minmax(320px, 1fr) 2px var(--code-width);
    gap: 8px;
    padding: 8px;
    background:
      radial-gradient(circle at 15% 20%, rgba(var(--accent-rgb), .055), transparent 34%),
      radial-gradient(circle at 85% 78%, rgba(91, 184, 232, .045), transparent 38%);
  }

  body.library-collapsed:not(.code-collapsed) .light-workspace {
    grid-template-columns: 0 0 minmax(320px, 1fr) 2px var(--code-width);
  }

  body.code-collapsed:not(.library-collapsed) .light-workspace {
    grid-template-columns: var(--library-width) 2px minmax(320px, 1fr) 0 0;
  }

  body.library-collapsed.code-collapsed .light-workspace {
    grid-template-columns: 0 0 minmax(0, 1fr) 0 0;
  }

  .light-panel {
    border: 0;
    border-radius: 20px;
    background:
      linear-gradient(155deg, color-mix(in srgb, var(--surface) 72%, transparent), color-mix(in srgb, var(--surface-2) 58%, transparent));
    box-shadow:
      0 0 0 1px color-mix(in srgb, var(--line) 78%, transparent),
      0 18px 52px rgba(0, 0, 0, .16),
      inset 0 1px 0 color-mix(in srgb, white 5%, transparent);
  }

  .library-panel,
  .chat-panel,
  .code-panel {
    overflow: hidden;
  }

  .pane-resizer {
    width: 2px;
  }

  .pane-resizer::after {
    inset: 20% 0;
    border-radius: 999px;
    background: color-mix(in srgb, var(--line) 54%, transparent);
  }

  body:is(.library-maximized, .code-maximized) .light-workspace {
    grid-template-columns: minmax(0, 1fr);
    gap: 0;
    padding: 0;
  }

  body.library-maximized .library-panel,
  body.code-maximized .code-panel {
    grid-column: 1;
    border-radius: 0;
  }

  :where(.right-view-switch, .chat-heading, .code-heading, .source-group-header, .studio-heading) {
    border-color: transparent;
    box-shadow: inset 0 -1px color-mix(in srgb, var(--line) 58%, transparent);
  }

  :where(.header-icon, .palette-switch > summary, .status-button, .export-project, .right-view-switch button, .editor-tools, .composer-foot, .light-dialog) {
    border-color: color-mix(in srgb, var(--line) 78%, transparent);
  }

  :where(.message-card, .source-entry, .document-entry, .studio-action, .scene-panel, .view-panel) {
    border-color: color-mix(in srgb, var(--line) 64%, transparent);
    box-shadow: 0 12px 36px rgba(0, 0, 0, .12);
  }

  .library-panel {
    overflow: auto;
    scrollbar-gutter: stable;
  }

  .message-list,
  .notebook-view,
  .image-editor-body,
  .image-inspector {
    overflow: auto;
    overscroll-behavior: contain;
    scrollbar-gutter: stable;
  }

  .source-list,
  .file-tree,
  .conversation-list,
  .studio-artifacts {
    overflow: auto;
    overscroll-behavior: contain;
    scrollbar-gutter: stable;
  }

  .left-accordion > summary,
  .studio-heading,
  .code-heading {
    position: sticky;
    top: 0;
    z-index: 7;
    background: color-mix(in srgb, var(--surface) 92%, transparent);
    backdrop-filter: blur(14px) saturate(1.05);
  }

  .studio-heading {
    margin-inline: -10px;
    padding-inline: 10px;
  }

  .studio-actions {
    max-height: clamp(118px, 21vh, 190px);
  }

  :where(
    .library-panel,
    .message-list,
    .notebook-view,
    .source-list,
    .file-tree,
    .conversation-list,
    .studio-artifacts,
    .image-editor-body,
    .image-inspector,
    #codeEditor
  ) {
    scrollbar-width: thin;
    scrollbar-color:
      color-mix(in srgb, var(--accent) 34%, transparent)
      color-mix(in srgb, var(--bg) 74%, transparent);
  }

  :where(
    .library-panel,
    .message-list,
    .notebook-view,
    .source-list,
    .file-tree,
    .conversation-list,
    .studio-artifacts,
    .image-editor-body,
    .image-inspector,
    #codeEditor
  )::-webkit-scrollbar {
    width: 9px;
    height: 9px;
  }

  :where(
    .library-panel,
    .message-list,
    .notebook-view,
    .source-list,
    .file-tree,
    .conversation-list,
    .studio-artifacts,
    .image-editor-body,
    .image-inspector,
    #codeEditor
  )::-webkit-scrollbar-thumb {
    border: 2px solid transparent;
    border-radius: 999px;
    background: color-mix(in srgb, var(--accent) 36%, transparent);
    background-clip: padding-box;
  }

  :where(
    .library-panel,
    .message-list,
    .notebook-view,
    .source-list,
    .file-tree,
    .conversation-list,
    .studio-artifacts,
    .image-editor-body,
    .image-inspector,
    #codeEditor
  )::-webkit-scrollbar-track {
    background: transparent;
  }
}

@media (max-width: 1080px) {
  .light-workspace {
    --library-width: 215px;
    --code-width: clamp(340px, 38vw, 500px);
  }

  .status-button {
    max-width: 145px;
  }

  .light-skin-picker select {
    max-width: 122px;
  }
}

@media (max-width: 900px) {
  body {
    grid-template-rows: 58px 39px minmax(0, 1fr);
  }

  .light-header {
    grid-template-columns: auto minmax(90px, 1fr) auto;
    gap: 7px;
    padding: 6px 8px;
  }

  .light-brand span,
  .status-button span,
  .local-mark,
  .palette-switch,
  .light-skin-picker {
    display: none;
  }

  .light-ribbon {
    display: none;
  }

  .light-brand img {
    width: 34px;
    height: 34px;
  }

  .project-identity {
    gap: 0;
  }

  .project-identity input {
    width: 100%;
    text-align: left;
  }

  .header-actions {
    gap: 4px;
  }

  .view-switch > summary {
    width: 34px;
    min-width: 34px;
    padding: 0;
  }

  .view-switch > summary > span {
    display: none;
  }

  .view-panel {
    position: fixed;
    top: 102px;
    right: 14px;
    left: auto;
    width: min(240px, calc(100vw - 28px));
  }

  .header-icon,
  .palette-switch > summary,
  .status-button,
  .export-project {
    width: 34px;
    min-width: 34px;
    height: 34px;
    padding: 0;
    font-size: 0;
  }

  .status-button {
    display: grid;
    place-items: center;
  }

  .status-button i {
    display: block;
  }

  .export-project::after {
    content: "↗";
    font-size: 13px;
  }

  .mobile-pane-switch {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 4px;
    padding: 4px 7px;
    border-bottom: 1px solid var(--line);
    background: var(--surface);
  }

  .mobile-pane-switch button {
    border: 1px solid transparent;
    border-radius: 7px;
    background: transparent;
    color: var(--muted);
    font: 7px var(--mono);
  }

  .mobile-pane-switch button.is-active {
    border-color: var(--line);
    background: var(--surface-2);
    color: var(--accent);
  }

  .light-workspace {
    display: block;
  }

  .pane-resizer,
  .panel-expand,
  .right-expand {
    display: none;
  }

  .light-panel {
    display: none;
    width: 100%;
    height: 100%;
    border-right: 0;
  }

  body[data-mobile-pane="sources"] .library-panel,
  body[data-mobile-pane="chat"] .chat-panel,
  body[data-mobile-pane="code"] .code-panel {
    display: grid;
  }

  .library-panel {
    grid-template-rows: auto minmax(180px, .8fr) minmax(220px, 1.2fr);
  }

  .code-panel {
    grid-template-rows: auto minmax(0, 1fr);
  }

  .image-editor-body {
    grid-template-columns: minmax(0, 1fr) 205px;
  }

  .image-editor-modal {
    width: 100vw;
    height: 100svh;
    max-width: none;
    max-height: none;
    border-radius: 0;
  }

  .image-editor-main {
    grid-template-columns: 66px minmax(0, 1fr);
  }

  .image-modal-layers {
    position: absolute;
    right: 7px;
    bottom: 7px;
    width: min(260px, calc(100vw - 14px));
    max-height: 42svh;
    border: 1px solid var(--line-strong);
    border-radius: 10px;
    box-shadow: 0 16px 50px rgba(0,0,0,.5);
  }

  .studio-actions {
    grid-template-columns: repeat(6, minmax(112px, 1fr));
    overflow-x: auto;
    padding-bottom: 2px;
  }
}

@media (max-width: 540px) {
  .light-header {
    grid-template-columns: 34px minmax(80px, 1fr) auto;
  }

  .light-brand img {
    width: 32px;
    height: 32px;
  }

  .dialog-actions {
    flex-direction: column-reverse;
  }

  .dialog-actions button,
  #modelDialog .model-actions button {
    width: 100%;
  }

  #modelDialog .model-actions {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
  }

  .editor-tools {
    gap: 6px;
  }

  .editor-tools span {
    display: none;
  }

  .editor-tools span:last-child {
    display: inline;
    margin-left: auto;
  }

  .studio-heading > div {
    display: grid;
    gap: 2px;
  }

  .studio-actions {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    overflow: visible;
  }

  .studio-actions small {
    display: none;
  }

  .image-editor-body {
    grid-template-columns: minmax(0, 1fr);
    grid-template-rows: minmax(260px, 1fr) auto;
  }

  .image-inspector {
    max-height: 240px;
    border-top: 1px solid var(--line);
    border-left: 0;
  }

  .addon-grid {
    grid-template-columns: 1fr;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    transition-duration: .01ms !important;
    animation-duration: .01ms !important;
  }
}

/* Light opens as a command rail around the conversation, not a wall of panels. */
.light-header {
  border-bottom: 0;
  background:
    radial-gradient(circle at 100% 0, color-mix(in srgb, var(--accent) 12%, transparent), transparent 34%),
    color-mix(in srgb, var(--surface) 90%, transparent);
  box-shadow: 0 10px 28px rgba(0, 0, 0, .12);
}

.header-icon,
.palette-switch > summary,
.status-button,
.export-project,
.view-switch > summary {
  border-color: transparent !important;
  background:
    linear-gradient(145deg,
      color-mix(in srgb, var(--surface-2) 82%, white 18%),
      color-mix(in srgb, var(--surface) 90%, var(--accent) 10%)) !important;
  box-shadow: inset 0 1px rgba(255, 255, 255, .09), 0 5px 14px rgba(0, 0, 0, .1);
}

.light-ribbon {
  position: relative;
  z-index: 28;
  border: 0;
  background:
    linear-gradient(90deg,
      color-mix(in srgb, var(--surface) 90%, var(--accent) 10%),
      color-mix(in srgb, var(--surface-2) 90%, var(--gold) 10%)) !important;
  box-shadow: 0 8px 25px rgba(0, 0, 0, .12);
}

.light-ribbon-bar {
  min-height: 66px;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 6px 12px;
}

.light-ribbon-tabs {
  flex: 1 1 auto;
  min-height: 58px;
  justify-content: center;
  gap: 8px;
  padding: 0;
  overflow-x: auto;
  border: 0;
  background: transparent;
}

.light-ribbon-tabs button,
.light-ribbon .light-ribbon-toggle {
  width: 62px;
  min-width: 62px;
  height: 58px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 5px;
  padding: 5px 3px 4px;
  border: 0;
  border-radius: 14px;
  background:
    linear-gradient(145deg,
      color-mix(in srgb, var(--surface-2) 88%, white 12%),
      color-mix(in srgb, var(--surface) 86%, var(--accent) 14%));
  color: var(--ink);
  font-size: 0;
  box-shadow:
    inset 0 1px color-mix(in srgb, white 18%, transparent),
    0 4px 13px color-mix(in srgb, var(--bg) 22%, transparent);
  cursor: pointer;
}

.light-ribbon .light-ribbon-toggle {
  position: relative;
  z-index: 2;
  flex: 0 0 62px;
}

.light-ribbon-tabs button > b,
.light-ribbon-toggle > b {
  font-size: 18px;
  font-weight: 400;
  line-height: 1;
}

.light-ribbon-tabs button > small,
.light-ribbon-toggle > small {
  max-width: calc(100% - 2px);
  min-height: 1.15em;
  overflow: visible;
  color: var(--ink);
  font: 700 9px/1.15 var(--mono);
  letter-spacing: .015em;
  text-overflow: clip;
  text-shadow: 0 1px color-mix(in srgb, var(--surface) 74%, transparent);
  text-transform: uppercase;
  white-space: nowrap;
}

.light-ribbon-tabs button:is(:hover, :focus-visible),
.light-ribbon-toggle:is(:hover, :focus-visible),
.light-ribbon-tabs button[aria-selected="true"],
.light-ribbon-toggle[aria-expanded="true"] {
  background:
    radial-gradient(circle at 24% 18%, rgba(255, 255, 255, .19), transparent 34%),
    linear-gradient(135deg,
      color-mix(in srgb, var(--light-ui-accent, var(--accent)) 34%, var(--surface-2)),
      color-mix(in srgb, var(--blue) 18%, var(--surface))) !important;
  box-shadow: 0 8px 22px color-mix(in srgb, var(--light-ui-accent, var(--accent)) 20%, transparent);
  outline: none;
}

.light-ribbon-panels {
  position: absolute;
  z-index: 80;
  top: calc(100% + 7px);
  left: 10px;
  width: min(820px, calc(100vw - 20px));
  max-height: min(360px, calc(100svh - 120px));
  min-height: 0;
  display: none;
  overflow: auto;
  border: 0;
  border-radius: 0 16px 16px 16px;
  background:
    radial-gradient(circle at 12% 0, color-mix(in srgb, var(--light-ui-accent, var(--accent)) 15%, transparent), transparent 35%),
    color-mix(in srgb, var(--surface) 97%, transparent);
  box-shadow: 0 22px 58px rgba(0, 0, 0, .34);
  backdrop-filter: blur(22px) saturate(1.12);
}

.light-ribbon.is-open .light-ribbon-panels {
  display: block;
}

.light-ribbon-panel {
  min-width: 0;
  min-height: 0;
  padding: 11px;
  background: linear-gradient(120deg, rgba(255, 255, 255, .025), transparent);
}

.light-ribbon-group {
  min-width: 0;
  padding: 8px 10px;
  border: 0;
  border-radius: 12px;
  background:
    linear-gradient(140deg,
      color-mix(in srgb, var(--surface-2) 82%, transparent),
      color-mix(in srgb, var(--surface) 94%, var(--light-ui-accent, var(--accent)) 6%));
}

.light-ribbon :is(button) {
  border: 0;
  background: transparent;
}

.light-ribbon :is(button):is(:hover, :focus-visible) {
  border: 0;
  background:
    linear-gradient(120deg,
      color-mix(in srgb, var(--light-ui-accent, var(--accent)) 24%, transparent),
      color-mix(in srgb, var(--blue) 12%, transparent));
}

.light-panel {
  border: 0;
  box-shadow: 0 16px 44px rgba(0, 0, 0, .12);
}

.right-view-switch {
  border: 0;
  background: linear-gradient(120deg, color-mix(in srgb, var(--surface-2) 90%, transparent), transparent);
}

.right-view-switch button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  padding: 5px 8px;
  border: 0;
  border-radius: 10px;
  font-size: 7px;
  letter-spacing: .04em;
  text-transform: uppercase;
}

.right-view-switch button::before {
  font-size: 15px;
}

.right-view-switch button[data-right-view="notebook"]::before { content: "◫"; }
.right-view-switch button[data-right-view="agent"]::before { content: "◎"; }
.right-view-switch button[data-right-view="image"]::before { content: "▧"; }

.right-view-switch button.is-active {
  background: linear-gradient(135deg,
    color-mix(in srgb, var(--light-ui-accent, var(--accent)) 32%, transparent),
    color-mix(in srgb, var(--blue) 14%, transparent));
}

@media (max-width: 900px) {
  body {
    grid-template-rows: 58px 54px 39px minmax(0, 1fr);
  }

  .light-ribbon {
    display: block;
  }

  .light-ribbon-panels {
    position: fixed;
    top: 102px;
    right: 8px;
    left: 8px;
    width: auto;
    max-height: min(45svh, 360px);
    border-radius: 14px;
  }

  .light-ribbon-tabs {
    justify-content: flex-start;
  }

  .light-ribbon-tabs button,
  .light-ribbon .light-ribbon-toggle {
    width: 58px;
    min-width: 58px;
  }

  .light-ribbon .light-ribbon-toggle {
    flex-basis: 58px;
  }

  .light-skin-picker,
  .view-switch,
  .status-button,
  .export-project {
    display: none !important;
  }

  .header-actions {
    gap: 4px;
  }

  .project-identity input {
    max-width: 150px;
  }
}

body[data-app-install="light"] .nyarindo-palette-strip {
  min-height: 36px;
  border: 0;
  background:
    linear-gradient(90deg,
      color-mix(in srgb, var(--surface) 88%, var(--accent) 12%),
      color-mix(in srgb, var(--surface-2) 88%, var(--gold) 12%));
  box-shadow: 0 8px 20px rgba(0, 0, 0, .1);
}

.source-entry,
.file-entry {
  display: block;
  margin-bottom: 6px;
  padding: 0;
  overflow: hidden;
  border: 0;
  border-radius: 12px;
  background:
    linear-gradient(145deg,
      color-mix(in srgb, var(--surface-2) 72%, transparent),
      color-mix(in srgb, var(--surface) 94%, var(--accent) 6%));
  box-shadow: inset 0 1px rgba(255, 255, 255, .045);
}

.source-entry.is-expanded,
.file-entry.is-expanded,
.file-entry.is-current {
  background:
    linear-gradient(145deg,
      color-mix(in srgb, var(--light-ui-accent, var(--accent)) 14%, var(--surface-2)),
      color-mix(in srgb, var(--surface) 92%, var(--blue) 8%));
  box-shadow: 0 10px 26px rgba(0, 0, 0, .14);
}

.file-open,
.source-open {
  width: 100%;
  min-width: 0;
  display: grid;
  gap: 3px;
  padding: 10px 11px;
  border: 0;
  background: transparent;
  color: inherit;
  text-align: left;
  cursor: pointer;
}

.source-open {
  grid-template-columns: minmax(0, 1fr);
}

.file-open strong,
.source-open strong {
  overflow-wrap: anywhere;
  white-space: normal;
}

.container-actions {
  display: none;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 6px;
  padding: 0 9px 9px;
}

.is-expanded > .container-actions {
  display: grid;
}

.container-action,
.source-include {
  min-height: 34px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 7px 9px;
  border: 0;
  border-radius: 9px;
  background:
    linear-gradient(135deg,
      color-mix(in srgb, var(--surface-2) 76%, white 12%),
      color-mix(in srgb, var(--light-ui-accent, var(--accent)) 11%, var(--surface)));
  color: var(--ink);
  font: 8px/1.3 var(--mono);
  text-align: center;
  cursor: pointer;
}

.source-entry .source-include {
  display: flex;
}

.container-action:is(:hover, :focus-visible),
.source-include:is(:hover, :focus-within) {
  background:
    linear-gradient(135deg,
      color-mix(in srgb, var(--light-ui-accent, var(--accent)) 24%, var(--surface-2)),
      color-mix(in srgb, var(--blue) 14%, var(--surface)));
  outline: none;
  box-shadow: 0 7px 18px rgba(0, 0, 0, .14);
}

.source-include input {
  accent-color: var(--accent);
}

.source-preview {
  grid-column: 1 / -1;
  max-height: 180px;
  margin: 0;
  overflow: auto;
  padding: 10px;
  border-radius: 9px;
  background: color-mix(in srgb, var(--bg) 58%, transparent);
  color: var(--muted);
  font: 9px/1.6 var(--mono);
  white-space: pre-wrap;
}

.mobile-pane-switch button {
  font-size: 0;
}

.mobile-pane-switch button::before {
  font-size: 16px;
}

.mobile-pane-switch button[data-mobile-pane="sources"]::before { content: "▣"; }
.mobile-pane-switch button[data-mobile-pane="chat"]::before { content: "◌"; }
.mobile-pane-switch button[data-mobile-pane="code"]::before { content: "⌨"; }
