:root {
  --bg: #f4efe7;
  --bg-deep: #e7ddcf;
  --panel: rgba(255, 251, 245, 0.82);
  --panel-strong: rgba(249, 242, 231, 0.94);
  --line: rgba(54, 40, 26, 0.16);
  --ink: #1f1a16;
  --muted: #6c5c4e;
  --accent: #a24b2a;
  --accent-soft: rgba(162, 75, 42, 0.12);
  --shadow: 0 18px 60px rgba(45, 29, 16, 0.12);
  --radius-xl: 30px;
  --radius-lg: 22px;
  --radius-md: 16px;
  --radius-sm: 12px;
  --font-display: "Iowan Old Style", "Palatino Linotype", "Noto Serif SC", serif;
  --font-body: "Microsoft YaHei UI", "PingFang SC", "Segoe UI", sans-serif;
  --shell-max-width: 1680px;
  --sidebar-width: clamp(272px, 19vw, 318px);
  --panel-padding: clamp(12px, 0.95vw, 16px);
  --card-padding: clamp(10px, 0.8vw, 14px);
  --input-height: 40px;
  --composer-textarea-min-height: clamp(94px, 12dvh, 128px);
  --app-shell-padding: clamp(8px, 0.82vw, 12px);
  --app-shell-gap: clamp(8px, 0.82vw, 12px);
  --panel-frame-height: calc(100dvh - (var(--app-shell-padding) * 2));
  --thread-max-height-desktop: clamp(360px, 93dvh, 100dvh);
  --thread-max-height-tablet: clamp(320px, 52dvh, 680px);
  --thread-max-height-mobile: clamp(260px, 48dvh, 520px);
  --control-panel-max-height-tablet: clamp(320px, 48dvh, 680px);
  --control-panel-max-height-mobile: clamp(280px, 42dvh, 520px);
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

html,
body {
  margin: 0;
  min-height: 100dvh;
  min-height: 100%;
  color: var(--ink);
  background:
    radial-gradient(circle at top left, rgba(193, 126, 76, 0.16), transparent 28%),
    radial-gradient(circle at top right, rgba(128, 95, 52, 0.12), transparent 22%),
    linear-gradient(180deg, #f7f3ed 0%, var(--bg) 54%, var(--bg-deep) 100%);
  font-family: var(--font-body);
}

body::before {
  position: fixed;
  inset: 0;
  pointer-events: none;
  content: "";
  opacity: 0.24;
  background-image:
    linear-gradient(rgba(79, 59, 39, 0.03) 1px, transparent 1px),
    linear-gradient(90deg, rgba(79, 59, 39, 0.03) 1px, transparent 1px);
  background-size: 22px 22px;
  mask-image: radial-gradient(circle at center, black 52%, transparent 95%);
}

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

button {
  cursor: pointer;
}

.app-shell {
  display: grid;
  grid-template-columns: minmax(0, var(--sidebar-width)) minmax(0, 1fr);
  gap: var(--app-shell-gap);
  width: min(var(--shell-max-width), calc(100vw - (var(--app-shell-padding) * 2)));
  min-height: 100dvh;
  margin: 0 auto;
  padding: var(--app-shell-padding);
  align-items: stretch;
}

.sidebar,
.main-panel,
.settings-panel {
  backdrop-filter: blur(20px) saturate(120%);
  background:
    linear-gradient(180deg, rgba(255, 252, 247, 0.88) 0%, rgba(247, 239, 229, 0.76) 100%);
  border: 1px solid rgba(255, 255, 255, 0.52);
  box-shadow:
    0 24px 64px rgba(45, 29, 16, 0.11),
    inset 0 1px 0 rgba(255, 255, 255, 0.3);
}

.sidebar {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  gap: 10px;
  padding: var(--panel-padding);
  border-radius: var(--radius-xl);
  min-height: var(--panel-frame-height);
  max-height: var(--panel-frame-height);
  overflow: hidden;
}

.brand-block {
  display: grid;
  gap: 6px;
  align-content: start;
}

.brand-block h1,
.thread-head h2,
.settings-panel h2 {
  margin: 2px 0 6px;
  font-family: var(--font-display);
  font-size: clamp(1.54rem, 2.52vw, 2.08rem);
  line-height: 0.94;
  letter-spacing: -0.03em;
}

.brand-copy,
.meta-note,
.composer-tip,
.message-caption,
.status-label,
.composer-reference-tip,
.reference-meta span {
  color: var(--muted);
}

.brand-copy {
  margin: 0;
  max-width: 34ch;
  font-size: 0.82rem;
  line-height: 1.52;
}

.eyebrow {
  margin: 0;
  color: var(--accent);
  font-size: 0.66rem;
  font-weight: 700;
  letter-spacing: 0.2em;
}

.brand-links {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 8px;
}

.github-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 34px;
  padding: 0 10px;
  border: 1px solid rgba(76, 55, 35, 0.12);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.6);
  color: var(--ink);
  text-decoration: none;
  transition:
    transform 140ms ease,
    background 140ms ease,
    border-color 140ms ease,
    box-shadow 140ms ease;
}

.github-link:hover {
  transform: translateY(-1px);
  border-color: rgba(76, 55, 35, 0.2);
  background: rgba(255, 255, 255, 0.76);
  box-shadow: 0 10px 24px rgba(45, 29, 16, 0.08);
}

.github-link:focus-visible {
  outline: none;
  border-color: rgba(162, 75, 42, 0.44);
  box-shadow: 0 0 0 5px rgba(162, 75, 42, 0.08);
}

.github-link svg {
  width: 14px;
  height: 14px;
  flex: 0 0 auto;
  fill: currentColor;
}

.control-card {
  padding: var(--card-padding);
  border: 1px solid var(--line);
  border-radius: 18px;
  background:
    linear-gradient(180deg, rgba(255, 253, 249, 0.86) 0%, rgba(249, 241, 230, 0.72) 100%);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.36);
}

.control-card-scrollable {
  min-height: 0;
  height: 100%;
  max-height: none;
  padding-right: 2px;
  overflow-y: auto;
  overscroll-behavior: contain;
  scrollbar-gutter: stable;
}

.control-card-scrollable.is-reverse-mode {
  border-color: rgba(162, 75, 42, 0.18);
  box-shadow: inset 0 0 0 1px rgba(162, 75, 42, 0.05);
}

.control-card.compact {
  margin-top: auto;
}

.card-head,
.composer-actions,
.thread-head,
.message-meta,
.settings-actions,
.image-toolbar,
.composer-reference-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.card-head h2,
.control-card h2 {
  margin: 0;
  font-size: 0.86rem;
  font-weight: 700;
  font-family: var(--font-body);
}

.field {
  display: grid;
  gap: 6px;
  margin-top: 10px;
}

.field > span {
  font-size: 0.78rem;
  font-weight: 600;
}

.field.is-mode-muted {
  opacity: 0.5;
}

.field.is-mode-muted .meta-note {
  color: rgba(108, 92, 78, 0.78);
}

.checkbox-row {
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 8px 10px;
  border: 1px solid rgba(76, 55, 35, 0.12);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.66);
}

.checkbox-row input[type="checkbox"] {
  width: 16px;
  height: 16px;
  margin: 0;
  accent-color: var(--accent);
}

.checkbox-row span {
  font-size: 0.8rem;
  font-weight: 500;
}

input,
textarea,
select {
  width: 100%;
  min-height: var(--input-height);
  border: 1px solid rgba(76, 55, 35, 0.18);
  border-radius: 14px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.92) 0%, rgba(251, 247, 241, 0.8) 100%);
  color: var(--ink);
  padding: 9px 12px;
  outline: none;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.42);
  transition:
    border-color 140ms ease,
    box-shadow 140ms ease,
    transform 140ms ease,
    background 140ms ease;
}

.control-select {
  appearance: none;
  padding-right: 44px;
  background-image:
    linear-gradient(45deg, transparent 50%, rgba(76, 55, 35, 0.72) 50%),
    linear-gradient(135deg, rgba(76, 55, 35, 0.72) 50%, transparent 50%);
  background-position:
    calc(100% - 20px) calc(50% - 3px),
    calc(100% - 14px) calc(50% - 3px);
  background-size: 6px 6px, 6px 6px;
  background-repeat: no-repeat;
}

input:focus,
textarea:focus,
select:focus {
  border-color: rgba(162, 75, 42, 0.44);
  box-shadow: 0 0 0 5px rgba(162, 75, 42, 0.08);
}

textarea {
  min-height: var(--composer-textarea-min-height);
  line-height: 1.54;
  resize: vertical;
}

.segmented {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(66px, 1fr));
  gap: 5px;
}

.segment,
.ghost-button,
.secondary-button,
.primary-button,
.reference-preview,
.reference-remove {
  border: 1px solid transparent;
  border-radius: 999px;
  padding: 7px 10px;
  min-height: 32px;
  font-weight: 600;
  letter-spacing: 0.01em;
  transition:
    transform 140ms ease,
    background 140ms ease,
    border-color 140ms ease,
    color 140ms ease,
    box-shadow 140ms ease;
}

.segment {
  color: var(--muted);
  border-color: rgba(76, 55, 35, 0.12);
  background: rgba(255, 255, 255, 0.55);
}

