:root {
  color-scheme: light;
  --bg: #f4f6fb;
  --surface: #ffffff;
  --surface-soft: #f8fafc;
  --surface-strong: #eef3ff;
  --border: #d9e2f2;
  --border-strong: #c4d0e4;
  --text: #111827;
  --muted: #64748b;
  --primary: #1d4ed8;
  --primary-strong: #173c99;
  --accent: #0f766e;
  --success: #047857;
  --danger: #b42318;
  --shadow: 0 18px 48px rgba(20, 37, 63, 0.1);
  --page-gutter: 28px;
  --panel-pad: 22px;
}

/* Pawprint Studio visual system */
:root {
  --bg: #eee6d5;
  --surface: #fffaf0;
  --surface-soft: #f8f1e3;
  --surface-strong: #efe2ca;
  --border: rgba(103, 82, 55, 0.2);
  --border-strong: rgba(103, 82, 55, 0.34);
  --text: #28231b;
  --muted: #766d5f;
  --primary: #7c2f22;
  --primary-strong: #5e2119;
  --accent: #2d5c55;
  --success: #3e6d4a;
  --danger: #9b2f26;
  --shadow: 0 18px 48px rgba(64, 49, 31, 0.13);
  --paper-texture: url("/assets/pawprint-soft-texture.webp");
  --ink-landscape: url("/assets/pawprint-pet-landscape.webp");
  --serif: "Songti SC", "STSong", "SimSun", "Noto Serif CJK SC", serif;
}

body {
  background:
    linear-gradient(180deg, rgba(250, 246, 235, 0.82), rgba(238, 230, 213, 0.9)),
    var(--paper-texture),
    var(--bg);
  color: var(--text);
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  background:
    linear-gradient(90deg, rgba(250, 246, 235, 0.88), rgba(250, 246, 235, 0.58), rgba(250, 246, 235, 0.86)),
    var(--ink-landscape) center top / cover no-repeat;
  opacity: 0.6;
}

button {
  border-radius: 8px;
  background: var(--primary);
  color: #fffaf0;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.16);
}

button:hover {
  background: var(--primary-strong);
}

.secondary-button,
.icon-button,
.mobile-header-button,
.sample-chip,
.media-action,
.download-choice-close {
  background: rgba(255, 250, 240, 0.82);
  color: var(--text);
}

.secondary-button:hover,
.icon-button:hover,
.mobile-header-button:hover,
.sample-chip:hover,
.media-action:hover,
.download-choice-close:hover {
  background: #f3ead9;
}

.eyebrow {
  color: var(--accent);
  font-size: 11px;
  letter-spacing: 0;
}

h1,
h2,
.auth-brand h1,
.brand-lockup h1,
.chat-empty p {
  font-family: var(--serif);
  font-weight: 700;
}

h1 {
  font-size: 38px;
}

.panel {
  border-color: var(--border);
  border-radius: 8px;
  background:
    linear-gradient(180deg, rgba(255, 252, 244, 0.92), rgba(250, 244, 232, 0.9)),
    var(--paper-texture);
  box-shadow: var(--shadow);
}

.field input,
.field select,
.field textarea,
.composer-field textarea,
.field .pill-control,
.custom-size-input input,
.composer-settings .pill-control {
  border-color: var(--border);
  background: rgba(255, 252, 244, 0.9);
  color: var(--text);
}

.field input:focus,
.field select:focus,
.field textarea:focus,
.composer-field textarea:focus {
  border-color: rgba(124, 47, 34, 0.58);
  box-shadow: 0 0 0 4px rgba(124, 47, 34, 0.12);
}

.auth-shell {
  width: min(1120px, calc(100% - var(--page-gutter)));
}

.auth-screen {
  grid-template-columns: minmax(0, 1.08fr) minmax(320px, 410px);
}

.auth-brand {
  position: relative;
  min-height: 460px;
  display: grid;
  align-content: center;
  border: 1px solid rgba(103, 82, 55, 0.16);
  border-radius: 8px;
  background:
    linear-gradient(90deg, rgba(250, 246, 235, 0.28), rgba(250, 246, 235, 0.76)),
    var(--ink-landscape) center / cover no-repeat;
  padding: 46px;
  overflow: hidden;
}

.auth-brand::after,
.brand-lockup::after {
  content: "";
  width: 32px;
  height: 32px;
  display: block;
  border: 2px solid rgba(124, 47, 34, 0.72);
  border-radius: 6px;
  opacity: 0.8;
}

.auth-brand::after {
  margin-top: 18px;
}

.auth-brand h1 {
  color: #2b241b;
  font-size: clamp(44px, 6vw, 72px);
  line-height: 1;
}

.auth-card {
  background:
    linear-gradient(180deg, rgba(255, 252, 244, 0.95), rgba(248, 241, 227, 0.94)),
    var(--paper-texture);
}

.app-shell {
  width: min(1480px, calc(100% - var(--page-gutter)));
  padding: 18px 0;
}

.app-header {
  position: relative;
  min-height: 72px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background:
    linear-gradient(90deg, rgba(255, 252, 244, 0.92), rgba(255, 252, 244, 0.74)),
    var(--ink-landscape) center 42% / cover no-repeat;
  box-shadow: 0 12px 34px rgba(64, 49, 31, 0.1);
  padding: 13px 18px;
}

.brand-lockup {
  display: grid;
  grid-template-columns: auto auto;
  align-items: center;
  column-gap: 12px;
}

.brand-lockup .eyebrow {
  grid-column: 1 / -1;
}

.brand-lockup h1 {
  font-size: 30px;
}

.brand-lockup::after {
  width: 24px;
  height: 24px;
}

.status-pill {
  background: rgba(248, 241, 227, 0.86);
  color: var(--accent);
}

.status-pill.ok {
  background: rgba(62, 109, 74, 0.1);
  color: var(--success);
}

.user-box {
  border: 1px solid var(--border);
  border-radius: 8px;
  background: rgba(255, 250, 240, 0.72);
  padding: 8px 8px 8px 12px;
}

.studio-workspace {
  grid-template-columns: 282px minmax(0, 1fr);
}

.history-panel {
  max-height: none;
}

.panel-heading {
  padding-bottom: 8px;
  border-bottom: 1px solid rgba(103, 82, 55, 0.14);
}

.conversation-list {
  max-height: min(64dvh, 620px);
  gap: 10px;
}

.conversation-item {
  border-color: rgba(103, 82, 55, 0.18);
  border-radius: 8px;
  background: rgba(255, 252, 244, 0.78);
}

.conversation-item:hover,
.conversation-item.active {
  border-color: rgba(124, 47, 34, 0.36);
  background: rgba(244, 232, 211, 0.78);
}

.conversation-small-action,
.conversation-delete {
  border-color: rgba(103, 82, 55, 0.18);
  background: rgba(255, 250, 240, 0.86);
  color: var(--accent);
}

.conversation-delete {
  color: var(--danger);
}

.chat-panel {
  background:
    linear-gradient(180deg, rgba(255, 252, 244, 0.92), rgba(248, 241, 227, 0.86)),
    var(--paper-texture);
}

.chat-topline {
  border-bottom-color: rgba(103, 82, 55, 0.16);
  padding: 13px var(--panel-pad);
}

.conversation-log {
  gap: 16px;
  background:
    radial-gradient(circle at 16% 12%, rgba(124, 47, 34, 0.05), transparent 28%),
    radial-gradient(circle at 84% 80%, rgba(45, 92, 85, 0.06), transparent 30%);
}

.chat-empty {
  width: min(620px, 100%);
}

.chat-empty p {
  color: #332a20;
  font-size: clamp(28px, 4vw, 48px);
}

.sample-chip {
  border-color: rgba(103, 82, 55, 0.18);
  color: #403729;
}

.message-avatar {
  border-color: rgba(103, 82, 55, 0.22);
  border-radius: 8px;
  background: rgba(255, 250, 240, 0.9);
  color: var(--primary);
  font-family: var(--serif);
}

.message.user .message-avatar {
  background: var(--primary);
  color: #fff7e8;
}

.message-meta {
  color: rgba(118, 109, 95, 0.82);
}

.message-bubble {
  border-color: rgba(103, 82, 55, 0.18);
  border-radius: 8px;
  background:
    linear-gradient(180deg, rgba(255, 252, 244, 0.9), rgba(248, 241, 227, 0.86)),
    var(--paper-texture);
}

.message.user .message-bubble {
  border-color: rgba(124, 47, 34, 0.22);
  background: #f3e6d0;
  color: #32261d;
}

.prompt-tag {
  border-color: rgba(103, 82, 55, 0.18);
  background: rgba(255, 250, 240, 0.76);
  color: var(--muted);
}

.composer-wrap {
  border-top-color: rgba(103, 82, 55, 0.16);
  background:
    linear-gradient(180deg, rgba(248, 241, 227, 0.95), rgba(240, 229, 210, 0.96)),
    var(--paper-texture);
}

.composer-settings {
  gap: 7px;
}

.composer-settings .field > span,
.field span,
.user-box span {
  color: var(--muted);
}

.composer-settings select.pill-control {
  background-color: rgba(255, 252, 244, 0.92);
  background-image:
    linear-gradient(45deg, transparent 50%, #756854 50%),
    linear-gradient(135deg, #756854 50%, transparent 50%);
}

.composer-advanced summary,
.upload-reference-button {
  border-color: var(--border);
  background: rgba(255, 252, 244, 0.9);
  color: var(--text);
}

.composer-field textarea {
  border-color: rgba(103, 82, 55, 0.24);
  background: rgba(255, 252, 244, 0.96);
}

.send-button {
  background: var(--primary);
}

.cancel-button {
  border-color: rgba(155, 47, 38, 0.26);
  background: rgba(155, 47, 38, 0.08);
}

.progress-box,
.result-notice {
  border-color: rgba(103, 82, 55, 0.18);
  background: rgba(255, 252, 244, 0.86);
}

.progress-track {
  background: rgba(103, 82, 55, 0.13);
}

.progress-track span {
  background: linear-gradient(90deg, var(--accent), var(--primary));
}

.result-notice.success {
  border-color: rgba(62, 109, 74, 0.24);
  background: rgba(62, 109, 74, 0.08);
}

.media-card {
  border-color: rgba(103, 82, 55, 0.2);
  border-radius: 8px;
  background: rgba(255, 252, 244, 0.94);
  box-shadow: 0 14px 34px rgba(64, 49, 31, 0.1);
}

.media-card img,
.media-card video {
  background: #f1eadc;
}

.media-card-meta {
  background:
    linear-gradient(180deg, rgba(255, 252, 244, 0.9), rgba(246, 237, 220, 0.9)),
    var(--paper-texture);
}

.media-action.primary,
.download-choice-option.primary {
  border-color: rgba(124, 47, 34, 0.26);
  background: rgba(124, 47, 34, 0.1);
  color: var(--primary-strong);
}

.download-choice-overlay {
  background: rgba(40, 35, 27, 0.36);
}

.download-choice-dialog {
  border-radius: 8px;
  background:
    linear-gradient(180deg, rgba(255, 252, 244, 0.98), rgba(248, 241, 227, 0.98)),
    var(--paper-texture);
}

.download-choice-header h2 {
  font-family: var(--serif);
}

@media (max-width: 860px) {
  body {
    background:
      linear-gradient(180deg, rgba(250, 246, 235, 0.92), rgba(238, 230, 213, 0.94)),
      var(--paper-texture),
      var(--bg);
  }

  body::before {
    opacity: 0.32;
    background-position: 48% top;
  }

  .app-header {
    border-right: 0;
    border-left: 0;
    border-radius: 0;
    background:
      linear-gradient(90deg, rgba(255, 252, 244, 0.96), rgba(255, 252, 244, 0.82)),
      var(--ink-landscape) center / cover no-repeat;
  }

  .brand-lockup h1 {
    font-size: 23px;
  }

  .studio-sidebar {
    top: calc(62px + env(safe-area-inset-top));
  }

  .history-panel {
    border-radius: 8px;
    background:
      linear-gradient(180deg, rgba(255, 252, 244, 0.98), rgba(248, 241, 227, 0.98)),
      var(--paper-texture);
  }

  .chat-panel {
    background:
      linear-gradient(180deg, rgba(255, 252, 244, 0.74), rgba(248, 241, 227, 0.9)),
      var(--paper-texture);
  }

  .conversation-log {
    padding-top: 18px;
  }

  .composer-wrap {
    background:
      linear-gradient(180deg, rgba(248, 241, 227, 0.96), rgba(238, 226, 205, 0.98)),
      var(--paper-texture);
  }

  .composer-hint {
    display: none;
  }
}

@media (max-width: 560px) {
  h1 {
    font-size: 32px;
  }

  .auth-brand {
    min-height: 230px;
    padding: 28px;
  }

  .message,
  .message.user {
    grid-template-columns: 32px minmax(0, 1fr);
  }

  .message.user {
    grid-template-columns: minmax(0, 1fr) 32px;
  }

  .message-avatar,
  .message.user .message-avatar {
    border-radius: 8px;
  }

  .message-bubble,
  .message.user .message-bubble {
    border-radius: 8px;
  }

  .sample-chip {
    min-height: 38px;
  }
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

body {
  margin: 0;
  min-height: 100dvh;
  overflow-x: hidden;
  background:
    linear-gradient(180deg, rgba(233, 238, 249, 0.9), transparent 340px),
    var(--bg);
  color: var(--text);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

button,
input,
select,
textarea {
  font: inherit;
  font-size: 16px;
}

button {
  min-height: 44px;
  border: 0;
  border-radius: 8px;
  background: var(--primary);
  color: #fff;
  padding: 0 16px;
  font-weight: 800;
  cursor: pointer;
  touch-action: manipulation;
  transition: transform 140ms ease, background 140ms ease, opacity 140ms ease;
}

button:hover {
  background: var(--primary-strong);
}

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

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

.secondary-button {
  min-height: 38px;
  border: 1px solid var(--border);
  background: #fff;
  color: var(--text);
}

.secondary-button:hover {
  background: var(--surface-strong);
}

.icon-button {
  width: 38px;
  min-width: 38px;
  min-height: 38px;
  padding: 0;
  border: 1px solid var(--border);
  background: #fff;
  color: var(--primary);
  font-size: 22px;
  line-height: 1;
}

.icon-button:hover {
  background: var(--surface-strong);
}

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

.eyebrow {
  margin: 0 0 6px;
  color: var(--primary);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0;
  text-transform: uppercase;
}

h1,
h2 {
  margin: 0;
  letter-spacing: 0;
}

h1 {
  font-size: 34px;
  line-height: 1.05;
}

h2 {
  font-size: 22px;
  line-height: 1.2;
}

.panel {
  border: 1px solid var(--border);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.96);
  box-shadow: var(--shadow);
}

.panel-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
}

.field {
  display: grid;
  gap: 8px;
}

.field span,
.user-box span {
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

.field input,
.field select,
.field textarea,
.composer-field textarea {
  width: 100%;
  min-height: 44px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #fff;
  color: var(--text);
  padding: 11px 12px;
  outline: none;
  transition: border-color 160ms ease, box-shadow 160ms ease;
}

.field .pill-control,
.custom-size-input input {
  border-radius: 999px;
  border-color: #dedbd8;
  background: #fff;
  color: #3d3935;
  font-weight: 800;
  box-shadow: 0 1px 0 rgba(17, 24, 39, 0.03);
}

.field textarea,
.composer-field textarea {
  min-width: 0;
  resize: vertical;
  line-height: 1.55;
}

.field input:focus,
.field select:focus,
.field textarea:focus,
.composer-field textarea:focus {
  border-color: rgba(29, 78, 216, 0.72);
  box-shadow: 0 0 0 4px rgba(29, 78, 216, 0.12);
}

.grid-two {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

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

.custom-size-panel {
  display: grid;
  gap: 8px;
}

.custom-size-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr) auto;
  align-items: end;
  gap: 8px;
}

.custom-size-input {
  display: grid;
  gap: 5px;
  min-width: 0;
}

.custom-size-input span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.custom-size-input input {
  min-height: 40px;
  padding: 8px 12px;
}

.size-times {
  padding-bottom: 10px;
  color: var(--muted);
  font-weight: 900;
}

.size-help-wrap {
  position: relative;
  display: inline-flex;
  align-items: center;
  padding-bottom: 1px;
}

.size-help-button {
  width: 40px;
  min-width: 40px;
  min-height: 40px;
  border: 1px solid #dedbd8;
  border-radius: 999px;
  background: #fff;
  color: #8a817a;
  padding: 0;
  font-size: 20px;
  font-weight: 900;
  line-height: 1;
}

.size-help-button:hover,
.size-help-button[aria-expanded="true"] {
  background: #fbfaf8;
  color: var(--text);
}

.size-help-popover {
  position: absolute;
  right: calc(100% + 10px);
  left: auto;
  bottom: 0;
  z-index: 10;
  width: min(280px, 78vw);
  display: grid;
  gap: 7px;
  border: 1px solid #dedbd8;
  border-radius: 8px;
  background: #fff;
  box-shadow: 0 18px 42px rgba(20, 37, 63, 0.16);
  color: var(--text);
  padding: 12px;
  font-size: 13px;
  line-height: 1.4;
}

.size-help-popover strong {
  font-size: 14px;
}

.size-help-popover span {
  color: var(--text);
  font-size: 13px;
  font-weight: 700;
}

.field-help {
  min-height: 18px;
  margin: 0;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  line-height: 1.45;
}

.field-help.error {
  color: var(--danger);
}

.field-help.success {
  color: var(--success);
}

.auth-shell {
  min-height: 100dvh;
  display: grid;
  place-items: center;
  width: min(1040px, calc(100% - var(--page-gutter)));
  margin: 0 auto;
  padding: 40px 0;
}

.auth-screen {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(320px, 420px);
  align-items: center;
  gap: 48px;
  width: 100%;
}

.auth-brand {
  max-width: 560px;
}

.auth-card {
  display: grid;
  gap: 16px;
  padding: var(--panel-pad);
}

.form-message {
  min-height: 22px;
  margin: 0;
  color: var(--muted);
  font-size: 14px;
  font-weight: 700;
}

.form-message.error {
  color: var(--danger);
}

.app-shell {
  width: min(1440px, calc(100% - var(--page-gutter)));
  height: 100dvh;
  max-height: 100dvh;
  margin: 0 auto;
  padding: 20px 0;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  gap: 16px;
  overflow: hidden;
}

.app-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
}

.brand-lockup {
  min-width: 0;
}

.header-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 14px;
}

