*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
.hidden { display: none !important; }

:root {
  --bg: #fff7fb;
  --thread-bg: #ffffff;
  --user-bubble-bg: #fff0f7;
  --user-bubble-text: #3b1830;
  --card-bg: rgba(255, 255, 255, .82);
  --accent: #ff4fa3;
  --accent-hover: #e83f91;
  --accent-deep: #6d28d9;
  --accent-cyan: #22d3ee;
  --accent-light: #fff0f7;
  --ink: #231829;
  --muted: #7a6476;
  --border: rgba(112, 72, 105, .16);
  --input-bg: #ffffff;
  --danger: #dc2626;
  --shadow-sm: 0 10px 28px rgba(88, 28, 72, .10);
  --shadow-md: 0 28px 80px rgba(60, 18, 58, .16);
  --radius: 18px;
  --radius-sm: 12px;
  --font: Inter, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

html, body {
  height: 100%;
  overflow-x: hidden;
  font-family: var(--font);
  background:
    radial-gradient(circle at 16% 12%, rgba(255, 79, 163, .24), transparent 32%),
    radial-gradient(circle at 88% 4%, rgba(34, 211, 238, .22), transparent 30%),
    radial-gradient(circle at 72% 84%, rgba(109, 40, 217, .16), transparent 34%),
    linear-gradient(145deg, #fff9fd 0%, #fff2f8 42%, #f3fbff 100%);
  color: var(--ink);
  font-size: 15px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

/* ── Layout ── */
.app {
  display: flex;
  flex-direction: column;
  width: min(100%, 960px);
  height: 100dvh; /* dynamic viewport — avoids mobile browser chrome overlap */
  max-width: 960px;
  margin: 0 auto;
  background: rgba(255, 255, 255, .64);
  backdrop-filter: blur(24px);
  box-shadow: var(--shadow-md);
  border-left: 1px solid rgba(255, 255, 255, .72);
  border-right: 1px solid rgba(255, 255, 255, .72);
}

/* ── Header ── */
.header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 20px;
  border-bottom: 1px solid #e5e7eb;
  background: #ffffff;
  flex-shrink: 0;
  z-index: 10;
}

.header-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 600;
  font-size: 16px;
  color: #111827;
  text-decoration: none;
}

.header-brand svg { color: #4f46e5; }

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

.btn-ghost {
  background: none;
  border: 1px solid #e5e7eb;
  color: #6b7280;
  padding: 5px 12px;
  border-radius: 20px;
  font-size: 13px;
  cursor: pointer;
  transition: all .15s;
  font-family: var(--font);
}

.btn-ghost:hover {
  border-color: #4f46e5;
  color: #4f46e5;
}

.user-chip {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  color: #6b7280;
  font-weight: 500;
}

.user-chip strong { color: #111827; }

/* ── Thread ── */
.thread {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding: 26px 22px 18px;
  display: flex;
  flex-direction: column;
  gap: 22px;
  scroll-behavior: smooth;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, .45), rgba(255, 255, 255, .78)),
    radial-gradient(circle at 6% 2%, rgba(255, 79, 163, .10), transparent 26%),
    radial-gradient(circle at 94% 14%, rgba(34, 211, 238, .10), transparent 30%);
}

.studio-hero {
  position: relative;
  overflow: hidden;
  isolation: isolate;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 22px;
  align-items: end;
  padding: 28px;
  border: 1px solid rgba(255, 255, 255, .74);
  border-radius: 28px;
  background:
    linear-gradient(90deg, rgba(255,255,255,.97) 0%, rgba(255,255,255,.92) 38%, rgba(255,255,255,.68) 68%, rgba(255,255,255,.44) 100%),
    radial-gradient(circle at 14% 10%, rgba(255, 79, 163, .18), transparent 36%),
    radial-gradient(circle at 86% 22%, rgba(34, 211, 238, .14), transparent 34%),
    url("assets/salon-hero-bg.png") right center / cover no-repeat;
  box-shadow: 0 24px 70px rgba(91, 33, 90, .12);
}

.studio-hero::after {
  content: "";
  position: absolute;
  inset: 0;
  background:
    linear-gradient(135deg, rgba(255, 247, 251, .42), rgba(243, 251, 255, .22)),
    repeating-linear-gradient(135deg, rgba(255,255,255,.10) 0 14px, rgba(255,255,255,0) 14px 28px);
  pointer-events: none;
}

.studio-hero-copy,
.studio-hero-tags {
  position: relative;
  z-index: 1;
  min-width: 0;
}

.studio-kicker {
  display: inline-flex;
  align-items: center;
  width: fit-content;
  border-radius: 999px;
  padding: 6px 10px;
  background: rgba(255, 79, 163, .12);
  color: #a31568;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: .12em;
}

.studio-hero h1 {
  margin-top: 12px;
  font-size: clamp(28px, 5vw, 46px);
  line-height: 1.04;
  letter-spacing: 0;
  color: var(--ink);
  max-width: 100%;
  overflow-wrap: anywhere;
  word-break: break-word;
}

.hero-prompt-box {
  width: min(100%, 240px);
  height: 33px;
  margin-top: 16px;
  border-radius: 999px;
  border: 1px solid rgba(112, 72, 105, .15);
  background: rgba(255, 255, 255, .72);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .7), 0 12px 34px rgba(91, 33, 90, .08);
  transition: border-color .16s, box-shadow .16s;
}

