:root {
  --macaron-blue: #a8d8ea;
  --macaron-blue-deep: #78b8e4;
  --macaron-pink: #f8b4c4;
  --macaron-pink-deep: #ff8fa8;
  --macaron-green: #b8e0d2;
  --macaron-mint: #d3f2e5;
  --macaron-lilac: #d4b8e8;
  --macaron-yellow: #ffd78a;
  --ink: #2f3d56;
  --ink-soft: #6c7891;
  --glass: rgba(255, 255, 255, 0.52);
  --glass-strong: rgba(255, 255, 255, 0.74);
  --glass-soft: rgba(255, 255, 255, 0.34);
  --line: rgba(255, 255, 255, 0.68);
  --shadow: 0 24px 52px rgba(62, 94, 135, 0.18), -5px -6px 18px rgba(255, 255, 255, 0.65);
  --dock-shadow: 0 22px 40px rgba(45, 78, 120, 0.24);
}

* {
  box-sizing: border-box;
}

html,
body {
  width: 100%;
  min-width: 1160px;
  min-height: 820px;
  margin: 0;
}

body {
  overflow: hidden;
  color: var(--ink);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", "Noto Sans SC", sans-serif;
  background: #edf9ff;
}

button,
input,
textarea {
  font: inherit;
}

button {
  color: inherit;
}

.desktop {
  position: relative;
  width: 100vw;
  height: 100vh;
  min-width: 1160px;
  min-height: 820px;
  overflow: hidden;
  background:
    linear-gradient(135deg, rgba(168, 216, 234, 0.96) 0%, rgba(248, 180, 196, 0.92) 48%, rgba(184, 224, 210, 0.96) 100%);
}

.desktop::after {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background:
    radial-gradient(circle at 28% 18%, rgba(255, 255, 255, 0.22), transparent 30%),
    radial-gradient(circle at 78% 24%, rgba(168, 216, 234, 0.28), transparent 32%),
    radial-gradient(circle at 68% 76%, rgba(184, 224, 210, 0.32), transparent 34%),
    radial-gradient(circle at 16% 82%, rgba(248, 180, 196, 0.28), transparent 28%);
}

.wallpaper-glow {
  position: absolute;
  border-radius: 999px;
  filter: blur(62px);
  opacity: 0.38;
  pointer-events: none;
}

.glow-a {
  left: 8%;
  top: 14%;
  width: 260px;
  height: 260px;
  background: #fff;
}

.glow-b {
  right: 8%;
  top: 12%;
  width: 360px;
  height: 360px;
  background: var(--macaron-blue);
}

.glow-c {
  left: 58%;
  bottom: 12%;
  width: 320px;
  height: 320px;
  background: var(--macaron-green);
}

.menu-bar {
  position: absolute;
  z-index: 20;
  top: 18px;
  left: 24px;
  right: 24px;
  height: 50px;
  display: flex;
  align-items: center;
  gap: 28px;
  padding: 0 24px;
  border: 1px solid var(--line);
  border-radius: 20px;
  background: rgba(255, 255, 255, 0.42);
  box-shadow: var(--dock-shadow);
  backdrop-filter: blur(28px) saturate(1.25);
  -webkit-backdrop-filter: blur(28px) saturate(1.25);
}

.brand-mark,
.menu-status,
.menu-items {
  display: flex;
  align-items: center;
}

.brand-mark {
  gap: 10px;
  min-width: 185px;
}

.brand-dot {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--macaron-green);
  box-shadow: 0 0 0 5px rgba(184, 224, 210, 0.28), 0 0 22px rgba(97, 199, 163, 0.7);
}

.menu-items {
  gap: 22px;
  color: var(--ink-soft);
  font-size: 13px;
  font-weight: 600;
}

.menu-status {
  margin-left: auto;
  gap: 10px;
}

.status-pill {
  display: inline-flex;
  align-items: center;
  min-height: 30px;
  padding: 0 13px;
  border: 1px solid rgba(255, 255, 255, 0.64);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.36);
  color: var(--ink-soft);
  font-size: 12px;
  font-weight: 700;
}

.status-pill.is-online {
  background: rgba(184, 224, 210, 0.72);
  color: #fff;
}

.clock {
  min-width: 72px;
  color: var(--ink-soft);
  font-size: 12px;
  font-weight: 700;
  text-align: right;
}