.status-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 30px;
  border-radius: 999px;
  background: var(--surface-strong);
  color: var(--primary-strong);
  padding: 5px 11px;
  font-size: 13px;
  font-weight: 800;
  white-space: nowrap;
}

.status-pill.ok {
  background: #e8f7ef;
  color: var(--success);
}

.status-pill.warn {
  background: #fff3e5;
  color: #9a4c00;
}

.user-box {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 12px;
  min-width: 0;
}

.mobile-header-button,
.mobile-settings-button {
  display: none;
}

.user-box div {
  display: grid;
  gap: 4px;
  text-align: right;
}

.studio-workspace {
  min-height: 0;
  display: grid;
  grid-template-columns: 300px minmax(0, 1fr);
  gap: 16px;
  align-items: stretch;
  overflow: hidden;
}

.studio-sidebar {
  min-width: 0;
  position: sticky;
  top: 18px;
  max-height: 100%;
  overflow: auto;
  display: grid;
  align-content: start;
  gap: 16px;
}

.history-panel {
  display: grid;
  gap: 16px;
  padding: var(--panel-pad);
}

.history-panel {
  max-height: 420px;
}

.conversation-list {
  min-height: 90px;
  max-height: 260px;
  overflow: auto;
  display: grid;
  align-content: start;
  grid-auto-rows: max-content;
  gap: 8px;
  padding-bottom: 2px;
}

.conversation-item {
  position: relative;
  width: 100%;
  min-height: 54px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #fff;
  color: var(--text);
  padding: 9px 10px;
  text-align: left;
  overflow: visible;
}

.conversation-item:hover,
.conversation-item.active {
  border-color: rgba(29, 78, 216, 0.38);
  background: #eaf1ff;
  z-index: 1;
}

.conversation-item-main {
  width: 100%;
  min-width: 0;
  display: grid;
  gap: 4px;
  min-height: 34px;
  border: 0;
  background: transparent;
  color: var(--text);
  padding: 0;
  text-align: left;
}

.conversation-item-main:hover {
  background: transparent;
}

.conversation-item-main strong,
.conversation-item-main small {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.conversation-item-main strong {
  font-size: 14px;
  font-weight: 900;
}

.conversation-item-main small,
.conversation-message,
.conversation-empty {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.conversation-item-actions {
  position: relative;
  z-index: 2;
  display: flex;
  gap: 6px;
}

.conversation-small-action,
.conversation-delete {
  flex: 0 0 auto;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #fff;
  color: var(--primary-strong);
  padding: 6px 8px;
  font-size: 12px;
  font-weight: 900;
  min-height: 32px;
}

.conversation-delete {
  color: var(--danger);
}

.conversation-message,
.conversation-empty {
  margin: 0;
  line-height: 1.45;
}

.conversation-message.error {
  color: var(--danger);
}

.advanced-panel summary {
  cursor: pointer;
  color: var(--text);
  font-weight: 800;
}

.advanced-panel .field {
  margin-top: 12px;
}

.chat-panel {
  min-width: 0;
  min-height: 0;
  height: 100%;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  overflow: hidden;
}

.chat-topline {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  border-bottom: 1px solid var(--border);
  padding: 12px var(--panel-pad);
}

.conversation-log {
  min-height: 0;
  overflow: auto;
  display: flex;
  flex-direction: column;
  gap: 14px;
  padding: 16px var(--panel-pad);
  scroll-behavior: smooth;
}

.chat-empty {
  margin: auto;
  width: min(680px, 100%);
  display: grid;
  justify-items: center;
  gap: 16px;
  color: var(--muted);
  text-align: center;
}

.chat-empty p {
  margin: 0;
  color: var(--text);
  font-size: 28px;
  font-weight: 800;
  line-height: 1.2;
}

.prompt-samples {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 10px;
}

.sample-chip {
  min-height: 38px;
  border: 1px solid var(--border);
  background: #fff;
  color: var(--text);
  padding: 0 12px;
  font-size: 14px;
  font-weight: 700;
}

.sample-chip:hover {
  background: var(--surface-strong);
}

.message {
  display: grid;
  grid-template-columns: 34px minmax(0, 1fr);
  gap: 12px;
}

.message.user {
  grid-template-columns: minmax(0, 1fr) 34px;
}

.message.user .message-avatar {
  grid-column: 2;
  grid-row: 1;
}

.message.user .message-body {
  grid-column: 1;
  justify-self: end;
}

.message-avatar {
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface-soft);
  color: var(--primary);
  font-size: 14px;
  font-weight: 900;
}

.message.user .message-avatar {
  background: var(--primary);
  color: #fff;
}

.message-body {
  width: min(880px, 100%);
  display: grid;
  gap: 8px;
}

.message-meta {
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

.message-bubble {
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface-soft);
  padding: 12px;
  line-height: 1.65;
  overflow-wrap: anywhere;
}

.message.user .message-bubble {
  border-color: rgba(29, 78, 216, 0.22);
  background: #eaf1ff;
}

.prompt-text {
  white-space: pre-wrap;
}

.prompt-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 10px;
}

.prompt-tag {
  border: 1px solid var(--border);
  border-radius: 999px;
  background: #fff;
  color: var(--muted);
  padding: 4px 9px;
  font-size: 12px;
  font-weight: 800;
}

.composer-wrap {
  border-top: 1px solid var(--border);
  background: rgba(248, 250, 252, 0.98);
  padding: 8px var(--panel-pad) 10px;
}

.composer-settings {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  gap: 8px;
  margin-bottom: 6px;
}

.composer-setting {
  flex: 0 1 128px;
  gap: 4px;
}

.composer-size-setting {
  flex: 1 1 300px;
}

.negative-setting {
  flex: 1 1 160px;
}

.composer-settings .field > span {
  color: #4a4641;
}

.composer-settings .pill-control {
  min-height: 40px;
  border-color: #dedbd8;
  padding-right: 36px;
}

.composer-settings select.pill-control {
  appearance: none;
  background-color: #fff;
  background-image:
    linear-gradient(45deg, transparent 50%, #7c746c 50%),
    linear-gradient(135deg, #7c746c 50%, transparent 50%);
  background-position:
    calc(100% - 18px) 50%,
    calc(100% - 12px) 50%;
  background-repeat: no-repeat;
  background-size: 6px 6px, 6px 6px;
}

.composer-settings input.pill-control,
.composer-settings select.pill-control {
  border-radius: 999px;
  box-shadow: 0 1px 0 rgba(17, 24, 39, 0.03);
}

.composer-advanced {
  flex: 0 0 auto;
  align-self: end;
}

.composer-advanced summary {
  width: fit-content;
  min-height: 34px;
  display: inline-flex;
  align-items: center;
  border: 1px solid #dedbd8;
  border-radius: 999px;
  background: #fff;
  color: #3d3935;
  padding: 0 14px;
}

.composer-advanced[open] summary {
  margin-bottom: 8px;
}

.composer-field {
  position: relative;
  display: block;
}

.composer-field textarea {
  min-height: 52px;
  max-height: 118px;
  display: block;
  background: #fff;
  padding-right: 250px;
  padding-bottom: 44px;
}

.composer-inline-actions {
  position: absolute;
  right: 10px;
  bottom: 10px;
  display: flex;
  align-items: center;
  gap: 8px;
  max-width: calc(100% - 20px);
}

.composer-actions {
  display: grid;
  align-items: center;
  gap: 6px;
  margin-top: 6px;
}

.composer-status {
  min-width: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.composer-hint {
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

.reference-toggle {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--primary-strong);
  font-size: 13px;
  font-weight: 900;
}

.reference-toggle input {
  width: 16px;
  height: 16px;
  accent-color: var(--primary);
}

.upload-reference-preview {
  display: grid;
  grid-template-columns: 58px minmax(0, 1fr) auto;
  align-items: center;
  gap: 12px;
  margin-top: 10px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #fff;
  padding: 10px;
}

.upload-reference-preview img {
  width: 58px;
  height: 58px;
  border-radius: 8px;
  background: #0f172a;
  object-fit: cover;
}

.upload-reference-preview div {
  min-width: 0;
  display: grid;
  gap: 4px;
}

.upload-reference-preview strong,
.upload-reference-preview span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.upload-reference-preview strong {
  font-size: 14px;
}

.upload-reference-preview span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.upload-reference-button {
  min-height: 36px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #fff;
  color: var(--primary-strong);
  padding: 0 12px;
  font-weight: 900;
  cursor: pointer;
  white-space: nowrap;
}

.upload-reference-button:hover {
  background: var(--surface-strong);
}

.upload-reference-button input {
  display: none;
}

.attachment-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(74px, 1fr));
  gap: 8px;
  width: 100%;
  min-width: 0;
}

.attachment-thumb {
  position: relative;
  min-width: 0;
  margin: 0;
  display: grid;
  gap: 5px;
}

.attachment-thumb img {
  width: 100%;
  aspect-ratio: 1;
  border-radius: 12px;
  object-fit: cover;
  background: rgba(15, 23, 42, 0.12);
}

.attachment-thumb figcaption {
  overflow: hidden;
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
  line-height: 1.2;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.attachment-remove-button {
  position: absolute;
  top: -6px;
  right: -6px;
  width: 24px;
  min-width: 24px;
  height: 24px;
  min-height: 24px;
  display: grid;
  place-items: center;
  border: 1px solid rgba(255, 255, 255, 0.72);
  border-radius: 999px;
  background: rgba(32, 55, 68, 0.78);
  color: #ffffff;
  font-size: 17px;
  font-weight: 900;
  line-height: 1;
  padding: 0;
  box-shadow: 0 8px 16px rgba(32, 55, 68, 0.18);
}

.send-button {
  min-width: 82px;
  min-height: 36px;
}

.cancel-button {
  min-width: 72px;
  min-height: 36px;
  border: 1px solid #ffd0c9;
  background: #fff5f3;
  color: var(--danger);
}

.cancel-button:hover {
  background: #ffe6e1;
}

.progress-box,
.result-notice,
.media-preview {
  width: 100%;
}

.progress-box {
  display: grid;
  gap: 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #fff;
  padding: 14px;
}

.progress-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  color: var(--text);
  font-weight: 800;
}

.progress-track {
  height: 10px;
  overflow: hidden;
  border-radius: 999px;
  background: var(--surface-strong);
}

.progress-track span {
  display: block;
  width: 0;
  height: 100%;
  border-radius: inherit;
  background: var(--primary);
  transition: width 280ms ease;
}

.progress-box p {
  margin: 0;
  color: var(--muted);
  font-size: 14px;
  font-weight: 700;
  line-height: 1.5;
}

.result-notice {
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #fff;
  color: var(--muted);
  padding: 12px 14px;
  font-size: 14px;
  font-weight: 800;
  line-height: 1.5;
}

.result-notice.success {
  border-color: #bee7d0;
  background: #effaf4;
  color: var(--success);
}

.result-notice.error {
  border-color: #ffd0c9;
  background: #fff5f3;
  color: var(--danger);
}

.media-preview {
  display: grid;
  gap: 10px;
}

.media-card {
  position: relative;
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #fff;
}

.media-card::before {
  content: "图片加载中...";
  position: absolute;
  inset: 0 0 48px;
  z-index: 1;
  display: none;
  place-items: center;
  min-height: 180px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
  background:
    linear-gradient(90deg, rgba(248, 250, 252, 0.78), rgba(255, 255, 255, 0.95), rgba(248, 250, 252, 0.78)),
    #f8fafc;
}

.media-card.is-loading::before {
  display: grid;
}

.media-card img,
.media-card video {
  display: block;
  width: 100%;
  max-height: min(52dvh, 520px);
  background: #f8fafc;
  object-fit: contain;
}

.media-card img {
  transition: opacity 160ms ease;
}

.media-card.is-loading img {
  min-height: 220px;
  opacity: 0;
}

.media-card-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 12px;
}

