/* BatchWatermark Web — Studio Dark Theme */

:root {
  --bg-canvas: #14161b;
  --bg-app: #16181d;
  --bg-panel: #1e2128;
  --bg-card: #1f232b;
  --bg-input: #15181e;
  --border: #2c313c;
  --border-strong: #383f4e;
  --text: #e5e7eb;
  --text-strong: #f9fafb;
  --text-muted: #9ca3af;
  --accent: #3b82f6;
  --accent-hover: #2563eb;
  --accent-deep: #1d4ed8;
  --accent-soft: #93c5fd;
  --danger-bg: #2a2326;
  --danger-border: #4c2c32;
  --danger-text: #fca5a5;
  --radius: 8px;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
  background: var(--bg-app);
  color: var(--text);
  font-family: "Microsoft YaHei UI", "PingFang SC", "Segoe UI", system-ui, -apple-system, sans-serif;
  font-size: 13px;
}

/* The app fills the first viewport; the crawlable guide sits below it. */
html {
  scroll-behavior: smooth;
}

body {
  overflow-x: hidden;
}

.hidden {
  display: none !important;
}

.sr-only {
  position: absolute !important;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.app-shell {
  display: flex;
  flex-direction: column;
  height: 100vh;
  height: 100dvh;
}

/* ---- Top Dual-Mode Tab Bar ---- */
.mode-tab-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 0 14px;
  height: 46px;
  flex-shrink: 0;
  background: #14171e;
  border-bottom: 1px solid var(--border);
}

.mode-bar-left,
.mode-bar-right {
  display: flex;
  align-items: center;
  gap: 10px;
}

.lang-select {
  appearance: auto;
  background: #1c202a;
  color: var(--text);
  border: 1px solid #323a4c;
  border-radius: 7px;
  padding: 4px 8px;
  font-size: 12px;
  font-weight: 600;
  height: 30px;
  cursor: pointer;
}

.lang-select:hover,
.lang-select:focus {
  border-color: var(--accent);
  outline: none;
}

.mode-tabs {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px;
  border-radius: 9px;
  background: #1c202a;
  border: 1px solid #2d3444;
}

.mode-tab-btn {
  appearance: none;
  border: 1px solid transparent;
  background: transparent;
  color: var(--text-muted);
  font-size: 13px;
  font-weight: 700;
  padding: 5px 14px;
  border-radius: 7px;
  cursor: pointer;
  white-space: nowrap;
  transition: background 0.14s, color 0.14s, border-color 0.14s;
}

.mode-tab-btn:hover {
  color: var(--text-strong);
  background: #252b38;
}

.mode-tab-btn.active {
  background: var(--accent-hover);
  color: #ffffff;
  border-color: #60a5fa;
  box-shadow: 0 2px 8px rgba(37, 99, 235, 0.35);
}

.mode-view {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 0;
  overflow: hidden;
}

/* ---- Top Bar ---- */
.top-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 0 14px;
  height: 54px;
  flex-shrink: 0;
  background: var(--bg-panel);
  border-bottom: 1px solid var(--border);
}

.top-bar-left,
.top-bar-right {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: nowrap;
}

.brand {
  display: flex;
  align-items: center;
  gap: 6px;
  margin: 0 4px 0 0;
  font-size: inherit;
  font-weight: inherit;
  line-height: normal;
}

.brand-icon {
  font-size: 16px;
}

.brand-title {
  font-size: 15px;
  font-weight: 700;
  color: var(--text-strong);
}

.brand-tag {
  background: #1d3257;
  color: var(--accent-soft);
  border: 1px solid #30528c;
  border-radius: 6px;
  padding: 1px 6px;
  font-size: 11px;
  font-weight: 700;
}

.count-badge {
  background: #262b36;
  color: var(--accent-soft);
  border: 1px solid #354156;
  border-radius: 10px;
  padding: 3px 10px;
  font-size: 12px;
  font-weight: 600;
  white-space: nowrap;
}

.privacy-pill {
  background: #182722;
  color: #6ee7b7;
  border: 1px solid #24473a;
  border-radius: 10px;
  padding: 3px 9px;
  font-size: 11px;
  font-weight: 600;
  white-space: nowrap;
}

.size-control {
  display: flex;
  align-items: center;
  gap: 6px;
  white-space: nowrap;
  flex-shrink: 0;
}

.size-control span {
  white-space: nowrap;
}

.size-control input[type="range"] {
  width: 92px;
}

.repo-link {
  text-decoration: none;
  display: inline-flex;
  align-items: center;
}

/* ---- Buttons ---- */
.btn {
  background: #2a2f3a;
  color: var(--text);
  border: 1px solid var(--border-strong);
  border-radius: 6px;
  padding: 6px 12px;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.14s, border-color 0.14s, color 0.14s;
  white-space: nowrap;
}

.btn:hover:not(:disabled) {
  background: #343b49;
  border-color: #4b5568;
}

.btn:disabled {
  background: #21242c;
  color: #6b7280;
  border-color: #2a2e37;
  cursor: not-allowed;
}