.desk-window {
  position: absolute;
  z-index: 5;
  min-width: 260px;
  min-height: 180px;
  border: 1px solid var(--line);
  border-radius: 26px;
  background: var(--glass);
  box-shadow: var(--shadow);
  backdrop-filter: blur(28px) saturate(1.25);
  -webkit-backdrop-filter: blur(28px) saturate(1.25);
  transform: translate3d(0, 0, 0);
  transition:
    box-shadow 180ms ease,
    opacity 240ms ease,
    transform 260ms cubic-bezier(0.2, 0.8, 0.2, 1);
  user-select: none;
}

.desk-window[data-window="connection"] {
  min-width: 360px;
  min-height: 430px;
}

.desk-window[data-window="chat"] {
  min-width: 420px;
  min-height: 520px;
}

.desk-window[data-window="models"] {
  min-width: 244px;
  min-height: 420px;
}

.desk-window[data-window="logs"] {
  min-width: 330px;
  min-height: 270px;
}

.desk-window[data-window="image"] {
  min-width: 620px;
  min-height: 520px;
}

.desk-window::before {
  content: "";
  position: absolute;
  left: 20px;
  right: 20px;
  top: 1px;
  height: 1px;
  border-radius: 2px;
  background: rgba(255, 255, 255, 0.64);
}

.desk-window.is-focused {
  box-shadow: 0 30px 68px rgba(58, 91, 136, 0.24), -5px -6px 18px rgba(255, 255, 255, 0.72);
}

.desk-window.is-dragging {
  cursor: grabbing;
  transition: none;
  transform: translate3d(0, 0, 0) scale(1.012) rotateX(1deg);
}

.desk-window.is-resizing {
  cursor: nwse-resize;
  transition: none;
}

body.is-resizing-window,
body.is-resizing-window * {
  cursor: nwse-resize !important;
  user-select: none !important;
}

.desk-window.is-minimized {
  pointer-events: none;
  opacity: 0;
  transform: translate3d(0, 26px, 0) scale(0.92);
}

.window-titlebar {
  height: 68px;
  display: grid;
  grid-template-columns: 54px 1fr auto;
  align-items: center;
  gap: 16px;
  padding: 14px 20px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.42);
  cursor: grab;
  touch-action: none;
}

.window-titlebar h1 {
  margin: 0;
  font-size: 16px;
  line-height: 1.2;
}

.window-titlebar p {
  margin: 5px 0 0;
  color: var(--ink-soft);
  font-size: 11px;
  line-height: 1.2;
}

.window-controls {
  display: flex;
  gap: 6px;
}

.control {
  width: 12px;
  height: 12px;
  padding: 0;
  border: 1px solid rgba(255, 255, 255, 0.6);
  border-radius: 50%;
  cursor: pointer;
}

.control.close {
  background: #ec5d73;
}

.control.minimize {
  background: #f7b05b;
}

.control.zoom {
  background: #66c799;
}

.window-state {
  display: inline-flex;
  align-items: center;
  height: 28px;
  padding: 0 14px;
  border-radius: 999px;
  background: rgba(120, 184, 228, 0.72);
  color: white;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0;
}

.window-body {
  padding: 20px 24px 24px;
}

.resize-handle {
  position: absolute;
  z-index: 3;
  opacity: 0;
  transition: opacity 160ms ease;
  touch-action: none;
}

.desk-window:hover .resize-handle,
.desk-window.is-focused .resize-handle,
.desk-window.is-resizing .resize-handle {
  opacity: 1;
}

.resize-handle::after {
  content: "";
  position: absolute;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.62);
  box-shadow: 0 0 0 1px rgba(120, 184, 228, 0.2);
}

.resize-handle-east {
  top: 74px;
  right: -8px;
  bottom: 20px;
  width: 16px;
  cursor: ew-resize;
}

.resize-handle-east::after {
  top: 50%;
  right: 6px;
  width: 4px;
  height: 42px;
  transform: translateY(-50%);
}

.resize-handle-south {
  left: 24px;
  right: 24px;
  bottom: -8px;
  height: 16px;
  cursor: ns-resize;
}

.resize-handle-south::after {
  left: 50%;
  bottom: 6px;
  width: 48px;
  height: 4px;
  transform: translateX(-50%);
}

.resize-handle-corner {
  right: -8px;
  bottom: -8px;
  width: 26px;
  height: 26px;
  cursor: nwse-resize;
}

