:root {
  --bg: #eceae5;
  --panel: rgba(249, 247, 242, 0.92);
  --panel-solid: #f8f6f1;
  --sidebar: #f3f1ec;
  --surface: #ffffff;
  --surface-muted: #eeece7;
  --surface-hover: #e8e5df;
  --ink: #171714;
  --muted: #74716a;
  --muted-strong: #4f4c46;
  --line: rgba(23, 23, 20, 0.1);
  --line-strong: rgba(23, 23, 20, 0.18);
  --accent: #d9ff72;
  --accent-soft: #edffc0;
  --accent-ink: #1b2510;
  --danger: #b83f38;
  --shadow-sm: 0 1px 2px rgba(25, 22, 17, 0.04), 0 8px 24px rgba(25, 22, 17, 0.04);
  --shadow-lg: 0 24px 70px rgba(30, 25, 18, 0.14), 0 2px 10px rgba(30, 25, 18, 0.06);
  --radius-sm: 10px;
  --radius-md: 16px;
  --radius-lg: 24px;
  --sidebar-width: 252px;
  --composer-width: min(920px, calc(100vw - var(--sidebar-width) - 64px));
  font-family: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  color: var(--ink);
  background: var(--bg);
  font-synthesis: none;
  text-rendering: optimizeLegibility;
}

:root[data-theme="dark"] {
  --bg: #171714;
  --panel: rgba(29, 29, 26, 0.94);
  --panel-solid: #1d1d1a;
  --sidebar: #20201d;
  --surface: #292925;
  --surface-muted: #252521;
  --surface-hover: #30302b;
  --ink: #f5f3ee;
  --muted: #aaa69e;
  --muted-strong: #d1cdc5;
  --line: rgba(255, 255, 255, 0.09);
  --line-strong: rgba(255, 255, 255, 0.16);
  --accent: #d9ff72;
  --accent-soft: #34421b;
  --accent-ink: #152006;
  --danger: #ff8c84;
  --shadow-sm: 0 8px 24px rgba(0, 0, 0, 0.14);
  --shadow-lg: 0 30px 90px rgba(0, 0, 0, 0.38);
}

* {
  box-sizing: border-box;
}

html,
body {
  min-height: 100%;
  margin: 0;
}

body {
  min-width: 320px;
  overflow: hidden;
  background:
    radial-gradient(circle at 70% -10%, rgba(255, 255, 255, 0.75), transparent 32%),
    var(--bg);
}

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

button,
select {
  cursor: pointer;
}

button {
  color: inherit;
}

button:focus-visible,
textarea:focus-visible,
input:focus-visible,
select:focus-visible,
a:focus-visible {
  outline: 2px solid var(--ink);
  outline-offset: 3px;
}

svg {
  display: block;
  stroke: currentColor;
  stroke-width: 1.7;
  stroke-linecap: round;
  stroke-linejoin: round;
}

[hidden] {
  display: none !important;
}

.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;
}

.ambient {
  position: fixed;
  z-index: 0;
  pointer-events: none;
  filter: blur(80px);
  opacity: 0.38;
}

.ambient-one {
  top: 12%;
  left: 34%;
  width: 300px;
  height: 300px;
  background: rgba(217, 255, 114, 0.24);
}

.ambient-two {
  right: 2%;
  bottom: 4%;
  width: 260px;
  height: 260px;
  background: rgba(221, 198, 255, 0.2);
}

.app-shell {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-columns: var(--sidebar-width) minmax(0, 1fr);
  height: 100dvh;
  margin: 0;
  overflow: hidden;
  background: var(--panel);
  backdrop-filter: blur(24px);
}

.sidebar {
  position: relative;
  z-index: 20;
  display: flex;
  flex-direction: column;
  min-width: 0;
  padding: 20px 16px 16px;
  overflow: hidden;
  background: color-mix(in srgb, var(--sidebar) 94%, transparent);
  border-right: 1px solid var(--line);
}

.sidebar-head,
.topbar,
.topbar-left,
.topbar-actions,
.brand,
.new-session,
.sidebar-section-head,
.edge-card,
.reference-link,
.status-pill,
.composer-main,
.composer-toolbar,
.select-wrap,
.advanced-toggle,
.generate-button,
.field-label-row,
.dialog-head,
.settings-note,
.remember-token,
.dialog-actions,
.result-card-meta,
.result-actions,
.history-item-top {
  display: flex;
  align-items: center;
}

.sidebar-head {
  justify-content: space-between;
  min-height: 42px;
  margin-bottom: 23px;
}

.brand {
  gap: 11px;
  color: var(--ink);
  text-decoration: none;
}

.brand-mark {
  display: grid;
  width: 38px;
  height: 38px;
  place-items: center;
  color: #f8f6ef;
  background: #151512;
  border-radius: 12px;
  box-shadow: 0 7px 17px rgba(0, 0, 0, 0.13);
}

.brand-mark svg {
  width: 21px;
  height: 21px;
}