.hero-prompt-box:focus-within {
  border-color: rgba(255, 79, 163, .42);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .8), 0 16px 38px rgba(255, 79, 163, .12);
}

.hero-prompt-input {
  display: block;
  width: 100%;
  height: 33px;
  min-height: 33px;
  max-height: 33px;
  resize: none;
  border: 0;
  outline: 0;
  padding: 5px 15px;
  border-radius: inherit;
  background: transparent;
  color: var(--ink);
  font-family: var(--font);
  font-size: 15px;
  line-height: 21px;
  overflow: hidden;
}

.hero-prompt-input::placeholder {
  color: #9f8799;
}

.studio-hero-tags {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px;
  max-width: 240px;
}

.studio-mode {
  border: 1px solid rgba(255, 255, 255, .82);
  border-radius: 999px;
  padding: 7px 11px;
  background: rgba(255, 255, 255, .68);
  color: #70405f;
  font-size: 12px;
  font-weight: 650;
  font-family: var(--font);
  cursor: pointer;
  box-shadow: 0 8px 24px rgba(130, 43, 113, .08);
  transition: transform .16s, border-color .16s, background .16s, color .16s, box-shadow .16s;
}

.studio-mode:hover {
  border-color: rgba(255, 79, 163, .36);
  background: rgba(255, 240, 247, .88);
  color: #a31568;
  box-shadow: 0 10px 28px rgba(255, 79, 163, .14);
  transform: translateY(-1px);
}

