:root {
  --ink: #17201b;
  --muted: #5d685f;
  --paper: #f4efe3;
  --card: rgba(255, 252, 244, 0.92);
  --accent: #0f6b52;
  --accent-2: #c76635;
  --line: rgba(23, 32, 27, 0.16);
  --shadow: 0 24px 70px rgba(40, 34, 24, 0.16);
}
* { box-sizing: border-box; }
body {
  margin: 0;
  color: var(--ink);
  font-family: "Aptos", "Segoe UI", sans-serif;
  background:
    radial-gradient(circle at 12% 12%, rgba(199, 102, 53, 0.24), transparent 28rem),
    radial-gradient(circle at 84% 16%, rgba(15, 107, 82, 0.20), transparent 25rem),
    linear-gradient(135deg, #f6e8cf 0%, #e7efe2 54%, #f8f1e5 100%);
  min-height: 100vh;
}
button, input, textarea, select { font: inherit; }
button, .ghost {
  border: 0;
  border-radius: 999px;
  padding: 0.78rem 1.1rem;
  background: var(--accent);
  color: white;
  cursor: pointer;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
button.secondary, .ghost { background: #f0e2c7; color: var(--ink); border: 1px solid var(--line); }
button:disabled { opacity: 0.55; cursor: wait; }
input, textarea, select {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 0.9rem 1rem;
  background: rgba(255,255,255,0.72);
  color: var(--ink);
}
textarea { resize: vertical; }
label, .label { font-size: 0.78rem; letter-spacing: 0.08em; text-transform: uppercase; color: var(--muted); }
.public-shell, .admin-shell { padding: 32px; }
.studio, .admin-layout { max-width: 1180px; margin: 0 auto; }
.hero { display: flex; justify-content: space-between; align-items: flex-start; gap: 24px; margin-bottom: 24px; }
.hero.compact h1 { font-size: clamp(2rem, 4vw, 4rem); }
.eyebrow { color: var(--accent-2); font-weight: 700; letter-spacing: 0.14em; text-transform: uppercase; }
h1 { font-family: Georgia, "Times New Roman", serif; font-size: clamp(2.7rem, 7vw, 6.6rem); line-height: 0.92; margin: 0; max-width: 850px; }
h2 { margin: 0 0 14px; }
.muted { color: var(--muted); max-width: 720px; }
.admin-link { color: var(--ink); text-decoration: none; border-bottom: 1px solid var(--ink); padding-top: 14px; }
.card {
  background: var(--card);
  border: 1px solid rgba(255,255,255,0.7);
  border-radius: 28px;
  box-shadow: var(--shadow);
  padding: 22px;
  backdrop-filter: blur(14px);
}
.hidden { display: none !important; }
.inline-form { display: grid; grid-template-columns: 1fr auto; gap: 12px; align-items: center; }
.login-card { max-width: 680px; display: grid; gap: 12px; }
.status { min-height: 1.4em; color: var(--accent-2); }
.workspace { display: grid; gap: 18px; }
.toolbar { display: grid; grid-template-columns: 1fr 1.2fr 1.2fr auto; gap: 14px; align-items: end; }
.toolbar strong { display: block; font-size: 2.4rem; }
.grid { display: grid; grid-template-columns: 0.9fr 1.1fr; gap: 18px; }
.composer { display: grid; gap: 14px; }
.actions { display: flex; gap: 10px; flex-wrap: wrap; }
.preview-card { min-height: 520px; display: flex; flex-direction: column; }
.preview-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 14px; }
.preview { flex: 1; border: 1px dashed var(--line); border-radius: 24px; display: grid; place-items: center; overflow: hidden; background: rgba(255,255,255,0.38); }
.preview img { max-width: 100%; max-height: 100%; object-fit: contain; }
.history-card ol { margin: 0; padding-left: 20px; }
.history-card li { margin: 8px 0; color: var(--muted); }
.stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; margin-bottom: 18px; }
.stat { padding: 18px; border-radius: 24px; background: rgba(255,255,255,0.68); border: 1px solid var(--line); }
.stat strong { display: block; font-size: 2rem; }
.admin-grid { display: grid; grid-template-columns: 120px 140px 1fr auto; gap: 12px; }
.code-output { white-space: pre-wrap; background: #18231d; color: #d8ffe6; padding: 16px; border-radius: 18px; overflow: auto; }
.table { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; border-bottom: 1px solid var(--line); padding: 10px; vertical-align: top; }
code { background: rgba(23,32,27,0.08); padding: 0.1rem 0.35rem; border-radius: 8px; }
@media (max-width: 840px) {
  .public-shell, .admin-shell { padding: 18px; }
  .hero, .grid { grid-template-columns: 1fr; display: grid; }
  .toolbar, .stats, .admin-grid, .inline-form { grid-template-columns: 1fr; }
}

/* ChatGPT-like public workspace override */
.chat-shell {
  padding: 0;
  background: #ffffff;
  color: #111111;
  min-height: 100vh;
}
.chat-app {
  min-height: 100vh;
}
.redeem-screen {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 32px;
  background:
    radial-gradient(circle at 50% 10%, rgba(15, 107, 82, 0.10), transparent 34rem),
    linear-gradient(#fff, #f7f7f4);
}
.redeem-copy {
  max-width: 760px;
  text-align: center;
  margin-bottom: 24px;
}
.redeem-copy h1 {
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(3rem, 7vw, 6rem);
  line-height: 0.96;
}
.chat-workspace {
  min-height: 100vh;
  padding: 74px 24px 190px;
  background: #fff;
}
.chat-topbar {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 20;
  height: 58px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0 22px;
  background: rgba(255, 255, 255, 0.88);
  border-bottom: 1px solid #ececec;
  backdrop-filter: blur(18px);
}
.chat-topbar strong { display: block; font-size: 15px; }
.chat-topbar span { color: #6b6b6b; font-size: 13px; }
.topbar-actions { display: flex; align-items: center; gap: 10px; }
.credit-pill {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  border: 1px solid #e8e8e8;
  border-radius: 999px;
  padding: 7px 12px;
  background: #fafafa;
}
.credit-pill b { color: #0f6b52; font-size: 16px; }
.subtle-button, .subtle-link {
  border: 1px solid #e4e4e4;
  background: #fff;
  color: #222;
  border-radius: 999px;
  padding: 9px 13px;
  text-decoration: none;
  box-shadow: none;
}
.conversation {
  width: min(100%, 840px);
  margin: 0 auto;
}
.empty-chat {
  text-align: center;
  padding: 18vh 12px 10vh;
  color: #666;
}
.empty-chat h2 {
  color: #111;
  font-size: clamp(2rem, 5vw, 4.8rem);
  line-height: 1.04;
  letter-spacing: -0.055em;
  max-width: 760px;
  margin: 8px auto 16px;
}
.message {
  display: flex;
  margin: 26px 0;
  animation: messageIn 240ms ease-out both;
}
.message.user { justify-content: flex-end; }
.bubble {
  max-width: 680px;
  background: #f4f4f4;
  border-radius: 28px;
  padding: 17px 22px;
  font-size: 18px;
  line-height: 1.65;
  white-space: pre-wrap;
}
.message.assistant {
  display: block;
  max-width: 720px;
}
.assistant-meta {
  color: #5f6368;
  font-weight: 650;
  margin: 0 0 16px;
}
.image-frame {
  position: relative;
  width: min(100%, 620px);
  border-radius: 28px;
  overflow: hidden;
  background: #f6f6f6;
}
.image-frame img {
  display: block;
  width: 100%;
  height: auto;
}
.image-frame::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 86px;
  background: linear-gradient(transparent, rgba(0,0,0,0.32));
  pointer-events: none;
}
.image-download, .image-edit {
  position: absolute;
  z-index: 2;
  bottom: 14px;
  border: 0;
  color: #fff;
  background: rgba(0,0,0,0.34);
  backdrop-filter: blur(10px);
  border-radius: 999px;
  padding: 10px 14px;
  text-decoration: none;
}
.image-edit { left: 14px; }
.image-download { right: 14px; }
.feedback-row {
  display: flex;
  gap: 6px;
  margin-top: 12px;
}
.feedback-row button {
  color: #606060;
  background: transparent;
  padding: 7px;
  border-radius: 10px;
}
.composer-dock {
  position: fixed;
  left: 50%;
  bottom: 24px;
  transform: translateX(-50%);
  width: min(calc(100vw - 28px), 960px);
  z-index: 30;
  background: rgba(255,255,255,0.96);
  border: 1px solid #dedede;
  border-radius: 30px;
  box-shadow: 0 18px 70px rgba(0,0,0,0.13);
  padding: 12px 14px 10px;
}
.composer-dock textarea {
  border: 0;
  background: transparent;
  resize: none;
  outline: none;
  min-height: 44px;
  max-height: 220px;
  padding: 11px 12px;
  font-size: 17px;
  line-height: 1.55;
}
.composer-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
}
.composer-left, .composer-right {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}
.icon-button {
  width: 38px;
  height: 38px;
  border-radius: 999px;
  display: grid;
  place-items: center;
  border: 1px solid #dcdcdc;
  background: #fff;
  color: #111;
  cursor: pointer;
  font-size: 24px;
  line-height: 1;
}
.icon-button input { display: none; }
.composer-dock select,
.custom-size input {
  height: 38px;
  border: 1px solid #dedede;
  background: #fff;
  border-radius: 999px;
  padding: 0 12px;
  width: auto;
  color: #222;
}
.size-control { display: flex; align-items: center; gap: 8px; }
.custom-size {
  display: flex;
  align-items: center;
  gap: 5px;
  background: #f7f7f7;
  border-radius: 999px;
  padding: 3px;
}
.custom-size input {
  width: 72px;
  text-align: center;
  padding: 0 8px;
}
.send-button {
  width: 42px;
  height: 42px;
  padding: 0;
  border-radius: 999px;
  background: #111;
  color: #fff;
  font-size: 22px;
}
.attachment-preview {
  display: flex;
  align-items: center;
  gap: 10px;
  width: fit-content;
  max-width: 100%;
  margin: 0 0 8px 8px;
  background: #f4f4f4;
  border-radius: 18px;
  padding: 6px 8px 6px 6px;
}
.attachment-preview img {
  width: 48px;
  height: 48px;
  border-radius: 12px;
  object-fit: cover;
}
.attachment-preview span {
  max-width: 280px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: #444;
}
.attachment-preview button {
  width: 28px;
  height: 28px;
  padding: 0;
  background: #e9e9e9;
  color: #111;
}
.composer-status {
  margin: 4px 10px 0;
  min-height: 20px;
  font-size: 13px;
}
@keyframes messageIn {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}
@media (max-width: 760px) {
  .chat-workspace { padding: 68px 12px 220px; }
  .chat-topbar { padding: 0 12px; }
  .chat-topbar div:first-child span { display: none; }
  .topbar-actions { gap: 6px; }
  .subtle-link { display: none; }
  .composer-dock { bottom: 10px; border-radius: 24px; }
  .composer-row { align-items: flex-start; flex-direction: column; }
  .composer-right { width: 100%; justify-content: flex-end; }
  .bubble { font-size: 16px; }
}

/* Full ChatGPT-like ImageEV2 app */
.chat-shell {
  --gpt-bg: #ffffff;
  --gpt-sidebar: #f9f9f9;
  --gpt-border: #e5e5e5;
  --gpt-soft: #f4f4f4;
  --gpt-hover: #ececec;
  --gpt-text: #0d0d0d;
  --gpt-muted: #676767;
  --gpt-danger: #b42318;
  padding: 0;
  background: var(--gpt-bg);
  color: var(--gpt-text);
  min-height: 100vh;
  font-family: ui-sans-serif, "Segoe UI", "Helvetica Neue", Arial, sans-serif;
}
.chatgpt-app { min-height: 100vh; }
.redeem-screen {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 32px;
  background:
    radial-gradient(circle at 50% 6%, rgba(16, 163, 127, 0.10), transparent 32rem),
    linear-gradient(#fff, #f7f7f7);
}
.redeem-copy { max-width: 760px; text-align: center; margin-bottom: 24px; }
.redeem-copy h1 {
  font-size: clamp(2.7rem, 6vw, 5.7rem);
  line-height: 1;
  letter-spacing: -0.06em;
  font-family: ui-serif, Georgia, serif;
}
.gpt-layout {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 292px 1fr;
  background: var(--gpt-bg);
}
.gpt-sidebar {
  position: fixed;
  inset: 0 auto 0 0;
  z-index: 40;
  width: 292px;
  display: flex;
  flex-direction: column;
  background: var(--gpt-sidebar);
  border-right: 1px solid var(--gpt-border);
  padding: 12px;
  transition: transform 180ms ease, width 180ms ease;
}
.gpt-sidebar.collapsed { transform: translateX(-292px); }
.sidebar-head { display: flex; gap: 8px; align-items: center; margin-bottom: 10px; }
.sidebar-new {
  flex: 1;
  height: 42px;
  justify-content: flex-start;
  background: #fff;
  color: var(--gpt-text);
  border: 1px solid var(--gpt-border);
  border-radius: 12px;
  box-shadow: none;
  padding: 0 13px;
}
.sidebar-icon {
  width: 42px;
  height: 42px;
  border: 1px solid var(--gpt-border);
  border-radius: 12px;
  background: #fff;
  color: var(--gpt-text);
  padding: 0;
}
.sidebar-search {
  height: 40px;
  display: flex;
  align-items: center;
  gap: 8px;
  background: #fff;
  border: 1px solid var(--gpt-border);
  border-radius: 12px;
  padding: 0 12px;
  margin-bottom: 10px;
  letter-spacing: 0;
  text-transform: none;
}
.sidebar-search input {
  border: 0;
  background: transparent;
  padding: 0;
  outline: 0;
  font-size: 14px;
}
.chat-list { flex: 1; overflow-y: auto; display: grid; align-content: start; gap: 3px; }
.chat-item {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px;
  width: 100%;
  min-height: 42px;
  color: var(--gpt-text);
  background: transparent;
  border: 0;
  border-radius: 10px;
  padding: 8px 10px;
  text-align: left;
  box-shadow: none;
}
.chat-item:hover, .chat-item.active { background: var(--gpt-hover); }
.chat-item span { overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.chat-item small { color: var(--gpt-muted); }
.sidebar-foot {
  border-top: 1px solid var(--gpt-border);
  padding-top: 10px;
  display: grid;
  gap: 6px;
}
.sidebar-foot a, .sidebar-foot button {
  color: var(--gpt-text);
  background: transparent;
  border: 0;
  border-radius: 10px;
  text-align: left;
  justify-content: flex-start;
  padding: 9px 10px;
  text-decoration: none;
}
.sidebar-foot a:hover, .sidebar-foot button:hover { background: var(--gpt-hover); }
.code-card {
  display: grid;
  gap: 8px;
  padding: 10px;
  border: 1px solid var(--gpt-border);
  border-radius: 16px;
  background: #fffaf1;
}
.code-card-head {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  color: var(--gpt-muted);
  font-size: 13px;
}
.code-card-head strong {
  color: var(--gpt-text);
}
.code-card input {
  width: 100%;
  min-width: 0;
  height: 38px;
  border-radius: 12px;
  font-size: 13px;
}
.code-actions {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 6px;
}
.sidebar-foot .code-actions button {
  justify-content: center;
  text-align: center;
  padding: 8px 10px;
  background: #fff;
  border: 1px solid var(--gpt-border);
}
.sidebar-foot .code-actions button:first-child {
  background: #17130f;
  color: #fff;
  border-color: #17130f;
}
.code-card .status {
  min-height: 16px;
  font-size: 12px;
  margin: 0;
}
.credit-line {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px;
  border-radius: 12px;
  background: #fff;
  color: var(--gpt-muted);
}
.credit-line strong { color: #0f7b5f; font-size: 18px; }
.gpt-main {
  grid-column: 2;
  min-height: 100vh;
  padding: 64px 24px 170px;
}
.gpt-topbar {
  position: fixed;
  left: 292px;
  right: 0;
  top: 0;
  z-index: 30;
  height: 58px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 18px;
  background: rgba(255,255,255,0.88);
  backdrop-filter: blur(16px);
}
.gpt-layout.sidebar-collapsed {
  grid-template-columns: 0 1fr;
}
.gpt-layout.sidebar-collapsed .gpt-main {
  grid-column: 1 / -1;
}
.gpt-layout.sidebar-collapsed .gpt-topbar {
  left: 0;
}
.gpt-layout.sidebar-collapsed #open-sidebar {
  display: inline-grid;
}
.gpt-layout.sidebar-collapsed .gpt-composer {
  left: 50%;
  width: min(calc(100vw - 48px), 900px);
}
.gpt-layout.sidebar-collapsed .model-menu {
  margin-right: auto;
}
.model-menu { position: relative; }
.model-button {
  background: transparent;
  color: var(--gpt-text);
  border: 0;
  border-radius: 10px;
  padding: 10px 12px;
  box-shadow: none;
  font-weight: 650;
}
.model-button:hover { background: var(--gpt-hover); }
.popover {
  position: absolute;
  top: 46px;
  left: 0;
  width: 280px;
  background: #fff;
  border: 1px solid var(--gpt-border);
  border-radius: 16px;
  box-shadow: 0 20px 70px rgba(0,0,0,0.16);
  padding: 12px;
}
.popover strong, .popover p { display: block; margin: 8px; }
.popover p { color: var(--gpt-muted); font-size: 13px; line-height: 1.4; }
.selected-model {
  width: 100%;
  justify-content: flex-start;
  color: var(--gpt-text);
  background: var(--gpt-soft);
  border-radius: 12px;
  box-shadow: none;
}
.topbar-actions { display: flex; gap: 8px; align-items: center; }
.topbar-code {
  max-width: min(30vw, 310px);
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 7px 10px;
  border: 1px solid var(--gpt-border);
  border-radius: 999px;
  background: #fff;
  color: var(--gpt-muted);
  font-size: 12px;
}
.topbar-code span {
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}
.topbar-code strong {
  flex: 0 0 auto;
  color: #0f7b5f;
}
.toolbar-button {
  background: #fff;
  color: var(--gpt-text);
  border: 1px solid var(--gpt-border);
  border-radius: 999px;
  padding: 8px 12px;
  box-shadow: none;
}
.toolbar-button:hover { background: var(--gpt-hover); }
.toolbar-button.danger { color: var(--gpt-danger); }
.mobile-only { display: none; }
.gpt-thread {
  width: min(100%, 840px);
  margin: 0 auto;
}
.gpt-empty {
  min-height: calc(100vh - 260px);
  display: grid;
  place-content: center;
  text-align: center;
  color: var(--gpt-muted);
}
.gpt-empty h2 {
  margin: 0 auto 12px;
  color: var(--gpt-text);
  font-size: clamp(2rem, 4vw, 3.6rem);
  letter-spacing: -0.05em;
}
.starter-grid {
  margin-top: 24px;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}
.starter-grid button {
  min-height: 58px;
  justify-content: flex-start;
  text-align: left;
  color: var(--gpt-text);
  background: #fff;
  border: 1px solid var(--gpt-border);
  border-radius: 16px;
  box-shadow: none;
}
.starter-grid button:hover { background: var(--gpt-soft); }
.message {
  display: flex;
  flex-direction: column;
  margin: 28px 0;
  animation: messageIn 180ms ease-out both;
}
.message.user { align-items: flex-end; }
.bubble {
  max-width: min(720px, 82%);
  background: var(--gpt-soft);
  color: var(--gpt-text);
  border-radius: 28px;
  padding: 14px 20px;
  font-size: 17px;
  line-height: 1.65;
  white-space: pre-wrap;
}
.message.user .message-actions {
  margin-right: 10px;
  opacity: 0;
  transition: opacity 120ms ease;
}
.message.user:hover .message-actions { opacity: 1; }
.message-actions, .feedback-row {
  display: flex;
  gap: 4px;
  margin-top: 8px;
}
.message-actions button, .feedback-row button {
  color: var(--gpt-muted);
  background: transparent;
  border: 0;
  border-radius: 9px;
  padding: 7px 8px;
  box-shadow: none;
}
.message-actions button:hover, .feedback-row button:hover { background: var(--gpt-hover); color: var(--gpt-text); }
.message.assistant { align-items: flex-start; }
.assistant-meta {
  display: flex;
  gap: 12px;
  color: var(--gpt-muted);
  font-size: 14px;
  font-weight: 650;
  margin-bottom: 12px;
}
.image-frame {
  position: relative;
  width: min(100%, 640px);
  border-radius: 26px;
  overflow: hidden;
  background: #f5f5f5;
  border: 1px solid #efefef;
}
.image-frame img { display: block; width: 100%; height: auto; }
.image-frame::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 88px;
  background: linear-gradient(transparent, rgba(0,0,0,0.34));
  pointer-events: none;
}
.image-download, .image-edit {
  position: absolute;
  z-index: 2;
  bottom: 14px;
  border: 0;
  color: #fff;
  background: rgba(0,0,0,0.38);
  backdrop-filter: blur(10px);
  border-radius: 999px;
  padding: 10px 14px;
  text-decoration: none;
  box-shadow: none;
}
.image-edit { left: 14px; }
.image-download { right: 14px; }
.gpt-composer {
  position: fixed;
  left: calc(292px + (100vw - 292px) / 2);
  bottom: 22px;
  transform: translateX(-50%);
  width: min(calc(100vw - 340px), 900px);
  z-index: 35;
  background: rgba(255,255,255,0.98);
  border: 1px solid #d9d9d9;
  border-radius: 28px;
  box-shadow: 0 12px 48px rgba(0,0,0,0.14);
  padding: 10px 12px 8px;
}
.gpt-composer textarea {
  width: 100%;
  min-height: 44px;
  max-height: 220px;
  border: 0;
  outline: 0;
  resize: none;
  background: transparent;
  border-radius: 18px;
  padding: 11px 12px;
  font-size: 17px;
  line-height: 1.55;
}
.composer-row { display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.composer-left, .composer-right { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.round-tool {
  width: 38px;
  height: 38px;
  border-radius: 999px;
  display: grid;
  place-items: center;
  border: 1px solid #d9d9d9;
  background: #fff;
  color: var(--gpt-text);
  cursor: pointer;
  font-size: 22px;
  line-height: 1;
}
.round-tool:hover { background: var(--gpt-hover); }
.round-tool input { display: none; }
.gpt-composer select,
.custom-size input {
  width: auto;
  height: 38px;
  border: 1px solid #d9d9d9;
  border-radius: 999px;
  background: #fff;
  color: var(--gpt-text);
  padding: 0 12px;
}
.size-control { display: flex; align-items: center; gap: 8px; }
.custom-size {
  display: flex;
  align-items: center;
  gap: 5px;
  background: var(--gpt-soft);
  border-radius: 999px;
  padding: 3px;
}
.custom-size input { width: 72px; padding: 0 8px; text-align: center; }
.send-button {
  width: 42px;
  height: 42px;
  padding: 0;
  border-radius: 999px;
  background: #111;
  color: #fff;
  font-size: 22px;
  box-shadow: none;
}
.send-button:hover { background: #333; }
.attachment-preview {
  display: flex;
  align-items: center;
  gap: 10px;
  width: fit-content;
  max-width: 100%;
  margin: 0 0 8px 8px;
  background: var(--gpt-soft);
  border-radius: 18px;
  padding: 6px 8px 6px 6px;
}
.attachment-preview img { width: 48px; height: 48px; border-radius: 12px; object-fit: cover; }
.attachment-preview span { max-width: 280px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: #444; }
.attachment-preview button { width: 28px; height: 28px; padding: 0; background: #e9e9e9; color: #111; box-shadow: none; }
.composer-status { margin: 4px 10px 0; min-height: 19px; font-size: 13px; color: #c15a22; }
@keyframes messageIn { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: translateY(0); } }
@media (max-width: 900px) {
  .gpt-layout { display: block; }
  .gpt-sidebar { transform: translateX(-292px); box-shadow: 12px 0 40px rgba(0,0,0,0.16); }
  .gpt-sidebar:not(.collapsed) { transform: translateX(0); }
  .gpt-main { padding: 62px 14px 210px; }
  .gpt-topbar { left: 0; }
  .mobile-only { display: inline-grid; }
  .topbar-actions .toolbar-button { display: none; }
  .topbar-code { display: none; }
  .gpt-composer { left: 50%; width: min(calc(100vw - 18px), 900px); bottom: 10px; }
  .composer-row { align-items: flex-start; flex-direction: column; }
  .composer-right { width: 100%; justify-content: flex-end; }
  .starter-grid { grid-template-columns: 1fr; }
  .bubble { max-width: 92%; font-size: 16px; }
}

.generated-code-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin: 14px 0 8px;
  color: #5d685f;
}
.generated-code-head button {
  width: auto;
  padding: 0.55rem 0.9rem;
}
.code-output.empty {
  color: #9aa09b;
  background: #f6f1e8;
}
.generated-code-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 10px;
  align-items: center;
  padding: 8px 0;
  border-bottom: 1px solid rgba(255,255,255,0.16);
}
.generated-code-row:last-child { border-bottom: 0; }
.generated-code-row code {
  color: #d8ffe6;
  background: transparent;
  padding: 0;
  word-break: break-all;
}
.generated-code-row button {
  background: rgba(255,255,255,0.12);
  border: 1px solid rgba(255,255,255,0.22);
  color: #fff;
  padding: 0.45rem 0.8rem;
}

/* ImageEV2 complete workspace additions */
.chat-shell {
  --gpt-bg: #fffdf8;
  --gpt-sidebar: #f4f0e8;
  --gpt-border: #e4ded2;
  --gpt-soft: #f3efe7;
  --gpt-hover: #e9e1d4;
  --gpt-text: #17130f;
  --gpt-muted: #746b5e;
  --gpt-danger: #b42318;
  background: var(--gpt-bg);
}
.view-tabs {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 4px;
  margin: 4px 0 10px;
  padding: 4px;
  border: 1px solid var(--gpt-border);
  border-radius: 14px;
  background: #fffaf1;
}
.view-tabs button,
.mode-switch button,
.chip-row button,
.category-row button {
  background: transparent;
  color: var(--gpt-text);
  border: 0;
  box-shadow: none;
  border-radius: 10px;
  padding: 8px 10px;
}
.view-tabs button.active,
.mode-switch button.active,
.chip-row button.active,
.category-row button.active {
  background: #17130f;
  color: #fff;
}
.sidebar-import {
  color: var(--gpt-text);
  background: transparent;
  border: 0;
  border-radius: 10px;
  text-align: left;
  padding: 9px 10px;
  text-transform: none;
  letter-spacing: 0;
  cursor: pointer;
}
.sidebar-import:hover { background: var(--gpt-hover); }
.sidebar-import input { display: none; }
.topbar-title {
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  color: var(--gpt-muted);
  font-size: 14px;
  font-weight: 650;
}
.workspace-view {
  width: min(100%, 1040px);
  margin: 0 auto;
}
.gpt-thread { width: min(100%, 880px); }
.mode-switch {
  display: flex;
  gap: 4px;
  padding: 4px;
  background: var(--gpt-soft);
  border: 1px solid var(--gpt-border);
  border-radius: 999px;
}
.mode-switch button { border-radius: 999px; white-space: nowrap; }
.param-button {
  background: #fff;
  color: var(--gpt-text);
  border: 1px solid var(--gpt-border);
  box-shadow: none;
  gap: 8px;
}
.param-button span { color: var(--gpt-muted); font-size: 12px; }
.param-popover {
  position: absolute;
  left: 12px;
  bottom: 68px;
  width: min(520px, calc(100vw - 34px));
  background: #fffaf1;
  border: 1px solid var(--gpt-border);
  border-radius: 22px;
  box-shadow: 0 24px 80px rgba(37, 29, 19, 0.22);
  padding: 14px;
  z-index: 50;
}
.param-section strong { display: block; margin-bottom: 8px; }
.chip-row,
.category-row,
.tag-row,
.gallery-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}
.param-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
  margin: 12px 0;
}
.param-grid label {
  display: grid;
  gap: 6px;
  letter-spacing: 0;
  text-transform: none;
  color: var(--gpt-muted);
}
.param-grid select,
.param-grid input {
  width: 100%;
  height: 38px;
  border-radius: 12px;
}
.custom-toggle {
  display: flex;
  align-items: center;
  gap: 8px;
  letter-spacing: 0;
  text-transform: none;
  color: var(--gpt-text);
}
.custom-toggle input { width: auto; }
.param-note { margin: 10px 0 0; color: var(--gpt-muted); font-size: 13px; }
.assistant-images {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 12px;
}
.assistant-images.multi {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  width: min(100%, 760px);
}
.attachment-preview {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.attachment-chip {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--gpt-soft);
  border: 1px solid var(--gpt-border);
  border-radius: 16px;
  padding: 6px;
}
.attachment-chip img { width: 46px; height: 46px; object-fit: cover; border-radius: 11px; }
.attachment-chip span { max-width: 180px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.attachment-chip button { width: 28px; height: 28px; padding: 0; color: var(--gpt-text); background: #fff; }
.library-head {
  display: flex;
  justify-content: space-between;
  gap: 18px;
  align-items: end;
  margin: 32px 0 18px;
}
.library-head h2 {
  font-size: clamp(2rem, 4vw, 4.4rem);
  letter-spacing: -0.055em;
  margin: 0;
}
.library-head input {
  max-width: 360px;
  background: #fff;
}
.gallery-grid,
.inspiration-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
  gap: 16px;
  padding-bottom: 40px;
}
.gallery-card,
.inspiration-card {
  overflow: hidden;
  border: 1px solid var(--gpt-border);
  border-radius: 24px;
  background: #fffaf1;
  box-shadow: 0 18px 55px rgba(39, 30, 18, 0.08);
}
.gallery-card img {
  width: 100%;
  aspect-ratio: 1 / 1;
  object-fit: cover;
  display: block;
  background: var(--gpt-soft);
}
.gallery-card-body,
.inspiration-body { padding: 14px; }
.gallery-card-body p,
.inspiration-body p {
  color: var(--gpt-muted);
  line-height: 1.55;
  min-height: 3.1em;
}
.gallery-card-body small { color: var(--gpt-muted); }
.gallery-actions { margin-top: 12px; }
.gallery-actions button,
.gallery-actions a {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 34px;
  border-radius: 999px;
  padding: 0 12px;
  border: 1px solid var(--gpt-border);
  background: #fff;
  color: var(--gpt-text);
  text-decoration: none;
  box-shadow: none;
}
.inspiration-art {
  min-height: 122px;
  display: grid;
  place-items: center;
  color: #fff;
  font-size: 28px;
  letter-spacing: -0.04em;
  background:
    radial-gradient(circle at 18% 12%, rgba(255,255,255,0.32), transparent 30%),
    linear-gradient(135deg, #20382f, #bd7047 54%, #e0b15c);
}
.tag-row span {
  color: #795c42;
  background: #f0e2d0;
  border-radius: 999px;
  padding: 4px 9px;
  font-size: 12px;
}
@media (max-width: 900px) {
  .library-head { display: grid; align-items: start; }
  .library-head input { max-width: none; }
  .assistant-images.multi { grid-template-columns: 1fr; }
  .param-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .mode-switch { width: 100%; overflow-x: auto; }
  .topbar-title { display: none; }
}

.edit-target {
  margin: 0 0 8px;
}
.edit-target-inner {
  display: grid;
  grid-template-columns: 46px 1fr auto;
  align-items: center;
  gap: 10px;
  padding: 7px 8px;
  border: 1px solid rgba(15, 107, 82, 0.24);
  border-radius: 18px;
  background: #eff8f1;
  color: var(--gpt-text);
}
.edit-target-inner img {
  width: 46px;
  height: 46px;
  border-radius: 12px;
  object-fit: cover;
}
.edit-target-inner strong {
  display: block;
  font-size: 14px;
}
.edit-target-inner span {
  display: block;
  color: #587164;
  font-size: 12px;
  line-height: 1.35;
}
.edit-target-inner button {
  height: 32px;
  padding: 0 12px;
  background: #fff;
  color: var(--gpt-text);
  border: 1px solid rgba(15, 107, 82, 0.20);
  box-shadow: none;
}
.image-frame img[data-open-image-key],
.gallery-card img[data-open-image-key],
.user-attachments img[data-open-image-key] {
  cursor: zoom-in;
}
.user-attachments {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(92px, 140px));
  justify-content: end;
  gap: 8px;
  max-width: min(720px, 82%);
  margin: 0 0 8px auto;
}
.user-attachments img {
  width: 100%;
  aspect-ratio: 1 / 1;
  object-fit: cover;
  border-radius: 18px;
  border: 1px solid var(--gpt-border);
  background: var(--gpt-soft);
}
.user-attachments.multi {
  max-width: min(720px, 92%);
}
.image-placeholder {
  min-height: min(62vw, 420px);
  display: grid;
  place-items: center;
  overflow: hidden;
  background:
    radial-gradient(circle at 24% 18%, rgba(255,255,255,0.86), transparent 26%),
    linear-gradient(135deg, #f4eadb, #e5eee4 52%, #f8f3ea);
}
.image-placeholder::after { display: none; }
.placeholder-sheen {
  position: absolute;
  inset: -40%;
  background: linear-gradient(105deg, transparent 38%, rgba(255,255,255,0.78) 50%, transparent 62%);
  animation: placeholderSweep 1.35s ease-in-out infinite;
}
.placeholder-copy {
  position: relative;
  z-index: 1;
  display: grid;
  gap: 6px;
  text-align: center;
  color: #5f574d;
}
.placeholder-copy strong {
  color: var(--gpt-text);
  font-size: 16px;
}
.placeholder-copy span {
  max-width: 260px;
  font-size: 13px;
  line-height: 1.45;
}
.image-placeholder.failed {
  min-height: 220px;
  background: #fff2ec;
  border-color: rgba(180, 35, 24, 0.20);
}
.version-switcher {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  margin: 0 0 10px;
  padding: 5px;
  border: 1px solid var(--gpt-border);
  border-radius: 999px;
  background: #fffaf1;
}
.version-switcher button {
  min-width: 32px;
  height: 32px;
  padding: 0 10px;
  border-radius: 999px;
  background: transparent;
  color: var(--gpt-muted);
  border: 0;
  box-shadow: none;
}
.version-switcher button:hover:not(:disabled) {
  background: var(--gpt-hover);
  color: var(--gpt-text);
}
.version-switcher .version-pill.active {
  background: #17130f;
  color: #fff;
}
.image-lightbox {
  position: fixed;
  inset: 0;
  z-index: 90;
  display: grid;
  place-items: center;
  padding: 56px 24px 32px;
  background: rgba(13, 13, 13, 0.82);
  backdrop-filter: blur(12px);
}
.image-lightbox img {
  max-width: min(96vw, 1280px);
  max-height: 84vh;
  width: auto;
  height: auto;
  object-fit: contain;
  border-radius: 22px;
  box-shadow: 0 34px 120px rgba(0,0,0,0.48);
  background: #111;
}
.image-lightbox p {
  margin: 14px 0 0;
  max-width: min(90vw, 900px);
  color: rgba(255,255,255,0.82);
  text-align: center;
}
.lightbox-close {
  position: fixed;
  top: 18px;
  right: 20px;
  width: 42px;
  height: 42px;
  padding: 0;
  border-radius: 999px;
  background: rgba(255,255,255,0.14);
  color: #fff;
  border: 1px solid rgba(255,255,255,0.22);
  box-shadow: none;
  font-size: 28px;
  line-height: 1;
}
@keyframes placeholderSweep {
  from { transform: translateX(-35%) rotate(8deg); }
  to { transform: translateX(35%) rotate(8deg); }
}
@media (max-width: 900px) {
  .edit-target-inner { grid-template-columns: 42px 1fr; }
  .edit-target-inner button { grid-column: 1 / -1; width: 100%; }
  .image-lightbox { padding: 54px 12px 24px; }
  .image-lightbox img { max-height: 78vh; border-radius: 16px; }
}

/* Mobile-first interaction polish */
html,
body {
  max-width: 100%;
  overflow-x: hidden;
}

@media (max-width: 900px) {
  .chat-shell {
    background: #fffaf1;
  }

  .gpt-layout {
    min-height: 100dvh;
    overflow-x: hidden;
  }

  .gpt-layout.sidebar-open::before {
    content: "";
    position: fixed;
    inset: 0;
    z-index: 38;
    background: rgba(23, 19, 15, 0.28);
    backdrop-filter: blur(2px);
  }

  .gpt-sidebar {
    width: min(86vw, 320px);
    max-width: 320px;
    transform: translateX(-100%);
    box-shadow: 18px 0 70px rgba(37, 29, 19, 0.22);
  }

  .gpt-sidebar.collapsed {
    transform: translateX(-100%);
  }

  .gpt-sidebar:not(.collapsed) {
    transform: translateX(0);
  }

  .sidebar-head {
    margin-top: max(0px, env(safe-area-inset-top));
  }

  .gpt-main {
    padding: calc(58px + env(safe-area-inset-top)) 10px calc(172px + env(safe-area-inset-bottom));
  }

  .gpt-topbar {
    left: 0;
    height: calc(56px + env(safe-area-inset-top));
    padding: env(safe-area-inset-top) 10px 0;
    gap: 8px;
  }

  .mobile-only,
  .gpt-layout.sidebar-collapsed #open-sidebar {
    display: inline-grid;
    flex: 0 0 auto;
  }

  .model-menu {
    min-width: 0;
    margin-right: auto;
  }

  .model-button {
    max-width: 176px;
    overflow: hidden;
    white-space: nowrap;
    text-overflow: ellipsis;
    padding: 9px 10px;
  }

  .popover {
    position: fixed;
    top: calc(56px + env(safe-area-inset-top));
    left: 10px;
    right: 10px;
    width: auto;
  }

  .workspace-view,
  .gpt-thread {
    width: 100%;
  }

  .gpt-empty {
    min-height: calc(100dvh - 260px);
    padding: 38px 4px 20px;
  }

  .gpt-empty h2 {
    font-size: clamp(1.7rem, 9vw, 2.8rem);
    letter-spacing: -0.045em;
  }

  .starter-grid {
    grid-template-columns: 1fr;
    gap: 8px;
    margin-top: 18px;
  }

  .starter-grid button {
    min-height: 52px;
    border-radius: 14px;
    padding: 12px 14px;
  }

  .message {
    margin: 20px 0;
  }

  .message.assistant {
    width: 100%;
  }

  .bubble {
    max-width: 94%;
    border-radius: 22px;
    padding: 12px 16px;
    font-size: 16px;
  }

  .message.user .message-actions {
    opacity: 1;
  }

  .user-attachments {
    grid-template-columns: repeat(auto-fit, minmax(78px, 112px));
    max-width: 94%;
    gap: 7px;
    margin-bottom: 7px;
  }

  .user-attachments img {
    border-radius: 15px;
  }

  .assistant-meta {
    width: 100%;
    flex-wrap: wrap;
    gap: 6px 10px;
    font-size: 12px;
    padding: 0 2px;
  }

  .assistant-images,
  .assistant-images.multi {
    width: 100%;
    grid-template-columns: 1fr;
  }

  .image-frame {
    width: 100%;
    border-radius: 20px;
  }

  .image-frame::after {
    height: 70px;
  }

  .image-edit,
  .image-download {
    bottom: 10px;
    padding: 8px 11px;
    font-size: 13px;
  }

  .image-edit {
    left: 10px;
  }

  .image-download {
    right: 10px;
  }

  .feedback-row,
  .version-switcher {
    max-width: 100%;
    overflow-x: auto;
    scrollbar-width: none;
  }

  .feedback-row::-webkit-scrollbar,
  .version-switcher::-webkit-scrollbar {
    display: none;
  }

  .feedback-row button {
    flex: 0 0 auto;
  }

  .gpt-composer,
  .gpt-layout.sidebar-collapsed .gpt-composer {
    left: 50%;
    bottom: max(8px, env(safe-area-inset-bottom));
    width: min(calc(100vw - 14px), 900px);
    border-radius: 24px;
    padding: 8px 9px 7px;
  }

  .gpt-composer textarea {
    min-height: 42px;
    padding: 10px 10px;
    font-size: 16px;
    line-height: 1.45;
  }

  .composer-row {
    flex-direction: row;
    align-items: center;
    gap: 8px;
  }

  .composer-left {
    flex: 1 1 auto;
    min-width: 0;
    flex-wrap: nowrap;
    overflow-x: auto;
    scrollbar-width: none;
  }

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

  .composer-right {
    width: auto;
    flex: 0 0 auto;
    justify-content: flex-end;
  }

  #model-select {
    display: none;
  }

  .round-tool {
    flex: 0 0 38px;
  }

  .param-button {
    flex: 0 0 auto;
    max-width: calc(100vw - 116px);
    padding: 0 12px;
    min-height: 38px;
    white-space: nowrap;
  }

  .param-button span {
    display: inline-block;
    max-width: 150px;
    overflow: hidden;
    text-overflow: ellipsis;
    vertical-align: bottom;
  }

  .send-button {
    width: 42px;
    height: 42px;
    flex: 0 0 42px;
  }

  .param-popover {
    position: fixed;
    left: 9px;
    right: 9px;
    bottom: calc(112px + env(safe-area-inset-bottom));
    width: auto;
    max-height: calc(100dvh - 176px);
    overflow-y: auto;
    border-radius: 22px;
    padding: 12px;
  }

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

  .custom-size {
    width: fit-content;
    max-width: 100%;
  }

  .attachment-preview {
    max-width: 100%;
    margin-left: 0;
  }

  .attachment-chip {
    max-width: 100%;
  }

  .attachment-chip span {
    max-width: min(220px, calc(100vw - 128px));
  }

  .edit-target {
    margin-bottom: 6px;
  }

  .edit-target-inner {
    grid-template-columns: 42px 1fr auto;
    gap: 8px;
    border-radius: 16px;
  }

  .edit-target-inner button {
    grid-column: auto;
    width: auto;
    padding: 0 10px;
  }

  .library-head {
    margin: 18px 0 14px;
  }

  .library-head h2 {
    font-size: clamp(1.8rem, 10vw, 3rem);
  }

  .gallery-grid,
  .inspiration-grid {
    grid-template-columns: 1fr;
    gap: 12px;
  }

  .image-lightbox {
    padding: calc(52px + env(safe-area-inset-top)) 8px calc(20px + env(safe-area-inset-bottom));
  }

  .image-lightbox img {
    max-width: 100%;
    max-height: 78dvh;
    border-radius: 16px;
  }
}

@media (max-width: 420px) {
  .param-grid {
    grid-template-columns: 1fr;
  }

  .param-button span {
    max-width: 112px;
  }

  .edit-target-inner {
    grid-template-columns: 38px 1fr;
  }

  .edit-target-inner button {
    grid-column: 1 / -1;
    width: 100%;
  }
}