.resize-handle-corner::after {
  right: 7px;
  bottom: 7px;
  width: 11px;
  height: 11px;
  border-radius: 4px;
  background:
    linear-gradient(135deg, transparent 0 42%, rgba(255, 255, 255, 0.78) 42% 56%, transparent 56%),
    rgba(255, 255, 255, 0.18);
}

.window-connection {
  left: 4vw;
  top: 104px;
  width: 438px;
  height: 520px;
}

.window-chat {
  left: 37vw;
  top: 96px;
  width: 550px;
  height: 620px;
}

.window-models {
  right: 4vw;
  top: 112px;
  width: 264px;
  height: 542px;
}

.window-logs {
  left: 6vw;
  bottom: 118px;
  width: 394px;
  height: 332px;
}

.window-image {
  right: 5vw;
  bottom: 132px;
  width: 820px;
  height: min(560px, calc(100vh - 228px));
}

.window-batch {
  left: 44vw;
  bottom: 190px;
  width: 360px;
  height: 210px;
}

.connection-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 18px 12px;
}

.wide {
  grid-column: 1 / -1;
}

.field {
  display: grid;
  gap: 8px;
  color: var(--ink-soft);
  font-size: 12px;
  font-weight: 700;
}

.field input,
.field select,
.field textarea,
.composer textarea {
  width: 100%;
  border: 1px solid rgba(255, 255, 255, 0.72);
  border-radius: 16px;
  outline: none;
  background: rgba(255, 255, 255, 0.58);
  color: var(--ink);
  box-shadow: inset 0 2px 4px rgba(50, 70, 96, 0.05);
  transition: box-shadow 180ms ease, background 180ms ease, border-color 180ms ease;
}

.field input {
  height: 50px;
  padding: 0 16px;
}

.field select {
  height: 50px;
  padding: 0 16px;
  appearance: none;
}

.field input:focus,
.field select:focus,
.field textarea:focus,
.composer textarea:focus {
  border-color: rgba(120, 184, 228, 0.68);
  background: rgba(255, 255, 255, 0.74);
  box-shadow: 0 0 0 4px rgba(168, 216, 234, 0.35), inset 0 2px 4px rgba(50, 70, 96, 0.05);
}

.secret-field {
  position: relative;
}

.secret-field input {
  padding-right: 54px;
}

.icon-button,
.field-action {
  border: 1px solid rgba(255, 255, 255, 0.7);
  background: rgba(255, 255, 255, 0.46);
  cursor: pointer;
}

.secret-field .icon-button {
  position: absolute;
  right: 10px;
  bottom: 10px;
}

.icon-button {
  width: 34px;
  height: 34px;
  border-radius: 12px;
}

.preset-row,
.action-row,
.stat-row {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
}

.preset-row button,
.glass-button,
.segmented button {
  display: inline-grid;
  place-items: center;
  min-height: 32px;
  padding: 0 13px;
  border: 1px solid rgba(255, 255, 255, 0.7);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.4);
  color: var(--ink);
  font-size: 12px;
  font-weight: 800;
  text-decoration: none;
  cursor: pointer;
  transition: transform 160ms ease, background 160ms ease;
}

.preset-row button:hover,
.glass-button:hover,
.segmented button:hover,
.icon-button:hover,
.field-action:hover {
  background: rgba(255, 255, 255, 0.65);
  transform: translateY(-1px);
}

.primary-button {
  min-height: 40px;
  padding: 0 18px;
  border: 0;
  border-radius: 999px;
  background: linear-gradient(135deg, var(--macaron-blue-deep), var(--macaron-pink-deep));
  color: #fff;
  box-shadow: 0 12px 24px rgba(120, 184, 228, 0.28);
  font-size: 13px;
  font-weight: 900;
  cursor: pointer;
  transition: transform 160ms ease, box-shadow 160ms ease;
}

.primary-button:hover {
  transform: translateY(-1px);
  box-shadow: 0 16px 28px rgba(120, 184, 228, 0.34);
}

.primary-button:disabled,
.glass-button:disabled {
  cursor: wait;
  opacity: 0.7;
}

.mini-stat {
  min-height: 76px;
  padding: 14px 16px;
  border: 1px solid rgba(255, 255, 255, 0.58);
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.4);
  box-shadow: 0 12px 24px rgba(78, 100, 130, 0.1);
}