.btn-primary {
  background: var(--accent);
  color: #ffffff;
  border-color: var(--accent);
  font-weight: 600;
}

.btn-primary:hover:not(:disabled) {
  background: var(--accent-hover);
  border-color: var(--accent-hover);
}

.btn-primary:disabled {
  background: #28364f;
  color: #7d95b8;
  border-color: #28364f;
}

.btn-toggle {
  background: #242934;
  color: #cbd5e1;
  border-color: #3b4354;
  font-weight: 600;
}

.btn-toggle.active {
  background: var(--accent-deep);
  color: #ffffff;
  border-color: #60a5fa;
}

.btn-danger {
  background: var(--danger-bg);
  color: var(--danger-text);
  border-color: var(--danger-border);
}

.btn-danger:hover:not(:disabled) {
  background: #7f1d1d;
  color: #ffffff;
  border-color: #991b1b;
}

.btn-ghost {
  background: transparent;
  border-color: var(--border-strong);
  padding: 4px 8px;
  font-size: 12px;
}

.btn-ghost:hover:not(:disabled) {
  background: #2c313c;
}

.btn-segmented {
  flex: 1;
  background: var(--bg-input);
  color: var(--text-muted);
  border: 1px solid #323744;
  border-radius: 6px;
  padding: 6px 10px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
}

.btn-segmented:hover {
  background: #252932;
  color: var(--text);
}

.btn-segmented.active {
  background: var(--accent-hover);
  color: #ffffff;
  border-color: #60a5fa;
}

.btn-pill {
  background: #232730;
  color: #cbd5e1;
  border: 1px solid #343a46;
  border-radius: 4px;
  padding: 3px 8px;
  font-size: 11px;
  cursor: pointer;
}

.btn-pill:hover {
  background: #323846;
  color: #ffffff;
}

.btn-pill.active {
  background: var(--accent-hover);
  border-color: #60a5fa;
  color: #ffffff;
}

.full-width {
  width: 100%;
}

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

/* ---- Main Split Workspace ---- */
.workspace {
  display: flex;
  flex: 1;
  min-height: 0;
}

.gallery-pane {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  background: var(--bg-canvas);
  border-right: 1px solid var(--border);
  position: relative;
}

.gallery-filter-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 7px 16px;
  background: #1a1e26;
  border-bottom: 1px solid #2a303d;
  flex-shrink: 0;
  flex-wrap: wrap;
}

.filter-bar-left {
  display: flex;
  align-items: center;
  gap: 8px;
}

.filter-label {
  font-size: 12px;
  font-weight: 600;
  color: var(--accent-soft);
}

.pill-group {
  display: flex;
  align-items: center;
  gap: 6px;
}

/* ---- Empty Drop Zone ---- */
.empty-state {
  flex: 1;
  padding: 28px;
  display: flex;
}

.drop-zone {
  flex: 1;
  background: #1a1d24;
  border: 2px dashed #384050;
  border-radius: 14px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 28px;
  gap: 10px;
  transition: background 0.15s, border-color 0.15s;
}

.drop-zone.drag-over,
.gallery-pane.drag-over .drop-zone {
  background: #1d2738;
  border-color: var(--accent);
}

.gallery-pane.drag-over::after {
  content: "松开鼠标导入图片、视频或文件夹";
  position: absolute;
  inset: 12px;
  background: rgba(29, 39, 56, 0.88);
  border: 2px dashed #60a5fa;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  font-weight: 700;
  color: #ffffff;
  z-index: 30;
  pointer-events: none;
}

.drop-icons {
  font-size: 44px;
  line-height: 1.1;
}

.drop-zone h2 {
  margin: 0;
  font-size: 18px;
  color: #f3f4f6;
}

.drop-sub {
  margin: 0;
  font-size: 13px;
  color: var(--text-muted);
}

.drop-actions {
  display: flex;
  gap: 12px;
  margin-top: 8px;
}