.studio-mode.is-active {
  border-color: rgba(199, 32, 126, .68);
  background: linear-gradient(135deg, #ff4fa3, #9b5cff);
  color: #fff;
  box-shadow: 0 14px 32px rgba(199, 32, 126, .28);
  transform: translateY(-1px);
}

.studio-mode.is-active:hover {
  border-color: rgba(199, 32, 126, .78);
  background: linear-gradient(135deg, #f23f98, #884cff);
  color: #fff;
}

/* ── Upload placeholder (lives inside thread) ── */
.upload-placeholder {
  width: 100%;
}

.upload-placeholder.has-photo {
  display: flex;
  justify-content: flex-start;
}

.upload-zone {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  width: 100%;
  min-height: 220px;
  border: 1.5px dashed rgba(255, 79, 163, .36);
  border-radius: 26px;
  cursor: pointer;
  color: var(--muted);
  text-align: center;
  background:
    linear-gradient(135deg, rgba(255,255,255,.84), rgba(255,255,255,.56)),
    repeating-linear-gradient(135deg, rgba(255, 79, 163, .055) 0 12px, rgba(34, 211, 238, .055) 12px 24px);
  transition: transform .18s, border-color .18s, box-shadow .18s, color .18s;
  box-shadow: inset 0 0 0 1px rgba(255,255,255,.66), 0 16px 42px rgba(90, 24, 70, .08);
}

.upload-zone:hover {
  border-color: var(--accent);
  color: var(--accent);
  transform: translateY(-1px);
  box-shadow: inset 0 0 0 1px rgba(255,255,255,.8), 0 18px 46px rgba(255, 79, 163, .12);
}

.upload-placeholder.has-photo .upload-zone { display: none; }

.upload-zone-title {
  font-size: 17px;
  font-weight: 750;
  color: var(--ink);
}

.upload-zone-sub {
  max-width: 320px;
  font-size: 12px;
  opacity: 0.72;
}

.input-file { display: none; }

/* Preview card (inside upload placeholder) */
.preview-card {
  position: relative;
  width: 100%;
  border-radius: 24px;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, .74);
  background: rgba(255, 255, 255, .76);
  box-shadow: var(--shadow-sm);
}

.preview-card.hidden { display: none; }

.preview-img {
  width: 100%;
  height: auto;
  display: block;
  max-height: 420px;
  object-fit: contain;
  cursor: zoom-in;
  background:
    linear-gradient(135deg, rgba(255, 240, 247, .9), rgba(240, 253, 255, .9));
}

.preview-remove {
  position: absolute;
  top: 8px;
  right: 8px;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: rgba(0,0,0,.55);
  color: #fff;
  border: none;
  font-size: 16px;
  line-height: 1;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  transition: background .15s;
}

.preview-remove:hover { background: rgba(0,0,0,.8); }

/* ── Messages ── */
.msg {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.msg-user  { align-items: flex-end; }
.msg-assistant { align-items: flex-start; }

.bubble {
  max-width: 75%;
  padding: 11px 15px;
  border-radius: 18px;
  font-size: 14px;
  line-height: 1.55;
  word-break: break-word;
  box-shadow: 0 10px 24px rgba(88, 28, 72, .08);
}

.msg-user .bubble {
  background:
    linear-gradient(135deg, rgba(255, 79, 163, .13), rgba(34, 211, 238, .11)),
    var(--user-bubble-bg);
  color: var(--user-bubble-text);
  border-bottom-right-radius: 4px;
  border: 1px solid rgba(255, 79, 163, .12);
}

/* ── Image card ── */
.img-card,
.comparison-card {
  background:
    linear-gradient(135deg, rgba(255,255,255,.96), rgba(255,255,255,.78)),
    radial-gradient(circle at 12% 0%, rgba(255, 79, 163, .10), transparent 34%),
    radial-gradient(circle at 100% 0%, rgba(34, 211, 238, .10), transparent 38%);
  border: 1px solid rgba(255, 255, 255, .74);
  border-radius: 24px;
  overflow: hidden;
  max-width: 860px;
  width: 100%;
  box-shadow: 0 18px 54px rgba(91, 33, 90, .13);
}

.img-card-body { position: relative; }

.img-card img {
  display: block;
  width: 100%;
  height: auto;
  opacity: 0;
  transition: opacity .3s ease;
}

.img-card img.loaded { opacity: 1; }

.img-card-footer {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  padding: 11px 14px;
  border-top: 1px solid rgba(112, 72, 105, .12);
  gap: 8px;
}

.comparison-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 16px 18px 0;
}

.comparison-title {
  font-size: 15px;
  font-weight: 800;
  color: var(--ink);
}

.comparison-subtitle {
  margin-top: 2px;
  font-size: 12px;
  color: var(--muted);
}

.comparison-chip {
  flex-shrink: 0;
  border-radius: 999px;
  padding: 6px 10px;
  background: rgba(255, 79, 163, .12);
  color: #a31568;
  font-size: 11px;
  font-weight: 800;
}

.comparison-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  padding: 16px 18px 14px;
}

.comparison-panel {
  min-width: 0;
  overflow: hidden;
  border-radius: 18px;
  border: 1px solid rgba(112, 72, 105, .13);
  background: rgba(255, 255, 255, .66);
}

.comparison-media {
  position: relative;
  height: 360px;
  min-height: 300px;
  background:
    linear-gradient(135deg, rgba(255, 240, 247, .78), rgba(240, 253, 255, .78));
}

.comparison-media img {
  display: block;
  width: 100%;
  height: 100%;
  min-height: 300px;
  max-height: 520px;
  object-fit: contain;
}

.comparison-panel.after {
  border-color: rgba(255, 79, 163, .28);
  box-shadow: inset 0 0 0 1px rgba(255, 79, 163, .08);
}

.comparison-badge {
  position: absolute;
  left: 10px;
  top: 10px;
  z-index: 1;
  border-radius: 999px;
  padding: 5px 9px;
  background: rgba(35, 24, 41, .72);
  color: #fff;
  font-size: 11px;
  font-weight: 750;
  backdrop-filter: blur(10px);
}

