:root {
  color-scheme: dark;
  --ink: #0b0c0e;
  --carbon: #141619;
  --carbon-raised: #181b1f;
  --slate: #202328;
  --slate-light: #2b2f35;
  --paper: #f4efe6;
  --paper-muted: #d8d1c6;
  --ash: #a9adb4;
  --ash-dim: #70757d;
  --signal: #ff6b45;
  --signal-strong: #ff805f;
  --lime: #b9ef72;
  --amber: #f2bd64;
  --danger: #ff756f;
  --line: rgb(244 239 230 / 0.11);
  --line-strong: rgb(244 239 230 / 0.19);
  --shadow-deep: 0 26px 70px rgb(0 0 0 / 0.42);
  --radius-panel: 16px;
  --radius-control: 12px;
  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
  background: var(--ink);
}

* {
  box-sizing: border-box;
}

html {
  min-width: 320px;
  background: var(--ink);
  -webkit-text-size-adjust: 100%;
}

body {
  min-height: 100vh;
  min-height: 100dvh;
  margin: 0;
  overflow-x: hidden;
  color: var(--paper);
  background:
    radial-gradient(circle at 88% -12%, rgb(255 107 69 / 0.12), transparent 32rem),
    var(--ink);
  accent-color: var(--signal);
}

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

button,
select,
summary,
label[for] {
  -webkit-tap-highlight-color: transparent;
}

button {
  color: inherit;
}

button:focus-visible,
input:focus-visible,
textarea:focus-visible,
select:focus-visible,
summary:focus-visible {
  outline: 3px solid rgb(255 107 69 / 0.42);
  outline-offset: 2px;
}

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

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

::-webkit-scrollbar-track {
  background: var(--ink);
}

::-webkit-scrollbar-thumb {
  border: 3px solid var(--ink);
  border-radius: 999px;
  background: var(--slate-light);
}

[hidden] {
  display: none !important;
}

.symbol-library {
  position: absolute;
  width: 0;
  height: 0;
  overflow: hidden;
}