.mini-stat span {
  color: var(--ink-soft);
  font-size: 12px;
  font-weight: 700;
}

.mini-stat strong {
  display: block;
  margin-top: 4px;
  color: var(--ink);
  font-size: 21px;
  line-height: 1;
}

.mini-stat small {
  display: block;
  margin-top: 6px;
  color: var(--ink-soft);
  font-size: 10px;
}

.chat-layout {
  display: grid;
  height: calc(100% - 68px);
  min-height: 0;
  grid-template-rows: auto minmax(120px, 1fr) auto auto auto;
  gap: 16px;
}

.model-field {
  position: relative;
}

.model-field input {
  padding-right: 54px;
}

.field-action {
  position: absolute;
  right: 10px;
  bottom: 10px;
  width: 34px;
  height: 34px;
  border-radius: 12px;
}

.chat-transcript {
  min-height: 120px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 16px;
  border: 1px solid rgba(255, 255, 255, 0.56);
  border-radius: 22px;
  background: rgba(255, 255, 255, 0.3);
}

.empty-state {
  height: 100%;
  display: grid;
  place-items: center;
  align-content: center;
  gap: 12px;
  color: var(--ink-soft);
  text-align: center;
}

.empty-state span {
  display: grid;
  width: 54px;
  height: 54px;
  place-items: center;
  border-radius: 18px;
  background: linear-gradient(135deg, var(--macaron-blue), var(--macaron-lilac));
  color: #fff;
  font-weight: 900;
}

.empty-state p {
  max-width: 320px;
  margin: 0;
  font-size: 13px;
}

.message {
  max-width: 82%;
  padding: 13px 16px;
  border-radius: 20px;
  white-space: pre-wrap;
  word-break: break-word;
  font-size: 13px;
  line-height: 1.55;
  animation: messageIn 220ms ease both;
}

@keyframes messageIn {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
}

.message.user {
  align-self: flex-end;
  border-bottom-right-radius: 7px;
  background: linear-gradient(135deg, var(--macaron-blue-deep), var(--macaron-lilac));
  color: #fff;
}

.message.assistant {
  align-self: flex-start;
  border-bottom-left-radius: 7px;
  background: rgba(255, 255, 255, 0.62);
}

.message.error {
  align-self: flex-start;
  background: rgba(248, 180, 196, 0.55);
  color: #953149;
}

.message small {
  display: block;
  margin-top: 8px;
  opacity: 0.76;
}

.message-images {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 8px;
}

.message-images img,
.image-result img {
  width: 84px;
  height: 84px;
  border-radius: 14px;
  object-fit: cover;
}

.file-preview {
  min-height: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.file-chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  max-width: 180px;
  min-height: 32px;
  padding: 0 10px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.4);
  color: var(--ink-soft);
  font-size: 12px;
  font-weight: 700;
}

.file-chip img {
  width: 22px;
  height: 22px;
  border-radius: 7px;
  object-fit: cover;
}

.file-chip button {
  width: 18px;
  height: 18px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: rgba(248, 180, 196, 0.72);
  cursor: pointer;
}

.composer {
  display: grid;
  grid-template-columns: 34px 1fr auto;
  gap: 10px;
  align-items: end;
}

.composer textarea {
  min-height: 74px;
  max-height: 110px;
  padding: 13px 15px;
  resize: vertical;
}

.stat-row {
  display: grid;
  grid-template-columns: 116px 116px 1fr;
}

.models-body {
  display: grid;
  height: calc(100% - 68px);
  min-height: 0;
  grid-template-rows: auto minmax(120px, 1fr) auto;
  gap: 14px;
}

.model-list {
  min-height: 120px;
  overflow-y: auto;
  display: grid;
  align-content: start;
  gap: 10px;
}

.model-row {
  display: grid;
  grid-template-columns: 12px 1fr auto;
  gap: 10px;
  align-items: center;
  padding: 11px 12px;
  border: 1px solid rgba(255, 255, 255, 0.56);
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.38);
  cursor: pointer;
}

.model-row:hover,
.model-row.is-selected {
  background: rgba(255, 255, 255, 0.64);
}

.model-dot {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--macaron-blue-deep);
}

.model-row strong,
.model-row small {
  display: block;
}

.model-row strong {
  font-size: 12px;
}

.model-row small {
  margin-top: 3px;
  color: var(--ink-soft);
  font-size: 10px;
}