.segment.is-active {
  color: #fff9f1;
  background: linear-gradient(135deg, #202224 0%, #7b3f27 100%);
  box-shadow: 0 10px 30px rgba(79, 42, 18, 0.18);
}

.ghost-button,
.secondary-button,
.reference-remove {
  color: var(--ink);
  border-color: rgba(76, 55, 35, 0.12);
  background: rgba(255, 255, 255, 0.52);
}

.primary-button {
  color: #fff9f1;
  background: linear-gradient(135deg, #1f2328 0%, #a24b2a 100%);
  box-shadow: 0 12px 30px rgba(95, 45, 21, 0.22);
}

.segment:hover,
.ghost-button:hover,
.secondary-button:hover,
.primary-button:hover,
.reference-preview:hover,
.reference-remove:hover {
  transform: translateY(-1px);
}

.ghost-button:active,
.secondary-button:active,
.primary-button:active,
.segment:active,
.reference-preview:active,
.reference-remove:active {
  transform: translateY(0);
}

.main-panel {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  min-height: var(--panel-frame-height);
  max-height: var(--panel-frame-height);
  padding: var(--panel-padding);
  border-radius: var(--radius-xl);
  overflow: hidden;
}

.thread-head {
  padding-bottom: 10px;
  border-bottom: 1px solid var(--line);
}

.thread {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 10px 6px 0 2px;
  overflow-x: hidden;
  overflow-y: auto;
  min-height: 0;
  height: 100%;
  max-height: min(100%, var(--thread-max-height-desktop));
  overscroll-behavior: contain;
  scrollbar-gutter: stable;
  scroll-padding-block-end: 12px;
}

.message {
  max-width: min(860px, 100%);
  padding: 11px 13px;
  border-radius: 16px;
  border: 1px solid rgba(76, 55, 35, 0.14);
  background: linear-gradient(180deg, rgba(255, 252, 247, 0.92) 0%, rgba(251, 245, 237, 0.78) 100%);
  box-shadow: 0 14px 34px rgba(58, 39, 22, 0.08);
  animation: message-rise 240ms ease;
}

.message[data-role="assistant"] {
  align-self: flex-start;
  width: min(700px, 64%);
}

.message.has-image-batch[data-role="assistant"] {
  width: min(920px, 88%);
}

.message[data-role="user"] {
  align-self: flex-end;
  width: min(440px, 40%);
  background: linear-gradient(180deg, rgba(255, 247, 238, 0.98) 0%, rgba(248, 235, 223, 0.92) 100%);
}

.message[data-role="system"] {
  align-self: flex-start;
  width: min(760px, 76%);
  background: linear-gradient(180deg, rgba(252, 246, 238, 0.96) 0%, rgba(246, 237, 226, 0.9) 100%);
}

.message-meta {
  margin-bottom: 8px;
  color: var(--muted);
  font-size: 0.68rem;
  text-transform: uppercase;
  letter-spacing: 0.11em;
}

.message-body {
  display: grid;
  gap: 8px;
  line-height: 1.54;
  word-break: break-word;
}

.message-body p {
  margin: 0;
}

.message-section-title {
  color: var(--muted);
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.image-card {
  overflow: hidden;
  border-radius: 14px;
  border: 1px solid rgba(64, 48, 34, 0.12);
  background: rgba(255, 255, 255, 0.64);
}

.image-card-preview {
  border-style: dashed;
  border-color: rgba(162, 75, 42, 0.22);
  background:
    linear-gradient(180deg, rgba(255, 248, 239, 0.92) 0%, rgba(255, 252, 247, 0.68) 100%);
}

.image-card img {
  display: block;
  width: 100%;
  height: auto;
  max-height: clamp(150px, 26dvh, 360px);
  object-fit: contain;
  background: linear-gradient(135deg, rgba(162, 75, 42, 0.08), rgba(28, 30, 34, 0.08));
}

.zoomable-image {
  cursor: zoom-in;
}

.image-toolbar {
  flex-wrap: wrap;
  padding: 8px 10px;
  border-top: 1px solid rgba(64, 48, 34, 0.1);
}

.image-batch {
  display: grid;
  gap: 12px;
}

.image-batch-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.image-batch-copy {
  display: grid;
  gap: 6px;
  min-width: 0;
}

.image-batch-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(138px, 1fr));
  gap: 8px;
}

.image-card-compact {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  min-width: 0;
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.72);
}

.image-card-compact img,
.zoomable-image.is-compact {
  width: 100%;
  max-height: clamp(96px, 14dvh, 142px);
  object-fit: contain;
}

.image-card-label {
  padding: 6px 8px 0;
  color: var(--muted);
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  line-height: 1.4;
}

.image-toolbar.is-compact {
  align-items: flex-start;
  gap: 6px;
  padding: 7px 8px 8px;
}

.image-meta.is-compact {
  gap: 4px 6px;
  font-size: 0.66rem;
}

.image-meta.is-compact .pill {
  min-height: 28px;
  padding: 0 10px;
}

.diagnostic-panel {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 8px;
  padding: 10px;
  border: 1px solid rgba(76, 55, 35, 0.12);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.62);
}

.diagnostic-row {
  display: grid;
  gap: 6px;
  min-width: 0;
}

.diagnostic-label {
  color: var(--muted);
  font-size: 0.8rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.diagnostic-value {
  display: block;
  overflow-wrap: anywhere;
  padding: 10px 12px;
  border-radius: 12px;
  background: rgba(33, 28, 24, 0.06);
  color: #34271f;
  font-family: Consolas, "SFMono-Regular", monospace;
  font-size: 0.87rem;
}

.image-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 14px;
  font-size: 0.88rem;
  color: var(--muted);
}

.pill {
  display: inline-flex;
  align-items: center;
  min-height: 34px;
  padding: 0 12px;
  border-radius: 999px;
  background: rgba(162, 75, 42, 0.08);
}

.assist-details {
  display: grid;
  gap: 12px;
  padding: 14px 16px;
  border: 1px solid rgba(76, 55, 35, 0.12);
  border-radius: 20px;
  background: rgba(255, 255, 255, 0.58);
}

.assist-details[open] {
  background: rgba(255, 255, 255, 0.68);
}

.assist-summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  cursor: pointer;
  list-style: none;
}

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

.assist-summary-main {
  display: grid;
  gap: 4px;
  min-width: 0;
}

.assist-summary-title {
  font-weight: 600;
  color: var(--ink);
}

.assist-summary-meta {
  color: var(--muted);
  font-size: 0.9rem;
}

.assist-state-pill {
  white-space: nowrap;
}

.assist-details.is-pending .assist-state-pill {
  background: rgba(162, 75, 42, 0.12);
  color: #8c4f1c;
}

.assist-details.is-complete .assist-state-pill {
  background: rgba(46, 115, 73, 0.12);
  color: #2d6a43;
}

.assist-details.is-failed .assist-state-pill {
  background: rgba(145, 65, 49, 0.12);
  color: #8a3e31;
}

.assist-content {
  display: grid;
  gap: 12px;
}

.reverse-details .assist-summary-title,
.reverse-details .assist-summary-meta {
  overflow-wrap: anywhere;
}

.reverse-content {
  gap: 14px;
}

.reverse-prompt-card {
  display: grid;
  gap: 10px;
  padding: 14px 16px;
  border: 1px solid rgba(76, 55, 35, 0.1);
  border-radius: 18px;
  background: rgba(255, 252, 247, 0.88);
}

.reverse-prompt-card.is-primary {
  background:
    linear-gradient(180deg, rgba(255, 248, 239, 0.98) 0%, rgba(250, 239, 227, 0.9) 100%);
  border-color: rgba(162, 75, 42, 0.18);
}

.reverse-prompt-text {
  margin: 0;
  color: var(--ink);
  line-height: 1.72;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.reverse-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.reverse-breakdown {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 12px;
}

.reverse-breakdown-item {
  display: grid;
  gap: 8px;
  min-width: 0;
  padding: 12px 14px;
  border-radius: 16px;
  border: 1px solid rgba(76, 55, 35, 0.1);
  background: rgba(255, 255, 255, 0.66);
}

.reverse-chip-section,
.reverse-point-section,
.reverse-breakdown-section,
.reverse-variant-section {
  display: grid;
  gap: 10px;
}

.reverse-chip-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.reverse-point-list {
  display: grid;
  gap: 8px;
  margin: 0;
  padding-left: 18px;
}

.reverse-point-list li {
  overflow-wrap: anywhere;
}

.assist-prompt-list {
  display: grid;
  gap: 10px;
}

.assist-prompt-item {
  display: grid;
  gap: 6px;
  padding: 12px 14px;
  border-radius: 16px;
  border: 1px solid rgba(76, 55, 35, 0.1);
  background: rgba(255, 252, 247, 0.88);
}

.assist-prompt-heading {
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.assist-prompt-text {
  margin: 0;
  color: var(--ink);
  line-height: 1.65;
  word-break: break-word;
}

.composer {
  position: relative;
  display: grid;
  gap: 8px;
  align-self: end;
  margin-top: 8px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background:
    linear-gradient(180deg, rgba(255, 251, 245, 0.94) 0%, rgba(248, 240, 230, 0.9) 100%);
  box-shadow:
    0 12px 28px rgba(58, 39, 22, 0.06),
    inset 0 1px 0 rgba(255, 255, 255, 0.36);
}

.composer-mode-row {
  margin-bottom: 0;
}

.composer-mode-group {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.composer-edit-banner {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 0;
  padding: 7px 8px;
  border: 1px solid rgba(162, 75, 42, 0.18);
  border-radius: 12px;
  background:
    linear-gradient(180deg, rgba(255, 248, 239, 0.96) 0%, rgba(250, 239, 227, 0.88) 100%);
}

.composer-edit-copy {
  display: grid;
  gap: 4px;
  min-width: 0;
}

.composer-edit-copy strong {
  color: var(--ink);
  font-size: 0.8rem;
}

.composer-edit-copy span {
  color: var(--muted);
  font-size: 0.76rem;
  line-height: 1.34;
  overflow-wrap: anywhere;
}

.composer-label {
  display: block;
  margin-bottom: 0;
  font-size: 0.8rem;
  font-weight: 600;
}

.composer-run-controls {
  display: inline-flex;
  align-items: center;
  justify-content: flex-end;
  gap: 6px;
  flex-wrap: wrap;
}

.composer-reference-head {
  margin-bottom: 0;
  align-items: flex-start;
}

.composer-reference-tip {
  display: block;
  min-width: 0;
  font-size: 0.78rem;
  line-height: 1.34;
}

.composer-reference-tip[data-tone="warning"] {
  color: #8c4f1c;
}

.composer-reference-clear {
  flex: 0 0 auto;
  padding-inline: 8px;
}

.composer-reference-strip {
  margin-bottom: 0;
  padding-right: 2px;
}

.reference-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(102px, 1fr));
  gap: 6px;
}

.reference-grid.is-compact {
  grid-template-columns: repeat(auto-fill, minmax(96px, 1fr));
}

.reference-card {
  display: grid;
  gap: 6px;
  min-width: 0;
  padding: 8px;
  border: 1px solid rgba(76, 55, 35, 0.12);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.68);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.32);
}

.reference-preview {
  display: grid;
  place-items: center;
  width: 100%;
  min-height: 76px;
  padding: 0;
  overflow: hidden;
  border-radius: 10px;
  border-color: rgba(76, 55, 35, 0.12);
  background:
    radial-gradient(circle at top left, rgba(162, 75, 42, 0.12), transparent 26%),
    rgba(255, 255, 255, 0.82);
}

.reference-preview:disabled {
  cursor: default;
}

.reference-preview img {
  display: block;
  width: 100%;
  height: 100%;
  min-height: 76px;
  max-height: 104px;
  object-fit: cover;
}

.reference-placeholder {
  padding: 18px;
  color: var(--muted);
  font-size: 0.84rem;
}

.reference-meta {
  display: grid;
  gap: 2px;
  min-width: 0;
}

.reference-meta strong {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 0.74rem;
}

.reference-meta span {
  font-size: 0.66rem;
}

.reference-remove {
  justify-self: start;
  padding: 4px 8px;
  font-size: 0.7rem;
}

.message-reference-section {
  display: grid;
  gap: 10px;
}

.settings-dialog {
  width: min(680px, calc(100vw - 24px));
  padding: 0;
  border: none;
  background: transparent;
}