svg {
  width: 1.25rem;
  height: 1.25rem;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

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

.brand-lockup {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.brand-lockup > div {
  display: grid;
  gap: 0.12rem;
}

.brand-lockup strong {
  font-size: 1rem;
  letter-spacing: -0.02em;
}

.brand-lockup span:not(.brand-mark) {
  color: var(--ash-dim);
  font-size: 0.63rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.brand-lockup--large {
  gap: 1rem;
}

.brand-lockup--large strong {
  font-size: 1.3rem;
}

.brand-mark {
  position: relative;
  display: inline-block;
  width: 2rem;
  height: 2rem;
  flex: 0 0 auto;
}

.brand-mark span {
  position: absolute;
  width: 1.35rem;
  height: 1.35rem;
  border-radius: 0.35rem;
}

.brand-mark span:first-child {
  top: 0;
  left: 0;
  background: var(--paper);
}

.brand-mark span:last-child {
  right: 0;
  bottom: 0;
  background: var(--signal);
  box-shadow: 0 7px 20px rgb(255 107 69 / 0.28);
}

.login-screen {
  display: grid;
  min-height: 100vh;
  min-height: 100dvh;
  grid-template-columns: minmax(0, 0.95fr) minmax(22rem, 1.05fr);
  overflow: hidden;
}

.login-panel {
  display: flex;
  min-width: 0;
  padding: clamp(2rem, 6vw, 6.5rem);
  flex-direction: column;
  justify-content: space-between;
  background: var(--ink);
}

.login-copy {
  width: min(100%, 34rem);
  margin: auto 0 2.5rem;
  padding-top: 4rem;
}

.login-copy h1 {
  max-width: 10ch;
  margin: 0;
  font-size: clamp(2.8rem, 6vw, 5.4rem);
  font-weight: 650;
  letter-spacing: -0.04em;
  line-height: 0.98;
  text-wrap: balance;
}

.login-copy p {
  max-width: 32rem;
  margin: 1.6rem 0 0;
  color: var(--ash);
  font-size: 1rem;
  line-height: 1.7;
}

.login-form {
  width: min(100%, 34rem);
  margin-bottom: auto;
}

.login-form > label,
.field-group label,
.settings-grid label > span {
  display: block;
  margin-bottom: 0.58rem;
  color: var(--paper-muted);
  font-size: 0.82rem;
  font-weight: 650;
}

.password-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 0.65rem;
}

input,
textarea,
select {
  width: 100%;
  color: var(--paper);
  border: 1px solid var(--line);
  border-radius: var(--radius-control);
  background: var(--slate);
  transition: border-color 160ms ease, background 160ms ease, box-shadow 160ms ease;
}

input,
select {
  min-height: 3.15rem;
  padding: 0 0.95rem;
}

textarea {
  display: block;
  min-height: 8rem;
  padding: 0.95rem 1rem;
  resize: vertical;
  line-height: 1.6;
}

input::placeholder,
textarea::placeholder {
  color: #858a92;
}

input:hover,
textarea:hover,
select:hover {
  border-color: var(--line-strong);
}

input:focus,
textarea:focus,
select:focus {
  border-color: rgb(255 107 69 / 0.7);
  background: #24272d;
  box-shadow: 0 0 0 4px rgb(255 107 69 / 0.09);
  outline: none;
}

.primary-button,
.secondary-button,
.text-button,
.icon-button,
.send-button,
.mode-button,
.nav-button,
.suggestion-row button,
.prompt-suggestions button,
.clear-upload {
  border: 0;
  cursor: pointer;
}

.primary-button {
  display: inline-flex;
  min-height: 3.25rem;
  padding: 0 1.2rem;
  align-items: center;
  justify-content: center;
  gap: 0.7rem;
  color: #1a0c08;
  border-radius: var(--radius-control);
  background: var(--signal);
  box-shadow: 0 10px 25px rgb(255 107 69 / 0.18);
  font-weight: 760;
  transition: background 160ms ease, transform 160ms var(--ease-out), box-shadow 160ms ease;
}

.primary-button:hover {
  background: var(--signal-strong);
  box-shadow: 0 14px 34px rgb(255 107 69 / 0.24);
  transform: translateY(-1px);
}

.primary-button:active {
  transform: translateY(1px);
}

.primary-button:disabled {
  color: #77716d;
  cursor: wait;
  background: #3b3938;
  box-shadow: none;
  transform: none;
}

.primary-button--compact {
  min-width: 5.5rem;
}

.primary-button--wide {
  width: 100%;
  margin-top: 0.2rem;
}

.primary-button--wide svg {
  width: 1.05rem;
  height: 1.05rem;
}

.form-error {
  margin: 0.7rem 0 0;
  color: var(--danger);
  font-size: 0.82rem;
}

.login-footnote {
  display: flex;
  margin-top: 2.5rem;
  align-items: center;
  gap: 0.55rem;
  color: var(--ash-dim);
  font-size: 0.75rem;
}

.status-dot {
  width: 0.46rem;
  height: 0.46rem;
  flex: 0 0 auto;
  border-radius: 50%;
  background: var(--lime);
  box-shadow: 0 0 0 4px rgb(185 239 114 / 0.08);
}

.login-art {
  position: relative;
  display: grid;
  min-height: 100%;
  overflow: hidden;
  place-items: center;
  color: var(--ink);
  background: var(--paper);
}

.login-art::before,
.login-art::after {
  position: absolute;
  content: "";
  border-radius: 50%;
}

.login-art::before {
  width: min(52vw, 42rem);
  height: min(52vw, 42rem);
  border: 1px solid rgb(11 12 14 / 0.13);
}

.login-art::after {
  width: min(32vw, 26rem);
  height: min(32vw, 26rem);
  border: 1px solid rgb(11 12 14 / 0.18);
}

.login-art > p {
  position: absolute;
  right: clamp(1.5rem, 4vw, 4rem);
  bottom: clamp(1.5rem, 4vw, 4rem);
  z-index: 2;
  margin: 0;
  font-size: clamp(2.6rem, 6vw, 6rem);
  font-weight: 850;
  letter-spacing: -0.04em;
  line-height: 0.78;
  text-align: right;
}

.aperture {
  position: relative;
  z-index: 1;
  width: min(21vw, 14rem);
  aspect-ratio: 1;
  transform: rotate(12deg);
}

.aperture span {
  position: absolute;
  width: 64%;
  height: 64%;
  border-radius: 23%;
  background: var(--ink);
  box-shadow: var(--shadow-deep);
}

.aperture span:nth-child(1) { top: 0; left: 0; }
.aperture span:nth-child(2) { top: 0; right: 0; background: var(--signal); }
.aperture span:nth-child(3) { right: 0; bottom: 0; }
.aperture span:nth-child(4) { bottom: 0; left: 0; background: #d9d1c5; }

.app-shell {
  min-height: 100vh;
  min-height: 100dvh;
  background: var(--ink);
}

.desktop-rail {
  position: fixed;
  inset: 0 auto 0 0;
  z-index: 20;
  display: flex;
  width: 5.5rem;
  padding: 1.25rem 0.7rem;
  flex-direction: column;
  align-items: center;
  border-right: 1px solid var(--line);
  background: #0d0f11;
}

.rail-brand {
  display: grid;
  width: 3rem;
  height: 3rem;
  padding: 0;
  cursor: default;
  border: 0;
  background: transparent;
  place-items: center;
}

.rail-brand .brand-mark {
  transform: scale(0.76);
}

.rail-nav {
  display: grid;
  width: 100%;
  gap: 0.5rem;
  margin-top: 4rem;
}

.nav-button {
  display: flex;
  min-height: 3.5rem;
  padding: 0.45rem;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.3rem;
  color: var(--ash-dim);
  border-radius: 11px;
  background: transparent;
  font-size: 0.66rem;
  font-weight: 680;
  transition: color 150ms ease, background 150ms ease;
}

.nav-button svg {
  width: 1.2rem;
  height: 1.2rem;
}

.nav-button:hover {
  color: var(--paper);
  background: var(--carbon);
}

.nav-button.is-active {
  color: var(--signal);
  background: rgb(255 107 69 / 0.09);
}

.rail-logout {
  width: 100%;
  margin-top: auto;
}

.workspace {
  min-height: 100vh;
  min-height: 100dvh;
  margin-left: 5.5rem;
}

.topbar {
  display: flex;
  height: 4.6rem;
  padding: 0 clamp(1.5rem, 4vw, 3rem);
  align-items: center;
  justify-content: flex-end;
  border-bottom: 1px solid var(--line);
}

.topbar-brand {
  display: none;
}

.topbar-status {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  color: var(--ash);
  font-size: 0.75rem;
}

.app-view {
  min-height: calc(100dvh - 4.6rem);
  padding: clamp(1.5rem, 4vw, 3.2rem);
}

.app-view.is-entering {
  animation: view-in 360ms var(--ease-out) both;
}

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

.view-heading {
  display: flex;
  max-width: 84rem;
  margin: 0 auto 1.8rem;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
}

.view-heading h1 {
  margin: 0;
  font-size: clamp(2rem, 4vw, 3.2rem);
  font-weight: 680;
  letter-spacing: -0.035em;
  line-height: 1;
}

.view-heading p {
  margin: 0.65rem 0 0;
  color: var(--ash);
  font-size: 0.86rem;
}

.heading-actions {
  display: flex;
  align-items: center;
  gap: 0.55rem;
}

.select-control {
  position: relative;
  display: block;
}

.select-control select {
  padding-right: 2.8rem;
  appearance: none;
}

.select-control svg {
  position: absolute;
  top: 50%;
  right: 0.9rem;
  width: 1rem;
  height: 1rem;
  color: var(--ash-dim);
  pointer-events: none;
  transform: translateY(-50%);
}

.select-control--compact select {
  min-width: 10.5rem;
  min-height: 2.75rem;
  padding-left: 0.8rem;
  font-size: 0.82rem;
}

.icon-button {
  display: grid;
  width: 2.75rem;
  height: 2.75rem;
  padding: 0;
  color: var(--ash);
  border: 1px solid var(--line);
  border-radius: var(--radius-control);
  background: var(--carbon);
  place-items: center;
  transition: color 150ms ease, border-color 150ms ease, transform 150ms ease;
}

.icon-button:hover {
  color: var(--paper);
  border-color: var(--line-strong);
  transform: rotate(-10deg);
}

.chat-stage {
  display: grid;
  width: min(100%, 60rem);
  min-height: calc(100dvh - 10.8rem);
  margin: 0 auto;
  grid-template-rows: minmax(0, 1fr) auto;
}

.chat-messages {
  display: flex;
  min-height: 0;
  padding: 1rem 0 2rem;
  flex-direction: column;
  gap: 1.15rem;
  overflow-y: auto;
  scroll-behavior: smooth;
}

.chat-empty {
  display: grid;
  max-width: 30rem;
  margin: auto;
  padding: 3rem 1rem;
  justify-items: center;
  text-align: center;
}

.empty-orbit {
  position: relative;
  width: 5rem;
  height: 5rem;
  margin-bottom: 1.5rem;
  border: 1px solid var(--line-strong);
  border-radius: 50%;
}

.empty-orbit::before {
  position: absolute;
  inset: 0.75rem;
  content: "";
  border: 1px solid var(--line);
  border-radius: 50%;
}

.empty-orbit span:first-child {
  position: absolute;
  top: -0.25rem;
  left: 50%;
  width: 0.6rem;
  height: 0.6rem;
  border-radius: 50%;
  background: var(--signal);
  box-shadow: 0 0 18px rgb(255 107 69 / 0.5);
  transform: translateX(-50%);
}

.empty-orbit span:last-child {
  position: absolute;
  right: 0.4rem;
  bottom: 0.5rem;
  width: 0.42rem;
  height: 0.42rem;
  border-radius: 50%;
  background: var(--lime);
}

.chat-empty h2 {
  margin: 0;
  font-size: 1.55rem;
  letter-spacing: -0.025em;
}

.chat-empty p {
  margin: 0.7rem 0 1.4rem;
  color: var(--ash);
  line-height: 1.6;
}

.suggestion-row,
.prompt-suggestions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.suggestion-row {
  justify-content: center;
}

.suggestion-row button,
.prompt-suggestions button {
  min-height: 2.3rem;
  padding: 0 0.8rem;
  color: var(--paper-muted);
  border: 1px solid var(--line);
  border-radius: 999px;
  background: transparent;
  font-size: 0.75rem;
  transition: color 150ms ease, border-color 150ms ease, background 150ms ease;
}

.suggestion-row button:hover,
.prompt-suggestions button:hover {
  color: var(--paper);
  border-color: rgb(255 107 69 / 0.35);
  background: rgb(255 107 69 / 0.07);
}

.chat-message {
  display: grid;
  max-width: min(82%, 46rem);
  gap: 0.45rem;
  animation: message-in 280ms var(--ease-out) both;
}

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

.chat-message--user {
  align-self: flex-end;
}

.chat-message--assistant {
  align-self: flex-start;
}

.message-label {
  color: var(--ash-dim);
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.07em;
  text-transform: uppercase;
}

.chat-message--user .message-label {
  text-align: right;
}

.message-bubble {
  padding: 0.9rem 1rem;
  border: 1px solid var(--line);
  border-radius: 14px;
  color: var(--paper-muted);
  background: var(--carbon);
  line-height: 1.65;
  white-space: pre-wrap;
}

.chat-message--user .message-bubble {
  color: #21100b;
  border-color: transparent;
  background: var(--signal);
}

.chat-message.is-loading .message-bubble {
  min-width: 4.5rem;
  color: var(--ash);
}

.typing-dots {
  display: inline-flex;
  gap: 0.3rem;
}

.typing-dots span {
  width: 0.38rem;
  height: 0.38rem;
  border-radius: 50%;
  background: currentColor;
  animation: typing 1s ease-in-out infinite;
}

.typing-dots span:nth-child(2) { animation-delay: 120ms; }
.typing-dots span:nth-child(3) { animation-delay: 240ms; }

@keyframes typing {
  0%, 100% { opacity: 0.28; transform: translateY(0); }
  50% { opacity: 1; transform: translateY(-3px); }
}

.chat-composer {
  display: grid;
  padding: 0.55rem;
  grid-template-columns: 1fr auto;
  align-items: end;
  gap: 0.55rem;
  border: 1px solid var(--line-strong);
  border-radius: 16px;
  background: var(--carbon-raised);
  box-shadow: 0 18px 55px rgb(0 0 0 / 0.25);
}

.chat-composer textarea {
  min-height: 2.75rem;
  max-height: 11rem;
  padding: 0.7rem 0.8rem;
  border: 0;
  background: transparent;
  resize: none;
  box-shadow: none;
}

.chat-composer textarea:focus {
  background: transparent;
  box-shadow: none;
}

.send-button {
  display: grid;
  width: 2.75rem;
  height: 2.75rem;
  padding: 0;
  color: #1a0c08;
  border-radius: 11px;
  background: var(--signal);
  place-items: center;
  transition: background 150ms ease, transform 150ms var(--ease-out);
}

.send-button:hover {
  background: var(--signal-strong);
  transform: translateY(-1px);
}

.send-button:disabled {
  color: #807974;
  cursor: wait;
  background: #3b3938;
  transform: none;
}

.mode-switcher {
  display: grid;
  width: min(100%, 84rem);
  margin: 0 auto 1.15rem;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 0.5rem;
}

.mode-button {
  position: relative;
  display: flex;
  min-height: 3.3rem;
  padding: 0 1rem;
  align-items: center;
  justify-content: center;
  gap: 0.55rem;
  color: var(--ash);
  border: 1px solid var(--line);
  border-radius: var(--radius-control);
  background: var(--carbon);
  font-size: 0.8rem;
  font-weight: 680;
  transition: color 150ms ease, border-color 150ms ease, background 150ms ease, transform 150ms var(--ease-out);
}

.mode-button:hover {
  color: var(--paper);
  border-color: var(--line-strong);
  transform: translateY(-1px);
}

.mode-button.is-active {
  color: var(--paper);
  border-color: rgb(255 107 69 / 0.42);
  background: rgb(255 107 69 / 0.1);
}

.mode-button.is-active svg {
  color: var(--signal);
}

.mode-button em {
  padding: 0.18rem 0.4rem;
  color: #21170a;
  border-radius: 999px;
  background: var(--amber);
  font-size: 0.56rem;
  font-style: normal;
  letter-spacing: 0.04em;
}

.create-layout {
  display: grid;
  width: min(100%, 84rem);
  min-height: calc(100dvh - 14.7rem);
  margin: 0 auto;
  grid-template-columns: minmax(19rem, 25rem) minmax(0, 1fr);
  gap: 1.15rem;
}

.control-panel {
  display: flex;
  padding: 1.2rem;
  flex-direction: column;
  gap: 1.15rem;
  border: 1px solid var(--line);
  border-radius: var(--radius-panel);
  background: var(--carbon);
}

.field-group {
  min-width: 0;
}

.field-group--grow {
  flex: 1;
}

.field-heading {
  display: flex;
  margin-bottom: 0.58rem;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.field-heading label {
  margin: 0;
}

.field-heading span {
  color: var(--ash-dim);
  font-size: 0.68rem;
}

.model-path {
  margin: 0.45rem 0 0;
  overflow: hidden;
  color: var(--ash-dim);
  font-family: ui-monospace, SFMono-Regular, Consolas, monospace;
  font-size: 0.63rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.upload-zone {
  position: relative;
  display: flex;
  min-height: 7.2rem;
  margin: 0;
  padding: 1rem;
  align-items: center;
  gap: 0.85rem;
  overflow: hidden;
  cursor: pointer;
  border: 1px dashed var(--line-strong);
  border-radius: var(--radius-control);
  background: #111315;
  transition: border-color 150ms ease, background 150ms ease;
}

.upload-zone:hover,
.upload-zone.is-dragging {
  border-color: rgb(255 107 69 / 0.62);
  background: rgb(255 107 69 / 0.05);
}

.upload-zone input {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
}

.upload-icon {
  display: grid;
  width: 2.7rem;
  height: 2.7rem;
  flex: 0 0 auto;
  color: var(--signal);
  border-radius: 10px;
  background: rgb(255 107 69 / 0.1);
  place-items: center;
}

.upload-copy {
  display: grid;
  gap: 0.25rem;
}

.upload-copy strong {
  color: var(--paper-muted);
  font-size: 0.82rem;
}

.upload-copy small {
  color: var(--ash-dim);
  font-size: 0.69rem;
}

.upload-zone.has-image {
  min-height: 10rem;
  padding: 0;
  border-style: solid;
}

.upload-zone.has-image .upload-icon,
.upload-zone.has-image .upload-copy {
  display: none;
}

.upload-zone img {
  width: 100%;
  height: 10rem;
  object-fit: cover;
}

.clear-upload {
  position: absolute;
  top: 0.6rem;
  right: 0.6rem;
  display: grid;
  width: 2.2rem;
  height: 2.2rem;
  padding: 0;
  color: var(--paper);
  border-radius: 50%;
  background: rgb(11 12 14 / 0.82);
  place-items: center;
}

.clear-upload svg {
  width: 1rem;
  height: 1rem;
}

.prompt-suggestions {
  margin-top: 0.65rem;
}

.advanced-settings {
  border-top: 1px solid var(--line);
}

.advanced-settings summary {
  display: flex;
  min-height: 2.8rem;
  align-items: center;
  justify-content: space-between;
  color: var(--paper-muted);
  cursor: pointer;
  font-size: 0.78rem;
  font-weight: 650;
  list-style: none;
}

.advanced-settings summary::-webkit-details-marker {
  display: none;
}

.advanced-settings summary svg {
  width: 1rem;
  height: 1rem;
  color: var(--ash-dim);
  transition: transform 180ms var(--ease-out);
}

.advanced-settings[open] summary svg {
  transform: rotate(180deg);
}

.settings-grid {
  display: grid;
  padding-top: 0.35rem;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.75rem;
}

.settings-grid label {
  min-width: 0;
}

.settings-grid select {
  min-height: 2.8rem;
  font-size: 0.78rem;
}

.result-stage {
  display: grid;
  min-width: 0;
  overflow: hidden;
  grid-template-rows: auto minmax(24rem, 1fr) auto;
  border: 1px solid var(--line);
  border-radius: var(--radius-panel);
  background: #101214;
}

.result-header {
  display: flex;
  min-height: 5rem;
  padding: 1rem 1.2rem;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--line);
}

.result-header > div:first-child {
  display: grid;
  gap: 0.18rem;
}

.result-header span:first-child {
  color: var(--ash-dim);
  font-family: ui-monospace, SFMono-Regular, Consolas, monospace;
  font-size: 0.6rem;
  font-weight: 700;
  letter-spacing: 0.1em;
}

.result-header h2 {
  margin: 0;
  font-size: 1rem;
  letter-spacing: -0.015em;
}

.result-meta {
  display: flex;
  align-items: center;
  gap: 0.38rem;
  color: var(--ash);
  font-family: ui-monospace, SFMono-Regular, Consolas, monospace;
  font-size: 0.7rem;
}

.result-meta svg {
  width: 0.95rem;
  height: 0.95rem;
}

.result-canvas {
  position: relative;
  display: grid;
  min-height: 0;
  overflow: hidden;
  background:
    linear-gradient(rgb(244 239 230 / 0.025) 1px, transparent 1px),
    linear-gradient(90deg, rgb(244 239 230 / 0.025) 1px, transparent 1px),
    #0d0f11;
  background-size: 3rem 3rem;
  place-items: center;
}

.result-canvas::after {
  position: absolute;
  inset: 0;
  content: "";
  pointer-events: none;
  box-shadow: inset 0 0 70px rgb(0 0 0 / 0.28);
}

.result-empty {
  position: relative;
  display: grid;
  width: min(72%, 25rem);
  aspect-ratio: 4 / 3;
  color: var(--ash-dim);
  place-items: center;
}

.result-empty > svg {
  width: 2rem;
  height: 2rem;
  margin-bottom: -4rem;
  color: var(--signal);
}

.result-empty p {
  margin: 0;
  align-self: end;
  font-size: 0.78rem;
}

.frame-corners {
  position: absolute;
  inset: 0;
  border: 1px solid var(--line);
}

.frame-corners::before,
.frame-corners::after {
  position: absolute;
  width: 2.2rem;
  height: 2.2rem;
  content: "";
}

.frame-corners::before {
  top: -1px;
  left: -1px;
  border-top: 2px solid var(--paper-muted);
  border-left: 2px solid var(--paper-muted);
}

.frame-corners::after {
  right: -1px;
  bottom: -1px;
  border-right: 2px solid var(--paper-muted);
  border-bottom: 2px solid var(--paper-muted);
}

.result-progress {
  position: absolute;
  inset: 0;
  z-index: 2;
  display: grid;
  overflow: hidden;
  background: #101214;
  place-items: center;
}

.progress-scan {
  position: absolute;
  inset: -30% 0 auto;
  height: 38%;
  background: linear-gradient(180deg, transparent, rgb(255 107 69 / 0.11), transparent);
  animation: scan 2.4s var(--ease-out) infinite;
}

@keyframes scan {
  from { transform: translateY(-20%); }
  to { transform: translateY(410%); }
}

.progress-copy {
  position: relative;
  z-index: 1;
  max-width: 27rem;
  padding: 2rem;
  text-align: center;
}

.progress-copy > span {
  color: var(--signal);
  font-size: 0.7rem;
  font-weight: 760;
  letter-spacing: 0.09em;
  text-transform: uppercase;
}

.progress-copy strong {
  display: block;
  margin-top: 0.75rem;
  font-size: 1.5rem;
  letter-spacing: -0.025em;
}

.progress-copy p {
  margin: 0.65rem 0 0;
  color: var(--ash);
  font-size: 0.8rem;
  line-height: 1.6;
}

.result-error {
  z-index: 3;
  display: flex;
  width: min(86%, 34rem);
  padding: 1.1rem;
  align-items: flex-start;
  gap: 0.85rem;
  border: 1px solid rgb(255 117 111 / 0.26);
  border-radius: 14px;
  background: rgb(255 117 111 / 0.07);
}

.error-mark {
  display: grid;
  width: 1.7rem;
  height: 1.7rem;
  flex: 0 0 auto;
  color: var(--ink);
  border-radius: 50%;
  background: var(--danger);
  font-weight: 850;
  place-items: center;
}

.result-error strong {
  color: var(--danger);
  font-size: 0.84rem;
}

.result-error p {
  margin: 0.3rem 0 0;
  color: var(--paper-muted);
  font-size: 0.75rem;
  line-height: 1.55;
  word-break: break-word;
}

.result-image,
.result-video {
  z-index: 1;
  display: block;
  width: 100%;
  height: 100%;
  max-height: calc(100dvh - 18rem);
  object-fit: contain;
  background: #08090a;
  animation: result-reveal 650ms var(--ease-out) both;
}

@keyframes result-reveal {
  from { opacity: 0; filter: blur(14px); clip-path: inset(10% 6%); }
  to { opacity: 1; filter: blur(0); clip-path: inset(0); }
}

.result-actions {
  display: flex;
  min-height: 4.6rem;
  padding: 0.75rem 1.1rem;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  border-top: 1px solid var(--line);
}

.secondary-button {
  display: inline-flex;
  min-height: 2.8rem;
  padding: 0 1rem;
  align-items: center;
  gap: 0.5rem;
  color: var(--paper);
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-control);
  background: var(--slate);
  font-size: 0.78rem;
  font-weight: 680;
}

.secondary-button:hover {
  border-color: rgb(255 107 69 / 0.42);
}

.secondary-button svg {
  width: 1rem;
  height: 1rem;
}

.text-button {
  padding: 0.5rem;
  color: var(--ash);
  background: transparent;
  font-size: 0.75rem;
  text-decoration: underline;
  text-decoration-color: transparent;
  text-underline-offset: 0.25rem;
}

.text-button:hover {
  color: var(--paper);
  text-decoration-color: var(--ash-dim);
}

.mobile-nav {
  display: none;
}

.toast-region {
  position: fixed;
  right: 1rem;
  bottom: 1rem;
  z-index: 100;
  display: grid;
  gap: 0.5rem;
  pointer-events: none;
}

.toast {
  max-width: min(24rem, calc(100vw - 2rem));
  padding: 0.78rem 0.9rem;
  color: var(--paper-muted);
  border: 1px solid var(--line-strong);
  border-radius: 12px;
  background: #202328;
  box-shadow: var(--shadow-deep);
  font-size: 0.78rem;
  animation: toast-in 260ms var(--ease-out) both;
}

.toast--error {
  color: #ffd0ce;
  border-color: rgb(255 117 111 / 0.36);
  background: #321c1d;
}

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

@media (max-width: 900px) {
  .login-screen {
    grid-template-columns: 1fr;
  }

  .login-panel {
    min-height: 100dvh;
    padding: max(1.5rem, env(safe-area-inset-top)) 1.25rem max(1.5rem, env(safe-area-inset-bottom));
  }

  .login-copy {
    padding-top: 3rem;
  }

  .login-copy h1 {
    max-width: 9ch;
    font-size: clamp(2.7rem, 14vw, 4.8rem);
  }

  .login-art {
    display: none;
  }

  .desktop-rail {
    display: none;
  }

  .workspace {
    margin-left: 0;
    padding-bottom: calc(4.8rem + env(safe-area-inset-bottom));
  }

  .topbar {
    position: sticky;
    top: 0;
    z-index: 15;
    height: auto;
    min-height: 4.2rem;
    padding: max(0.75rem, env(safe-area-inset-top)) 1rem 0.75rem;
    justify-content: space-between;
    background: rgb(11 12 14 / 0.94);
  }

  .topbar-brand {
    display: flex;
  }

  .topbar-brand .brand-mark {
    transform: scale(0.72);
    transform-origin: left center;
  }

  .app-view {
    min-height: calc(100dvh - 9rem);
    padding: 1.25rem 1rem;
  }

  .view-heading {
    margin-bottom: 1.2rem;
  }

  .view-heading h1 {
    font-size: 2.15rem;
  }

  .view-heading p {
    font-size: 0.78rem;
  }

  .chat-stage {
    min-height: calc(100dvh - 12rem);
  }

  .chat-messages {
    padding-top: 0;
  }

  .chat-empty {
    padding: 2rem 0.5rem;
  }

  .chat-message {
    max-width: 90%;
  }

  .chat-composer {
    position: sticky;
    bottom: calc(5.2rem + env(safe-area-inset-bottom));
    z-index: 8;
  }

  .mode-switcher {
    display: flex;
    margin: 0 -1rem 1rem;
    padding: 0 1rem 0.25rem;
    gap: 0.45rem;
    overflow-x: auto;
    scrollbar-width: none;
  }

  .mode-switcher::-webkit-scrollbar {
    display: none;
  }

  .mode-button {
    min-width: max-content;
    min-height: 3rem;
    padding: 0 0.85rem;
  }

  .create-layout {
    min-height: 0;
    grid-template-columns: 1fr;
  }

  .control-panel {
    padding: 1rem;
  }

  .result-stage {
    grid-template-rows: auto minmax(22rem, 68dvh) auto;
  }

  .result-image,
  .result-video {
    max-height: 68dvh;
  }

  .mobile-nav {
    position: fixed;
    inset: auto 0 0;
    z-index: 30;
    display: grid;
    min-height: calc(4.6rem + env(safe-area-inset-bottom));
    padding: 0.45rem 1rem max(0.45rem, env(safe-area-inset-bottom));
    grid-template-columns: repeat(3, 1fr);
    border-top: 1px solid var(--line-strong);
    background: #101214;
  }

  .mobile-nav .nav-button {
    min-height: 3.3rem;
  }

  .toast-region {
    right: 0.75rem;
    bottom: calc(5.5rem + env(safe-area-inset-bottom));
  }
}

@media (max-width: 560px) {
  .password-row {
    grid-template-columns: 1fr;
  }

  .primary-button--compact {
    width: 100%;
  }

  .view-heading {
    align-items: flex-end;
  }

  .view-heading--create {
    display: block;
  }

  .heading-actions {
    gap: 0.4rem;
  }

  .select-control--compact select {
    min-width: 7.7rem;
    max-width: 9rem;
  }

  .settings-grid {
    grid-template-columns: 1fr;
  }

  .result-stage {
    grid-template-rows: auto minmax(19rem, 58dvh) auto;
  }

  .result-actions {
    align-items: stretch;
    flex-direction: column;
  }

  .secondary-button,
  .text-button {
    justify-content: center;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}
