:root {
  color-scheme: light;
  --page-bg: #eef5ff;
  --panel: rgba(255, 255, 255, 0.84);
  --panel-strong: rgba(255, 255, 255, 0.94);
  --line: rgba(115, 143, 190, 0.22);
  --line-strong: rgba(79, 119, 207, 0.36);
  --text: #0f172a;
  --subtext: #667493;
  --faint: #9aa8c2;
  --blue: #2577ff;
  --cyan: #19c8ff;
  --violet: #7c5cff;
  --green: #18d796;
  --red: #ff4d72;
  --amber: #f59e0b;
  --shadow-soft: 0 20px 56px rgba(70, 103, 160, 0.13);
  --shadow-blue: 0 18px 42px rgba(37, 119, 255, 0.26);
  font-family: Inter, "SF Pro Display", "SF Pro Text", "PingFang SC", "Microsoft YaHei", Arial, sans-serif;
}

* {
  box-sizing: border-box;
}

html {
  min-width: 0;
}

body {
  margin: 0;
  min-height: 100vh;
  overflow: hidden;
  background:
    radial-gradient(circle at 84% 5%, rgba(176, 193, 255, 0.36), transparent 34%),
    radial-gradient(circle at 28% 18%, rgba(222, 244, 255, 0.9), transparent 40%),
    linear-gradient(135deg, #f9fcff 0%, #eef6ff 48%, #f7f9ff 100%);
  color: var(--text);
}

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

button {
  cursor: pointer;
}

button:disabled {
  cursor: not-allowed;
  filter: grayscale(0.2);
  opacity: 0.7;
}

svg {
  display: block;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.9;
}

.app-shell {
  display: grid;
  grid-template-columns: 106px minmax(0, 1fr);
  height: 100vh;
}

.side-nav {
  position: sticky;
  top: 0;
  display: flex;
  height: 100vh;
  flex-direction: column;
  align-items: center;
  gap: 36px;
  border-right: 1px solid rgba(142, 166, 206, 0.22);
  background: rgba(255, 255, 255, 0.54);
  padding: 24px 14px;
  box-shadow: 10px 0 36px rgba(77, 112, 169, 0.08);
  backdrop-filter: blur(22px);
}

.brand-cube {
  display: grid;
  width: 60px;
  height: 60px;
  place-items: center;
  border-radius: 18px;
  background: linear-gradient(145deg, #090f31, #09245d);
  color: #20d7ff;
  box-shadow: 0 12px 26px rgba(26, 82, 219, 0.42), inset 0 0 0 1px rgba(119, 99, 255, 0.55);
}

.brand-cube svg {
  width: 38px;
  height: 38px;
}

.brand-cube path:first-child {
  fill: rgba(0, 200, 255, 0.78);
  stroke: rgba(119, 99, 255, 0.9);
}

.brand-cube path:nth-child(2) {
  fill: rgba(124, 92, 255, 0.78);
}

.brand-cube path:nth-child(3) {
  fill: rgba(0, 108, 255, 0.78);
}

.nav-stack {
  display: flex;
  width: 100%;
  flex-direction: column;
  gap: 18px;
}

.nav-item {
  display: flex;
  min-height: 82px;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border-radius: 16px;
  color: #657493;
  font-size: 14px;
  font-weight: 700;
  text-decoration: none;
}

.nav-item svg {
  width: 24px;
  height: 24px;
}

.nav-item.active {
  background: linear-gradient(180deg, rgba(232, 239, 255, 0.96), rgba(222, 232, 255, 0.82));
  color: #2c67ff;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.86);
}

.workspace {
  min-width: 0;
  height: 100vh;
  overflow: hidden;
}

.topbar {
  display: grid;
  grid-template-columns: minmax(280px, 1fr) minmax(620px, 880px);
  align-items: center;
  gap: 28px;
  min-height: 116px;
  border-bottom: 1px solid rgba(142, 166, 206, 0.2);
  padding: 20px 38px;
}

.title-block h1,
.title-block p,
.session-head h2,
.card-title h2,
.card-title h3 {
  margin: 0;
}

.title-block h1 {
  font-size: 28px;
  font-weight: 850;
  line-height: 1.18;
  letter-spacing: 0;
}

.title-block p {
  margin-top: 8px;
  color: var(--subtext);
  font-size: 15px;
  font-weight: 600;
}

.connection-panel {
  display: grid;
  grid-template-columns: minmax(220px, 260px) minmax(220px, 260px) 136px 12px;
  align-items: end;
  justify-content: end;
  gap: 24px;
}

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

.field-shell span,
.select-field span,
.size-fields span {
  color: #53617e;
  font-size: 13px;
  font-weight: 750;
}

.field-input {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 34px;
  align-items: center;
  height: 44px;
  border: 1px solid var(--line-strong);
  border-radius: 11px;
  background: rgba(255, 255, 255, 0.88);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.85), 0 12px 28px rgba(80, 117, 179, 0.08);
}

.field-input input {
  min-width: 0;
  height: 100%;
  border: 0;
  background: transparent;
  padding: 0 0 0 13px;
  color: #202b45;
  outline: 0;
  font-size: 15px;
}

.field-input button {
  display: grid;
  width: 34px;
  height: 34px;
  place-items: center;
  border: 0;
  background: transparent;
  color: #61708e;
}

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

.connect-button {
  display: inline-flex;
  height: 44px;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border: 0;
  border-radius: 999px;
  background: linear-gradient(135deg, #18c4f8, #2a77ff 58%, #805cff);
  color: #fff;
  font-size: 14px;
  font-weight: 850;
  box-shadow: var(--shadow-blue);
}

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

.mobile-brand,
.mobile-drawer-head,
.mobile-icon-button,
.mobile-toggle-button,
.mobile-size-field,
.mobile-custom-size {
  display: none;
}

.connection-dot {
  align-self: center;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #36e6a2;
  box-shadow: 0 0 0 5px rgba(54, 230, 162, 0.15);
}

.connection-dot.offline {
  background: #c8d1e2;
  box-shadow: none;
}

.content-grid {
  display: grid;
  grid-template-columns: 250px minmax(520px, 1fr) 330px;
  gap: 14px;
  height: calc(100vh - 116px);
  min-height: 0;
  padding: 10px 16px 12px 14px;
}

.panel-card {
  border: 1px solid var(--line);
  border-radius: 16px;
  background: var(--panel);
  box-shadow: var(--shadow-soft), inset 0 1px 0 rgba(255, 255, 255, 0.74);
  backdrop-filter: blur(18px);
}

.session-panel {
  display: flex;
  min-height: 0;
  flex-direction: column;
  padding: 18px 14px 14px;
}

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

.session-head h2,
.card-title h2 {
  color: #12203a;
  font-size: 16px;
  font-weight: 850;
}

.session-head button,
.session-foot,
.spread-title > button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  border: 1px solid rgba(107, 142, 205, 0.24);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.76);
  color: #286dff;
  font-size: 13px;
  font-weight: 800;
  box-shadow: 0 8px 18px rgba(70, 104, 160, 0.08);
}