.media-card-meta strong {
  min-width: 0;
  color: var(--text);
  font-size: 14px;
  overflow-wrap: anywhere;
}

.media-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px;
}

.media-action {
  appearance: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 36px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #fff;
  color: var(--text);
  padding: 0 12px;
  font-size: 14px;
  font-weight: 800;
  text-decoration: none;
  white-space: nowrap;
  cursor: pointer;
}

.media-action.primary {
  border-color: var(--primary);
  background: var(--primary);
  color: #fff;
}

.download-choice-overlay {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: grid;
  place-items: center;
  padding: 20px;
  background: rgba(17, 24, 39, 0.34);
  backdrop-filter: blur(8px);
}

.download-choice-dialog {
  width: min(420px, 100%);
  border: 1px solid var(--border);
  border-radius: 14px;
  background: #fff;
  box-shadow: 0 24px 70px rgba(17, 24, 39, 0.24);
  padding: 16px;
}

.download-choice-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}

.download-choice-header h2 {
  margin: 0;
  color: var(--text);
  font-size: 18px;
  line-height: 1.2;
}

.download-choice-close {
  width: 34px;
  height: 34px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: #fff;
  color: var(--muted);
  font-size: 22px;
  line-height: 1;
  cursor: pointer;
}

.download-choice-options {
  display: grid;
  gap: 10px;
}

.download-choice-option {
  appearance: none;
  display: grid;
  gap: 4px;
  width: 100%;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: #fff;
  color: var(--text);
  padding: 13px 14px;
  text-align: left;
  cursor: pointer;
}

.download-choice-option strong {
  font-size: 15px;
  line-height: 1.25;
}

.download-choice-option span {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.35;
}

.download-choice-option.primary {
  border-color: rgba(46, 83, 218, 0.28);
  background: #f4f7ff;
}

@media (max-width: 1040px) {
  .studio-workspace {
    grid-template-columns: 260px minmax(0, 1fr);
  }
}

@media (max-width: 860px) {
  :root {
    --page-gutter: 0px;
    --panel-pad: 14px;
  }

  body {
    background: #f7f8fb;
  }

  .app-shell {
    width: 100%;
    height: 100dvh;
    max-height: 100dvh;
    min-height: 100dvh;
    padding: 0;
    gap: 0;
    overflow: hidden;
    grid-template-rows: auto minmax(0, 1fr);
  }

  .auth-screen,
  .studio-workspace {
    grid-template-columns: 1fr;
  }

  .studio-workspace {
    min-height: 0;
    grid-template-rows: minmax(0, 1fr) auto;
    gap: 0;
    overflow: hidden;
  }

  .auth-shell {
    width: min(100% - var(--page-gutter), 680px);
    place-items: start center;
    padding: 42px 0 28px;
  }

  .auth-screen {
    gap: 24px;
  }

  .app-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    border: 0;
    border-bottom: 1px solid var(--border);
    border-radius: 0;
    background: rgba(255, 255, 255, 0.98);
    padding: max(10px, env(safe-area-inset-top)) 12px 9px;
  }

  .header-actions {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    width: auto;
    gap: 7px;
  }

  .brand-lockup .eyebrow,
  .status-pill,
  .user-box div {
    display: none;
  }

  .brand-lockup h1 {
    font-size: 21px;
    line-height: 1.05;
  }

  .mobile-header-button {
    min-height: 34px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: 1px solid var(--border);
    border-radius: 999px;
    background: #fff;
    color: var(--text);
    padding: 0 10px;
    font-size: 13px;
    font-weight: 900;
  }

  .user-box {
    justify-content: flex-end;
  }

  .studio-sidebar {
    position: fixed;
    top: calc(60px + env(safe-area-inset-top));
    right: 10px;
    z-index: 30;
    width: min(330px, calc(100vw - 20px));
    max-height: min(72dvh, 540px);
    overflow: auto;
    padding: 0;
    opacity: 0;
    pointer-events: none;
    transform: translateY(-8px);
    transition: opacity 160ms ease, transform 160ms ease;
  }

  .app-shell.history-open .studio-sidebar {
    opacity: 1;
    pointer-events: auto;
    transform: translateY(0);
  }

  .history-panel {
    min-height: 0;
    max-height: none;
    border-radius: 18px;
    box-shadow: 0 20px 56px rgba(15, 23, 42, 0.18);
    gap: 10px;
    padding: 14px;
  }

  .conversation-list {
    min-height: 0;
    max-height: min(44dvh, 360px);
    overflow: auto;
  }

  .chat-panel {
    height: 100%;
    min-height: 0;
    border: 0;
    border-radius: 0;
    box-shadow: none;
    background: #fff;
    overflow: hidden;
  }

  .chat-topline {
    display: none;
  }

  .conversation-log {
    min-height: 0;
    height: auto;
    max-height: none;
    overflow: auto;
    padding: 16px 14px;
  }

  .chat-empty {
    gap: 12px;
  }

  .chat-empty p {
    font-size: 24px;
  }

  .prompt-samples {
    display: grid;
    width: 100%;
  }

  .sample-chip {
    width: 100%;
    min-height: 40px;
    white-space: normal;
  }

  .composer-size-setting,
  .negative-setting {
    flex-basis: 100%;
  }

  .composer-wrap {
    border-top: 1px solid var(--border);
    background: rgba(248, 250, 252, 0.98);
    padding: 8px 10px calc(10px + env(safe-area-inset-bottom));
  }
}

@media (max-width: 560px) {
  :root {
    --panel-pad: 12px;
  }

  h2 {
    font-size: 20px;
  }

  .auth-shell {
    min-height: auto;
  }

  .conversation-list {
    max-height: min(42dvh, 320px);
  }

  .header-actions {
    display: grid;
  }

  .user-box {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: center;
  }

  .grid-two,
  .upload-reference-preview,
  .media-card-meta {
    display: grid;
    align-items: stretch;
  }

  .status-pill {
    width: 100%;
  }

  .user-box .secondary-button {
    width: auto;
    min-height: 36px;
    padding: 0 12px;
  }

  .icon-button {
    width: 100%;
  }

  .conversation-item {
    display: grid;
    gap: 8px;
  }

  .conversation-item-actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
  }

  .conversation-small-action,
  .conversation-delete {
    justify-self: stretch;
    text-align: center;
  }

  .message,
  .message.user {
    grid-template-columns: 1fr;
  }

  .message-avatar,
  .message.user .message-avatar {
    display: none;
  }

  .message.user .message-body {
    grid-column: 1;
  }

  .composer-hint {
    min-height: 18px;
  }

  .composer-settings {
    display: grid;
    gap: 6px;
    margin-bottom: 6px;
  }

  .conversation-log {
    min-height: 0;
    height: auto;
    max-height: none;
    padding: 14px 12px;
  }

  .composer-field textarea {
    min-height: 58px;
    padding-right: 12px;
    padding-bottom: 48px;
  }

  .composer-inline-actions {
    left: 10px;
    right: 10px;
    justify-content: stretch;
  }

  .composer-inline-actions .upload-reference-button,
  .composer-inline-actions .cancel-button,
  .composer-inline-actions .send-button {
    flex: 1;
    width: auto;
  }

  .media-actions {
    justify-content: stretch;
  }

  .custom-size-row {
    grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr) 40px;
  }

  .size-help-button {
    width: 40px;
  }

  .size-help-popover {
    right: 0;
    left: auto;
    bottom: calc(100% + 10px);
  }

  .media-action {
    flex: 1;
  }

  .media-card img,
  .media-card video {
    max-height: 44dvh;
  }

  .media-card.is-loading img {
    min-height: 240px;
  }
}

@media (max-width: 860px) {
  .studio-workspace {
    grid-template-rows: minmax(0, 1fr);
  }

  .chat-panel {
    grid-template-rows: minmax(0, 1fr) auto;
  }

  .chat-empty {
    width: 100%;
    max-width: 100%;
    min-width: 0;
    margin: auto 0;
    justify-items: stretch;
    text-align: left;
  }

  .chat-empty p {
    font-size: 22px;
    text-align: center;
  }

  .composer-settings {
    display: flex;
    flex-wrap: nowrap;
    align-items: center;
    gap: 6px;
    margin-bottom: 5px;
    overflow-x: auto;
    overscroll-behavior-x: contain;
    scrollbar-width: none;
  }

  .composer-settings::-webkit-scrollbar {
    display: none;
  }

  .composer-setting,
  .composer-size-setting,
  .negative-setting,
  .composer-advanced {
    flex: 0 0 auto;
  }

  .composer-setting {
    width: 112px;
  }

  .composer-size-setting {
    width: 176px;
  }

  .negative-setting {
    width: 154px;
  }

  .composer-settings .field > span {
    display: none;
  }

  .composer-settings .pill-control {
    min-height: 34px;
    padding: 7px 32px 7px 12px;
    font-size: 14px;
  }

  .composer-advanced {
    align-self: center;
  }

  .composer-advanced summary {
    min-height: 34px;
    padding: 0 12px;
    font-size: 14px;
    white-space: nowrap;
  }

  .composer-field textarea {
    min-height: 46px;
    max-height: 96px;
    border-radius: 18px;
    padding: 11px 12px 48px;
  }

  .composer-wrap,
  .composer-field {
    max-width: 100vw;
    min-width: 0;
    overflow: hidden;
  }

  .composer-inline-actions {
    bottom: 8px;
  }

  .composer-inline-actions .upload-reference-button,
  .composer-inline-actions .cancel-button,
  .composer-inline-actions .send-button {
    min-width: 0;
    min-height: 32px;
    border-radius: 999px;
    padding: 0 10px;
    font-size: 13px;
  }

  .composer-hint {
    display: none;
  }

  .composer-status {
    justify-content: flex-end;
  }
}

@media (max-width: 560px) {
  .app-header {
    min-height: 54px;
  }

  .brand-lockup h1 {
    font-size: 20px;
  }

  .header-actions {
    display: flex;
    gap: 6px;
  }

  .mobile-header-button,
  .user-box .secondary-button {
    min-height: 32px;
    padding: 0 9px;
    font-size: 12px;
  }

  .user-box {
    display: flex;
  }

  .conversation-log {
    padding: 12px 10px;
  }

  .prompt-samples,
  .sample-chip {
    min-width: 0;
    max-width: 100%;
  }

  .sample-chip {
    overflow: hidden;
    text-overflow: ellipsis;
  }

  .message-bubble {
    padding: 10px 11px;
    line-height: 1.55;
  }

  .composer-wrap {
    padding: 6px 8px calc(8px + env(safe-area-inset-bottom));
  }
}