.brand strong,
.brand small {
  display: block;
}

.brand strong {
  font-size: 15px;
  font-weight: 750;
  letter-spacing: -0.02em;
}

.brand small {
  margin-top: 2px;
  color: var(--muted);
  font-size: 8px;
  font-weight: 700;
  letter-spacing: 0.18em;
}

.icon-button {
  display: grid;
  width: 38px;
  height: 38px;
  padding: 0;
  place-items: center;
  color: var(--muted-strong);
  background: color-mix(in srgb, var(--surface) 72%, transparent);
  border: 1px solid var(--line);
  border-radius: 12px;
  transition: 180ms ease;
}

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

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

.sidebar-close,
.menu-button {
  display: none;
}

.new-session {
  width: 100%;
  min-height: 46px;
  gap: 10px;
  padding: 0 13px;
  color: #f8f7f2;
  background: #151512;
  border: 0;
  border-radius: 13px;
  box-shadow: 0 9px 22px rgba(0, 0, 0, 0.13);
  transition: 180ms ease;
}

.new-session:hover {
  transform: translateY(-1px);
  box-shadow: 0 13px 30px rgba(0, 0, 0, 0.17);
}

.new-session svg {
  width: 17px;
  height: 17px;
}

.new-session span {
  flex: 1;
  text-align: left;
  font-size: 13px;
  font-weight: 650;
}

.new-session kbd {
  padding: 3px 5px;
  color: rgba(255, 255, 255, 0.58);
  font-family: inherit;
  font-size: 9px;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 5px;
}