.session-head button {
  height: 34px;
  padding: 0 12px;
}

.session-head svg,
.session-foot svg {
  width: 16px;
  height: 16px;
}

.session-group {
  display: grid;
  min-height: 0;
  flex: 1;
  grid-template-rows: auto minmax(0, 1fr);
  gap: 9px;
}

.session-group > span {
  padding-left: 12px;
  color: #8593ad;
  font-size: 13px;
  font-weight: 750;
}

.session-item {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 30px;
  align-items: center;
  gap: 8px;
  width: 100%;
  border: 1px solid rgba(123, 148, 192, 0.18);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.44);
  padding: 13px 12px;
  color: #61708e;
  text-align: left;
  box-shadow: none;
  transition: border-color 0.18s ease, background 0.18s ease, box-shadow 0.18s ease, color 0.18s ease;
}

.session-select {
  display: grid;
  min-width: 0;
  grid-template-columns: 22px minmax(0, 1fr);
  gap: 10px;
  border: 0;
  background: transparent;
  color: inherit;
  padding: 0;
  text-align: left;
}

.session-delete {
  display: grid;
  width: 28px;
  height: 28px;
  place-items: center;
  border: 1px solid rgba(109, 130, 174, 0.18);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.62);
  color: #7b89a6;
  padding: 0;
}

.session-delete:hover {
  border-color: rgba(255, 77, 114, 0.26);
  background: rgba(255, 77, 114, 0.08);
  color: #ff4d72;
}

.session-item:hover {
  border-color: rgba(94, 124, 182, 0.28);
  background: rgba(255, 255, 255, 0.72);
}

.session-item.active {
  border-color: rgba(54, 105, 255, 0.52);
  background: linear-gradient(180deg, rgba(239, 244, 255, 0.98), rgba(231, 238, 255, 0.8));
  color: #2d67ff;
  box-shadow: 0 12px 26px rgba(78, 116, 205, 0.13);
}