@media (max-width: 860px) {
  .conversation-log {
    gap: 12px;
  }

  .message,
  .message.user {
    display: grid;
    align-items: end;
    gap: 8px;
  }

  .message {
    grid-template-columns: 32px minmax(0, 1fr);
  }

  .message.user {
    grid-template-columns: minmax(0, 1fr) 32px;
  }

  .message-avatar,
  .message.user .message-avatar {
    width: 32px;
    height: 32px;
    display: grid;
    border-radius: 50%;
    font-size: 12px;
    box-shadow: 0 6px 14px rgba(15, 23, 42, 0.08);
  }

  .message-avatar {
    grid-column: 1;
    grid-row: 1;
    align-self: end;
    border-color: #dfe7f5;
    background: #fff;
    color: var(--primary);
  }

  .message.user .message-avatar {
    grid-column: 2;
    background: var(--primary);
    color: #fff;
  }

  .message-body {
    width: min(100%, 82vw);
    gap: 5px;
  }

  .message .message-body {
    grid-column: 2;
    justify-self: start;
  }

  .message.user .message-body {
    grid-column: 1;
    justify-self: end;
  }

  .message-meta {
    padding: 0 4px;
    font-size: 12px;
  }

  .message.user .message-meta {
    text-align: right;
  }

  .message-bubble {
    width: fit-content;
    max-width: 100%;
    border-radius: 18px 18px 18px 6px;
    background: #fff;
    padding: 10px 12px;
    box-shadow: 0 8px 20px rgba(15, 23, 42, 0.06);
  }

  .message.user .message-bubble {
    justify-self: end;
    border-color: rgba(29, 78, 216, 0.18);
    border-radius: 18px 18px 6px 18px;
    background: #dce8ff;
    color: #102044;
  }

  .prompt-tags {
    gap: 6px;
  }

  .prompt-tag {
    background: rgba(255, 255, 255, 0.82);
    font-size: 11px;
  }
}

/* 0.8.9 keep composer height stable while typing */
.composer-field textarea,
.app-shell[data-module="chat"] .composer-field textarea {
  height: 58px !important;
  min-height: 58px;
  max-height: 58px;
  resize: none;
  overflow-y: auto;
}

@media (max-width: 860px) {
  .composer-field textarea,
  .app-shell[data-module="chat"] .composer-field textarea {
    height: 42px !important;
    min-height: 42px;
    max-height: 42px;
  }
}

@media (max-width: 430px) {
  .app-shell[data-module="chat"] .composer-field textarea {
    height: 78px !important;
    min-height: 78px;
    max-height: 78px;
  }
}

/* Pawprint Studio final overrides */
body {
  background:
    linear-gradient(180deg, rgba(250, 246, 235, 0.82), rgba(238, 230, 213, 0.9)),
    var(--paper-texture),
    var(--bg);
  color: var(--text);
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  background:
    linear-gradient(90deg, rgba(250, 246, 235, 0.88), rgba(250, 246, 235, 0.58), rgba(250, 246, 235, 0.86)),
    var(--ink-landscape) center top / cover no-repeat;
  opacity: 0.6;
}

button {
  background: var(--primary);
  color: #fffaf0;
}

button:hover {
  background: var(--primary-strong);
}

.secondary-button,
.icon-button,
.mobile-header-button,
.sample-chip,
.media-action,
.download-choice-close {
  background: rgba(255, 250, 240, 0.82);
  color: var(--text);
}

.secondary-button:hover,
.icon-button:hover,
.mobile-header-button:hover,
.sample-chip:hover,
.media-action:hover,
.download-choice-close:hover {
  background: #f3ead9;
}

.eyebrow {
  color: var(--accent);
}

h1,
h2,
.auth-brand h1,
.brand-lockup h1,
.chat-empty p,
.download-choice-header h2 {
  font-family: var(--serif);
}

.panel,
.auth-card,
.chat-panel,
.composer-wrap,
.media-card-meta,
.download-choice-dialog {
  background:
    linear-gradient(180deg, rgba(255, 252, 244, 0.94), rgba(248, 241, 227, 0.9)),
    var(--paper-texture);
}

.panel,
.field input,
.field select,
.field textarea,
.composer-field textarea,
.field .pill-control,
.custom-size-input input,
.composer-settings .pill-control,
.composer-advanced summary,
.upload-reference-button,
.conversation-item,
.conversation-small-action,
.conversation-delete,
.progress-box,
.result-notice,
.media-card,
.download-choice-dialog,
.download-choice-option {
  border-color: var(--border);
}

.field input,
.field select,
.field textarea,
.composer-field textarea,
.field .pill-control,
.custom-size-input input,
.composer-settings .pill-control,
.composer-advanced summary,
.upload-reference-button {
  background: rgba(255, 252, 244, 0.92);
  color: var(--text);
}

.field input:focus,
.field select:focus,
.field textarea:focus,
.composer-field textarea:focus {
  border-color: rgba(124, 47, 34, 0.58);
  box-shadow: 0 0 0 4px rgba(124, 47, 34, 0.12);
}

.auth-brand {
  background:
    linear-gradient(90deg, rgba(250, 246, 235, 0.26), rgba(250, 246, 235, 0.78)),
    var(--ink-landscape) center / cover no-repeat;
}

.app-header {
  background:
    linear-gradient(90deg, rgba(255, 252, 244, 0.92), rgba(255, 252, 244, 0.74)),
    var(--ink-landscape) center 42% / cover no-repeat;
}

.status-pill,
.conversation-item,
.conversation-small-action,
.conversation-delete,
.progress-box,
.result-notice {
  background: rgba(255, 250, 240, 0.78);
}

.conversation-item:hover,
.conversation-item.active {
  border-color: rgba(124, 47, 34, 0.36);
  background: rgba(244, 232, 211, 0.78);
}

.conversation-small-action {
  color: var(--accent);
}

.conversation-delete,
.cancel-button,
.result-notice.error {
  color: var(--danger);
}

.conversation-log {
  background:
    radial-gradient(circle at 16% 12%, rgba(124, 47, 34, 0.05), transparent 28%),
    radial-gradient(circle at 84% 80%, rgba(45, 92, 85, 0.06), transparent 30%);
}

.chat-empty p {
  color: #332a20;
}

.sample-chip {
  color: #403729;
}

.message-avatar {
  border-color: rgba(103, 82, 55, 0.22);
  border-radius: 8px;
  background: rgba(255, 250, 240, 0.9);
  color: var(--primary);
  font-family: var(--serif);
}

.message.user .message-avatar {
  background: var(--primary);
  color: #fff7e8;
}

.message-meta {
  color: rgba(118, 109, 95, 0.82);
}

.message-bubble {
  border-color: rgba(103, 82, 55, 0.18);
  border-radius: 8px;
  background:
    linear-gradient(180deg, rgba(255, 252, 244, 0.9), rgba(248, 241, 227, 0.86)),
    var(--paper-texture);
}

.message.user .message-bubble {
  border-color: rgba(124, 47, 34, 0.22);
  border-radius: 8px;
  background: #f3e6d0;
  color: #32261d;
}

.prompt-tag {
  border-color: rgba(103, 82, 55, 0.18);
  background: rgba(255, 250, 240, 0.76);
  color: var(--muted);
}

.progress-track {
  background: rgba(103, 82, 55, 0.13);
}

.progress-track span {
  background: linear-gradient(90deg, var(--accent), var(--primary));
}

.media-card {
  background: rgba(255, 252, 244, 0.94);
  box-shadow: 0 14px 34px rgba(64, 49, 31, 0.1);
}

.media-card img,
.media-card video {
  background: #f1eadc;
}

.media-action.primary,
.download-choice-option.primary {
  border-color: rgba(124, 47, 34, 0.26);
  background: rgba(124, 47, 34, 0.1);
  color: var(--primary-strong);
}

.download-choice-overlay {
  background: rgba(40, 35, 27, 0.36);
}

@media (max-width: 860px) {
  body {
    background:
      linear-gradient(180deg, rgba(250, 246, 235, 0.92), rgba(238, 230, 213, 0.94)),
      var(--paper-texture),
      var(--bg);
  }

  body::before {
    opacity: 0.32;
  }

  .app-header {
    background:
      linear-gradient(90deg, rgba(255, 252, 244, 0.96), rgba(255, 252, 244, 0.82)),
      var(--ink-landscape) center / cover no-repeat;
  }

  .history-panel,
  .chat-panel,
  .composer-wrap {
    background:
      linear-gradient(180deg, rgba(255, 252, 244, 0.96), rgba(248, 241, 227, 0.96)),
      var(--paper-texture);
  }
}

@media (max-width: 560px) {
  .message-avatar,
  .message.user .message-avatar,
  .message-bubble,
  .message.user .message-bubble {
    border-radius: 8px;
  }
}