.comparison-panel.after .comparison-badge {
  background: linear-gradient(135deg, rgba(255, 79, 163, .92), rgba(109, 40, 217, .88));
}

.comparison-caption {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  min-height: 42px;
  padding: 9px 11px;
  border-top: 1px solid rgba(112, 72, 105, .11);
  color: var(--muted);
  font-size: 12px;
}

.comparison-caption strong {
  color: var(--ink);
  font-size: 13px;
}

.comparison-hint {
  color: var(--muted);
  font-size: 12px;
}

.comparison-card .img-card-footer {
  justify-content: space-between;
}

.btn-download {
  display: flex;
  align-items: center;
  gap: 5px;
  background: none;
  border: 1px solid rgba(112, 72, 105, .18);
  border-radius: 999px;
  padding: 7px 12px;
  font-size: 12px;
  color: var(--muted);
  cursor: pointer;
  font-family: var(--font);
  font-weight: 700;
  transition: transform .15s, border-color .15s, color .15s, background .15s;
}

.btn-download:hover {
  border-color: var(--accent);
  color: var(--accent);
  background: rgba(255, 79, 163, .08);
  transform: translateY(-1px);
}

/* ── Skeleton loader ── */
.skeleton-card {
  background:
    linear-gradient(135deg, rgba(255,255,255,.95), rgba(255,255,255,.76)),
    radial-gradient(circle at 0% 0%, rgba(255, 79, 163, .12), transparent 34%),
    radial-gradient(circle at 100% 0%, rgba(34, 211, 238, .13), transparent 38%);
  border: 1px solid rgba(255, 255, 255, .78);
  border-radius: 24px;
  overflow: hidden;
  max-width: 860px;
  width: 100%;
  box-shadow: 0 18px 54px rgba(91, 33, 90, .12);
}

.skeleton-img {
  width: 100%;
  background:
    linear-gradient(135deg, rgba(255, 240, 247, .78), rgba(240, 253, 255, .78));
  position: relative;
  overflow: hidden;
}

.skeleton-img::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(
    105deg,
    transparent 0%,
    rgba(255,255,255,.55) 45%,
    rgba(255,255,255,.7) 50%,
    rgba(255,255,255,.55) 55%,
    transparent 100%
  );
  background-size: 200% 100%;
  animation: shimmer 1.6s infinite;
}

@keyframes shimmer {
  0%   { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

.skeleton-footer {
  padding: 12px 14px;
  border-top: 1px solid rgba(112, 72, 105, .12);
  display: flex;
  align-items: center;
  gap: 8px;
}

.skeleton-text {
  height: 12px;
  border-radius: 6px;
  background: #dde0e4;
  flex: 1;
}

.skeleton-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--accent);
  animation: pulse 1.2s ease-in-out infinite;
}

.skeleton-dot:nth-child(2) { animation-delay: .2s; }
.skeleton-dot:nth-child(3) { animation-delay: .4s; }

@keyframes pulse {
  0%, 100% { opacity: .3; }
  50%       { opacity: 1; }
}

.skeleton-label {
  font-size: 12px;
  color: var(--muted);
  margin-left: 4px;
}

.processing-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
  padding: 16px 18px 0;
}

.processing-eyebrow {
  color: #a31568;
  font-size: 11px;
  font-weight: 850;
  letter-spacing: .1em;
}

.processing-title {
  margin-top: 4px;
  font-size: 15px;
  font-weight: 800;
  color: var(--ink);
}

.processing-time {
  flex-shrink: 0;
  border-radius: 999px;
  padding: 6px 10px;
  background: rgba(255, 255, 255, .72);
  color: var(--muted);
  font-size: 12px;
  font-weight: 750;
}

.processing-grid {
  display: grid;
  grid-template-columns: .9fr 1.1fr;
  gap: 12px;
  padding: 16px 18px;
}

.processing-panel {
  min-width: 0;
  overflow: hidden;
  border: 1px solid rgba(112, 72, 105, .13);
  border-radius: 18px;
  background: rgba(255, 255, 255, .66);
}