.session-list {
  display: grid;
  align-content: start;
  gap: 10px;
  overflow-y: auto;
  padding: 0 2px 12px 0;
}

.session-item svg {
  width: 18px;
  height: 18px;
  margin-top: 2px;
}

.session-delete svg {
  width: 15px;
  height: 15px;
  margin-top: 0;
}

.session-item strong,
.session-item em {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.session-item strong {
  color: #34425e;
  font-size: 14px;
  font-weight: 850;
}

.session-item.active strong {
  color: #245dff;
}

.session-item em {
  margin-top: 5px;
  color: #7182a2;
  font-size: 12px;
  font-style: normal;
  font-weight: 700;
}

.session-empty {
  border: 1px dashed rgba(115, 143, 190, 0.25);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.42);
  color: #8190ad;
  padding: 14px 12px;
  font-size: 13px;
  font-weight: 750;
  text-align: center;
}

.session-foot {
  width: 100%;
  height: 40px;
  margin-top: auto;
  color: #455574;
}

.conversation-column {
  display: grid;
  grid-template-rows: minmax(0, 1fr) auto;
  min-width: 0;
  min-height: 0;
  gap: 10px;
}

.conversation-stream {
  min-height: 0;
  overflow-y: auto;
  padding: 6px 8px 4px;
  scroll-behavior: smooth;
}

.empty-conversation {
  display: grid;
  min-height: 100%;
  place-items: center;
  align-content: center;
  gap: 10px;
  color: #667493;
  text-align: center;
}

.empty-conversation h2,
.empty-conversation p {
  margin: 0;
}

.empty-conversation h2 {
  color: #14223e;
  font-size: 22px;
  font-weight: 850;
}

.empty-conversation p {
  max-width: 360px;
  font-size: 14px;
  font-weight: 650;
  line-height: 1.7;
}

.chat-round {
  display: grid;
  gap: 10px;
  margin-bottom: 14px;
}

.user-message,
.assistant-message {
  display: flex;
  gap: 10px;
}

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

.user-row {
  display: flex;
  max-width: 100%;
  align-items: flex-start;
  justify-content: flex-end;
  gap: 10px;
}

.user-row time {
  margin-top: 7px;
  color: #75839f;
  font-size: 12px;
  font-weight: 700;
}

.user-stack {
  display: flex;
  min-width: 0;
  max-width: min(570px, 78%);
  flex-direction: column;
  align-items: flex-end;
}

.user-content {
  display: flex;
  min-width: 0;
  max-width: 100%;
  flex-direction: column;
  align-items: flex-end;
}

.user-bubble {
  min-width: 0;
  max-width: 100%;
  border: 1px solid rgba(100, 152, 225, 0.28);
  border-radius: 12px;
  background: linear-gradient(180deg, #f4faff, #eaf4ff);
  padding: 13px 16px;
  color: #253350;
  font-size: 14px;
  font-weight: 700;
  line-height: 1.6;
  overflow-wrap: anywhere;
  box-shadow: 0 10px 24px rgba(72, 104, 166, 0.1);
}

.user-avatar {
  width: 40px;
  height: 40px;
  flex: 0 0 auto;
  overflow: hidden;
  border: 3px solid rgba(255, 255, 255, 0.9);
  border-radius: 50%;
  box-shadow: 0 10px 22px rgba(68, 105, 174, 0.18);
}

.user-avatar svg {
  width: 100%;
  height: 100%;
  stroke: none;
}

.assistant-message {
  align-items: flex-start;
}

.ai-avatar {
  display: grid;
  width: 40px;
  height: 40px;
  flex: 0 0 auto;
  place-items: center;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.88);
  color: #276eff;
  box-shadow: 0 12px 24px rgba(71, 105, 168, 0.14);
}

.ai-avatar svg {
  width: 21px;
  height: 21px;
}

.result-group {
  width: fit-content;
  min-width: 330px;
  max-width: min(640px, calc(100% - 50px));
  border: 1px solid rgba(114, 143, 191, 0.23);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.86);
  padding: 14px;
  box-shadow: 0 14px 36px rgba(72, 105, 166, 0.12);
}

.chat-round.running .result-group {
  border-color: rgba(112, 93, 255, 0.48);
  box-shadow: 0 0 0 1px rgba(26, 205, 255, 0.2), 0 16px 38px rgba(90, 87, 206, 0.16);
}

.result-group-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 10px;
}

.result-group-head strong {
  color: #1a2946;
  font-size: 14px;
  font-weight: 900;
}

.result-group-head time {
  color: #6d7b99;
  font-size: 12px;
  font-weight: 700;
}