.settings-dialog::backdrop {
  background: rgba(17, 15, 13, 0.46);
  backdrop-filter: blur(6px);
}

.settings-panel {
  padding: clamp(14px, 1.2vw, 18px);
  border-radius: 20px;
  background: var(--panel-strong);
}

.image-preview-dialog {
  width: min(1120px, calc(100vw - 24px));
  padding: 0;
  border: none;
  background: transparent;
}

.image-preview-dialog::backdrop {
  background: rgba(17, 15, 13, 0.72);
  backdrop-filter: blur(10px);
}

.image-preview-panel {
  padding: 18px;
  border-radius: 28px;
  border: 1px solid rgba(255, 255, 255, 0.22);
  background: rgba(31, 26, 22, 0.88);
  box-shadow: 0 28px 80px rgba(0, 0, 0, 0.34);
}

.image-preview-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 16px;
}

.image-preview-frame {
  display: grid;
  place-items: center;
  min-height: min(72dvh, 780px);
  max-height: 78dvh;
  overflow: auto;
  border-radius: 22px;
  background:
    radial-gradient(circle at top left, rgba(162, 75, 42, 0.12), transparent 26%),
    rgba(255, 255, 255, 0.04);
}

.image-preview-frame img {
  display: block;
  width: auto;
  height: auto;
  max-width: 100%;
  max-height: 74dvh;
  object-fit: contain;
  border-radius: 18px;
}

.settings-actions {
  margin-top: 20px;
}

.status-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  margin-top: 10px;
}

.status-grid > div {
  padding: 8px 10px;
  border: 1px solid rgba(76, 55, 35, 0.1);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.5);
}

.status-grid strong {
  display: block;
  margin-top: 4px;
  font-size: 0.86rem;
}

.empty-state {
  padding: 40px 28px;
  border: 1px dashed rgba(76, 55, 35, 0.22);
  border-radius: 28px;
  color: var(--muted);
  background: rgba(255, 255, 255, 0.4);
}

.loading-dots {
  display: inline-flex;
  gap: 6px;
}

.loading-dots span {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--accent);
  animation: blink 900ms infinite ease-in-out;
}

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

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

@keyframes blink {
  0%,
  80%,
  100% {
    transform: scale(0.8);
    opacity: 0.3;
  }
  40% {
    transform: scale(1);
    opacity: 1;
  }
}

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

.thread,
.control-card-scrollable,
.composer-reference-strip,
.image-preview-frame {
  scrollbar-width: thin;
  scrollbar-color: rgba(97, 72, 49, 0.44) transparent;
}

.thread::-webkit-scrollbar,
.control-card-scrollable::-webkit-scrollbar,
.composer-reference-strip::-webkit-scrollbar,
.image-preview-frame::-webkit-scrollbar {
  width: 10px;
  height: 10px;
}

.thread::-webkit-scrollbar-thumb,
.control-card-scrollable::-webkit-scrollbar-thumb,
.composer-reference-strip::-webkit-scrollbar-thumb,
.image-preview-frame::-webkit-scrollbar-thumb {
  border: 2px solid transparent;
  border-radius: 999px;
  background: rgba(97, 72, 49, 0.4);
  background-clip: padding-box;
}

.thread::-webkit-scrollbar-track,
.control-card-scrollable::-webkit-scrollbar-track,
.composer-reference-strip::-webkit-scrollbar-track,
.image-preview-frame::-webkit-scrollbar-track {
  background: transparent;
}

@media (max-width: 1080px) {
  .app-shell {
    grid-template-columns: 1fr;
    width: min(1280px, calc(100vw - (var(--app-shell-padding) * 2)));
  }

  .sidebar {
    display: flex;
    gap: 14px;
    min-height: auto;
    max-height: none;
    overflow: visible;
  }

  .control-card-scrollable {
    height: auto;
    max-height: var(--control-panel-max-height-tablet);
  }

  .main-panel {
    padding: 16px;
  }

  .thread {
    gap: 12px;
    padding: 10px 4px 0 0;
    max-height: min(100%, var(--thread-max-height-tablet));
  }

  .message {
    max-width: 100%;
    padding: 14px 16px;
    border-radius: 18px;
  }

  .message[data-role="assistant"] {
    width: min(720px, 80%);
  }

  .message.has-image-batch[data-role="assistant"] {
    width: min(100%, 920px);
  }

  .message[data-role="user"] {
    width: min(460px, 54%);
  }

  .message[data-role="system"] {
    width: min(100%, 820px);
  }

  .composer {
    padding: 12px;
  }
}

@media (max-width: 640px) {
  :root {
    --app-shell-padding: 10px;
    --app-shell-gap: 10px;
  }

  .app-shell {
    padding: var(--app-shell-padding);
    gap: var(--app-shell-gap);
  }

  .sidebar,
  .main-panel {
    padding: 14px;
    border-radius: 22px;
  }

  .control-card {
    padding: 14px;
    border-radius: 20px;
  }

  .thread {
    gap: 14px;
    padding: 8px 0 0;
    max-height: min(100%, var(--thread-max-height-mobile));
  }

  .control-card-scrollable {
    max-height: var(--control-panel-max-height-mobile);
  }

  .message {
    width: 100%;
    max-width: 100%;
    padding: 14px 16px;
    border-radius: 20px;
  }

  .message[data-role="assistant"],
  .message[data-role="user"],
  .message[data-role="system"] {
    width: 100%;
  }

  .diagnostic-panel {
    grid-template-columns: 1fr;
    padding: 14px;
  }

  .image-card img {
    max-height: clamp(220px, 34dvh, 380px);
  }

  .image-batch-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
  }

  .image-batch-head {
    flex-direction: column;
    align-items: stretch;
  }

  .image-card-compact img,
  .zoomable-image.is-compact {
    max-height: clamp(120px, 20dvh, 160px);
  }

  .image-toolbar.is-compact {
    padding: 10px;
  }

  .reference-grid,
  .reference-grid.is-compact {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .image-preview-panel {
    padding: 14px;
    border-radius: 22px;
  }

  .image-preview-head,
  .reverse-actions,
  .composer-edit-banner,
  .composer-reference-head,
  .thread-head,
  .composer-actions,
  .composer-run-controls,
  .card-head,
  .settings-actions {
    flex-direction: column;
    align-items: stretch;
  }

  .thread-head h2 {
    margin: 4px 0 0;
    font-size: clamp(1.9rem, 10vw, 2.6rem);
  }

  input,
  textarea,
  select {
    min-height: 48px;
    padding: 12px 14px;
  }

  .composer {
    gap: 10px;
    padding: 12px;
    border-radius: 22px;
  }

  .composer-tip,
  .meta-note,
  .composer-reference-tip {
    font-size: 0.86rem;
  }

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

  .image-preview-frame {
    min-height: min(56dvh, 560px);
    max-height: 68dvh;
  }

  .image-preview-frame img {
    max-height: 64dvh;
  }

  .reference-grid,
  .reference-grid.is-compact {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .reverse-breakdown {
    grid-template-columns: 1fr;
  }

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

.endpoint-select {
  cursor: pointer;
}


/* PROMPTCANVAS FROSTED GLASS DASHBOARD OVERRIDE - 2026-06-15 */
:root {
  --bg: #08111f;
  --bg-deep: #030814;
  --panel: rgba(255, 255, 255, 0.10);
  --panel-strong: rgba(255, 255, 255, 0.16);
  --line: rgba(255, 255, 255, 0.20);
  --ink: rgba(255, 255, 255, 0.94);
  --muted: rgba(226, 236, 255, 0.68);
  --accent: #7dd3fc;
  --accent-soft: rgba(125, 211, 252, 0.16);
  --glass-bg: rgba(255, 255, 255, 0.10);
  --glass-bg-strong: rgba(255, 255, 255, 0.16);
  --glass-bg-soft: rgba(255, 255, 255, 0.06);
  --glass-line: rgba(255, 255, 255, 0.20);
  --glass-line-soft: rgba(255, 255, 255, 0.12);
  --glass-highlight: rgba(255, 255, 255, 0.34);
  --glass-blur: blur(28px) saturate(165%);
  --glass-shadow: 0 24px 80px rgba(0, 0, 0, 0.30), inset 0 1px 0 rgba(255, 255, 255, 0.30);
  --glass-shadow-soft: 0 16px 44px rgba(0, 0, 0, 0.20), inset 0 1px 0 rgba(255, 255, 255, 0.20);
  --focus-glow: 0 0 0 5px rgba(125, 211, 252, 0.18), 0 0 34px rgba(129, 140, 248, 0.22);
}

html,
body {
  color: var(--ink);
  background:
    radial-gradient(circle at 12% 8%, rgba(56, 189, 248, 0.38), transparent 26%),
    radial-gradient(circle at 84% 12%, rgba(168, 85, 247, 0.34), transparent 30%),
    radial-gradient(circle at 68% 82%, rgba(20, 184, 166, 0.28), transparent 33%),
    linear-gradient(135deg, #08111f 0%, #101a35 44%, #050813 100%);
}

body::before {
  z-index: 0;
  opacity: 0.34;
  background-image:
    linear-gradient(rgba(255,255,255,0.045) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255,255,255,0.045) 1px, transparent 1px);
  background-size: 30px 30px;
  mask-image: radial-gradient(circle at center, black 42%, transparent 86%);
}

body::after {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  content: "";
  background:
    linear-gradient(120deg, rgba(255,255,255,0.10), transparent 22%, rgba(255,255,255,0.06) 46%, transparent 66%),
    radial-gradient(circle at 50% 50%, transparent 0 45%, rgba(0,0,0,0.24) 100%);
  mix-blend-mode: screen;
  opacity: 0.55;
}

.glass-background {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  overflow: hidden;
}

.glass-orb {
  position: absolute;
  display: block;
  border-radius: 999px;
  filter: blur(18px);
  opacity: 0.72;
  transform: translateZ(0);
}

.glass-orb-a {
  width: 34vw;
  height: 34vw;
  left: -8vw;
  top: 6vh;
  background: radial-gradient(circle, rgba(56,189,248,0.48), rgba(37,99,235,0.18) 52%, transparent 70%);
}

.glass-orb-b {
  width: 42vw;
  height: 42vw;
  right: -14vw;
  top: -10vh;
  background: radial-gradient(circle, rgba(217,70,239,0.38), rgba(99,102,241,0.22) 54%, transparent 72%);
}

.glass-orb-c {
  width: 30vw;
  height: 30vw;
  right: 12vw;
  bottom: -12vh;
  background: radial-gradient(circle, rgba(45,212,191,0.34), rgba(14,165,233,0.18) 50%, transparent 74%);
}

.glass-mesh {
  position: absolute;
  inset: 7vh 7vw;
  border: 1px solid rgba(255,255,255,0.10);
  border-radius: 48px;
  background: linear-gradient(135deg, rgba(255,255,255,0.07), transparent 35%, rgba(255,255,255,0.03));
  filter: blur(0.2px);
  opacity: 0.48;
}

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

.sidebar,
.main-panel,
.settings-panel,
.image-preview-panel {
  backdrop-filter: var(--glass-blur);
  -webkit-backdrop-filter: var(--glass-blur);
  background:
    linear-gradient(150deg, rgba(255,255,255,0.18), rgba(255,255,255,0.08) 42%, rgba(255,255,255,0.05) 100%);
  border: 1px solid var(--glass-line);
  box-shadow: var(--glass-shadow);
}

.sidebar,
.main-panel {
  isolation: isolate;
}

.sidebar::before,
.main-panel::before,
.settings-panel::before,
.image-preview-panel::before,
.control-card::before,
.composer::before,
.message::before {
  position: absolute;
  inset: 0;
  pointer-events: none;
  content: "";
  border-radius: inherit;
  background: linear-gradient(135deg, rgba(255,255,255,0.24), transparent 34%, rgba(255,255,255,0.06));
  opacity: 0.54;
}

.sidebar,
.main-panel,
.settings-panel,
.image-preview-panel,
.control-card,
.composer,
.message,
.image-card,
.image-card-compact,
.diagnostic-panel,
.reference-card,
.empty-state,
.checkbox-row,
.composer-edit-banner,
.assist-prompt {
  position: relative;
}

.brand-block h1,
.thread-head h2,
.settings-panel h2,
.card-head h2,
.control-card h2,
.field > span,
.reference-meta strong,
.assist-prompt-heading {
  color: rgba(255,255,255,0.96);
  text-shadow: 0 1px 24px rgba(125,211,252,0.12);
}

.brand-copy,
.meta-note,
.composer-tip,
.message-caption,
.status-label,
.composer-reference-tip,
.reference-meta span,
.message-meta,
.message-section-title,
.diagnostic-label,
.image-meta,
.image-card-label,
.reference-placeholder {
  color: var(--muted);
}

.eyebrow {
  color: #93c5fd;
  text-shadow: 0 0 24px rgba(96,165,250,0.34);
}

.control-card,
.composer,
.message,
.empty-state,
.diagnostic-panel,
.reference-card,
.assist-prompt {
  backdrop-filter: blur(22px) saturate(155%);
  -webkit-backdrop-filter: blur(22px) saturate(155%);
  border: 1px solid var(--glass-line-soft);
  background: linear-gradient(145deg, rgba(255,255,255,0.125), rgba(255,255,255,0.055));
  box-shadow: var(--glass-shadow-soft);
}

.control-card-scrollable.is-reverse-mode {
  border-color: rgba(125,211,252,0.30);
  box-shadow: var(--glass-shadow-soft), inset 0 0 0 1px rgba(125,211,252,0.12);
}

.control-card:hover,
.message:hover,
.image-card:hover,
.image-card-compact:hover,
.reference-card:hover {
  transform: translateY(-1px);
  border-color: rgba(255,255,255,0.28);
  background: linear-gradient(145deg, rgba(255,255,255,0.16), rgba(255,255,255,0.075));
}

.github-link,
.segment,
.ghost-button,
.secondary-button,
.reference-remove,
.reference-preview,
.status-grid > div,
.checkbox-row,
input,
textarea,
select,
.pill,
.diagnostic-value {
  color: var(--ink);
  border-color: var(--glass-line-soft);
  background: rgba(255,255,255,0.085);
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.18);
  backdrop-filter: blur(16px) saturate(145%);
  -webkit-backdrop-filter: blur(16px) saturate(145%);
}

.github-link:hover,
.segment:hover,
.ghost-button:hover,
.secondary-button:hover,
.reference-remove:hover,
.reference-preview:hover {
  border-color: rgba(255,255,255,0.30);
  background: rgba(255,255,255,0.16);
  box-shadow: 0 12px 34px rgba(15,23,42,0.20), inset 0 1px 0 rgba(255,255,255,0.24);
}

input::placeholder,
textarea::placeholder {
  color: rgba(226,236,255,0.42);
}

.control-select {
  background-image:
    linear-gradient(45deg, transparent 50%, rgba(226,236,255,0.78) 50%),
    linear-gradient(135deg, rgba(226,236,255,0.78) 50%, transparent 50%);
}

select option {
  color: #0f172a;
  background: #eaf2ff;
}

input:focus,
textarea:focus,
select:focus,
.github-link:focus-visible,
.ghost-button:focus-visible,
.secondary-button:focus-visible,
.primary-button:focus-visible,
.segment:focus-visible,
.reference-preview:focus-visible,
.reference-remove:focus-visible {
  outline: none;
  border-color: rgba(125,211,252,0.58);
  box-shadow: var(--focus-glow);
}

.checkbox-row input[type="checkbox"] {
  accent-color: #38bdf8;
}

.segment.is-active,
.primary-button {
  color: #f8fbff;
  border-color: rgba(255,255,255,0.26);
  background: linear-gradient(135deg, rgba(14,165,233,0.92) 0%, rgba(124,58,237,0.88) 58%, rgba(236,72,153,0.76) 100%);
  box-shadow: 0 18px 46px rgba(37,99,235,0.30), inset 0 1px 0 rgba(255,255,255,0.34);
}

.message[data-role="user"] {
  background: linear-gradient(145deg, rgba(14,165,233,0.24), rgba(124,58,237,0.16));
}

.message[data-role="system"] {
  background: linear-gradient(145deg, rgba(255,255,255,0.12), rgba(20,184,166,0.10));
}

.message-body,
.assist-prompt-text,
.status-grid strong,
.diagnostic-value {
  color: rgba(255,255,255,0.91);
}

.image-card,
.image-card-compact,
.reference-preview {
  border-color: var(--glass-line-soft);
  background: rgba(255,255,255,0.08);
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.16);
}

