@charset "UTF-8";

@font-face {
  font-family: 'Bricolage Grotesque';
  font-style: normal;
  font-weight: 400 700;
  font-display: swap;
  src: url('../fonts/bricolage-grotesque-latin.woff2') format('woff2');
}

@font-face {
  font-family: 'IBM Plex Mono';
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url('../fonts/ibm-plex-mono-400-latin.woff2') format('woff2');
}

@font-face {
  font-family: 'IBM Plex Mono';
  font-style: normal;
  font-weight: 500;
  font-display: swap;
  src: url('../fonts/ibm-plex-mono-500-latin.woff2') format('woff2');
}

@font-face {
  font-family: 'IBM Plex Mono';
  font-style: normal;
  font-weight: 600;
  font-display: swap;
  src: url('../fonts/ibm-plex-mono-600-latin.woff2') format('woff2');
}

:root {
  --canvas: oklch(0.148 0.011 85);
  --rail: oklch(0.124 0.01 85);
  --panel: oklch(0.186 0.013 85);
  --panel-2: oklch(0.224 0.015 85);
  --panel-3: oklch(0.26 0.016 85);
  --inset: oklch(0.122 0.008 85);

  --line: oklch(1 0 0 / 0.07);
  --line-strong: oklch(1 0 0 / 0.14);

  --text: oklch(0.965 0.008 85);
  --text-dim: oklch(0.84 0.012 85);
  --muted: oklch(0.61 0.015 85);

  --amber: oklch(0.8 0.13 68);
  --amber-soft: oklch(0.8 0.13 68 / 0.13);
  --magenta: oklch(0.76 0.15 340);
  --magenta-soft: oklch(0.76 0.15 340 / 0.13);
  --cyan: oklch(0.77 0.095 190);
  --cyan-soft: oklch(0.77 0.095 190 / 0.13);
  --lime: oklch(0.81 0.12 130);
  --lime-soft: oklch(0.81 0.12 130 / 0.13);
  --danger: oklch(0.74 0.15 25);
  --danger-soft: oklch(0.74 0.15 25 / 0.12);

  --brand-tile: oklch(0.14 0.012 85);
  --brand-tile-line: oklch(1 0 0 / 0.12);

  --radius: 14px;
  --radius-sm: 9px;
  --radius-pill: 999px;

  --shadow-1: 0 1px 2px oklch(0 0 0 / 0.38), 0 8px 26px oklch(0 0 0 / 0.2);
  --shadow-2: 0 2px 6px oklch(0 0 0 / 0.38), 0 20px 54px oklch(0 0 0 / 0.28);

  --mode-accent: var(--amber);
  --mode-accent-soft: var(--amber-soft);

  --font-display: 'Bricolage Grotesque', 'Noto Sans SC', 'Microsoft YaHei', sans-serif;
  --font-mono: 'IBM Plex Mono', 'Cascadia Code', Consolas, monospace;

  --topbar-height: 60px;
  --mobile-topbar-height: 58px;
  --mobile-nav-height: 72px;
  --tablet-rail-width: 72px;
  --touch-target: 44px;
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-right: env(safe-area-inset-right, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --safe-left: env(safe-area-inset-left, 0px);
}

body[data-app-mode='chat'] {
  --mode-accent: var(--amber);
  --mode-accent-soft: var(--amber-soft);
}

body[data-app-mode='image'] {
  --mode-accent: var(--magenta);
  --mode-accent-soft: var(--magenta-soft);
}

body[data-app-mode='video'] {
  --mode-accent: var(--cyan);
  --mode-accent-soft: var(--cyan-soft);
}

body[data-app-mode='works'] {
  --mode-accent: var(--lime);
  --mode-accent-soft: var(--lime-soft);
}

* {
  box-sizing: border-box;
}

html {
  min-width: 0;
  min-height: 100%;
  background: var(--canvas);
  color-scheme: dark;
  scroll-behavior: smooth;
}

body {
  position: relative;
  min-width: 0;
  min-height: 100vh;
  margin: 0;
  overflow-x: hidden;
  background: var(--canvas);
  color: var(--text);
  font-family: var(--font-display);
  font-size: 14px;
  line-height: 1.5;
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
}

html[data-theme='light'] {
  color-scheme: light;
  --canvas: oklch(0.97 0.008 85);
  --rail: oklch(0.94 0.01 85);
  --panel: oklch(0.99 0.004 85);
  --panel-2: oklch(0.95 0.008 85);
  --panel-3: oklch(0.91 0.01 85);
  --inset: oklch(0.93 0.008 85);
  --line: oklch(0.2 0.02 85 / 0.12);
  --line-strong: oklch(0.2 0.02 85 / 0.22);
  --text: oklch(0.22 0.018 85);
  --text-dim: oklch(0.34 0.018 85);
  --muted: oklch(0.5 0.018 85);
  --surface-shadow: 0 10px 30px oklch(0.35 0.02 85 / 0.08);
}

@media (prefers-color-scheme: light) {
html[data-theme='system'] {
    color-scheme: light;
    --canvas: oklch(0.97 0.008 85);
    --rail: oklch(0.94 0.01 85);
    --panel: oklch(0.99 0.004 85);
    --panel-2: oklch(0.95 0.008 85);
    --panel-3: oklch(0.91 0.01 85);
    --inset: oklch(0.93 0.008 85);
    --line: oklch(0.2 0.02 85 / 0.12);
    --line-strong: oklch(0.2 0.02 85 / 0.22);
    --text: oklch(0.22 0.018 85);
    --text-dim: oklch(0.34 0.018 85);
    --muted: oklch(0.5 0.018 85);
    --surface-shadow: 0 10px 30px oklch(0.35 0.02 85 / 0.08);
  }
}

html[data-theme='dark'], html[data-theme='system'] { --surface-shadow: var(--shadow-1); }

html[data-density='compact'] {
  --touch-target: 44px;
}

html.reduce-motion *,
html.reduce-motion *::before,
html.reduce-motion *::after {
  animation-duration: 1ms !important;
  animation-iteration-count: 1 !important;
  scroll-behavior: auto !important;
  transition-duration: 1ms !important;
}

body.overlay-open {
  overflow: hidden;
  overscroll-behavior: none;
}

body::before {
  position: fixed;
  z-index: 0;
  inset: 0;
  background:
    radial-gradient(680px 460px at 16% -10%, oklch(0.8 0.13 68 / 0.06), transparent 62%),
    radial-gradient(780px 520px at 94% -14%, oklch(0.76 0.15 340 / 0.05), transparent 62%),
    radial-gradient(640px 500px at 68% 110%, oklch(0.77 0.095 190 / 0.045), transparent 62%);
  content: '';
  pointer-events: none;
}

.app-shell {
  position: relative;
  z-index: 1;
}

::selection {
  background: oklch(0.8 0.13 68 / 0.3);
}

::-webkit-scrollbar {
  width: 10px;
  height: 10px;
}

::-webkit-scrollbar-thumb {
  border: 3px solid transparent;
  border-radius: 999px;
  background: var(--line-strong);
  background-clip: content-box;
}

::-webkit-scrollbar-track {
  background: transparent;
}

* {
  scrollbar-width: thin;
  scrollbar-color: var(--line-strong) transparent;
}

button,
input,
textarea,
select {
  border: 0;
  border-radius: var(--radius-sm);
  font: inherit;
}

button {
  color: inherit;
  cursor: pointer;
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.5;
}

:focus-visible {
  outline: 2px solid oklch(0.8 0.13 68 / 0.5);
  outline-offset: 2px;
}

textarea,
input,
select {
  width: 100%;
  min-height: 40px;
  padding: 9px 12px;
  border: 1px solid var(--line-strong);
  background: var(--inset);
  color: var(--text);
  transition: border-color 160ms ease, background-color 160ms ease, box-shadow 160ms ease;
}

textarea {
  min-height: 100px;
  resize: vertical;
  line-height: 1.6;
}

textarea::placeholder,
input::placeholder {
  color: var(--muted);
  opacity: 0.85;
}

textarea:hover,
input:hover,
select:hover {
  border-color: oklch(1 0 0 / 0.2);
}

textarea:focus,
input:focus,
select:focus {
  border-color: var(--mode-accent);
  background: var(--panel);
  box-shadow: 0 0 0 3px var(--mode-accent-soft);
  outline: 0;
}

select {
  appearance: none;
  padding-right: 36px;
  background-image: linear-gradient(45deg, transparent 50%, var(--muted) 50%), linear-gradient(135deg, var(--muted) 50%, transparent 50%);
  background-position: calc(100% - 16px) 17px, calc(100% - 11px) 17px;
  background-repeat: no-repeat;
  background-size: 5px 5px, 5px 5px;
}

img,
video {
  max-width: 100%;
}

.is-hidden,
[hidden] {
  display: none !important;
}

svg.lucide,
svg[data-lucide] {
  display: inline-block;
  flex: 0 0 auto;
  stroke-width: 1.8;
}

.mono {
  font-family: var(--font-mono);
}

.desktop-only {
  display: inline-flex;
}

.mobile-only {
  display: none !important;
}

.app-shell {
  display: grid;
  grid-template-columns: 236px minmax(0, 1fr);
  min-height: 100dvh;
  background: var(--canvas);
}

.sidebar {
  position: sticky;
  top: 0;
  z-index: 50;
  display: flex;
  width: 236px;
  height: 100dvh;
  flex-direction: column;
  padding: 18px 14px 14px;
  overflow: hidden;
  border-right: 1px solid var(--line);
  background: var(--rail);
}

.brand-lockup {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 2px 2px 20px;
}

.brand-main {
  display: flex;
  min-width: 0;
  align-items: center;
  gap: 11px;
}

.brand-mark {
  display: block;
  width: 42px;
  height: 42px;
  flex: 0 0 auto;
  padding: 2px;
  border: 1px solid var(--brand-tile-line);
  border-radius: 11px;
  background: var(--brand-tile);
  object-fit: contain;
  box-shadow: 0 5px 16px oklch(0 0 0 / 0.24);
}

.brand-copy {
  display: grid;
  min-width: 0;
  gap: 1px;
}

.brand-name {
  overflow: hidden;
  color: var(--text);
  font-size: 14px;
  font-weight: 700;
  letter-spacing: 0;
  line-height: 1.2;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.brand-subtitle {
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: 8.5px;
  letter-spacing: 0.04em;
}

.icon-button {
  display: inline-grid;
  width: 34px;
  height: 34px;
  flex: 0 0 auto;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--panel);
  color: var(--text-dim);
  transition: transform 160ms ease, border-color 160ms ease, background-color 160ms ease, color 160ms ease;
}

.icon-button:hover {
  border-color: var(--line-strong);
  background: var(--panel-2);
  color: var(--text);
  transform: translateY(-1px);
}

.icon-button:active,
.text-button:active,
.primary-action:active,
.send-button:active,
.tool-button:active {
  transform: scale(0.96);
}

.icon-button.small {
  width: 30px;
  height: 30px;
}

.icon-button.is-active {
  border-color: var(--mode-accent);
  background: var(--mode-accent-soft);
  color: var(--mode-accent);
}

.icon-button svg {
  width: 16px;
  height: 16px;
}

.workspace-switcher {
  display: flex;
  min-height: 36px;
  align-items: center;
  gap: 9px;
  margin: 0 2px 22px;
  padding: 0 10px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: oklch(1 0 0 / 0.03);
  color: var(--text-dim);
  font-family: var(--font-mono);
  font-size: 10px;
}

.workspace-switcher svg {
  width: 13px;
  height: 13px;
  margin-left: auto;
  color: var(--muted);
}

.status-light {
  display: inline-block;
  width: 7px;
  height: 7px;
  flex: 0 0 auto;
  border-radius: 50%;
  background: var(--muted);
}

.status-light.is-live {
  background: var(--cyan);
  box-shadow: 0 0 0 3px oklch(0.77 0.095 190 / 0.14), 0 0 12px oklch(0.77 0.095 190 / 0.45);
}

.primary-nav {
  display: grid;
  gap: 3px;
}

.nav-label {
  margin: 2px 10px 8px;
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: 9px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.nav-item {
  position: relative;
  display: grid;
  grid-template-columns: 20px minmax(0, 1fr) auto;
  min-height: 40px;
  align-items: center;
  gap: 10px;
  padding: 0 11px;
  border: 0;
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--muted);
  text-align: left;
  transition: background-color 160ms ease, color 160ms ease, transform 160ms ease;
}

.nav-item:hover {
  background: oklch(1 0 0 / 0.04);
  color: var(--text-dim);
  transform: translateX(2px);
}

.nav-item.is-active {
  background: var(--panel-2);
  color: var(--text);
}

.nav-item.is-active > svg {
  color: var(--mode-accent);
}

.nav-item.is-active::before {
  position: absolute;
  top: 50%;
  left: -14px;
  width: 3px;
  height: 18px;
  border-radius: 999px;
  background: var(--mode-accent);
  content: '';
  transform: translateY(-50%);
}

.nav-item > svg {
  width: 17px;
  height: 17px;
}

.nav-item > span:not(.nav-count) {
  min-width: 0;
  overflow: hidden;
  font-size: 13px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.nav-count {
  display: grid;
  min-width: 20px;
  height: 20px;
  place-items: center;
  border-radius: var(--radius-pill);
  background: var(--panel-3);
  color: var(--text-dim);
  font-family: var(--font-mono);
  font-size: 9px;
}

.nav-item.is-active .nav-count {
  background: var(--mode-accent);
  color: var(--inset);
}

.sidebar-spacer {
  flex: 1;
}

.sidebar-foot {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  margin-top: 16px;
  padding: 12px 4px 0;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: 8.5px;
  letter-spacing: 0.04em;
}

.workbench {
  min-width: 0;
  background: transparent;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 40;
  display: flex;
  min-height: 60px;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 0 clamp(20px, 3vw, 44px);
  border-bottom: 1px solid var(--line);
  background: color-mix(in oklch, var(--canvas) 88%, transparent);
  backdrop-filter: blur(16px);
}

.topbar-context,
.topbar-actions {
  display: flex;
  min-width: 0;
  align-items: center;
  gap: 10px;
}

.topbar-context {
  overflow: hidden;
}

.topbar-brand-mark {
  display: none;
  width: 34px;
  height: 34px;
  flex: 0 0 34px;
  padding: 1px;
  border: 1px solid var(--brand-tile-line);
  border-radius: 9px;
  background: var(--brand-tile);
  object-fit: contain;
  box-shadow: 0 4px 14px oklch(0 0 0 / 0.2);
}

.eyebrow,
.breadcrumb-separator {
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: 9px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.breadcrumb-current {
  overflow: hidden;
  color: var(--text-dim);
  font-size: 12px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.api-status {
  appearance: none;
  display: inline-flex;
  min-height: 28px;
  align-items: center;
  gap: 8px;
  padding: 0 10px;
  border: 1px solid var(--line);
  border-radius: var(--radius-pill);
  background: var(--panel);
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: 9.5px;
  text-align: left;
  white-space: nowrap;
  cursor: pointer;
  transition: border-color 160ms ease, background-color 160ms ease, color 160ms ease;
}

.api-status:hover,
.api-status:focus-visible {
  border-color: var(--cyan);
  background: var(--cyan-soft);
  color: var(--text);
}

.api-status.is-connected {
  border-color: oklch(0.77 0.095 190 / 0.4);
  color: var(--cyan);
}

.api-status.is-error {
  border-color: color-mix(in oklch, var(--danger) 56%, transparent);
  color: var(--danger);
}

.api-status-copy {
  display: inline-flex;
  min-width: 0;
  align-items: center;
  gap: 4px;
  overflow: hidden;
}

.api-status-copy > span {
  overflow: hidden;
  text-overflow: ellipsis;
}

.content-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 300px;
  min-height: calc(100dvh - 60px);
  transition: grid-template-columns 240ms ease;
}

.content-grid.inspector-collapsed {
  grid-template-columns: minmax(0, 1fr) 0;
}

.studio-column {
  min-width: 0;
  padding: 30px clamp(20px, 3.2vw, 48px) 12px;
}

.mode-panel {
  max-width: 1420px;
  margin: 0 auto;
  animation: panel-in 280ms ease-out both;
}

@keyframes panel-in {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.mode-heading {
  display: flex;
  min-height: 76px;
  align-items: flex-end;
  justify-content: space-between;
  gap: 22px;
  margin-bottom: 24px;
}

.section-kicker {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.signal-line {
  display: inline-block;
  width: 22px;
  height: 2px;
  border-radius: 2px;
  background: var(--mode-accent);
}

.signal-line.is-cyan {
  background: var(--cyan);
}

.signal-line.is-lime {
  background: var(--lime);
}

.mode-heading h1 {
  max-width: 760px;
  margin: 8px 0 0;
  color: var(--text);
  font-size: clamp(27px, 2.7vw, 37px);
  font-weight: 600;
  letter-spacing: -0.03em;
  line-height: 1.08;
}

.surface-frame {
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel);
  box-shadow: var(--shadow-1);
}

.surface-toolbar {
  display: flex;
  min-height: 50px;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 0 16px;
  border-bottom: 1px solid var(--line);
  background: oklch(1 0 0 / 0.03);
}

.surface-toolbar-title {
  display: flex;
  min-width: 0;
  align-items: center;
  gap: 9px;
  overflow: hidden;
  color: var(--text-dim);
  font-size: 13px;
  font-weight: 500;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.surface-index {
  color: var(--muted);
  font-size: 9.5px;
  letter-spacing: 0.06em;
  white-space: nowrap;
}

.live-pulse {
  display: inline-block;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--cyan);
  box-shadow: 0 0 0 4px oklch(0.77 0.095 190 / 0.13);
}

.toolbar-actions,
.output-actions,
.video-monitor-actions {
  display: flex;
  align-items: center;
  gap: 6px;
}

.text-button,
.tool-button {
  display: inline-flex;
  min-height: 32px;
  align-items: center;
  gap: 7px;
  padding: 0 8px;
  border: 0;
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--muted);
  font-size: 11.5px;
  transition: background-color 160ms ease, color 160ms ease, transform 160ms ease;
}

.text-button:hover,
.tool-button:hover {
  background: var(--panel-2);
  color: var(--text);
}

.text-button svg,
.tool-button svg {
  width: 14px;
  height: 14px;
}

.danger-button {
  color: var(--danger);
}

.danger-button:hover {
  background: var(--danger-soft);
  color: var(--danger);
}