.round-references {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px;
  margin-bottom: 8px;
}

.round-reference-thumb {
  overflow: hidden;
  width: 56px;
  height: 56px;
  border: 1px solid rgba(92, 139, 220, 0.26);
  border-radius: 9px;
  background: #eef6ff;
  padding: 0;
}

.round-reference-thumb img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.result-card {
  display: grid;
  width: 300px;
  max-width: 100%;
  gap: 12px;
}

.result-card + .result-card {
  margin-top: 12px;
  border-top: 1px solid rgba(115, 143, 190, 0.16);
  padding-top: 12px;
}

.result-preview {
  overflow: hidden;
  width: 100%;
  border: 0;
  border-radius: 9px;
  background: #eef6ff;
  padding: 0;
}

.result-preview img {
  display: block;
  width: 100%;
  aspect-ratio: 16 / 7;
  object-fit: cover;
}

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

.result-actions button {
  display: inline-flex;
  min-width: 0;
  height: 34px;
  align-items: center;
  justify-content: center;
  gap: 7px;
  border: 1px solid rgba(105, 138, 198, 0.25);
  border-radius: 9px;
  background: rgba(255, 255, 255, 0.82);
  color: #4b5c7a;
  font-size: 12px;
  font-weight: 850;
}

.result-actions svg {
  width: 15px;
  height: 15px;
}

.pending-card,
.error-card {
  display: block;
}

.pending-art {
  overflow: hidden;
  width: 300px;
  max-width: 100%;
  height: 104px;
  border-radius: 9px;
  background:
    linear-gradient(90deg, rgba(18, 104, 255, 0.08), rgba(18, 104, 255, 0.26), rgba(18, 104, 255, 0.08)),
    linear-gradient(145deg, #eef6ff, #dceaff);
  background-size: 220% 100%, auto;
  animation: shimmer 1.1s ease-in-out infinite;
}

.pending-card strong,
.error-card strong {
  color: #172642;
  font-size: 15px;
  font-weight: 900;
}

.pending-card p,
.error-card p {
  margin: 7px 0;
  color: #63718d;
  font-size: 13px;
  font-weight: 650;
  line-height: 1.6;
}

.pending-card span {
  color: #266bff;
  font-size: 12px;
  font-weight: 850;
}

.error-card {
  grid-template-columns: 1fr;
  border-radius: 10px;
  background: rgba(255, 77, 114, 0.08);
  padding: 14px;
}

.composer-panel {
  padding: 12px 14px 10px;
}

.composer-tools {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 9px;
}

.tool-button {
  display: inline-flex;
  height: 32px;
  align-items: center;
  justify-content: center;
  gap: 7px;
  border: 1px solid rgba(105, 138, 198, 0.25);
  border-radius: 9px;
  background: rgba(255, 255, 255, 0.76);
  color: #51617d;
  padding: 0 12px;
  font-size: 12px;
  font-weight: 850;
}

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

.reference-strip {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding: 0 0 9px;
}

.reference-item {
  position: relative;
  flex: 0 0 auto;
}

.reference-item {
  width: 52px;
  height: 52px;
}

.reference-preview {
  overflow: hidden;
  width: 100%;
  height: 100%;
  border: 0;
  border-radius: 8px;
  background: transparent;
  padding: 0;
}

.reference-preview img {
  display: block;
  width: 100%;
  height: 100%;
  border: 1px solid rgba(92, 139, 220, 0.26);
  border-radius: 8px;
  object-fit: cover;
}

.reference-remove {
  position: absolute;
  top: -6px;
  right: -6px;
  display: grid;
  width: 22px;
  height: 22px;
  place-items: center;
  border: 1px solid rgba(121, 151, 204, 0.28);
  border-radius: 50%;
  background: #fff;
  color: #657493;
}

.reference-remove svg {
  width: 13px;
  height: 13px;
}

.prompt-box {
  position: relative;
  overflow: hidden;
  border: 1px solid rgba(37, 119, 255, 0.26);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.74);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.72);
}

textarea {
  display: block;
  width: 100%;
  min-height: 66px;
  resize: none;
  border: 0;
  background: transparent;
  padding: 12px 14px 28px;
  color: #17233d;
  outline: 0;
  font-size: 14px;
  font-weight: 650;
  line-height: 1.55;
}

textarea::placeholder {
  color: #8a98b1;
}

.prompt-counter {
  position: absolute;
  right: 13px;
  bottom: 9px;
  color: #6a7896;
  font-size: 12px;
  font-weight: 750;
}