.image-card-preview,
.reference-preview,
.image-preview-frame {
  background:
    radial-gradient(circle at 15% 12%, rgba(125,211,252,0.16), transparent 34%),
    radial-gradient(circle at 86% 86%, rgba(168,85,247,0.14), transparent 35%),
    rgba(255,255,255,0.055);
}

.image-card img,
.image-card-compact img,
.zoomable-image.is-compact {
  background: linear-gradient(135deg, rgba(56,189,248,0.10), rgba(168,85,247,0.12));
}

.image-toolbar {
  border-top-color: var(--glass-line-soft);
}

.diagnostic-panel {
  background: rgba(255,255,255,0.075);
}

.diagnostic-value {
  background: rgba(3,7,18,0.22);
  font-family: Consolas, "SFMono-Regular", monospace;
}

.pill {
  color: rgba(255,255,255,0.86);
  border-radius: 999px;
}

.composer-edit-banner {
  border-color: rgba(125,211,252,0.26);
  background: linear-gradient(145deg, rgba(14,165,233,0.18), rgba(124,58,237,0.12));
}

.composer-reference-tip[data-tone="warning"] {
  color: #fbbf24;
}

.settings-dialog::backdrop,
.image-preview-dialog::backdrop {
  background: rgba(3, 7, 18, 0.58);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
}

.thread,
.control-card-scrollable,
.composer-reference-strip,
.image-preview-frame {
  scrollbar-color: rgba(226,236,255,0.34) transparent;
}

.thread::-webkit-scrollbar-thumb,
.control-card-scrollable::-webkit-scrollbar-thumb,
.composer-reference-strip::-webkit-scrollbar-thumb,
.image-preview-frame::-webkit-scrollbar-thumb {
  background: rgba(226,236,255,0.30);
  background-clip: padding-box;
}

@media (prefers-reduced-motion: no-preference) {
  .control-card,
  .message,
  .image-card,
  .image-card-compact,
  .reference-card,
  .segment,
  .ghost-button,
  .secondary-button,
  .primary-button,
  .reference-preview,
  .reference-remove {
    transition: transform .7s ease, background .7s ease, border-color .7s ease, box-shadow .7s ease, color .25s ease;
  }
}

@media (max-width: 640px) {
  .glass-orb-a { width: 70vw; height: 70vw; }
  .glass-orb-b { width: 78vw; height: 78vw; }
  .glass-orb-c { width: 62vw; height: 62vw; }
}


/* PROMPTCANVAS SAFE GHOST + SOLID BUTTON FIX - 2026-06-15 */
:root {
  --solid-button-bg: rgba(255,255,255,0.135);
  --solid-button-bg-hover: rgba(255,255,255,0.18);
  --solid-button-border: rgba(255,255,255,0.24);
}

body::after {
  opacity: 0.14 !important;
  background:
    linear-gradient(120deg, rgba(255,255,255,0.035), transparent 22%, rgba(255,255,255,0.025) 46%, transparent 66%),
    radial-gradient(circle at 50% 50%, transparent 0 58%, rgba(0,0,0,0.14) 100%) !important;
}

.glass-mesh {
  border-color: rgba(255,255,255,0.035) !important;
  background: linear-gradient(135deg, rgba(255,255,255,0.018), transparent 42%, rgba(255,255,255,0.012)) !important;
  opacity: 0.16 !important;
}

.sidebar::before,
.main-panel::before,
.settings-panel::before,
.image-preview-panel::before,
.control-card::before,
.composer::before,
.message::before {
  opacity: 0.12 !important;
  background: linear-gradient(135deg, rgba(255,255,255,0.06), transparent 42%, rgba(255,255,255,0.025)) !important;
}

.control-card:hover,
.message:hover,
.image-card:hover,
.image-card-compact:hover,
.reference-card:hover {
  transform: none !important;
  border-color: rgba(255,255,255,0.18) !important;
  background: linear-gradient(145deg, rgba(255,255,255,0.135), rgba(255,255,255,0.060)) !important;
  box-shadow: var(--glass-shadow-soft) !important;
}

.github-link:hover,
.segment:hover,
.ghost-button:hover,
.secondary-button:hover,
.reference-remove:hover,
.reference-preview:hover {
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.22) !important;
}

.segment.is-active,
.primary-button {
  color: #f8fbff !important;
  border-color: var(--solid-button-border) !important;
  background: var(--solid-button-bg) !important;
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.26) !important;
}

.segment.is-active:hover,
.primary-button:hover {
  background: var(--solid-button-bg-hover) !important;
  border-color: rgba(255,255,255,0.30) !important;
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.28) !important;
}

.message[data-role="user"] {
  background: rgba(255,255,255,0.115) !important;
}

.message[data-role="system"] {
  background: rgba(255,255,255,0.095) !important;
}

.composer-edit-banner {
  background: rgba(255,255,255,0.105) !important;
}