.sidebar-section-head {
  justify-content: space-between;
  margin: 29px 6px 12px;
  color: var(--muted);
  font-size: 10px;
  font-weight: 750;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.sidebar-section-head button {
  padding: 4px;
  color: var(--muted);
  font-size: 11px;
  background: none;
  border: 0;
  opacity: 0;
  transition: 160ms ease;
}

.sidebar:hover .sidebar-section-head button,
.sidebar-section-head button:focus-visible {
  opacity: 1;
}

.sidebar-section-head button:hover {
  color: var(--danger);
}

.history-list {
  min-height: 0;
  margin: 0 -5px;
  padding: 0 5px 18px;
  overflow: auto;
  scrollbar-width: thin;
  scrollbar-color: var(--line-strong) transparent;
}

.history-empty {
  display: grid;
  min-height: 154px;
  padding: 24px;
  place-items: center;
  align-content: center;
  color: var(--muted);
  text-align: center;
  background: color-mix(in srgb, var(--surface) 34%, transparent);
  border: 1px dashed var(--line-strong);
  border-radius: 14px;
}

.history-empty-icon {
  display: grid;
  width: 38px;
  height: 38px;
  margin-bottom: 10px;
  place-items: center;
  color: var(--muted);
  background: var(--surface-muted);
  border-radius: 11px;
}

.history-empty-icon svg {
  width: 19px;
  height: 19px;
}

.history-empty p {
  max-width: 126px;
  margin: 0;
  font-size: 11px;
  line-height: 1.6;
}

.history-item {
  position: relative;
  display: block;
  width: 100%;
  margin-bottom: 5px;
  padding: 12px 12px 12px 14px;
  text-align: left;
  background: transparent;
  border: 0;
  border-radius: 11px;
  transition: 150ms ease;
}

.history-item::before {
  position: absolute;
  top: 11px;
  bottom: 11px;
  left: 0;
  width: 2px;
  background: var(--ink);
  border-radius: 2px;
  content: "";
  opacity: 0;
  transform: scaleY(0.5);
  transition: 150ms ease;
}

.history-item:hover,
.history-item.is-active {
  background: var(--surface-muted);
}

.history-item.is-active::before {
  opacity: 1;
  transform: scaleY(1);
}

.history-item-top {
  gap: 8px;
  justify-content: space-between;
}

.history-title {
  min-width: 0;
  overflow: hidden;
  color: var(--ink);
  font-size: 12px;
  font-weight: 640;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.history-model {
  flex: 0 0 auto;
  padding: 2px 5px;
  color: var(--muted);
  font-size: 8px;
  font-weight: 750;
  background: color-mix(in srgb, var(--surface) 60%, transparent);
  border: 1px solid var(--line);
  border-radius: 5px;
}

.history-date {
  display: block;
  margin-top: 6px;
  color: var(--muted);
  font-size: 10px;
}

.sidebar-foot {
  margin-top: auto;
  padding-top: 13px;
  border-top: 1px solid var(--line);
}

.edge-card {
  gap: 10px;
  padding: 11px;
  background: color-mix(in srgb, var(--accent-soft) 55%, var(--surface));
  border: 1px solid color-mix(in srgb, var(--accent) 45%, var(--line));
  border-radius: 12px;
}

.edge-icon {
  display: grid;
  width: 31px;
  height: 31px;
  flex: 0 0 auto;
  place-items: center;
  color: var(--accent-ink);
  background: var(--accent);
  border-radius: 9px;
}

.edge-icon svg {
  width: 17px;
  height: 17px;
}

.edge-card strong,
.edge-card small {
  display: block;
}

.edge-card strong {
  font-size: 10px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.edge-card small {
  margin-top: 3px;
  color: var(--muted);
  font-size: 9px;
}

.sidebar-scrim {
  display: none;
}

.main-panel {
  position: relative;
  display: grid;
  grid-template-rows: 76px minmax(0, 1fr) auto 32px;
  min-width: 0;
  height: 100dvh;
  overflow: hidden;
  background: color-mix(in srgb, var(--panel-solid) 90%, transparent);
}

.topbar {
  position: relative;
  z-index: 6;
  justify-content: space-between;
  padding: 0 26px 0 30px;
  border-bottom: 1px solid var(--line);
}

.topbar-left {
  gap: 13px;
}

.eyebrow,
.empty-kicker,
.result-label,
.dialog-kicker,
.loading-label {
  color: var(--muted);
  font-size: 8px;
  font-weight: 780;
  letter-spacing: 0.18em;
}

.topbar h1 {
  max-width: 55vw;
  margin: 4px 0 0;
  overflow: hidden;
  font-size: 14px;
  font-weight: 680;
  letter-spacing: -0.02em;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.topbar-actions {
  gap: 8px;
}

.status-pill {
  gap: 7px;
  height: 34px;
  padding: 0 12px;
  color: var(--muted-strong);
  font-size: 10px;
  font-weight: 650;
  background: color-mix(in srgb, var(--surface) 72%, transparent);
  border: 1px solid var(--line);
  border-radius: 999px;
  transition: 150ms ease;
}

.status-pill:hover {
  color: var(--ink);
  border-color: var(--line-strong);
}

.status-dot {
  width: 7px;
  height: 7px;
  background: #82b819;
  border: 2px solid color-mix(in srgb, #82b819 23%, transparent);
  border-radius: 50%;
  box-shadow: 0 0 0 3px color-mix(in srgb, #82b819 14%, transparent);
}

.status-pill.is-direct .status-dot {
  background: #578bd5;
  box-shadow: 0 0 0 3px rgba(87, 139, 213, 0.14);
}

.status-pill.is-error .status-dot {
  background: #c85a51;
  box-shadow: 0 0 0 3px rgba(200, 90, 81, 0.14);
}

.moon-icon {
  display: none;
}

[data-theme="dark"] .sun-icon {
  display: none;
}

[data-theme="dark"] .moon-icon {
  display: block;
}

.canvas {
  position: relative;
  min-height: 0;
  overflow: auto;
  overscroll-behavior: contain;
  scrollbar-width: thin;
  scrollbar-color: var(--line-strong) transparent;
}

.empty-state {
  display: flex;
  min-height: 100%;
  padding: 28px 24px 54px;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  text-align: center;
}

.empty-visual {
  position: relative;
  width: 210px;
  height: 172px;
  margin-bottom: 21px;
}

.empty-orbit {
  position: absolute;
  border: 1px solid var(--line);
  border-radius: 50%;
  transform: rotate(-15deg);
}

.orbit-one {
  inset: 16px 8px 9px;
}

.orbit-two {
  inset: 30px -13px 20px;
  transform: rotate(18deg);
}

.visual-card {
  position: absolute;
  width: 102px;
  height: 124px;
  overflow: hidden;
  border: 1px solid var(--line-strong);
  border-radius: 20px;
  box-shadow: var(--shadow-lg);
}

.visual-card-back {
  top: 31px;
  left: 36px;
  background:
    linear-gradient(145deg, rgba(224, 190, 255, 0.65), transparent 55%),
    linear-gradient(30deg, #d9ff72, #f4f0e8 56%);
  transform: rotate(-12deg);
}

.visual-card-back span {
  position: absolute;
  right: -20px;
  bottom: -12px;
  width: 80px;
  height: 80px;
  background: rgba(255, 255, 255, 0.55);
  border-radius: 50%;
}

.visual-card-front {
  top: 13px;
  right: 35px;
  display: grid;
  place-items: center;
  color: var(--ink);
  background: color-mix(in srgb, var(--surface) 96%, transparent);
  transform: rotate(7deg);
}

.visual-card-front::after {
  position: absolute;
  inset: 7px;
  border: 1px dashed var(--line-strong);
  border-radius: 14px;
  content: "";
}

.visual-card-front svg {
  width: 61px;
  height: 61px;
  stroke-width: 1.3;
}

.spark {
  position: absolute;
  color: var(--ink);
  font-size: 17px;
}

.spark-one {
  top: 14px;
  left: 17px;
}

.spark-two {
  right: 10px;
  bottom: 30px;
  color: #8cae2f;
  font-size: 12px;
}

.empty-state h2 {
  margin: 10px 0 13px;
  font-family: Georgia, "Songti SC", "STSong", serif;
  font-size: clamp(27px, 3.1vw, 40px);
  font-weight: 500;
  line-height: 1.18;
  letter-spacing: -0.05em;
}

.empty-state > p {
  max-width: 480px;
  margin: 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.7;
}

.prompt-suggestions {
  display: flex;
  gap: 8px;
  margin-top: 20px;
  flex-wrap: wrap;
  justify-content: center;
}

.prompt-suggestions button {
  padding: 7px 11px;
  color: var(--muted-strong);
  font-size: 10px;
  background: color-mix(in srgb, var(--surface) 65%, transparent);
  border: 1px solid var(--line);
  border-radius: 999px;
  transition: 150ms ease;
}

.prompt-suggestions button:hover {
  color: var(--ink);
  background: var(--surface);
  border-color: var(--line-strong);
  transform: translateY(-1px);
}

.loading-state {
  display: flex;
  min-height: 100%;
  padding: 40px;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  text-align: center;
}

.loading-art {
  position: relative;
  width: min(310px, 68vw);
  aspect-ratio: 1.2;
  overflow: hidden;
  background:
    radial-gradient(circle at 26% 25%, rgba(217, 255, 114, 0.9), transparent 25%),
    radial-gradient(circle at 75% 36%, rgba(217, 191, 255, 0.75), transparent 32%),
    linear-gradient(145deg, var(--surface-muted), var(--surface));
  border: 1px solid var(--line);
  border-radius: 28px;
  box-shadow: var(--shadow-lg);
}

.loading-art > span {
  position: absolute;
  background: color-mix(in srgb, var(--surface) 60%, transparent);
  border: 1px solid color-mix(in srgb, var(--surface) 80%, transparent);
  border-radius: 50%;
  animation: float 3s ease-in-out infinite;
}

.loading-art > span:nth-child(1) {
  top: 22%;
  left: 15%;
  width: 70px;
  height: 70px;
}

.loading-art > span:nth-child(2) {
  right: 15%;
  bottom: 17%;
  width: 110px;
  height: 110px;
  animation-delay: -0.8s;
}

.loading-art > span:nth-child(3) {
  top: 25%;
  right: 25%;
  width: 34px;
  height: 34px;
  animation-delay: -1.5s;
}

.loading-scan {
  position: absolute;
  right: 0;
  left: 0;
  height: 2px;
  background: linear-gradient(90deg, transparent, var(--accent), transparent);
  box-shadow: 0 0 18px var(--accent);
  animation: scan 2.2s ease-in-out infinite;
}

.loading-copy {
  margin-top: 25px;
}

.loading-copy h2 {
  margin: 8px 0 7px;
  font-family: Georgia, "Songti SC", serif;
  font-size: 25px;
  font-weight: 500;
}

.loading-copy p {
  margin: 0;
  color: var(--muted);
  font-size: 11px;
}

.loading-progress {
  width: 210px;
  height: 3px;
  margin: 18px auto 0;
  overflow: hidden;
  background: var(--surface-muted);
  border-radius: 3px;
}

.loading-progress span {
  display: block;
  width: 45%;
  height: 100%;
  background: var(--ink);
  border-radius: inherit;
  animation: progress 1.5s ease-in-out infinite;
}

.results-view {
  max-width: 1180px;
  min-height: 100%;
  margin: 0 auto;
  padding: 35px 36px 58px;
}

.results-head {
  display: flex;
  gap: 20px;
  align-items: flex-end;
  justify-content: space-between;
  margin-bottom: 18px;
}

.results-head h2 {
  max-width: 680px;
  margin: 7px 0 0;
  overflow: hidden;
  font-family: Georgia, "Songti SC", serif;
  font-size: clamp(22px, 2.2vw, 31px);
  font-weight: 500;
  line-height: 1.2;
  letter-spacing: -0.04em;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.result-meta {
  display: flex;
  gap: 7px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.meta-chip {
  padding: 6px 9px;
  color: var(--muted-strong);
  font-size: 9px;
  font-weight: 650;
  background: var(--surface-muted);
  border: 1px solid var(--line);
  border-radius: 999px;
}

.result-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
}

.result-grid.is-single {
  grid-template-columns: minmax(0, 760px);
  justify-content: center;
}

.result-card {
  position: relative;
  margin: 0;
  overflow: hidden;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 18px;
  box-shadow: var(--shadow-sm);
}

.result-image-button {
  display: block;
  width: 100%;
  padding: 0;
  background: var(--surface-muted);
  border: 0;
}

.result-card img {
  display: block;
  width: 100%;
  max-height: 72vh;
  object-fit: contain;
  background:
    linear-gradient(45deg, var(--surface-muted) 25%, transparent 25%) 0 0 / 16px 16px,
    linear-gradient(-45deg, var(--surface-muted) 25%, transparent 25%) 0 0 / 16px 16px,
    var(--surface);
}

.result-card figcaption {
  padding: 10px 11px;
}

.missing-result {
  display: flex;
  min-height: 280px;
  padding: 40px;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  text-align: center;
}

.missing-result > span {
  display: grid;
  width: 44px;
  height: 44px;
  margin-bottom: 13px;
  place-items: center;
  color: var(--accent-ink);
  background: var(--accent);
  border-radius: 14px;
}

.missing-result strong {
  font-family: Georgia, "Songti SC", serif;
  font-size: 17px;
  font-weight: 500;
}

.missing-result p {
  max-width: 320px;
  margin: 8px 0 0;
  color: var(--muted);
  font-size: 10px;
  line-height: 1.6;
}

.result-card.has-image-error .result-image-button {
  min-height: 260px;
  background: repeating-linear-gradient(-45deg, var(--surface-muted), var(--surface-muted) 10px, var(--surface) 10px, var(--surface) 20px);
}

.result-card-meta {
  justify-content: space-between;
  gap: 10px;
}

.image-index {
  color: var(--muted);
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.12em;
}

.result-actions {
  gap: 5px;
}

.result-action {
  display: grid;
  width: 30px;
  height: 30px;
  padding: 0;
  place-items: center;
  color: var(--muted-strong);
  background: var(--surface-muted);
  border: 1px solid var(--line);
  border-radius: 8px;
  transition: 150ms ease;
}

.result-action:hover {
  color: var(--ink);
  background: var(--surface-hover);
}

.result-action svg {
  width: 14px;
  height: 14px;
}

.composer {
  position: relative;
  z-index: 7;
  width: var(--composer-width);
  margin: 0 auto;
  padding: 9px;
  background: color-mix(in srgb, var(--surface) 96%, transparent);
  border: 1px solid var(--line-strong);
  border-radius: 19px;
  box-shadow: var(--shadow-lg);
  backdrop-filter: blur(24px);
}

.composer:focus-within {
  border-color: color-mix(in srgb, var(--ink) 28%, transparent);
}

.composer-main {
  position: relative;
  min-height: 52px;
  gap: 10px;
  padding: 6px 10px 6px 9px;
}

.prompt-icon {
  display: grid;
  width: 31px;
  height: 31px;
  flex: 0 0 auto;
  place-items: center;
  color: var(--ink);
  background: var(--accent);
  border-radius: 10px;
}

.prompt-icon svg {
  width: 17px;
  height: 17px;
}

.composer-main textarea {
  width: 100%;
  max-height: 128px;
  min-height: 31px;
  padding: 6px 54px 5px 0;
  resize: none;
  overflow-y: auto;
  color: var(--ink);
  font-size: 16px;
  line-height: 1.55;
  background: transparent;
  border: 0;
  outline: 0;
}

.composer-main textarea::placeholder,
.advanced-field textarea::placeholder,
.advanced-field input::placeholder,
.settings-field input::placeholder {
  color: color-mix(in srgb, var(--muted) 70%, transparent);
}

.char-count {
  position: absolute;
  right: 10px;
  bottom: 13px;
  color: var(--muted);
  font-size: 10px;
}

.composer-toolbar {
  gap: 6px;
  padding: 8px 8px 0;
  border-top: 1px solid var(--line);
}

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

.control-group > label {
  display: none;
}

.select-wrap {
  position: relative;
  min-width: 94px;
  height: 35px;
  gap: 5px;
  color: var(--muted-strong);
  background: var(--surface-muted);
  border: 1px solid transparent;
  border-radius: 9px;
  transition: 150ms ease;
}

.select-wrap:hover {
  color: var(--ink);
  background: var(--surface-hover);
}

.select-wrap select {
  width: 100%;
  height: 100%;
  padding: 0 27px 0 11px;
  color: currentColor;
  font-size: 13px;
  font-weight: 650;
  appearance: none;
  background: transparent;
  border: 0;
  outline: 0;
}

.select-wrap > svg:not(.leading-icon) {
  position: absolute;
  right: 8px;
  width: 13px;
  height: 13px;
  pointer-events: none;
}

.select-wrap .leading-icon {
  width: 14px;
  height: 14px;
  margin-left: 9px;
  flex: 0 0 auto;
  pointer-events: none;
}

.select-wrap .leading-icon + select {
  margin-left: -4px;
  padding-left: 0;
}

.model-select-wrap {
  min-width: 126px;
}

.model-swatch {
  width: 7px;
  height: 7px;
  margin-left: 10px;
  flex: 0 0 auto;
  background: #94bc37;
  border-radius: 50%;
  box-shadow: 0 0 0 3px color-mix(in srgb, #94bc37 16%, transparent);
}

.model-swatch[data-model="wai"] {
  background: #ba7ee3;
  box-shadow: 0 0 0 3px rgba(186, 126, 227, 0.15);
}

.model-swatch[data-model="Pony-3"] {
  background: #ec8cac;
  box-shadow: 0 0 0 3px rgba(236, 140, 172, 0.15);
}

.model-swatch[data-model="R-1.5"] {
  background: #6f9ed8;
  box-shadow: 0 0 0 3px rgba(111, 158, 216, 0.15);
}

.model-swatch[data-model="Turbo-3.5"] {
  background: #e89f4f;
  box-shadow: 0 0 0 3px rgba(232, 159, 79, 0.15);
}

.model-select-wrap select {
  margin-left: -3px;
  padding-left: 0;
}

.advanced-toggle {
  min-width: 68px;
  height: 35px;
  gap: 6px;
  justify-content: center;
  padding: 0 10px;
  color: var(--muted-strong);
  font-size: 13px;
  font-weight: 650;
  background: var(--surface-muted);
  border: 1px solid transparent;
  border-radius: 9px;
  transition: 150ms ease;
}

.advanced-toggle:hover,
.advanced-toggle[aria-expanded="true"] {
  color: var(--ink);
  background: var(--surface-hover);
}

.advanced-toggle svg {
  width: 14px;
  height: 14px;
}

.generate-button {
  min-width: 128px;
  height: 37px;
  gap: 16px;
  justify-content: center;
  margin-left: auto;
  padding: 0 14px;
  color: #f8f6f0;
  font-size: 13px;
  font-weight: 700;
  background: #171714;
  border: 0;
  border-radius: 10px;
  box-shadow: 0 8px 18px rgba(0, 0, 0, 0.12);
  transition: 170ms ease;
}

.generate-button:hover {
  transform: translateY(-1px);
  box-shadow: 0 11px 25px rgba(0, 0, 0, 0.17);
}

.generate-button:disabled {
  cursor: wait;
  opacity: 0.6;
  transform: none;
}

.generate-button svg {
  width: 15px;
  height: 15px;
}

.advanced-panel {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 180px;
  gap: 10px;
  margin: 10px 8px 5px;
  padding-top: 12px;
  border-top: 1px solid var(--line);
  animation: panel-in 170ms ease both;
}

.advanced-field {
  padding: 10px 11px;
  background: var(--surface-muted);
  border: 1px solid var(--line);
  border-radius: 11px;
}

.field-label-row {
  justify-content: space-between;
  margin-bottom: 6px;
}

.field-label-row label {
  color: var(--muted-strong);
  font-size: 9px;
  font-weight: 700;
}

.field-label-row span,
.field-label-row button {
  color: var(--muted);
  font-size: 8px;
}

.field-label-row button {
  padding: 2px 0;
  background: none;
  border: 0;
}

.field-label-row button:hover {
  color: var(--ink);
}

.advanced-field textarea,
.advanced-field input {
  width: 100%;
  color: var(--ink);
  font-size: 10px;
  line-height: 1.5;
  background: transparent;
  border: 0;
  outline: 0;
}

.advanced-field textarea {
  min-height: 36px;
  resize: none;
}

.advanced-field input {
  height: 30px;
  font-variant-numeric: tabular-nums;
}

.workspace-foot {
  display: flex;
  padding: 0 30px;
  align-items: center;
  justify-content: space-between;
  color: var(--muted);
  font-size: 8px;
}

.settings-dialog,
.image-dialog {
  padding: 0;
  background: transparent;
  border: 0;
}

.settings-dialog::backdrop,
.image-dialog::backdrop {
  background: rgba(18, 17, 14, 0.58);
  backdrop-filter: blur(6px);
}

.dialog-card {
  width: min(510px, calc(100vw - 30px));
  max-height: calc(100dvh - 24px);
  margin: 0;
  overflow: auto;
  color: var(--ink);
  background: var(--panel-solid);
  border: 1px solid var(--line-strong);
  border-radius: 22px;
  box-shadow: var(--shadow-lg);
  animation: dialog-in 180ms ease both;
}

.dialog-head {
  justify-content: space-between;
  padding: 21px 22px 17px;
  border-bottom: 1px solid var(--line);
}

.dialog-head h2 {
  margin: 5px 0 0;
  font-family: Georgia, "Songti SC", serif;
  font-size: 22px;
  font-weight: 500;
  letter-spacing: -0.035em;
}

.dialog-body {
  display: grid;
  gap: 17px;
  padding: 20px 22px;
}

.settings-note {
  gap: 10px;
  padding: 12px 13px;
  color: var(--muted-strong);
  background: color-mix(in srgb, var(--accent-soft) 50%, var(--surface));
  border: 1px solid color-mix(in srgb, var(--accent) 38%, var(--line));
  border-radius: 12px;
}

.settings-note svg {
  width: 18px;
  height: 18px;
  flex: 0 0 auto;
  color: #769424;
}

.settings-note p {
  margin: 0;
  font-size: 10px;
  line-height: 1.55;
}

.settings-note code {
  color: var(--ink);
  font-family: "SFMono-Regular", Consolas, monospace;
  font-size: 9px;
}

.settings-field {
  display: grid;
  gap: 7px;
}

.settings-field > span,
.auth-method legend {
  color: var(--muted-strong);
  font-size: 10px;
  font-weight: 700;
}

.settings-field em {
  color: var(--muted);
  font-size: 8px;
  font-style: normal;
  font-weight: 500;
}

.settings-field > input,
.password-wrap {
  width: 100%;
  height: 43px;
  color: var(--ink);
  background: var(--surface);
  border: 1px solid var(--line-strong);
  border-radius: 11px;
  outline: 0;
}

.settings-field > input {
  padding: 0 12px;
  font-size: 11px;
}

.settings-field > input:focus,
.password-wrap:focus-within {
  border-color: var(--ink);
}

.settings-field small {
  color: var(--muted);
  font-size: 8px;
  line-height: 1.5;
}

.password-wrap {
  display: flex;
  align-items: center;
  padding: 0 6px 0 12px;
}

.password-wrap input {
  min-width: 0;
  height: 100%;
  flex: 1;
  color: var(--ink);
  font-family: "SFMono-Regular", Consolas, monospace;
  font-size: 11px;
  background: transparent;
  border: 0;
  outline: 0;
}

.password-wrap button {
  display: grid;
  width: 32px;
  height: 32px;
  padding: 0;
  place-items: center;
  color: var(--muted);
  background: transparent;
  border: 0;
  border-radius: 8px;
}

.password-wrap button:hover {
  color: var(--ink);
  background: var(--surface-muted);
}

.password-wrap svg {
  width: 16px;
  height: 16px;
}

.eye-closed {
  display: none;
}

.password-wrap.is-visible .eye-open {
  display: none;
}

.password-wrap.is-visible .eye-closed {
  display: block;
}

.auth-method {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  margin: 0;
  padding: 0;
  border: 0;
}

.auth-method legend {
  margin-bottom: 8px;
}

.auth-method label {
  position: relative;
  display: block;
  cursor: pointer;
}

.auth-method input {
  position: absolute;
  opacity: 0;
}

.auth-method label > span {
  display: block;
  padding: 11px;
  background: var(--surface);
  border: 1px solid var(--line-strong);
  border-radius: 11px;
  transition: 150ms ease;
}

.auth-method input:checked + span {
  border-color: var(--ink);
  box-shadow: inset 0 0 0 1px var(--ink);
}

.auth-method strong,
.auth-method small {
  display: block;
}

.auth-method strong {
  font-size: 9px;
}

.auth-method small {
  margin-top: 4px;
  overflow: hidden;
  color: var(--muted);
  font-family: "SFMono-Regular", Consolas, monospace;
  font-size: 7px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.remember-token {
  gap: 8px;
  color: var(--muted-strong);
  font-size: 9px;
  cursor: pointer;
}

.remember-token input {
  width: 15px;
  height: 15px;
  accent-color: var(--ink);
}

.dialog-actions {
  gap: 9px;
  justify-content: flex-end;
  padding: 15px 22px 20px;
  border-top: 1px solid var(--line);
}

.secondary-button,
.primary-button {
  height: 38px;
  padding: 0 15px;
  font-size: 10px;
  font-weight: 700;
  border-radius: 10px;
}

.secondary-button {
  color: var(--muted-strong);
  background: var(--surface-muted);
  border: 1px solid var(--line);
}

.primary-button {
  color: #f8f6f0;
  background: #171714;
  border: 1px solid #171714;
}

.image-dialog {
  width: 100vw;
  max-width: none;
  height: 100dvh;
  max-height: none;
  overflow: hidden;
}

.image-dialog[open] {
  display: grid;
  place-items: center;
}

.image-dialog img {
  display: block;
  max-width: calc(100vw - 50px);
  max-height: calc(100dvh - 50px);
  object-fit: contain;
  border-radius: 12px;
  box-shadow: 0 30px 100px rgba(0, 0, 0, 0.45);
}

.lightbox-close {
  position: fixed;
  z-index: 2;
  top: 18px;
  right: 18px;
  display: grid;
  width: 38px;
  height: 38px;
  padding: 0;
  place-items: center;
  color: white;
  background: rgba(0, 0, 0, 0.4);
  border: 1px solid rgba(255, 255, 255, 0.22);
  border-radius: 50%;
  backdrop-filter: blur(12px);
}

.lightbox-close svg {
  width: 18px;
  height: 18px;
}

.toast-region {
  position: fixed;
  z-index: 100;
  right: 18px;
  bottom: 18px;
  display: grid;
  width: min(340px, calc(100vw - 36px));
  gap: 8px;
  pointer-events: none;
}

.toast {
  display: flex;
  gap: 10px;
  padding: 12px 14px;
  align-items: flex-start;
  color: #f7f5ef;
  background: rgba(22, 22, 19, 0.94);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 12px;
  box-shadow: 0 16px 45px rgba(0, 0, 0, 0.22);
  backdrop-filter: blur(14px);
  animation: toast-in 220ms ease both;
  pointer-events: auto;
}

.toast.is-error {
  background: rgba(112, 38, 33, 0.96);
}

.toast-icon {
  display: grid;
  width: 21px;
  height: 21px;
  flex: 0 0 auto;
  place-items: center;
  color: #151512;
  font-size: 11px;
  font-weight: 900;
  background: var(--accent);
  border-radius: 50%;
}

.toast.is-error .toast-icon {
  color: white;
  background: rgba(255, 255, 255, 0.17);
}

.toast p {
  margin: 2px 0 0;
  font-size: 10px;
  line-height: 1.5;
}

@keyframes float {
  0%,
  100% { transform: translateY(0); }
  50% { transform: translateY(-9px); }
}

@keyframes scan {
  0% { top: 8%; opacity: 0; }
  20% { opacity: 1; }
  80% { opacity: 1; }
  100% { top: 92%; opacity: 0; }
}

@keyframes progress {
  0% { transform: translateX(-100%); }
  100% { transform: translateX(330%); }
}

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

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

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

@media (max-width: 980px) {
  :root {
    --sidebar-width: 225px;
  }

  .composer-toolbar {
    flex-wrap: wrap;
  }

  .workspace-foot span:first-child {
    display: none;
  }

  .workspace-foot {
    justify-content: center;
  }
}

@media (max-width: 760px) {
  :root {
    --composer-width: calc(100vw - 24px);
  }

  body {
    overflow: hidden;
  }

  .app-shell {
    display: block;
  }

  .sidebar {
    position: fixed;
    top: 0;
    bottom: 0;
    left: 0;
    width: min(286px, calc(100vw - 46px));
    transform: translateX(-105%);
    transition: transform 220ms ease;
    box-shadow: 20px 0 50px rgba(0, 0, 0, 0.18);
  }

  body.sidebar-open .sidebar {
    transform: translateX(0);
  }

  .sidebar-scrim {
    position: fixed;
    z-index: 15;
    inset: 0;
    display: block;
    visibility: hidden;
    background: rgba(18, 17, 14, 0.4);
    opacity: 0;
    transition: 220ms ease;
    backdrop-filter: blur(2px);
  }

  body.sidebar-open .sidebar-scrim {
    visibility: visible;
    opacity: 1;
  }

  .sidebar-close,
  .menu-button {
    display: grid;
  }

  .main-panel {
    grid-template-rows: 65px minmax(0, 1fr) auto 26px;
  }

  .topbar {
    padding: 0 12px;
  }

  .eyebrow {
    display: none;
  }

  .topbar h1 {
    margin: 0;
    font-size: 13px;
  }

  .status-pill {
    display: none;
  }

  .canvas {
    padding-bottom: 4px;
  }

  .empty-state {
    padding: 20px 18px 38px;
  }

  .empty-visual {
    width: 175px;
    height: 140px;
    margin-bottom: 12px;
    transform: scale(0.88);
  }

  .empty-state h2 {
    font-size: 28px;
  }

  .empty-state > p {
    max-width: 340px;
    font-size: 11px;
  }

  .prompt-suggestions button:last-child {
    display: none;
  }

  .results-view {
    padding: 24px 12px 35px;
  }

  .results-head {
    align-items: flex-start;
    flex-direction: column;
  }

  .results-head h2 {
    max-width: 88vw;
    font-size: 24px;
  }

  .result-meta {
    justify-content: flex-start;
  }

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

  .composer {
    padding: 7px;
    border-radius: 16px;
  }

  .composer-main {
    min-height: 48px;
  }

  .composer-main textarea {
    font-size: 15px;
  }

  .composer-toolbar {
    display: grid;
    grid-template-columns: minmax(0, 1.25fr) minmax(0, 0.85fr) minmax(0, 0.85fr);
    gap: 5px;
    overflow: visible;
  }

  .composer-toolbar .control-group,
  .composer-toolbar .select-wrap {
    width: 100%;
    min-width: 0;
  }

  .model-select-wrap {
    min-width: 0;
  }

  .advanced-toggle {
    grid-column: 1 / 3;
    width: 100%;
    min-width: 0;
  }

  .generate-button {
    grid-column: 3;
    width: 100%;
    min-width: 0;
    gap: 0;
    margin-left: 0;
    padding: 0;
  }

  .generate-button span {
    display: none;
  }

  .advanced-panel {
    grid-template-columns: 1fr;
    max-height: 210px;
    overflow: auto;
  }

  .workspace-foot {
    padding: 0 12px;
  }

  .workspace-foot span:last-child {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .toast-region {
    right: 12px;
    bottom: 12px;
    width: calc(100vw - 24px);
  }
}

@media (max-width: 430px) {
  .topbar-actions .icon-button:first-of-type {
    display: none;
  }

  .prompt-suggestions {
    max-width: 280px;
  }

  .prompt-suggestions button {
    flex: 1;
  }

  .auth-method {
    grid-template-columns: 1fr;
  }
}

@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;
  }
}