/* ---- Populated Gallery ---- */
.gallery-scroll {
  flex: 1;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.media-section {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.group-header {
  display: flex;
  align-items: center;
  gap: 8px;
  background: #1b2029;
  border: 1px solid #2c3444;
  border-radius: 7px;
  padding: 7px 12px;
}

.group-title {
  font-size: 13px;
  font-weight: 700;
  color: #f3f4f6;
}

.group-badge {
  background: #263145;
  color: var(--accent-soft);
  border-radius: 8px;
  padding: 2px 8px;
  font-size: 11px;
  font-weight: 600;
}

.group-empty {
  color: var(--text-muted);
  font-size: 12px;
  padding: 4px 6px 8px;
}

.media-grid {
  --card-w: 250px;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(var(--card-w), var(--card-w)));
  gap: 14px;
  align-items: start;
}

.preview-card {
  width: var(--card-w);
  background: var(--bg-card);
  border: 1px solid #2d323e;
  border-radius: 9px;
  padding: 6px 6px 8px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  cursor: pointer;
  transition: border-color 0.14s, background 0.14s;
}

.preview-card:hover {
  border-color: #4b6b9b;
  background: #242934;
}

.preview-card.selected {
  border-color: var(--accent);
  background: #232b3a;
}

.card-stage {
  position: relative;
  width: 100%;
  aspect-ratio: 4 / 3;
  border-radius: 6px;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  background-color: #181b22;
  background-image:
    linear-gradient(45deg, #20242e 25%, transparent 25%),
    linear-gradient(-45deg, #20242e 25%, transparent 25%),
    linear-gradient(45deg, transparent 75%, #20242e 75%),
    linear-gradient(-45deg, transparent 75%, #20242e 75%);
  background-size: 20px 20px;
  background-position: 0 0, 0 10px, 10px -10px, -10px 0;
}

.card-stage canvas {
  max-width: calc(100% - 10px);
  max-height: calc(100% - 10px);
  object-fit: contain;
  display: block;
}

.video-badge {
  position: absolute;
  top: 6px;
  left: 6px;
  background: rgba(17, 24, 39, 0.85);
  color: var(--accent-soft);
  border: 1px solid rgba(96, 165, 250, 0.55);
  border-radius: 9px;
  padding: 2px 7px;
  font-size: 11px;
  font-weight: 700;
  pointer-events: none;
}

.card-actions {
  position: absolute;
  top: 6px;
  right: 6px;
  display: flex;
  gap: 5px;
}

.card-icon-btn {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: rgba(20, 22, 27, 0.82);
  color: var(--text);
  border: 1px solid rgba(255, 255, 255, 0.16);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 12px;
  font-weight: 700;
  padding: 0;
}

.card-icon-btn:hover {
  background: var(--accent);
  border-color: #60a5fa;
  color: #ffffff;
}

.card-icon-btn.remove {
  color: var(--danger-text);
}

.card-icon-btn.remove:hover {
  background: #dc2626;
  border-color: #ef4444;
  color: #ffffff;
}

.card-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  padding: 0 2px;
}

.card-name {
  font-size: 12px;
  font-weight: 600;
  color: var(--text);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  flex: 1;
}

.card-meta {
  font-size: 11px;
  color: var(--text-muted);
  white-space: nowrap;
}

/* ---- Status Bar ---- */
.status-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 5px 14px;
  background: #1a1d24;
  border-top: 1px solid #2a2f3a;
  color: var(--text-muted);
  font-size: 12px;
  flex-shrink: 0;
}

.status-right {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  white-space: nowrap;
}

.guide-link {
  color: var(--accent-soft);
  text-decoration: none;
  font-weight: 600;
}

.guide-link:hover {
  text-decoration: underline;
}

/* ---- Right Control Panel ---- */
.control-panel {
  width: 410px;
  min-width: 360px;
  max-width: 450px;
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  background: var(--bg-app);
}

.panel-scroll {
  flex: 1;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.section-card {
  background: var(--bg-panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 11px 12px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.orientation-card {
  background: #1b2333;
  border-color: #324a75;
}

.section-title {
  font-size: 13px;
  font-weight: 700;
  color: #f3f4f6;
}

.accent-title {
  color: var(--accent-soft);
}

.info-hint {
  background: #1a2639;
  color: var(--accent-soft);
  border: 1px solid #2c4670;
  border-radius: 6px;
  padding: 6px 8px;
  font-size: 12px;
}

.control-stack {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.orient-switch-host {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.segmented-row {
  display: flex;
  gap: 6px;
}

.inline-row {
  display: flex;
  align-items: center;
  gap: 6px;
}

.grow {
  flex: 1;
  min-width: 0;
}

.preset-actions {
  display: flex;
  align-items: center;
  gap: 5px;
}

.dropdown-wrap {
  position: relative;
}

.dropdown-menu {
  position: absolute;
  right: 0;
  top: calc(100% + 4px);
  background: #1e2128;
  border: 1px solid var(--border-strong);
  border-radius: 6px;
  padding: 4px;
  min-width: 210px;
  box-shadow: 0 10px 26px rgba(0, 0, 0, 0.5);
  z-index: 40;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.dropdown-menu button {
  background: transparent;
  color: var(--text);
  border: none;
  border-radius: 4px;
  padding: 7px 10px;
  text-align: left;
  font-size: 12px;
  cursor: pointer;
}

.dropdown-menu button:hover {
  background: var(--accent-hover);
  color: #ffffff;
}

/* Inputs */
.input-text,
.input-textarea,
.input-select,
.input-num {
  background: var(--bg-input);
  color: #f3f4f6;
  border: 1px solid #323846;
  border-radius: 5px;
  padding: 5px 8px;
  font-family: inherit;
  font-size: 13px;
}

.input-text:focus,
.input-textarea:focus,
.input-select:focus,
.input-num:focus {
  outline: none;
  border-color: var(--accent);
}

.input-textarea {
  resize: vertical;
  min-height: 60px;
}

.input-num {
  width: 66px;
  text-align: right;
}

.field-label {
  width: 60px;
  flex-shrink: 0;
  font-size: 12px;
  color: var(--text);
}

.field-label.short {
  width: auto;
}

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

.slider-row input[type="range"] {
  flex: 1;
  min-width: 0;
}

input[type="range"] {
  accent-color: var(--accent);
  cursor: pointer;
}

.checkbox-row {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  cursor: pointer;
  color: #d1d5db;
  font-size: 12px;
  user-select: none;
}

.checkbox-row input[type="checkbox"] {
  accent-color: var(--accent);
  width: 15px;
  height: 15px;
  cursor: pointer;
}

.color-row,
.effect-header {
  display: flex;
  align-items: center;
  gap: 6px;
}

.color-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: var(--bg-input);
  border: 1px solid #4b5568;
  border-radius: 5px;
  padding: 2px 8px 2px 3px;
  cursor: pointer;
  font-size: 12px;
  font-weight: 600;
}

.color-chip input[type="color"] {
  border: none;
  background: transparent;
  width: 22px;
  height: 22px;
  padding: 0;
  cursor: pointer;
}

.swatches {
  display: flex;
  align-items: center;
  gap: 5px;
}

.swatch {
  width: 20px;
  height: 20px;
  border-radius: 4px;
  border: 1px solid #4b5568;
  cursor: pointer;
  padding: 0;
}

.swatch:hover {
  border: 2px solid #60a5fa;
}

.quick-angles {
  display: flex;
  align-items: center;
  gap: 5px;
}

/* Logo picker */
.logo-picker-box {
  display: flex;
  align-items: center;
  gap: 10px;
}

.logo-thumb {
  width: 52px;
  height: 52px;
  flex-shrink: 0;
  background: var(--bg-input);
  border: 1px solid #323846;
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  font-size: 11px;
  color: var(--text-muted);
}

.logo-thumb img {
  max-width: 46px;
  max-height: 46px;
  object-fit: contain;
}

.logo-picker-info {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 5px;
}

/* 3x3 Anchor Grid */
.anchor-row {
  display: flex;
  align-items: flex-start;
  gap: 8px;
}

.anchor-grid {
  display: grid;
  grid-template-columns: repeat(3, 38px);
  gap: 5px;
}

.anchor-btn {
  width: 38px;
  height: 32px;
  background: #1b1e25;
  color: var(--text-muted);
  border: 1px solid #323744;
  border-radius: 5px;
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
}

.anchor-btn:hover {
  background: #282d38;
  color: #f3f4f6;
}

.anchor-btn.active {
  background: var(--accent-hover);
  border-color: #60a5fa;
  color: #ffffff;
}

/* Sticky Export Footer */
.export-footer {
  background: var(--bg-panel);
  border-top: 1px solid var(--border);
  padding: 10px 12px 12px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.export-footer-row {
  display: flex;
  align-items: center;
  gap: 8px;
}

.export-main-btn {
  height: 38px;
}

/* Mobile-only elements hidden on desktop */
.mobile-param-tabs,
.mobile-gallery-bar,
.mobile-only-flex {
  display: none;
}

.desktop-only-block {
  display: block;
}

/* ---- Modals ---- */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(8, 10, 14, 0.78);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
  padding: 20px;
}

.modal-card {
  background: var(--bg-panel);
  border: 1px solid var(--border-strong);
  border-radius: 12px;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.65);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.lightbox-card {
  width: min(1040px, 94vw);
  height: min(760px, 90vh);
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
}

.modal-title {
  font-weight: 700;
  font-size: 14px;
  color: #f3f4f6;
}

.modal-header-actions {
  display: flex;
  gap: 8px;
}

.lightbox-stage {
  flex: 1;
  min-height: 0;
  padding: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  background-color: #14161b;
  background-image:
    linear-gradient(45deg, #1b1f28 25%, transparent 25%),
    linear-gradient(-45deg, #1b1f28 25%, transparent 25%),
    linear-gradient(45deg, transparent 75%, #1b1f28 75%),
    linear-gradient(-45deg, transparent 75%, #1b1f28 75%);
  background-size: 24px 24px;
  background-position: 0 0, 0 12px, 12px -12px, -12px 0;
}

.lightbox-stage canvas {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.45);
}

.lightbox-video-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 16px;
  border-top: 1px solid var(--border);
  background: #1a1d24;
}

.lightbox-video-bar input[type="range"] {
  flex: 1;
}

.time-readout {
  min-width: 84px;
  text-align: center;
}

.export-progress-card {
  width: min(480px, 92vw);
}

.export-progress-body {
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.progress-track {
  height: 18px;
  background: var(--bg-input);
  border: 1px solid #323846;
  border-radius: 6px;
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  background: linear-gradient(90deg, #2563eb, #60a5fa);
  transition: width 0.12s linear;
}

.export-percent {
  text-align: right;
  font-size: 12px;
  font-weight: 700;
  color: var(--accent-soft);
}

.modal-footer {
  padding: 10px 16px 14px;
  display: flex;
  justify-content: flex-end;
  border-top: 1px solid var(--border);
}

/* ---- Toast ---- */
.toast-host {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  flex-direction: column;
  gap: 8px;
  z-index: 200;
  pointer-events: none;
}

.toast-item {
  background: rgba(24, 30, 42, 0.96);
  color: #f3f4f6;
  border: 1px solid #3b82f6;
  border-radius: 8px;
  padding: 8px 16px;
  font-size: 13px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.45);
}

/* Custom Scrollbars */
::-webkit-scrollbar {
  width: 9px;
  height: 9px;
}

::-webkit-scrollbar-track {
  background: var(--bg-app);
}

::-webkit-scrollbar-thumb {
  background: #343a46;
  border-radius: 5px;
  border: 2px solid var(--bg-app);
}

::-webkit-scrollbar-thumb:hover {
  background: #4b5568;
}

/* ---- Creative Mode Studio Layout ---- */
.creative-toolbar {
  height: 50px;
}

.creative-workspace {
  display: grid;
  grid-template-columns: 280px minmax(0, 1fr) 336px;
  flex: 1;
  min-height: 0;
  overflow: hidden;
  background: var(--bg-canvas);
}

.creative-lib-pane {
  display: flex;
  flex-direction: column;
  min-height: 0;
  padding: 10px;
  gap: 8px;
  background: #181b22;
  border-right: 1px solid var(--border);
}

.creative-pane-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.creative-pane-hint {
  margin: 0;
  font-size: 11.5px;
  line-height: 1.45;
}

.creative-lib-actions,
.creative-lib-pack-row {
  display: flex;
  gap: 6px;
}

.creative-lib-list {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding-right: 2px;
}

.creative-asset-card {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 7px 8px;
  background: #20242d;
  border: 1px solid #2f3645;
  border-radius: 8px;
  cursor: grab;
  transition: border-color 0.14s, background 0.14s;
}

.creative-asset-card:hover {
  background: #262c38;
  border-color: #4b6b9b;
}

.creative-asset-card:active {
  cursor: grabbing;
}

.asset-thumb {
  width: 44px;
  height: 44px;
  flex-shrink: 0;
  border-radius: 6px;
  background: #13161d;
  border: 1px solid #2c3342;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

.asset-thumb-canvas {
  max-width: 40px;
  max-height: 40px;
  object-fit: contain;
}

.asset-info {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.asset-name {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-strong);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.asset-meta {
  display: flex;
  align-items: center;
  gap: 5px;
}

.kind-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 1px 5px;
  border-radius: 4px;
  font-size: 10.5px;
  font-weight: 700;
}

.kind-badge.img {
  background: #1e3a5f;
  color: #93c5fd;
}

.kind-badge.txt {
  background: #3b2452;
  color: #d8b4fe;
}

.mini-select {
  background: var(--bg-input);
  color: var(--text);
  border: 1px solid var(--border-strong);
  border-radius: 5px;
  padding: 1px 4px;
  font-size: 11px;
  height: 22px;
  flex: 1;
  min-width: 0;
}

.asset-actions {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.creative-stage-pane {
  display: flex;
  flex-direction: column;
  min-width: 0;
  min-height: 0;
  background: #11141a;
}

.creative-stage-box {
  position: relative;
  flex: 1;
  min-height: 0;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
}

.creative-stage-box.drag-over {
  outline: 2px dashed var(--accent);
  outline-offset: -6px;
  background: #162033;
}

.creative-empty-state {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.creative-drop-zone {
  max-width: 520px;
}

.creative-canvas {
  display: block;
  touch-action: none;
  user-select: none;
}

.creative-filmstrip {
  height: 92px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 10px;
  overflow-x: auto;
  background: #181c24;
  border-top: 1px solid var(--border);
}

.creative-filmstrip:empty {
  height: 0;
  padding: 0;
  border-top: none;
}

.filmstrip-card {
  width: 108px;
  height: 78px;
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: 4px 5px;
  background: #1f232b;
  border: 1px solid #2d323e;
  border-radius: 7px;
  cursor: pointer;
}

.filmstrip-card:hover {
  border-color: #4b6b9b;
}

.filmstrip-card.selected {
  border: 2px solid #38bdf8;
  background: #222c3d;
}

.filmstrip-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 4px;
}

.card-icon-btn.mini {
  width: 18px;
  height: 18px;
  font-size: 10px;
}

.filmstrip-thumb {
  width: 96px;
  height: 36px;
  display: block;
  margin: 0 auto;
}

.filmstrip-name {
  font-size: 10.5px;
  color: var(--text-muted);
  text-align: center;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.creative-right-pane {
  display: flex;
  flex-direction: column;
  min-height: 0;
  background: var(--bg-app);
  border-left: 1px solid var(--border);
}

.creative-mobile-tabs {
  display: none;
}

.creative-text-modal-card {
  width: min(460px, 94vw);
  max-height: 90dvh;
  display: flex;
  flex-direction: column;
}

.creative-modal-body {
  padding: 14px 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  overflow-y: auto;
}

.color-native-input {
  width: 38px;
  height: 30px;
  padding: 2px;
  background: var(--bg-input);
  border: 1px solid var(--border-strong);
  border-radius: 6px;
  cursor: pointer;
}

@media (max-width: 1120px) {
  .creative-workspace {
    grid-template-columns: 235px minmax(0, 1fr) 295px;
  }
}

/* ---- Crawlable Product Guide (below the app viewport) ---- */
.site-guide-wrap {
  background: linear-gradient(180deg, #14161b 0%, #161c28 100%);
  border-top: 1px solid var(--border);
  padding: 56px 20px 40px;
}

.site-guide {
  max-width: 1080px;
  margin: 0 auto;
  font-size: 15px;
  line-height: 1.8;
  color: var(--text);
}

.site-guide h2 {
  margin: 0 0 16px;
  font-size: 22px;
  line-height: 1.4;
  color: var(--text-strong);
}

.site-guide h3 {
  margin: 0 0 6px;
  font-size: 16px;
  color: var(--accent-soft);
}

.site-guide p {
  margin: 0;
}

.site-guide a:not(.btn) {
  color: var(--accent-soft);
}

.guide-hero {
  text-align: center;
  margin-bottom: 48px;
}

.guide-hero h2 {
  font-size: 30px;
}

.guide-eyebrow {
  display: inline-block;
  margin-bottom: 14px !important;
  padding: 3px 12px;
  border-radius: 999px;
  border: 1px solid #24473a;
  background: #182722;
  color: #6ee7b7;
  font-size: 13px;
  font-weight: 600;
}

.guide-lead {
  max-width: 820px;
  margin: 0 auto 22px !important;
  color: #cbd5e1;
}

.guide-lead strong {
  color: var(--text-strong);
}

.guide-cta {
  display: inline-block;
  padding: 10px 22px;
  font-size: 15px;
  text-decoration: none;
}

.guide-section {
  margin-bottom: 44px;
}

.feature-grid {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 14px;
}

.feature-item {
  background: var(--bg-panel);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 18px 20px;
  font-size: 14px;
  color: #cbd5e1;
}

.howto-steps {
  margin: 0;
  padding-left: 1.6em;
  display: grid;
  gap: 8px;
  color: #cbd5e1;
}

.howto-steps strong {
  color: var(--text-strong);
}

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

.faq-item {
  background: var(--bg-panel);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 0 18px;
}

.faq-item summary {
  cursor: pointer;
  padding: 14px 0;
  font-weight: 600;
  color: var(--text-strong);
}

.faq-item[open] summary {
  color: var(--accent-soft);
}

.faq-item p {
  padding: 0 0 16px;
  font-size: 14px;
  color: #cbd5e1;
}

.guide-footer {
  border-top: 1px solid var(--border);
  padding-top: 22px;
  text-align: center;
}

.guide-links {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px 24px;
  margin-bottom: 10px;
  font-size: 14px;
}

.guide-links a {
  text-decoration: none;
}

.guide-links a:hover {
  text-decoration: underline;
}

/* GEO TL;DR Fact Grid & Comparison Table */
.facts-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(290px, 1fr));
  gap: 12px;
  margin: 0;
}

.fact-card {
  background: var(--bg-panel);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 14px 16px;
}

.fact-card dt {
  font-size: 12px;
  font-weight: 700;
  color: var(--accent-soft);
  margin-bottom: 4px;
}

.fact-card dd {
  margin: 0;
  font-size: 14px;
  color: #d1d5db;
  line-height: 1.6;
}

.fact-card code,
.feature-item code {
  background: #15181e;
  border: 1px solid #2d3340;
  border-radius: 4px;
  padding: 1px 5px;
  font-size: 12px;
  color: #93c5fd;
}

.table-scroll {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--bg-panel);
}

.compare-table {
  width: 100%;
  border-collapse: collapse;
  min-width: 640px;
  font-size: 14px;
}

.compare-table th,
.compare-table td {
  padding: 12px 14px;
  text-align: left;
  border-bottom: 1px solid var(--border);
  vertical-align: top;
}

.compare-table thead th {
  background: #1a1f2b;
  color: var(--text-strong);
  font-weight: 700;
}

.compare-table tbody tr:last-child td {
  border-bottom: none;
}

.compare-table td:first-child {
  font-weight: 600;
  color: var(--accent-soft);
  white-space: nowrap;
}

/* Responsive adjustments for laptop & tablet viewports */
@media (max-width: 1340px) {
  .privacy-pill {
    display: none;
  }
}

@media (max-width: 1200px) {
  .size-control {
    display: none;
  }
  .top-bar {
    padding: 0 10px;
    gap: 6px;
  }
  .top-bar .btn {
    padding: 5px 9px;
    font-size: 12px;
  }
  .control-panel {
    width: 375px;
    min-width: 340px;
  }
}

@media (max-width: 960px) {
  .app-shell {
    height: auto;
    min-height: 100dvh;
  }
  .top-bar {
    height: auto;
    padding: 8px 12px;
    flex-wrap: wrap;
  }
  .privacy-pill,
  .size-control {
    display: none;
  }
  .workspace {
    flex-direction: column;
  }
  .gallery-pane {
    min-height: 360px;
    border-right: none;
    border-bottom: 1px solid var(--border);
  }
  .control-panel {
    width: 100%;
    max-width: none;
    min-width: 0;
  }
  .status-bar {
    flex-wrap: wrap;
  }
  .site-guide-wrap {
    padding: 40px 16px 32px;
  }
  .guide-hero h2 {
    font-size: 24px;
  }
  .feature-grid {
    grid-template-columns: 1fr;
  }
}

/* ---- Native-Like Mobile Photo Editor Layout (<= 768px) ---- */
@media (max-width: 768px) {
  .desktop-only-inline,
  .desktop-only-block {
    display: none !important;
  }

  .mobile-only-flex {
    display: inline-flex;
    align-items: center;
    justify-content: center;
  }

  .app-shell {
    min-height: 100dvh;
    padding-bottom: 66px; /* Space for fixed mobile export footer */
  }

  /* Compact sticky mobile top bar */
  .top-bar {
    position: sticky;
    top: 0;
    z-index: 60;
    padding: calc(8px + env(safe-area-inset-top)) 10px 8px;
    flex-wrap: nowrap;
    gap: 6px;
    min-height: 50px;
  }

  .top-bar-left {
    flex: 1;
    min-width: 0;
    gap: 6px;
  }

  .top-bar-right {
    gap: 6px;
  }

  .brand-title {
    font-size: 14px;
  }

  .brand-tag {
    display: none;
  }

  .top-bar .btn {
    padding: 6px 10px;
    min-height: 34px;
    font-size: 12px;
  }

  .count-badge {
    padding: 3px 7px;
    font-size: 11px;
  }

  .repo-link {
    display: none !important;
  }

  /* Pinned Live Preview Stage so sliders below update visible previews! */
  .gallery-pane {
    min-height: 0;
    position: sticky;
    top: calc(50px + env(safe-area-inset-top));
    z-index: 45;
    box-shadow: 0 6px 18px rgba(0, 0, 0, 0.35);
  }

  .mobile-gallery-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 6px 10px;
    background: #1a1e26;
    border-bottom: 1px solid #2a303d;
    gap: 8px;
  }

  .mobile-gallery-summary {
    font-size: 12px;
    font-weight: 700;
    color: var(--accent-soft);
  }

  .mobile-gallery-bar-actions {
    display: flex;
    align-items: center;
    gap: 6px;
  }

  .mobile-guide-pill {
    text-decoration: none;
    display: inline-flex;
    align-items: center;
  }

  .gallery-filter-bar {
    padding: 6px 10px;
  }

  .filter-label {
    display: none;
  }

  .empty-state {
    padding: 12px;
  }

  .drop-zone {
    padding: 20px 14px;
    gap: 8px;
  }

  .drop-icons {
    font-size: 32px;
  }

  .drop-zone h2 {
    font-size: 15px;
  }

  .drop-sub {
    font-size: 12px;
    line-height: 1.5;
  }

  .drop-actions .btn {
    min-height: 42px;
    padding: 8px 18px;
    font-size: 14px;
  }

  .gallery-scroll {
    max-height: 36dvh;
    padding: 10px;
    gap: 12px;
    transition: max-height 0.2s ease;
  }

  .gallery-pane.mobile-expanded .gallery-scroll {
    max-height: 68dvh;
  }

  /* Fluid 2-column mobile photo grid — zero wasted right margin */
  .media-grid {
    --card-w: auto;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
  }

  .preview-card {
    width: 100%;
    padding: 5px 5px 6px;
  }

  .card-icon-btn {
    width: 32px;
    height: 32px;
    font-size: 14px;
  }

  .card-name {
    font-size: 11px;
  }

  .card-meta {
    font-size: 10px;
  }

  .status-bar {
    display: none;
  }

  /* Mobile Parameter Tab Bar */
  .mobile-param-tabs {
    display: flex;
    align-items: stretch;
    gap: 4px;
    padding: 6px 8px;
    background: var(--bg-panel);
    border-bottom: 1px solid var(--border);
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }

  .mobile-tab-btn {
    flex: 1 0 auto;
    min-height: 36px;
    padding: 6px 10px;
    border-radius: 7px;
    border: 1px solid transparent;
    background: transparent;
    color: var(--text-muted);
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    white-space: nowrap;
  }

  .mobile-tab-btn.active {
    background: var(--accent-hover);
    border-color: #60a5fa;
    color: #ffffff;
  }

  .panel-scroll {
    padding: 10px 10px 18px;
    overflow: visible;
  }

  /* Show only the selected tab's parameter cards on mobile */
  .control-panel[data-active-mobile-tab] .section-card[data-tab-group] {
    display: none;
  }
  .control-panel[data-active-mobile-tab="content"] .section-card[data-tab-group="content"],
  .control-panel[data-active-mobile-tab="style"] .section-card[data-tab-group="style"],
  .control-panel[data-active-mobile-tab="layout"] .section-card[data-tab-group="layout"],
  .control-panel[data-active-mobile-tab="preset"] .section-card[data-tab-group="preset"],
  .control-panel[data-active-mobile-tab="export"] .section-card[data-tab-group="export"] {
    display: flex;
  }

  /* Touch-friendly controls & 16px inputs to prevent iOS Safari focus zoom */
  .input-text,
  .input-textarea,
  .input-select,
  .input-num {
    font-size: 16px;
    min-height: 40px;
    padding: 7px 10px;
  }

  .input-num {
    width: 72px;
  }

  .btn-segmented,
  .preset-actions .btn,
  .quick-angles .btn-pill {
    min-height: 38px;
  }

  .swatch {
    width: 30px;
    height: 30px;
    border-radius: 6px;
  }

  .color-row {
    flex-wrap: wrap;
  }

  .anchor-grid {
    grid-template-columns: repeat(3, 48px);
    gap: 8px;
  }

  .anchor-btn {
    width: 48px;
    height: 42px;
    font-size: 17px;
  }

  .checkbox-row {
    min-height: 34px;
    font-size: 13px;
  }

  .checkbox-row input[type="checkbox"] {
    width: 18px;
    height: 18px;
  }

  input[type="range"] {
    height: 28px;
  }

  /* Fixed Bottom Export Bar with safe-area padding */
  .export-footer {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 70;
    padding: 8px 10px calc(8px + env(safe-area-inset-bottom));
    box-shadow: 0 -6px 20px rgba(0, 0, 0, 0.45);
  }

  .export-footer .btn {
    min-height: 44px;
    font-size: 14px;
  }

  /* Fullscreen Mobile Lightbox */
  .modal-backdrop {
    padding: 0;
  }

  .lightbox-card {
    width: 100vw;
    height: 100dvh;
    border-radius: 0;
    border: none;
  }

  .modal-header {
    padding: calc(10px + env(safe-area-inset-top)) 12px 10px;
    flex-wrap: wrap;
    gap: 8px;
  }

  .modal-title {
    font-size: 13px;
    width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .modal-header-actions {
    width: 100%;
    justify-content: space-between;
  }

  .modal-header-actions .btn {
    flex: 1;
    min-height: 38px;
  }

  .lightbox-video-bar {
    flex-wrap: wrap;
    padding: 10px 12px calc(10px + env(safe-area-inset-bottom));
  }

  .toast-host {
    bottom: calc(74px + env(safe-area-inset-bottom));
    width: calc(100vw - 24px);
    align-items: center;
  }

  .site-guide-wrap {
    padding: 32px 14px calc(88px + env(safe-area-inset-bottom));
  }

  .facts-grid {
    grid-template-columns: 1fr;
  }

  /* ---- Mobile Dual-Mode Top Tab Bar & Creative Mode ---- */
  .mode-tab-bar {
    position: sticky;
    top: 0;
    z-index: 65;
    height: auto;
    padding: calc(6px + env(safe-area-inset-top)) 10px 6px;
  }

  .mode-bar-left {
    flex: 1;
    min-width: 0;
    justify-content: flex-start;
    gap: 6px;
  }

  .mode-bar-left .brand-title,
  .mode-bar-left .brand-tag {
    display: none;
  }

  .mode-bar-right {
    display: flex;
    gap: 4px;
    flex-shrink: 0;
  }

  .mode-bar-right .privacy-pill,
  .mode-bar-right .repo-link {
    display: none;
  }

  .lang-select {
    max-width: 96px;
    padding: 3px 4px;
    font-size: 11.5px;
    height: 32px;
  }

  .mode-tab-btn {
    padding: 6px 10px;
    font-size: 12.5px;
  }

  .top-bar {
    position: static;
    padding: 6px 10px;
  }

  .creative-toolbar {
    height: auto;
    flex-wrap: wrap;
    gap: 6px;
    padding: 6px 10px;
  }

  .creative-toolbar .top-bar-left,
  .creative-toolbar .top-bar-right {
    flex-wrap: wrap;
    gap: 6px;
  }

  .creative-workspace {
    display: flex;
    flex-direction: column;
    overflow: visible;
    padding-bottom: calc(74px + env(safe-area-inset-bottom));
  }

  .creative-stage-pane {
    order: 1;
    height: 40dvh;
    min-height: 240px;
    border-bottom: 1px solid var(--border);
  }

  .creative-mobile-tabs {
    order: 2;
    display: flex;
    position: sticky;
    top: 46px;
    z-index: 50;
  }

  .creative-lib-pane,
  .creative-right-pane {
    order: 3;
    border: none;
    height: auto;
    overflow: visible;
  }

  .creative-workspace [data-creative-panel] {
    display: none !important;
  }

  .creative-workspace[data-mobile-creative-tab="auto"] [data-creative-panel="auto"],
  .creative-workspace[data-mobile-creative-tab="library"] [data-creative-panel="library"],
  .creative-workspace[data-mobile-creative-tab="layer"] [data-creative-panel="layer"],
  .creative-workspace[data-mobile-creative-tab="export"] [data-creative-panel="export"] {
    display: flex !important;
  }

  .creative-workspace[data-mobile-creative-tab="auto"] .creative-lib-pane,
  .creative-workspace[data-mobile-creative-tab="layer"] .creative-lib-pane,
  .creative-workspace[data-mobile-creative-tab="export"] .creative-lib-pane {
    display: none !important;
  }

  .creative-workspace[data-mobile-creative-tab="library"] .creative-right-pane .panel-scroll {
    display: none !important;
  }

  .creative-lib-list {
    max-height: none;
    overflow: visible;
  }
}