.processing-panel-label {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 38px;
  padding: 9px 11px;
  border-bottom: 1px solid rgba(112, 72, 105, .11);
  color: var(--muted);
  font-size: 12px;
}

.processing-panel-label strong {
  color: var(--ink);
  font-size: 13px;
}

.processing-original {
  width: 100%;
  height: 270px;
  object-fit: contain;
  background:
    linear-gradient(135deg, rgba(255, 240, 247, .8), rgba(240, 253, 255, .82));
}

.processing-preview {
  position: relative;
  display: flex;
  min-height: 270px;
  flex-direction: column;
  justify-content: flex-end;
  padding: 18px;
  overflow: hidden;
  background:
    radial-gradient(circle at 20% 20%, rgba(255, 79, 163, .22), transparent 32%),
    radial-gradient(circle at 82% 22%, rgba(34, 211, 238, .22), transparent 30%),
    linear-gradient(135deg, rgba(255, 240, 247, .95), rgba(245, 239, 255, .9));
}

.processing-preview::before {
  content: "";
  position: absolute;
  inset: 18px;
  border-radius: 24px;
  background: linear-gradient(115deg, rgba(255,255,255,.16), rgba(255,255,255,.72), rgba(255,255,255,.18));
  animation: shimmer 1.8s infinite;
}

.processing-rings {
  position: absolute;
  right: 22px;
  top: 22px;
  width: 92px;
  height: 92px;
  border-radius: 50%;
  border: 1px solid rgba(255, 79, 163, .32);
  box-shadow: 0 0 0 18px rgba(255, 79, 163, .08), 0 0 0 36px rgba(34, 211, 238, .08);
  animation: floaty 2.8s ease-in-out infinite;
}

@keyframes floaty {
  0%, 100% { transform: translateY(0) scale(1); }
  50% { transform: translateY(5px) scale(1.03); }
}

.processing-copy {
  position: relative;
  z-index: 1;
}

.processing-stage {
  font-size: 15px;
  font-weight: 850;
  color: var(--ink);
}

.processing-detail {
  margin-top: 6px;
  color: var(--muted);
  font-size: 12px;
}

.processing-progress {
  height: 8px;
  margin-top: 14px;
  overflow: hidden;
  border-radius: 999px;
  background: rgba(255, 255, 255, .68);
}

.processing-progress-bar {
  width: 12%;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--accent), var(--accent-deep), var(--accent-cyan));
  transition: width .5s ease;
}

.processing-note {
  padding: 0 18px 16px;
  color: var(--muted);
  font-size: 12px;
}

.processing-note strong {
  color: var(--ink);
}

/* ── Error message ── */
.msg-error { align-items: flex-start; }

.error-bubble {
  background: rgba(254, 242, 242, .92);
  border: 1px solid #fecaca;
  border-radius: var(--radius);
  padding: 10px 14px;
  font-size: 13px;
  color: var(--danger);
  max-width: 75%;
}

/* ── Settings bar ── */
.settings-bar {
  border-top: 1px solid rgba(112, 72, 105, .12);
  background: rgba(255, 255, 255, .78);
  backdrop-filter: blur(18px);
  flex-shrink: 0;
  overflow: hidden;
  transition: max-height .2s ease;
  max-height: 0;
}

.settings-bar.open { max-height: 80px; }

.settings-inner {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 16px;
  flex-wrap: wrap;
}

.settings-label {
  font-size: 12px;
  color: var(--muted);
  margin-right: 2px;
}

.settings-select {
  font-size: 13px;
  padding: 6px 9px;
  border: 1px solid rgba(112, 72, 105, .18);
  border-radius: 999px;
  background: rgba(255, 255, 255, .86);
  color: var(--ink);
  font-family: var(--font);
  cursor: pointer;
  outline: none;
  transition: border-color .15s;
}

.settings-select:focus { border-color: var(--accent); }

/* ── Input area ── */
.input-area {
  border-top: 1px solid rgba(112, 72, 105, .12);
  background: rgba(255, 255, 255, .78);
  backdrop-filter: blur(18px);
  flex-shrink: 0;
}

/* Hides border when prompt row is not visible */
.input-area:has(.prompt-row.hidden) {
  border-top: none;
}

.prompt-row {
  padding: 10px 16px 12px;
}

.prompt-row.hidden { display: none; }

.prompt-mode-row {
  display: none;
}