@media (prefers-reduced-motion: no-preference) {
  .control-card,
  .message,
  .image-card,
  .image-card-compact,
  .reference-card,
  .segment,
  .ghost-button,
  .secondary-button,
  .primary-button,
  .reference-preview,
  .reference-remove {
    transition: background .22s ease, border-color .22s ease, box-shadow .22s ease, color .22s ease !important;
  }
}


/* PROMPTCANVAS MAIN-STATION BACKGROUND THEME - 2026-06-16 */
:root,
html[data-theme="main-light"] {
  --main-bg-a: #fef7e7;
  --main-bg-b: #eaf6ff;
  --main-bg-c: #f5edff;
  --main-glow-white: rgba(255,255,255,0.76);
  --main-glow-cool: rgba(125,211,252,0.28);
  --main-glow-warm: rgba(244,114,182,0.16);
  --main-grid: rgba(148,163,184,0.18);
  --main-image-overlay: rgba(255,255,255,0.22);
  --solid-button-bg: rgba(255,255,255,0.135);
  --solid-button-bg-hover: rgba(255,255,255,0.18);
  --solid-button-border: rgba(255,255,255,0.24);
}

html[data-theme="main-violet"] {
  --main-bg-a: #f4efff; --main-bg-b: #e8f0ff; --main-bg-c: #f9eefe;
  --main-glow-white: rgba(255,255,255,0.72); --main-glow-cool: rgba(99,102,241,0.28); --main-glow-warm: rgba(217,70,239,0.18);
  --main-grid: rgba(129,140,248,0.18); --main-image-overlay: rgba(245,240,255,0.25);
}

html[data-theme="main-cyan"] {
  --main-bg-a: #effcff; --main-bg-b: #e0f7ff; --main-bg-c: #f1fbff;
  --main-glow-white: rgba(255,255,255,0.74); --main-glow-cool: rgba(34,211,238,0.30); --main-glow-warm: rgba(59,130,246,0.12);
  --main-grid: rgba(14,165,233,0.16); --main-image-overlay: rgba(240,253,255,0.28);
}

html[data-theme="main-rose"] {
  --main-bg-a: #fff1f5; --main-bg-b: #fff7ed; --main-bg-c: #f5f3ff;
  --main-glow-white: rgba(255,255,255,0.74); --main-glow-cool: rgba(168,85,247,0.18); --main-glow-warm: rgba(244,114,182,0.26);
  --main-grid: rgba(244,114,182,0.16); --main-image-overlay: rgba(255,245,248,0.28);
}

html[data-theme="main-amber"] {
  --main-bg-a: #fff7ed; --main-bg-b: #fefce8; --main-bg-c: #eff6ff;
  --main-glow-white: rgba(255,255,255,0.75); --main-glow-cool: rgba(96,165,250,0.14); --main-glow-warm: rgba(251,191,36,0.28);
  --main-grid: rgba(245,158,11,0.14); --main-image-overlay: rgba(255,251,235,0.26);
}

html[data-theme="main-mint"] {
  --main-bg-a: #ecfdf5; --main-bg-b: #eff6ff; --main-bg-c: #f0fdfa;
  --main-glow-white: rgba(255,255,255,0.74); --main-glow-cool: rgba(20,184,166,0.24); --main-glow-warm: rgba(125,211,252,0.16);
  --main-grid: rgba(20,184,166,0.14); --main-image-overlay: rgba(240,253,250,0.26);
}

html,
body {
  background:
    radial-gradient(circle at 20% 18%, var(--main-glow-white), transparent 416px),
    radial-gradient(circle at 82% 70%, var(--main-glow-cool), transparent 448px),
    radial-gradient(circle at 62% 14%, var(--main-glow-warm), transparent 384px),
    linear-gradient(135deg, var(--main-bg-a) 0%, var(--main-bg-b) 46%, var(--main-bg-c) 100%) !important;
}

body::after {
  opacity: 0.26 !important;
  background:
    linear-gradient(rgba(148,163,184,0.18) 1px, transparent 1px),
    linear-gradient(90deg, rgba(148,163,184,0.18) 1px, transparent 1px),
    radial-gradient(circle at 52% 16%, rgba(255,255,255,0.72), transparent 544px),
    radial-gradient(circle at 20% 18%, rgba(244,114,182,0.18), transparent 416px),
    radial-gradient(circle at 82% 34%, rgba(125,211,252,0.24), transparent 480px) !important;
  background-size: 32px 32px, 32px 32px, auto, auto, auto !important;
  mix-blend-mode: normal !important;
}

.glass-background::before {
  position: absolute;
  inset: 0;
  content: "";
  background:
    linear-gradient(var(--main-image-overlay), rgba(255,255,255,0.12)),
    url("/assets/main-watercolor.jpg"),
    url("/assets/main-gradient.jpg");
  background-size: cover, cover, cover;
  background-position: center;
  opacity: 0.50;
}

.glass-mesh {
  border-color: rgba(255,255,255,0.035) !important;
  background: linear-gradient(135deg, rgba(255,255,255,0.018), transparent 42%, rgba(255,255,255,0.012)) !important;
  opacity: 0.14 !important;
}

.sidebar::before,
.main-panel::before,
.settings-panel::before,
.image-preview-panel::before,
.control-card::before,
.composer::before,
.message::before {
  opacity: 0.12 !important;
  background: linear-gradient(135deg, rgba(255,255,255,0.06), transparent 42%, rgba(255,255,255,0.025)) !important;
}

.brand-block {
  position: relative;
}

.brand-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 10px;
}

.theme-popover {
  position: absolute;
  left: 0;
  top: calc(100% + 8px);
  z-index: 30;
  width: min(280px, calc(100vw - 36px));
  padding: 12px;
  border: 1px solid var(--glass-line);
  border-radius: 18px;
  background: linear-gradient(145deg, rgba(255,255,255,0.54), rgba(255,255,255,0.22));
  box-shadow: 0 24px 70px rgba(15,23,42,0.18), inset 0 1px 0 rgba(255,255,255,0.35);
  backdrop-filter: blur(22px) saturate(145%);
  -webkit-backdrop-filter: blur(22px) saturate(145%);
}

.theme-popover-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 10px;
  color: var(--ink);
}

.theme-popover-close {
  min-height: 28px;
  padding: 4px 9px;
  font-size: 0.76rem;
}

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

.theme-swatch {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 38px;
  padding: 7px 9px;
  border: 1px solid var(--glass-line-soft);
  border-radius: 999px;
  color: var(--ink);
  background: rgba(255,255,255,0.18);
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.24);
  font-weight: 650;
}

.theme-swatch span {
  width: 17px;
  height: 17px;
  border-radius: 999px;
  border: 1px solid rgba(255,255,255,0.55);
}

.theme-swatch[aria-pressed="true"] {
  border-color: rgba(99,102,241,0.38);
  background: rgba(255,255,255,0.32);
}

