.gpimg-shell,
.gpimg-shell * {
  box-sizing: border-box;
}

.gpimg-shell {
  --bg: #f7f7f8;
  --panel: #fff;
  --soft: #f4f5f7;
  --text: #191b1f;
  --muted: #8b9099;
  --line: rgba(20, 24, 32, .1);
  --blue: #1769ff;
  --dark: #23272e;
  width: min(100%, 1480px);
  margin: 0 auto;
  padding: 12px clamp(10px, 2.6vw, 38px) 58px;
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
  letter-spacing: 0;
}

.gpimg-shell button,
.gpimg-shell input,
.gpimg-shell select,
.gpimg-shell textarea {
  letter-spacing: 0;
}

.gpimg-app-page {
  min-height: calc(100vh - 90px);
}

.gpimg-app-hero {
  text-align: center;
  margin: 0 auto 12px;
}

.gpimg-app-hero h1 {
  margin: 0 0 8px;
  font-size: clamp(28px, 2.8vw, 40px);
  line-height: 1.1;
  font-weight: 500;
}

.gpimg-app-hero p {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  margin: 0;
  color: #2c3036;
  font-size: clamp(14px, 1.35vw, 18px);
}

.gpimg-badge-row {
  display: inline-flex;
  gap: 4px;
}

.gpimg-badge-row i {
  width: 19px;
  height: 19px;
  border-radius: 50%;
  background: linear-gradient(135deg, #7a8cff, #64d5ff);
  border: 2px solid #eaf2ff;
}

.gpimg-badge-row i:nth-child(2) { background: linear-gradient(135deg, #5dd6ff, #fff); }
.gpimg-badge-row i:nth-child(3) { background: linear-gradient(135deg, #ff9f6e, #fff); }
.gpimg-badge-row i:nth-child(4) { background: linear-gradient(135deg, #82a4ff, #fff); }
.gpimg-badge-row i:nth-child(5) { background: linear-gradient(135deg, #6d7cff, #eef); }

.gpimg-account {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  width: min(100%, 1240px);
  margin: 0 auto 10px;
}

.gpimg-account div {
  padding: 9px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255,255,255,.78);
}

.gpimg-account span,
.gpimg-account strong {
  display: block;
  line-height: 1.35;
}

.gpimg-account span {
  color: var(--muted);
  font-size: 11px;
}

.gpimg-account strong {
  margin-top: 4px;
  font-size: 13px;
}

.gpimg-account [data-gpimg-login-link] {
  cursor: pointer;
  text-decoration: underline;
  text-underline-offset: 3px;
}

.gpimg-creator-card {
  position: relative;
  display: flex;
  flex-direction: column;
  width: min(100%, 1240px);
  min-height: 316px;
  margin: 0 auto 28px;
  padding: 18px 20px 17px;
  border: 1px solid rgba(12, 18, 28, .08);
  border-radius: 10px;
  background: var(--panel);
  box-shadow: 0 18px 42px rgba(31, 35, 42, .1);
}

.gpimg-prompt-main {
  position: relative;
  display: block;
  flex: 1 1 auto;
  min-height: 234px;
}

.gpimg-prompt-main textarea {
  display: block;
  width: 100%;
  min-height: 230px;
  border: 0 !important;
  outline: 0;
  resize: vertical;
  background: transparent !important;
  color: var(--text);
  font: inherit;
  font-size: 16px;
  font-weight: 400;
  line-height: 1.65;
  box-shadow: none !important;
}

.gpimg-prompt-main textarea::placeholder {
  color: #b8bec8;
  font-weight: 400;
}

.gpimg-tool-row {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 24px 0 12px;
}

.gpimg-mini-upload {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  width: auto;
  height: 34px;
  min-width: 84px;
  padding: 0 8px;
  border: .5px solid rgba(28, 32, 38, .18);
  border-radius: 8px;
  cursor: pointer;
  overflow: hidden;
  background: rgba(255,255,255,.82);
  white-space: nowrap;
}

.gpimg-mini-upload input {
  position: absolute;
  inset: 0;
  opacity: 0;
  cursor: pointer;
}

.gpimg-mini-upload strong {
  font-size: 13px;
  line-height: 1;
}

.gpimg-mini-upload small {
  position: absolute;
  left: 50%;
  bottom: calc(100% + 8px);
  transform: translateX(-50%);
  display: none;
  padding: 5px 8px;
  border-radius: 7px;
  background: rgba(20,24,32,.86);
  color: #fff;
  font-size: 12px;
  line-height: 1;
  white-space: nowrap;
  pointer-events: none;
  z-index: 30;
}

.gpimg-mini-upload:hover small {
  display: block;
}

.gpimg-mini-upload.has-file {
  border-color: var(--blue);
  background: #eef4ff;
}

.gpimg-ref-preview {
  position: absolute;
  left: 0;
  bottom: calc(100% + 6px);
  display: none;
  align-items: center;
  gap: 6px;
  min-width: 0;
  width: fit-content;
  max-width: 100%;
  overflow: hidden;
  padding: 7px;
  margin: 0;
  border: 1px solid rgba(28,32,38,.08);
  border-radius: 10px;
  background: rgba(255,255,255,.92);
  box-shadow: 0 10px 28px rgba(20,24,32,.08);
  backdrop-filter: blur(8px);
  z-index: 24;
  pointer-events: auto;
}

.gpimg-ref-preview::before {
  content: attr(data-empty-hint);
  color: var(--muted);
  font-size: 12px;
  white-space: nowrap;
}

.gpimg-ref-preview.has-items::before {
  display: none;
}

.gpimg-ref-preview.has-items {
  display: inline-flex;
}

.gpimg-bottom-controls {
  margin-top: auto;
  position: relative;
  display: grid;
  gap: 0;
}

.gpimg-ref-thumb {
  flex: 0 0 auto;
  width: 30px;
  height: 30px;
  border: 1px solid rgba(28,32,38,.16);
  border-radius: 8px;
  padding: 0;
  overflow: hidden;
  background: #fff;
  cursor: zoom-in;
}

.gpimg-ref-more {
  flex: 0 0 auto;
  display: inline-grid;
  place-items: center;
  min-width: 30px;
  height: 30px;
  border-radius: 8px;
  background: #f0f2f5;
  color: #59606b;
  font-size: 12px;
  font-weight: 700;
}

.gpimg-ref-clear {
  flex: 0 0 auto;
  height: 30px;
  border: 0;
  border-radius: 8px;
  padding: 0 10px;
  background: #fff1f1;
  color: #d04444;
  cursor: pointer;
  font-size: 12px;
  font-weight: 700;
}

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

.gpimg-action-row {
  position: relative;
  z-index: 50;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  margin-top: 0;
  display: flex;
  min-width: 0;
}

.gpimg-action-tools {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  justify-content: flex-start;
  gap: 6px;
  min-width: 0;
  max-width: calc(100% - 96px);
}

.gpimg-select-pill,
.gpimg-select-button {
  position: relative;
  display: inline-flex !important;
  align-items: center;
  gap: 6px;
  min-height: 34px;
  border: .5px solid rgba(28, 32, 38, .18);
  border-radius: 8px;
  background: rgba(255,255,255,.82);
  padding: 0 10px;
  color: #1d2229;
  font-size: 13px;
  font-weight: 600;
  white-space: nowrap;
  transition: background .16s ease, border-color .16s ease, box-shadow .16s ease;
}

.gpimg-select-pill:hover,
.gpimg-select-button:hover,
.gpimg-mini-upload:hover {
  background: #f8f9fb;
  border-color: rgba(28, 32, 38, .34);
}

.gpimg-select-pill span {
  color: #1d2229;
  font-weight: 600;
}

.gpimg-select-pill select {
  width: 100%;
  min-width: 0;
  border: 0 !important;
  outline: 0;
  background: transparent !important;
  font: inherit;
  font-weight: 600;
  box-shadow: none !important;
}

.gpimg-popover-control {
  position: relative;
  width: max-content;
}

.gpimg-popover-control.is-open {
  z-index: 120;
}

.gpimg-select-button {
  cursor: pointer;
}

.gpimg-popover {
  position: absolute;
  left: 0;
  bottom: calc(100% + 10px);
  z-index: 120;
  width: min(520px, calc(100vw - 36px));
  max-width: calc(100vw - 36px);
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  box-shadow: 0 18px 44px rgba(30, 35, 45, .16);
  display: none;
}

.gpimg-action-row [data-gpimg-config] .gpimg-popover {
  left: 0;
  right: auto;
  transform: translate(var(--gpimg-pop-shift, 0px), var(--gpimg-pop-y-shift, 0px));
  width: var(--gpimg-pop-width, min(530px, calc(100vw - 36px)));
  max-height: min(76vh, var(--gpimg-pop-max-height, 680px));
  overflow: auto;
}

.gpimg-action-row [data-gpimg-config] .gpimg-select-button {
  min-width: 104px;
  width: auto;
  justify-content: center;
}

.gpimg-popover-control.is-open .gpimg-popover {
  display: block;
}

.gpimg-popover h3 {
  margin: 18px 0 10px;
  color: #252a31;
  font-size: 15px;
  font-weight: 600;
  line-height: 1.25;
}

.gpimg-popover h3:first-child {
  margin-top: 0;
}

.gpimg-ratio-grid {
  display: grid;
  grid-template-columns: repeat(6, minmax(58px, 1fr));
  gap: 6px;
  background: #f4f4f5;
  border-radius: 8px;
  padding: 10px;
}

.gpimg-ratio-grid button,
.gpimg-segment button {
  min-height: 42px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  cursor: pointer;
  font: inherit;
  color: #555b64;
}

.gpimg-ratio-grid button {
  display: grid;
  place-items: center;
  gap: 6px;
  min-height: 74px;
  padding: 7px 5px;
}

.gpimg-ratio-grid button > i {
  display: block;
  width: var(--ratio-w, 14px);
  height: var(--ratio-h, 18px);
  border: 1.2px solid #30343a;
  border-radius: 3px;
  background: #fff;
}

.gpimg-ratio-grid button > span {
  line-height: 1.1;
}

.gpimg-ratio-grid [data-ratio-shape="auto"] { --ratio-w: 12px; --ratio-h: 18px; }
.gpimg-ratio-grid [data-ratio-shape="1:1"] { --ratio-w: 17px; --ratio-h: 17px; }
.gpimg-ratio-grid [data-ratio-shape="1:2"],
.gpimg-ratio-grid [data-ratio-shape="9:21"] { --ratio-w: 12px; --ratio-h: 24px; }
.gpimg-ratio-grid [data-ratio-shape="2:1"],
.gpimg-ratio-grid [data-ratio-shape="21:9"] { --ratio-w: 28px; --ratio-h: 12px; }
.gpimg-ratio-grid [data-ratio-shape="9:16"],
.gpimg-ratio-grid [data-ratio-shape="3:4"],
.gpimg-ratio-grid [data-ratio-shape="2:3"],
.gpimg-ratio-grid [data-ratio-shape="4:5"] { --ratio-w: 13px; --ratio-h: 22px; }
.gpimg-ratio-grid [data-ratio-shape="16:9"],
.gpimg-ratio-grid [data-ratio-shape="4:3"],
.gpimg-ratio-grid [data-ratio-shape="3:2"],
.gpimg-ratio-grid [data-ratio-shape="5:4"] { --ratio-w: 24px; --ratio-h: 13px; }

.gpimg-ratio-grid button.is-active,
.gpimg-segment button.is-active,
.gpimg-ratio-grid button:hover,
.gpimg-segment button:hover {
  background: #fff;
  color: #15191f;
}

.gpimg-config-pop {
  width: min(530px, calc(100vw - 36px));
}

.gpimg-segment {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  padding: 8px;
  background: #f4f4f5;
  border-radius: 8px;
  margin-bottom: 18px;
}

.gpimg-quantity-segment {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.gpimg-submit {
  margin-left: auto;
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 32px;
  border: 0;
  border-radius: 999px;
  padding: 0 4px 0 10px;
  background: var(--dark);
  color: #fff;
  cursor: pointer;
  font: inherit;
  font-size: 14px;
  font-weight: 700;
  justify-self: end;
}

.gpimg-submit span {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  min-width: 32px;
  justify-content: center;
}

.gpimg-submit span i {
  color: #ff8a1f;
  font-style: normal;
  font-size: 13px;
}

.gpimg-submit b {
  display: grid;
  place-items: center;
  width: 23px;
  height: 23px;
  border-radius: 50%;
  background: rgba(255,255,255,.16);
}

.gpimg-submit svg {
  width: 15px;
  height: 15px;
  display: block;
}

.gpimg-ref-toast {
  position: absolute;
  left: 22px;
  bottom: 104px;
  z-index: 35;
  max-width: min(420px, calc(100% - 44px));
  padding: 9px 12px;
  border: 1px solid rgba(255, 168, 0, .35);
  border-radius: 8px;
  background: rgba(255, 250, 235, .98);
  color: #8a5a00;
  box-shadow: 0 12px 28px rgba(60, 42, 0, .12);
  font-size: 13px;
  line-height: 1.45;
  opacity: 1;
  transform: translateY(0);
  transition: opacity .22s ease, transform .22s ease;
}

.gpimg-ref-toast.is-hiding {
  opacity: 0;
  transform: translateY(6px);
}

.gpimg-tool-icon {
  position: relative;
  flex: 0 0 auto;
  width: 14px;
  height: 14px;
  color: #333943;
}

.gpimg-icon-plus::before,
.gpimg-icon-plus::after {
  content: "";
  position: absolute;
  background: currentColor;
  border-radius: 999px;
}

.gpimg-icon-plus::before {
  left: 2px;
  right: 2px;
  top: 6px;
  height: 2px;
}

.gpimg-icon-plus::after {
  top: 2px;
  bottom: 2px;
  left: 6px;
  width: 2px;
}

.gpimg-icon-config {
  width: 16px;
  height: 16px;
}

.gpimg-icon-config::before {
  content: "";
  position: absolute;
  left: 2px;
  right: 2px;
  top: 4px;
  height: 2px;
  border-radius: 999px;
  background: currentColor;
  box-shadow: 0 4px 0 currentColor, 0 8px 0 currentColor;
}

.gpimg-icon-config::after {
  content: "";
  position: absolute;
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: currentColor;
  left: 4px;
  top: 3px;
  box-shadow: 5px 4px 0 currentColor, -1px 8px 0 currentColor;
}

.gpimg-submit:disabled {
  opacity: .7;
  cursor: wait;
}

.gpimg-result {
  width: min(100%, 1240px);
  min-height: 0;
  margin: 0 auto 18px;
  display: grid;
  gap: 12px;
}

.gpimg-result-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 34px;
}

.gpimg-result-head h2 {
  margin: 0;
  color: var(--text);
  font-size: 20px;
  font-weight: 700;
  line-height: 1.25;
}

.gpimg-result-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 12px;
  width: 100%;
}

.gpimg-result-grid > .gpimg-loading,
.gpimg-result-grid > .gpimg-notice {
  grid-column: 1 / -1;
}

.gpimg-result-grid .gpimg-output:nth-of-type(n+6) {
  display: none;
}

.gpimg-same {
  width: min(100%, 1240px);
  margin: 0 auto;
}

body:has(.gpimg-app-page) .float-right,
body:has(.gpimg-app-page) .fixed-right,
body:has(.gpimg-app-page) .right-bar,
body:has(.gpimg-app-page) .footer-tabbar,
body:has(.gpimg-app-page) .tabbar,
body:has(.gpimg-app-page) .mobile-tabbar,
body:has(.gpimg-app-page) .zib-footer-tabbar,
body:has(.gpimg-app-page) .footer-tab,
body:has(.gpimg-app-page) .mobile-footer-menu,
body:has(.gpimg-gallery-page) .float-right,
body:has(.gpimg-gallery-page) .fixed-right,
body:has(.gpimg-gallery-page) .right-bar {
  display: none !important;
}

.gpimg-empty,
.gpimg-loading,
.gpimg-notice {
  width: 100%;
  min-height: 0;
  padding: 16px;
  display: grid;
  place-items: center;
  gap: 8px;
  color: var(--muted);
  text-align: center;
}

.gpimg-loading span {
  width: 44px;
  height: 44px;
  border: 6px solid #e7efff;
  border-top-color: #5caeff;
  border-radius: 50%;
  animation: gpimg-spin .8s linear infinite;
}

.gpimg-output {
  position: relative;
  display: flex;
  flex-direction: column;
  min-width: 0;
  margin: 0;
  padding: 8px;
  border: 1px solid rgba(20,24,32,.1);
  border-radius: 10px;
  background: rgba(255,255,255,.72);
  overflow: hidden;
}

.gpimg-output-preview {
  position: relative;
  display: block;
  width: 100%;
  aspect-ratio: 1 / 1;
  overflow: hidden;
  border-radius: 8px;
  background: transparent;
}

.gpimg-output-preview > button {
  display: block;
  width: 100%;
  height: 100%;
  border: 0;
  padding: 0;
  background: transparent;
  cursor: zoom-in;
}

.gpimg-output img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.gpimg-download-icon {
  position: absolute;
  right: 8px;
  bottom: 8px;
  top: auto;
  z-index: 2;
  display: inline-grid;
  place-items: center;
  width: 32px;
  height: 32px;
  border: 1px solid rgba(255,255,255,.72);
  border-radius: 999px;
  background: rgba(20,24,32,.82);
  color: #fff;
  box-shadow: 0 8px 18px rgba(20,24,32,.18);
  backdrop-filter: blur(8px);
}

.gpimg-download-icon svg {
  width: 17px;
  height: 17px;
}

.gpimg-card-menu {
  position: absolute;
  top: 8px;
  right: 8px;
  z-index: 3;
}

.gpimg-card-more {
  display: inline-grid;
  place-items: center;
  width: 32px;
  height: 32px;
  border: 1px solid rgba(255,255,255,.72);
  border-radius: 999px;
  background: rgba(20,24,32,.82);
  color: #fff;
  cursor: pointer;
  box-shadow: 0 8px 18px rgba(20,24,32,.18);
  backdrop-filter: blur(8px);
}

.gpimg-card-more svg {
  width: 16px;
  height: 16px;
  display: block;
}

.gpimg-card-dropdown {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  display: none;
  min-width: 96px;
  padding: 6px;
  border: 1px solid rgba(20,24,32,.12);
  border-radius: 8px;
  background: rgba(255,255,255,.98);
  box-shadow: 0 12px 28px rgba(20,24,32,.16);
}

.gpimg-card-menu.is-open .gpimg-card-dropdown {
  display: block;
}

.gpimg-card-dropdown button {
  width: 100%;
  min-height: 32px;
  border: 0;
  border-radius: 6px;
  background: #fff5f5;
  color: #c03737;
  cursor: pointer;
  font: inherit;
  font-weight: 700;
}

.gpimg-settings-tabs {
  margin-top: 18px;
}

.gpimg-settings-panel {
  margin-top: 18px;
}

.gpimg-settings-panel > h2 {
  margin-bottom: 8px;
}

.gpimg-output figcaption {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 7px;
  padding-top: 8px;
}

.gpimg-output figcaption span {
  flex: 1 1 100%;
  color: #4d5561;
  font-size: 13px;
  line-height: 1.55;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.gpimg-works-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 32px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0 12px;
  background: rgba(255,255,255,.82);
  color: #1a1f27;
  text-decoration: none;
  font-weight: 700;
  font-size: 13px;
}

.gpimg-output-actions {
  display: flex;
  gap: 6px;
  width: 100%;
}

.gpimg-output figcaption button,
.gpimg-use-link,
.gpimg-prompt-card button[data-gpimg-use],
.gpimg-prompt-card button[data-gpimg-copy],
.gpimg-card-actions button,
.gpimg-card-actions a {
  display: inline-flex;
  justify-content: center;
  align-items: center;
  min-height: 42px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0 14px;
  background: #fff;
  color: #171b21;
  cursor: pointer;
  text-decoration: none;
  font: inherit;
  font-weight: 700;
}

.gpimg-output-actions button {
  flex: 1 1 0;
  min-height: 32px;
  padding: 0 8px;
  font-size: 12px;
}

.gpimg-card-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.gpimg-card-actions button[data-gpimg-delete-work] {
  background: #fff5f5;
  color: #c03737;
  border-color: rgba(192, 55, 55, .18);
}

.gpimg-load-more-wrap {
  display: flex;
  justify-content: center;
  margin: 22px 0 0;
}

.gpimg-load-more {
  min-height: 40px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0 22px;
  background: #fff;
  color: #171b21;
  cursor: pointer;
  font: inherit;
  font-weight: 700;
}

.gpimg-load-more:disabled {
  cursor: wait;
  opacity: .72;
}

.gpimg-section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin: 0 0 18px;
}

.gpimg-section-head h1,
.gpimg-section-head h2 {
  margin: 0;
  font-size: clamp(24px, 2.2vw, 34px);
}

.gpimg-section-head p {
  margin: 8px 0 0;
  color: var(--muted);
}

.gpimg-section-head a {
  color: #111;
  text-decoration: none;
  font-weight: 700;
}

.gpimg-card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(210px, 1fr));
  gap: 16px;
}

.gpimg-prompt-card {
  display: grid;
  gap: 10px;
  min-width: 0;
  padding: 8px;
  border: 1px solid rgba(20,24,32,.12);
  border-radius: 10px;
  background: rgba(255,255,255,.72);
}

.gpimg-image-wrap {
  position: relative;
  display: block;
  width: 100%;
  aspect-ratio: 1 / 1;
  overflow: hidden;
  border: 0;
  border-radius: 8px;
  padding: 0;
  background: #eef0f4;
  cursor: zoom-in;
}

.gpimg-work-preview {
  position: relative;
}

.gpimg-work-card .gpimg-download-icon {
  right: 8px;
  bottom: 8px;
}

.gpimg-image-wrap img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.gpimg-image-wrap span {
  position: absolute;
  top: 8px;
  right: 8px;
  max-width: calc(100% - 16px);
  padding: 4px 7px;
  border-radius: 8px;
  background: rgba(0,0,0,.62);
  color: #fff;
  font-size: 12px;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.gpimg-prompt-card strong {
  font-size: 14px;
  line-height: 1.35;
}

.gpimg-prompt-card small,
.gpimg-prompt-card details {
  color: var(--muted);
  font-size: 12px;
}

.gpimg-tabs {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  margin-bottom: 20px;
}

.gpimg-tabs button {
  flex: 0 0 auto;
  min-height: 40px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0 14px;
  background: #fff;
  cursor: pointer;
}

.gpimg-tabs button.is-active {
  background: #111827;
  color: #fff;
}

.gpimg-detail-modal {
  position: fixed;
  inset: 0;
  z-index: 999999;
  display: grid;
  place-items: center;
  padding: 28px;
  background: rgba(0,0,0,.72);
}

.gpimg-image-preview-modal {
  position: fixed;
  inset: 0;
  z-index: 999999;
  display: grid;
  place-items: center;
  padding: 28px;
  background: rgba(0,0,0,.76);
}

.gpimg-image-preview-modal img {
  max-width: min(94vw, 980px);
  max-height: 88vh;
  border-radius: 8px;
  background: #fff;
}

.gpimg-detail-panel {
  position: relative;
  display: grid;
  grid-template-columns: minmax(260px, 48%) minmax(260px, 1fr);
  gap: 22px;
  width: min(1040px, 96vw);
  max-height: 90vh;
  overflow: auto;
  padding: 22px;
  border-radius: 8px;
  background: #fff;
}

.gpimg-detail-media img {
  display: block;
  width: 100%;
  max-height: 76vh;
  object-fit: contain;
  border-radius: 8px;
}

.gpimg-detail-close {
  position: fixed;
  top: max(14px, env(safe-area-inset-top));
  right: max(14px, env(safe-area-inset-right));
  width: 42px;
  height: 42px;
  border: 0;
  border-radius: 50%;
  background: #f1f2f4;
  color: #111;
  font-size: 30px;
  cursor: pointer;
}

.gpimg-detail-info small {
  color: var(--muted);
}

.gpimg-detail-info h2 {
  margin: 10px 48px 14px 0;
  font-size: 24px;
  line-height: 1.3;
}

.gpimg-detail-info textarea {
  width: 100%;
  min-height: 330px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  resize: vertical;
  color: #30343a;
  background: #f7f8fa;
  line-height: 1.7;
}

.gpimg-detail-actions {
  display: flex;
  gap: 10px;
  margin-top: 12px;
}

.gpimg-detail-actions button {
  min-height: 42px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0 18px;
  background: #fff;
  cursor: pointer;
  font-weight: 700;
}

.gpimg-detail-actions button:first-child {
  background: #111827;
  color: #fff;
}

body.dark-theme .gpimg-shell,
body.dark .gpimg-shell,
body.theme-dark .gpimg-shell,
body.night .gpimg-shell,
html.dark .gpimg-shell,
[data-theme="dark"] .gpimg-shell,
[data-bs-theme="dark"] .gpimg-shell {
  --bg: #101317;
  --panel: #171b21;
  --soft: #20252c;
  --text: #eef2f7;
  --muted: #9aa4b2;
  --line: rgba(235, 241, 248, .14);
  --dark: #eef2f7;
  color: var(--text);
}

body.dark-theme .gpimg-app-hero p,
body.dark .gpimg-app-hero p,
body.theme-dark .gpimg-app-hero p,
body.night .gpimg-app-hero p,
html.dark .gpimg-app-hero p,
[data-theme="dark"] .gpimg-app-hero p,
[data-bs-theme="dark"] .gpimg-app-hero p {
  color: #d8dee8;
}

body.dark-theme .gpimg-account div,
body.dark-theme .gpimg-account-card,
body.dark-theme .gpimg-creator-card,
body.dark-theme .gpimg-mini-upload,
body.dark-theme .gpimg-select-pill,
body.dark-theme .gpimg-select-button,
body.dark-theme .gpimg-popover,
body.dark-theme .gpimg-ref-preview,
body.dark-theme .gpimg-output,
body.dark-theme .gpimg-prompt-card,
body.dark-theme .gpimg-detail-panel,
body.dark .gpimg-account div,
body.dark .gpimg-account-card,
body.dark .gpimg-creator-card,
body.dark .gpimg-mini-upload,
body.dark .gpimg-select-pill,
body.dark .gpimg-select-button,
body.dark .gpimg-popover,
body.dark .gpimg-ref-preview,
body.dark .gpimg-output,
body.dark .gpimg-prompt-card,
body.dark .gpimg-detail-panel,
body.theme-dark .gpimg-account div,
body.theme-dark .gpimg-account-card,
body.theme-dark .gpimg-creator-card,
body.theme-dark .gpimg-mini-upload,
body.theme-dark .gpimg-select-pill,
body.theme-dark .gpimg-select-button,
body.theme-dark .gpimg-popover,
body.theme-dark .gpimg-ref-preview,
body.theme-dark .gpimg-output,
body.theme-dark .gpimg-prompt-card,
body.theme-dark .gpimg-detail-panel,
body.night .gpimg-account div,
body.night .gpimg-account-card,
body.night .gpimg-creator-card,
body.night .gpimg-mini-upload,
body.night .gpimg-select-pill,
body.night .gpimg-select-button,
body.night .gpimg-popover,
body.night .gpimg-ref-preview,
body.night .gpimg-output,
body.night .gpimg-prompt-card,
body.night .gpimg-detail-panel,
html.dark .gpimg-account div,
html.dark .gpimg-account-card,
html.dark .gpimg-creator-card,
html.dark .gpimg-mini-upload,
html.dark .gpimg-select-pill,
html.dark .gpimg-select-button,
html.dark .gpimg-popover,
html.dark .gpimg-ref-preview,
html.dark .gpimg-output,
html.dark .gpimg-prompt-card,
html.dark .gpimg-detail-panel,
[data-theme="dark"] .gpimg-account div,
[data-theme="dark"] .gpimg-account-card,
[data-theme="dark"] .gpimg-creator-card,
[data-theme="dark"] .gpimg-mini-upload,
[data-theme="dark"] .gpimg-select-pill,
[data-theme="dark"] .gpimg-select-button,
[data-theme="dark"] .gpimg-popover,
[data-theme="dark"] .gpimg-ref-preview,
[data-theme="dark"] .gpimg-output,
[data-theme="dark"] .gpimg-prompt-card,
[data-theme="dark"] .gpimg-detail-panel,
[data-bs-theme="dark"] .gpimg-account div,
[data-bs-theme="dark"] .gpimg-account-card,
[data-bs-theme="dark"] .gpimg-creator-card,
[data-bs-theme="dark"] .gpimg-mini-upload,
[data-bs-theme="dark"] .gpimg-select-pill,
[data-bs-theme="dark"] .gpimg-select-button,
[data-bs-theme="dark"] .gpimg-popover,
[data-bs-theme="dark"] .gpimg-ref-preview,
[data-bs-theme="dark"] .gpimg-output,
[data-bs-theme="dark"] .gpimg-prompt-card,
[data-bs-theme="dark"] .gpimg-detail-panel {
  background: rgba(23, 27, 33, .94);
  border-color: var(--line);
  color: var(--text);
}

body.dark-theme .gpimg-prompt-main textarea,
body.dark-theme .gpimg-select-pill select,
body.dark .gpimg-prompt-main textarea,
body.dark .gpimg-select-pill select,
body.theme-dark .gpimg-prompt-main textarea,
body.theme-dark .gpimg-select-pill select,
body.night .gpimg-prompt-main textarea,
body.night .gpimg-select-pill select,
html.dark .gpimg-prompt-main textarea,
html.dark .gpimg-select-pill select,
[data-theme="dark"] .gpimg-prompt-main textarea,
[data-theme="dark"] .gpimg-select-pill select,
[data-bs-theme="dark"] .gpimg-prompt-main textarea,
[data-bs-theme="dark"] .gpimg-select-pill select {
  color: var(--text);
}

body.dark-theme .gpimg-ratio-grid,
body.dark-theme .gpimg-segment,
body.dark-theme .gpimg-ref-more,
body.dark-theme .gpimg-detail-info textarea,
body.dark .gpimg-ratio-grid,
body.dark .gpimg-segment,
body.dark .gpimg-ref-more,
body.dark .gpimg-detail-info textarea,
body.theme-dark .gpimg-ratio-grid,
body.theme-dark .gpimg-segment,
body.theme-dark .gpimg-ref-more,
body.theme-dark .gpimg-detail-info textarea,
body.night .gpimg-ratio-grid,
body.night .gpimg-segment,
body.night .gpimg-ref-more,
body.night .gpimg-detail-info textarea,
html.dark .gpimg-ratio-grid,
html.dark .gpimg-segment,
html.dark .gpimg-ref-more,
html.dark .gpimg-detail-info textarea,
[data-theme="dark"] .gpimg-ratio-grid,
[data-theme="dark"] .gpimg-segment,
[data-theme="dark"] .gpimg-ref-more,
[data-theme="dark"] .gpimg-detail-info textarea,
[data-bs-theme="dark"] .gpimg-ratio-grid,
[data-bs-theme="dark"] .gpimg-segment,
[data-bs-theme="dark"] .gpimg-ref-more,
[data-bs-theme="dark"] .gpimg-detail-info textarea {
  background: #11151b;
  color: var(--text);
}

body.dark-theme .gpimg-ratio-grid button.is-active,
body.dark-theme .gpimg-segment button.is-active,
body.dark-theme .gpimg-output figcaption button,
body.dark-theme .gpimg-card-actions a,
body.dark-theme .gpimg-card-actions button,
body.dark-theme .gpimg-works-link,
body.dark .gpimg-ratio-grid button.is-active,
body.dark .gpimg-segment button.is-active,
body.dark .gpimg-output figcaption button,
body.dark .gpimg-card-actions a,
body.dark .gpimg-card-actions button,
body.dark .gpimg-works-link,
body.theme-dark .gpimg-ratio-grid button.is-active,
body.theme-dark .gpimg-segment button.is-active,
body.theme-dark .gpimg-output figcaption button,
body.theme-dark .gpimg-card-actions a,
body.theme-dark .gpimg-card-actions button,
body.theme-dark .gpimg-works-link,
body.night .gpimg-ratio-grid button.is-active,
body.night .gpimg-segment button.is-active,
body.night .gpimg-output figcaption button,
body.night .gpimg-card-actions a,
body.night .gpimg-card-actions button,
body.night .gpimg-works-link,
html.dark .gpimg-ratio-grid button.is-active,
html.dark .gpimg-segment button.is-active,
html.dark .gpimg-output figcaption button,
html.dark .gpimg-card-actions a,
html.dark .gpimg-card-actions button,
html.dark .gpimg-works-link,
[data-theme="dark"] .gpimg-ratio-grid button.is-active,
[data-theme="dark"] .gpimg-segment button.is-active,
[data-theme="dark"] .gpimg-output figcaption button,
[data-theme="dark"] .gpimg-card-actions a,
[data-theme="dark"] .gpimg-card-actions button,
[data-theme="dark"] .gpimg-works-link,
[data-bs-theme="dark"] .gpimg-ratio-grid button.is-active,
[data-bs-theme="dark"] .gpimg-segment button.is-active,
[data-bs-theme="dark"] .gpimg-output figcaption button,
[data-bs-theme="dark"] .gpimg-card-actions a,
[data-bs-theme="dark"] .gpimg-card-actions button,
[data-bs-theme="dark"] .gpimg-works-link {
  background: #eef2f7;
  color: #11151b;
}

body.dark-theme .gpimg-download-icon,
body.dark .gpimg-download-icon,
body.theme-dark .gpimg-download-icon,
body.night .gpimg-download-icon,
html.dark .gpimg-download-icon,
[data-theme="dark"] .gpimg-download-icon,
[data-bs-theme="dark"] .gpimg-download-icon {
  background: rgba(238,242,247,.88);
  color: #11151b;
}

body.dark-theme .gpimg-creator-card,
body.dark .gpimg-creator-card,
body.theme-dark .gpimg-creator-card,
body.night .gpimg-creator-card,
html.dark .gpimg-creator-card,
[data-theme="dark"] .gpimg-creator-card,
[data-bs-theme="dark"] .gpimg-creator-card {
  background: linear-gradient(180deg, rgba(19,23,30,.98), rgba(15,18,24,.98));
  border-color: rgba(240,246,255,.18);
  box-shadow: 0 18px 48px rgba(0,0,0,.36), inset 0 1px 0 rgba(255,255,255,.04);
}

body.dark-theme .gpimg-popover,
body.dark .gpimg-popover,
body.theme-dark .gpimg-popover,
body.night .gpimg-popover,
html.dark .gpimg-popover,
[data-theme="dark"] .gpimg-popover,
[data-bs-theme="dark"] .gpimg-popover {
  background: #090d14;
  border-color: rgba(240,246,255,.32);
  box-shadow: 0 26px 78px rgba(0,0,0,.74), 0 0 0 1px rgba(255,255,255,.06) inset;
  color: #f7fafc;
  scrollbar-color: rgba(226,232,240,.42) transparent;
}

body.dark-theme .gpimg-popover h3,
body.dark .gpimg-popover h3,
body.theme-dark .gpimg-popover h3,
body.night .gpimg-popover h3,
html.dark .gpimg-popover h3,
[data-theme="dark"] .gpimg-popover h3,
[data-bs-theme="dark"] .gpimg-popover h3 {
  color: #f8fafc;
}

body.dark-theme .gpimg-section-head a,
body.dark-theme .gpimg-tabs button,
body.dark-theme .gpimg-detail-actions button,
body.dark-theme .gpimg-load-more,
body.dark .gpimg-section-head a,
body.dark .gpimg-tabs button,
body.dark .gpimg-detail-actions button,
body.dark .gpimg-load-more,
body.theme-dark .gpimg-section-head a,
body.theme-dark .gpimg-tabs button,
body.theme-dark .gpimg-detail-actions button,
body.theme-dark .gpimg-load-more,
body.night .gpimg-section-head a,
body.night .gpimg-tabs button,
body.night .gpimg-detail-actions button,
body.night .gpimg-load-more,
html.dark .gpimg-section-head a,
html.dark .gpimg-tabs button,
html.dark .gpimg-detail-actions button,
html.dark .gpimg-load-more,
[data-theme="dark"] .gpimg-section-head a,
[data-theme="dark"] .gpimg-tabs button,
[data-theme="dark"] .gpimg-detail-actions button,
[data-theme="dark"] .gpimg-load-more,
[data-bs-theme="dark"] .gpimg-section-head a,
[data-bs-theme="dark"] .gpimg-tabs button,
[data-bs-theme="dark"] .gpimg-detail-actions button,
[data-bs-theme="dark"] .gpimg-load-more {
  background: #111722;
  border-color: rgba(238,244,255,.2);
  color: #f6f8fb;
}

body.dark-theme .gpimg-tabs button.is-active,
body.dark-theme .gpimg-detail-actions button:first-child,
body.dark .gpimg-tabs button.is-active,
body.dark .gpimg-detail-actions button:first-child,
body.theme-dark .gpimg-tabs button.is-active,
body.theme-dark .gpimg-detail-actions button:first-child,
body.night .gpimg-tabs button.is-active,
body.night .gpimg-detail-actions button:first-child,
html.dark .gpimg-tabs button.is-active,
html.dark .gpimg-detail-actions button:first-child,
[data-theme="dark"] .gpimg-tabs button.is-active,
[data-theme="dark"] .gpimg-detail-actions button:first-child,
[data-bs-theme="dark"] .gpimg-tabs button.is-active,
[data-bs-theme="dark"] .gpimg-detail-actions button:first-child {
  background: #f4f7fb;
  color: #0d1219;
  border-color: rgba(255,255,255,.52);
}

body.dark-theme .gpimg-prompt-card strong,
body.dark-theme .gpimg-result-head h2,
body.dark-theme .gpimg-section-head h1,
body.dark-theme .gpimg-section-head h2,
body.dark .gpimg-prompt-card strong,
body.dark .gpimg-result-head h2,
body.dark .gpimg-section-head h1,
body.dark .gpimg-section-head h2,
body.theme-dark .gpimg-prompt-card strong,
body.theme-dark .gpimg-result-head h2,
body.theme-dark .gpimg-section-head h1,
body.theme-dark .gpimg-section-head h2,
body.night .gpimg-prompt-card strong,
body.night .gpimg-result-head h2,
body.night .gpimg-section-head h1,
body.night .gpimg-section-head h2,
html.dark .gpimg-prompt-card strong,
html.dark .gpimg-result-head h2,
html.dark .gpimg-section-head h1,
html.dark .gpimg-section-head h2,
[data-theme="dark"] .gpimg-prompt-card strong,
[data-theme="dark"] .gpimg-result-head h2,
[data-theme="dark"] .gpimg-section-head h1,
[data-theme="dark"] .gpimg-section-head h2,
[data-bs-theme="dark"] .gpimg-prompt-card strong,
[data-bs-theme="dark"] .gpimg-result-head h2,
[data-bs-theme="dark"] .gpimg-section-head h1,
[data-bs-theme="dark"] .gpimg-section-head h2 {
  color: #f7fafc;
}

body.dark-theme .gpimg-section-head p,
body.dark-theme .gpimg-prompt-card small,
body.dark-theme .gpimg-prompt-card details,
body.dark-theme .gpimg-output figcaption span,
body.dark-theme .gpimg-empty,
body.dark-theme .gpimg-loading,
body.dark-theme .gpimg-notice,
body.dark .gpimg-section-head p,
body.dark .gpimg-prompt-card small,
body.dark .gpimg-prompt-card details,
body.dark .gpimg-output figcaption span,
body.dark .gpimg-empty,
body.dark .gpimg-loading,
body.dark .gpimg-notice,
body.theme-dark .gpimg-section-head p,
body.theme-dark .gpimg-prompt-card small,
body.theme-dark .gpimg-prompt-card details,
body.theme-dark .gpimg-output figcaption span,
body.theme-dark .gpimg-empty,
body.theme-dark .gpimg-loading,
body.theme-dark .gpimg-notice,
body.night .gpimg-section-head p,
body.night .gpimg-prompt-card small,
body.night .gpimg-prompt-card details,
body.night .gpimg-output figcaption span,
body.night .gpimg-empty,
body.night .gpimg-loading,
body.night .gpimg-notice,
html.dark .gpimg-section-head p,
html.dark .gpimg-prompt-card small,
html.dark .gpimg-prompt-card details,
html.dark .gpimg-output figcaption span,
html.dark .gpimg-empty,
html.dark .gpimg-loading,
html.dark .gpimg-notice,
[data-theme="dark"] .gpimg-section-head p,
[data-theme="dark"] .gpimg-prompt-card small,
[data-theme="dark"] .gpimg-prompt-card details,
[data-theme="dark"] .gpimg-output figcaption span,
[data-theme="dark"] .gpimg-empty,
[data-theme="dark"] .gpimg-loading,
[data-theme="dark"] .gpimg-notice,
[data-bs-theme="dark"] .gpimg-section-head p,
[data-bs-theme="dark"] .gpimg-prompt-card small,
[data-bs-theme="dark"] .gpimg-prompt-card details,
[data-bs-theme="dark"] .gpimg-output figcaption span,
[data-bs-theme="dark"] .gpimg-empty,
[data-bs-theme="dark"] .gpimg-loading,
[data-bs-theme="dark"] .gpimg-notice {
  color: #aeb8c7;
}

body.dark-theme .gpimg-image-wrap,
body.dark-theme .gpimg-image-preview-modal img,
body.dark .gpimg-image-wrap,
body.dark .gpimg-image-preview-modal img,
body.theme-dark .gpimg-image-wrap,
body.theme-dark .gpimg-image-preview-modal img,
body.night .gpimg-image-wrap,
body.night .gpimg-image-preview-modal img,
html.dark .gpimg-image-wrap,
html.dark .gpimg-image-preview-modal img,
[data-theme="dark"] .gpimg-image-wrap,
[data-theme="dark"] .gpimg-image-preview-modal img,
[data-bs-theme="dark"] .gpimg-image-wrap,
[data-bs-theme="dark"] .gpimg-image-preview-modal img {
  background: #0b0f16;
}

body.dark-theme .gpimg-ratio-grid,
body.dark-theme .gpimg-segment,
body.dark .gpimg-ratio-grid,
body.dark .gpimg-segment,
body.theme-dark .gpimg-ratio-grid,
body.theme-dark .gpimg-segment,
body.night .gpimg-ratio-grid,
body.night .gpimg-segment,
html.dark .gpimg-ratio-grid,
html.dark .gpimg-segment,
[data-theme="dark"] .gpimg-ratio-grid,
[data-theme="dark"] .gpimg-segment,
[data-bs-theme="dark"] .gpimg-ratio-grid,
[data-bs-theme="dark"] .gpimg-segment {
  background: #050810;
  box-shadow: inset 0 0 0 1px rgba(255,255,255,.08);
}

body.dark-theme .gpimg-ratio-grid button,
body.dark-theme .gpimg-segment button,
body.dark .gpimg-ratio-grid button,
body.dark .gpimg-segment button,
body.theme-dark .gpimg-ratio-grid button,
body.theme-dark .gpimg-segment button,
body.night .gpimg-ratio-grid button,
body.night .gpimg-segment button,
html.dark .gpimg-ratio-grid button,
html.dark .gpimg-segment button,
[data-theme="dark"] .gpimg-ratio-grid button,
[data-theme="dark"] .gpimg-segment button,
[data-bs-theme="dark"] .gpimg-ratio-grid button,
[data-bs-theme="dark"] .gpimg-segment button {
  color: #c4ccd8;
}

body.dark-theme .gpimg-ratio-grid button.is-active,
body.dark-theme .gpimg-segment button.is-active,
body.dark .gpimg-ratio-grid button.is-active,
body.dark .gpimg-segment button.is-active,
body.theme-dark .gpimg-ratio-grid button.is-active,
body.theme-dark .gpimg-segment button.is-active,
body.night .gpimg-ratio-grid button.is-active,
body.night .gpimg-segment button.is-active,
html.dark .gpimg-ratio-grid button.is-active,
html.dark .gpimg-segment button.is-active,
[data-theme="dark"] .gpimg-ratio-grid button.is-active,
[data-theme="dark"] .gpimg-segment button.is-active,
[data-bs-theme="dark"] .gpimg-ratio-grid button.is-active,
[data-bs-theme="dark"] .gpimg-segment button.is-active {
  background: linear-gradient(180deg, #f8fbff, #e8edf5);
  color: #0e131a;
  box-shadow: 0 10px 28px rgba(0,0,0,.34), 0 0 0 1px rgba(255,255,255,.5) inset;
}

body.dark-theme .gpimg-ratio-grid button > i,
body.dark .gpimg-ratio-grid button > i,
body.theme-dark .gpimg-ratio-grid button > i,
body.night .gpimg-ratio-grid button > i,
html.dark .gpimg-ratio-grid button > i,
[data-theme="dark"] .gpimg-ratio-grid button > i,
[data-bs-theme="dark"] .gpimg-ratio-grid button > i {
  background: #f8fafc;
  border-color: rgba(248,250,252,.9);
  box-shadow: 0 0 0 1px rgba(0,0,0,.22);
}

body.dark-theme .gpimg-mini-upload,
body.dark-theme .gpimg-select-button,
body.dark .gpimg-mini-upload,
body.dark .gpimg-select-button,
body.theme-dark .gpimg-mini-upload,
body.theme-dark .gpimg-select-button,
body.night .gpimg-mini-upload,
body.night .gpimg-select-button,
html.dark .gpimg-mini-upload,
html.dark .gpimg-select-button,
[data-theme="dark"] .gpimg-mini-upload,
[data-theme="dark"] .gpimg-select-button,
[data-bs-theme="dark"] .gpimg-mini-upload,
[data-bs-theme="dark"] .gpimg-select-button {
  background: #111722;
  border-color: rgba(238,244,255,.28);
  color: #f6f8fb;
  box-shadow: 0 1px 0 rgba(255,255,255,.05) inset;
}

body.dark-theme .gpimg-mini-upload.has-file,
body.dark .gpimg-mini-upload.has-file,
body.theme-dark .gpimg-mini-upload.has-file,
body.night .gpimg-mini-upload.has-file,
html.dark .gpimg-mini-upload.has-file,
[data-theme="dark"] .gpimg-mini-upload.has-file,
[data-bs-theme="dark"] .gpimg-mini-upload.has-file {
  background: rgba(33,120,255,.24);
  border-color: rgba(118,190,255,.86);
}

body.dark-theme .gpimg-ref-preview,
body.dark .gpimg-ref-preview,
body.theme-dark .gpimg-ref-preview,
body.night .gpimg-ref-preview,
html.dark .gpimg-ref-preview,
[data-theme="dark"] .gpimg-ref-preview,
[data-bs-theme="dark"] .gpimg-ref-preview {
  background: #0c111a;
  border-color: rgba(238,244,255,.3);
  box-shadow: 0 16px 40px rgba(0,0,0,.46), 0 0 0 1px rgba(255,255,255,.04) inset;
}

body.dark-theme .gpimg-ref-thumb,
body.dark .gpimg-ref-thumb,
body.theme-dark .gpimg-ref-thumb,
body.night .gpimg-ref-thumb,
html.dark .gpimg-ref-thumb,
[data-theme="dark"] .gpimg-ref-thumb,
[data-bs-theme="dark"] .gpimg-ref-thumb {
  border-color: rgba(238,244,255,.56);
  background: #0b0f16;
  box-shadow: 0 0 0 1px rgba(0,0,0,.45), 0 5px 14px rgba(0,0,0,.28);
}

body.dark-theme .gpimg-submit,
body.dark .gpimg-submit,
body.theme-dark .gpimg-submit,
body.night .gpimg-submit,
html.dark .gpimg-submit,
[data-theme="dark"] .gpimg-submit,
[data-bs-theme="dark"] .gpimg-submit {
  background: linear-gradient(180deg, #ffffff, #e8edf5);
  color: #0d1219 !important;
  box-shadow: 0 12px 30px rgba(0,0,0,.4), 0 0 0 1px rgba(255,255,255,.6) inset;
}

body.dark-theme .gpimg-submit span i,
body.dark .gpimg-submit span i,
body.theme-dark .gpimg-submit span i,
body.night .gpimg-submit span i,
html.dark .gpimg-submit span i,
[data-theme="dark"] .gpimg-submit span i,
[data-bs-theme="dark"] .gpimg-submit span i {
  color: #ff8a1f !important;
  opacity: 1;
}

body.dark-theme .gpimg-submit b,
body.dark .gpimg-submit b,
body.theme-dark .gpimg-submit b,
body.night .gpimg-submit b,
html.dark .gpimg-submit b,
[data-theme="dark"] .gpimg-submit b,
[data-bs-theme="dark"] .gpimg-submit b {
  background: rgba(13,18,25,.14);
  color: #0d1219 !important;
}

body.dark-theme .gpimg-submit span,
body.dark .gpimg-submit span,
body.theme-dark .gpimg-submit span,
body.night .gpimg-submit span,
html.dark .gpimg-submit span,
[data-theme="dark"] .gpimg-submit span,
[data-bs-theme="dark"] .gpimg-submit span,
body.dark-theme .gpimg-submit svg,
body.dark .gpimg-submit svg,
body.theme-dark .gpimg-submit svg,
body.night .gpimg-submit svg,
html.dark .gpimg-submit svg,
[data-theme="dark"] .gpimg-submit svg,
[data-bs-theme="dark"] .gpimg-submit svg {
  color: #0d1219 !important;
  opacity: 1;
}

body.dark-theme .gpimg-submit:disabled,
body.dark .gpimg-submit:disabled,
body.theme-dark .gpimg-submit:disabled,
body.night .gpimg-submit:disabled,
html.dark .gpimg-submit:disabled,
[data-theme="dark"] .gpimg-submit:disabled,
[data-bs-theme="dark"] .gpimg-submit:disabled {
  opacity: .82;
  filter: saturate(.92);
}

@keyframes gpimg-spin {
  to { transform: rotate(360deg); }
}

@media (max-width: 760px) {
  .gpimg-shell {
    padding: 14px 12px 34px;
  }

  .gpimg-app-hero {
    margin-top: 4px;
  }

  .gpimg-app-hero p {
    font-size: 16px;
  }

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

  .gpimg-account div {
    padding: 8px 10px;
  }

  .gpimg-account span {
    font-size: 10px;
  }

  .gpimg-account strong {
    font-size: 12px;
  }

  .gpimg-creator-card {
    min-height: 300px;
    padding: 12px;
  }

  .gpimg-prompt-main {
    min-height: 188px;
  }

  .gpimg-prompt-main textarea {
    min-height: 184px;
    font-size: 16px;
  }

  .gpimg-action-row {
    align-items: flex-end;
    display: flex;
    gap: 8px;
  }

  .gpimg-action-tools {
    flex: 1 1 auto;
    display: flex;
    gap: 8px;
    flex-wrap: nowrap;
    max-width: none;
    min-width: 0;
  }

  .gpimg-select-pill,
  .gpimg-popover-control,
  .gpimg-mini-upload {
    width: auto;
    min-width: 0;
  }

  .gpimg-action-tools .gpimg-mini-upload {
    flex: 0 0 106px;
  }

  .gpimg-action-tools .gpimg-popover-control {
    flex: 0 0 auto;
  }

  .gpimg-select-button,
  .gpimg-select-pill {
    justify-content: center;
    text-align: center;
    padding-left: 6px;
    padding-right: 6px;
  }

  .gpimg-select-pill {
    width: 100%;
  }

  .gpimg-action-row [data-gpimg-config] .gpimg-select-button {
    min-width: 116px;
    max-width: 132px;
    padding-left: 10px;
    padding-right: 10px;
  }

  .gpimg-mini-upload {
    justify-content: center;
    gap: 3px;
  }

  .gpimg-mini-upload strong,
  .gpimg-select-button span {
    text-align: center;
    font-size: 12px;
  }

  .gpimg-submit {
    width: auto;
    justify-content: center;
    margin-left: auto;
    min-width: 72px;
    align-self: end;
    justify-self: end;
  }

  .gpimg-popover {
    position: absolute;
    left: 50% !important;
    right: auto !important;
    bottom: calc(100% + 8px);
    transform: translateX(-50%);
    width: min(366px, calc(100vw - 24px)) !important;
    max-height: 70vh;
    overflow: auto;
  }

  .gpimg-popover.is-mobile-positioned {
    position: fixed;
    left: var(--gpimg-pop-left, 12px) !important;
    top: var(--gpimg-pop-top, auto);
    right: auto !important;
    bottom: auto;
    transform: none;
    z-index: 400;
  }

  .gpimg-popover.is-mobile-positioned::before {
    content: "";
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,.2);
    transform: none;
    pointer-events: none;
    z-index: -1;
  }

  .gpimg-ref-preview {
    max-width: 100%;
    overflow-x: auto;
    overflow-y: hidden;
    scrollbar-width: none;
    z-index: 18;
  }

  .gpimg-ref-preview::-webkit-scrollbar {
    display: none;
  }

  .gpimg-popover-control.is-open {
    z-index: 420;
  }

  .gpimg-ratio-grid {
    grid-template-columns: repeat(3, 1fr);
  }

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

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

  .gpimg-result-grid .gpimg-output:nth-of-type(n+3) {
    display: none;
  }

  .gpimg-result-head h2 {
    font-size: 18px;
  }

  .gpimg-output {
    width: 100%;
    max-width: 100%;
    padding: 7px;
  }

  .gpimg-output figcaption span {
    -webkit-line-clamp: 2;
    font-size: 12px;
  }

  .gpimg-download-icon {
    right: 8px;
    bottom: 8px;
    top: auto;
    width: 30px;
    height: 30px;
  }

  .gpimg-detail-panel {
    grid-template-columns: 1fr;
    width: 100%;
    max-width: 100%;
    max-height: calc(100vh - 24px);
    padding: 14px;
    overflow-x: hidden;
  }

  .gpimg-detail-modal {
    padding: 12px;
    align-items: start;
    justify-items: center;
    overflow-x: hidden;
  }

  .gpimg-detail-media,
  .gpimg-detail-info,
  .gpimg-detail-info textarea {
    min-width: 0;
    max-width: 100%;
  }

  .gpimg-ref-preview {
    left: 0;
    right: auto;
    bottom: 45px;
    max-width: calc(100% - 74px);
    width: max-content;
    max-height: 52px;
    z-index: 18;
  }

  .gpimg-action-row > .gpimg-ref-preview {
    position: absolute !important;
    left: 0 !important;
    right: auto !important;
    top: auto !important;
    bottom: calc(100% + 6px) !important;
    transform: none !important;
    margin: 0 !important;
    align-self: start;
  }

  .gpimg-bottom-controls {
    gap: 0 !important;
    row-gap: 0 !important;
  }

  .gpimg-ref-toast {
    left: 12px;
    bottom: 102px;
    max-width: calc(100% - 24px);
  }

}

/* Final mobile reference preview guard: keep uploaded thumbs floating above the
   action row without adding layout height. This is intentionally last so
   cached inline critical CSS and older mobile rules cannot pull it back up. */
@media (max-width: 760px) {
  .gpimg-creator-card .gpimg-bottom-controls {
    position: relative !important;
    display: grid !important;
    gap: 0 !important;
    row-gap: 0 !important;
  }

  .gpimg-creator-card .gpimg-action-row {
    position: relative !important;
  }

  .gpimg-creator-card .gpimg-action-row > .gpimg-ref-preview,
  .gpimg-creator-card .gpimg-action-row > .gpimg-ref-preview.has-items {
    position: absolute !important;
    left: 0 !important;
    right: auto !important;
    top: auto !important;
    bottom: calc(100% + 6px) !important;
    display: none;
    width: max-content !important;
    max-width: calc(100% - 74px) !important;
    max-height: 52px !important;
    padding: 7px !important;
    border: 1px solid rgba(28,32,38,.08) !important;
    border-radius: 10px !important;
    background: rgba(255,255,255,.92) !important;
    box-shadow: 0 10px 28px rgba(20,24,32,.08) !important;
    backdrop-filter: blur(8px) !important;
    margin: 0 !important;
    transform: none !important;
    overflow-x: auto !important;
    overflow-y: hidden !important;
    z-index: 18 !important;
    gap: 6px !important;
  }

  .gpimg-creator-card .gpimg-action-row > .gpimg-ref-preview.has-items {
    display: inline-flex !important;
  }
}