.drop-hint {
  pointer-events: none;
  position: absolute;
  inset: 8px;
  display: none;
  align-items: center;
  justify-content: center;
  gap: 10px;
  border: 1px dashed rgba(37, 119, 255, 0.72);
  border-radius: 9px;
  background: rgba(245, 250, 255, 0.9);
  color: #2374ff;
  font-weight: 850;
  backdrop-filter: blur(3px);
}

.drop-hint svg {
  width: 18px;
  height: 18px;
}

.prompt-box.dragging .drop-hint {
  display: flex;
}

.control-row {
  display: grid;
  grid-template-columns: minmax(136px, 1fr) 100px 76px 132px minmax(96px, auto);
  align-items: end;
  gap: 10px;
  margin-top: 9px;
}

.select-field {
  display: grid;
  gap: 6px;
  min-width: 0;
}

.select-field.mobile-size-field {
  display: none;
}

.select-field select,
.select-field input {
  width: 100%;
  height: 36px;
  min-width: 0;
  border: 1px solid rgba(116, 148, 203, 0.28);
  border-radius: 9px;
  background: rgba(255, 255, 255, 0.82);
  color: #17233d;
  outline: 0;
  padding: 0 11px;
  font-size: 13px;
  font-weight: 750;
}

.select-field select {
  appearance: none;
  background-image:
    linear-gradient(45deg, transparent 50%, #71809d 50%),
    linear-gradient(135deg, #71809d 50%, transparent 50%);
  background-position:
    calc(100% - 16px) 16px,
    calc(100% - 11px) 16px;
  background-repeat: no-repeat;
  background-size: 5px 5px;
  padding-right: 30px;
}

.generate-button {
  position: relative;
  display: inline-flex;
  overflow: hidden;
  width: 100px;
  height: 44px;
  align-items: center;
  justify-content: center;
  justify-self: end;
  gap: 8px;
  border: 0;
  border-radius: 999px;
  background: radial-gradient(circle at 30% 24%, #69f7ff, #16b8ff 32%, #2c72ff 58%, #805cff 100%);
  color: #fff;
  font-size: 14px;
  font-weight: 900;
  box-shadow: 0 13px 28px rgba(24, 123, 255, 0.3), 0 0 0 5px rgba(20, 205, 255, 0.13);
  transition: box-shadow 0.18s ease, transform 0.18s ease;
}

.generate-button::before {
  position: absolute;
  top: 50%;
  left: -55%;
  width: 46%;
  height: 155%;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.72), transparent);
  content: "";
  opacity: 0;
  transform: translateY(-50%) rotate(18deg);
}

.generate-button:hover {
  box-shadow: 0 15px 30px rgba(24, 123, 255, 0.34), 0 0 0 5px rgba(20, 205, 255, 0.16);
  transform: translateY(-1px);
}

.generate-button:hover::before {
  animation: buttonShine 0.72s ease;
}

.generate-button svg,
.generate-button span {
  position: relative;
  z-index: 1;
}

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

.settings-column {
  display: grid;
  min-height: 0;
  align-content: start;
  gap: 10px;
  overflow-y: auto;
}

.settings-card {
  padding: 18px;
}

.card-title,
.spread-title,
.spread-title > div {
  display: flex;
  align-items: center;
}

.spread-title {
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 16px;
}

.spread-title > div,
.card-title {
  gap: 10px;
}

.card-title svg {
  width: 20px;
  height: 20px;
  color: #2387ff;
}

.spread-title > button {
  height: 30px;
  padding: 0 11px;
  color: #60708f;
}

.settings-card h3 {
  margin: 0 0 10px;
  color: #5d6d8a;
  font-size: 13px;
  font-weight: 850;
}

.preset-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  margin-bottom: 18px;
}

.preset-button {
  position: relative;
  min-height: 62px;
  border: 1px solid rgba(116, 148, 203, 0.28);
  border-radius: 9px;
  background: rgba(255, 255, 255, 0.72);
  color: #17233d;
  padding: 8px 6px;
}

.preset-button strong,
.preset-button span {
  display: block;
  text-align: center;
}

.preset-button strong {
  font-size: 15px;
  font-weight: 900;
}

.preset-button span {
  margin-top: 6px;
  color: #64728e;
  font-size: 11px;
  font-weight: 750;
}