/* Lively pet Studio overrides */
:root {
  --bg: #f2fbff;
  --surface: #ffffff;
  --surface-soft: #f7fcfb;
  --surface-strong: #e4f7ef;
  --border: rgba(43, 112, 126, 0.15);
  --border-strong: rgba(43, 112, 126, 0.28);
  --text: #203236;
  --muted: #627b7d;
  --primary: #ff7a59;
  --primary-strong: #e85d3f;
  --accent: #28a883;
  --success: #208b63;
  --danger: #d94841;
  --shadow: 0 18px 48px rgba(39, 107, 130, 0.14);
  --paper-texture: url("/assets/pawstudio-ui-texture.webp");
  --ink-landscape: url("/assets/pawstudio-pets-hero.webp");
  --serif: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

body {
  background:
    radial-gradient(circle at 12% 0%, rgba(255, 214, 102, 0.22), transparent 28%),
    radial-gradient(circle at 86% 10%, rgba(92, 200, 255, 0.22), transparent 30%),
    linear-gradient(180deg, rgba(242, 251, 255, 0.92), rgba(247, 252, 251, 0.96)),
    var(--bg);
  color: var(--text);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  background:
    linear-gradient(90deg, rgba(242, 251, 255, 0.84), rgba(242, 251, 255, 0.36), rgba(242, 251, 255, 0.88)),
    var(--ink-landscape) center top / cover no-repeat;
  opacity: 0.74;
}

button,
.send-button {
  border-radius: 999px;
  background: linear-gradient(135deg, #ff8a5f, #ff5f7e);
  color: #ffffff;
  box-shadow: 0 12px 28px rgba(255, 122, 89, 0.24);
}

button:hover,
.send-button:hover {
  background: linear-gradient(135deg, #ff7650, #ee4c6e);
}

.secondary-button,
.icon-button,
.mobile-header-button,
.sample-chip,
.media-action,
.download-choice-close,
.conversation-small-action,
.conversation-delete,
.upload-reference-button,
.composer-advanced summary {
  background: rgba(255, 255, 255, 0.88);
  color: var(--text);
  box-shadow: none;
}

.secondary-button:hover,
.icon-button:hover,
.mobile-header-button:hover,
.sample-chip:hover,
.media-action:hover,
.download-choice-close:hover,
.conversation-small-action:hover,
.conversation-delete:hover,
.upload-reference-button:hover,
.composer-advanced summary:hover {
  background: #e9f8f4;
}

.eyebrow {
  color: var(--accent);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0;
}

h1,
h2,
.auth-brand h1,
.brand-lockup h1,
.chat-empty p,
.download-choice-header h2 {
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  letter-spacing: 0;
}

.panel,
.auth-card,
.chat-panel,
.composer-wrap,
.media-card-meta,
.download-choice-dialog {
  border-color: var(--border);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.92), rgba(247, 252, 251, 0.9)),
    var(--paper-texture);
  box-shadow: var(--shadow);
}

.field input,
.field select,
.field textarea,
.composer-field textarea,
.field .pill-control,
.custom-size-input input,
.composer-settings .pill-control {
  border-color: var(--border);
  background: rgba(255, 255, 255, 0.92);
  color: var(--text);
}

.field input:focus,
.field select:focus,
.field textarea:focus,
.composer-field textarea:focus {
  border-color: rgba(40, 168, 131, 0.62);
  box-shadow: 0 0 0 4px rgba(40, 168, 131, 0.14);
}

.auth-brand {
  border-color: rgba(43, 112, 126, 0.15);
  background:
    linear-gradient(90deg, rgba(255, 255, 255, 0.2), rgba(242, 251, 255, 0.78)),
    var(--ink-landscape) center / cover no-repeat;
}

.auth-brand::after,
.brand-lockup::after {
  border: 0;
  border-radius: 0;
  background:
    radial-gradient(circle at 50% 76%, #ff7a59 0 7px, transparent 8px),
    radial-gradient(circle at 22% 28%, #ffb05f 0 4px, transparent 5px),
    radial-gradient(circle at 42% 14%, #ff8f7a 0 4px, transparent 5px),
    radial-gradient(circle at 62% 14%, #ff8f7a 0 4px, transparent 5px),
    radial-gradient(circle at 82% 28%, #ffb05f 0 4px, transparent 5px);
}

.auth-brand h1,
.brand-lockup h1 {
  color: #203236;
}

.app-header {
  border-color: var(--border);
  background:
    linear-gradient(90deg, rgba(255, 255, 255, 0.94), rgba(242, 251, 255, 0.72)),
    var(--ink-landscape) center 46% / cover no-repeat;
  box-shadow: 0 12px 34px rgba(39, 107, 130, 0.12);
}

.status-pill,
.user-box {
  border-color: var(--border);
  background: rgba(255, 255, 255, 0.82);
  color: var(--accent);
}

.history-panel,
.chat-panel,
.composer-wrap {
  backdrop-filter: blur(18px);
}

.panel-heading {
  border-bottom-color: rgba(43, 112, 126, 0.12);
}

.conversation-list {
  gap: 10px;
}

.conversation-item {
  border-color: var(--border);
  background: rgba(255, 255, 255, 0.82);
}

.conversation-item:hover,
.conversation-item.active {
  border-color: rgba(255, 122, 89, 0.38);
  background: #fff5ee;
}

.conversation-small-action {
  color: var(--accent);
}

.conversation-delete,
.cancel-button,
.result-notice.error {
  color: var(--danger);
}

.conversation-log {
  background:
    radial-gradient(circle at 14% 12%, rgba(255, 209, 102, 0.18), transparent 22%),
    radial-gradient(circle at 82% 20%, rgba(120, 217, 198, 0.18), transparent 26%),
    radial-gradient(circle at 78% 86%, rgba(255, 122, 89, 0.1), transparent 28%);
}

.chat-empty p {
  color: #203236;
}

.sample-chip {
  border-color: rgba(255, 122, 89, 0.22);
  color: #2e5155;
}

.message-avatar {
  border-color: rgba(43, 112, 126, 0.14);
  border-radius: 999px;
  background: #ffffff;
  color: var(--primary);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  box-shadow: 0 8px 18px rgba(39, 107, 130, 0.12);
}

.message.user .message-avatar {
  background: linear-gradient(135deg, #48cfae, #2fb7e8);
  color: #ffffff;
}

.message-meta {
  color: rgba(98, 123, 125, 0.86);
}

.message-bubble {
  border-color: rgba(43, 112, 126, 0.13);
  border-radius: 18px 18px 18px 7px;
  background: rgba(255, 255, 255, 0.9);
}

.message.user .message-bubble {
  border-color: rgba(255, 122, 89, 0.18);
  border-radius: 18px 18px 7px 18px;
  background: #fff0e8;
  color: #2f3133;
}

.prompt-tag {
  border-color: rgba(43, 112, 126, 0.13);
  background: #eaf8f4;
  color: #527173;
}

.progress-box,
.result-notice {
  border-color: var(--border);
  background: rgba(255, 255, 255, 0.84);
}

.progress-track {
  background: rgba(43, 112, 126, 0.12);
}

.progress-track span {
  background: linear-gradient(90deg, #2fc6a0, #ff8a5f);
}

.media-card {
  border-color: var(--border);
  background: rgba(255, 255, 255, 0.94);
  box-shadow: 0 14px 34px rgba(39, 107, 130, 0.12);
}

.media-card img,
.media-card video {
  background: #eff9fb;
}

.media-action.primary,
.download-choice-option.primary {
  border-color: rgba(255, 122, 89, 0.24);
  background: #fff0e8;
  color: var(--primary-strong);
}

.download-choice-overlay {
  background: rgba(32, 50, 54, 0.32);
}

@media (max-width: 860px) {
  body {
    background:
      linear-gradient(180deg, rgba(242, 251, 255, 0.96), rgba(247, 252, 251, 0.98)),
      var(--bg);
  }

  body::before {
    opacity: 0.42;
    background:
      linear-gradient(180deg, rgba(242, 251, 255, 0.58), rgba(242, 251, 255, 0.94)),
      var(--ink-landscape) 8% 68px / auto 420px no-repeat;
  }

  .app-header {
    background: rgba(255, 255, 255, 0.9);
  }

  .history-panel,
  .chat-panel,
  .composer-wrap {
    background:
      linear-gradient(180deg, rgba(255, 255, 255, 0.96), rgba(247, 252, 251, 0.96)),
      var(--paper-texture);
  }

  .conversation-log {
    background:
      radial-gradient(circle at 10% 0%, rgba(255, 209, 102, 0.14), transparent 24%),
      radial-gradient(circle at 100% 22%, rgba(120, 217, 198, 0.14), transparent 30%);
  }

  .chat-empty::before {
    content: "";
    display: block;
    width: min(100%, 330px);
    height: 118px;
    margin: 0 auto 20px;
    border: 1px solid rgba(255, 122, 89, 0.18);
    border-radius: 8px;
    background:
      linear-gradient(90deg, rgba(255, 255, 255, 0.08), rgba(242, 251, 255, 0.42)),
      var(--ink-landscape) 0% 62% / 440px auto no-repeat;
    box-shadow: 0 12px 28px rgba(39, 107, 130, 0.1);
  }

  .message-bubble {
    border-radius: 18px 18px 18px 7px;
  }

  .message.user .message-bubble {
    border-radius: 18px 18px 7px 18px;
    background: #fff0e8;
  }

  .message-avatar,
  .message.user .message-avatar {
    border-radius: 999px;
  }
}

/* Pet avatar and glass chat refinements */
.message {
  grid-template-columns: 42px minmax(0, 1fr);
}

.message.user {
  grid-template-columns: minmax(0, 1fr) 42px;
}

.chat-panel,
.composer-wrap {
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.64), rgba(247, 252, 251, 0.48)),
    var(--paper-texture);
  backdrop-filter: blur(24px) saturate(1.18);
  -webkit-backdrop-filter: blur(24px) saturate(1.18);
  border-color: rgba(255, 255, 255, 0.54);
  box-shadow: 0 22px 56px rgba(39, 107, 130, 0.16);
}

.conversation-log {
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.2), rgba(242, 251, 255, 0.16)),
    radial-gradient(circle at 14% 12%, rgba(255, 209, 102, 0.22), transparent 22%),
    radial-gradient(circle at 82% 20%, rgba(120, 217, 198, 0.2), transparent 28%),
    radial-gradient(circle at 78% 86%, rgba(255, 122, 89, 0.12), transparent 30%),
    var(--ink-landscape) center / cover no-repeat;
  background-blend-mode: normal, normal, normal, normal, soft-light;
}

.message-avatar {
  position: relative;
  width: 42px;
  height: 42px;
  overflow: visible;
  border: 1px solid rgba(255, 255, 255, 0.74);
  border-radius: 999px;
  background:
    radial-gradient(circle at 28% 24%, rgba(255, 255, 255, 0.76), transparent 30%),
    linear-gradient(145deg, #b7f0ff, #d9fff2 58%, #fff1b8);
  box-shadow:
    0 10px 22px rgba(39, 107, 130, 0.16),
    inset 0 0 0 1px rgba(255, 255, 255, 0.56);
  color: transparent;
  font-size: 0;
}

.message-avatar::before,
.message-avatar::after {
  content: "";
  position: absolute;
  pointer-events: none;
}

.cat-avatar::after {
  inset: 4px 7px auto;
  height: 15px;
  background:
    linear-gradient(135deg, transparent 48%, #ffd08c 50%) left top / 15px 15px no-repeat,
    linear-gradient(225deg, transparent 48%, #ffd08c 50%) right top / 15px 15px no-repeat;
  filter: drop-shadow(0 2px 0 rgba(196, 122, 54, 0.08));
  z-index: 0;
}

.cat-avatar::before {
  left: 8px;
  top: 11px;
  width: 26px;
  height: 23px;
  border-radius: 46% 46% 50% 50%;
  background:
    radial-gradient(circle at 34% 43%, #203236 0 1.5px, transparent 2px),
    radial-gradient(circle at 66% 43%, #203236 0 1.5px, transparent 2px),
    radial-gradient(ellipse at 50% 58%, #ff7a8a 0 2px, transparent 2.5px),
    linear-gradient(90deg, transparent 0 18%, rgba(255, 138, 95, 0.42) 19% 21%, transparent 22% 78%, rgba(255, 138, 95, 0.42) 79% 81%, transparent 82%),
    #fff7e6;
  box-shadow:
    inset 0 -3px 0 rgba(255, 198, 120, 0.34),
    0 2px 6px rgba(39, 107, 130, 0.08);
  z-index: 1;
}

.message.user .dog-avatar {
  background:
    radial-gradient(circle at 30% 22%, rgba(255, 255, 255, 0.74), transparent 28%),
    linear-gradient(145deg, #7fe3cc, #68c9ff 58%, #ffe083);
}

.dog-avatar::after {
  left: 6px;
  top: 12px;
  width: 30px;
  height: 22px;
  background:
    radial-gradient(ellipse at 8% 28%, #9a6846 0 6px, transparent 6.5px),
    radial-gradient(ellipse at 92% 28%, #9a6846 0 6px, transparent 6.5px);
  z-index: 0;
}

.dog-avatar::before {
  left: 8px;
  top: 10px;
  width: 26px;
  height: 24px;
  border-radius: 46% 46% 52% 52%;
  background:
    radial-gradient(circle at 35% 44%, #203236 0 1.5px, transparent 2px),
    radial-gradient(circle at 65% 44%, #203236 0 1.5px, transparent 2px),
    radial-gradient(ellipse at 50% 60%, #68452f 0 2.7px, transparent 3px),
    radial-gradient(ellipse at 50% 74%, rgba(255, 122, 89, 0.42) 0 4px, transparent 4.5px),
    linear-gradient(180deg, #fff8e9, #ffe0b4);
  box-shadow:
    inset 0 -3px 0 rgba(154, 104, 70, 0.14),
    0 2px 6px rgba(39, 107, 130, 0.08);
  z-index: 1;
}

.message-bubble {
  border-color: rgba(255, 255, 255, 0.58);
  background: rgba(255, 255, 255, 0.58);
  backdrop-filter: blur(16px) saturate(1.12);
  -webkit-backdrop-filter: blur(16px) saturate(1.12);
  box-shadow:
    0 14px 30px rgba(39, 107, 130, 0.1),
    inset 0 1px 0 rgba(255, 255, 255, 0.66);
}

.message.user .message-bubble {
  border-color: rgba(255, 219, 190, 0.68);
  background: rgba(255, 240, 232, 0.66);
}

.progress-box,
.result-notice,
.media-card {
  backdrop-filter: blur(14px) saturate(1.1);
  -webkit-backdrop-filter: blur(14px) saturate(1.1);
}

@media (max-width: 860px) {
  .chat-panel,
  .composer-wrap {
    background:
      linear-gradient(180deg, rgba(255, 255, 255, 0.72), rgba(247, 252, 251, 0.62)),
      var(--paper-texture);
  }

  .conversation-log {
    background:
      linear-gradient(180deg, rgba(255, 255, 255, 0.28), rgba(242, 251, 255, 0.22)),
      radial-gradient(circle at 10% 0%, rgba(255, 209, 102, 0.18), transparent 24%),
      radial-gradient(circle at 100% 22%, rgba(120, 217, 198, 0.16), transparent 30%),
      var(--ink-landscape) 42% 10% / auto 420px no-repeat;
  }

  .message {
    grid-template-columns: 34px minmax(0, 1fr);
    max-width: 100%;
    min-width: 0;
  }

  .message.user {
    grid-template-columns: minmax(0, 1fr) 34px;
    max-width: 100%;
    min-width: 0;
  }

  .message-avatar,
  .message.user .message-avatar {
    width: 34px;
    height: 34px;
  }

  .cat-avatar::after {
    inset: 3px 6px auto;
    height: 12px;
    background-size: 12px 12px;
  }

  .cat-avatar::before,
  .dog-avatar::before {
    left: 7px;
    top: 9px;
    width: 20px;
    height: 19px;
  }

  .dog-avatar::after {
    left: 5px;
    top: 10px;
    width: 24px;
    height: 18px;
  }

  .message-bubble {
    width: auto;
    max-inline-size: 100%;
    max-width: 100%;
    min-width: 0;
    background: rgba(255, 255, 255, 0.64);
    overflow-wrap: break-word;
    word-break: normal;
  }

  .message.user .message-bubble {
    background: rgba(255, 240, 232, 0.72);
  }

  .message .message-bubble,
  .message.user .message-bubble {
    inline-size: 100%;
    justify-self: stretch;
  }

  .message-body {
    width: min(90vw, calc(100vw - 56px));
    max-width: min(90vw, calc(100vw - 56px));
    min-width: 0;
  }

  .prompt-text,
  .result-notice {
    overflow-wrap: anywhere;
    word-break: break-word;
  }
}

/* Unified macOS-style glass system */
:root {
  --glass-bg: rgba(255, 255, 255, 0.52);
  --glass-bg-strong: rgba(255, 255, 255, 0.68);
  --glass-bg-soft: rgba(255, 255, 255, 0.38);
  --glass-border: rgba(255, 255, 255, 0.62);
  --glass-border-tint: rgba(43, 112, 126, 0.14);
  --glass-highlight: inset 0 1px 0 rgba(255, 255, 255, 0.78);
  --glass-shadow: 0 18px 42px rgba(39, 107, 130, 0.13);
  --glass-radius: 22px;
  --glass-radius-sm: 16px;
}

.panel,
.auth-card,
.auth-brand,
.app-header,
.history-panel,
.chat-panel,
.composer-wrap,
.download-choice-dialog {
  border: 1px solid var(--glass-border);
  border-radius: var(--glass-radius);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.66), rgba(247, 252, 251, 0.46)),
    var(--paper-texture);
  box-shadow: var(--glass-shadow), var(--glass-highlight);
  backdrop-filter: blur(26px) saturate(1.2);
  -webkit-backdrop-filter: blur(26px) saturate(1.2);
}

.app-header {
  background:
    linear-gradient(90deg, rgba(255, 255, 255, 0.72), rgba(242, 251, 255, 0.48)),
    var(--ink-landscape) center 46% / cover no-repeat;
}

.chat-panel,
.composer-wrap {
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.58), rgba(247, 252, 251, 0.4)),
    var(--paper-texture);
}

.field input,
.field select,
.field textarea,
.composer-field textarea,
.field .pill-control,
.custom-size-input input,
.composer-settings .pill-control,
.advanced-panel,
.advanced-panel summary,
.reference-toggle,
.upload-reference-preview,
.upload-reference-button,
.secondary-button,
.icon-button,
.mobile-header-button,
.sample-chip,
.media-action,
.download-choice-close,
.conversation-small-action,
.conversation-delete,
.download-choice-option {
  border: 1px solid var(--glass-border);
  border-radius: var(--glass-radius-sm);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.58), rgba(255, 255, 255, 0.34));
  box-shadow:
    0 10px 24px rgba(39, 107, 130, 0.08),
    var(--glass-highlight);
  backdrop-filter: blur(18px) saturate(1.14);
  -webkit-backdrop-filter: blur(18px) saturate(1.14);
}

.composer-field textarea {
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.46), rgba(255, 255, 255, 0.24));
  box-shadow:
    0 16px 34px rgba(39, 107, 130, 0.1),
    inset 0 1px 0 rgba(255, 255, 255, 0.72);
}

.field input::placeholder,
.field textarea::placeholder,
.composer-field textarea::placeholder {
  color: rgba(98, 123, 125, 0.74);
}

.field input:focus,
.field select:focus,
.field textarea:focus,
.composer-field textarea:focus,
.custom-size-input input:focus,
.composer-settings .pill-control:focus {
  border-color: rgba(40, 168, 131, 0.42);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.68), rgba(255, 255, 255, 0.4));
  box-shadow:
    0 0 0 4px rgba(40, 168, 131, 0.12),
    0 18px 34px rgba(39, 107, 130, 0.12),
    var(--glass-highlight);
}

.send-button,
.media-action.primary,
.download-choice-option.primary {
  border: 1px solid rgba(255, 255, 255, 0.6);
  border-radius: 999px;
  background:
    linear-gradient(135deg, rgba(255, 138, 95, 0.94), rgba(255, 95, 126, 0.9));
  color: #ffffff;
  box-shadow:
    0 14px 30px rgba(255, 122, 89, 0.24),
    inset 0 1px 0 rgba(255, 255, 255, 0.38);
}

.secondary-button:hover,
.icon-button:hover,
.mobile-header-button:hover,
.sample-chip:hover,
.media-action:hover,
.download-choice-close:hover,
.conversation-small-action:hover,
.conversation-delete:hover,
.upload-reference-button:hover,
.advanced-panel summary:hover,
.download-choice-option:hover {
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.74), rgba(232, 250, 246, 0.54));
  border-color: rgba(255, 255, 255, 0.78);
  transform: translateY(-1px);
}

.conversation-item,
.progress-box,
.result-notice,
.media-card,
.media-card-meta,
.custom-size-panel {
  border: 1px solid var(--glass-border);
  border-radius: var(--glass-radius-sm);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.54), rgba(255, 255, 255, 0.32));
  box-shadow:
    0 12px 30px rgba(39, 107, 130, 0.1),
    var(--glass-highlight);
  backdrop-filter: blur(18px) saturate(1.12);
  -webkit-backdrop-filter: blur(18px) saturate(1.12);
}

.conversation-item:hover,
.conversation-item.active {
  border-color: rgba(255, 255, 255, 0.82);
  background:
    linear-gradient(180deg, rgba(255, 246, 239, 0.72), rgba(255, 255, 255, 0.44));
}

.message-bubble {
  border-color: var(--glass-border);
  border-radius: 22px 22px 22px 8px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.6), rgba(255, 255, 255, 0.38));
  box-shadow:
    0 16px 34px rgba(39, 107, 130, 0.12),
    var(--glass-highlight);
  backdrop-filter: blur(20px) saturate(1.16);
  -webkit-backdrop-filter: blur(20px) saturate(1.16);
}

.message.user .message-bubble {
  border-color: rgba(255, 255, 255, 0.7);
  border-radius: 22px 22px 8px 22px;
  background:
    linear-gradient(180deg, rgba(255, 241, 232, 0.7), rgba(255, 255, 255, 0.38));
}

.download-choice-overlay {
  background:
    radial-gradient(circle at 28% 18%, rgba(120, 217, 198, 0.24), transparent 34%),
    rgba(32, 50, 54, 0.28);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}

@media (max-width: 860px) {
  :root {
    --glass-radius: 20px;
    --glass-radius-sm: 15px;
  }

  .app-header {
    border-radius: 0 0 20px 20px;
    background: rgba(255, 255, 255, 0.62);
  }

  .chat-panel,
  .composer-wrap {
    background:
      linear-gradient(180deg, rgba(255, 255, 255, 0.58), rgba(247, 252, 251, 0.42)),
      var(--paper-texture);
  }

  .composer-field textarea {
    border-radius: 20px;
    background:
      linear-gradient(180deg, rgba(255, 255, 255, 0.5), rgba(255, 255, 255, 0.3));
  }

  .message-bubble {
    border-radius: 20px 20px 20px 8px;
  }

  .message.user .message-bubble {
    border-radius: 20px 20px 8px 20px;
  }
}

/* ChatGPT-style module shell */
:root {
  --sidebar-width: 304px;
  --topbar-height: 62px;
}

.app-shell {
  width: 100%;
  height: 100dvh;
  max-height: 100dvh;
  padding: 0;
  display: block;
  overflow: hidden;
}

.app-header {
  position: fixed;
  top: 10px;
  right: 18px;
  z-index: 20;
  min-height: 44px;
  width: auto;
  max-width: calc(100vw - var(--sidebar-width) - 48px);
  padding: 6px 8px 6px 12px;
  gap: 12px;
}

.brand-lockup {
  display: none;
}

.header-actions {
  gap: 8px;
}

.status-pill {
  min-height: 34px;
}

.user-box {
  min-height: 34px;
}

.studio-workspace {
  height: 100dvh;
  min-height: 0;
  display: grid;
  grid-template-columns: var(--sidebar-width) minmax(0, 1fr);
  gap: 0;
  align-items: stretch;
  overflow: hidden;
}

.studio-sidebar {
  grid-column: 1;
  position: relative;
  top: 0;
  max-height: none;
  min-height: 0;
  display: grid;
  grid-template-rows: auto auto minmax(0, 1fr) auto;
  gap: 12px;
  padding: 12px;
  overflow: hidden;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.58), rgba(235, 249, 247, 0.36)),
    var(--paper-texture);
  border-right: 1px solid rgba(255, 255, 255, 0.64);
  box-shadow: inset -1px 0 0 rgba(47, 118, 132, 0.08);
  transition: transform 220ms ease, opacity 180ms ease;
}