.input-row {
  display: flex;
  align-items: flex-end;
  gap: 8px;
  background: rgba(255, 255, 255, .92);
  border: 1.5px solid rgba(112, 72, 105, .18);
  border-radius: 20px;
  padding: 9px 9px 9px 14px;
  box-shadow: 0 14px 38px rgba(91, 33, 90, .08);
  transition: border-color .15s, box-shadow .15s;
}

.input-row:focus-within {
  border-color: rgba(255, 79, 163, .48);
  box-shadow: 0 16px 42px rgba(255, 79, 163, .12);
}

.prompt-input {
  flex: 1;
  border: none;
  outline: none;
  resize: none;
  font-family: var(--font);
  font-size: 14px;
  line-height: 1.5;
  background: transparent;
  color: var(--ink);
  max-height: 120px;
  overflow-y: auto;
  padding: 2px 0;
}

.prompt-input::placeholder { color: #b6a5b4; }

.input-actions {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  flex-shrink: 0;
}

.btn-settings {
  background: none;
  border: none;
  cursor: pointer;
  color: var(--muted);
  padding: 4px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  transition: color .15s;
}

.btn-settings:hover, .btn-settings.active { color: var(--accent); }

.btn-send {
  background: linear-gradient(135deg, var(--accent), var(--accent-deep));
  border: none;
  border-radius: 12px;
  color: #fff;
  width: 34px;
  height: 34px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  box-shadow: 0 10px 22px rgba(255, 79, 163, .22);
  transition: transform .15s, box-shadow .15s, filter .15s;
  flex-shrink: 0;
}

.btn-send:hover:not(:disabled) {
  filter: saturate(1.08);
  transform: translateY(-1px);
  box-shadow: 0 12px 26px rgba(255, 79, 163, .28);
}

.btn-send:disabled {
  background: #ead8e5;
  cursor: not-allowed;
  box-shadow: none;
}

/* ── Auth Modal ── */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.45);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
  padding: 20px;
}

.modal-overlay.hidden { display: none; }

.modal {
  background: rgba(255, 255, 255, .94);
  border: 1px solid rgba(255, 255, 255, .76);
  border-radius: 22px;
  padding: 32px 28px;
  width: 100%;
  max-width: 380px;
  box-shadow: var(--shadow-md);
}

.modal h2 {
  font-size: 20px;
  font-weight: 700;
  margin-bottom: 20px;
  color: var(--ink);
}

.form-group { margin-bottom: 14px; }

.form-group label {
  display: block;
  font-size: 13px;
  font-weight: 500;
  color: var(--muted);
  margin-bottom: 5px;
}

.form-group input {
  width: 100%;
  padding: 9px 12px;
  border: 1.5px solid rgba(112, 72, 105, .18);
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-family: var(--font);
  outline: none;
  transition: border-color .15s;
  color: var(--ink);
}

.form-group input:focus { border-color: var(--accent); }

.btn-primary {
  width: 100%;
  background: linear-gradient(135deg, var(--accent), var(--accent-deep));
  color: #fff;
  border: none;
  border-radius: var(--radius-sm);
  padding: 10px;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  margin-top: 8px;
  font-family: var(--font);
  transition: background .15s;
}

.btn-primary:hover { filter: saturate(1.08); }

.modal-switch {
  text-align: center;
  font-size: 13px;
  color: var(--muted);
  margin-top: 16px;
}

.modal-switch a {
  color: var(--accent);
  cursor: pointer;
  text-decoration: none;
  font-weight: 500;
}

.modal-error {
  font-size: 13px;
  color: var(--danger);
  margin-top: 8px;
  text-align: center;
  min-height: 18px;
}

/* ── Lightbox ── */
.lightbox {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.92);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 300;
  cursor: zoom-out;
  padding: 16px;
}

.lightbox.hidden { display: none; }

.lightbox-img {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  border-radius: 8px;
  user-select: none;
}

/* ── Toast ── */
.toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%) translateY(20px);
  background: #1f2937;
  color: #fff;
  padding: 9px 18px;
  border-radius: 20px;
  font-size: 13px;
  opacity: 0;
  pointer-events: none;
  transition: opacity .2s, transform .2s;
  z-index: 200;
  white-space: nowrap;
}

.toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

/* ── Profile View ── */
.profile-view {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: 48px 20px;
}