.preset-button.active {
  border-color: #2b79ff;
  background: linear-gradient(180deg, #f5f9ff, #edf4ff);
  color: #216bff;
  box-shadow: 0 10px 22px rgba(37, 119, 255, 0.15);
}

.preset-button.active::after {
  content: "";
  position: absolute;
  top: -8px;
  right: -8px;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background:
    linear-gradient(135deg, #25d7ff, #2577ff),
    #2577ff;
  box-shadow: 0 5px 12px rgba(37, 119, 255, 0.22);
}

.size-fields {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.size-fields label {
  display: grid;
  gap: 7px;
}

.size-fields div {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 28px;
  align-items: center;
  height: 38px;
  border: 1px solid rgba(116, 148, 203, 0.28);
  border-radius: 9px;
  background: rgba(255, 255, 255, 0.82);
}

.size-fields input {
  min-width: 0;
  height: 100%;
  border: 0;
  background: transparent;
  padding: 0 0 0 10px;
  color: #17233d;
  outline: 0;
  font-size: 14px;
  font-weight: 800;
}

.size-fields em {
  color: #64728e;
  font-size: 12px;
  font-style: normal;
  font-weight: 750;
}

.size-summary {
  margin: 12px 0 16px;
  border-radius: 9px;
  background: #edf4ff;
  padding: 10px 12px;
  color: #65779d;
  font-size: 12px;
  font-weight: 800;
}

.status-panel {
  display: none;
}

.status-chip {
  display: inline-flex;
  min-width: 64px;
  height: 25px;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
  padding: 0 10px;
  font-size: 12px;
  font-weight: 850;
}

.status-chip.idle,
.status-chip.testing {
  background: rgba(37, 119, 255, 0.09);
  color: #2d6dff;
}

.status-chip.running {
  background: rgba(24, 215, 150, 0.13);
  color: #07986d;
}

.status-chip.success {
  background: rgba(24, 215, 150, 0.13);
  color: #07986d;
}

.status-chip.error {
  background: rgba(255, 77, 114, 0.12);
  color: #d72e56;
}

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

.status-entry {
  display: grid;
  grid-template-columns: 22px minmax(0, 1fr);
  gap: 10px;
  border-radius: 10px;
  background: linear-gradient(180deg, rgba(235, 250, 255, 0.92), rgba(239, 247, 255, 0.88));
  padding: 14px;
}

.status-entry svg {
  width: 18px;
  height: 18px;
  margin-top: 2px;
}

.status-entry strong {
  display: block;
  color: #1674ff;
  font-size: 13px;
  font-weight: 900;
  line-height: 1.45;
}

.status-entry span {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  margin-top: 8px;
  color: #71809c;
  font-size: 12px;
  font-weight: 750;
}

.status-entry em {
  font-style: normal;
}

.status-entry.error {
  background: rgba(255, 77, 114, 0.08);
}

.status-entry.error strong,
.status-entry.error svg {
  color: #d72e56;
}

.status-entry.warning strong,
.status-entry.warning svg {
  color: var(--amber);
}

.lightbox {
  width: min(92vw, 1180px);
  border: 0;
  border-radius: 18px;
  background: rgba(9, 17, 38, 0.88);
  padding: 18px;
}

.lightbox::backdrop {
  background: rgba(10, 18, 40, 0.62);
  backdrop-filter: blur(6px);
}

.lightbox img {
  display: block;
  max-width: 100%;
  max-height: 82vh;
  margin: 0 auto;
  border-radius: 12px;
  object-fit: contain;
}

.lightbox-close {
  position: absolute;
  top: 14px;
  right: 14px;
  display: grid;
  width: 38px;
  height: 38px;
  place-items: center;
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.12);
  color: #fff;
}

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

.drawer-backdrop {
  position: fixed;
  inset: 0;
  z-index: 50;
  background: rgba(11, 26, 54, 0.26);
  backdrop-filter: blur(5px);
}

.drawer-backdrop[hidden] {
  display: none;
}

.mobile-select-panel {
  display: none;
}

@keyframes shimmer {
  from {
    background-position: 140% 0, 0 0;
  }
  to {
    background-position: -80% 0, 0 0;
  }
}

@keyframes buttonShine {
  0% {
    left: -55%;
    opacity: 0;
  }
  18%,
  72% {
    opacity: 1;
  }
  100% {
    left: 155%;
    opacity: 0;
  }
}

@media (max-width: 1380px) {
  .content-grid {
    grid-template-columns: 220px minmax(480px, 1fr) 310px;
  }

  .control-row {
    grid-template-columns: minmax(180px, 1fr) 100px 76px minmax(120px, 180px) 100px;
  }

  .generate-button {
    grid-column: auto;
    width: 100px;
  }
}

@media (max-width: 1180px) {
  body {
    overflow-y: auto;
  }

  .app-shell,
  .workspace {
    min-height: 100vh;
    height: auto;
  }

  .topbar,
  .content-grid {
    grid-template-columns: 1fr;
  }

  .connection-panel {
    justify-content: stretch;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) 136px 12px;
  }

  .content-grid {
    height: auto;
  }

  .conversation-column {
    min-height: 720px;
  }
}

@media (max-width: 820px) {
  body {
    height: 100dvh;
    overflow: hidden;
  }

  .app-shell {
    display: block;
    height: 100dvh;
  }

  .side-nav {
    display: none;
  }

  .workspace {
    height: 100dvh;
    overflow: hidden;
  }

  .topbar {
    display: grid;
    grid-template-columns: 44px 52px minmax(0, 1fr) 44px;
    gap: 8px;
    min-height: 92px;
    align-items: center;
    border-bottom: 0;
    padding: 14px 12px 10px;
  }

  .mobile-icon-button {
    display: grid;
    width: 44px;
    height: 44px;
    place-items: center;
    border: 1px solid rgba(115, 143, 190, 0.2);
    border-radius: 14px;
    background: rgba(255, 255, 255, 0.86);
    color: #183054;
    box-shadow: 0 12px 26px rgba(70, 103, 160, 0.14);
  }

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

  .mobile-brand {
    display: grid;
    width: 52px;
    height: 52px;
    place-items: center;
    border-radius: 15px;
    background: linear-gradient(145deg, #090f31, #09245d);
    color: #20d7ff;
    box-shadow: 0 12px 26px rgba(26, 82, 219, 0.36), inset 0 0 0 1px rgba(119, 99, 255, 0.55);
  }

  .mobile-brand svg {
    width: 34px;
    height: 34px;
  }

  .mobile-brand path:first-child {
    fill: rgba(0, 200, 255, 0.78);
    stroke: rgba(119, 99, 255, 0.9);
  }

  .mobile-brand path:nth-child(2) {
    fill: rgba(124, 92, 255, 0.78);
  }

  .mobile-brand path:nth-child(3) {
    fill: rgba(0, 108, 255, 0.78);
  }

  .title-block {
    min-width: 0;
  }

  .title-block h1 {
    font-size: 24px;
    line-height: 1.08;
  }

  .title-block p {
    overflow: hidden;
    margin-top: 5px;
    font-size: 13px;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .content-grid {
    display: block;
    height: calc(100dvh - 92px);
    padding: 0 12px 10px;
  }

  .conversation-column {
    display: grid;
    height: 100%;
    min-height: 0;
    grid-template-rows: minmax(0, 1fr) auto;
  }

  .conversation-stream {
    padding: 6px 2px 10px;
  }

  .session-panel {
    position: fixed;
    z-index: 70;
    top: 0;
    bottom: 0;
    left: 0;
    width: min(86vw, 330px);
    border-radius: 0 18px 18px 0;
    padding: 18px 14px 16px;
    transform: translateX(-105%);
    transition: transform 0.22s ease;
  }

  body.history-drawer-open .session-panel {
    transform: translateX(0);
  }

  .settings-column {
    display: none;
  }

  .connection-panel {
    position: fixed;
    z-index: 70;
    top: 104px;
    right: 14px;
    left: 14px;
    display: grid;
    grid-template-columns: 1fr;
    justify-content: stretch;
    gap: 12px;
    border: 1px solid var(--line);
    border-radius: 18px;
    background: rgba(255, 255, 255, 0.96);
    padding: 16px;
    box-shadow: var(--shadow-soft);
    opacity: 0;
    pointer-events: none;
    transform: translateY(-12px);
    transition: opacity 0.18s ease, transform 0.18s ease;
  }

  body.connection-drawer-open .connection-panel {
    opacity: 1;
    pointer-events: auto;
    transform: translateY(0);
  }

  .mobile-drawer-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
  }

  .mobile-drawer-head strong {
    color: #12203a;
    font-size: 16px;
    font-weight: 900;
  }

  .mobile-drawer-head button {
    display: grid;
    width: 34px;
    height: 34px;
    place-items: center;
    border: 1px solid rgba(107, 142, 205, 0.24);
    border-radius: 10px;
    background: #fff;
    color: #61708e;
  }

  .mobile-drawer-head svg {
    width: 18px;
    height: 18px;
  }

  .connection-dot {
    display: none;
  }

  .composer-panel {
    border-radius: 16px;
    padding: 9px 10px;
  }

  .composer-tools {
    display: grid;
    grid-template-columns: auto auto;
    justify-content: space-between;
    margin-bottom: 8px;
  }

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

  .composer-panel:not(.expanded) #clearPromptButton,
  .composer-panel:not(.expanded) .select-field,
  .composer-panel:not(.expanded) .mobile-custom-size {
    display: none;
  }

  .composer-panel:not(.expanded) .reference-strip {
    padding-bottom: 6px;
  }

  .composer-panel.expanded {
    padding: 10px 12px;
  }

  .composer-panel.expanded .composer-tools {
    grid-template-columns: repeat(3, auto);
    justify-content: start;
  }

  textarea {
    min-height: 48px;
    padding: 10px 13px 22px;
  }

  .composer-panel.expanded textarea {
    min-height: 76px;
  }

  .user-stack {
    max-width: calc(100vw - 94px);
  }

  .user-content {
    max-width: calc(100vw - 142px);
  }

  .user-row {
    gap: 8px;
  }

  .user-row time {
    font-size: 11px;
  }

  .user-bubble {
    padding: 11px 13px;
    font-size: 13px;
  }

  .user-avatar,
  .ai-avatar {
    width: 36px;
    height: 36px;
  }

  .assistant-message {
    gap: 8px;
    padding-right: 42px;
  }

  .result-group {
    width: fit-content;
    min-width: 0;
    max-width: calc(100vw - 112px);
    padding: 12px;
  }

  .result-card {
    width: min(300px, calc(100vw - 138px));
  }

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

  .round-references {
    max-width: 100%;
  }

  .round-reference-thumb {
    width: 52px;
    height: 52px;
  }

  .select-field.mobile-size-field {
    display: grid;
  }

  .control-row {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .model-field,
  .mobile-custom-size {
    grid-column: 1 / -1;
  }

  .style-field {
    grid-column: 1 / 3;
  }

  .mobile-custom-size {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
  }

  .mobile-custom-size[hidden] {
    display: none;
  }

  .mobile-custom-size label {
    display: grid;
    gap: 6px;
  }

  .mobile-custom-size span {
    color: #53617e;
    font-size: 13px;
    font-weight: 750;
  }

  .mobile-custom-size input {
    width: 100%;
    height: 36px;
    border: 1px solid rgba(116, 148, 203, 0.28);
    border-radius: 9px;
    background: rgba(255, 255, 255, 0.82);
    color: #17233d;
    outline: 0;
    padding: 0 11px;
    font-size: 13px;
    font-weight: 750;
  }

  .generate-button {
    grid-column: 3 / -1;
    align-self: end;
    justify-self: end;
    width: 100px;
  }

  .mobile-select-panel {
    position: fixed;
    inset: 0;
    z-index: 90;
    display: grid;
    align-items: end;
    background: rgba(13, 28, 58, 0.28);
    padding: 12px;
    backdrop-filter: blur(5px);
  }

  .mobile-select-panel[hidden] {
    display: none;
  }

  .mobile-select-sheet {
    overflow: hidden;
    max-height: min(58dvh, 440px);
    border: 1px solid rgba(116, 148, 203, 0.26);
    border-radius: 16px;
    background: rgba(255, 255, 255, 0.98);
    box-shadow: 0 20px 54px rgba(37, 68, 126, 0.22);
  }

  .mobile-select-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-bottom: 1px solid rgba(116, 148, 203, 0.18);
    padding: 13px 14px;
  }

  .mobile-select-head strong {
    color: #162541;
    font-size: 15px;
    font-weight: 900;
  }

  .mobile-select-head button {
    display: grid;
    width: 32px;
    height: 32px;
    place-items: center;
    border: 1px solid rgba(107, 142, 205, 0.24);
    border-radius: 9px;
    background: #fff;
    color: #60708f;
  }

  .mobile-select-head svg {
    width: 17px;
    height: 17px;
  }

  .mobile-select-options {
    display: grid;
    max-height: calc(min(58dvh, 440px) - 59px);
    overflow-y: auto;
    padding: 7px;
  }

  .mobile-select-option {
    display: flex;
    min-height: 44px;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    border: 0;
    border-radius: 10px;
    background: transparent;
    color: #1c2d4c;
    padding: 0 12px;
    text-align: left;
    font-size: 14px;
    font-weight: 800;
  }

  .mobile-select-option.active {
    background: linear-gradient(180deg, #edf4ff, #e6efff);
    color: #236cff;
  }

  .mobile-select-option em {
    flex: 0 0 auto;
    border-radius: 999px;
    background: rgba(37, 119, 255, 0.1);
    color: #236cff;
    padding: 3px 8px;
    font-size: 11px;
    font-style: normal;
    font-weight: 900;
  }
}

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