.logs-body {
  --raw-preview-height: 62px;
  display: grid;
  height: calc(100% - 68px);
  min-height: 0;
  grid-template-rows: minmax(86px, 1fr) 10px var(--raw-preview-height);
  gap: 8px;
}

.log-list {
  min-height: 110px;
  overflow-y: auto;
  display: grid;
  align-content: start;
  gap: 10px;
}

.log-row {
  display: grid;
  grid-template-columns: 54px 1fr 48px 48px;
  align-items: center;
  gap: 8px;
  min-height: 40px;
  padding: 8px 10px;
  border: 1px solid rgba(255, 255, 255, 0.48);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.36);
  font-size: 12px;
}

.log-method {
  display: inline-grid;
  place-items: center;
  height: 24px;
  border-radius: 999px;
  background: rgba(120, 184, 228, 0.72);
  color: #fff;
  font-weight: 900;
}

.log-status.ok {
  color: #4dae87;
}

.log-status.error {
  color: #d84e69;
}

.log-status.draft {
  color: #a37bd0;
}

.raw-preview {
  height: 100%;
  min-height: 42px;
  margin: 0;
  overflow: auto;
  padding: 14px;
  border-radius: 16px;
  background: rgba(27, 34, 51, 0.88);
  color: rgba(255, 255, 255, 0.88);
  font-size: 11px;
}

.raw-resize-handle {
  position: relative;
  display: block;
  min-height: 10px;
  cursor: ns-resize;
  border-radius: 999px;
}

.raw-resize-handle::before {
  content: "";
  position: absolute;
  left: 50%;
  top: 3px;
  width: 54px;
  height: 4px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.58);
  box-shadow: 0 0 0 1px rgba(120, 184, 228, 0.18);
  transform: translateX(-50%);
}

.raw-resize-handle:hover::before,
.desk-window.is-raw-resizing .raw-resize-handle::before {
  background: rgba(168, 216, 234, 0.76);
}

.image-body {
  display: grid;
  height: calc(100% - 68px);
  min-height: 0;
  grid-template-columns: minmax(148px, 0.48fr) minmax(340px, 1.32fr) minmax(210px, 0.72fr);
  gap: 14px;
  align-items: stretch;
  overflow: hidden;
}

.image-drop,
.image-result {
  display: grid;
  place-items: center;
  align-content: center;
  gap: 10px;
  min-height: 120px;
  overflow: auto;
  border: 1px solid rgba(255, 255, 255, 0.62);
  border-radius: 22px;
  background: rgba(255, 255, 255, 0.36);
  color: var(--ink-soft);
  text-align: center;
}

.image-drop {
  padding: 16px;
  cursor: pointer;
}

.image-drop,
.image-result,
.image-controls {
  min-height: 0;
}

.image-drop.is-dragover,
.chat-transcript.is-dragover {
  outline: 3px solid rgba(168, 216, 234, 0.55);
  outline-offset: 3px;
}

.image-drop span {
  display: grid;
  width: 62px;
  height: 62px;
  place-items: center;
  border-radius: 20px;
  background: linear-gradient(135deg, var(--macaron-green), var(--macaron-blue));
  color: #fff;
  font-weight: 900;
}

.image-drop p,
.image-result {
  margin: 0;
  font-size: 12px;
  font-weight: 700;
}

.image-controls {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  align-content: start;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 2px 6px 18px 0;
  scrollbar-gutter: stable;
}

.image-option-panel {
  display: grid;
  gap: 12px;
  padding: 2px 0;
}

.image-option-block {
  display: grid;
  gap: 8px;
}

.image-option-block h2 {
  margin: 0;
  color: var(--ink);
  font-size: 15px;
  font-weight: 900;
}

.image-pill-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 9px;
}

.ratio-grid {
  grid-template-columns: repeat(5, minmax(0, 1fr));
}

.image-pill-grid button {
  min-height: 44px;
  border: 1px solid rgba(150, 226, 221, 0.58);
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.54);
  color: rgba(24, 45, 48, 0.62);
  box-shadow: inset 0 1px 1px rgba(255, 255, 255, 0.7), 0 10px 20px rgba(120, 184, 228, 0.08);
  font-size: 16px;
  font-weight: 900;
  cursor: pointer;
  transition: transform 160ms ease, background 160ms ease, border-color 160ms ease, color 160ms ease;
}