.profile-view.hidden { display: none; }

.profile-container {
  width: 100%;
  max-width: 400px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
}

.profile-avatar-circle {
  width: 72px;
  height: 72px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--accent), var(--accent-deep));
  color: #fff;
  font-size: 28px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  text-transform: uppercase;
  letter-spacing: -1px;
  margin-bottom: 4px;
}

.profile-name {
  font-size: 20px;
  font-weight: 700;
  color: var(--ink);
  text-align: center;
}

.profile-credits {
  font-size: 14px;
  color: var(--muted);
  text-align: center;
  min-height: 20px;
}

.profile-divider {
  width: 100%;
  height: 1px;
  background: var(--border);
  margin: 8px 0;
}

.profile-actions {
  display: flex;
  flex-direction: column;
  gap: 10px;
  width: 100%;
}

.btn-outline-danger {
  width: 100%;
  background: transparent;
  border: 1.5px solid #fca5a5;
  color: var(--danger);
  border-radius: var(--radius-sm);
  padding: 10px;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  font-family: var(--font);
  transition: background .15s, border-color .15s;
}

.btn-outline-danger:hover {
  background: #fef2f2;
  border-color: var(--danger);
}

/* ── Responsive ── */
@media (max-width: 600px) {
  .app {
    width: 100vw;
    max-width: 100vw;
    border-left: none;
    border-right: none;
    overflow-x: hidden;
  }
  .header {
    gap: 8px;
    padding: 10px 12px;
  }
  .header-brand {
    min-width: 0;
    flex-shrink: 1;
    gap: 8px;
    font-size: 15px;
  }
  .header-brand svg {
    width: 20px;
    height: 20px;
    flex-shrink: 0;
  }
  .header-nav {
    flex-shrink: 0;
    gap: 6px;
  }
  .btn-ghost {
    padding: 5px 9px;
    font-size: 12px;
  }
  .thread {
    padding: 16px 12px 12px;
    gap: 16px;
    overflow-x: hidden;
  }
  .thread > * {
    width: 100%;
    max-width: 100%;
    min-width: 0;
  }
  .studio-hero {
    grid-template-columns: 1fr;
    padding: 22px;
    border-radius: 22px;
    width: 100%;
    max-width: 100%;
  }
  .studio-hero-copy {
    width: 100%;
    max-width: 100%;
  }
  .hero-prompt-box,
  .studio-hero h1 {
    max-width: 100%;
    white-space: normal;
    overflow-wrap: anywhere;
    word-break: break-word;
  }
  .studio-hero-tags {
    justify-content: flex-start;
    max-width: none;
  }
  .prompt-mode-row {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    padding: 0 0 8px;
  }
  .studio-hero h1 { font-size: 32px; }
  .prompt-row { padding: 8px 12px 12px; }
  .settings-inner { padding: 8px 12px; }
  .bubble, .error-bubble { max-width: 90%; }
  .img-card, .skeleton-card { max-width: 100%; }
  .comparison-grid,
  .processing-grid {
    grid-template-columns: 1fr;
  }
  .comparison-header,
  .processing-header {
    align-items: flex-start;
    flex-direction: column;
  }
  .comparison-chip,
  .processing-time {
    align-self: flex-start;
  }
  .comparison-media,
  .comparison-media img,
  .processing-original,
  .processing-preview {
    min-height: 240px;
    height: 240px;
  }
  .modal { padding: 24px 20px; }
  .upload-zone { min-height: 180px; }
  .upload-placeholder.has-photo {
    width: auto;
    max-width: 132px;
  }
  .upload-placeholder.has-photo .preview-card {
    width: 112px;
    height: 112px;
    border-radius: 18px;
  }
  .upload-placeholder.has-photo .preview-img {
    width: 100%;
    height: 100%;
    max-height: none;
    object-fit: cover;
  }
  .upload-placeholder.has-photo .preview-remove {
    top: 5px;
    right: 5px;
    width: 24px;
    height: 24px;
    font-size: 15px;
  }
}

@media (max-width: 420px) {
  .header-brand { font-size: 14px; }
  .btn-ghost {
    padding: 5px 8px;
    font-size: 12px;
  }
  .studio-hero h1 { font-size: 28px; }
  .hero-prompt-input { font-size: 14px; }
}