.sidebar-brand,
.module-switch,
.history-panel {
  min-width: 0;
}

.sidebar-brand {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 6px 4px 2px;
}

.sidebar-brand strong {
  display: block;
  color: var(--text);
  font-size: 18px;
  line-height: 1.2;
}

.sidebar-toggle,
.sidebar-expand {
  font-size: 20px;
}

.module-switch {
  display: grid;
  gap: 8px;
}

.module-button {
  min-height: 46px;
  width: 100%;
  display: grid;
  grid-template-columns: 28px minmax(0, 1fr);
  align-items: center;
  gap: 10px;
  border: 1px solid rgba(255, 255, 255, 0.58);
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.36);
  color: var(--text);
  padding: 8px 12px;
  text-align: left;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.72);
}

.module-button:hover,
.module-button.active {
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.74), rgba(230, 249, 246, 0.52));
  border-color: rgba(255, 255, 255, 0.84);
  color: #173f49;
}

.sidebar-footer {
  min-width: 0;
  display: grid;
  gap: 8px;
}

.settings-button {
  width: 100%;
  min-height: 46px;
  display: grid;
  grid-template-columns: 28px minmax(0, 1fr);
  align-items: center;
  gap: 10px;
  border: 1px solid rgba(255, 255, 255, 0.62);
  border-radius: 16px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.58), rgba(255, 255, 255, 0.34));
  color: var(--text);
  padding: 8px 12px;
  text-align: left;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.74);
}

.settings-button:hover {
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.78), rgba(230, 249, 246, 0.54));
}

.settings-icon {
  width: 24px;
  height: 24px;
  position: relative;
  display: inline-block;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.52);
  box-shadow: inset 0 0 0 2px rgba(32, 103, 118, 0.16);
}

.settings-icon::before,
.settings-icon::after {
  content: "";
  position: absolute;
  border-radius: 999px;
}

.settings-icon::before {
  inset: 6px;
  border: 2px solid #4f9db1;
}

.settings-icon::after {
  inset: 10px;
  background: #ff8a6b;
}

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

.module-icon {
  width: 24px;
  height: 24px;
  position: relative;
  display: inline-block;
  border-radius: 9px;
  background: rgba(255, 255, 255, 0.52);
  box-shadow: inset 0 0 0 1px rgba(32, 103, 118, 0.14);
}

.module-icon-draw::before,
.module-icon-chat::before,
.module-icon-hot::before {
  content: "";
  position: absolute;
  inset: 6px;
  border-radius: 999px;
}

.module-icon-draw::before {
  background:
    radial-gradient(circle at 34% 34%, #7ad9c5 0 3px, transparent 4px),
    radial-gradient(circle at 66% 34%, #ffbe61 0 3px, transparent 4px),
    radial-gradient(circle at 50% 66%, #ff7f68 0 4px, transparent 5px);
}

.module-icon-chat::before {
  border: 2px solid #4f9db1;
  border-radius: 9px;
}

.module-icon-chat::after {
  content: "";
  position: absolute;
  left: 8px;
  bottom: 4px;
  width: 8px;
  height: 8px;
  border-left: 2px solid #4f9db1;
  border-bottom: 2px solid #4f9db1;
  transform: rotate(-18deg);
}

.module-icon-hot::before {
  background:
    radial-gradient(circle at 50% 30%, #ff8a6b 0 4px, transparent 5px),
    linear-gradient(135deg, transparent 34%, #ffbe61 35% 64%, transparent 65%);
}

.module-icon-hot::after {
  content: "";
  position: absolute;
  left: 7px;
  right: 7px;
  bottom: 6px;
  height: 7px;
  border-radius: 999px 999px 4px 4px;
  background: #7ad9c5;
}

.history-panel {
  min-height: 0;
  max-height: none;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  gap: 12px;
  padding: 14px;
}

.conversation-list {
  max-height: none;
  min-height: 0;
  overflow: auto;
}

.chat-panel {
  grid-column: 2;
  border: 0;
  border-radius: 0;
  min-height: 0;
  height: 100dvh;
  background:
    radial-gradient(circle at 16% 14%, rgba(126, 217, 196, 0.22), transparent 34%),
    radial-gradient(circle at 86% 12%, rgba(255, 194, 99, 0.18), transparent 32%),
    linear-gradient(180deg, rgba(255, 255, 255, 0.46), rgba(246, 252, 252, 0.34)),
    var(--paper-texture);
  box-shadow: none;
}

.chat-topline {
  min-height: var(--topbar-height);
  justify-content: flex-start;
  padding: 10px calc(var(--panel-pad) + 210px) 10px var(--panel-pad);
}

.chat-topline > div {
  min-width: 0;
}

.chat-topline #clearButton {
  margin-left: auto;
}

.mobile-module-switch {
  display: none;
}

.sidebar-expand {
  display: none;
}

.conversation-log {
  width: min(920px, 100%);
  margin: 0 auto;
  padding: 28px 24px;
}

.chat-empty {
  padding: 32px 0;
}

.chat-empty p {
  font-size: clamp(30px, 4vw, 46px);
}

.composer-wrap {
  width: min(920px, calc(100% - 32px));
  margin: 0 auto 14px;
  border: 1px solid rgba(255, 255, 255, 0.62);
  border-radius: 24px;
  padding: 12px;
}

.composer-settings[hidden],
.composer-advanced[hidden],
.chat-quick-settings[hidden],
.upload-reference-button[hidden] {
  display: none !important;
}

.chat-quick-settings {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  width: min(920px, 100%);
  margin: 0 auto 10px;
  padding: 0 4px;
}

.quick-select {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  border: 1px solid rgba(255, 255, 255, 0.58);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.52);
  padding: 5px 6px 5px 12px;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.7), 0 12px 24px rgba(43, 97, 118, 0.08);
  backdrop-filter: blur(16px) saturate(1.28);
  -webkit-backdrop-filter: blur(16px) saturate(1.28);
}

.quick-select span {
  color: rgba(43, 63, 76, 0.72);
  font-size: 12px;
  font-weight: 900;
  white-space: nowrap;
}

.quick-select select {
  min-height: 34px;
  border: 0;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.68);
  color: #203744;
  padding: 0 28px 0 12px;
  font-size: 14px;
  font-weight: 900;
  outline: none;
}

.composer-field textarea {
  min-height: 58px;
  max-height: 180px;
  padding: 15px 180px 48px 16px;
  border-radius: 22px;
}

.composer-inline-actions {
  right: 12px;
  bottom: 12px;
}

.chat-text {
  white-space: pre-wrap;
  overflow-wrap: break-word;
  word-break: normal;
}

.chat-text.streaming::after {
  content: "";
  display: inline-block;
  width: 7px;
  height: 1.15em;
  margin-left: 3px;
  border-radius: 999px;
  background: currentColor;
  vertical-align: -0.18em;
  animation: stream-caret 900ms steps(2, end) infinite;
}

.chat-text.error {
  border-color: rgba(180, 35, 24, 0.28);
  color: var(--danger);
}

.chat-thinking {
  display: grid;
  gap: 10px;
  width: 100%;
  border: 1px solid rgba(255, 255, 255, 0.62);
  border-radius: 18px;
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.68), rgba(245, 252, 255, 0.48));
  color: rgba(40, 57, 68, 0.82);
  padding: 12px 14px;
  box-shadow: 0 18px 42px rgba(49, 102, 125, 0.12), inset 0 1px 0 rgba(255, 255, 255, 0.72);
  backdrop-filter: blur(18px) saturate(1.34);
  -webkit-backdrop-filter: blur(18px) saturate(1.34);
}

.chat-thinking-header {
  display: flex;
  align-items: center;
  gap: 8px;
}

.chat-thinking-header span {
  width: 8px;
  height: 8px;
  border-radius: 999px;
  background: #35b99b;
  box-shadow: 0 0 0 5px rgba(53, 185, 155, 0.14);
  animation: thinking-pulse 1.2s ease-in-out infinite;
}

.chat-thinking.done .chat-thinking-header span {
  background: #4f8cff;
  box-shadow: 0 0 0 5px rgba(79, 140, 255, 0.12);
  animation: none;
}

.chat-thinking-header strong {
  color: #203744;
  font-size: 13px;
  font-weight: 900;
}

.chat-thinking-header small {
  margin-left: auto;
  color: rgba(72, 90, 101, 0.74);
  font-size: 12px;
  font-weight: 800;
}