.image-pill-grid button:hover {
  transform: translateY(-1px);
  background: rgba(255, 255, 255, 0.76);
}

.image-pill-grid button.active {
  border-color: rgba(94, 206, 211, 0.75);
  background: linear-gradient(135deg, rgba(206, 242, 247, 0.96), rgba(229, 250, 244, 0.88));
  color: var(--ink);
  box-shadow: inset 0 1px 2px rgba(255, 255, 255, 0.88), 0 14px 24px rgba(120, 184, 228, 0.18);
}

.image-select-row {
  display: grid;
  grid-template-columns: 1fr 0.88fr;
  gap: 12px;
  padding: 2px 0 4px;
}

.image-select-row .field span {
  color: var(--ink);
  font-size: 15px;
  font-weight: 900;
}

.image-select-row select {
  height: 54px;
  border-color: rgba(150, 226, 221, 0.58);
  border-radius: 16px;
  background-color: rgba(255, 255, 255, 0.62);
  font-size: 17px;
}

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

.segmented button.active {
  background: rgba(184, 224, 210, 0.78);
  color: #fff;
}

.image-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  position: sticky;
  bottom: 0;
  grid-column: 1 / -1;
  padding: 10px 0 2px;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0), rgba(255, 245, 250, 0.82) 34%, rgba(255, 245, 250, 0.92));
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}

.image-preview-card {
  width: 100%;
  display: grid;
  gap: 10px;
  justify-items: center;
}

.image-preview-card img {
  max-width: 100%;
  max-height: 150px;
  border-radius: 18px;
  object-fit: contain;
  box-shadow: 0 12px 24px rgba(78, 100, 130, 0.14);
}

.image-preview-card small {
  max-width: 100%;
  color: var(--ink-soft);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.image-result-grid {
  width: 100%;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(128px, 1fr));
  gap: 12px;
  padding: 10px;
}

.image-result-card {
  display: grid;
  gap: 8px;
  padding: 8px;
  border: 1px solid rgba(255, 255, 255, 0.62);
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.42);
  box-shadow: 0 12px 22px rgba(78, 100, 130, 0.1);
}

.image-result-card button {
  width: 100%;
  padding: 0;
  border: 0;
  border-radius: 14px;
  background: transparent;
  cursor: zoom-in;
  overflow: hidden;
}

.image-result-card img {
  display: block;
  width: 100%;
  aspect-ratio: 1 / 1;
  border-radius: 14px;
  object-fit: cover;
  background: rgba(255, 255, 255, 0.4);
  transition: transform 180ms ease;
}

.image-result-card button:hover img {
  transform: scale(1.035);
}

.image-result-card div {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.image-result-card span,
.image-result-card a {
  color: var(--ink);
  font-size: 11px;
  font-weight: 800;
  text-decoration: none;
}

.image-result-card a {
  display: inline-grid;
  min-height: 28px;
  padding: 0 10px;
  place-items: center;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.64);
  color: var(--macaron-pink-deep);
}

.image-lightbox[hidden] {
  display: none;
}

.image-lightbox {
  position: absolute;
  inset: 0;
  z-index: 300;
  display: grid;
  place-items: center;
  padding: 52px 28px 112px;
}

.image-lightbox-backdrop {
  position: absolute;
  inset: 0;
  border: 0;
  background: rgba(21, 33, 46, 0.28);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
}

.image-lightbox-panel {
  position: relative;
  z-index: 1;
  display: grid;
  width: min(86vw, 980px);
  max-height: calc(100vh - 180px);
  gap: 14px;
  padding: 16px;
  border: 1px solid rgba(255, 255, 255, 0.64);
  border-radius: 26px;
  background: rgba(255, 255, 255, 0.66);
  box-shadow: 0 34px 80px rgba(32, 52, 72, 0.28), inset 0 1px 1px rgba(255, 255, 255, 0.8);
}