.theme-swatch[data-theme="main-light"] span { background: linear-gradient(135deg, #fef7e7, #eaf6ff, #f5edff); }
.theme-swatch[data-theme="main-violet"] span { background: linear-gradient(135deg, #c4b5fd, #93c5fd); }
.theme-swatch[data-theme="main-cyan"] span { background: linear-gradient(135deg, #67e8f9, #bfdbfe); }
.theme-swatch[data-theme="main-rose"] span { background: linear-gradient(135deg, #f9a8d4, #ddd6fe); }
.theme-swatch[data-theme="main-amber"] span { background: linear-gradient(135deg, #fde68a, #bfdbfe); }
.theme-swatch[data-theme="main-mint"] span { background: linear-gradient(135deg, #a7f3d0, #bae6fd); }

.segment.is-active,
.primary-button {
  color: #f8fbff !important;
  border-color: var(--solid-button-border) !important;
  background: var(--solid-button-bg) !important;
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.26) !important;
}

.segment.is-active:hover,
.primary-button:hover {
  background: var(--solid-button-bg-hover) !important;
  border-color: rgba(255,255,255,0.30) !important;
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.28) !important;
}

.message[data-role="user"] { background: rgba(255,255,255,0.115) !important; }
.message[data-role="system"] { background: rgba(255,255,255,0.095) !important; }

/* PROMPTCANVAS ALL TEXT BLACK OVERRIDE - 2026-06-16 */
:root,
html,
body {
  --ink: #000000 !important;
  --muted: #000000 !important;
  --accent: #000000 !important;
}

body,
body *:not(svg):not(path) {
  color: #000000 !important;
  text-shadow: none !important;
}

input::placeholder,
textarea::placeholder {
  color: rgba(0, 0, 0, 0.62) !important;
}

select option {
  color: #000000 !important;
}

.segment.is-active,
.primary-button,
.ghost-button,
.secondary-button,
.github-link,
.theme-swatch,
.theme-popover,
.theme-popover *:not(svg):not(path),
.message-body,
.assist-prompt-text,
.status-grid strong,
.diagnostic-value,
.pill {
  color: #000000 !important;
  text-shadow: none !important;
}

/* PROMPTCANVAS TRANSLUCENT EDGE SHADOW REFINEMENT - 2026-06-16 */
:root,
html[data-theme] {
  --layer-shadow-panel: 0 26px 78px rgba(15, 23, 42, 0.145), 0 6px 22px rgba(15, 23, 42, 0.055), inset 0 1px 0 rgba(255,255,255,0.62);
  --layer-shadow-card: 0 16px 44px rgba(15, 23, 42, 0.125), 0 3px 14px rgba(15, 23, 42, 0.052), inset 0 1px 0 rgba(255,255,255,0.58);
  --layer-shadow-button: 0 8px 22px rgba(15, 23, 42, 0.135), 0 2px 7px rgba(15, 23, 42, 0.075), inset 0 1px 0 rgba(255,255,255,0.62);
  --layer-shadow-button-hover: 0 12px 30px rgba(15, 23, 42, 0.17), 0 3px 10px rgba(15, 23, 42, 0.085), inset 0 1px 0 rgba(255,255,255,0.68);
}

.sidebar,
.main-panel,
.settings-panel,
.image-preview-panel {
  border-color: rgba(255,255,255,0.48) !important;
  background: linear-gradient(180deg, rgba(255,255,255,0.54), rgba(255,255,255,0.30)) !important;
  box-shadow: var(--layer-shadow-panel) !important;
}

.control-card,
.composer,
.message,
.empty-state,
.diagnostic-panel,
.reference-card,
.assist-prompt,
.checkbox-row,
.status-grid > div,
.image-card,
.image-card-compact,
.image-preview-frame {
  border-color: rgba(255,255,255,0.38) !important;
  background: linear-gradient(145deg, rgba(255,255,255,0.36), rgba(255,255,255,0.18)) !important;
  box-shadow: var(--layer-shadow-card) !important;
}

.github-link,
.segment,
.ghost-button,
.secondary-button,
.primary-button,
.reference-remove,
.reference-preview,
.theme-popover-close,
.theme-swatch,
button[type=submit] {
  border-color: rgba(255,255,255,0.42) !important;
  background: linear-gradient(180deg, rgba(255,255,255,0.42), rgba(255,255,255,0.24)) !important;
  box-shadow: var(--layer-shadow-button) !important;
  color: #000000 !important;
}

.segment.is-active,
.primary-button {
  border-color: rgba(255,255,255,0.48) !important;
  background: linear-gradient(180deg, rgba(255,255,255,0.46), rgba(255,255,255,0.27)) !important;
  box-shadow: var(--layer-shadow-button) !important;
}

.github-link:hover,
.segment:hover,
.ghost-button:hover,
.secondary-button:hover,
.primary-button:hover,
.reference-remove:hover,
.reference-preview:hover,
.theme-popover-close:hover,
.theme-swatch:hover,
.segment.is-active:hover,
.primary-button:hover {
  border-color: rgba(255,255,255,0.54) !important;
  background: linear-gradient(180deg, rgba(255,255,255,0.50), rgba(255,255,255,0.30)) !important;
  box-shadow: var(--layer-shadow-button-hover) !important;
  transform: none !important;
}

input,
textarea,
select,
.diagnostic-value,
.pill {
  border-color: rgba(255,255,255,0.40) !important;
  background: rgba(255,255,255,0.34) !important;
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.60), 0 5px 16px rgba(15,23,42,0.055) !important;
  color: #000000 !important;
}

.theme-popover {
  border-color: rgba(255,255,255,0.46) !important;
  background: linear-gradient(145deg, rgba(255,255,255,0.52), rgba(255,255,255,0.28)) !important;
  box-shadow: 0 28px 78px rgba(15,23,42,0.18), 0 7px 20px rgba(15,23,42,0.07), inset 0 1px 0 rgba(255,255,255,0.64) !important;
}

.message[data-role=user],
.message[data-role=system] {
  background: linear-gradient(145deg, rgba(255,255,255,0.38), rgba(255,255,255,0.20)) !important;
}

.control-card:hover,
.message:hover,
.image-card:hover,
.image-card-compact:hover,
.reference-card:hover {
  border-color: rgba(255,255,255,0.48) !important;
  background: linear-gradient(145deg, rgba(255,255,255,0.42), rgba(255,255,255,0.22)) !important;
  box-shadow: 0 20px 54px rgba(15,23,42,0.145), 0 4px 16px rgba(15,23,42,0.06), inset 0 1px 0 rgba(255,255,255,0.64) !important;
  transform: none !important;
}

/* PROMPTCANVAS GLOBAL STATION TYPOGRAPHY + ACCENT + FOCUS RESTORE - 2026-06-16 */
:root,
html,
body {
  --font-body: Public Sans, Inter, Microsoft YaHei UI, PingFang SC, Segoe UI, sans-serif !important;
  --font-display: Public Sans, Inter, Microsoft YaHei UI, PingFang SC, Segoe UI, sans-serif !important;
  --station-accent-gradient: linear-gradient(to right, #4f46e5 0%, #d946ef 50%, #06b6d4 100%);
  --station-accent-solid: #7c3aed;
  --station-focus-ring: 0 0 0 3px rgba(79,70,229,0.18), 0 0 0 6px rgba(6,182,212,0.10), 0 10px 30px rgba(79,70,229,0.16);
}

body,
button,
input,
textarea,
select {
  font-family: var(--font-body) !important;
}

.brand-block h1 {
  display: inline-flex;
  width: fit-content;
  align-items: center;
  gap: 10px;
  margin: 0;
  padding: 8px 14px;
  border: 1px solid rgba(255,255,255,0.48);
  border-radius: 999px;
  background: rgba(255,255,255,0.28);
  box-shadow: 0 14px 36px rgba(15,23,42,0.12), inset 0 1px 0 rgba(255,255,255,0.62);
  backdrop-filter: blur(24px) saturate(145%);
  -webkit-backdrop-filter: blur(24px) saturate(145%);
  font-family: var(--font-body) !important;
  font-size: clamp(1.02rem, 1.2vw, 1.28rem) !important;
  font-weight: 600 !important;
  line-height: 1.18 !important;
  letter-spacing: -0.025em !important;
  color: #000000 !important;
  text-shadow: none !important;
}

.brand-block h1::before {
  width: 22px;
  height: 22px;
  flex: 0 0 auto;
  border-radius: 8px;
  content: ;
  background:
    radial-gradient(circle at 34% 26%, rgba(255,255,255,0.96), transparent 26%),
    var(--station-accent-gradient);
  box-shadow: 0 8px 18px rgba(79,70,229,0.22), inset 0 1px 0 rgba(255,255,255,0.72);
}

.brand-copy,
.meta-note,
.composer-tip,
.message-caption,
.status-label,
.composer-reference-tip,
.reference-meta span,
.message-meta,
.message-section-title,
.diagnostic-label,
.image-meta,
.image-card-label,
.reference-placeholder,
.field > span,
.control-card h2,
.card-head h2,
.thread-head h2,
.settings-panel h2,
.reference-meta strong,
.assist-prompt-heading,
.message-body,
.assist-prompt-text,
.status-grid strong,
.diagnostic-value,
input,
textarea,
select,
button {
  font-family: var(--font-body) !important;
  color: #000000 !important;
  text-shadow: none !important;
}

.primary-button,
.segment.is-active {
  color: transparent !important;
  background-image: var(--station-accent-gradient), linear-gradient(180deg, rgba(255,255,255,0.46), rgba(255,255,255,0.27)) !important;
  background-origin: border-box !important;
  background-clip: text, padding-box !important;
  -webkit-background-clip: text, padding-box !important;
  -webkit-text-fill-color: transparent !important;
  font-weight: 700 !important;
}

.primary-button:hover,
.segment.is-active:hover {
  background-image: var(--station-accent-gradient), linear-gradient(180deg, rgba(255,255,255,0.50), rgba(255,255,255,0.30)) !important;
  background-clip: text, padding-box !important;
  -webkit-background-clip: text, padding-box !important;
  -webkit-text-fill-color: transparent !important;
}

.segment:not(.is-active),
.ghost-button,
.secondary-button,
.reference-remove,
.reference-preview,
.theme-swatch,
.theme-popover-close {
  -webkit-text-fill-color: #000000 !important;
  color: #000000 !important;
  font-weight: 650 !important;
}

input:focus,
textarea:focus,
select:focus,
.github-link:focus-visible,
.ghost-button:focus-visible,
.secondary-button:focus-visible,
.primary-button:focus-visible,
.segment:focus-visible,
.reference-preview:focus-visible,
.reference-remove:focus-visible,
.theme-swatch:focus-visible,
.theme-popover-close:focus-visible {
  outline: none !important;
  border-color: rgba(79,70,229,0.54) !important;
  box-shadow: var(--station-focus-ring), inset 0 1px 0 rgba(255,255,255,0.66) !important;
}

input:focus,
textarea:focus,
select:focus {
  background: rgba(255,255,255,0.42) !important;
}

/* PROMPTCANVAS ACCENT BUTTON TEXT LEGIBILITY FIX - 2026-06-16 */
.primary-button,
.segment.is-active {
  color: #7c3aed !important;
  -webkit-text-fill-color: #7c3aed !important;
  background: linear-gradient(180deg, rgba(255,255,255,0.46), rgba(255,255,255,0.27)) !important;
  font-weight: 750 !important;
}

.primary-button:hover,
.segment.is-active:hover,
.primary-button:focus-visible,
.segment.is-active:focus-visible {
  color: #4f46e5 !important;
  -webkit-text-fill-color: #4f46e5 !important;
  background: linear-gradient(180deg, rgba(255,255,255,0.50), rgba(255,255,255,0.30)) !important;
}

/* PROMPTCANVAS PILL SHADOW + ACTION ACCENT + THEME BUTTON COLOR - 2026-06-16 */
:root,
html[data-theme=main-light] {
  --theme-button-bg: linear-gradient(135deg, rgba(254,247,231,0.72), rgba(234,246,255,0.58) 48%, rgba(245,237,255,0.62));
  --theme-button-shadow-color: rgba(124,58,237,0.14);
}
html[data-theme=main-violet] {
  --theme-button-bg: linear-gradient(135deg, rgba(196,181,253,0.72), rgba(147,197,253,0.48), rgba(217,70,239,0.28));
  --theme-button-shadow-color: rgba(124,58,237,0.20);
}
html[data-theme=main-cyan] {
  --theme-button-bg: linear-gradient(135deg, rgba(103,232,249,0.70), rgba(191,219,254,0.55), rgba(255,255,255,0.32));
  --theme-button-shadow-color: rgba(6,182,212,0.20);
}
html[data-theme=main-rose] {
  --theme-button-bg: linear-gradient(135deg, rgba(249,168,212,0.70), rgba(221,214,254,0.54), rgba(255,255,255,0.32));
  --theme-button-shadow-color: rgba(217,70,239,0.18);
}
html[data-theme=main-amber] {
  --theme-button-bg: linear-gradient(135deg, rgba(253,230,138,0.76), rgba(191,219,254,0.45), rgba(255,255,255,0.30));
  --theme-button-shadow-color: rgba(245,158,11,0.18);
}
html[data-theme=main-mint] {
  --theme-button-bg: linear-gradient(135deg, rgba(167,243,208,0.72), rgba(186,230,253,0.52), rgba(255,255,255,0.30));
  --theme-button-shadow-color: rgba(20,184,166,0.18);
}

.image-meta .pill,
.image-meta.is-compact .pill,
.pill {
  border: 1px solid rgba(255,255,255,0.58) !important;
  background: rgba(255,255,255,0.42) !important;
  box-shadow:
    0 10px 24px rgba(15,23,42,0.14),
    0 2px 7px rgba(15,23,42,0.08),
    inset 0 1px 0 rgba(255,255,255,0.70) !important;
  color: #000000 !important;
  font-weight: 650 !important;
}

#openThemeButton {
  background: var(--theme-button-bg) !important;
  box-shadow:
    0 12px 30px var(--theme-button-shadow-color),
    0 8px 22px rgba(15,23,42,0.13),
    inset 0 1px 0 rgba(255,255,255,0.70) !important;
  border-color: rgba(255,255,255,0.58) !important;
}

#openThemeButton:hover,
#openThemeButton:focus-visible {
  background: var(--theme-button-bg) !important;
  box-shadow:
    0 16px 40px var(--theme-button-shadow-color),
    0 10px 28px rgba(15,23,42,0.16),
    inset 0 1px 0 rgba(255,255,255,0.76) !important;
}

#openSettingsButton,
#clearThreadButton,
#clearReferenceImagesButton,
.message .secondary-button,
.message .ghost-button,
.reverse-actions .secondary-button,
.reverse-actions .ghost-button {
  color: #7c3aed !important;
  -webkit-text-fill-color: #7c3aed !important;
  font-weight: 750 !important;
}

#openSettingsButton:hover,
#clearThreadButton:hover,
#clearReferenceImagesButton:hover,
.message .secondary-button:hover,
.message .ghost-button:hover,
.reverse-actions .secondary-button:hover,
.reverse-actions .ghost-button:hover {
  color: #4f46e5 !important;
  -webkit-text-fill-color: #4f46e5 !important;
}

/* PROMPTCANVAS THEME BUTTON TEXT ACCENT - 2026-06-16 */
#openThemeButton,
#openThemeButton:hover,
#openThemeButton:focus-visible {
  color: #7c3aed !important;
  -webkit-text-fill-color: #7c3aed !important;
  font-weight: 750 !important;
}

#openThemeButton:hover,
#openThemeButton:focus-visible {
  color: #4f46e5 !important;
  -webkit-text-fill-color: #4f46e5 !important;
}


/* PROMPTCANVAS 10 DISTINCT THEMES + ICE-BLUE DEFAULT - 2026-06-16 */
:root, html[data-theme="main-cyan"] { --main-bg-a:#ecfeff;--main-bg-b:#dbeafe;--main-bg-c:#f8fbff;--main-glow-white:rgba(255,255,255,.78);--main-glow-cool:rgba(56,189,248,.34);--main-glow-warm:rgba(129,140,248,.12);--main-grid:rgba(14,165,233,.16);--main-image-overlay:rgba(240,253,255,.30);--station-accent-solid:#0284c7;--station-accent-hover:#0369a1;--station-focus-ring:0 0 0 3px rgba(2,132,199,.18),0 0 0 6px rgba(34,211,238,.10),0 10px 30px rgba(2,132,199,.16);--theme-button-bg:linear-gradient(135deg,rgba(103,232,249,.72),rgba(191,219,254,.56),rgba(255,255,255,.34));--theme-button-shadow-color:rgba(6,182,212,.22);}
html[data-theme="main-amber"]{--main-bg-a:#fff7ed;--main-bg-b:#fef3c7;--main-bg-c:#eff6ff;--main-glow-white:rgba(255,255,255,.76);--main-glow-cool:rgba(96,165,250,.14);--main-glow-warm:rgba(251,191,36,.34);--main-grid:rgba(245,158,11,.16);--main-image-overlay:rgba(255,251,235,.28);--station-accent-solid:#d97706;--station-accent-hover:#b45309;--station-focus-ring:0 0 0 3px rgba(217,119,6,.18),0 0 0 6px rgba(251,191,36,.10),0 10px 30px rgba(217,119,6,.15);--theme-button-bg:linear-gradient(135deg,rgba(253,230,138,.78),rgba(251,191,36,.40),rgba(255,255,255,.32));--theme-button-shadow-color:rgba(245,158,11,.22);}
html[data-theme="theme-dark-purple"]{--main-bg-a:#12071f;--main-bg-b:#2e1065;--main-bg-c:#111827;--main-glow-white:rgba(255,255,255,.10);--main-glow-cool:rgba(34,211,238,.16);--main-glow-warm:rgba(168,85,247,.38);--main-grid:rgba(216,180,254,.12);--main-image-overlay:rgba(36,20,64,.44);--station-accent-solid:#c084fc;--station-accent-hover:#67e8f9;--station-focus-ring:0 0 0 3px rgba(192,132,252,.28),0 0 0 6px rgba(103,232,249,.12),0 12px 34px rgba(192,132,252,.22);--theme-button-bg:linear-gradient(135deg,rgba(88,28,135,.72),rgba(192,132,252,.34),rgba(34,211,238,.20));--theme-button-shadow-color:rgba(192,132,252,.28);}
html[data-theme="theme-emerald"]{--main-bg-a:#ecfdf5;--main-bg-b:#dcfce7;--main-bg-c:#f0fdfa;--main-glow-white:rgba(255,255,255,.76);--main-glow-cool:rgba(20,184,166,.22);--main-glow-warm:rgba(34,197,94,.28);--main-grid:rgba(16,185,129,.16);--main-image-overlay:rgba(240,253,250,.28);--station-accent-solid:#059669;--station-accent-hover:#047857;--station-focus-ring:0 0 0 3px rgba(5,150,105,.18),0 0 0 6px rgba(45,212,191,.10),0 10px 30px rgba(5,150,105,.15);--theme-button-bg:linear-gradient(135deg,rgba(167,243,208,.76),rgba(34,197,94,.32),rgba(186,230,253,.34));--theme-button-shadow-color:rgba(16,185,129,.22);}
html[data-theme="theme-pink"]{--main-bg-a:#fff1f2;--main-bg-b:#fce7f3;--main-bg-c:#f5f3ff;--main-glow-white:rgba(255,255,255,.77);--main-glow-cool:rgba(168,85,247,.16);--main-glow-warm:rgba(244,114,182,.34);--main-grid:rgba(236,72,153,.15);--main-image-overlay:rgba(255,245,248,.30);--station-accent-solid:#db2777;--station-accent-hover:#be185d;--station-focus-ring:0 0 0 3px rgba(219,39,119,.18),0 0 0 6px rgba(244,114,182,.10),0 10px 30px rgba(219,39,119,.15);--theme-button-bg:linear-gradient(135deg,rgba(249,168,212,.76),rgba(236,72,153,.28),rgba(221,214,254,.40));--theme-button-shadow-color:rgba(219,39,119,.20);}
html[data-theme="theme-claude"]{--main-bg-a:#fff7ed;--main-bg-b:#fed7aa;--main-bg-c:#fef3c7;--main-glow-white:rgba(255,255,255,.74);--main-glow-cool:rgba(120,113,108,.10);--main-glow-warm:rgba(234,88,12,.34);--main-grid:rgba(194,65,12,.15);--main-image-overlay:rgba(255,247,237,.28);--station-accent-solid:#c2410c;--station-accent-hover:#9a3412;--station-focus-ring:0 0 0 3px rgba(194,65,12,.18),0 0 0 6px rgba(251,146,60,.10),0 10px 30px rgba(194,65,12,.15);--theme-button-bg:linear-gradient(135deg,rgba(251,146,60,.76),rgba(217,119,6,.32),rgba(255,255,255,.28));--theme-button-shadow-color:rgba(194,65,12,.22);}
html[data-theme="theme-ocean"]{--main-bg-a:#e0f2fe;--main-bg-b:#0f766e;--main-bg-c:#0f172a;--main-glow-white:rgba(255,255,255,.42);--main-glow-cool:rgba(56,189,248,.34);--main-glow-warm:rgba(20,184,166,.24);--main-grid:rgba(125,211,252,.16);--main-image-overlay:rgba(8,47,73,.26);--station-accent-solid:#0891b2;--station-accent-hover:#0e7490;--station-focus-ring:0 0 0 3px rgba(8,145,178,.20),0 0 0 6px rgba(45,212,191,.10),0 10px 30px rgba(8,145,178,.18);--theme-button-bg:linear-gradient(135deg,rgba(125,211,252,.72),rgba(20,184,166,.36),rgba(15,23,42,.18));--theme-button-shadow-color:rgba(8,145,178,.24);}
html[data-theme="theme-lime"]{--main-bg-a:#f7fee7;--main-bg-b:#d9f99d;--main-bg-c:#ecfccb;--main-glow-white:rgba(255,255,255,.76);--main-glow-cool:rgba(20,184,166,.13);--main-glow-warm:rgba(132,204,22,.34);--main-grid:rgba(101,163,13,.15);--main-image-overlay:rgba(247,254,231,.28);--station-accent-solid:#65a30d;--station-accent-hover:#4d7c0f;--station-focus-ring:0 0 0 3px rgba(101,163,13,.18),0 0 0 6px rgba(190,242,100,.12),0 10px 30px rgba(101,163,13,.15);--theme-button-bg:linear-gradient(135deg,rgba(190,242,100,.78),rgba(132,204,22,.36),rgba(255,255,255,.30));--theme-button-shadow-color:rgba(101,163,13,.20);}
html[data-theme="theme-graphite"]{--main-bg-a:#f8fafc;--main-bg-b:#e2e8f0;--main-bg-c:#cbd5e1;--main-glow-white:rgba(255,255,255,.76);--main-glow-cool:rgba(100,116,139,.20);--main-glow-warm:rgba(148,163,184,.18);--main-grid:rgba(71,85,105,.14);--main-image-overlay:rgba(248,250,252,.25);--station-accent-solid:#475569;--station-accent-hover:#334155;--station-focus-ring:0 0 0 3px rgba(71,85,105,.18),0 0 0 6px rgba(148,163,184,.10),0 10px 30px rgba(71,85,105,.15);--theme-button-bg:linear-gradient(135deg,rgba(226,232,240,.78),rgba(100,116,139,.26),rgba(255,255,255,.30));--theme-button-shadow-color:rgba(71,85,105,.18);}
html[data-theme="theme-sunset"]{--main-bg-a:#fff7ed;--main-bg-b:#fecaca;--main-bg-c:#fde68a;--main-glow-white:rgba(255,255,255,.74);--main-glow-cool:rgba(244,114,182,.16);--main-glow-warm:rgba(249,115,22,.36);--main-grid:rgba(239,68,68,.14);--main-image-overlay:rgba(255,247,237,.28);--station-accent-solid:#e11d48;--station-accent-hover:#be123c;--station-focus-ring:0 0 0 3px rgba(225,29,72,.18),0 0 0 6px rgba(251,146,60,.10),0 10px 30px rgba(225,29,72,.15);--theme-button-bg:linear-gradient(135deg,rgba(251,146,60,.74),rgba(244,63,94,.34),rgba(253,224,71,.30));--theme-button-shadow-color:rgba(225,29,72,.20);}
.primary-button,.segment.is-active,#openThemeButton,#openSettingsButton,#clearThreadButton,#clearReferenceImagesButton,.message .secondary-button,.message .ghost-button,.reverse-actions .secondary-button,.reverse-actions .ghost-button{color:var(--station-accent-solid)!important;-webkit-text-fill-color:var(--station-accent-solid)!important}.primary-button:hover,.segment.is-active:hover,.primary-button:focus-visible,.segment.is-active:focus-visible,#openThemeButton:hover,#openThemeButton:focus-visible,#openSettingsButton:hover,#clearThreadButton:hover,#clearReferenceImagesButton:hover,.message .secondary-button:hover,.message .ghost-button:hover,.reverse-actions .secondary-button:hover,.reverse-actions .ghost-button:hover{color:var(--station-accent-hover)!important;-webkit-text-fill-color:var(--station-accent-hover)!important}.theme-grid{grid-template-columns:repeat(2,minmax(0,1fr))}.theme-swatch[data-theme="main-cyan"] span{background:linear-gradient(135deg,#67e8f9,#bfdbfe)}.theme-swatch[data-theme="main-amber"] span{background:linear-gradient(135deg,#fde68a,#f59e0b)}.theme-swatch[data-theme="theme-dark-purple"] span{background:linear-gradient(135deg,#2e1065,#c084fc,#22d3ee)}.theme-swatch[data-theme="theme-emerald"] span{background:linear-gradient(135deg,#bbf7d0,#10b981)}.theme-swatch[data-theme="theme-pink"] span{background:linear-gradient(135deg,#f9a8d4,#db2777,#ddd6fe)}.theme-swatch[data-theme="theme-claude"] span{background:linear-gradient(135deg,#fed7aa,#c2410c)}.theme-swatch[data-theme="theme-ocean"] span{background:linear-gradient(135deg,#7dd3fc,#0f766e,#0f172a)}.theme-swatch[data-theme="theme-lime"] span{background:linear-gradient(135deg,#bef264,#65a30d)}.theme-swatch[data-theme="theme-graphite"] span{background:linear-gradient(135deg,#f8fafc,#64748b)}.theme-swatch[data-theme="theme-sunset"] span{background:linear-gradient(135deg,#fb923c,#e11d48,#fde68a)}
html[data-theme="theme-dark-purple"] body,html[data-theme="theme-dark-purple"] body *:not(svg):not(path):not(.primary-button):not(.segment.is-active):not(#openThemeButton):not(#openSettingsButton):not(#clearThreadButton):not(#clearReferenceImagesButton):not(.secondary-button):not(.ghost-button){color:#f8f7ff!important;-webkit-text-fill-color:#f8f7ff!important}html[data-theme="theme-dark-purple"] .brand-block h1,html[data-theme="theme-dark-purple"] input,html[data-theme="theme-dark-purple"] textarea,html[data-theme="theme-dark-purple"] select,html[data-theme="theme-dark-purple"] .pill,html[data-theme="theme-dark-purple"] .diagnostic-value{color:#f8f7ff!important;-webkit-text-fill-color:#f8f7ff!important}html[data-theme="theme-dark-purple"] .sidebar,html[data-theme="theme-dark-purple"] .main-panel,html[data-theme="theme-dark-purple"] .settings-panel,html[data-theme="theme-dark-purple"] .control-card,html[data-theme="theme-dark-purple"] .composer,html[data-theme="theme-dark-purple"] .message,html[data-theme="theme-dark-purple"] .theme-popover,html[data-theme="theme-dark-purple"] input,html[data-theme="theme-dark-purple"] textarea,html[data-theme="theme-dark-purple"] select{border-color:rgba(255,255,255,.18)!important;background:linear-gradient(145deg,rgba(30,20,55,.58),rgba(17,24,39,.34))!important}html[data-theme="theme-dark-purple"] .brand-block h1,html[data-theme="theme-dark-purple"] #openThemeButton,html[data-theme="theme-dark-purple"] .ghost-button,html[data-theme="theme-dark-purple"] .secondary-button,html[data-theme="theme-dark-purple"] .segment,html[data-theme="theme-dark-purple"] .primary-button,html[data-theme="theme-dark-purple"] .theme-swatch{background:linear-gradient(180deg,rgba(255,255,255,.18),rgba(255,255,255,.08))!important;border-color:rgba(255,255,255,.22)!important}html[data-theme="theme-dark-purple"] #openThemeButton{background:var(--theme-button-bg)!important}


/* PROMPTCANVAS REMOVE DARK PURPLE + OCEAN DEFAULT - 2026-06-16 */
html[data-theme=theme-dark-purple] {
  --main-bg-a:#e0f2fe; --main-bg-b:#0f766e; --main-bg-c:#0f172a;
  --main-glow-white:rgba(255,255,255,.42); --main-glow-cool:rgba(56,189,248,.34); --main-glow-warm:rgba(20,184,166,.24);
  --main-grid:rgba(125,211,252,.16); --main-image-overlay:rgba(8,47,73,.26);
  --station-accent-solid:#0891b2; --station-accent-hover:#0e7490;
  --station-focus-ring:0 0 0 3px rgba(8,145,178,.20),0 0 0 6px rgba(45,212,191,.10),0 10px 30px rgba(8,145,178,.18);
  --theme-button-bg:linear-gradient(135deg,rgba(125,211,252,.72),rgba(20,184,166,.36),rgba(15,23,42,.18));
  --theme-button-shadow-color:rgba(8,145,178,.24);
}

/* PROMPTCANVAS OCEAN DEFAULT VISUAL FIX - 2026-06-16 */
html[data-theme=theme-ocean] {
  --main-bg-a: #dff7ff;
  --main-bg-b: #0e7490;
  --main-bg-c: #082f49;
  --main-glow-white: rgba(255,255,255,0.34);
  --main-glow-cool: rgba(34,211,238,0.42);
  --main-glow-warm: rgba(20,184,166,0.32);
  --main-grid: rgba(125,211,252,0.20);
  --main-image-overlay: rgba(8,47,73,0.34);
  --station-accent-solid: #0891b2;
  --station-accent-hover: #0e7490;
  --theme-button-bg: linear-gradient(135deg, rgba(125,211,252,0.78), rgba(20,184,166,0.42), rgba(8,47,73,0.24));
  --theme-button-shadow-color: rgba(8,145,178,0.28);
}

html[data-theme=theme-ocean] .theme-swatch[data-theme=theme-ocean] {
  border-color: rgba(8,145,178,0.48) !important;
  background: linear-gradient(135deg, rgba(125,211,252,0.56), rgba(20,184,166,0.28), rgba(255,255,255,0.34)) !important;
  box-shadow: 0 0 0 2px rgba(8,145,178,0.16), 0 12px 28px rgba(8,145,178,0.18), inset 0 1px 0 rgba(255,255,255,0.74) !important;
}

html[data-theme=theme-ocean] .sidebar,
html[data-theme=theme-ocean] .main-panel,
html[data-theme=theme-ocean] .settings-panel {
  background: linear-gradient(180deg, rgba(255,255,255,0.50), rgba(224,242,254,0.25)) !important;
  box-shadow: 0 28px 80px rgba(8,47,73,0.18), 0 8px 24px rgba(8,145,178,0.08), inset 0 1px 0 rgba(255,255,255,0.62) !important;
}


/* PROMPTCANVAS TITLE GRADIENT + COMPOSER LAYOUT + INSET THREAD - 2026-06-16 */
.brand-block h1 {
  background-image: linear-gradient(90deg, #4f46e5 0%, #7c3aed 28%, #d946ef 56%, #06b6d4 100%) !important;
  background-clip: text !important;
  -webkit-background-clip: text !important;
  color: transparent !important;
  -webkit-text-fill-color: transparent !important;
}
.thread-head.is-compact { display: none !important; }
.thread {
  border: 1px solid rgba(255,255,255,0.34) !important;
  border-radius: 22px !important;
  background: linear-gradient(145deg, rgba(255,255,255,0.22), rgba(255,255,255,0.10)) !important;
  box-shadow: inset 0 2px 8px rgba(15,23,42,0.10), inset 0 -1px 0 rgba(255,255,255,0.45), 0 14px 38px rgba(8,47,73,0.08) !important;
  padding: clamp(10px, 1vw, 14px) !important;
}
.composer-reference-head { align-items: flex-start !important; gap: 10px !important; }
.composer-upload-button { flex: 0 0 auto; color: var(--station-accent-solid) !important; -webkit-text-fill-color: var(--station-accent-solid) !important; font-weight: 750 !important; }
.composer-reference-tip { flex: 1 1 auto; min-width: 160px; padding-top: 7px; }
.composer-reference-actions { display: flex; flex: 0 0 auto; gap: 8px; align-items: center; justify-content: flex-end; flex-wrap: wrap; }
.composer-thread-clear, .composer-reference-clear, .composer-upload-button { min-height: 36px; padding: 7px 13px; }
.composer-upload-button:hover, .composer-upload-button:focus-visible, .composer-thread-clear:hover, .composer-thread-clear:focus-visible { color: var(--station-accent-hover) !important; -webkit-text-fill-color: var(--station-accent-hover) !important; }
@media (max-width: 760px) { .composer-reference-head, .composer-reference-actions { align-items: stretch !important; flex-direction: column; } .composer-reference-tip { padding-top: 0; } }


/* PROMPTCANVAS THREAD/COMPOSER SEPARATION + REMOVE BRAND COPY - 2026-06-16 */
.brand-copy { display: none !important; }
.main-panel {
  gap: 14px !important;
}
.thread {
  box-sizing: border-box !important;
  height: auto !important;
  max-height: none !important;
  min-height: 0 !important;
  margin: 0 !important;
  overflow-y: auto !important;
  align-self: stretch !important;
}
.composer {
  position: relative !important;
  z-index: 2 !important;
  margin-top: 0 !important;
}


/* PROMPTCANVAS HARD FIX: THREAD MUST NOT UNDERLAP COMPOSER - 2026-06-16 */
.main-panel {
  display: grid !important;
  grid-template-rows: minmax(0, 1fr) auto !important;
  gap: 14px !important;
  overflow: hidden !important;
}
.thread-head.is-compact {
  display: none !important;
}
.thread {
  grid-row: 1 !important;
  min-height: 0 !important;
  height: auto !important;
  max-height: none !important;
  align-self: stretch !important;
  overflow-y: auto !important;
  overflow-x: hidden !important;
  scroll-padding-block-end: 24px !important;
  padding-bottom: 24px !important;
}
.composer {
  grid-row: 2 !important;
  align-self: end !important;
  margin-top: 0 !important;
  z-index: 2 !important;
}

/* PROMPTCANVAS CENTER BRAND TITLE - 2026-06-16 */
.brand-block h1 {
  text-align: center !important;
  width: 100% !important;
  display: block !important;
}


/* PROMPTCANVAS REFERENCE FILE INPUT - 2026-06-16 */
.visually-hidden-file-input {
  position: fixed !important;
  inline-size: 1px !important;
  block-size: 1px !important;
  opacity: 0 !important;
  pointer-events: none !important;
  inset-inline-start: -9999px !important;
  inset-block-start: auto !important;
}


/* Desktop settings dialog actions moved into the header. */
.settings-head-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  flex-wrap: wrap;
}

.settings-head-actions .secondary-button,
.settings-head-actions .primary-button,
.settings-head-actions .ghost-button {
  min-height: 34px;
  padding: 0 12px;
  border-radius: 999px;
}

.settings-actions:empty {
  display: none !important;
}

@media (max-width: 640px) {
  .settings-head-actions {
    width: 100%;
    justify-content: flex-start;
  }
}

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