.chat-thinking-text {
  color: rgba(43, 63, 76, 0.78);
  font-size: 13px;
  font-weight: 700;
  line-height: 1.7;
  white-space: pre-wrap;
}

@keyframes thinking-pulse {
  0%,
  100% {
    transform: scale(0.86);
    opacity: 0.68;
  }

  50% {
    transform: scale(1.08);
    opacity: 1;
  }
}

@keyframes stream-caret {
  0%,
  45% {
    opacity: 1;
  }

  46%,
  100% {
    opacity: 0;
  }
}

.settings-overlay {
  position: fixed;
  inset: 0;
  z-index: 90;
  display: grid;
  place-items: center;
  padding: 18px;
  background:
    radial-gradient(circle at 24% 18%, rgba(120, 217, 198, 0.24), transparent 34%),
    rgba(32, 50, 54, 0.28);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}

.settings-dialog {
  width: min(640px, 100%);
  max-height: min(720px, calc(100dvh - 36px));
  overflow: auto;
  border: 1px solid rgba(255, 255, 255, 0.72);
  border-radius: 26px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.72), rgba(247, 252, 251, 0.5)),
    var(--paper-texture);
  box-shadow:
    0 28px 80px rgba(32, 92, 108, 0.24),
    inset 0 1px 0 rgba(255, 255, 255, 0.82);
  backdrop-filter: blur(28px) saturate(1.18);
  -webkit-backdrop-filter: blur(28px) saturate(1.18);
  padding: 18px;
}

.settings-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding-bottom: 14px;
}

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

.settings-card {
  min-width: 0;
  display: grid;
  align-content: start;
  gap: 10px;
  border: 1px solid rgba(255, 255, 255, 0.68);
  border-radius: 20px;
  background: rgba(255, 255, 255, 0.42);
  box-shadow:
    0 12px 30px rgba(39, 107, 130, 0.1),
    inset 0 1px 0 rgba(255, 255, 255, 0.72);
  padding: 14px;
}

.settings-card-wide {
  grid-column: 1 / -1;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  align-items: end;
}

.settings-card-wide .settings-label {
  grid-column: 1 / -1;
}

.settings-label {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
  font-weight: 900;
}

.settings-card strong {
  min-width: 0;
  overflow-wrap: anywhere;
}

.settings-card small {
  color: var(--muted);
  font-weight: 700;
  line-height: 1.4;
}

.app-shell.sidebar-collapsed .studio-workspace {
  grid-template-columns: 0 minmax(0, 1fr);
}

.app-shell.sidebar-collapsed .studio-sidebar {
  transform: translateX(-100%);
  opacity: 0;
  pointer-events: none;
  padding-inline: 0;
  border-right: 0;
}

.app-shell.sidebar-collapsed .app-header {
  max-width: calc(100vw - 92px);
}

.app-shell.sidebar-collapsed .sidebar-expand {
  display: grid;
}

.app-shell.sidebar-collapsed .conversation-log,
.app-shell.sidebar-collapsed .composer-wrap {
  width: min(980px, calc(100% - 32px));
}

@media (max-width: 860px) {
  :root {
    --sidebar-width: min(82vw, 320px);
  }

  .app-header {
    top: 8px;
    right: 8px;
    max-width: calc(100vw - 18px);
  }

  .user-box div,
  .status-pill {
    display: none;
  }

  .mobile-header-button {
    display: inline-flex;
  }

  .studio-workspace {
    grid-template-columns: 0 minmax(0, 1fr);
  }

  .studio-sidebar {
    position: fixed;
    z-index: 50;
    inset: 0 auto 0 0;
    width: var(--sidebar-width);
    transform: translateX(-105%);
  }

  .app-shell.history-open .studio-sidebar {
    transform: translateX(0);
    opacity: 1;
    pointer-events: auto;
  }

  .app-shell.history-open::after {
    content: "";
    position: fixed;
    inset: 0;
    z-index: 40;
    background: rgba(31, 55, 60, 0.26);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
  }

  .sidebar-expand {
    display: grid;
  }

  .sidebar-toggle {
    display: none;
  }

  .chat-topline {
    min-height: auto;
    display: grid;
    grid-template-columns: auto minmax(0, 1fr) auto;
    gap: 8px;
    align-items: center;
    padding: 8px 10px;
  }

  .chat-topline > div {
    display: none;
  }

  .mobile-module-switch {
    display: grid;
    grid-column: 2;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 4px;
    min-width: 0;
    border: 1px solid rgba(255, 255, 255, 0.62);
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.42);
    padding: 4px;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.72), 0 10px 24px rgba(39, 107, 130, 0.08);
    backdrop-filter: blur(14px) saturate(1.2);
    -webkit-backdrop-filter: blur(14px) saturate(1.2);
  }

  .mobile-module-button {
    min-width: 0;
    min-height: 34px;
    border-radius: 999px;
    border: 0;
    background: transparent;
    color: rgba(32, 55, 68, 0.72);
    padding: 0 10px;
    font-size: 14px;
    font-weight: 900;
    white-space: nowrap;
  }

  .mobile-module-button:hover,
  .mobile-module-button.active {
    background: rgba(255, 255, 255, 0.86);
    color: #173f49;
    box-shadow: 0 8px 18px rgba(39, 107, 130, 0.1);
  }

  .chat-topline #clearButton {
    min-height: 36px;
    margin-left: 0;
    border-radius: 999px;
    padding: 0 12px;
    font-size: 13px;
  }

  .conversation-log {
    width: 100%;
    padding: 18px 12px;
  }

  .composer-wrap {
    width: calc(100% - 16px);
    margin-bottom: 8px;
    border-radius: 22px;
  }

  .composer-field textarea {
    padding-right: 112px;
  }

  .upload-reference-button {
    display: none;
  }

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

  .settings-dialog {
    border-radius: 22px;
  }
}

@media (max-width: 860px) {
  .app-shell,
  .studio-workspace,
  .chat-panel {
    height: 100dvh;
    max-height: 100dvh;
    min-height: 0;
    overflow: hidden;
  }

  .studio-workspace {
    display: grid;
    grid-template-columns: 0 minmax(0, 1fr);
    grid-template-rows: minmax(0, 1fr);
  }

  .chat-panel {
    display: grid;
    grid-template-rows: 54px minmax(0, 1fr) auto;
    isolation: isolate;
  }

  .chat-topline {
    position: relative;
    z-index: 8;
    grid-row: 1;
    min-height: 54px;
    display: grid;
    grid-template-columns: 40px minmax(0, 1fr) 38px auto;
    gap: 8px;
    align-items: center;
    padding: max(8px, env(safe-area-inset-top)) 10px 8px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.52);
    background: rgba(255, 255, 255, 0.54);
    backdrop-filter: blur(18px) saturate(1.24);
    -webkit-backdrop-filter: blur(18px) saturate(1.24);
  }

  .chat-topline > div {
    display: none;
  }

  .chat-topline .sidebar-expand {
    grid-column: 1;
    width: 40px;
    min-height: 38px;
    display: grid;
  }

  .mobile-module-switch {
    grid-column: 2;
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    align-self: center;
    min-height: 38px;
  }

  .chat-topline #clearButton {
    grid-column: 4;
    min-height: 38px;
    padding: 0 10px;
  }

  .mobile-settings-button {
    grid-column: 3;
    width: 38px;
    min-height: 38px;
    display: grid;
    border-radius: 999px;
  }

  .conversation-log {
    position: relative;
    z-index: 1;
    grid-row: 2;
    min-height: 0;
    height: auto;
    overflow: auto;
    padding: 12px 12px 14px;
  }

  .composer-wrap {
    position: relative;
    z-index: 7;
    grid-row: 3;
    width: calc(100% - 16px);
    margin: 0 auto max(8px, env(safe-area-inset-bottom));
    padding: 8px;
    border-radius: 20px;
  }

  .chat-quick-settings {
    display: none !important;
  }

  .upload-reference-button:not([hidden]) {
    display: inline-flex;
  }

  .upload-reference-button span {
    max-width: 60px;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  .upload-reference-preview {
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 8px;
    margin-top: 8px;
  }

  .upload-reference-preview > img[hidden] {
    display: none;
  }

  .upload-reference-preview > div {
    display: none;
  }

  .upload-reference-preview .attachment-grid {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }

  .composer-field textarea {
    min-height: 42px;
    max-height: 88px;
    line-height: 22px;
    padding: 10px 174px 10px 14px;
    border-radius: 18px;
  }

  .composer-inline-actions {
    right: 8px;
    bottom: 5px;
    left: auto;
    height: 32px;
    justify-content: flex-end;
  }

  .composer-inline-actions .cancel-button,
  .composer-inline-actions .send-button {
    min-height: 32px;
    padding: 0 11px;
  }
}

@media (max-width: 430px) {
  .chat-panel {
    grid-template-rows: 52px minmax(0, 1fr) auto;
  }

  .chat-topline {
    min-height: 52px;
    grid-template-columns: 38px minmax(0, 1fr) 36px auto;
    gap: 6px;
    padding-left: 8px;
    padding-right: 8px;
  }

  .mobile-module-button {
    min-height: 32px;
    padding: 0 8px;
    font-size: 13px;
  }

  .chat-topline #clearButton {
    min-height: 34px;
    padding: 0 9px;
    font-size: 12px;
  }

  .mobile-settings-button {
    width: 36px;
    min-height: 34px;
    font-size: 13px;
  }
}

/* 0.8.0 productivity and safety polish */
.history-search {
  display: block;
}

.history-search input,
.preset-library input {
  width: 100%;
  min-height: 38px;
  border: 1px solid rgba(255, 255, 255, 0.62);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.48);
  color: #203744;
  padding: 0 14px;
  outline: none;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.68);
  backdrop-filter: blur(16px) saturate(1.22);
  -webkit-backdrop-filter: blur(16px) saturate(1.22);
}

.sidebar-footer {
  display: grid;
  gap: 8px;
}

.export-icon {
  width: 18px;
  height: 18px;
  border-radius: 6px;
  border: 2px solid currentColor;
  position: relative;
}

.export-icon::before {
  content: "";
  position: absolute;
  left: 4px;
  right: 4px;
  bottom: 3px;
  height: 2px;
  border-radius: 999px;
  background: currentColor;
}

.export-icon::after {
  content: "↓";
  position: absolute;
  inset: -8px 0 auto;
  color: currentColor;
  font-size: 14px;
  font-weight: 900;
  text-align: center;
  line-height: 18px;
}

.version-banner {
  position: absolute;
  top: 10px;
  left: 50%;
  z-index: 15;
  display: inline-flex;
  align-items: center;
  gap: 10px;
  max-width: calc(100% - 24px);
  transform: translateX(-50%);
  border: 1px solid rgba(255, 255, 255, 0.7);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.72);
  color: #203744;
  padding: 8px 10px 8px 14px;
  box-shadow: 0 18px 42px rgba(49, 102, 125, 0.14), inset 0 1px 0 rgba(255, 255, 255, 0.8);
  backdrop-filter: blur(18px) saturate(1.28);
  -webkit-backdrop-filter: blur(18px) saturate(1.28);
}

.version-banner button,
.preset-library-header button {
  min-height: 30px;
  border: 0;
  border-radius: 999px;
  background: linear-gradient(135deg, #4f8cff, #35b99b);
  color: #fff;
  padding: 0 12px;
  font-weight: 900;
  cursor: pointer;
}

.task-queue-panel,
.preset-library {
  display: grid;
  gap: 8px;
  margin-bottom: 10px;
  border: 1px solid rgba(255, 255, 255, 0.62);
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.42);
  padding: 10px;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.72), 0 10px 24px rgba(39, 107, 130, 0.08);
  backdrop-filter: blur(16px) saturate(1.22);
  -webkit-backdrop-filter: blur(16px) saturate(1.22);
}

.task-queue-panel[hidden] {
  display: none !important;
}

.task-queue-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  min-height: 34px;
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.48);
  color: rgba(32, 55, 68, 0.78);
  padding: 6px 10px;
  font-size: 13px;
  font-weight: 800;
}

.task-queue-item.running {
  color: #1f6e81;
}

.task-queue-item.done {
  color: #1b7a61;
}

.task-queue-item.error,
.task-queue-item.cancelled {
  color: #b42318;
}

.preset-library-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  color: rgba(43, 63, 76, 0.78);
  font-size: 13px;
  font-weight: 900;
}

.preset-library-body {
  display: grid;
  gap: 8px;
}

.preset-library-body[hidden] {
  display: none !important;
}

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

.preset-item {
  min-width: 0;
  min-height: 72px;
  display: grid;
  gap: 4px;
  text-align: left;
  border: 1px solid rgba(255, 255, 255, 0.62);
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.5);
  color: #203744;
  padding: 10px;
  cursor: pointer;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.68);
}

.preset-item strong {
  font-size: 13px;
  font-weight: 900;
}

.preset-item span,
.preset-empty {
  margin: 0;
  color: rgba(43, 63, 76, 0.68);
  font-size: 12px;
  line-height: 1.45;
}

.chat-text {
  display: grid;
  gap: 8px;
}

.chat-text p,
.chat-text ol,
.chat-text ul {
  margin: 0;
}

.chat-text ol,
.chat-text ul {
  padding-left: 1.25em;
}

.chat-text li + li {
  margin-top: 5px;
}

.chat-section-title {
  display: block;
  color: #203744;
  font-weight: 900;
}

.model-capability-hint {
  grid-column: 1 / -1;
}

.settings-data-row {
  grid-column: 1 / -1;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}

.usage-pill {
  display: inline-flex;
  align-items: center;
  align-self: flex-start;
  max-width: 100%;
  border: 1px solid rgba(255, 255, 255, 0.58);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.42);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.68);
  color: rgba(43, 63, 76, 0.72);
  font-size: 11px;
  font-weight: 800;
  line-height: 1.35;
  overflow-wrap: anywhere;
  padding: 6px 10px;
}