.image-lightbox-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.image-lightbox-toolbar strong {
  min-width: 0;
  overflow: hidden;
  color: var(--ink);
  font-size: 14px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.image-lightbox-toolbar div {
  display: flex;
  gap: 8px;
}

.image-lightbox-panel img {
  display: block;
  max-width: 100%;
  max-height: calc(100vh - 280px);
  margin: 0 auto;
  border-radius: 20px;
  object-fit: contain;
  background: rgba(255, 255, 255, 0.4);
  box-shadow: 0 18px 36px rgba(78, 100, 130, 0.16);
}

.image-lightbox-panel p {
  max-height: 54px;
  margin: 0;
  overflow: auto;
  color: var(--ink-soft);
  font-size: 12px;
  font-weight: 700;
  text-align: center;
}

.batch-body {
  display: grid;
  height: calc(100% - 68px);
  min-height: 0;
  gap: 16px;
  color: var(--ink-soft);
  font-size: 13px;
}

.dock {
  position: absolute;
  z-index: 50;
  left: 50%;
  bottom: 24px;
  display: flex;
  gap: 28px;
  align-items: center;
  height: 78px;
  padding: 10px 28px;
  border: 1px solid var(--line);
  border-radius: 32px;
  background: rgba(255, 255, 255, 0.44);
  box-shadow: var(--dock-shadow);
  backdrop-filter: blur(30px) saturate(1.25);
  -webkit-backdrop-filter: blur(30px) saturate(1.25);
  transform: translateX(-50%);
}

.dock-item {
  position: relative;
  width: 74px;
  height: 58px;
  display: grid;
  grid-template-rows: 34px 16px;
  place-items: center;
  gap: 2px;
  padding: 7px 0 4px;
  border: 1px solid rgba(255, 255, 255, 0.64);
  border-radius: 20px;
  background: rgba(255, 255, 255, 0.52);
  cursor: pointer;
  transition: transform 200ms cubic-bezier(0.2, 0.8, 0.2, 1), background 180ms ease;
}

.dock-item:hover {
  background: rgba(255, 255, 255, 0.7);
  transform: translateY(-7px) scale(1.04);
}

.dock-item span:last-of-type {
  font-size: 10px;
  font-weight: 800;
}

.dock-icon {
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  border-radius: 12px;
  color: #fff;
  font-size: 11px;
  font-weight: 900;
}

.dock-icon.blue {
  background: var(--macaron-blue-deep);
}

.dock-icon.pink {
  background: var(--macaron-pink-deep);
}

.dock-icon.green {
  background: #72c6a3;
}

.dock-icon.lilac {
  background: #b18add;
}

.dock-icon.yellow {
  background: #f0aa48;
}

.dock-icon.mint {
  background: #75cfae;
}

.dock-item i {
  position: absolute;
  left: 50%;
  bottom: -7px;
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: currentColor;
  transform: translateX(-50%);
}

.dock-item.is-closed {
  opacity: 0.62;
}

.dock-item.is-closed i {
  display: none;
}

.toast {
  position: fixed;
  z-index: 1000;
  right: 24px;
  top: 84px;
  max-width: 360px;
  padding: 14px 18px;
  border: 1px solid rgba(255, 255, 255, 0.72);
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.84);
  color: var(--ink);
  box-shadow: 0 18px 34px rgba(62, 94, 135, 0.16);
  transform: translateX(calc(100% + 40px));
  transition: transform 260ms cubic-bezier(0.2, 0.8, 0.2, 1);
}

.toast.show {
  transform: translateX(0);
}

@media (max-width: 900px) {
  html,
  body,
  .desktop {
    min-width: 0;
    min-height: 0;
    overflow: auto;
  }

  body {
    overflow: auto;
  }

  .desktop {
    height: auto;
    min-height: 100vh;
    padding: 88px 16px 120px;
  }

  .menu-bar {
    left: 12px;
    right: 12px;
    gap: 12px;
  }

  .menu-items {
    display: none;
  }

  .desk-window {
    position: relative;
    left: auto;
    right: auto;
    top: auto;
    bottom: auto;
    width: 100%;
    height: auto;
    min-height: 240px;
    margin-bottom: 18px;
  }

  .resize-handle {
    display: none;
  }

  .desk-window.is-minimized {
    display: none;
  }

  .image-body,
  .image-controls,
  .image-select-row,
  .composer,
  .stat-row {
    grid-template-columns: 1fr;
  }

  .ratio-grid,
  .image-pill-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .image-lightbox {
    position: fixed;
    padding: 72px 14px 100px;
  }

  .image-lightbox-panel {
    width: 100%;
    max-height: calc(100vh - 150px);
  }

  .dock {
    position: fixed;
    left: 12px;
    right: 12px;
    bottom: 12px;
    transform: none;
    overflow-x: auto;
    justify-content: flex-start;
    gap: 12px;
  }
}