.data-console-panel {
  grid-column: 1 / -1;
  display: grid;
  gap: 12px;
}

.data-console-shell {
  min-height: 100dvh;
  padding: 24px;
  background:
    linear-gradient(135deg, rgba(122, 214, 244, 0.28), rgba(255, 211, 111, 0.18)),
    var(--paper-texture);
}

.data-console-topbar,
.data-console-overview,
.data-console-section {
  border: 1px solid rgba(255, 255, 255, 0.68);
  border-radius: 24px;
  background: rgba(255, 255, 255, 0.48);
  box-shadow:
    0 18px 48px rgba(39, 107, 130, 0.12),
    inset 0 1px 0 rgba(255, 255, 255, 0.75);
  backdrop-filter: blur(24px) saturate(1.2);
  -webkit-backdrop-filter: blur(24px) saturate(1.2);
}

.data-console-topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin: 0 auto 14px;
  max-width: 1280px;
  padding: 16px 18px;
}

.data-console-topbar h1 {
  margin: 2px 0 0;
  font-size: 24px;
}

.data-console-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: flex-end;
}

.data-console-overview {
  display: grid;
  gap: 6px;
  margin: 0 auto 14px;
  max-width: 1280px;
  padding: 16px 18px;
}

.data-console-layout {
  display: grid;
  grid-template-columns: minmax(260px, 0.34fr) minmax(0, 0.66fr);
  gap: 14px;
  margin: 0 auto;
  max-width: 1280px;
}

.data-console-section {
  min-height: 0;
  padding: 14px;
}

.data-console-section-head {
  align-items: center;
  display: flex;
  gap: 10px;
  justify-content: space-between;
  margin-bottom: 10px;
}

.data-console-users,
.data-console-messages {
  display: grid;
  gap: 8px;
  max-height: calc(100dvh - 220px);
  overflow: auto;
}

.data-console-user,
.data-console-message {
  display: grid;
  gap: 6px;
  border: 1px solid rgba(255, 255, 255, 0.58);
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.38);
  box-shadow:
    0 10px 22px rgba(39, 107, 130, 0.08),
    inset 0 1px 0 rgba(255, 255, 255, 0.68);
  padding: 10px 12px;
}

.data-console-user {
  appearance: none;
  color: inherit;
  cursor: pointer;
  text-align: left;
  transition: border-color 0.2s ease, box-shadow 0.2s ease, transform 0.2s ease;
}

.data-console-user:hover,
.data-console-user.active {
  border-color: rgba(255, 138, 101, 0.64);
  box-shadow:
    0 14px 28px rgba(255, 138, 101, 0.16),
    inset 0 1px 0 rgba(255, 255, 255, 0.78);
  transform: translateY(-1px);
}

#showAllDataConsoleMessagesButton.active {
  border-color: rgba(87, 190, 255, 0.72);
  background: rgba(214, 243, 255, 0.66);
}

.data-console-user small,
.data-console-message small {
  color: rgba(43, 63, 76, 0.68);
}

.data-console-message-head {
  display: flex;
  justify-content: space-between;
  gap: 10px;
}

.data-console-message p {
  max-height: 7.5em;
  overflow: auto;
  margin: 0;
  color: rgba(32, 55, 68, 0.82);
  font-size: 13px;
  line-height: 1.55;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.data-console-media-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.data-console-media-grid a,
.data-console-more {
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.48);
  color: rgba(32, 55, 68, 0.78);
  font-size: 12px;
  font-weight: 900;
  padding: 6px 9px;
  text-decoration: none;
}

@media (max-width: 860px) {
  .data-console-shell {
    padding: 12px;
  }

  .data-console-topbar {
    align-items: flex-start;
    border-radius: 20px;
    flex-direction: column;
  }

  .data-console-actions {
    width: 100%;
  }

  .data-console-actions .secondary-button {
    flex: 1;
  }

  .data-console-layout {
    grid-template-columns: 1fr;
  }

  .data-console-users,
  .data-console-messages {
    max-height: none;
  }
}

.danger-lite {
  color: #b42318;
}

.recent-log-list {
  grid-column: 1 / -1;
  display: grid;
  gap: 6px;
  max-height: 160px;
  overflow: auto;
}

.recent-log-item {
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.42);
  color: rgba(43, 63, 76, 0.72);
  padding: 8px 10px;
  font-size: 12px;
  line-height: 1.45;
}

.recent-log-item.error {
  color: #b42318;
}

@media (max-width: 860px) {
  .version-banner {
    top: 58px;
    width: calc(100% - 20px);
    justify-content: space-between;
    border-radius: 16px;
    font-size: 13px;
  }

  .preset-library {
    margin-bottom: 8px;
    padding: 8px;
  }

  .preset-list {
    grid-template-columns: 1fr;
    max-height: 190px;
    overflow: auto;
  }

  .task-queue-panel {
    padding: 8px;
  }

  .composer-field textarea {
    height: auto;
    min-height: 42px;
    max-height: 110px;
  }
}

/* 0.8.4 wider chat workspace and quieter composer */
.app-shell {
  width: 100%;
  max-width: none;
  padding: 0;
}

.studio-workspace {
  width: 100%;
  max-width: none;
}

.chat-panel {
  width: 100%;
  max-width: none;
}

.conversation-log {
  width: min(100%, 1320px);
  max-width: calc(100% - 40px);
  margin-inline: auto;
  padding-inline: clamp(14px, 2vw, 28px);
}

.composer-wrap {
  width: min(100%, 1320px);
  max-width: calc(100% - 40px);
  margin-inline: auto;
}

.message-body {
  width: min(100%, 1160px);
  max-width: 100%;
}

.message-bubble,
.message.user .message-bubble {
  max-width: min(100%, 1040px);
}

.preset-library[hidden],
.task-queue-panel[hidden] {
  display: none !important;
}

@media (min-width: 1320px) {
  .conversation-log,
  .composer-wrap {
    width: calc(100% - 48px);
  }

  .message-body {
    width: min(100%, calc(100vw - var(--sidebar-width) - 180px));
  }

  .message-bubble,
  .message.user .message-bubble {
    max-width: min(100%, calc(100vw - var(--sidebar-width) - 300px));
  }
}

@media (max-width: 860px) {
  .conversation-log,
  .composer-wrap {
    width: calc(100% - 16px);
    max-width: calc(100% - 16px);
  }
}

/* 0.8.5 inline chat model controls */
.composer-inline-actions .chat-quick-settings {
  display: inline-flex;
  align-items: center;
  flex-wrap: nowrap;
  gap: 6px;
  width: auto;
  margin: 0;
  padding: 0;
}

.composer-inline-actions .chat-quick-settings[hidden] {
  display: none !important;
}

.composer-inline-actions .quick-select {
  min-height: 34px;
  gap: 5px;
  padding: 4px 5px 4px 9px;
}

.composer-inline-actions .quick-select span {
  font-size: 11px;
}

.composer-inline-actions .quick-select select {
  min-height: 28px;
  max-width: 118px;
  font-size: 12px;
  padding: 0 22px 0 8px;
}

.app-shell[data-module="chat"] .composer-field textarea {
  padding-right: 450px;
}

@media (max-width: 860px) {
  .composer-inline-actions .chat-quick-settings:not([hidden]) {
    display: inline-flex !important;
  }

  .composer-inline-actions .quick-select {
    min-height: 32px;
    gap: 0;
    padding: 0;
    border: 0;
    background: transparent;
    box-shadow: none;
  }

  .composer-inline-actions .quick-select span {
    display: none;
  }

  .composer-inline-actions .quick-select select {
    min-height: 32px;
    max-width: 82px;
    font-size: 11px;
    padding: 0 18px 0 8px;
  }

  .app-shell[data-module="chat"] .composer-field textarea {
    padding-right: 340px;
  }
}

/* 0.8.7 compact mobile upload attachments */
.chat-upload-preview {
  align-items: center;
}

.chat-upload-preview > img,
.chat-upload-preview > div,
.chat-upload-preview #clearUploadReferenceButton {
  display: none !important;
}

.chat-upload-preview .attachment-grid {
  display: flex;
  grid-template-columns: none;
  align-items: center;
  gap: 8px;
  width: 100%;
  min-width: 0;
  overflow-x: auto;
  overflow-y: visible;
  padding: 6px 2px 4px;
  scrollbar-width: none;
}

.chat-upload-preview .attachment-grid::-webkit-scrollbar {
  display: none;
}

.chat-upload-preview .attachment-thumb {
  flex: 0 0 auto;
  width: 64px;
  gap: 0;
}

.chat-upload-preview .attachment-thumb img {
  width: 64px;
  height: 64px;
  border-radius: 16px;
  border: 1px solid rgba(255, 255, 255, 0.7);
  box-shadow: 0 10px 22px rgba(32, 55, 68, 0.12);
}

.chat-upload-preview .attachment-thumb figcaption {
  display: none;
}

@media (max-width: 860px) {
  .chat-upload-preview {
    margin: 0 0 6px;
    padding: 2px 4px 0;
    border: 0;
    background: transparent;
    box-shadow: none;
  }

  .chat-upload-preview .attachment-grid {
    gap: 7px;
    padding: 6px 2px 3px;
  }

  .chat-upload-preview .attachment-thumb,
  .chat-upload-preview .attachment-thumb img {
    width: 54px;
  }

  .chat-upload-preview .attachment-thumb img {
    height: 54px;
    border-radius: 14px;
  }

  .attachment-remove-button {
    top: -7px;
    right: -7px;
    width: 22px;
    min-width: 22px;
    height: 22px;
    min-height: 22px;
    font-size: 15px;
  }

  .composer-inline-actions .upload-reference-button,
  .composer-inline-actions .cancel-button,
  .composer-inline-actions .send-button {
    min-height: 30px;
    padding: 0 9px;
    font-size: 12px;
  }

  .upload-reference-button span {
    max-width: 50px;
  }
}

@media (max-width: 430px) {
  .chat-upload-preview .attachment-thumb,
  .chat-upload-preview .attachment-thumb img {
    width: 48px;
  }

  .chat-upload-preview .attachment-thumb img {
    height: 48px;
    border-radius: 13px;
  }

  .app-shell[data-module="chat"] .composer-inline-actions .upload-reference-button,
  .app-shell[data-module="chat"] .composer-inline-actions .cancel-button,
  .app-shell[data-module="chat"] .composer-inline-actions .send-button {
    min-height: 30px;
    padding: 0 8px;
    font-size: 12px;
  }

  .app-shell[data-module="chat"] .upload-reference-button span {
    max-width: 48px;
  }
}

/* 0.8.8 stabilize chat scenic background during input focus */
.conversation-log {
  background-image:
    linear-gradient(180deg, rgba(255, 255, 255, 0.22), rgba(242, 251, 255, 0.16)),
    radial-gradient(circle, rgba(255, 209, 102, 0.2), transparent 62%),
    radial-gradient(circle, rgba(120, 217, 198, 0.18), transparent 64%),
    radial-gradient(circle, rgba(255, 122, 89, 0.1), transparent 66%),
    var(--ink-landscape);
  background-position:
    center,
    14% 12%,
    82% 20%,
    78% 86%,
    center bottom;
  background-size:
    100% 100%,
    620px 620px,
    760px 760px,
    720px 720px,
    min(1120px, 82vw) auto;
  background-repeat: no-repeat;
  background-blend-mode: normal, normal, normal, normal, soft-light;
}

@media (max-width: 860px) {
  .conversation-log {
    background-position:
      center,
      10% 2%,
      100% 22%,
      72% 92%,
      center 18px;
    background-size:
      100% 100%,
      420px 420px,
      520px 520px,
      500px 500px,
      min(720px, 170vw) auto;
  }
}

@media (max-width: 430px) {
  .composer-inline-actions .chat-quick-settings {
    gap: 4px;
  }

  .composer-inline-actions .quick-select select {
    max-width: 72px;
  }

  .app-shell[data-module="chat"] .composer-field textarea {
    padding-right: 12px;
    padding-bottom: 86px;
  }

  .app-shell[data-module="chat"] .composer-inline-actions {
    align-items: stretch;
    flex-wrap: wrap;
    height: auto;
    row-gap: 6px;
  }

  .app-shell[data-module="chat"] .composer-inline-actions .chat-quick-settings {
    flex: 1 1 100%;
    justify-content: flex-end;
  }
}

/* 0.8.9 final composer lock */
.composer-field textarea,
.app-shell[data-module="chat"] .composer-field textarea {
  height: 86px !important;
  min-height: 86px !important;
  max-height: 86px !important;
  padding-top: 12px;
  padding-bottom: 42px;
  resize: none;
  overflow-y: auto;
}

@media (max-width: 860px) {
  .composer-field textarea,
  .app-shell[data-module="chat"] .composer-field textarea {
    height: 78px !important;
    min-height: 78px !important;
    max-height: 78px !important;
    padding-top: 10px;
    padding-bottom: 40px;
  }
}

@media (max-width: 430px) {
  .app-shell[data-module="chat"] .composer-field textarea {
    height: 112px !important;
    min-height: 112px !important;
    max-height: 112px !important;
    padding-top: 12px;
    padding-bottom: 74px;
  }
}

/* 0.8.10 mobile message containment */
.chat-text,
.chat-text *,
.message-bubble,
.message-body {
  min-width: 0;
  max-width: 100%;
  overflow-wrap: anywhere;
  word-break: break-word;
}

.message-bubble {
  box-sizing: border-box;
  overflow-x: hidden;
}

@media (max-width: 860px) {
  .conversation-log {
    overflow-x: hidden;
  }

  .message,
  .message.user,
  .message-body,
  .message-bubble,
  .message.user .message-bubble {
    max-width: 100%;
    min-width: 0;
  }

  .message-body {
    width: 100%;
  }

  .chat-text {
    white-space: pre-wrap;
    line-break: anywhere;
  }
}
