/* ========================================
   Neon Atelier — Premium LED Studio
   Display: Sora | Body: DM Sans
   Theme: Obsidian + Vibrant Gradient Glow
======================================== */

:root {
  --bg-base: #060610;
  --bg-surface: #0d0d1a;
  --bg-elevated: #14142b;
  --glass: rgba(255, 255, 255, 0.04);
  --glass-hover: rgba(255, 255, 255, 0.07);
  --glass-border: rgba(255, 255, 255, 0.08);
  --glass-border-bright: rgba(255, 255, 255, 0.14);
  --glass-surface: rgba(17, 15, 35, 0.68);
  --glass-surface-strong: rgba(17, 15, 35, 0.82);
  --glass-surface-soft: rgba(255, 255, 255, 0.035);
  --glass-stroke: rgba(255, 255, 255, 0.11);
  --glass-highlight: rgba(255, 255, 255, 0.075);
  --glass-filter: blur(18px) saturate(135%);
  --glass-shadow: 0 18px 48px rgba(0, 0, 0, 0.3), inset 0 1px 0 var(--glass-highlight);
  --interaction-hover: rgba(124, 58, 237, 0.13);
  --interaction-pressed: rgba(124, 58, 237, 0.2);
  --interaction-focus: rgba(167, 139, 250, 0.72);
  --interaction-ring: 0 0 0 3px rgba(124, 58, 237, 0.18);
  --divider-soft: rgba(255, 255, 255, 0.055);
  --panel-fill-soft: rgba(255, 255, 255, 0.026);
  --type-heading: #f4f2fb;
  --type-label: rgba(232, 229, 242, 0.66);
  --type-caption: rgba(221, 217, 234, 0.5);
  --type-data: #f0ecfb;
  --state-success: #52d39a;
  --state-warning: #f3bd62;
  --state-error: #f87171;
  --state-info: #a78bfa;

  --accent-1: #7c3aed;
  --accent-2: #ec4899;
  --accent-3: #f59e0b;
  --accent-glow: rgba(124, 58, 237, 0.5);

  --danger: #ef4444;
  --danger-glow: rgba(239, 68, 68, 0.4);

  --text-primary: #f8f8ff;
  --text-secondary: rgba(248, 248, 255, 0.65);
  --text-muted: rgba(248, 248, 255, 0.52);

  --shadow-card: 0 10px 28px rgba(0, 0, 0, 0.24);

  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --radius-xl: 20px;

  --font-display: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'PingFang SC', 'Microsoft YaHei', sans-serif;
  --font-body: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'PingFang SC', 'Microsoft YaHei', sans-serif;
}

[hidden] {
  display: none !important;
}

/* Desktop content layer manager */
.desktop-layer-panel {
  display: none;
}

.desktop-layer-grip {
  display: none;
}

.desktop-layer-panel[hidden] {
  display: none !important;
}

@media (min-width: 768px) and (min-height: 521px) {
  .desktop-layer-panel:not([hidden]) {
    display: block;
    margin: 0 0 12px;
    overflow: hidden;
    border: 1px solid rgba(196, 181, 253, 0.18);
    border-radius: 14px;
    background: rgba(16, 16, 32, 0.58);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.035);
  }

  .desktop-layer-panel > summary {
    min-height: 46px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 0 13px;
    color: #f5f3ff;
    cursor: pointer;
    list-style: none;
  }

  .desktop-layer-panel > summary::-webkit-details-marker {
    display: none;
  }

  .desktop-layer-panel > summary::after {
    content: '⌄';
    margin-left: auto;
    color: #8f8ba2;
    transition: transform 160ms ease;
  }

  .desktop-layer-panel:not([open]) > summary::after {
    transform: rotate(-90deg);
  }

  .desktop-layer-panel > summary strong {
    font-size: 13px;
  }

  .desktop-layer-panel > summary span {
    color: #8f8ba2;
    font-size: 11px;
  }

  .desktop-layer-body {
    display: grid;
    gap: 8px;
    padding: 0 10px 10px;
    border-top: 1px solid rgba(255, 255, 255, 0.06);
  }

  .desktop-layer-help {
    margin: 8px 0 -2px;
    color: #858196;
    font-size: 10px;
    line-height: 1.4;
  }

  .desktop-layer-list {
    max-height: 220px;
    display: grid;
    gap: 6px;
    padding: 9px 0;
    overflow-y: auto;
    overscroll-behavior: contain;
    scrollbar-width: thin;
  }

  .desktop-layer-list .mobile-layer-item {
    position: relative;
    min-width: 0;
    min-height: 48px;
    display: grid;
    grid-template-columns: minmax(0, 1fr) 44px;
    align-items: center;
    gap: 7px;
    padding-right: 3px;
    border: 1px solid rgba(255, 255, 255, 0.075);
    border-radius: 10px;
    background: rgba(255, 255, 255, 0.025);
    transition: border-color 160ms ease, background-color 160ms ease;
  }

  .desktop-layer-list .mobile-layer-item.active {
    border-color: rgba(103, 232, 249, 0.46);
    background: rgba(8, 145, 178, 0.12);
    box-shadow: inset 3px 0 0 #22d3ee;
  }

  .desktop-layer-list .mobile-layer-item.is-hidden {
    border-style: dashed;
  }

  .desktop-layer-list .mobile-layer-item.dragging {
    opacity: 0.42;
  }

  .desktop-layer-list .mobile-layer-item.drop-before::before,
  .desktop-layer-list .mobile-layer-item.drop-after::after {
    content: '';
    position: absolute;
    left: 7px;
    right: 7px;
    z-index: 2;
    height: 2px;
    border-radius: 2px;
    background: #22d3ee;
    box-shadow: 0 0 0 2px rgba(34, 211, 238, 0.13), 0 0 10px rgba(34, 211, 238, 0.65);
    pointer-events: none;
  }

  .desktop-layer-list .mobile-layer-item.drop-before::before {
    top: -5px;
  }

  .desktop-layer-list .mobile-layer-item.drop-after::after {
    bottom: -5px;
  }

  .desktop-layer-list .mobile-layer-select {
    min-width: 0;
    min-height: 48px;
    display: grid;
    grid-template-columns: 16px 32px minmax(0, 1fr) auto;
    align-items: center;
    gap: 8px;
    padding: 4px 3px 4px 8px;
    border: 0;
    border-radius: 9px;
    color: inherit;
    background: transparent;
    text-align: left;
    cursor: pointer;
  }

  .desktop-layer-list .desktop-layer-grip {
    width: 16px;
    height: 32px;
    display: grid;
    place-items: center;
    color: #77738a;
    cursor: grab;
    user-select: none;
  }

  .desktop-layer-list .desktop-layer-grip:active {
    cursor: grabbing;
  }

  .desktop-layer-list .desktop-layer-grip svg {
    width: 14px;
    height: 22px;
    fill: currentColor;
  }

  .desktop-layer-list .mobile-layer-item.is-hidden .mobile-layer-select {
    opacity: 0.56;
  }

  .desktop-layer-list .mobile-layer-type {
    width: 30px;
    height: 30px;
    display: grid;
    place-items: center;
    border-radius: 8px;
    color: #ddd6fe;
    background: rgba(124, 58, 237, 0.2);
    font-size: 11px;
    font-weight: 750;
  }

  .desktop-layer-list .mobile-layer-type.is-image-preview {
    overflow: hidden;
    padding: 0;
    border: 1px solid rgba(103, 232, 249, 0.25);
    background: #090b14;
  }

  .desktop-layer-list .mobile-layer-thumbnail {
    width: 100%;
    height: 100%;
    display: block;
    object-fit: cover;
    pointer-events: none;
  }

  .desktop-layer-list .mobile-layer-type.is-text-preview {
    font-size: 12px;
  }

  .desktop-layer-list .mobile-layer-copy {
    min-width: 0;
    display: grid;
    gap: 1px;
  }

  .desktop-layer-list .mobile-layer-copy strong,
  .desktop-layer-list .mobile-layer-copy small {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .desktop-layer-list .mobile-layer-copy strong {
    color: #f5f3ff;
    font-size: 12px;
  }

  .desktop-layer-list .mobile-layer-copy small,
  .desktop-layer-list .mobile-layer-order {
    color: #918da4;
    font-size: 9px;
  }

  .desktop-layer-list .mobile-layer-order {
    white-space: nowrap;
  }

  .desktop-layer-list .mobile-layer-visibility {
    width: 40px;
    min-width: 40px;
    height: 40px;
    min-height: 40px;
    display: grid;
    place-items: center;
    padding: 0;
    border: 1px solid rgba(103, 232, 249, 0.14);
    border-radius: 9px;
    color: #a5f3fc;
    background: rgba(8, 145, 178, 0.1);
    cursor: pointer;
  }

  .desktop-layer-list .mobile-layer-visibility svg {
    width: 18px;
    height: 18px;
    fill: none;
    stroke: currentColor;
    stroke-width: 1.8;
    stroke-linecap: round;
    stroke-linejoin: round;
  }

  .desktop-layer-list .mobile-layer-item.is-hidden .mobile-layer-visibility {
    color: #c4b5fd;
    background: rgba(124, 58, 237, 0.16);
  }

  .desktop-layer-actions {
    display: grid;
    grid-template-columns: repeat(5, minmax(0, 1fr));
    gap: 6px;
  }

  .desktop-layer-actions button,
  .desktop-layer-rename-form button {
    min-width: 0;
    min-height: 38px;
    padding: 0 4px;
    border: 1px solid rgba(255, 255, 255, 0.09);
    border-radius: 8px;
    color: rgba(255, 255, 255, 0.84);
    background: rgba(255, 255, 255, 0.055);
    font-size: 10px;
    cursor: pointer;
  }

  .desktop-layer-actions button:disabled {
    opacity: 0.34;
    cursor: not-allowed;
  }

  .desktop-layer-actions .desktop-layer-delete {
    color: #fecdd3;
    background: rgba(225, 29, 72, 0.12);
  }

  .desktop-layer-rename-form:not([hidden]) {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 52px 52px;
    align-items: center;
    gap: 6px;
    padding: 7px;
    border: 1px solid rgba(103, 232, 249, 0.24);
    border-radius: 10px;
    background: rgba(8, 47, 73, 0.34);
  }

  .desktop-layer-rename-form label {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
  }

  .desktop-layer-rename-form input {
    width: 100%;
    min-width: 0;
    min-height: 38px;
    padding: 0 9px;
    border: 1px solid rgba(255, 255, 255, 0.14);
    border-radius: 8px;
    outline: none;
    color: #fff;
    background: rgba(255, 255, 255, 0.06);
    font-size: 13px;
  }

  .desktop-layer-rename-form input:focus,
  .desktop-layer-list button:focus-visible,
  .desktop-layer-actions button:focus-visible {
    border-color: #67e8f9;
    box-shadow: 0 0 0 3px rgba(34, 211, 238, 0.13);
  }
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}

button,
input,
textarea {
  font: inherit;
}

.tab-item,
.border-width-item,
.add-btn,
.screen-edit-mode-btn,
.rotate-btn,
.rotate-reset,
.ai-angle-item {
  appearance: none;
  color: inherit;
}

button:focus-visible,
input:focus-visible,
textarea:focus-visible,
summary:focus-visible,
[tabindex]:focus-visible {
  outline: 3px solid #c4b5fd;
  outline-offset: 3px;
}

.ui-icon {
  width: 1em;
  height: 1em;
  display: block;
  flex: 0 0 auto;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

html, body {
  height: 100%;
  font-family: var(--font-body);
  background: var(--bg-base);
  color: var(--text-primary);
  overflow: hidden;
  -webkit-font-smoothing: antialiased;
}

/* Mesh gradient atmosphere */
body::before {
  content: '';
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background:
    radial-gradient(ellipse 80% 50% at 20% 0%, rgba(124, 58, 237, 0.15) 0%, transparent 60%),
    radial-gradient(ellipse 60% 40% at 80% 20%, rgba(236, 72, 153, 0.1) 0%, transparent 55%),
    radial-gradient(ellipse 50% 30% at 50% 100%, rgba(245, 158, 11, 0.06) 0%, transparent 50%);
  pointer-events: none;
  z-index: 0;
}

/* Noise texture overlay */
body::after {
  content: '';
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 200 200' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='3' /%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='0.4'/%3E%3C/svg%3E");
  opacity: 0.03;
  pointer-events: none;
  z-index: 0;
}

#app {
  height: 100%;
  position: relative;
  z-index: 1;
}

.page {
  position: absolute;
  top: 0; left: 0;
  width: 100%; height: 100%;
  display: none;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}

.page.active {
  display: block;
  animation: pageEnter 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes pageEnter {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

/* ===== Index Page ===== */

.page-index {
  background: transparent;
  padding: 20px;
}

.container {
  max-width: 580px;
  margin: 0 auto;
  padding-top: 24px;
}

/* Hero Section — dramatic glass with glow */
.hero-section {
  background: linear-gradient(135deg, rgba(124, 58, 237, 0.1) 0%, rgba(236, 72, 153, 0.06) 50%, rgba(245, 158, 11, 0.04) 100%);
  border-radius: var(--radius-xl);
  padding: 44px 28px 36px;
  margin-bottom: 28px;
  text-align: center;
  border: 1px solid var(--glass-border);
  position: relative;
  overflow: hidden;
  backdrop-filter: blur(20px);
}

.hero-section::before {
  content: '';
  position: absolute;
  top: -60%; left: -20%;
  width: 140%; height: 140%;
  background:
    radial-gradient(circle at 30% 30%, rgba(124, 58, 237, 0.2) 0%, transparent 45%),
    radial-gradient(circle at 70% 70%, rgba(236, 72, 153, 0.15) 0%, transparent 45%);
  pointer-events: none;
  animation: meshFloat 8s ease-in-out infinite alternate;
}

.home-draft-card {
  position: relative;
  margin: -10px 0 28px;
  padding: 14px;
  display: grid;
  grid-template-columns: 156px minmax(0, 1fr) auto;
  align-items: center;
  gap: 16px;
  overflow: hidden;
  border: 1px solid rgba(103, 232, 249, 0.22);
  border-radius: 18px;
  background: linear-gradient(135deg, rgba(8, 145, 178, 0.12), rgba(124, 58, 237, 0.08)), rgba(15, 15, 31, 0.84);
  box-shadow: 0 14px 38px rgba(0, 0, 0, 0.24), inset 0 1px 0 rgba(255, 255, 255, 0.06);
  -webkit-backdrop-filter: blur(18px) saturate(125%);
  backdrop-filter: blur(18px) saturate(125%);
}

.home-draft-card[hidden] {
  display: none;
}

.home-draft-thumb {
  position: relative;
  width: 156px;
  height: 104px;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 12px;
  background: #090b14;
}

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

.home-draft-thumb > svg {
  position: absolute;
  inset: 50% auto auto 50%;
  width: 28px;
  height: 28px;
  display: none;
  fill: none;
  stroke: #94a3b8;
  stroke-width: 1.6;
  stroke-linecap: round;
  stroke-linejoin: round;
  transform: translate(-50%, -50%);
}

.home-draft-thumb.is-broken img {
  display: none;
}

.home-draft-thumb.is-broken > svg {
  display: block;
}

.home-draft-copy {
  min-width: 0;
  display: grid;
  gap: 5px;
}

.home-draft-eyebrow {
  color: #67e8f9;
  font-size: 10px;
  font-weight: 750;
  letter-spacing: 0.08em;
}

.home-draft-copy h2 {
  margin: 0;
  color: var(--text-primary);
  font-family: var(--font-display);
  font-size: 17px;
  line-height: 1.25;
}

.home-draft-copy > strong {
  overflow: hidden;
  color: #e2e8f0;
  font-size: 13px;
  line-height: 1.35;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.home-draft-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 5px 10px;
  color: var(--text-secondary);
  font-size: 11px;
  line-height: 1.4;
  font-variant-numeric: tabular-nums;
}

.home-draft-meta span::before {
  content: '·';
  margin-right: 10px;
  color: rgba(148, 163, 184, 0.55);
}

.home-draft-actions {
  display: grid;
  gap: 8px;
}

.home-draft-actions button {
  min-width: 116px;
  min-height: 44px;
  padding: 0 14px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 11px;
  color: var(--text-primary);
  font: 700 12px/1 var(--font-body);
  cursor: pointer;
  touch-action: manipulation;
  transition: color 180ms ease, border-color 180ms ease, background-color 180ms ease, transform 120ms ease;
}

.home-draft-continue {
  border-color: transparent !important;
  background: linear-gradient(135deg, var(--accent-1), var(--accent-2));
  box-shadow: 0 8px 22px rgba(124, 58, 237, 0.24);
}

.home-draft-discard {
  color: #cbd5e1 !important;
  background: rgba(255, 255, 255, 0.035);
}

.home-draft-actions button:hover {
  border-color: rgba(167, 139, 250, 0.36);
  background-color: rgba(124, 58, 237, 0.12);
}

.home-draft-actions button:active {
  transform: scale(0.97);
}

@media (max-width: 640px) {
  .home-draft-card {
    margin: -16px 0 22px;
    padding: 12px;
    grid-template-columns: 96px minmax(0, 1fr);
    gap: 12px;
    border-radius: 16px;
  }

  .home-draft-thumb {
    width: 96px;
    height: 78px;
    border-radius: 10px;
  }

  .home-draft-copy h2 {
    font-size: 15px;
  }

  .home-draft-meta {
    gap: 2px 7px;
    font-size: 10px;
  }

  .home-draft-meta span::before {
    margin-right: 7px;
  }

  .home-draft-actions {
    grid-column: 1 / -1;
    grid-template-columns: 1fr 1fr;
  }

  .home-draft-actions button {
    min-width: 0;
    min-height: 48px;
  }
}

@keyframes meshFloat {
  from { transform: translate(0, 0) rotate(0deg); }
  to { transform: translate(10px, -10px) rotate(2deg); }
}

.hero-title {
  font-family: var(--font-display);
  font-size: 30px;
  font-weight: 800;
  background: linear-gradient(135deg, #a78bfa 0%, #f472b6 50%, #fbbf24 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  margin-bottom: 8px;
  letter-spacing: 2px;
  position: relative;
  filter: drop-shadow(0 0 10px rgba(124, 58, 237, 0.32));
}

@keyframes titleGlow {
  from { filter: drop-shadow(0 0 8px rgba(124, 58, 237, 0.3)); }
  to { filter: drop-shadow(0 0 16px rgba(236, 72, 153, 0.4)); }
}

.hero-subtitle {
  font-family: var(--font-display);
  font-size: 18px;
  font-weight: 600;
  margin-bottom: 12px;
  letter-spacing: 1px;
  position: relative;
  color: var(--text-primary);
}

.hero-desc {
  font-size: 14px;
  color: var(--text-secondary);
  margin-bottom: 32px;
  line-height: 1.7;
  position: relative;
}

/* Hero Badge — breathing glow pill */
.hero-badge {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 6px 16px;
  background: linear-gradient(135deg, rgba(124, 58, 237, 0.2) 0%, rgba(236, 72, 153, 0.15) 100%);
  border: 1px solid rgba(124, 58, 237, 0.35);
  border-radius: 100px;
  font-family: var(--font-display);
  font-size: 12px;
  font-weight: 600;
  color: #c4b5fd;
  letter-spacing: 0.5px;
  margin-bottom: 18px;
  position: relative;
}

.hero-badge .ui-icon {
  font-size: 16px;
}

/* Primary CTA Button — premium gradient */
.upload-btn {
  width: 100%;
  height: 58px;
  background: linear-gradient(135deg, var(--accent-1) 0%, var(--accent-2) 45%, var(--accent-3) 100%);
  background-size: 200% 200%;
  color: #fff;
  border: none;
  border-radius: var(--radius-md);
  font-family: var(--font-display);
  font-size: 16px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  box-shadow:
    0 10px 30px rgba(124, 58, 237, 0.4),
    0 4px 12px rgba(236, 72, 153, 0.25),
    inset 0 1px 0 rgba(255, 255, 255, 0.3),
    inset 0 -2px 0 rgba(0, 0, 0, 0.15);
  position: relative;
  overflow: hidden;
  letter-spacing: 1.5px;
  cursor: pointer;
  transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
  animation: gradientShift 4s ease infinite;
}

@keyframes gradientShift {
  0%, 100% { background-position: 0% 50%; }
  50% { background-position: 100% 50%; }
}

.upload-btn::before {
  content: '';
  position: absolute;
  top: 0; left: -100%;
  width: 60%; height: 100%;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.4), transparent);
  opacity: 0;
}

@keyframes shimmer {
  0% { left: -60%; }
  100% { left: 120%; }
}

.upload-btn:active {
  transform: translateY(2px) scale(0.98);
  box-shadow:
    0 5px 15px rgba(124, 58, 237, 0.3),
    0 2px 6px rgba(236, 72, 153, 0.2),
    inset 0 1px 0 rgba(255, 255, 255, 0.2);
}

.upload-icon {
  font-size: 22px;
  font-weight: 300;
  text-shadow: 0 1px 4px rgba(0, 0, 0, 0.2);
  line-height: 1;
}

/* Hero Secondary Button — glass outline */
.hero-secondary-row {
  display: flex;
  gap: 10px;
  margin-top: 12px;
}

.hero-secondary-btn {
  flex: 1;
  height: 44px;
  background: transparent;
  color: var(--text-primary);
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: var(--radius-md);
  font-family: var(--font-display);
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.5px;
  cursor: pointer;
  transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

.hero-secondary-btn:active {
  background: rgba(124, 58, 237, 0.1);
  border-color: rgba(124, 58, 237, 0.3);
  transform: scale(0.97);
}

.home-ai-entry {
  margin-top: 12px;
  padding: 14px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  border: 1px solid rgba(192, 132, 252, 0.58);
  border-radius: var(--radius-md);
  background: linear-gradient(110deg, rgba(124, 58, 237, 0.3), rgba(236, 72, 153, 0.18));
  box-shadow: inset 0 1px rgba(255, 255, 255, 0.08), 0 8px 24px rgba(124, 58, 237, 0.12);
}

.home-ai-entry-copy { min-width: 0; display: grid; gap: 3px; text-align: left; }
.home-ai-entry-kicker { display: inline-flex; align-items: center; gap: 5px; color: #e9d5ff; font-size: 11px; font-weight: 850; letter-spacing: 1.1px; text-transform: uppercase; }
.home-ai-entry-kicker svg { width: 15px; height: 15px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.home-ai-entry-copy strong { color: #fff; font-size: 14px; line-height: 1.35; }
.home-ai-entry-copy small { color: rgba(226, 232, 240, 0.66); font-size: 11px; line-height: 1.35; }
.home-ai-entry button {
  flex: 0 0 auto;
  min-height: 38px;
  padding: 0 13px;
  border: 1px solid rgba(216, 180, 254, 0.42);
  border-radius: 9px;
  color: #fff;
  background: linear-gradient(135deg, #7c3aed, #db2777);
  font-size: 12px;
  font-weight: 750;
  cursor: pointer;
}
.home-ai-entry button:active { transform: scale(0.97); }

.ai-preview-box { position: relative; overflow: hidden; }
.ai-preview-box.is-region-editing { touch-action: none; }
.ai-region-handle { display: none; position: absolute; z-index: 2; width: 22px; height: 22px; padding: 0; margin: -11px 0 0 -11px; border: 2px solid #fff; border-radius: 50%; background: #06b6d4; box-shadow: 0 0 0 3px rgba(6, 182, 212, .28), 0 3px 10px rgba(0,0,0,.35); cursor: grab; touch-action: none; }
.ai-preview-box.is-region-editing .ai-region-handle { display: block; }
.ai-region-overlay { display: none; position: absolute; inset: 0; z-index: 1; width: 100%; height: 100%; pointer-events: none; overflow: visible; }
.ai-preview-box.is-region-editing .ai-region-overlay { display: block; }
.ai-region-overlay polygon { fill: rgba(6, 182, 212, .14); stroke: #22d3ee; stroke-width: 2; vector-effect: non-scaling-stroke; stroke-dasharray: 6 4; }
.ai-region-hint { margin-top: 7px; color: rgba(165, 243, 252, .86); font-size: 11px; line-height: 1.45; }

@media (max-width: 560px) {
  .home-ai-entry { align-items: stretch; flex-direction: column; }
  .home-ai-entry button { width: 100%; }
}

.project-import-btn {
  position: relative;
  width: 100%;
  min-height: 52px;
  margin-top: 10px;
  padding: 7px 14px;
  display: grid;
  grid-template-columns: 24px auto;
  grid-template-rows: auto auto;
  align-items: center;
  justify-content: center;
  column-gap: 10px;
  border: 1px solid rgba(103, 232, 249, 0.18);
  border-radius: var(--radius-md);
  background: linear-gradient(135deg, rgba(8, 145, 178, 0.09), rgba(124, 58, 237, 0.055));
  color: #dbeafe;
  font-family: var(--font-body);
  cursor: pointer;
  touch-action: manipulation;
  transition: border-color 180ms ease, background-color 180ms ease, transform 120ms ease, opacity 180ms ease;
}

.project-import-btn svg {
  grid-row: 1 / 3;
  width: 22px;
  height: 22px;
  fill: none;
  stroke: #67e8f9;
  stroke-width: 1.7;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.project-import-btn span { font-size: 13px; font-weight: 750; line-height: 1.3; }
.project-import-btn small { color: #8497a7; font-size: 10px; line-height: 1.35; }
.project-import-btn:hover { border-color: rgba(103, 232, 249, 0.34); background-color: rgba(8, 145, 178, 0.1); }
.project-import-btn:active { transform: scale(0.98); }
.project-import-btn:disabled { opacity: 0.5; cursor: wait; }

.home-drop-hint {
  display: none;
  align-items: center;
  justify-content: center;
  gap: 6px;
  margin-top: 10px;
  color: #718695;
  font-size: 10px;
  line-height: 1.4;
}

.home-drop-hint svg {
  width: 14px;
  height: 14px;
  fill: none;
  stroke: #67e8f9;
  stroke-width: 1.7;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.home-drop-overlay {
  position: absolute;
  inset: 10px;
  z-index: 20;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border: 2px dashed rgba(103, 232, 249, 0.74);
  border-radius: calc(var(--radius-xl) - 6px);
  background: linear-gradient(145deg, rgba(17, 13, 39, 0.95), rgba(6, 37, 49, 0.94));
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.05), 0 18px 50px rgba(0, 0, 0, 0.38);
  -webkit-backdrop-filter: blur(18px) saturate(130%);
  backdrop-filter: blur(18px) saturate(130%);
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transform: scale(0.985);
  transition: opacity 160ms ease, transform 160ms ease, visibility 160ms ease;
}

.hero-section.is-dragover .home-drop-overlay {
  opacity: 1;
  visibility: visible;
  transform: scale(1);
}

.hero-section.is-dragover { border-color: rgba(103, 232, 249, 0.58); }

.home-drop-overlay-icon {
  width: 54px;
  height: 54px;
  display: grid;
  place-items: center;
  border: 1px solid rgba(103, 232, 249, 0.36);
  border-radius: 50%;
  background: rgba(8, 145, 178, 0.14);
  color: #a5f3fc;
  box-shadow: 0 0 30px rgba(34, 211, 238, 0.14);
}

.home-drop-overlay-icon svg {
  width: 26px;
  height: 26px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.7;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.home-drop-overlay strong { color: #f5f3ff; font: 700 17px/1.3 var(--font-display); }
.home-drop-overlay span { color: #9fb3c1; font-size: 11px; }

@media (hover: hover) and (pointer: fine) {
  .home-drop-hint { display: flex; }
}

@media (prefers-reduced-motion: reduce) {
  .home-drop-overlay { transition: none; }
}

.project-export-btn {
  min-width: 146px;
  min-height: 40px;
  padding: 0 12px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  border: 1px solid rgba(103, 232, 249, 0.2);
  border-radius: 10px;
  background: rgba(8, 145, 178, 0.075);
  color: #c9f5fb;
  font: 700 12px/1 var(--font-body);
  cursor: pointer;
  touch-action: manipulation;
  transition: border-color 180ms ease, background-color 180ms ease, transform 120ms ease;
}

.editor-ai-btn {
  min-width: 148px;
  min-height: 40px;
  padding: 0 12px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  border: 1px solid rgba(216, 180, 254, 0.5);
  border-radius: 10px;
  background: linear-gradient(135deg, rgba(124, 58, 237, .82), rgba(219, 39, 119, .84));
  color: #fff;
  font: 800 12px/1 var(--font-body);
  cursor: pointer;
  touch-action: manipulation;
  box-shadow: 0 5px 18px rgba(168, 85, 247, .2);
  transition: filter 180ms ease, transform 120ms ease, box-shadow 180ms ease;
}

.editor-service-btn {
  min-height: 40px;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 0 13px;
  border: 1px solid rgba(45, 212, 191, .42);
  border-radius: 10px;
  background: rgba(13, 148, 136, .14);
  color: #b7fff4;
  font-weight: 700;
  cursor: pointer;
}
.editor-service-btn:hover { background: rgba(13, 148, 136, .26); border-color: #5eead4; }
.editor-service-btn svg { width: 17px; height: 17px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }

.home-text-image-card {
  margin: 18px 0 12px;
  padding: 18px 20px;
  border: 1px solid rgba(192, 132, 252, .38);
  border-radius: 16px;
  background: linear-gradient(110deg, rgba(76, 29, 149, .28), rgba(157, 23, 77, .22));
}
.home-text-image-heading h2 { margin: 4px 0 4px; font-size: 18px; color: #fff; }
.home-text-image-heading p { margin: 0 0 14px; color: #b8afd0; font-size: 13px; }
.home-text-image-kicker { color: #c4b5fd; font-size: 11px; letter-spacing: .14em; text-transform: uppercase; }
.home-text-image-label, .service-request-form label > span, .service-request-files > span { display: block; margin-bottom: 7px; color: #eee8ff; font-size: 13px; font-weight: 700; }
#text-image-prompt, #service-request-description { width: 100%; min-height: 72px; resize: vertical; border: 1px solid rgba(196, 181, 253, .24); border-radius: 10px; padding: 11px 12px; color: #fff; background: rgba(3, 2, 16, .56); outline: none; }
#text-image-prompt:focus, #service-request-description:focus { border-color: #a78bfa; box-shadow: 0 0 0 3px rgba(167, 139, 250, .16); }
.text-image-style-list { display: flex; flex-wrap: wrap; gap: 8px; margin: 11px 0; }
.text-image-style-btn, .home-text-image-result-actions button, #service-request-file-select { min-height: 38px; padding: 0 12px; border-radius: 9px; border: 1px solid rgba(196, 181, 253, .28); background: rgba(20, 15, 48, .62); color: #cfc5e8; cursor: pointer; }
.text-image-style-btn.active, .text-image-style-btn:hover { color: #fff; border-color: #c084fc; background: rgba(126, 34, 206, .32); }
.home-text-image-actions { display: flex; align-items: center; gap: 12px; }
.home-text-image-generate, #service-request-submit { min-height: 42px; padding: 0 18px; border: 0; border-radius: 10px; color: #fff; background: linear-gradient(100deg, #7c3aed, #db2777); font-weight: 800; cursor: pointer; }
.home-text-image-generate:disabled, #service-request-submit:disabled { opacity: .55; cursor: wait; }
.home-text-image-note { color: #a99cc7; font-size: 12px; }
.home-text-image-result { margin-top: 16px; padding-top: 14px; border-top: 1px solid rgba(255,255,255,.1); }
.home-text-image-result img { width: 100%; max-height: 360px; object-fit: contain; border-radius: 10px; background: #090714; }
.home-text-image-result-actions { display: flex; gap: 8px; margin-top: 10px; }
.service-request-card { width: min(560px, calc(100vw - 28px)); max-height: min(760px, calc(100vh - 28px)); overflow: auto; }
.service-request-form { display: grid; gap: 14px; }
.service-request-form select, .service-request-form input { width: 100%; min-height: 42px; padding: 0 11px; border: 1px solid rgba(196,181,253,.24); border-radius: 9px; color: #fff; background: rgba(3,2,16,.56); }
.service-request-form textarea { min-height: 110px; }
.service-request-files { display: grid; gap: 8px; }
.service-request-files small { color: #aaa1bd; }
.service-request-consent { display: flex; align-items: flex-start; gap: 8px; color: #b8afd0; font-size: 12px; line-height: 1.5; }
.service-request-consent input { width: 16px; height: 16px; margin-top: 2px; flex: 0 0 auto; }
.service-request-success { padding: 20px 0 4px; color: #e9ddff; text-align: center; }
.service-request-success strong { display: block; font-size: 20px; color: #fff; }
.service-request-success p { margin: 12px 0 6px; }
.service-request-success small { display: block; color: #b8afd0; margin-bottom: 16px; }

.editor-ai-btn svg {
  width: 17px;
  height: 17px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.editor-ai-btn:hover { filter: brightness(1.1); box-shadow: 0 7px 22px rgba(168, 85, 247, .32); }
.editor-ai-btn:active { transform: scale(.97); }

.project-export-btn svg {
  width: 17px;
  height: 17px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.project-export-btn kbd {
  min-width: 32px;
  padding: 3px 5px;
  border: 1px solid rgba(255, 255, 255, 0.13);
  border-bottom-color: rgba(255, 255, 255, 0.22);
  border-radius: 5px;
  background: rgba(255, 255, 255, 0.055);
  color: #8fa9b5;
  font: 600 9px/1 var(--font-body);
  letter-spacing: 0;
  box-shadow: inset 0 -1px 0 rgba(0, 0, 0, 0.25);
  white-space: nowrap;
}

.project-export-btn:hover { border-color: rgba(103, 232, 249, 0.4); background: rgba(8, 145, 178, 0.13); }
.project-export-btn:active { transform: scale(0.97); }

.shortcut-help-btn {
  position: relative;
  width: 40px;
  height: 40px;
  flex: 0 0 40px;
  display: grid;
  place-items: center;
  padding: 0;
  border: 1px solid rgba(196, 181, 253, 0.18);
  border-radius: 10px;
  background: rgba(124, 58, 237, 0.07);
  color: #c4b5fd;
  cursor: pointer;
  touch-action: manipulation;
  transition: border-color 180ms ease, background-color 180ms ease, transform 120ms ease;
}

.shortcut-help-btn svg {
  width: 18px;
  height: 18px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.shortcut-help-tooltip {
  position: absolute;
  z-index: 30;
  top: calc(100% + 10px);
  right: -4px;
  width: max-content;
  max-width: 180px;
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 8px 10px;
  border: 1px solid rgba(196, 181, 253, 0.2);
  border-radius: 9px;
  background: rgba(18, 16, 33, 0.94);
  color: #e9e7f5;
  font: 600 11px/1 var(--font-body);
  white-space: nowrap;
  box-shadow: 0 10px 26px rgba(0, 0, 0, 0.42), inset 0 1px 0 rgba(255, 255, 255, 0.06);
  -webkit-backdrop-filter: blur(14px) saturate(125%);
  backdrop-filter: blur(14px) saturate(125%);
  pointer-events: none;
  opacity: 0;
  visibility: hidden;
  transform: translateY(-4px);
  transition: opacity 160ms ease-out, transform 160ms ease-out, visibility 0s linear 160ms;
}

.shortcut-help-tooltip::before {
  content: '';
  position: absolute;
  right: 17px;
  bottom: 100%;
  border: 5px solid transparent;
  border-bottom-color: rgba(18, 16, 33, 0.94);
}

.shortcut-help-tooltip kbd {
  min-width: 21px;
  padding: 3px 5px;
  border: 1px solid rgba(196, 181, 253, 0.24);
  border-radius: 5px;
  background: rgba(124, 58, 237, 0.14);
  color: #ddd6fe;
  font: 700 10px/1 var(--font-body);
  text-align: center;
}

@media (min-width: 641px) and (hover: hover) and (pointer: fine) {
  .shortcut-help-btn:hover .shortcut-help-tooltip,
  .shortcut-help-btn:focus-visible .shortcut-help-tooltip {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
    transition-delay: 240ms, 240ms, 0s;
  }
}

.shortcut-help-btn:hover,
.shortcut-help-btn:focus-visible { border-color: rgba(196, 181, 253, 0.42); background: rgba(124, 58, 237, 0.13); }
.shortcut-help-btn:active { transform: scale(0.96); }

.shortcut-help-btn::after {
  content: '';
  position: absolute;
  inset: -5px;
  pointer-events: none;
  border: 1px solid rgba(196, 181, 253, 0.62);
  border-radius: 14px;
  opacity: 0;
  transform: scale(0.88);
}

.shortcut-help-btn.is-discovering {
  border-color: rgba(196, 181, 253, 0.68);
  background: rgba(124, 58, 237, 0.2);
  color: #ede9fe;
}

.shortcut-help-btn.is-discovering::after {
  animation: shortcutHelpRing 1.35s ease-out 3;
}

@keyframes shortcutHelpRing {
  0% { opacity: 0; transform: scale(0.88); }
  24% { opacity: 0.9; }
  100% { opacity: 0; transform: scale(1.16); }
}

.shortcut-help-modal {
  position: fixed;
  inset: 0;
  z-index: 2320;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.shortcut-help-mask {
  position: absolute;
  inset: 0;
  background: rgba(2, 3, 8, 0.76);
  -webkit-backdrop-filter: blur(9px);
  backdrop-filter: blur(9px);
}

.shortcut-help-card {
  position: relative;
  width: min(100%, 440px);
  max-height: calc(100dvh - 40px);
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 22px;
  border: 1px solid rgba(255, 255, 255, 0.13);
  border-radius: 20px;
  background: linear-gradient(145deg, rgba(29, 25, 52, 0.96), rgba(13, 13, 26, 0.94));
  box-shadow: 0 26px 72px rgba(0, 0, 0, 0.56), inset 0 1px 0 rgba(255, 255, 255, 0.06);
  -webkit-backdrop-filter: blur(22px) saturate(130%);
  backdrop-filter: blur(22px) saturate(130%);
  animation: aiModalIn 220ms cubic-bezier(0.16, 1, 0.3, 1);
}

.shortcut-help-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 8px;
}

.shortcut-help-header > div { display: grid; gap: 4px; }
.shortcut-help-header span { color: #67e8f9; font-size: 9px; font-weight: 800; letter-spacing: 0.13em; }
.shortcut-help-header h2 { margin: 0; color: #f5f3ff; font: 700 20px/1.25 var(--font-display); }

.shortcut-help-header button {
  width: 44px;
  height: 44px;
  flex: 0 0 44px;
  display: grid;
  place-items: center;
  padding: 0;
  border: 1px solid rgba(255, 255, 255, 0.11);
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.055);
  color: #cbd5e1;
  font-size: 22px;
  cursor: pointer;
}

.shortcut-help-header button:focus-visible { outline: 3px solid rgba(103, 232, 249, 0.42); outline-offset: 2px; }
.shortcut-help-card > p { margin: 0 0 16px; color: #8f9bac; font-size: 12px; line-height: 1.55; }

.shortcut-help-sections {
  display: grid;
  gap: 16px;
}

.shortcut-help-section {
  display: grid;
  gap: 8px;
}

.shortcut-help-section-heading {
  min-height: 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 0 2px;
}

.shortcut-help-section-heading h3 {
  margin: 0;
  color: #cbd5e1;
  font: 700 11px/1.3 var(--font-body);
  letter-spacing: 0.04em;
}

.shortcut-help-section-heading span {
  padding: 4px 8px;
  border: 1px solid rgba(103, 232, 249, 0.16);
  border-radius: 999px;
  background: rgba(8, 145, 178, 0.09);
  color: #a5f3fc;
  font: 700 9px/1 var(--font-body);
  letter-spacing: 0.04em;
}

.shortcut-help-section-heading-reference span {
  border-color: rgba(196, 181, 253, 0.14);
  background: rgba(124, 58, 237, 0.07);
  color: #c4b5fd;
}

.shortcut-help-list {
  display: grid;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.025);
}

.shortcut-help-reference-list {
  background: rgba(255, 255, 255, 0.015);
}

.shortcut-help-row {
  min-height: 62px;
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 10px 12px;
  border: 0;
  border-radius: 0;
  background: transparent;
  color: inherit;
  font: inherit;
  text-align: left;
}

.shortcut-help-row + .shortcut-help-row { border-top: 1px solid rgba(255, 255, 255, 0.07); }
.shortcut-help-row > span:first-child { min-width: 0; display: grid; gap: 3px; }
.shortcut-help-action { cursor: pointer; transition: background-color 160ms ease, box-shadow 160ms ease; }
.shortcut-help-action:hover:not(:disabled) { background: rgba(124, 58, 237, 0.09); }
.shortcut-help-action:active:not(:disabled) { background: rgba(124, 58, 237, 0.16); }
.shortcut-help-action:focus-visible { position: relative; z-index: 1; outline: 3px solid rgba(103, 232, 249, 0.42); outline-offset: -3px; }
.shortcut-help-action:disabled { cursor: not-allowed; opacity: 0.46; }
.shortcut-help-action[aria-pressed="true"] { background: rgba(8, 145, 178, 0.13); box-shadow: inset 3px 0 0 #67e8f9; }
.shortcut-help-action[aria-pressed="true"] strong { color: #cffafe; }
.shortcut-help-action[aria-pressed="true"] small { color: #67e8f9; }
.shortcut-help-list strong { color: #e9e7f5; font-size: 13px; }
.shortcut-help-list small { color: #7f8a9a; font-size: 10px; line-height: 1.35; }

.shortcut-help-list kbd {
  flex: 0 0 auto;
  min-width: 48px;
  padding: 7px 9px;
  border: 1px solid rgba(196, 181, 253, 0.2);
  border-bottom-color: rgba(196, 181, 253, 0.38);
  border-radius: 7px;
  background: rgba(124, 58, 237, 0.1);
  color: #ddd6fe;
  font: 700 11px/1 var(--font-body);
  text-align: center;
  white-space: nowrap;
  box-shadow: inset 0 -2px 0 rgba(0, 0, 0, 0.22);
}

.shortcut-key-pair { flex: 0 0 auto; display: flex; gap: 5px; }
.shortcut-key-pair kbd { min-width: 0; }

.shortcut-help-tip {
  margin-top: 14px;
  display: flex;
  align-items: flex-start;
  gap: 8px;
  color: #7f93a3;
  font-size: 10px;
  line-height: 1.5;
}

.shortcut-help-tip svg {
  width: 16px;
  height: 16px;
  flex: 0 0 16px;
  fill: none;
  stroke: #67e8f9;
  stroke-width: 1.7;
  stroke-linecap: round;
  stroke-linejoin: round;
}

@media (max-width: 480px) {
  .shortcut-help-modal {
    align-items: flex-end;
    padding: 12px max(12px, env(safe-area-inset-right)) calc(12px + env(safe-area-inset-bottom)) max(12px, env(safe-area-inset-left));
  }

  .shortcut-help-card {
    max-height: calc(100dvh - 24px - env(safe-area-inset-bottom));
    padding: 19px 16px 16px;
    border-radius: 20px;
  }

  .shortcut-help-row { min-height: 58px; padding-inline: 10px; }
  .shortcut-help-list kbd { padding: 7px; font-size: 10px; }
  .shortcut-help-sections { gap: 12px; }
}

@media (prefers-reduced-motion: reduce) {
  .shortcut-help-card { animation: none; }
  .shortcut-help-tooltip { transform: none; transition: none; }
  .shortcut-help-btn.is-discovering::after {
    animation: none;
    opacity: 0.72;
    transform: scale(1);
  }
}

/* ===== Flow Section — 3 steps guide ===== */
.flow-section {
  margin-bottom: 28px;
}

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

.flow-step {
  flex: 1;
  background: var(--glass);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-lg);
  padding: 20px 12px;
  text-align: center;
  backdrop-filter: blur(20px);
  box-shadow: var(--shadow-card);
}

.flow-step-num {
  width: 32px;
  height: 32px;
  line-height: 32px;
  text-align: center;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--accent-1), var(--accent-2));
  color: #fff;
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 15px;
  margin: 0 auto 12px;
  box-shadow: 0 4px 14px rgba(124, 58, 237, 0.45);
}

.flow-step-icon {
  font-size: 32px;
  margin-bottom: 8px;
  line-height: 1;
  display: flex;
  justify-content: center;
  color: #c4b5fd;
}

.flow-step-title {
  font-family: var(--font-display);
  font-size: 15px;
  font-weight: 700;
  margin-bottom: 6px;
  color: var(--text-primary);
}

.flow-step-desc {
  font-size: 13px;
  color: var(--text-muted);
  line-height: 1.5;
}

.flow-line {
  width: 24px;
  height: 2px;
  background: linear-gradient(90deg, var(--accent-1), var(--accent-2));
  border-radius: 1px;
  margin-top: 16px;
  flex-shrink: 0;
}

/* ===== Features Section — capability cards ===== */
.features-section {
  margin-bottom: 28px;
}

.features-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
}

.feature-card {
  background: linear-gradient(135deg, rgba(124, 58, 237, 0.06) 0%, rgba(236, 72, 153, 0.04) 100%);
  border: 1px solid var(--glass-border-bright);
  border-radius: var(--radius-lg);
  padding: 18px 16px;
  transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
  backdrop-filter: blur(20px);
  box-shadow: var(--shadow-card);
}

.feature-card:hover {
  transform: translateY(-4px);
  border-color: rgba(124, 58, 237, 0.45);
  box-shadow: 0 12px 30px rgba(124, 58, 237, 0.25), 0 4px 12px rgba(236, 72, 153, 0.15);
}

.feature-icon {
  width: 42px;
  height: 42px;
  display: grid;
  place-items: center;
  border-radius: var(--radius-md);
  background: linear-gradient(135deg, rgba(124, 58, 237, 0.22), rgba(236, 72, 153, 0.14));
  color: #c4b5fd;
  font-size: 24px;
  margin-bottom: 10px;
  line-height: 1;
  box-shadow: 0 6px 16px rgba(124, 58, 237, 0.18);
}

.feature-title {
  font-family: var(--font-display);
  font-size: 15px;
  font-weight: 700;
  margin-bottom: 6px;
  color: var(--text-primary);
}

.feature-desc {
  font-size: 12px;
  color: var(--text-secondary);
  line-height: 1.5;
}

/* ===== Examples Section — showcase grid ===== */
.examples-section {
  margin-bottom: 28px;
}

.examples-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
}

.example-item {
  position: relative;
  border-radius: var(--radius-lg);
  overflow: hidden;
  aspect-ratio: 4 / 3;
  cursor: pointer;
  border: 1px solid var(--glass-border);
  background: var(--bg-surface);
  transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

.example-item.image-error::after {
  content: '示例图片暂不可用';
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  color: var(--text-muted);
  background: var(--bg-surface);
  font-size: 13px;
  text-align: center;
}

.example-item:hover {
  transform: scale(1.02);
  border-color: rgba(124, 58, 237, 0.55);
  box-shadow: 0 10px 28px rgba(124, 58, 237, 0.3), 0 0 0 1px rgba(236, 72, 153, 0.2);
}

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

.example-label {
  position: absolute;
  left: 0; right: 0; bottom: 0;
  padding: 24px 12px 10px;
  background: linear-gradient(180deg, transparent 0%, rgba(0, 0, 0, 0.8) 100%);
  color: #fff;
  font-family: var(--font-display);
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.3px;
}

/* ===== Example Viewer — fullscreen modal ===== */
.example-viewer {
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(0, 0, 0, 0.92);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  backdrop-filter: blur(8px);
}

.example-viewer.active {
  display: flex;
}

.example-viewer-content {
  position: relative;
  max-width: 90vw;
  max-height: 90vh;
}

.example-viewer-content img {
  max-width: 90vw;
  max-height: 90vh;
  border-radius: var(--radius-md);
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.7), 0 0 40px rgba(124, 58, 237, 0.3);
  display: block;
}

.example-viewer-close {
  position: absolute;
  top: -40px;
  right: 0;
  width: 48px;
  height: 48px;
  line-height: 48px;
  text-align: center;
  background: rgba(255, 255, 255, 0.15);
  border: none;
  color: #fff;
  border-radius: 50%;
  font-size: 28px;
  font-weight: 300;
  cursor: pointer;
  transition: all 0.2s ease;
  backdrop-filter: blur(10px);
}

.example-viewer-close:hover {
  background: rgba(255, 255, 255, 0.25);
}

/* ===== Footer Section — brand bar ===== */
.footer-section {
  text-align: center;
  padding: 32px 20px 24px;
  margin-top: 20px;
  border-top: 1px solid var(--glass-border);
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.02) 0%, rgba(124, 58, 237, 0.04) 100%);
  backdrop-filter: blur(20px);
}

.footer-brand {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-family: var(--font-display);
  font-size: 18px;
  font-weight: 800;
  letter-spacing: 1px;
  margin-bottom: 8px;
  background: linear-gradient(135deg, var(--accent-1) 0%, var(--accent-2) 50%, var(--accent-3) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.footer-brand .ui-icon {
  color: #c4b5fd;
  -webkit-text-fill-color: initial;
}

.footer-desc {
  font-size: 12px;
  color: var(--text-muted);
  margin-bottom: 6px;
}

.footer-copyright {
  font-size: 11px;
  color: var(--text-muted);
  opacity: 0.7;
}

/* Section Header */
.section-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 16px;
  padding: 0 2px;
}

.section-title {
  font-family: var(--font-display);
  font-size: 17px;
  font-weight: 700;
  letter-spacing: 0.5px;
  position: relative;
  padding-left: 14px;
}

.section-title::before {
  content: '';
  position: absolute;
  left: 0; top: 50%;
  transform: translateY(-50%);
  width: 4px; height: 16px;
  background: linear-gradient(180deg, var(--accent-1), var(--accent-2));
  border-radius: 2px;
  box-shadow: 0 0 8px var(--accent-glow);
}

#history-storage-status {
  margin-left: 6px;
  font-size: 11px;
  font-weight: 500;
  color: var(--text-muted);
  letter-spacing: 0;
}

.clear-btn {
  font-family: var(--font-body);
  font-size: 13px;
  color: var(--text-muted);
  padding: 7px 16px;
  border-radius: var(--radius-sm);
  background: var(--glass);
  border: 1px solid var(--glass-border);
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s ease;
}

.clear-btn:active {
  background: rgba(239, 68, 68, 0.15);
  color: #f87171;
  border-color: rgba(239, 68, 68, 0.3);
  transform: scale(0.96);
}

.history-search-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: -2px 0 14px;
}

.history-search-field {
  min-width: 0;
  flex: 1;
  height: 42px;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 0 8px 0 12px;
  border: 1px solid var(--glass-border);
  border-radius: 11px;
  background: rgba(255, 255, 255, 0.035);
  transition: border-color 0.2s ease, box-shadow 0.2s ease, background 0.2s ease;
}

.history-search-field:focus-within {
  border-color: rgba(139, 92, 246, 0.65);
  background: rgba(124, 58, 237, 0.07);
  box-shadow: 0 0 0 3px rgba(124, 58, 237, 0.12);
}

.history-search-field > .ui-icon {
  width: 17px;
  height: 17px;
  flex: 0 0 auto;
  color: #a78bfa;
}

.history-search-field input {
  min-width: 0;
  flex: 1;
  height: 100%;
  padding: 0;
  border: 0;
  outline: 0;
  background: transparent;
  color: var(--text-primary);
  font: 13px/1 var(--font-body);
}

.history-search-field input::placeholder {
  color: var(--text-muted);
}

.history-search-field input::-webkit-search-cancel-button {
  display: none;
}

#history-search-clear {
  width: 30px;
  height: 30px;
  flex: 0 0 30px;
  display: grid;
  place-items: center;
  padding: 0;
  border: 0;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.06);
  color: var(--text-secondary);
  font-size: 18px;
  cursor: pointer;
}

#history-search-clear[hidden] {
  display: none;
}

.history-sort-select {
  width: 112px;
  height: 42px;
  flex: 0 0 112px;
  padding: 0 28px 0 11px;
  border: 1px solid var(--glass-border);
  border-radius: 11px;
  outline: 0;
  background-color: rgba(255, 255, 255, 0.035);
  color: var(--text-secondary);
  font: 600 11px/1 var(--font-body);
  cursor: pointer;
}

.history-sort-select:focus {
  border-color: rgba(139, 92, 246, 0.65);
  box-shadow: 0 0 0 3px rgba(124, 58, 237, 0.12);
}

.history-search-count {
  min-width: 62px;
  color: var(--text-muted);
  font-size: 11px;
  text-align: right;
  white-space: nowrap;
}

.history-search-empty {
  display: grid;
  justify-items: center;
  gap: 5px;
  margin-bottom: 14px;
  padding: 24px 16px;
  border: 1px dashed rgba(167, 139, 250, 0.28);
  border-radius: var(--radius-md);
  background: rgba(124, 58, 237, 0.035);
  text-align: center;
}

.history-search-empty[hidden] {
  display: none;
}

.history-search-empty strong {
  color: var(--text-secondary);
  font-size: 13px;
}

.history-search-empty span {
  color: var(--text-muted);
  font-size: 11px;
  line-height: 1.5;
}

/* History Grid */
.history-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 14px;
}

.history-item {
  position: relative;
  border-radius: var(--radius-md);
  overflow: hidden;
  background: var(--bg-surface);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.3);
  border: 1px solid var(--glass-border);
  transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
  aspect-ratio: 1 / 1;
  cursor: pointer;
}

.history-item:focus-visible {
  outline: 3px solid var(--accent-2);
  outline-offset: 3px;
}

.history-item::after {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0; bottom: 0;
  border-radius: var(--radius-md);
  border: 1px solid rgba(255, 255, 255, 0.05);
  pointer-events: none;
}

.history-item:active {
  transform: scale(0.95);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

.history-img {
  width: 100%; height: 100%;
  display: block;
  object-fit: cover;
  transition: transform 0.4s ease;
}

.history-img-placeholder {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  color: var(--text-muted);
  font-size: 13px;
  background: var(--bg-surface);
}

.history-img {
  position: relative;
  z-index: 1;
}

.history-card-meta {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 3;
  display: grid;
  gap: 5px;
  padding: 34px 12px 11px;
  background: linear-gradient(180deg, transparent, rgba(6, 6, 16, 0.9) 58%, rgba(6, 6, 16, 0.97));
  pointer-events: none;
}

.history-project-title {
  overflow: hidden;
  color: #fff;
  font-family: var(--font-display);
  font-size: 14px;
  font-weight: 700;
  line-height: 1.3;
  text-overflow: ellipsis;
  white-space: nowrap;
  text-shadow: 0 1px 8px rgba(0, 0, 0, 0.85);
}

.history-card-details {
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 7px;
}

.history-time {
  flex: 0 0 auto;
  color: rgba(255, 255, 255, 0.7);
  font-size: 10px;
  line-height: 1.2;
}

.history-size {
  min-width: 0;
  overflow: hidden;
  color: #c4b5fd;
  font: 600 10px/1.2 var(--font-display);
  text-overflow: ellipsis;
  white-space: nowrap;
}

.history-size::before {
  content: '·';
  margin-right: 7px;
  color: rgba(255, 255, 255, 0.34);
}

.history-card-actions {
  display: contents;
}

.history-more {
  display: none;
}

.history-rename {
  position: absolute;
  top: 8px;
  left: 8px;
  z-index: 10;
  width: 44px;
  height: 44px;
  display: grid;
  place-items: center;
  padding: 0;
  border: 1px solid rgba(196, 181, 253, 0.34);
  border-radius: 50%;
  background: rgba(34, 24, 61, 0.84);
  color: #ddd6fe;
  font-size: 17px;
  line-height: 1;
  box-shadow: 0 5px 16px rgba(0, 0, 0, 0.3);
  backdrop-filter: blur(8px);
  cursor: pointer;
  transition: transform 0.2s ease, background 0.2s ease, border-color 0.2s ease;
}

.history-rename:hover,
.history-rename:focus-visible {
  border-color: rgba(196, 181, 253, 0.72);
  background: rgba(76, 50, 129, 0.92);
}

.history-rename:active {
  transform: scale(0.92);
}

.history-pin {
  position: absolute;
  top: 8px;
  left: 60px;
  z-index: 10;
  width: 44px;
  height: 44px;
  display: grid;
  place-items: center;
  padding: 0;
  border: 1px solid rgba(251, 191, 36, 0.32);
  border-radius: 50%;
  background: rgba(55, 39, 16, 0.78);
  color: #fcd34d;
  font-size: 18px;
  line-height: 1;
  box-shadow: 0 5px 16px rgba(0, 0, 0, 0.3);
  backdrop-filter: blur(8px);
  cursor: pointer;
  transition: transform 0.2s ease, background 0.2s ease, border-color 0.2s ease;
}

.history-pin:hover,
.history-pin:focus-visible,
.history-pin[aria-pressed="true"] {
  border-color: rgba(251, 191, 36, 0.72);
  background: rgba(120, 75, 15, 0.9);
}

.history-pin:active {
  transform: scale(0.92);
}

.history-export {
  position: absolute;
  top: 8px;
  left: 112px;
  z-index: 10;
  width: 44px;
  height: 44px;
  display: grid;
  place-items: center;
  padding: 0;
  border: 1px solid rgba(103, 232, 249, 0.32);
  border-radius: 50%;
  background: rgba(8, 71, 89, 0.8);
  color: #a5f3fc;
  box-shadow: 0 5px 16px rgba(0, 0, 0, 0.3);
  -webkit-backdrop-filter: blur(8px);
  backdrop-filter: blur(8px);
  cursor: pointer;
  transition: transform 180ms ease, background 180ms ease, border-color 180ms ease;
}

.history-export svg {
  width: 18px;
  height: 18px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.history-export:hover,
.history-export:focus-visible {
  border-color: rgba(103, 232, 249, 0.72);
  background: rgba(8, 113, 138, 0.94);
}

.history-export:active { transform: scale(0.92); }

.history-item.is-pinned {
  border-color: rgba(251, 191, 36, 0.3);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.34), 0 0 0 1px rgba(251, 191, 36, 0.07);
}

.history-rename-form {
  display: grid;
  gap: 8px;
  pointer-events: auto;
}

.history-rename-form input {
  width: 100%;
  min-width: 0;
  height: 38px;
  padding: 0 10px;
  box-sizing: border-box;
  border: 1px solid rgba(196, 181, 253, 0.5);
  border-radius: 9px;
  outline: 0;
  background: rgba(12, 10, 24, 0.94);
  color: #fff;
  font: 12px/1 var(--font-body);
  box-shadow: 0 0 0 3px rgba(124, 58, 237, 0.14);
}

.history-rename-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 7px;
}

.history-rename-actions button {
  min-height: 34px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.07);
  color: var(--text-secondary);
  font: 600 11px/1 var(--font-body);
  cursor: pointer;
}

.history-rename-actions button:last-child {
  border-color: rgba(124, 58, 237, 0.72);
  background: linear-gradient(135deg, #6d38d8, #c23889);
  color: #fff;
}

.history-item.is-renaming .history-project-title,
.history-item.is-renaming .history-card-details,
.history-item.is-renaming .history-rename,
.history-item.is-renaming .history-pin,
.history-item.is-renaming .history-export,
.history-item.is-renaming .history-delete,
.history-item.is-renaming .history-more {
  display: none;
}

.history-item.is-renaming .history-card-meta {
  padding-top: 70px;
  pointer-events: auto;
}

.history-item:active .history-img {
  transform: scale(1.05);
}

.history-delete {
  position: absolute;
  top: 8px; right: 8px;
  width: 44px; height: 44px;
  line-height: 38px;
  text-align: center;
  background: linear-gradient(135deg, #ef4444, #f87171);
  color: #fff;
  border-radius: 50%;
  font-size: 18px;
  font-weight: bold;
  box-shadow: 0 3px 10px rgba(239, 68, 68, 0.5);
  border: 2px solid rgba(255, 255, 255, 0.9);
  z-index: 10;
  cursor: pointer;
  transition: all 0.2s ease;
}

.history-delete:active {
  transform: scale(0.9);
}

@media (max-width: 640px) {
  .history-card-actions {
    position: absolute;
    top: 58px;
    left: 8px;
    right: 8px;
    z-index: 22;
    display: none;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 4px;
    padding: 5px;
    border: 1px solid rgba(196, 181, 253, 0.24);
    border-radius: 12px;
    background: rgba(10, 9, 22, 0.94);
    box-shadow: 0 12px 28px rgba(0, 0, 0, 0.4);
    backdrop-filter: blur(14px);
  }

  .history-item.show-mobile-actions .history-card-actions {
    display: grid;
  }

  .history-card-actions .history-rename,
  .history-card-actions .history-pin,
  .history-card-actions .history-export,
  .history-card-actions .history-delete {
    position: static;
    width: auto;
    height: 44px;
    min-width: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 3px;
    padding: 4px 2px;
    border-width: 1px;
    border-radius: 8px;
    line-height: 1;
    box-shadow: none;
  }

  .history-card-actions button::after {
    content: attr(data-mobile-label);
    overflow: hidden;
    max-width: 100%;
    color: rgba(255, 255, 255, 0.76);
    font: 600 9px/1 var(--font-body);
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .history-more {
    position: absolute;
    top: 8px;
    right: 8px;
    z-index: 23;
    width: 44px;
    height: 44px;
    display: grid;
    place-items: center;
    padding: 0 0 6px;
    border: 1px solid rgba(196, 181, 253, 0.36);
    border-radius: 50%;
    background: rgba(34, 24, 61, 0.88);
    color: #ddd6fe;
    font-size: 16px;
    letter-spacing: 1px;
    box-shadow: 0 5px 16px rgba(0, 0, 0, 0.3);
    backdrop-filter: blur(8px);
    cursor: pointer;
  }

  .history-more[aria-expanded="true"] {
    border-color: rgba(196, 181, 253, 0.72);
    background: rgba(76, 50, 129, 0.94);
  }
}

/* ===== Unified Interaction States ===== */
.hero-secondary-btn,
.clear-btn,
.header-back-btn,
.editor-history-actions button,
.border-width-item,
.screen-edit-mode-btn,
.add-btn:not(.add-btn-disabled),
.alignment-preview-actions button,
.alignment-patterns button,
.alignment-snap-row button,
.alignment-snap-actions button,
.inspector-header button,
.quick-actions button,
.layer-actions button,
.ratio-lock,
.segmented-controls button,
.result-view-switch button,
.result-tool-group button,
.result-compare-control button,
.result-fullscreen-view-switch button,
.result-info-value-action button,
.result-logo-field button,
.commerce-secondary,
.feedback-confirm-cancel {
  transition:
    transform 0.18s cubic-bezier(0.16, 1, 0.3, 1),
    color 0.18s ease,
    border-color 0.18s ease,
    background-color 0.18s ease,
    box-shadow 0.18s ease;
}

@media (hover: hover) and (pointer: fine) {
  .hero-secondary-btn:hover,
  .clear-btn:hover,
  .header-back-btn:hover,
  .editor-history-actions button:not(:disabled):hover,
  .border-width-item:hover,
  .screen-edit-mode-btn:hover,
  .add-btn:not(.add-btn-disabled):hover,
  .alignment-preview-actions button:hover,
  .alignment-patterns button:hover,
  .alignment-snap-row button:hover,
  .alignment-snap-actions button:hover,
  .inspector-header button:hover,
  .quick-actions button:hover,
  .layer-actions button:hover,
  .ratio-lock:hover,
  .segmented-controls button:hover,
  .result-view-switch button:hover,
  .result-tool-group button:hover,
  .result-compare-control button:hover,
  .result-fullscreen-view-switch button:hover,
  .result-info-value-action button:hover,
  .result-logo-field button:hover,
  .commerce-secondary:hover,
  .feedback-confirm-cancel:hover {
    transform: translateY(-1px);
    border-color: rgba(167, 139, 250, 0.42);
    background-color: var(--interaction-hover);
    color: #fff;
    box-shadow: 0 8px 18px rgba(0, 0, 0, 0.2), inset 0 1px 0 rgba(255, 255, 255, 0.08);
  }

  .upload-btn:hover,
  .btn-primary:hover,
  .btn-save:hover,
  .commerce-primary:hover,
  .feedback-confirm-submit:hover,
  .ai-btn-confirm:hover {
    transform: translateY(-1px);
    filter: brightness(1.08) saturate(1.06);
  }

  .btn-reward-export:hover,
  .sponsor-content button:hover {
    transform: translateY(-1px);
    filter: brightness(1.1);
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.22);
  }

  #btn-delete-content:hover,
  [data-content-action="delete"]:hover,
  .result-template-clear:hover {
    border-color: rgba(239, 68, 68, 0.42);
    background-color: rgba(239, 68, 68, 0.12);
    color: #fecaca;
  }
}

.hero-secondary-btn:active,
.clear-btn:active,
.header-back-btn:active,
.editor-history-actions button:not(:disabled):active,
.border-width-item:active,
.screen-edit-mode-btn:active,
.add-btn:not(.add-btn-disabled):active,
.alignment-preview-actions button:active,
.alignment-patterns button:active,
.alignment-snap-row button:active,
.alignment-snap-actions button:active,
.inspector-header button:active,
.quick-actions button:active,
.layer-actions button:active,
.ratio-lock:active,
.segmented-controls button:active,
.result-view-switch button:active,
.result-tool-group button:active,
.result-compare-control button:active,
.result-fullscreen-view-switch button:active,
.result-info-value-action button:active,
.result-logo-field button:active,
.commerce-secondary:active,
.feedback-confirm-cancel:active {
  transform: translateY(1px) scale(0.98);
  background-color: var(--interaction-pressed);
  box-shadow: none;
}

.control-panel input:not([type="range"]):not([type="checkbox"]):not([type="color"]),
.control-panel textarea,
.control-panel select,
.result-sidebar input:not([type="range"]):not([type="checkbox"]):not([type="color"]),
.result-sidebar textarea,
.result-sidebar select,
.history-search-field,
.history-sort-select {
  transition: border-color 0.18s ease, background-color 0.18s ease, box-shadow 0.18s ease;
}

.control-panel input:not([type="range"]):not([type="checkbox"]):not([type="color"]):focus,
.control-panel textarea:focus,
.control-panel select:focus,
.result-sidebar input:not([type="range"]):not([type="checkbox"]):not([type="color"]):focus,
.result-sidebar textarea:focus,
.result-sidebar select:focus,
.history-search-field:focus-within,
.history-sort-select:focus {
  outline: none;
  border-color: var(--interaction-focus);
  background-color: rgba(32, 24, 58, 0.84);
  box-shadow: var(--interaction-ring), inset 0 1px 0 rgba(255, 255, 255, 0.055);
}

.commerce-modal-card,
.feedback-confirm-card,
.ai-modal-content {
  border-color: rgba(255, 255, 255, 0.13);
  background: linear-gradient(145deg, rgba(29, 25, 52, 0.92), rgba(13, 13, 26, 0.86));
  box-shadow: 0 28px 80px rgba(0, 0, 0, 0.58), inset 0 1px 0 rgba(255, 255, 255, 0.085);
  -webkit-backdrop-filter: blur(24px) saturate(140%);
  backdrop-filter: blur(24px) saturate(140%);
}

.commerce-modal-mask,
.feedback-confirm-mask,
.ai-modal-mask {
  background: rgba(3, 3, 10, 0.72);
  -webkit-backdrop-filter: blur(10px) saturate(110%);
  backdrop-filter: blur(10px) saturate(110%);
}

button:disabled,
.add-btn-disabled {
  transform: none !important;
  filter: none !important;
  box-shadow: none;
}

@media (max-width: 640px) {
  .commerce-modal-card,
  .feedback-confirm-card,
  .ai-modal-content {
    -webkit-backdrop-filter: blur(14px) saturate(120%);
    backdrop-filter: blur(14px) saturate(120%);
  }
}

/* Empty State */
.empty-history {
  text-align: center;
  padding: 56px 24px;
  background: linear-gradient(135deg, rgba(124, 58, 237, 0.05) 0%, rgba(236, 72, 153, 0.03) 100%);
  border-radius: var(--radius-xl);
  border: 1px dashed rgba(124, 58, 237, 0.3);
  margin-top: 4px;
  position: relative;
  overflow: hidden;
}

.empty-history::before {
  content: '';
  position: absolute;
  top: -50%; left: -20%;
  width: 140%; height: 140%;
  background: radial-gradient(circle at 50% 50%, rgba(124, 58, 237, 0.1) 0%, transparent 50%);
  pointer-events: none;
  animation: emptyFloat 6s ease-in-out infinite alternate;
}

@keyframes emptyFloat {
  from { transform: translate(0, 0); }
  to { transform: translate(20px, -10px); }
}

.empty-icon {
  font-size: 56px;
  margin-bottom: 16px;
  opacity: 0.6;
  position: relative;
  display: inline-block;
  filter: drop-shadow(0 4px 16px rgba(124, 58, 237, 0.4));
}

.empty-icon .ui-icon {
  width: 56px;
  height: 56px;
}

@keyframes iconBob {
  from { transform: translateY(0); }
  to { transform: translateY(-6px); }
}

.empty-text {
  font-family: var(--font-display);
  font-size: 16px;
  color: var(--text-secondary);
  margin-bottom: 8px;
  font-weight: 700;
  letter-spacing: 0.5px;
  position: relative;
}

.empty-desc {
  font-size: 13px;
  color: var(--text-muted);
  letter-spacing: 0.3px;
  position: relative;
}

/* ===== Editor Page ===== */

.editor-page {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background: transparent;
  height: 100%;
}

/* Step Tabs — glass pills */
.step-tabs {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 14px 16px;
  background: var(--glass);
  backdrop-filter: blur(20px);
  border-bottom: 1px solid var(--glass-border);
  gap: 10px;
  flex-shrink: 0;
}

.tab-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 9px 20px;
  font-family: var(--font-display);
  font-size: 14px;
  color: var(--text-muted);
  border-radius: var(--radius-lg);
  font-weight: 600;
  letter-spacing: 0.5px;
  cursor: pointer;
  transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
  border: 1px solid transparent;
  background: transparent;
}

.tab-item.active {
  color: var(--text-primary);
  background: linear-gradient(135deg, rgba(124, 58, 237, 0.25), rgba(236, 72, 153, 0.2));
  border-color: rgba(124, 58, 237, 0.35);
  box-shadow: 0 4px 14px rgba(124, 58, 237, 0.2), inset 0 1px 0 rgba(255, 255, 255, 0.1);
}

.tab-num {
  width: 22px; height: 22px;
  line-height: 22px;
  text-align: center;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.08);
  font-size: 12px;
  font-weight: 700;
  transition: all 0.3s ease;
}

.tab-item.active .tab-num {
  background: linear-gradient(135deg, var(--accent-1), var(--accent-2));
  box-shadow: 0 2px 8px var(--accent-glow);
}

.tab-divider {
  width: 24px; height: 2px;
  background: var(--glass-border);
  border-radius: 1px;
}

/* Canvas */
.canvas-container {
  flex: 0 0 auto;
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  overflow: hidden;
  padding: 12px;
  box-sizing: border-box;
  min-height: 200px;
}

.canvas-toolbar {
  width: 100%;
  min-height: 50px;
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 6px 7px 6px 12px;
  box-sizing: border-box;
  border: 1px solid var(--glass-border);
  border-radius: 12px;
  background: rgba(12, 12, 26, 0.82);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.22), inset 0 1px 0 rgba(255, 255, 255, 0.035);
  backdrop-filter: blur(16px);
}

.canvas-toolbar-title {
  min-width: 0;
  display: grid;
  gap: 2px;
}

.canvas-toolbar-title strong {
  color: var(--text-primary);
  font-size: 12px;
  line-height: 1.25;
}

.canvas-toolbar-title span {
  overflow: hidden;
  color: var(--text-muted);
  font-size: 10px;
  line-height: 1.25;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.editor-save-status {
  min-width: 104px;
  min-height: 30px;
  margin-left: auto;
  padding: 5px 9px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  box-sizing: border-box;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 999px;
  color: var(--text-muted);
  background: rgba(255, 255, 255, 0.035);
  font-size: 10px;
  line-height: 1;
  white-space: nowrap;
  transition: color 180ms ease, border-color 180ms ease, background-color 180ms ease;
}

.editor-save-status::before {
  content: '';
  width: 7px;
  height: 7px;
  flex: 0 0 auto;
  border-radius: 50%;
  background: currentColor;
  box-shadow: 0 0 0 3px rgba(148, 163, 184, 0.08);
}

.editor-save-status.is-saving {
  color: #c4b5fd;
  border-color: rgba(167, 139, 250, 0.25);
  background: rgba(124, 58, 237, 0.1);
}

.editor-save-status.is-saving::before {
  animation: editor-save-pulse 700ms ease-in-out infinite alternate;
}

.editor-save-status.is-saved {
  color: #67e8f9;
  border-color: rgba(34, 211, 238, 0.25);
  background: rgba(8, 145, 178, 0.1);
}

.editor-save-status.is-error {
  color: #fca5a5;
  border-color: rgba(248, 113, 113, 0.28);
  background: rgba(220, 38, 38, 0.1);
}

.editor-save-status.is-paused {
  color: #fcd34d;
  border-color: rgba(245, 158, 11, 0.3);
  background: rgba(180, 83, 9, 0.12);
}

.editor-save-status time {
  color: rgba(226, 232, 240, 0.62);
  font-variant-numeric: tabular-nums;
}

@keyframes editor-save-pulse {
  from { opacity: 0.45; transform: scale(0.82); }
  to { opacity: 1; transform: scale(1); }
}

.canvas-toolbar .editor-history-actions {
  margin-left: 0;
}

.editor-tab-conflict[hidden] {
  display: none;
}

.editor-tab-conflict {
  position: absolute;
  top: 72px;
  left: 24px;
  right: 24px;
  z-index: 95;
  min-height: 56px;
  padding: 8px 8px 8px 12px;
  display: flex;
  align-items: center;
  gap: 10px;
  box-sizing: border-box;
  border: 1px solid rgba(245, 158, 11, 0.42);
  border-radius: 14px;
  color: #fde68a;
  background: rgba(38, 24, 10, 0.9);
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.34), inset 0 1px 0 rgba(255, 255, 255, 0.08);
  backdrop-filter: blur(18px) saturate(135%);
}

.editor-tab-conflict-icon {
  width: 22px;
  height: 22px;
  flex: 0 0 auto;
}

.editor-tab-conflict-copy {
  min-width: 0;
  display: grid;
  gap: 2px;
}

.editor-tab-conflict-copy strong {
  color: #fff7d6;
  font-size: 12px;
  line-height: 1.3;
}

.editor-tab-conflict-copy small {
  color: rgba(254, 243, 199, 0.76);
  font-size: 10px;
  line-height: 1.35;
}

.editor-tab-conflict button {
  min-width: 104px;
  min-height: 44px;
  margin-left: auto;
  padding: 0 14px;
  border: 1px solid rgba(253, 230, 138, 0.34);
  border-radius: 10px;
  color: #1c1305;
  background: linear-gradient(135deg, #fde68a, #fbbf24);
  box-shadow: 0 8px 20px rgba(245, 158, 11, 0.2);
  font-size: 11px;
  font-weight: 800;
  cursor: pointer;
  touch-action: manipulation;
  transition: filter 180ms ease, box-shadow 180ms ease;
}

.editor-tab-conflict button:hover {
  filter: brightness(1.05);
  box-shadow: 0 10px 24px rgba(245, 158, 11, 0.28);
}

.editor-tab-conflict button:focus-visible {
  outline: 3px solid rgba(255, 255, 255, 0.82);
  outline-offset: 2px;
}

.canvas-wrapper {
  position: relative;
  flex-shrink: 0;
  margin: 0 auto;
  touch-action: none;
  overscroll-behavior: contain;
  transform-origin: 50% 50%;
  will-change: transform;
}

.canvas-wrapper.canvas-zoom-transition {
  transition: transform 220ms cubic-bezier(0.2, 0.8, 0.2, 1);
}

.canvas-gesture-status {
  display: none;
}

.canvas-gesture-coach {
  display: none;
}

.mobile-content-actions {
  display: none;
}

.mobile-layer-menu {
  display: none;
}

.mobile-layer-menu[hidden] {
  display: none !important;
}

.preview-canvas {
  display: block;
  border-radius: 6px;
}

/* Frame Overlay */
.frame-overlay {
  position: absolute;
  box-sizing: border-box;
  z-index: 10;
  cursor: move;
  touch-action: none;
}

.frame-border {
  position: absolute;
  top: 0; left: 0; right: 0; bottom: 0;
  border: 2px solid var(--accent-1);
  box-shadow: 0 0 12px rgba(124, 58, 237, 0.5), inset 0 0 12px rgba(124, 58, 237, 0.1);
  pointer-events: none;
}

.frame-grid {
  position: absolute;
  top: 0; left: 0; right: 0; bottom: 0;
  background-image:
    linear-gradient(rgba(124, 58, 237, 0.25) 1px, transparent 1px),
    linear-gradient(90deg, rgba(124, 58, 237, 0.25) 1px, transparent 1px);
  background-size: 40px 40px;
  pointer-events: none;
}

.frame-label {
  position: absolute;
  top: -20px; left: 0;
  font-family: var(--font-display);
  font-size: 11px;
  color: #a78bfa;
  background: rgba(124, 58, 237, 0.15);
  padding: 3px 8px;
  border-radius: 4px;
  white-space: nowrap;
  font-weight: 600;
}

/* Handles */
.handle {
  position: absolute;
  width: 24px; height: 24px;
  background: transparent;
  border: 2px solid var(--accent-1);
  border-radius: 50%;
  z-index: 20;
  box-shadow: 0 3px 10px rgba(124, 58, 237, 0.4);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--accent-1);
  font-size: 14px;
  font-weight: bold;
  cursor: pointer;
  user-select: none;
  touch-action: none;
}

.handle::before {
  content: '';
  position: absolute;
  inset: -10px;
  border-radius: 50%;
}

.handle-tl { top: -12px; left: -12px; }
.handle-tr { top: -12px; right: -12px; }
.handle-bl { bottom: -12px; left: -12px; }
.handle-br { bottom: -12px; right: -12px; }

/* Content Overlay */
.content-overlay {
  position: absolute;
  z-index: 10;
  box-sizing: border-box;
  overflow: visible;
  background: transparent;
}

.content-frame-guide {
  position: absolute;
  top: 0; left: 0; right: 0; bottom: 0;
  border: 2px dashed rgba(124, 58, 237, 0.5);
  pointer-events: none;
  cursor: default;
  z-index: 200;
  touch-action: none;
}

.content-alignment-guide {
  display: none;
}

.content-alignment-guide[hidden] {
  display: none !important;
}

.content-handle {
  position: absolute;
  width: 16px;
  height: 16px;
  background: transparent;
  border: 2px solid var(--accent-1);
  border-radius: 50%;
  z-index: 210;
  box-shadow: 0 2px 6px rgba(124, 58, 237, 0.4);
  pointer-events: auto;
  display: none;
  touch-action: none;
}

.content-handle::before {
  content: '';
  position: absolute;
  inset: -14px;
  border-radius: 50%;
}

.content-handle-tl { top: -8px; left: -8px; cursor: nwse-resize; }
.content-handle-tr { top: -8px; right: -8px; cursor: nesw-resize; }
.content-handle-bl { bottom: -8px; left: -8px; cursor: nesw-resize; }
.content-handle-br { bottom: -8px; right: -8px; cursor: nwse-resize; }

/* History re-edit checkpoint */
.history-restore-canvas-note[hidden],
.history-restore-summary[hidden] {
  display: none;
}

.history-restore-canvas-note {
  position: absolute;
  top: 78px;
  left: 18px;
  z-index: 60;
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 9px 12px;
  border: 1px solid rgba(52, 211, 153, 0.3);
  border-radius: 10px;
  background: rgba(7, 18, 20, 0.88);
  color: #d1fae5;
  box-shadow: 0 10px 28px rgba(0, 0, 0, 0.3);
  backdrop-filter: blur(16px);
  pointer-events: none;
}

.history-restore-canvas-note > span {
  display: grid;
  place-items: center;
  width: 26px;
  height: 26px;
  border-radius: 8px;
  background: rgba(52, 211, 153, 0.16);
  color: #6ee7b7;
  font-weight: 800;
}

.history-restore-canvas-note div {
  display: grid;
  gap: 2px;
}

.history-restore-canvas-note strong {
  font-size: 12px;
  line-height: 1.2;
}

.history-restore-canvas-note small {
  color: rgba(209, 250, 229, 0.62);
  font-size: 10px;
}

.history-restore-summary {
  position: relative;
  overflow: hidden;
  padding: 18px;
  border: 1px solid rgba(52, 211, 153, 0.22);
  border-radius: var(--radius-lg);
  background:
    linear-gradient(135deg, rgba(52, 211, 153, 0.09), rgba(14, 165, 233, 0.04) 55%, transparent),
    rgba(255, 255, 255, 0.025);
  box-shadow: inset 3px 0 0 rgba(52, 211, 153, 0.7);
}

.history-restore-heading {
  display: flex;
  align-items: center;
  gap: 12px;
}

.history-restore-heading > div {
  display: grid;
  gap: 4px;
  min-width: 0;
}

.history-restore-heading strong {
  color: var(--text-primary);
  font-family: var(--font-display);
  font-size: 15px;
}

.history-restore-heading small {
  overflow: hidden;
  color: var(--text-muted);
  font-size: 11px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.history-restore-check {
  display: grid;
  place-items: center;
  flex: 0 0 40px;
  width: 40px;
  height: 40px;
  border: 1px solid rgba(52, 211, 153, 0.3);
  border-radius: 12px;
  background: rgba(52, 211, 153, 0.14);
  color: #6ee7b7;
  font-size: 18px;
  font-weight: 800;
}

.history-restore-stats {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 7px;
  margin: 16px 0;
}

.history-restore-stats span {
  display: grid;
  gap: 2px;
  min-width: 0;
  padding: 10px 6px;
  border: 1px solid var(--glass-border);
  border-radius: 9px;
  background: rgba(0, 0, 0, 0.13);
  color: var(--text-muted);
  font-size: 10px;
  text-align: center;
}

.history-restore-stats strong {
  color: var(--text-primary);
  font-family: var(--font-display);
  font-size: 16px;
  font-variant-numeric: tabular-nums;
}

.history-restore-actions {
  display: grid;
  grid-template-columns: 1fr 1.15fr;
  gap: 8px;
}

.history-restore-actions button {
  min-height: 46px;
  padding: 0 10px;
  border: 1px solid var(--glass-border-bright);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.035);
  color: var(--text-secondary);
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
}

.history-restore-actions button:last-child {
  border-color: rgba(124, 58, 237, 0.5);
  background: linear-gradient(135deg, rgba(124, 58, 237, 0.78), rgba(236, 72, 153, 0.68));
  color: #fff;
  box-shadow: 0 8px 22px rgba(124, 58, 237, 0.23);
}

.page-editor.history-restore-mode #panel-content > :not(.history-restore-summary) {
  display: none !important;
}

.page-editor.history-restore-mode .content-frame-guide {
  opacity: 0;
}

.screen-edit-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 14px;
  padding: 10px 14px;
  background: rgba(255, 255, 255, 0.03);
  border-radius: 10px;
  border: 1px solid rgba(255, 255, 255, 0.06);
}

.screen-edit-modes {
  display: flex;
  gap: 8px;
}

.screen-edit-mode-btn {
  padding: 7px 16px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 8px;
  font-family: var(--font-display);
  font-size: 13px;
  color: rgba(255, 255, 255, 0.7);
  font-weight: 600;
  letter-spacing: 0.3px;
  cursor: pointer;
  transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

.screen-edit-mode-btn:active {
  transform: scale(0.94);
}

.screen-edit-mode-btn.active {
  background: linear-gradient(135deg, rgba(124, 58, 237, 0.3) 0%, rgba(236, 72, 153, 0.25) 100%);
  border-color: rgba(124, 58, 237, 0.5);
  color: #fff;
  box-shadow: 0 3px 10px rgba(124, 58, 237, 0.25), inset 0 1px 0 rgba(255, 255, 255, 0.12);
}

.content-item {
  position: absolute;
  z-index: 5;
  user-select: none;
  cursor: move;
  display: flex;
  align-items: center;
  justify-content: center;
  touch-action: none;
}

.content-item.selected {
  outline: 1px solid #67e8f9;
  outline-offset: 4px;
  z-index: 100;
}

.content-item.locked {
  cursor: default;
}

.content-item.selected.locked {
  outline-color: #c4b5fd;
  outline-style: dashed;
}

.content-lock-badge {
  position: absolute;
  top: 5px;
  left: 5px;
  z-index: 38;
  display: grid;
  place-items: center;
  width: 24px;
  height: 24px;
  border: 1px solid rgba(196, 181, 253, 0.48);
  border-radius: 8px;
  background: rgba(49, 28, 91, 0.88);
  color: #ede9fe;
  box-shadow: 0 5px 14px rgba(0, 0, 0, 0.3);
  font-size: 10px;
  font-weight: 800;
  pointer-events: none;
}

[data-content-lock-toggle][aria-pressed="true"] {
  border-color: rgba(196, 181, 253, 0.42) !important;
  background: rgba(124, 58, 237, 0.2) !important;
  color: #ede9fe !important;
}

.content-transform-locked input:disabled,
.content-transform-locked button:disabled {
  opacity: 0.42;
  cursor: not-allowed;
  filter: saturate(0.55);
}

.content-toolbar {
  position: absolute;
  left: 50%;
  bottom: calc(100% + 9px);
  z-index: 45;
  display: flex;
  gap: 4px;
  padding: 4px;
  border: 1px solid rgba(103, 232, 249, 0.38);
  border-radius: 9px;
  background: rgba(10, 12, 22, 0.94);
  box-shadow: 0 8px 24px rgba(0,0,0,.4);
  transform: translateX(-50%);
  white-space: nowrap;
  pointer-events: auto;
}

.content-toolbar button {
  min-height: 44px;
  padding: 0 10px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--text-secondary);
  font-size: 11px;
  cursor: pointer;
}

.content-toolbar button:last-child { color: #fda4af; }

.content-text {
  white-space: nowrap;
  font-weight: bold;
  pointer-events: none;
  display: block;
  transform-origin: center center;
  opacity: 0;
  visibility: hidden;
}

.content-image {
  width: 100%; height: 100%;
  display: block;
  pointer-events: none;
  object-fit: fill;
  opacity: 0;
  visibility: hidden;
}

.content-delete {
  position: absolute;
  top: 4px; right: 4px;
  width: 26px; height: 26px;
  line-height: 24px;
  text-align: center;
  background: var(--danger);
  color: #fff;
  border-radius: 50%;
  font-size: 18px;
  z-index: 30;
  box-shadow: 0 2px 8px var(--danger-glow);
  border: 2px solid #fff;
  pointer-events: auto;
  cursor: pointer;
  touch-action: manipulation;
}

.content-delete::before {
  content: '';
  position: absolute;
  inset: -9px;
  border-radius: 50%;
}

.text-resize-handle {
  position: absolute;
  bottom: 4px;
  right: 4px;
  width: 14px;
  height: 14px;
  background: linear-gradient(135deg, var(--accent-1), var(--accent-2));
  border: 2px solid #fff;
  border-radius: 3px;
  z-index: 30;
  box-shadow: 0 2px 6px rgba(124, 58, 237, 0.4);
  pointer-events: auto;
  cursor: nwse-resize;
  touch-action: none;
}

.text-resize-handle::before {
  content: '';
  position: absolute;
  inset: -15px;
}

.content-rotate-handle {
  position: absolute;
  left: 50%;
  top: auto;
  bottom: -30px;
  z-index: 35;
  width: 18px;
  height: 18px;
  border: 2px solid #fff;
  border-radius: 50%;
  background: #22d3ee;
  box-shadow: 0 2px 8px rgba(34,211,238,.45);
  transform: translateX(-50%);
  cursor: grab;
  pointer-events: auto;
  touch-action: none;
}

.content-rotate-handle::after {
  content: '';
  position: absolute;
  left: 50%;
  bottom: 16px;
  width: 1px;
  height: 14px;
  background: #67e8f9;
}

.content-rotate-handle::before { content:''; position:absolute; inset:-13px; border-radius:50%; }

.content-transform-feedback {
  display: none;
}

.content-transform-feedback[hidden] {
  display: none !important;
}

.inline-text-editor {
  position: absolute;
  z-index: 300;
  min-width: 80px;
  min-height: 48px;
  padding: 5px 8px;
  border: 1px solid #67e8f9;
  border-radius: 6px;
  outline: 3px solid rgba(34,211,238,.18);
  background: rgba(5,7,11,.8);
  line-height: 1.35;
  resize: none;
  transform-origin: center;
}

/* ===== AI多角度预览 ===== */

.btn-ai-preview {
  width: 100%;
  height: 52px;
  border: none;
  border-radius: 14px;
  background: linear-gradient(135deg, #7c3aed 0%, #ec4899 50%, #f59e0b 100%);
  background-size: 200% 200%;
  color: #fff;
  font-family: var(--font-display);
  font-size: 15px;
  font-weight: 700;
  letter-spacing: 0.5px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  cursor: pointer;
  position: relative;
  overflow: hidden;
  transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1);
  animation: gradientShift 4s ease infinite;
  box-shadow: 0 4px 20px rgba(124, 58, 237, 0.4), inset 0 1px 0 rgba(255, 255, 255, 0.2);
}

.btn-ai-preview:active {
  transform: scale(0.97);
}

.btn-ai-preview .btn-icon {
  font-size: 18px;
}

/* AI模态框 */
.ai-modal {
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
}

.ai-modal-mask {
  position: absolute;
  top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(8px);
}

.ai-modal-content {
  position: relative;
  background: linear-gradient(145deg, #14142a 0%, #0e0e1c 100%);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 20px;
  width: 92%;
  max-width: 480px;
  max-height: 85vh;
  display: flex;
  flex-direction: column;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5), 0 0 0 1px rgba(124, 58, 237, 0.1);
  animation: aiModalIn 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes aiModalIn {
  from { opacity: 0; transform: scale(0.92) translateY(20px); }
  to { opacity: 1; transform: scale(1) translateY(0); }
}

.ai-gallery-content {
  max-width: 760px;
  max-height: 90vh;
}

.ai-modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 24px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

.ai-modal-title {
  font-family: var(--font-display);
  font-size: 18px;
  font-weight: 700;
  color: #fff;
  letter-spacing: 0.5px;
}

.ai-modal-close {
  width: 44px;
  height: 44px;
  padding: 0;
  border: none;
  background: transparent;
  font-size: 28px;
  color: rgba(255, 255, 255, 0.4);
  cursor: pointer;
  line-height: 1;
  transition: color 0.2s;
  user-select: none;
}

.ai-modal-close:hover {
  color: #fff;
}

.ai-modal-body {
  flex: 1;
  overflow-y: auto;
  padding: 20px 24px;
}

.ai-modal-footer {
  display: flex;
  gap: 12px;
  padding: 16px 24px;
  border-top: 1px solid rgba(255, 255, 255, 0.06);
}

.ai-btn-cancel, .ai-btn-confirm {
  flex: 1;
  height: 44px;
  border: none;
  border-radius: 12px;
  font-family: var(--font-display);
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
}

.ai-btn-cancel {
  background: rgba(255, 255, 255, 0.06);
  color: rgba(255, 255, 255, 0.7);
  border: 1px solid rgba(255, 255, 255, 0.08);
}

.ai-btn-cancel:active {
  transform: scale(0.97);
}

.ai-btn-confirm {
  background: linear-gradient(135deg, #7c3aed 0%, #ec4899 100%);
  color: #fff;
  box-shadow: 0 4px 14px rgba(124, 58, 237, 0.35);
}

.ai-btn-confirm:active {
  transform: scale(0.97);
}

.ai-btn-confirm:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* 视角选择列表 */
.ai-angle-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.ai-angle-item {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px 16px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: 12px;
  cursor: pointer;
  transition: all 0.2s;
}

.ai-angle-item:hover {
  background: rgba(255, 255, 255, 0.05);
  border-color: rgba(124, 58, 237, 0.3);
}

.ai-angle-item.selected {
  background: linear-gradient(135deg, rgba(124, 58, 237, 0.15) 0%, rgba(236, 72, 153, 0.1) 100%);
  border-color: rgba(124, 58, 237, 0.5);
}

.ai-angle-checkbox {
  width: 22px;
  height: 22px;
  border-radius: 6px;
  border: 2px solid rgba(255, 255, 255, 0.2);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: all 0.2s;
}

.ai-angle-item.selected .ai-angle-checkbox {
  background: linear-gradient(135deg, #7c3aed, #ec4899);
  border-color: transparent;
}

.ai-angle-checkbox::after {
  content: '';
  width: 6px;
  height: 10px;
  border: solid #fff;
  border-width: 0 2px 2px 0;
  transform: rotate(45deg) scale(0);
  transition: transform 0.2s;
}

.ai-angle-item.selected .ai-angle-checkbox::after {
  transform: rotate(45deg) scale(1);
}

.ai-angle-info {
  flex: 1;
}

.ai-angle-name {
  font-size: 15px;
  font-weight: 600;
  color: #fff;
  margin-bottom: 2px;
}

.ai-angle-desc {
  font-size: 12px;
  color: rgba(255, 255, 255, 0.4);
}

/* 生成进度 */
.ai-generate-progress {
  margin-top: 16px;
  padding: 16px;
  background: rgba(255, 255, 255, 0.03);
  border-radius: 12px;
  text-align: center;
}

.ai-progress-bar {
  width: 100%;
  height: 6px;
  background: rgba(255, 255, 255, 0.06);
  border-radius: 3px;
  overflow: hidden;
  margin-bottom: 10px;
}

.ai-progress-fill {
  height: 100%;
  background: linear-gradient(90deg, #7c3aed, #ec4899, #f59e0b);
  background-size: 200% 100%;
  border-radius: 3px;
  width: 0%;
  transition: width 0.4s ease;
  animation: gradientShift 2s linear infinite;
}

.ai-progress-text {
  font-size: 13px;
  color: rgba(255, 255, 255, 0.6);
}

/* AI结果画廊 */
.ai-gallery-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 16px;
}

.ai-gallery-empty {
  grid-column: 1 / -1;
  text-align: center;
  padding: 40px 20px;
  color: var(--text-muted);
  font-size: 14px;
}

.ai-generate-info {
  padding: 20px 16px;
  text-align: center;
}

.ai-info-text {
  font-size: 14px;
  color: var(--text-primary);
  margin-bottom: 8px;
  line-height: 1.6;
}

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

/* AI生成面板 - 新增 */
.ai-generate-content {
  max-width: 560px;
}

.ai-section {
  margin-bottom: 18px;
}

.ai-section-label {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 10px;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-primary);
}

.ai-section-label > span:first-child {
  flex-shrink: 0;
}

.ai-mode-switch {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.ai-mode-item {
  min-height: 72px;
  padding: 12px 14px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.035);
  color: var(--text-primary);
  text-align: left;
  cursor: pointer;
  transition: border-color 0.2s, background 0.2s, transform 0.2s;
}

.ai-mode-item:hover { border-color: rgba(0, 229, 255, 0.35); }
.ai-mode-item.active {
  border-color: rgba(0, 229, 255, 0.62);
  background: linear-gradient(135deg, rgba(0, 229, 255, 0.12), rgba(124, 58, 237, 0.15));
  box-shadow: inset 0 0 0 1px rgba(0, 229, 255, 0.14);
}
.ai-mode-item strong,
.ai-mode-item small { display: block; }
.ai-mode-item strong { margin-bottom: 5px; font-size: 14px; }
.ai-mode-item small { color: var(--text-muted); font-size: 11px; line-height: 1.45; }

.ai-mode-note,
.ai-trust-note {
  margin: 9px 0 0;
  color: var(--text-muted);
  font-size: 12px;
  line-height: 1.55;
}

.ai-trust-note {
  margin-bottom: 14px;
  padding: 10px 12px;
  border: 1px solid rgba(245, 158, 11, 0.2);
  border-radius: 10px;
  background: rgba(245, 158, 11, 0.07);
  color: #d8c59a;
}

.ai-btn-text {
  background: rgba(124, 58, 237, 0.1);
  color: #c4b5fd;
  border: 1px solid rgba(124, 58, 237, 0.25);
  border-radius: 6px;
  padding: 5px 12px;
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s;
  font-family: var(--font-body);
}

.ai-btn-text:hover {
  background: rgba(124, 58, 237, 0.2);
  border-color: rgba(124, 58, 237, 0.4);
}

.ai-btn-text:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.ai-preview-box {
  width: 100%;
  height: 180px;
  background: rgba(0, 0, 0, 0.3);
  border: 1px dashed rgba(255, 255, 255, 0.1);
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

.ai-preview-empty {
  color: var(--text-muted);
  font-size: 13px;
}

.ai-preview-img {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
}

.ai-prompt-input {
  width: 100%;
  min-height: 100px;
  padding: 12px 14px;
  background: rgba(0, 0, 0, 0.3);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 10px;
  color: var(--text-primary);
  font-size: 13px;
  font-family: var(--font-body);
  line-height: 1.6;
  resize: vertical;
  outline: none;
  transition: border-color 0.2s;
}

.ai-prompt-input:focus {
  border-color: rgba(124, 58, 237, 0.5);
}

.ai-prompt-input::placeholder {
  color: var(--text-muted);
}

/* AI视角选择卡片 */
.ai-angle-hint {
  font-size: 11px;
  font-weight: 400;
  color: var(--text-muted);
}

.ai-angle-list {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
}

.ai-angle-item {
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 12px;
  padding: 14px 8px;
  text-align: center;
  cursor: pointer;
  transition: all 0.2s;
  user-select: none;
}

.ai-angle-item:hover {
  border-color: rgba(124, 58, 237, 0.3);
  background: rgba(124, 58, 237, 0.06);
}

.ai-angle-item.active {
  border-color: rgba(124, 58, 237, 0.6);
  background: rgba(124, 58, 237, 0.15);
  box-shadow: 0 0 0 1px rgba(124, 58, 237, 0.3) inset;
}

.ai-angle-icon {
  font-size: 22px;
  color: var(--text-muted);
  margin-bottom: 6px;
  line-height: 1;
}

.ai-angle-item.active .ai-angle-icon {
  color: #c4b5fd;
}

.ai-angle-name {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 2px;
}

.ai-angle-desc {
  font-size: 11px;
  color: var(--text-muted);
  line-height: 1.2;
}

@media (max-width: 480px) {
  .ai-angle-list {
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
  }
  .ai-angle-item {
    padding: 12px 4px;
  }
  .ai-angle-icon {
    font-size: 20px;
  }
  .ai-angle-name {
    font-size: 12px;
  }
  .ai-angle-desc {
    font-size: 10px;
  }
}

.ai-gallery-item {
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: 14px;
  overflow: hidden;
  transition: all 0.25s;
}

.ai-gallery-item:hover {
  border-color: rgba(124, 58, 237, 0.3);
  transform: translateY(-2px);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.3);
}

.ai-gallery-img-wrap {
  width: 100%;
  aspect-ratio: 4 / 3;
  overflow: hidden;
  cursor: pointer;
  background: #0a0a14;
  border: none;
  padding: 0;
  display: block;
  position: relative;
}

.ai-gallery-badge {
  position: absolute;
  top: 8px;
  left: 8px;
  background: rgba(124, 58, 237, 0.85);
  color: #fff;
  font-size: 11px;
  font-weight: 600;
  padding: 3px 8px;
  border-radius: 4px;
  backdrop-filter: blur(4px);
  pointer-events: none;
}

.ai-gallery-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.3s;
}

.ai-gallery-item:hover .ai-gallery-img {
  transform: scale(1.05);
}

.ai-gallery-info {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 10px 14px;
}

.ai-gallery-label {
  font-size: 13px;
  font-weight: 600;
  color: rgba(255, 255, 255, 0.8);
}

.ai-gallery-save {
  background: rgba(124, 58, 237, 0.2);
  border: 1px solid rgba(124, 58, 237, 0.3);
  border-radius: 8px;
  padding: 5px 12px;
  color: #c4b5fd;
  font-size: 12px;
  cursor: pointer;
  transition: all 0.2s;
}

.ai-gallery-save:hover {
  background: rgba(124, 58, 237, 0.35);
  color: #fff;
}

.ai-gallery-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 6px;
}

.ai-gallery-fit {
  border-color: rgba(0, 229, 255, 0.34);
  background: rgba(0, 229, 255, 0.1);
  color: #8befff;
}

.ai-gallery-edit {
  border-color: rgba(236, 72, 153, 0.48);
  background: linear-gradient(135deg, rgba(124, 58, 237, 0.28), rgba(236, 72, 153, 0.2));
  color: #f5d0fe;
}

.ai-gallery-edit:hover {
  border-color: rgba(244, 114, 182, 0.78);
  background: linear-gradient(135deg, rgba(124, 58, 237, 0.5), rgba(236, 72, 153, 0.38));
  color: #fff;
}

@media (max-width: 560px) {
  .ai-mode-switch { grid-template-columns: 1fr; }
  .ai-mode-item { min-height: 62px; }
  .ai-gallery-info { align-items: flex-start; flex-direction: column; }
  .ai-gallery-actions { width: 100%; justify-content: stretch; }
  .ai-gallery-actions .ai-gallery-save { min-height: 44px; flex: 1 1 auto; }
}

.ai-gallery-error {
  padding: 30px 16px;
  text-align: center;
}

.ai-gallery-error-text {
  font-size: 13px;
  color: #ff6b7a;
  margin-bottom: 8px;
}

.ai-gallery-retry {
  background: rgba(255, 71, 87, 0.15);
  border: 1px solid rgba(255, 71, 87, 0.3);
  border-radius: 8px;
  padding: 6px 16px;
  color: #ff6b7a;
  font-size: 12px;
  cursor: pointer;
}

/* 大图查看器 */
.ai-viewer {
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  z-index: 1100;
  display: flex;
  align-items: center;
  justify-content: center;
}

.ai-viewer-mask {
  position: absolute;
  top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(0, 0, 0, 0.9);
}

.ai-viewer-content {
  position: relative;
  max-width: 90vw;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.ai-viewer-img {
  max-width: 90vw;
  max-height: 75vh;
  border-radius: 12px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.6);
}

.ai-viewer-bar {
  display: flex;
  align-items: center;
  gap: 20px;
  margin-top: 16px;
}

.ai-viewer-label {
  font-size: 15px;
  font-weight: 600;
  color: rgba(255, 255, 255, 0.8);
}

.ai-viewer-save {
  background: linear-gradient(135deg, #7c3aed, #ec4899);
  border: none;
  border-radius: 10px;
  padding: 8px 20px;
  color: #fff;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  box-shadow: 0 4px 14px rgba(124, 58, 237, 0.35);
}

.ai-viewer-close {
  position: absolute;
  top: -40px;
  right: 0;
  font-size: 32px;
  width: 44px;
  height: 44px;
  padding: 0;
  border: none;
  background: transparent;
  color: rgba(255, 255, 255, 0.5);
  cursor: pointer;
  transition: color 0.2s;
}

.ai-viewer-close:hover {
  color: #fff;
}

/* ===== Share / Remaining Count ===== */
.ai-header-right {
  display: flex;
  align-items: center;
  gap: 12px;
}

.ai-remaining-badge {
  background: linear-gradient(135deg, rgba(124, 58, 237, 0.3), rgba(236, 72, 153, 0.3));
  border: 1px solid rgba(124, 58, 237, 0.4);
  border-radius: 100px;
  padding: 4px 12px;
  font-size: 12px;
  font-weight: 600;
  color: #c4b5fd;
  font-family: var(--font-display);
}

.ai-remaining-count {
  color: #fff;
  font-weight: 700;
  font-size: 14px;
}

.ai-share-tip {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: linear-gradient(135deg, rgba(124, 58, 237, 0.15), rgba(236, 72, 153, 0.1));
  border: 1px solid rgba(124, 58, 237, 0.25);
  border-radius: var(--radius-md);
  padding: 10px 14px;
  margin-top: 14px;
  font-size: 13px;
  color: var(--text-secondary);
}

.ai-share-tip span {
  color: #c4b5fd;
  font-weight: 500;
}

.share-modal-content {
  max-width: 420px;
}

.share-reward-card {
  display: flex;
  align-items: center;
  gap: 14px;
  background: linear-gradient(135deg, rgba(124, 58, 237, 0.15), rgba(236, 72, 153, 0.1));
  border: 1px solid rgba(124, 58, 237, 0.3);
  border-radius: var(--radius-lg);
  padding: 16px;
  margin-bottom: 18px;
}

.share-reward-icon {
  font-size: 36px;
  flex-shrink: 0;
}

.share-reward-title {
  font-size: 14px;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 4px;
  font-family: var(--font-display);
}

.share-reward-desc {
  font-size: 12px;
  color: var(--text-secondary);
  line-height: 1.5;
}

.share-ad-card {
  background: linear-gradient(135deg, rgba(217, 154, 37, 0.18), rgba(236, 72, 153, 0.08));
  border-color: rgba(217, 154, 37, 0.4);
}

.share-ad-btn {
  margin-left: auto;
  flex-shrink: 0;
  border: none;
  border-radius: var(--radius-md);
  background: linear-gradient(135deg, #e0a82e, #d99a25);
  color: #211705;
  font-weight: 700;
  font-size: 13px;
  padding: 10px 16px;
  cursor: pointer;
  font-family: var(--font-display);
  white-space: nowrap;
}

.share-ad-btn:hover { filter: brightness(1.05); }
.share-ad-btn:active { transform: scale(0.97); }

.ai-share-tip-actions {
  display: inline-flex;
  gap: 8px;
  flex-shrink: 0;
}

.ai-btn-ad {
  background: linear-gradient(135deg, #e0a82e, #d99a25);
  color: #211705;
  border-color: transparent;
}
.ai-btn-ad:hover {
  background: linear-gradient(135deg, #e6b347, #e0a82e);
  border-color: transparent;
}

.share-link-section {
  margin-bottom: 20px;
}

.share-link-label {
  font-size: 13px;
  color: var(--text-secondary);
  margin-bottom: 8px;
  font-weight: 500;
}

.share-link-row {
  display: flex;
  gap: 8px;
}

.share-link-input {
  flex: 1;
  background: var(--glass);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
  color: var(--text-primary);
  font-size: 12px;
  font-family: 'Courier New', monospace;
  outline: none;
  overflow: hidden;
  text-overflow: ellipsis;
}

.share-copy-btn {
  background: linear-gradient(135deg, var(--accent-1), var(--accent-2));
  border: none;
  border-radius: var(--radius-sm);
  padding: 0 16px;
  color: #fff;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
  font-family: var(--font-display);
  white-space: nowrap;
}

.share-copy-btn:active {
  transform: scale(0.96);
}

.share-stats {
  display: flex;
  gap: 10px;
}

.share-stat-item {
  flex: 1;
  text-align: center;
  background: var(--glass);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-md);
  padding: 14px 8px;
}

.share-stat-num {
  font-size: 22px;
  font-weight: 800;
  background: linear-gradient(135deg, #a78bfa, #f472b6, #fbbf24);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  font-family: var(--font-display);
  margin-bottom: 4px;
}

.share-stat-label {
  font-size: 11px;
  color: var(--text-muted);
}

/* ===== Control Panel — glassmorphism ===== */
.control-panel {
  background: rgba(13, 13, 26, 0.85);
  backdrop-filter: blur(30px);
  border-top: 1px solid var(--glass-border);
  padding: 16px 16px;
  padding-bottom: calc(16px + env(safe-area-inset-bottom));
  border-radius: var(--radius-xl) var(--radius-xl) 0 0;
  box-shadow: 0 -8px 30px rgba(0, 0, 0, 0.4), inset 0 1px 0 rgba(255, 255, 255, 0.06);
  position: relative;
  flex: 1;
  overflow-y: auto;
  min-height: 0;
}

.control-panel::before {
  content: '';
  position: absolute;
  top: 7px; left: 50%;
  transform: translateX(-50%);
  width: 36px; height: 4px;
  background: rgba(255, 255, 255, 0.12);
  border-radius: 2px;
}

.frame-tip {
  text-align: center;
  padding: 10px 0;
  font-size: 13px;
  color: var(--text-muted);
}

.frame-tip span,
.empty-tip span,
.preview-tip span,
.info-label,
.ai-share-tip > span,
.ai-btn-text {
  display: inline-flex;
  align-items: center;
  gap: 7px;
}

.frame-tip .ui-icon,
.empty-tip .ui-icon,
.preview-tip .ui-icon,
.info-label .ui-icon,
.ai-share-tip .ui-icon,
.ai-btn-text .ui-icon {
  font-size: 17px;
  color: #c4b5fd;
}

.geometry-panel {
  margin-top: 14px;
  padding: 12px;
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-md);
  background: rgba(255, 255, 255, 0.025);
}

.geometry-panel-summary {
  display: none;
}

.geometry-panel-summary,
.alignment-preview-header {
  list-style: none;
}

.geometry-panel-summary::-webkit-details-marker,
.alignment-preview-header::-webkit-details-marker {
  display: none;
}

.physical-size-panel {
  margin-top: 10px;
  padding: 12px;
  border: 1px solid rgba(158,120,255,.2);
  border-radius: var(--radius-md);
  background: rgba(105,65,215,.055);
}
.physical-size-header { min-height: 32px; display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 10px; cursor: pointer; list-style: none; }
.physical-size-header::-webkit-details-marker { display: none; }
.physical-size-header::after { content: '⌄'; color: #8f83b5; transition: transform 180ms ease; }
.physical-size-panel[open] .physical-size-header::after { transform: rotate(180deg); }
.physical-size-panel:not([open]) .physical-size-header { margin-bottom: 0; }
.physical-size-header strong { color: #ededf4; font-size: 12px; }
.physical-size-header > span { margin-left: auto; padding: 3px 6px; border-radius: 99px; background: rgba(255,255,255,.06); color: #888899; font-size: 9px; }
.project-name-field { display: grid; gap: 5px; margin-bottom: 10px; }
.project-name-field > span { color: #9292a4; font-size: 10px; }
.project-name-field input {
  width: 100%;
  height: 38px;
  min-width: 0;
  padding: 0 10px;
  border: 1px solid rgba(255,255,255,.11);
  border-radius: 8px;
  outline: none;
  background: #1d1d2c;
  color: #f1f1f5;
  font-size: 12px;
}
.project-name-field input:focus { border-color: #8a65e8; box-shadow: 0 0 0 3px rgba(105,65,215,.16); }
.physical-size-fields { display: grid; grid-template-columns: minmax(0,1fr) auto minmax(0,1fr) 72px; align-items: end; gap: 6px; }
.physical-size-fields label { display: grid; gap: 5px; min-width: 0; }
.physical-size-fields label > span { color: #9292a4; font-size: 10px; }
.physical-size-fields b { padding-bottom: 10px; color: #77778a; font-size: 11px; font-weight: 500; }
.physical-size-fields input,
.physical-size-fields select {
  width: 100%;
  height: 38px;
  min-width: 0;
  padding: 0 8px;
  border: 1px solid rgba(255,255,255,.11);
  border-radius: 8px;
  outline: none;
  background: #1d1d2c;
  color: #f1f1f5;
  font-size: 12px;
}
.physical-size-fields input:focus,
.physical-size-fields select:focus { border-color: #8a65e8; box-shadow: 0 0 0 3px rgba(105,65,215,.16); }
.physical-size-fields input[aria-invalid="true"] { border-color: #ef646d; }
.physical-size-area { min-height: 34px; display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-top: 9px; padding: 7px 9px; border-radius: 8px; background: rgba(124,58,237,.1); }
.physical-size-area[hidden] { display: none; }
.physical-size-area span { color: #9b94ad; font-size: 10px; }
.physical-size-area strong { margin-left: auto; color: #ded3ff; font: 700 12px var(--font-display); font-variant-numeric: tabular-nums; }
.physical-size-area button { min-height: 28px; padding: 0 9px; border: 1px solid rgba(196,181,253,.2); border-radius: 6px; background: rgba(124,58,237,.14); color: #cfc3f7; font-size: 10px; cursor: pointer; }
.physical-size-area button:hover { border-color: rgba(196,181,253,.4); color: #fff; }
.physical-size-toggle { min-height: 38px; display: flex; align-items: center; gap: 8px; margin-top: 8px; color: #b8b8c5; font-size: 11px; cursor: pointer; }
.physical-size-toggle input { width: 16px; height: 16px; accent-color: #7955df; }
.physical-size-toggle:has(input:disabled) { color: #6f6f80; cursor: not-allowed; }
#physical-size-status { margin: 0; color: #77778a; font-size: 10px; line-height: 1.45; }

.alignment-preview-panel {
  margin-top: 14px;
  padding: 12px;
  border: 1px solid rgba(34, 211, 238, 0.18);
  border-radius: var(--radius-md);
  background: linear-gradient(135deg, rgba(34, 211, 238, 0.045), rgba(124, 58, 237, 0.05));
}

.alignment-preview-header,
.alignment-patterns {
  display: flex;
  align-items: center;
}

.alignment-preview-header {
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 10px;
}

.alignment-preview-status {
  color: var(--text-muted);
  font-size: 11px;
}

.alignment-preview-active .alignment-preview-status {
  color: #67e8f9;
}

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

.alignment-preview-actions button,
.alignment-patterns button {
  min-height: 44px;
  border: 1px solid var(--glass-border-bright);
  border-radius: var(--radius-sm);
  background: var(--glass);
  color: var(--text-secondary);
  cursor: pointer;
  touch-action: manipulation;
}

.alignment-preview-actions button:active {
  transform: scale(0.97);
}

.alignment-hold-btn[aria-pressed="true"],
.alignment-lock-btn.active {
  border-color: rgba(34, 211, 238, 0.65);
  background: rgba(34, 211, 238, 0.12);
  color: #cffafe;
  box-shadow: 0 0 16px rgba(34, 211, 238, 0.12);
}

.alignment-patterns {
  gap: 6px;
  margin-top: 9px;
}

.alignment-patterns > span {
  margin-right: auto;
  color: var(--text-muted);
  font-size: 11px;
}

.alignment-patterns button {
  min-width: 52px;
  min-height: 44px;
  padding: 0 10px;
  font-size: 12px;
}

.alignment-patterns button.active {
  border-color: rgba(124, 58, 237, 0.75);
  background: rgba(124, 58, 237, 0.18);
  color: var(--text-primary);
}

.alignment-snap-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-top: 9px;
  color: var(--text-muted);
  font-size: 11px;
}

.alignment-snap-row button {
  min-width: 72px;
  min-height: 44px;
  border: 1px solid var(--glass-border-bright);
  border-radius: var(--radius-sm);
  background: var(--glass);
  color: var(--text-muted);
  cursor: pointer;
}

.alignment-snap-row button.active {
  border-color: rgba(34, 211, 238, 0.55);
  background: rgba(34, 211, 238, 0.1);
  color: #a5f3fc;
}

.alignment-preview-hint {
  margin-top: 9px;
  color: var(--text-muted);
  font-size: 11px;
  line-height: 1.45;
}

.alignment-snap-suggestion {
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: 12px;
  padding: 11px 12px;
  border: 1px solid rgba(34, 211, 238, 0.45);
  border-radius: var(--radius-md);
  background: rgba(8, 47, 58, 0.42);
  box-shadow: 0 8px 24px rgba(3, 105, 161, 0.12);
}

.alignment-snap-suggestion > div:first-child {
  min-width: 0;
}

.alignment-snap-suggestion span,
.alignment-snap-suggestion strong {
  display: block;
}

.alignment-snap-suggestion span {
  color: #cffafe;
  font-size: 12px;
}

.alignment-snap-suggestion strong {
  margin-top: 3px;
  color: #67e8f9;
  font-size: 11px;
  font-variant-numeric: tabular-nums;
}

.alignment-snap-actions {
  display: flex;
  gap: 6px;
  flex-shrink: 0;
}

.alignment-snap-actions button {
  min-height: 44px;
  padding: 0 11px;
  border: 1px solid var(--glass-border-bright);
  border-radius: var(--radius-sm);
  background: var(--glass);
  color: var(--text-secondary);
  cursor: pointer;
}

#btn-apply-edge-snap {
  border-color: rgba(34, 211, 238, 0.55);
  background: rgba(34, 211, 238, 0.14);
  color: #cffafe;
}

@media (max-width: 420px) {
  .alignment-snap-suggestion {
    align-items: stretch;
    flex-direction: column;
  }

  .alignment-snap-actions button {
    flex: 1;
  }
}

.alignment-preview-locked [data-frame-action]:disabled,
.alignment-preview-locked #mode-rect:disabled,
.alignment-preview-locked #mode-free:disabled,
.alignment-preview-locked #btn-reset-frame:disabled {
  opacity: 0.42;
  cursor: not-allowed;
}

.alignment-preview-active .frame-overlay,
.alignment-preview-active .handle {
  display: none !important;
}

.alignment-preview-locked .canvas-wrapper {
  cursor: default;
}

.alignment-magnifier {
  position: fixed;
  left: 16px;
  top: 16px;
  z-index: 1200;
  display: none;
  width: 176px;
  padding: 8px;
  border: 1px solid rgba(34, 211, 238, 0.7);
  border-radius: 14px;
  background: rgba(8, 10, 18, 0.94);
  box-shadow: 0 16px 44px rgba(0, 0, 0, 0.48), 0 0 24px rgba(34, 211, 238, 0.15);
  pointer-events: none;
  backdrop-filter: blur(12px);
}

.alignment-magnifier.active {
  display: block;
}

.alignment-magnifier canvas {
  display: block;
  width: 160px;
  height: 160px;
  border-radius: 8px;
  image-rendering: pixelated;
}

.alignment-magnifier-meta {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 8px;
  padding: 7px 2px 1px;
  color: var(--text-muted);
  font-size: 10px;
}

.alignment-magnifier-meta strong {
  color: #67e8f9;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  line-height: 1.35;
}

.geometry-values {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 6px;
  margin-bottom: 10px;
}

.geometry-values span {
  min-width: 0;
  padding: 7px 5px;
  border-radius: var(--radius-sm);
  background: rgba(255, 255, 255, 0.04);
  color: var(--text-muted);
  font-size: 11px;
  text-align: center;
}

.geometry-values strong {
  display: block;
  margin-top: 2px;
  color: var(--text-primary);
  font-family: var(--font-display);
  font-size: 13px;
  font-variant-numeric: tabular-nums;
}

.geometry-actions {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 6px;
}

.geometry-actions button {
  min-width: 0;
  min-height: 44px;
  padding: 0;
  border: 1px solid var(--glass-border-bright);
  border-radius: var(--radius-sm);
  background: var(--glass);
  color: var(--text-primary);
  cursor: pointer;
}

.geometry-actions button:active {
  transform: scale(0.94);
  background: rgba(124, 58, 237, 0.2);
}

.geometry-hint {
  margin-top: 9px;
  color: var(--text-muted);
  font-size: 11px;
  line-height: 1.4;
  text-align: center;
}

/* Button Row */
.btn-row {
  display: flex;
  gap: 10px;
  margin-top: 14px;
  padding-top: 14px;
  border-top: 1px solid var(--glass-border);
}

.btn-secondary {
  flex: 1;
  height: 46px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--glass);
  color: var(--text-primary);
  border: 1px solid var(--glass-border-bright);
  border-radius: var(--radius-md);
  font-family: var(--font-display);
  font-size: 14px;
  font-weight: 600;
  letter-spacing: 0.5px;
  cursor: pointer;
  transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

.btn-secondary:active {
  background: var(--glass-hover);
  transform: scale(0.97);
  border-color: rgba(255, 255, 255, 0.2);
}

.btn-primary {
  flex: 2;
  height: 46px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, var(--accent-1) 0%, var(--accent-2) 50%, var(--accent-3) 100%);
  background-size: 200% 200%;
  color: #fff;
  border: none;
  border-radius: var(--radius-md);
  font-family: var(--font-display);
  font-size: 15px;
  font-weight: 700;
  box-shadow:
    0 8px 20px rgba(124, 58, 237, 0.4),
    0 3px 8px rgba(236, 72, 153, 0.25),
    inset 0 1px 0 rgba(255, 255, 255, 0.3),
    inset 0 -2px 0 rgba(0, 0, 0, 0.12);
  position: relative;
  overflow: hidden;
  letter-spacing: 1px;
  cursor: pointer;
  transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
  animation: gradientShift 4s ease infinite;
}

.btn-primary::before {
  content: '';
  position: absolute;
  top: 0; left: -100%;
  width: 60%; height: 100%;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.35), transparent);
  animation: shimmer 3s ease-in-out infinite;
}

.btn-primary:active {
  transform: translateY(2px) scale(0.975);
  box-shadow:
    0 4px 10px rgba(124, 58, 237, 0.3),
    0 1px 4px rgba(236, 72, 153, 0.2),
    inset 0 1px 0 rgba(255, 255, 255, 0.2);
}

.btn-delete {
  width: 100%;
  height: 42px;
  background: rgba(239, 68, 68, 0.1);
  color: #f87171;
  border: 1px solid rgba(239, 68, 68, 0.25);
  border-radius: var(--radius-sm);
  font-family: var(--font-body);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
}

.btn-delete:active {
  background: rgba(239, 68, 68, 0.2);
  transform: scale(0.98);
}

/* Add Content Bar */
.add-content-bar {
  display: flex;
  gap: 10px;
  margin-bottom: 16px;
}

.add-btn {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  padding: 16px 0;
  background: var(--glass);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-md);
  position: relative;
  cursor: pointer;
  transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

.add-btn:active {
  background: var(--glass-hover);
  transform: scale(0.96);
  border-color: var(--glass-border-bright);
}

.add-btn-disabled {
  opacity: 0.45;
  cursor: not-allowed;
  cursor: not-allowed;
}

.add-icon {
  width: 40px; height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, rgba(124, 58, 237, 0.25), rgba(236, 72, 153, 0.2));
  border-radius: var(--radius-md);
  font-size: 19px;
  font-weight: bold;
  color: #a78bfa;
  box-shadow: 0 3px 10px rgba(124, 58, 237, 0.2);
}

.add-icon .ui-icon {
  font-size: 22px;
}

.add-btn:nth-child(2) .add-icon {
  background: linear-gradient(135deg, rgba(52, 211, 153, 0.2), rgba(56, 189, 248, 0.2));
  color: #34d399;
  box-shadow: 0 3px 10px rgba(52, 211, 153, 0.15);
}

.add-btn:nth-child(3) .add-icon {
  background: linear-gradient(135deg, rgba(245, 158, 11, 0.2), rgba(236, 72, 153, 0.2));
  color: #fbbf24;
  box-shadow: 0 3px 10px rgba(245, 158, 11, 0.15);
}

.add-text {
  font-family: var(--font-display);
  font-size: 12px;
  color: var(--text-secondary);
  font-weight: 600;
  letter-spacing: 0.5px;
}

.add-soon {
  position: absolute;
  top: 6px; right: 6px;
  font-size: 9px;
  color: #fbbf24;
  background: rgba(245, 158, 11, 0.15);
  padding: 3px 7px;
  border-radius: 4px;
  font-weight: 600;
  letter-spacing: 0.3px;
}

/* Edit Sections */
.text-edit-panel {
  background: var(--glass);
  border-radius: var(--radius-md);
  padding: 14px 16px;
  margin-bottom: 14px;
  border: 1px solid var(--glass-border);
}

.inspector-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin: -2px 0 14px;
  padding-bottom: 11px;
  border-bottom: 1px solid var(--glass-border);
  color: var(--text-primary);
  font-size: 14px;
  font-weight: 700;
}

.inspector-header b {
  display: inline-grid;
  place-items: center;
  width: 28px;
  height: 28px;
  margin-right: 6px;
  border-radius: 8px;
  background: rgba(124,58,237,.24);
  color: #c4b5fd;
}

.inspector-header > div { display: flex; gap: 6px; }
.mobile-inspector-toggle { display: none; }
.mobile-keyboard-done { display: none; }
.tablet-keyboard-toolbar {
  position: fixed;
  left: 50%;
  bottom: max(14px, env(safe-area-inset-bottom));
  z-index: 900;
  width: min(620px, calc(100% - 32px));
  min-height: 60px;
  display: none;
  grid-template-columns: minmax(100px, 1fr) auto auto auto auto auto;
  align-items: center;
  gap: 8px;
  padding: 7px;
  box-sizing: border-box;
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 16px;
  color: var(--text-primary);
  background: rgba(12, 20, 38, 0.95);
  box-shadow: 0 14px 36px rgba(0, 0, 0, 0.42), inset 0 1px 0 rgba(255, 255, 255, 0.12);
  -webkit-backdrop-filter: blur(18px) saturate(125%);
  backdrop-filter: blur(18px) saturate(125%);
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transform: translate(-50%, 12px);
  transition: opacity 160ms ease, transform 180ms ease, visibility 0s linear 180ms;
}

.tablet-keyboard-field {
  min-width: 0;
  overflow: hidden;
  padding: 0 8px;
  color: var(--text-secondary);
  font-size: 13px;
  font-weight: 600;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.tablet-keyboard-toolbar button {
  min-width: 76px;
  min-height: 46px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 0 12px;
  border: 1px solid var(--glass-border-bright);
  border-radius: 11px;
  color: var(--text-secondary);
  background: rgba(255, 255, 255, 0.06);
  font: inherit;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  touch-action: manipulation;
}

.tablet-keyboard-toolbar button:disabled {
  opacity: 0.38;
  cursor: default;
}

.tablet-keyboard-toolbar .tablet-keyboard-step {
  min-width: 46px;
  padding-inline: 8px;
  color: #d8b4fe;
  font-size: 20px;
  font-variant-numeric: tabular-nums;
}

.tablet-keyboard-toolbar .tablet-keyboard-step[hidden] {
  display: none;
}

.tablet-keyboard-toolbar .tablet-keyboard-done {
  min-width: 92px;
  border-color: rgba(103, 232, 249, 0.48);
  color: #ecfeff;
  background: rgba(8, 95, 125, 0.94);
}

.tablet-keyboard-toolbar .tablet-keyboard-done .ui-icon {
  width: 20px;
  height: 20px;
}

.page-editor.active.editor-input-focused .tablet-keyboard-toolbar {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
  transform: translate(-50%, 0);
  transition: opacity 180ms ease, transform 200ms ease, visibility 0s linear;
}

.page-editor.active.editor-input-focused .tablet-keyboard-toolbar button:not(:disabled):active {
  transform: scale(0.97);
}

.page-editor.active.editor-input-focused .tablet-keyboard-toolbar button:focus-visible {
  outline: 3px solid rgba(165, 243, 252, 0.72);
  outline-offset: 3px;
}

.page-editor input.input-navigation-invalid,
.page-editor textarea.input-navigation-invalid,
.page-editor select.input-navigation-invalid {
  border-color: rgba(251, 113, 133, 0.82) !important;
  box-shadow: 0 0 0 3px rgba(244, 63, 94, 0.16) !important;
}

.input-navigation-error {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 8px;
  grid-column: 1 / -1;
  flex-basis: 100%;
  margin-top: 6px;
  color: #fecdd3;
  font-size: 12px;
  font-weight: 600;
  line-height: 1.45;
}

.input-navigation-error-message {
  flex: 1 1 150px;
}

.input-navigation-error-message::before {
  content: '请修正：';
  color: #fda4af;
}

.input-navigation-fix {
  min-width: 108px;
  min-height: 44px;
  padding: 0 12px;
  border: 1px solid rgba(251, 113, 133, 0.46);
  border-radius: 10px;
  color: #fff1f2;
  background: rgba(159, 18, 57, 0.3);
  font: inherit;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
  touch-action: manipulation;
}

.input-navigation-fix:active {
  transform: scale(0.97);
}

.input-navigation-fix:focus-visible {
  outline: 3px solid rgba(251, 113, 133, 0.46);
  outline-offset: 2px;
}
.mobile-inspector-gesture-coach { display: none; }
.inspector-header button,
.quick-actions button,
.layer-actions button,
.ratio-lock {
  min-height: 44px;
  padding: 0 10px;
  border: 1px solid var(--glass-border-bright);
  border-radius: var(--radius-sm);
  background: var(--glass);
  color: var(--text-secondary);
  cursor: pointer;
}

#btn-delete-content,
[data-content-action="delete"] { color: #fda4af; }

.inspector-textarea {
  min-height: 68px;
  height: auto;
  padding: 10px 12px;
  line-height: 1.45;
  resize: vertical;
}

.input-count {
  display: block;
  margin-top: 5px;
  color: var(--text-muted);
  font-size: 10px;
  text-align: right;
}

.segmented-controls,
.quick-actions,
.layer-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.segmented-controls button {
  flex: 1;
  min-width: 48px;
  min-height: 44px;
  border: 1px solid var(--glass-border-bright);
  border-radius: var(--radius-sm);
  background: var(--glass);
  color: var(--text-muted);
}

.segmented-controls button[aria-pressed="true"],
.ratio-lock.active {
  border-color: rgba(124,58,237,.55);
  background: rgba(124,58,237,.2);
  color: #fff;
}

.value-stepper {
  display: grid;
  grid-template-columns: 44px 1fr 28px 44px;
  align-items: center;
  gap: 5px;
  margin-bottom: 10px;
}

.value-stepper button { min-height: 44px; border: 1px solid var(--glass-border-bright); border-radius: var(--radius-sm); background: var(--glass); color: #fff; }
.value-stepper input,
.numeric-grid input {
  width: 100%;
  min-height: 40px;
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-sm);
  background: rgba(255,255,255,.055);
  color: var(--text-primary);
  text-align: center;
  font-variant-numeric: tabular-nums;
}

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

.numeric-grid label { color: var(--text-muted); font-size: 10px; }
.numeric-grid input { display: block; margin-top: 4px; }

.inspector-details {
  margin-top: 10px;
  padding: 0 10px 10px;
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-sm);
}

.inspector-details-primary {
  margin: 0;
  padding: 0;
  border: 0;
  background: transparent;
}

.inspector-details-primary > summary,
.screen-settings-summary {
  display: none;
}

.inspector-details summary {
  min-height: 44px;
  display: flex;
  align-items: center;
  color: var(--text-secondary);
  font-size: 12px;
  cursor: pointer;
}

.switch-row { display:flex; align-items:center; gap:8px; min-height:44px; color:var(--text-secondary); font-size:12px; }
.ratio-lock { width:100%; margin:8px 0; min-height:44px; }
.layer-actions { margin-top:12px; }
.layer-actions button { flex:1; min-width:54px; }
.compact-color-list { gap:8px; }

.inspector-select {
  width: 100%;
  min-height: 44px;
  margin-bottom: 8px;
  padding: 0 10px;
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-sm);
  background: rgba(255,255,255,.055);
  color: var(--text-primary);
}

.custom-color-control {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 44px;
  margin-top: 8px;
  color: var(--text-muted);
  font-size: 11px;
}

.custom-color-control input { width: 48px; height: 36px; border:0; background:transparent; cursor:pointer; }

.image-size-row {
  display: grid;
  grid-template-columns: 40px minmax(0,1fr) 40px;
  gap: 6px;
  align-items: end;
}

.image-size-row button {
  min-height: 44px;
  border: 1px solid var(--glass-border-bright);
  border-radius: var(--radius-sm);
  background: var(--glass);
  color: #fff;
}

.image-size-row label { color:var(--text-muted); font-size:10px; }
.image-size-row input { width:100%; min-height:44px; margin-top:4px; border:1px solid var(--glass-border); border-radius:var(--radius-sm); background:rgba(255,255,255,.055); color:#fff; text-align:center; }

@media (max-width: 767px), (max-width: 899px) and (orientation: landscape) and (max-height: 520px) {
  #text-edit-panel,
  #image-edit-panel {
    position: fixed;
    left: 8px;
    right: 8px;
    bottom: max(8px, env(safe-area-inset-bottom));
    z-index: 900;
    max-height: min(68dvh, 620px);
    margin: 0;
    padding: 16px;
    overflow-y: auto;
    border-color: rgba(124,58,237,.42);
    border-radius: 20px 20px 14px 14px;
    background: rgba(15,15,30,.97);
    box-shadow: 0 -18px 60px rgba(0,0,0,.5);
    backdrop-filter: blur(22px);
  }

  .inspector-header {
    position: sticky;
    top: -16px;
    z-index: 3;
    margin: -16px -16px 14px;
    padding: 14px 16px 12px;
    background: rgba(15,15,30,.98);
  }

  .content-toolbar button { min-width:44px; padding:0 8px; }
}

.edit-section {
  margin-bottom: 14px;
}

.edit-section:last-child {
  margin-bottom: 0;
}

.edit-label {
  font-family: var(--font-display);
  font-size: 13px;
  color: var(--text-secondary);
  margin-bottom: 8px;
  display: block;
  font-weight: 600;
  letter-spacing: 0.3px;
}

.edit-input {
  width: 100%;
  height: 38px;
  background: rgba(255, 255, 255, 0.06);
  border-radius: var(--radius-sm);
  padding: 0 12px;
  font-family: var(--font-body);
  font-size: 14px;
  color: var(--text-primary);
  border: 1px solid var(--glass-border);
  outline: none;
  transition: border-color 0.2s ease;
}

.edit-input:focus {
  border-color: rgba(124, 58, 237, 0.4);
  background: rgba(255, 255, 255, 0.08);
}

.edit-slider {
  width: 100%;
  -webkit-appearance: none;
  appearance: none;
  height: 6px;
  background: rgba(255, 255, 255, 0.08);
  border-radius: 3px;
  outline: none;
}

.edit-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 18px; height: 18px;
  background: linear-gradient(135deg, var(--accent-1), var(--accent-2));
  border-radius: 50%;
  cursor: pointer;
  box-shadow: 0 2px 8px var(--accent-glow);
}

.edit-slider::-moz-range-thumb {
  width: 18px; height: 18px;
  background: linear-gradient(135deg, var(--accent-1), var(--accent-2));
  border-radius: 50%;
  cursor: pointer;
  border: none;
  box-shadow: 0 2px 8px var(--accent-glow);
}

/* Color List */
.color-list {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.color-item {
  width: 30px; height: 30px;
  border-radius: 50%;
  border: 2px solid rgba(255, 255, 255, 0.1);
  box-sizing: border-box;
  transition: all 0.2s ease;
  box-shadow: 0 3px 8px rgba(0, 0, 0, 0.25);
  cursor: pointer;
}

.color-item:active {
  transform: scale(0.9);
}

.color-item.active {
  border-color: #fff;
  box-shadow: 0 0 0 3px rgba(255, 255, 255, 0.15), 0 4px 12px rgba(0, 0, 0, 0.3);
  transform: scale(1.12);
}

/* Border Width List */
.border-width-list {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.border-width-item {
  padding: 9px 18px;
  background: var(--glass);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-sm);
  font-family: var(--font-display);
  font-size: 12px;
  color: var(--text-secondary);
  font-weight: 600;
  letter-spacing: 0.3px;
  cursor: pointer;
  transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

.border-width-item:active {
  transform: scale(0.94);
}

.border-width-item.active {
  background: linear-gradient(135deg, rgba(124, 58, 237, 0.3), rgba(236, 72, 153, 0.25));
  border-color: rgba(124, 58, 237, 0.5);
  color: #fff;
  box-shadow: 0 4px 12px rgba(124, 58, 237, 0.25), inset 0 1px 0 rgba(255, 255, 255, 0.12);
}

/* Rotate Control */
.rotate-control {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  margin-bottom: 8px;
}

.rotate-btn {
  width: 38px; height: 38px;
  line-height: 36px;
  text-align: center;
  background: var(--glass);
  border: 1px solid var(--glass-border-bright);
  border-radius: var(--radius-sm);
  color: #fff;
  font-size: 16px;
  font-weight: bold;
  cursor: pointer;
  user-select: none;
  transition: all 0.2s ease;
}

.rotate-btn:active {
  transform: scale(0.92);
  background: linear-gradient(135deg, rgba(124, 58, 237, 0.4), rgba(236, 72, 153, 0.4));
  border-color: rgba(124, 58, 237, 0.5);
}

.rotate-btn:nth-child(2),
.rotate-btn:nth-child(4) {
  width: 50px;
  font-size: 12px;
  font-weight: 600;
}

.rotate-value {
  min-width: 64px;
  text-align: center;
  font-family: var(--font-display);
  font-size: 18px;
  font-weight: 700;
  color: #fff;
  background: linear-gradient(135deg, rgba(124, 58, 237, 0.2), rgba(236, 72, 153, 0.15));
  border: 1px solid rgba(124, 58, 237, 0.35);
  border-radius: var(--radius-sm);
  padding: 5px 10px;
  letter-spacing: 0.5px;
}

.rotate-reset {
  width: 100%;
  border: none;
  background: transparent;
  text-align: center;
  font-size: 12px;
  color: var(--text-muted);
  padding: 8px 0;
  cursor: pointer;
  transition: all 0.2s ease;
}

.rotate-reset:active {
  color: #a78bfa;
  transform: scale(0.98);
}

.empty-tip {
  text-align: center;
  padding: 14px 0;
  font-size: 12px;
  color: var(--text-muted);
}

/* Loading */
.loading-mask {
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(6, 6, 16, 0.8);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
  backdrop-filter: blur(12px);
}

.loading-box {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  font-family: var(--font-display);
  font-size: 14px;
  color: var(--text-secondary);
}

.loading-spinner {
  width: 34px; height: 34px;
  border: 3px solid rgba(255, 255, 255, 0.1);
  border-top-color: var(--accent-1);
  border-right-color: var(--accent-2);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}

@keyframes spin {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}

/* ===== Result Page ===== */
.page-result {
  background: transparent;
}

.result-page {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  padding: 20px;
  box-sizing: border-box;
  max-width: 640px;
  margin: 0 auto;
  width: 100%;
}

/* Result Header — branded hero */
.result-header {
  text-align: center;
  padding: 8px 0 16px;
  position: relative;
}

.result-badge {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 6px 16px;
  background: linear-gradient(135deg, rgba(124, 58, 237, 0.2), rgba(236, 72, 153, 0.15));
  border: 1px solid rgba(124, 58, 237, 0.35);
  border-radius: 100px;
  font-family: var(--font-display);
  font-size: 12px;
  font-weight: 600;
  color: #c4b5fd;
  letter-spacing: 0.5px;
  margin-bottom: 12px;
  box-shadow: 0 4px 14px rgba(124, 58, 237, 0.2), inset 0 1px 0 rgba(255, 255, 255, 0.1);
}

@keyframes badgePulse {
  from { box-shadow: 0 4px 14px rgba(124, 58, 237, 0.2), inset 0 1px 0 rgba(255, 255, 255, 0.1); }
  to { box-shadow: 0 6px 22px rgba(236, 72, 153, 0.35), inset 0 1px 0 rgba(255, 255, 255, 0.15); }
}

.result-title {
  font-family: var(--font-display);
  font-size: 26px;
  font-weight: 800;
  background: linear-gradient(135deg, #a78bfa 0%, #f472b6 50%, #fbbf24 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  letter-spacing: 1.5px;
  margin-bottom: 6px;
  filter: drop-shadow(0 2px 12px rgba(124, 58, 237, 0.3));
}

.result-subtitle {
  font-size: 12px;
  color: var(--text-muted);
  letter-spacing: 1px;
  font-weight: 500;
}

.preview-area {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 0;
  padding: 6px 0;
}

/* Preview Frame — glowing showcase */
.preview-frame {
  position: relative;
  padding: 3px;
  border-radius: var(--radius-lg);
  background: linear-gradient(135deg, rgba(124, 58, 237, 0.6) 0%, rgba(236, 72, 153, 0.4) 50%, rgba(245, 158, 11, 0.3) 100%);
  box-shadow:
    0 20px 60px rgba(0, 0, 0, 0.6),
    0 8px 28px rgba(124, 58, 237, 0.35),
    0 0 0 1px rgba(255, 255, 255, 0.06);
  max-width: 100%;
  max-height: 100%;
}

.preview-frame::before {
  content: '';
  position: absolute;
  inset: -2px;
  border-radius: var(--radius-lg);
  background: linear-gradient(135deg, rgba(124, 58, 237, 0.5), rgba(236, 72, 153, 0.4), rgba(245, 158, 11, 0.3));
  filter: blur(12px);
  opacity: 0.6;
  z-index: -1;
  animation: frameGlow 4s ease-in-out infinite alternate;
}

@keyframes frameGlow {
  from { opacity: 0.4; filter: blur(10px); }
  to { opacity: 0.7; filter: blur(16px); }
}

.result-image {
  display: block;
  max-width: 100%;
  max-height: calc(100vh - 320px);
  object-fit: contain;
  border-radius: 14px;
}

.preview-tip {
  text-align: center;
  padding: 10px 0;
  font-size: 12px;
  color: var(--text-muted);
  letter-spacing: 0.3px;
}

/* Info Section — gradient bordered card */
.info-section {
  margin-bottom: 14px;
}

.info-card {
  background: linear-gradient(135deg, rgba(124, 58, 237, 0.06) 0%, rgba(236, 72, 153, 0.04) 100%);
  backdrop-filter: blur(20px);
  border-radius: var(--radius-md);
  padding: 14px 18px;
  border: 1px solid var(--glass-border-bright);
  position: relative;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.25), inset 0 1px 0 rgba(255, 255, 255, 0.05);
}

.info-card::before {
  content: '';
  position: absolute;
  left: 0; top: 12px; bottom: 12px;
  width: 3px;
  background: linear-gradient(180deg, var(--accent-1), var(--accent-2));
  border-radius: 0 2px 2px 0;
  box-shadow: 0 0 8px var(--accent-glow);
}

.info-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 6px 0;
}

.info-row + .info-row {
  border-top: 1px solid var(--glass-border);
}

.info-label {
  font-size: 13px;
  color: var(--text-secondary);
  font-weight: 500;
}

.info-value {
  font-family: var(--font-display);
  font-size: 14px;
  background: linear-gradient(135deg, #c4b5fd, #f9a8d4);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  font-weight: 700;
  letter-spacing: 0.5px;
}

/* Action Section */
.action-section {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding-bottom: env(safe-area-inset-bottom);
}

.btn-save {
  width: 100%;
  height: 54px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  background: linear-gradient(135deg, var(--accent-1) 0%, var(--accent-2) 45%, var(--accent-3) 100%);
  background-size: 200% 200%;
  color: #fff;
  border: none;
  border-radius: var(--radius-lg);
  font-family: var(--font-display);
  font-size: 16px;
  font-weight: 700;
  box-shadow:
    0 10px 28px rgba(124, 58, 237, 0.4),
    0 4px 10px rgba(236, 72, 153, 0.25),
    inset 0 1px 0 rgba(255, 255, 255, 0.3),
    inset 0 -2px 0 rgba(0, 0, 0, 0.12);
  position: relative;
  overflow: hidden;
  letter-spacing: 1px;
  cursor: pointer;
  transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
  animation: gradientShift 4s ease infinite;
}

.btn-save::before {
  content: '';
  position: absolute;
  top: 0; left: -100%;
  width: 60%; height: 100%;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.35), transparent);
  animation: shimmer 3s ease-in-out infinite;
}

.btn-save:active {
  transform: translateY(2px) scale(0.975);
  box-shadow:
    0 5px 14px rgba(124, 58, 237, 0.3),
    0 2px 6px rgba(236, 72, 153, 0.2),
    inset 0 1px 0 rgba(255, 255, 255, 0.2);
}

.btn-icon {
  font-size: 20px;
  display: inline-flex;
}

.btn-edit {
  width: 100%;
  height: 48px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.06), rgba(255, 255, 255, 0.03));
  color: var(--text-primary);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: var(--radius-md);
  font-family: var(--font-display);
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1);
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.2), inset 0 1px 0 rgba(255, 255, 255, 0.06);
  position: relative;
  overflow: hidden;
}

.btn-edit::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, rgba(124, 58, 237, 0.15), rgba(236, 72, 153, 0.1));
  opacity: 0;
  transition: opacity 0.3s ease;
}

.btn-edit:active {
  transform: scale(0.97);
  border-color: rgba(124, 58, 237, 0.4);
}

.btn-edit:active::before {
  opacity: 1;
}

.btn-home {
  width: 100%;
  height: 44px;
  background: transparent;
  color: var(--text-muted);
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  font-family: var(--font-body);
  font-size: 14px;
  cursor: pointer;
  transition: all 0.2s ease;
  letter-spacing: 0.5px;
}

.btn-home:active {
  color: #c4b5fd;
  background: rgba(124, 58, 237, 0.08);
  border-color: rgba(124, 58, 237, 0.2);
}

/* ===== Page Header (固定返回首页按钮) ===== */
.page-header {
  position: sticky;
  top: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  background: rgba(13, 13, 26, 0.85);
  backdrop-filter: blur(20px);
  border-bottom: 1px solid var(--glass-border);
}

.header-back-btn {
  padding: 6px 14px;
  background: var(--glass);
  border: 1px solid var(--glass-border-bright);
  border-radius: 100px;
  color: var(--text-primary);
  font-family: var(--font-body);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
}

.header-back-btn:active {
  background: rgba(124, 58, 237, 0.15);
  border-color: rgba(124, 58, 237, 0.4);
  transform: scale(0.96);
}

.header-title {
  font-family: var(--font-display);
  font-size: 15px;
  font-weight: 700;
  color: var(--text-secondary);
  letter-spacing: 0.5px;
}

.editor-header-actions {
  min-width: 0;
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 8px;
}

.editor-header-actions .editor-benefit-trigger {
  margin-left: 0;
}

@media (min-width: 641px) and (max-width: 1023px) {
  .editor-page > .page-header {
    gap: 8px;
    padding-inline: 12px;
  }

  .editor-page > .page-header .header-title {
    min-width: 0;
    flex: 1 1 auto;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .editor-header-actions {
    flex: 0 0 auto;
    padding-left: 8px;
    border-left: 1px solid var(--glass-border);
  }

  .editor-header-actions .project-export-btn {
    min-width: 108px;
    min-height: 44px;
    padding-inline: 11px;
  }

  .editor-header-actions .editor-ai-btn {
    min-width: 126px;
    min-height: 44px;
    padding-inline: 9px;
  }

  .editor-header-actions .project-export-btn kbd {
    display: none;
  }

  .editor-header-actions .shortcut-help-btn {
    width: 44px;
    height: 44px;
    flex-basis: 44px;
  }

  .editor-header-actions .editor-benefit-trigger {
    min-width: 68px;
    min-height: 44px;
    justify-content: center;
    padding-inline: 9px;
  }

  .editor-header-actions .editor-benefit-trigger span {
    display: none;
  }
}

.editor-history-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-left: auto;
  padding-left: 10px;
  border-left: 1px solid var(--glass-border);
}

.canvas-toolbar .editor-history-actions {
  margin-left: auto;
  padding-left: 14px;
}

.editor-history-actions button {
  min-width: 76px;
  height: 38px;
  padding: 0 9px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  border: 1px solid var(--glass-border-bright);
  border-radius: 9px;
  background: var(--glass);
  color: var(--text-primary);
  cursor: pointer;
}

.editor-history-actions button > span {
  font-size: 18px;
  line-height: 1;
}

.editor-history-actions button b {
  font-size: 11px;
  font-weight: 700;
}

.editor-history-actions kbd {
  padding: 2px 4px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 4px;
  background: rgba(255, 255, 255, 0.035);
  color: var(--text-muted);
  font: 9px/1.2 var(--font-body);
}

.editor-history-state {
  width: 126px;
  max-width: 126px;
  color: var(--text-muted);
  font-size: 10px;
  line-height: 1.3;
  text-align: right;
  white-space: normal;
}

.editor-history-actions button:disabled {
  opacity: 0.35;
  cursor: not-allowed;
}

@media (max-width: 640px) {
  .history-search-bar {
    gap: 7px;
  }

  .history-sort-select {
    width: 104px;
    flex-basis: 104px;
    padding-left: 9px;
  }

  .history-search-count {
    display: none;
  }

  .canvas-toolbar {
    min-height: 44px;
    padding: 3px 4px 3px 10px;
  }

  .canvas-toolbar-title span {
    display: none;
  }

  .editor-save-status {
    min-width: 78px;
    min-height: 28px;
    padding-inline: 7px;
  }

  .editor-save-status time {
    display: none;
  }

  .editor-tab-conflict {
    top: 58px;
    left: max(8px, env(safe-area-inset-left));
    right: max(8px, env(safe-area-inset-right));
    min-height: 60px;
    padding-left: 10px;
    gap: 8px;
    border-radius: 12px;
  }

  .editor-tab-conflict-copy small {
    max-width: 150px;
  }

  .editor-tab-conflict button {
    min-width: 96px;
    min-height: 44px;
    padding-inline: 10px;
  }

  .editor-history-state,
  .editor-history-actions button b,
  .editor-history-actions kbd {
    display: none;
  }

  .editor-history-actions {
    gap: 6px;
    padding-left: 7px;
  }

  .history-restore-canvas-note {
    top: 66px;
  }

  .editor-history-actions button {
    min-width: 38px;
    width: 38px;
    height: 38px;
    padding: 0;
    border-radius: 50%;
  }
}

/* ===== Responsive ===== */
@media (min-width: 768px) {
  .page-index { padding: 40px; }
  .container { max-width: 960px; padding-top: 40px; }
  .hero-section { padding: 56px 36px 44px; }
  .hero-title { font-size: 38px; }
  .hero-subtitle { font-size: 22px; }
  .upload-btn { height: 62px; font-size: 17px; }
  .history-grid { grid-template-columns: repeat(3, 1fr); }
  .control-panel { max-width: 600px; margin: 0 auto; width: 100%; }
  .result-page { max-width: 720px; margin: 0 auto; }
}

@media (min-width: 900px) {
  .features-grid,
  .examples-grid {
    grid-template-columns: repeat(4, 1fr);
  }

  .feature-card {
    min-height: 168px;
  }
}

@media (min-width: 1024px) {
  .page-editor {
    overflow: hidden;
  }

  .editor-page {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(360px, 420px);
    grid-template-rows: auto auto minmax(0, 1fr);
    gap: 14px 18px;
    width: 100%;
    max-width: 1600px;
    height: 100dvh;
    min-height: 0;
    margin: 0 auto;
    padding: 16px 20px 20px;
  }

  .editor-page > .page-header {
    grid-column: 1 / -1;
    grid-row: 1;
    position: relative;
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-lg);
  }

  .editor-page > .step-tabs {
    grid-column: 2;
    grid-row: 2;
    padding: 10px 12px;
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-lg);
  }

  .editor-page > .canvas-container {
    grid-column: 1;
    grid-row: 2 / 4;
    min-width: 0;
    min-height: 0;
    padding: 24px;
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-xl);
    background: rgba(13, 13, 26, 0.55);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.04);
  }

  .editor-page > .control-panel {
    grid-column: 2;
    grid-row: 3;
    width: auto;
    max-width: none;
    min-height: 0;
    margin: 0;
    padding: 18px;
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-xl);
    box-shadow: 0 14px 40px rgba(0, 0, 0, 0.28), inset 0 1px 0 rgba(255, 255, 255, 0.05);
  }

  .editor-page > .control-panel::before {
    display: none;
  }
}

@media (min-width: 1440px) {
  .container { max-width: 1080px; }
  .editor-page {
    grid-template-columns: minmax(0, 1fr) 440px;
    padding-inline: 28px;
  }
}

@media (max-width: 767px) {
  .page-index {
    padding-right: max(16px, env(safe-area-inset-right));
    padding-left: max(16px, env(safe-area-inset-left));
  }

  .page-header {
    padding-top: max(12px, env(safe-area-inset-top));
  }

  .tab-item {
    min-height: 44px;
    padding-inline: 14px;
  }

  .flow-steps {
    gap: 6px;
  }

  .flow-step {
    padding: 16px 6px;
  }

  .flow-line {
    width: 10px;
  }

  .flow-step-title {
    font-size: 14px;
  }

  .flow-step-desc {
    font-size: 11px;
  }
}

@media (max-width: 767px) and (orientation: portrait) {
  #panel-frame {
    flex-direction: column;
  }

  #panel-frame > .frame-tip { order: 0; }
  #panel-frame > .edit-section { order: 1; }
  #panel-frame > .geometry-panel { order: 2; }
  #panel-frame > .alignment-snap-suggestion { order: 3; }
  #panel-frame > .alignment-preview-panel { order: 4; }
  #panel-frame > .physical-size-panel { order: 5; }
  #panel-frame > .btn-row { order: 6; }

  .geometry-panel,
  .alignment-preview-panel,
  .physical-size-panel {
    margin-top: 8px;
    overflow: clip;
    transition: border-color 180ms ease, background-color 180ms ease;
  }

  .geometry-panel:not([open]),
  .alignment-preview-panel:not([open]),
  .physical-size-panel:not([open]) {
    padding: 0;
    border-color: rgba(255, 255, 255, 0.09);
    background: rgba(255, 255, 255, 0.025);
  }

  .geometry-panel-summary,
  .alignment-preview-header,
  .physical-size-header {
    min-height: 52px;
    align-items: center;
    gap: 8px;
    margin-bottom: 10px;
    cursor: pointer;
    touch-action: manipulation;
  }

  .geometry-panel-summary {
    display: flex;
    justify-content: space-between;
  }

  .geometry-panel-summary strong,
  .alignment-preview-header .edit-label,
  .physical-size-header strong {
    color: #f1f1f7;
    font-size: 13px;
    font-weight: 650;
  }

  .geometry-panel-summary > span {
    display: flex;
    align-items: center;
    gap: 7px;
    color: #9995aa;
    font-size: 10px;
    font-variant-numeric: tabular-nums;
  }

  .geometry-panel-summary i {
    font-style: normal;
    white-space: nowrap;
  }

  .geometry-panel-summary b {
    color: #d8d2e8;
    font-weight: 650;
  }

  .geometry-panel-summary::after,
  .alignment-preview-header::after {
    content: '⌄';
    flex: 0 0 auto;
    color: #9f8aca;
    transition: transform 180ms ease;
  }

  .geometry-panel[open] > .geometry-panel-summary::after,
  .alignment-preview-panel[open] > .alignment-preview-header::after {
    transform: rotate(180deg);
  }

  .geometry-panel:not([open]) > .geometry-panel-summary,
  .alignment-preview-panel:not([open]) > .alignment-preview-header,
  .physical-size-panel:not([open]) > .physical-size-header {
    min-height: 52px;
    margin: 0;
    padding: 0 12px;
  }

  .alignment-preview-header .alignment-preview-status,
  .physical-size-header > span {
    margin-left: auto;
  }

  .geometry-panel[open],
  .alignment-preview-panel[open],
  .physical-size-panel[open] {
    border-color: rgba(139, 109, 232, 0.3);
    background: rgba(105, 65, 215, 0.07);
  }

  .geometry-panel[open] > .geometry-panel-summary,
  .alignment-preview-panel[open] > .alignment-preview-header,
  .physical-size-panel[open] > .physical-size-header {
    border-bottom: 1px solid rgba(255, 255, 255, 0.07);
  }

  .geometry-panel[open] > .geometry-panel-summary {
    margin-bottom: 10px;
  }

  .geometry-panel[open] > .geometry-panel-summary > span {
    display: none;
  }

  .frame-tip {
    padding-block: 4px 8px;
  }

  .edit-section {
    margin-bottom: 8px;
  }

  .geometry-hint,
  .alignment-preview-hint {
    margin-top: 8px;
  }
}

@media (max-width: 899px) and (orientation: landscape) and (max-height: 520px) {
  .canvas-container {
    min-height: 140px;
    padding: 8px;
  }

  .step-tabs {
    padding-block: 8px;
  }

  .control-panel {
    padding-top: 12px;
  }
}

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

@media (max-width: 767px) and (orientation: portrait) {
  .screen-settings-details {
    margin-top: 8px;
    padding: 10px 12px 4px;
    overflow: clip;
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: var(--radius-md);
    background: rgba(255, 255, 255, 0.025);
  }

  .screen-settings-summary {
    min-height: 48px;
    display: flex;
    align-items: center;
    gap: 8px;
    margin: -10px -12px 6px;
    padding: 0 12px;
    color: var(--type-heading);
    cursor: pointer;
    list-style: none;
    touch-action: manipulation;
  }

  .screen-settings-summary::-webkit-details-marker {
    display: none;
  }

  .screen-settings-summary strong {
    font-size: 13px;
  }

  .screen-settings-summary span {
    margin-left: auto;
    color: var(--type-caption);
    font-size: 10px;
  }

  .screen-settings-summary::after,
  .inspector-details > summary::after {
    content: '⌄';
    flex: 0 0 auto;
    color: #9f8aca;
    transition: transform 180ms ease;
  }

  .screen-settings-details[open] > .screen-settings-summary::after,
  .inspector-details[open] > summary::after {
    transform: rotate(180deg);
  }

  .screen-settings-details:not([open]) {
    padding-bottom: 0;
  }

  .screen-settings-details:not([open]) > .screen-settings-summary {
    margin-bottom: 0;
  }

  .screen-settings-details .edit-section {
    margin-bottom: 8px;
  }

  #text-edit-panel > .inspector-details,
  #image-edit-panel > .inspector-details,
  .inspector-details-primary {
    margin-top: 8px;
    padding: 0 10px 10px;
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: var(--radius-sm);
    background: rgba(255, 255, 255, 0.025);
  }

  #text-edit-panel > .inspector-details:not([open]),
  #image-edit-panel > .inspector-details:not([open]) {
    padding-bottom: 0;
  }

  #text-edit-panel > .inspector-details > summary,
  #image-edit-panel > .inspector-details > summary,
  .inspector-details-primary > summary {
    min-height: 48px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    list-style: none;
    touch-action: manipulation;
  }

  .inspector-details > summary::-webkit-details-marker {
    display: none;
  }

  .inspector-details-primary .edit-section {
    margin-bottom: 10px;
  }

  .page-editor.editor-input-focused .inspector-header button:not(.mobile-keyboard-done) {
    display: none;
  }

  .page-editor.editor-input-focused .mobile-keyboard-done {
    min-width: 88px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-color: rgba(103, 232, 249, 0.45);
    color: #ecfeff;
    background: rgba(8, 145, 178, 0.24);
  }
}

/* ===== Global Feedback ===== */
.toast-region {
  position: fixed;
  top: max(20px, env(safe-area-inset-top));
  left: 50%;
  z-index: 2100;
  width: min(calc(100% - 32px), 420px);
  transform: translateX(-50%);
  display: grid;
  gap: 10px;
  pointer-events: none;
}

.action-toast-region {
  position: fixed;
  left: 50%;
  bottom: max(20px, env(safe-area-inset-bottom));
  z-index: 2150;
  width: min(calc(100% - 32px), 420px);
  transform: translateX(-50%);
  display: grid;
  pointer-events: none;
}

.feedback-toast {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 13px 15px;
  border: 1px solid var(--glass-border-bright);
  border-radius: var(--radius-md);
  background: rgba(20, 20, 43, 0.96);
  color: var(--text-primary);
  box-shadow: 0 14px 40px rgba(0, 0, 0, 0.45);
  backdrop-filter: blur(18px);
  font-size: 14px;
  line-height: 1.5;
  opacity: 0;
  transform: translateY(-10px) scale(0.98);
  transition: opacity 0.2s ease, transform 0.2s ease;
}

.feedback-toast.active {
  opacity: 1;
  transform: translateY(0) scale(1);
}

.feedback-toast::before {
  content: '✓';
  flex: 0 0 auto;
  color: #34d399;
  font-weight: 800;
}

.feedback-toast.error::before { content: '!'; color: #f87171; }
.feedback-toast.warning::before { content: '!'; color: #fbbf24; }

.feedback-toast.actionable {
  position: relative;
  align-items: center;
  padding: 9px 10px 9px 13px;
  overflow: hidden;
  pointer-events: auto;
}

.feedback-toast.actionable::before {
  content: '↶';
  color: #67e8f9;
  background: rgba(34, 211, 238, 0.13);
}

.feedback-toast.actionable::after {
  content: '';
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 2px;
  background: linear-gradient(90deg, #22d3ee, #8b5cf6);
  transform-origin: left center;
  animation: action-toast-countdown var(--action-toast-duration, 5000ms) linear forwards;
}

.feedback-toast-message {
  flex: 1 1 auto;
  min-width: 0;
}

.feedback-toast.actionable button {
  flex: 0 0 auto;
  min-width: 68px;
  min-height: 44px;
  padding: 0 14px;
  border: 1px solid rgba(103, 232, 249, 0.32);
  border-radius: 10px;
  background: rgba(34, 211, 238, 0.12);
  color: #cffafe;
  font: 750 13px var(--font-body);
  cursor: pointer;
  touch-action: manipulation;
}

.feedback-toast.actionable button:active {
  transform: scale(0.96);
}

.feedback-toast.actionable button:disabled {
  opacity: 0.56;
}

@keyframes action-toast-countdown {
  from { transform: scaleX(1); }
  to { transform: scaleX(0); }
}

.feedback-confirm {
  position: fixed;
  inset: 0;
  z-index: 2050;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.feedback-confirm-mask {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.72);
  backdrop-filter: blur(8px);
}

.feedback-confirm-card {
  position: relative;
  width: min(100%, 400px);
  padding: 26px;
  border: 1px solid var(--glass-border-bright);
  border-radius: var(--radius-xl);
  background: linear-gradient(145deg, #17172f, #0e0e1c);
  box-shadow: 0 24px 70px rgba(0, 0, 0, 0.55);
  text-align: center;
  animation: aiModalIn 0.25s cubic-bezier(0.16, 1, 0.3, 1);
  max-height: calc(100dvh - 40px);
  overflow-y: auto;
  overscroll-behavior: contain;
}

.feedback-confirm.has-preview .feedback-confirm-card {
  width: min(100%, 470px);
  text-align: left;
}

.feedback-confirm-icon {
  width: 44px;
  height: 44px;
  margin: 0 auto 14px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: rgba(245, 158, 11, 0.14);
  color: #fbbf24;
  font-size: 22px;
  font-weight: 800;
}

.feedback-confirm-icon svg {
  width: 23px;
  height: 23px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.feedback-confirm.draft-recovery .feedback-confirm-icon {
  color: #67e8f9;
  background: rgba(8, 145, 178, 0.14);
}

.feedback-confirm.import-project .feedback-confirm-icon {
  color: #67e8f9;
  background: rgba(8, 145, 178, 0.14);
}

.feedback-confirm-import-preview {
  min-width: 0;
  margin: -4px 0 12px;
  padding: 10px;
  display: grid;
  grid-template-columns: 132px minmax(0, 1fr);
  align-items: center;
  gap: 14px;
  border: 1px solid rgba(167, 139, 250, 0.28);
  border-radius: 14px;
  background: linear-gradient(135deg, rgba(124, 58, 237, 0.12), rgba(8, 145, 178, 0.07));
}

.feedback-confirm-import-preview[hidden] { display: none; }

.feedback-confirm-import-preview img {
  width: 132px;
  height: 96px;
  display: block;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 10px;
  background: #090b14;
  object-fit: cover;
}

.feedback-confirm-import-copy {
  min-width: 0;
  display: grid;
  gap: 5px;
}

.feedback-confirm-import-copy > span {
  color: #c4b5fd;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.08em;
}

.feedback-confirm-import-copy strong {
  overflow: hidden;
  color: var(--text-primary);
  font-size: 15px;
  line-height: 1.35;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.feedback-confirm-import-copy time,
.feedback-confirm-import-copy small {
  color: var(--text-secondary);
  font-size: 11px;
  line-height: 1.4;
  font-variant-numeric: tabular-nums;
}

.feedback-confirm.has-incoming-preview .feedback-confirm-preview {
  margin-top: 0;
  border-color: rgba(245, 158, 11, 0.2);
  background: rgba(245, 158, 11, 0.055);
}

.feedback-confirm.has-incoming-preview .feedback-confirm-preview-copy > span { color: #fbbf24; }

.feedback-confirm-preview {
  min-width: 0;
  margin: -4px 0 20px;
  padding: 10px;
  display: grid;
  grid-template-columns: 132px minmax(0, 1fr);
  align-items: center;
  gap: 14px;
  border: 1px solid rgba(103, 232, 249, 0.18);
  border-radius: 14px;
  background: rgba(8, 145, 178, 0.07);
}

.feedback-confirm-preview[hidden] {
  display: none;
}

.feedback-confirm-preview img {
  width: 132px;
  height: 96px;
  display: block;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 10px;
  background: #090b14;
  object-fit: cover;
}

.feedback-confirm-preview-copy {
  min-width: 0;
  display: grid;
  gap: 5px;
}

.feedback-confirm-preview-copy > span {
  color: #67e8f9;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.08em;
}

.feedback-confirm-preview-copy strong {
  overflow: hidden;
  color: var(--text-primary);
  font-size: 15px;
  line-height: 1.35;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.feedback-confirm-preview-copy time,
.feedback-confirm-preview-copy small {
  color: var(--text-secondary);
  font-size: 11px;
  line-height: 1.4;
  font-variant-numeric: tabular-nums;
}

.feedback-confirm.cancel-danger .feedback-confirm-cancel {
  border-color: rgba(248, 113, 113, 0.22);
  color: #fca5a5;
  background: rgba(220, 38, 38, 0.08);
}

.feedback-confirm.danger .feedback-confirm-icon {
  background: rgba(239, 68, 68, 0.14);
  color: #f87171;
}

/* ===== Result Proofing Workspace ===== */
.page-result { min-height: 100dvh; }
.result-page {
  max-width: 1480px;
  min-height: 100dvh;
  padding: 16px 24px 24px;
}
.result-page > .page-header {
  position: relative;
  flex: 0 0 auto;
  border: 1px solid var(--glass-border);
  border-radius: 14px;
  background: rgba(13, 13, 26, 0.82);
}
.result-workspace {
  flex: 1;
  min-height: 0;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 320px;
  gap: 16px;
  padding-top: 16px;
}
.result-proofing,
.result-sidebar {
  border: 1px solid rgba(255,255,255,.09);
  border-radius: 16px;
  background: #10101d;
  box-shadow: 0 18px 48px rgba(0,0,0,.28);
}
.result-proofing {
  min-width: 0;
  min-height: 620px;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.result-proofing-head {
  min-height: 72px;
  padding: 14px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  border-bottom: 1px solid rgba(255,255,255,.08);
}
.result-badge {
  margin: 0 0 4px;
  padding: 0;
  border: 0;
  background: none;
  box-shadow: none;
  color: #73d9b0;
  font-size: 12px;
  letter-spacing: .2px;
}
.result-title {
  margin: 0;
  color: #f4f4fa;
  background: none;
  -webkit-text-fill-color: currentColor;
  filter: none;
  font-size: 20px;
  letter-spacing: .2px;
}
.result-view-switch,
.result-tool-group {
  display: inline-flex;
  padding: 3px;
  gap: 2px;
  border: 1px solid rgba(255,255,255,.1);
  border-radius: 10px;
  background: #191927;
}
.result-view-switch button,
.result-tool-group button {
  min-height: 36px;
  padding: 0 13px;
  border: 0;
  border-radius: 7px;
  background: transparent;
  color: #a7a7b8;
  font: 600 13px var(--font-body);
  cursor: pointer;
  transition: background .2s ease, color .2s ease;
}
.result-view-switch button:hover,
.result-tool-group button:hover { color: #fff; background: rgba(255,255,255,.06); }
.result-view-switch button.active,
.result-tool-group button[aria-pressed="true"] {
  color: #fff;
  background: #6941d7;
}
.result-stage {
  position: relative;
  flex: 1;
  min-height: 430px;
  display: grid;
  place-items: center;
  overflow: hidden;
  background-color: #090a10;
  background-image: linear-gradient(rgba(255,255,255,.025) 1px, transparent 1px), linear-gradient(90deg, rgba(255,255,255,.025) 1px, transparent 1px);
  background-size: 24px 24px;
  cursor: default;
}
.result-stage.is-pannable { cursor: grab; }
.result-stage.is-panning { cursor: grabbing; }
.result-fullscreen-bar {
  position: absolute;
  top: 16px;
  left: 16px;
  right: 16px;
  z-index: 8;
  display: none;
  align-items: center;
  justify-content: space-between;
  pointer-events: none;
}
.result-fullscreen-meta {
  display: grid;
  gap: 2px;
  padding: 8px 11px;
  border: 1px solid rgba(255,255,255,.12);
  border-radius: 9px;
  background: rgba(13,13,24,.82);
  box-shadow: 0 8px 24px rgba(0,0,0,.28);
  backdrop-filter: blur(12px);
}
.result-fullscreen-bar span { color: #858599; font-size: 9px; letter-spacing: .08em; }
.result-fullscreen-bar strong { color: #f1f1f5; font: 600 12px var(--font-display); }
.result-fullscreen-actions { display: flex; align-items: center; gap: 8px; pointer-events: auto; }
.result-fullscreen-view-switch {
  display: flex;
  gap: 2px;
  padding: 3px;
  border: 1px solid rgba(255,255,255,.12);
  border-radius: 9px;
  background: rgba(13,13,24,.86);
  backdrop-filter: blur(12px);
}
.result-fullscreen-view-switch button {
  min-height: 32px;
  padding: 0 11px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: #9999aa;
  font-size: 11px;
  cursor: pointer;
}
.result-fullscreen-view-switch button:hover { color: #fff; background: rgba(255,255,255,.06); }
.result-fullscreen-view-switch button.active { color: #fff; background: #6941d7; }
.result-fullscreen-exit {
  min-height: 38px;
  padding: 0 14px;
  border: 1px solid rgba(255,255,255,.14);
  border-radius: 9px;
  background: rgba(13,13,24,.86);
  color: #e2e2e9;
  font-size: 12px;
  cursor: pointer;
  pointer-events: auto;
  backdrop-filter: blur(12px);
}
.result-fullscreen-exit:hover { border-color: rgba(158,120,255,.45); background: rgba(105,65,215,.3); color: #fff; }
.result-stage:fullscreen { width: 100vw; height: 100vh; min-height: 100vh; }
.result-stage:fullscreen .result-fullscreen-bar { display: flex; }
.result-stage:fullscreen .result-layer { max-height: calc(100dvh - 80px); }
.result-stage-content {
  position: relative;
  max-width: calc(100% - 48px);
  max-height: calc(100% - 48px);
  transform-origin: center;
  will-change: transform;
}
.result-layer {
  display: block;
  max-width: 100%;
  max-height: calc(100dvh - 230px);
  object-fit: contain;
  border-radius: 2px;
  user-select: none;
  -webkit-user-drag: none;
  box-shadow: 0 16px 50px rgba(0,0,0,.55);
}
.result-original-image { position: relative; }
.result-effect-layer {
  position: absolute;
  inset: 0;
  overflow: hidden;
}
.result-effect-layer .result-image { width: 100%; height: 100%; }
.result-dimension-overlay { position: absolute; inset: 0; z-index: 2; width: 100%; height: 100%; pointer-events: none; }
.result-preview-protection {
  display: none;
  position: absolute;
  inset: 0;
  z-index: 7;
  overflow: hidden;
  pointer-events: none;
  background: repeating-linear-gradient(-28deg, transparent 0 86px, rgba(9, 8, 20, .18) 86px 88px);
}
.result-preview-protection span {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 100%;
  padding: 10px 0;
  color: rgba(255,255,255,.58);
  background: rgba(10, 8, 24, .28);
  font: 700 clamp(12px, 1.4vw, 18px)/1.2 var(--font-display);
  letter-spacing: .08em;
  text-align: center;
  transform: translate(-50%, -50%) rotate(-18deg);
  text-shadow: 0 1px 3px rgba(0,0,0,.7);
}
.result-stage.is-preview-protected .result-preview-protection { display: block; }
.result-stage.is-preview-protected .result-fullscreen-bar { display: none !important; }
.result-sidebar .btn-save.is-quota-locked { background: linear-gradient(135deg, #4f3c9f, #7b4ab4); }
.result-sidebar .btn-save.is-quota-locked .btn-standard-copy strong { color: #f0dcff; }
.result-sidebar .btn-save.is-quota-locked .btn-standard-copy small { color: rgba(255,235,255,.78); }
.result-fullscreen-tools button:disabled,
#result-fullscreen:disabled { opacity: .55; cursor: not-allowed; }
.canvas-wrapper.is-preview-protected::after {
  content: '免费额度已用完 · 邀请好友或升级后导出';
  position: absolute;
  inset: 0;
  z-index: 20;
  display: grid;
  place-items: center;
  padding: 20px;
  color: rgba(255,255,255,.56);
  background: repeating-linear-gradient(-28deg, transparent 0 86px, rgba(9, 8, 20, .18) 86px 88px), rgba(9, 8, 20, .05);
  font: 700 clamp(12px, 1.4vw, 18px)/1.2 var(--font-display);
  letter-spacing: .08em;
  text-align: center;
  text-shadow: 0 1px 3px rgba(0,0,0,.75);
  transform: rotate(-18deg);
  pointer-events: none;
}
.result-stage[data-view="original"] .result-effect-layer { display: none; }
.result-stage[data-view="effect"] .result-original-image { visibility: hidden; }
.result-stage[data-view="effect"] .result-effect-layer { clip-path: none !important; }
.result-compare-side-label {
  position: absolute;
  top: 12px;
  z-index: 3;
  display: none;
  align-items: center;
  gap: 6px;
  padding: 5px 8px;
  border: 1px solid rgba(255,255,255,.16);
  border-radius: 6px;
  background: rgba(8,8,14,.78);
  color: rgba(255,255,255,.88);
  font-size: 11px;
  font-weight: 600;
  line-height: 1;
  backdrop-filter: blur(5px);
  transition: opacity .15s ease;
  pointer-events: none;
}
.result-compare-side-label i { width: 7px; height: 7px; border-radius: 50%; background: #9e78ff; box-shadow: 0 0 8px rgba(158,120,255,.7); }
.result-compare-side-label.is-effect { left: 12px; }
.result-compare-side-label.is-original { right: 12px; }
.result-compare-side-label.is-original i { background: #d1d1da; box-shadow: none; }
.result-stage[data-view="compare"] .result-compare-side-label { display: flex; }
.result-compare-control {
  position: absolute;
  left: 50%;
  bottom: 14px;
  z-index: 5;
  width: min(430px,calc(100% - 32px));
  min-height: 42px;
  display: none;
  align-items: center;
  gap: 9px;
  padding: 6px 7px 6px 11px;
  border: 1px solid rgba(255,255,255,.14);
  border-radius: 10px;
  background: rgba(13,13,24,.88);
  box-shadow: 0 8px 24px rgba(0,0,0,.32);
  backdrop-filter: blur(12px);
  transform: translateX(-50%);
}
.result-stage[data-view="compare"] .result-compare-control { display: flex; }
.result-compare-control > span { flex: 0 0 auto; color: #a5a5b4; font-size: 10px; white-space: nowrap; }
.result-compare-range {
  min-width: 80px;
  flex: 1;
  accent-color: #7955df;
  cursor: ew-resize;
}
.result-compare-control output {
  min-width: 43px;
  color: #e6defe;
  font: 600 10px var(--font-display);
  text-align: center;
  white-space: nowrap;
}
.result-compare-control button {
  min-height: 30px;
  padding: 0 9px;
  border: 1px solid rgba(255,255,255,.1);
  border-radius: 7px;
  background: rgba(255,255,255,.06);
  color: #c5c5d0;
  font-size: 10px;
  white-space: nowrap;
  cursor: pointer;
}
.result-compare-control button:hover { border-color: rgba(158,120,255,.4); color: #fff; }
.result-stage[data-view="compare"] .result-compare-control { pointer-events: auto; }
.result-compare-line {
  position: absolute;
  top: 0;
  bottom: 0;
  left: 50%;
  width: 44px;
  display: none;
  transform: translateX(-50%);
  cursor: ew-resize;
  touch-action: none;
  pointer-events: auto;
}
.result-stage[data-view="compare"] .result-compare-line { display: block; }
.result-stage[data-view="compare"] .result-stage-content { cursor: ew-resize; touch-action: none; }
.result-stage.is-pannable[data-view="compare"] .result-stage-content { cursor: grab; }
.result-stage.is-comparing[data-view="compare"] .result-stage-content,
.result-stage.is-pannable[data-view="compare"] .result-compare-line { cursor: ew-resize; }
.result-compare-line::before {
  content: '';
  position: absolute;
  top: 0;
  bottom: 0;
  left: 50%;
  width: 2px;
  background: #fff;
  box-shadow: 0 0 0 1px rgba(0,0,0,.35);
  transform: translateX(-50%);
}
.result-compare-line::after {
  content: '↔';
  position: absolute;
  top: 50%; left: 50%;
  width: 34px; height: 34px;
  display: grid; place-items: center;
  border-radius: 50%;
  background: #fff; color: #171724;
  transform: translate(-50%, -50%);
  font-weight: 800;
}
.result-compare-line span {
  position: absolute;
  top: 12px; left: calc(50% + 8px);
  padding: 4px 7px;
  border-radius: 5px;
  background: rgba(8,8,14,.82);
  color: #fff;
  font-size: 11px;
  white-space: nowrap;
}
.result-screen-boundary {
  position: absolute;
  border: 1px solid #9e78ff;
  box-shadow: 0 0 0 1px rgba(0,0,0,.45), inset 0 0 0 1px rgba(255,255,255,.18);
  pointer-events: none;
}
.result-screen-boundary::before,
.result-screen-boundary::after {
  content: '';
  position: absolute;
  width: 7px; height: 7px;
  border: 1px solid #fff;
  background: #6941d7;
}
.result-screen-boundary::before { left: -4px; top: -4px; }
.result-screen-boundary::after { right: -4px; bottom: -4px; }
.result-screen-boundary span {
  position: absolute;
  left: 0; bottom: calc(100% + 5px);
  padding: 3px 6px;
  border-radius: 4px;
  background: #6941d7;
  color: #fff;
  font-size: 10px;
  white-space: nowrap;
}
.result-screen-boundary.is-hidden { display: none; }
.result-crosshair { position: absolute; inset: 0; display: none; pointer-events: none; z-index: 4; }
.result-crosshair.is-active { display: block; }
.result-crosshair i,
.result-crosshair b { position: absolute; background: rgba(255,255,255,.55); }
.result-crosshair i { top: 0; bottom: 0; left: var(--crosshair-x, 50%); width: 1px; }
.result-crosshair b { left: 0; right: 0; top: var(--crosshair-y, 50%); height: 1px; }
.result-stage-empty { position: absolute; color: #8d8d9e; font-size: 13px; }
.result-stage.has-image .result-stage-empty { display: none; }
.result-tool-row {
  min-height: 58px;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  border-top: 1px solid rgba(255,255,255,.08);
}
.result-tool-hint { flex: 1; color: #77778a; font-size: 12px; text-align: center; }
.result-zoom-tools output { min-width: 48px; align-self: center; text-align: center; color: #e6e6ed; font: 600 12px var(--font-display); }
.result-zoom-tools button { min-width: 38px; padding-inline: 9px; }
.result-sidebar { padding: 16px; align-self: start; }
.result-summary { padding: 4px 2px 16px; border-bottom: 1px solid rgba(255,255,255,.08); }
.result-summary-label,
.result-ai-kicker { display: block; margin-bottom: 9px; color: #858599; font-size: 11px; font-weight: 700; letter-spacing: 1px; text-transform: uppercase; }
.result-summary strong { display: flex; align-items: center; gap: 8px; color: #f4f4fa; font-size: 16px; }
.result-status-dot { width: 8px; height: 8px; border-radius: 50%; background: #52d39a; box-shadow: 0 0 0 4px rgba(82,211,154,.12); }
.result-summary p,
.result-ai-card p { margin: 8px 0 0; color: #9292a4; font-size: 12px; line-height: 1.65; }
.result-sidebar .info-section { margin: 14px 0; }
.result-sidebar .info-card { padding: 4px 12px; border-radius: 10px; background: #161624; box-shadow: none; backdrop-filter: none; }
.result-sidebar .info-card::before { display: none; }
.result-sidebar .info-row { min-height: 42px; }
.result-sidebar .info-label { color: #9797a9; font-size: 12px; }
.result-sidebar .info-value { background: none; -webkit-text-fill-color: currentColor; color: #ededf3; font-size: 12px; letter-spacing: 0; }
.result-info-value-action { min-width: 0; display: flex; align-items: center; justify-content: flex-end; gap: 6px; }
.result-info-value-action button { min-height: 28px; padding: 0 8px; border: 1px solid rgba(196,181,253,.18); border-radius: 6px; background: rgba(124,58,237,.1); color: #bfb3e8; font-size: 10px; cursor: pointer; }
.result-info-value-action button:hover { border-color: rgba(196,181,253,.4); color: #fff; }
.result-export-card {
  margin: 0 0 14px;
  border: 1px solid rgba(255,255,255,.09);
  border-radius: 11px;
  background: #141421;
  overflow: hidden;
}
.result-export-card summary {
  min-height: 42px;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 0 12px;
  color: #ededf4;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  list-style: none;
}
.result-export-card summary::-webkit-details-marker { display: none; }
.result-export-card summary::after { content: '⌄'; margin-left: auto; color: #858599; transition: transform .2s ease; }
.result-export-card[open] summary::after { transform: rotate(180deg); }
.result-export-card summary strong { flex: 0 0 auto; }
.result-export-card summary span { min-width: 0; overflow: hidden; color: #77778a; font-size: 11px; font-weight: 500; text-overflow: ellipsis; white-space: nowrap; }
.result-export-fields {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 88px;
  gap: 12px 8px;
  padding: 12px;
  border-top: 1px solid rgba(255,255,255,.07);
}
.result-export-field { display: grid; gap: 6px; min-width: 0; }
.result-export-field > span { color: #9999aa; font-size: 11px; }
.result-export-field output { float: right; color: #c8baff; font: 600 11px var(--font-display); }
.result-export-field input[type="text"],
.result-export-field input[type="date"],
.result-export-field select {
  width: 100%;
  height: 38px;
  padding: 0 10px;
  border: 1px solid rgba(255,255,255,.11);
  border-radius: 8px;
  outline: none;
  background: #1d1d2c;
  color: #f1f1f5;
  font: 13px var(--font-body);
}
.result-export-field input[type="text"]:focus,
.result-export-field input[type="date"]:focus,
.result-export-field select:focus { border-color: #8a65e8; box-shadow: 0 0 0 3px rgba(105,65,215,.16); }
.result-export-field input[type="range"] { width: 100%; accent-color: #7955df; }
.result-export-name { grid-column: 1; }
#result-quality-field { grid-column: 1 / -1; }
#result-quality-field.is-disabled { display: none; }
.result-export-check {
  grid-column: 1 / -1;
  min-height: 36px;
  display: flex;
  align-items: center;
  gap: 8px;
  color: #b0b0bf;
  font-size: 11px;
  cursor: pointer;
}
.result-export-check input { width: 16px; height: 16px; accent-color: #7955df; }
.result-watermark-toggle { border-top: 1px solid rgba(255,255,255,.07); padding-top: 8px; }
.result-watermark-fields {
  grid-column: 1 / -1;
  display: none;
  grid-template-columns: 1fr 1fr;
  gap: 10px 8px;
  padding-top: 2px;
}
.result-watermark-fields.is-active { display: grid; }
.result-watermark-fields .result-export-field:nth-child(3),
.result-logo-field { grid-column: 1 / -1; }
.result-logo-field { display: grid; gap: 6px; }
.result-logo-field > span { color: #9999aa; font-size: 11px; }
.result-logo-field > div { display: flex; align-items: center; gap: 7px; min-width: 0; }
.result-logo-field button {
  min-height: 34px;
  padding: 0 10px;
  border: 1px solid rgba(255,255,255,.12);
  border-radius: 7px;
  background: #202030;
  color: #d9d9e2;
  font: 600 11px var(--font-body);
  cursor: pointer;
}
.result-logo-field button:hover { border-color: #7955df; }
.result-logo-field small { min-width: 0; overflow: hidden; color: #77778a; font-size: 10px; text-overflow: ellipsis; white-space: nowrap; }
.result-template-remember { padding-top: 4px; }
.result-template-clear {
  grid-column: 1 / -1;
  min-height: 34px;
  border: 1px solid rgba(255,255,255,.09);
  border-radius: 7px;
  background: transparent;
  color: #89899a;
  font: 11px var(--font-body);
  cursor: pointer;
}
.result-template-clear:hover { color: #e0e0e8; border-color: rgba(255,255,255,.18); }
.result-watermark-preview {
  position: absolute;
  right: 2.5%;
  bottom: 3%;
  z-index: 3;
  max-width: 48%;
  display: none;
  align-items: center;
  gap: 8px;
  padding: 7px 9px;
  border: 1px solid rgba(255,255,255,.28);
  border-radius: 6px;
  background: rgba(7,8,13,var(--watermark-opacity,.72));
  color: #fff;
  box-shadow: 0 5px 16px rgba(0,0,0,.28);
  backdrop-filter: blur(5px);
  pointer-events: none;
}
.result-watermark-preview.position-bottom-left { right: auto; left: 2.5%; }
.result-watermark-preview.position-top-right { bottom: auto; top: 3%; }
.result-watermark-preview.position-top-left { right: auto; bottom: auto; left: 2.5%; top: 3%; }
.result-watermark-preview.is-active { display: flex; }
.result-watermark-preview img { display: none; width: 34px; height: 34px; object-fit: contain; }
.result-watermark-preview img.has-logo { display: block; }
.result-watermark-preview div { min-width: 0; display: grid; gap: 2px; }
.result-watermark-preview strong,
.result-watermark-preview span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.result-watermark-preview strong { font-size: clamp(8px, 1.15vw, 13px); }
.result-watermark-preview span { color: rgba(255,255,255,.72); font-size: clamp(6px, .9vw, 10px); }
.result-platform-watermark {
  position: absolute;
  left: 2.5%;
  bottom: 3%;
  z-index: 3;
  max-width: 70%;
  overflow: hidden;
  padding: clamp(3px,.45vw,6px) clamp(5px,.7vw,9px);
  border-radius: clamp(3px,.4vw,6px);
  background: rgba(7,8,13,.58);
  color: rgba(255,255,255,.76);
  font-size: clamp(7px,.9vw,12px);
  font-weight: 500;
  line-height: 1;
  text-overflow: ellipsis;
  white-space: nowrap;
  pointer-events: none;
}
.result-platform-watermark.position-top-left { top: 3%; bottom: auto; }
.result-sidebar .action-section { gap: 8px; }
.benefit-trigger {
  min-height: 38px;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 0 11px;
  border: 1px solid rgba(245,185,66,.22);
  border-radius: 9px;
  background: rgba(245,185,66,.07);
  color: #b9b2a5;
  font: 11px var(--font-body);
  cursor: pointer;
}
.benefit-trigger strong { color: #ffd77a; font-size: 11px; }
.benefit-trigger strong + strong::before { content: '·'; margin: 0 7px 0 0; color: rgba(245,185,66,.4); }
.hero-benefit-trigger { position: absolute; top: 18px; right: 18px; z-index: 2; }
.editor-benefit-trigger,
.result-benefit-trigger { margin-left: auto; }
.editor-benefit-trigger + .editor-history-actions { margin-left: 0; }
.web-auth-trigger { min-height: 38px; display: inline-flex; align-items: center; justify-content: center; gap: 7px; padding: 0 12px; border: 1px solid rgba(82,211,154,.24); border-radius: 9px; background: rgba(82,211,154,.07); color: #b8cec6; font: 600 11px var(--font-body); cursor: pointer; white-space: nowrap; }
.web-auth-trigger:hover { border-color: rgba(82,211,154,.46); background: rgba(82,211,154,.12); }
.web-auth-trigger.is-authenticated { color: #bdf5dd; border-color: rgba(82,211,154,.38); }
.web-auth-dot { width: 7px; height: 7px; border-radius: 50%; background: #8d8798; box-shadow: 0 0 0 3px rgba(141,135,152,.12); }
.web-auth-trigger.is-authenticated .web-auth-dot { background: #52d39a; box-shadow: 0 0 0 3px rgba(82,211,154,.14); }
.hero-auth-trigger { position: absolute; top: 18px; left: 18px; z-index: 2; }
.web-auth-content { max-width: 470px; }
.web-auth-security { display: flex; gap: 12px; padding: 13px 14px; border: 1px solid rgba(82,211,154,.2); border-radius: 12px; background: rgba(82,211,154,.07); }
.web-auth-security > span { width: 28px; height: 28px; display: grid; place-items: center; flex: 0 0 auto; border-radius: 50%; background: rgba(82,211,154,.16); color: #86e3bb; font-weight: 800; }
.web-auth-security strong, .web-auth-security small { display: block; }
.web-auth-security strong { color: #e8f7f0; font-size: 13px; }
.web-auth-security small { margin-top: 4px; color: var(--text-secondary); font-size: 11px; line-height: 1.55; }
.web-auth-loading { min-height: 150px; display: flex; align-items: center; justify-content: center; gap: 10px; color: var(--text-secondary); }
.web-auth-loading > span { width: 18px; height: 18px; border: 2px solid rgba(255,255,255,.12); border-top-color: #a78bfa; border-radius: 50%; animation: ui-spin .9s linear infinite; }
.web-auth-scan-title { margin-top: 18px; display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.web-auth-scan-title strong { color: var(--text-primary); font: 750 14px var(--font-display); }
.web-auth-scan-title span { color: var(--text-secondary); font-size: 11px; }
.web-auth-qr-box { position: relative; width: 224px; height: 224px; margin: 14px auto 0; display: grid; place-items: center; overflow: hidden; border: 1px solid rgba(167,139,250,.3); border-radius: 18px; background: #fff; box-shadow: 0 14px 34px rgba(0,0,0,.28), 0 0 0 6px rgba(124,58,237,.06); }
.web-auth-qr-box img { width: 208px; height: 208px; display: block; object-fit: contain; opacity: 0; transition: opacity 160ms ease; }
.web-auth-qr-box.is-ready img { opacity: 1; }
.web-auth-qr-loading, .web-auth-qr-error { position: absolute; inset: 0; display: none; align-items: center; justify-content: center; flex-direction: column; gap: 10px; padding: 24px; color: #504762; text-align: center; }
.web-auth-qr-box.is-loading .web-auth-qr-loading { display: flex; }
.web-auth-qr-box.is-error .web-auth-qr-error { display: flex; }
.web-auth-qr-loading > span { width: 24px; height: 24px; border: 3px solid rgba(80,71,98,.14); border-top-color: #7c3aed; border-radius: 50%; animation: ui-spin .9s linear infinite; }
.web-auth-qr-loading small, .web-auth-qr-error small { color: #766c84; font-size: 11px; }
.web-auth-qr-error strong { color: #4d435d; font-size: 13px; }
.web-auth-scan-hint { margin: 16px auto 0; max-width: 290px; display: grid; grid-template-columns: 24px 1fr; align-items: center; gap: 7px 9px; }
.web-auth-scan-hint > span { width: 24px; height: 24px; display: grid; place-items: center; border-radius: 50%; background: rgba(124,58,237,.18); color: #c4b5fd; font-weight: 800; font-size: 11px; }
.web-auth-scan-hint p { margin: 0; color: var(--text-secondary); font-size: 11px; line-height: 1.5; }
.web-auth-code-fallback { margin-top: 15px; border-top: 1px solid rgba(255,255,255,.07); }
.web-auth-code-fallback summary { padding-top: 13px; color: #aaa4b6; font-size: 11px; text-align: center; cursor: pointer; list-style-position: inside; }
.web-auth-code-fallback .web-auth-code-wrap { margin-top: 12px; padding: 15px; }
.web-auth-code-fallback .web-auth-code-wrap strong { font-size: 25px; }
.web-auth-steps { margin-top: 18px; display: grid; grid-template-columns: 26px 1fr; align-items: center; gap: 9px 10px; }
.web-auth-steps > span { width: 26px; height: 26px; display: grid; place-items: center; border-radius: 50%; background: rgba(124,58,237,.18); color: #c4b5fd; font-weight: 800; font-size: 12px; }
.web-auth-steps p { margin: 0; color: var(--text-secondary); font-size: 12px; line-height: 1.5; }
.web-auth-code-wrap { margin-top: 18px; padding: 20px; border: 1px solid rgba(167,139,250,.32); border-radius: 14px; background: linear-gradient(135deg,rgba(124,58,237,.14),rgba(236,72,153,.07)); text-align: center; }
.web-auth-code-wrap strong { display: block; color: #f2ecff; font: 800 32px/1 var(--font-display); letter-spacing: 8px; }
.web-auth-code-wrap small { display: block; margin-top: 10px; color: var(--text-secondary); font-size: 11px; }
.web-auth-expired { min-height: 150px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 14px; color: var(--text-primary); }
.web-auth-expired button, .web-auth-success button { min-height: 36px; padding: 0 13px; border: 1px solid rgba(167,139,250,.32); border-radius: 8px; background: rgba(124,58,237,.12); color: #d8ccff; cursor: pointer; }
.web-auth-success { margin-top: 18px; min-height: 120px; display: grid; grid-template-columns: 38px 1fr auto; align-items: center; gap: 12px; padding: 16px; border: 1px solid rgba(82,211,154,.24); border-radius: 14px; background: rgba(82,211,154,.07); }
.web-auth-success > span { width: 38px; height: 38px; display: grid; place-items: center; border-radius: 50%; background: rgba(82,211,154,.16); color: #86e3bb; font-weight: 900; }
.web-auth-success strong, .web-auth-success small { display: block; }
.web-auth-success small { margin-top: 4px; color: var(--text-secondary); font-size: 11px; }
.web-auth-message { min-height: 18px; margin: 13px 0 0; color: var(--text-secondary); font-size: 11px; line-height: 1.55; text-align: center; }
.web-auth-message.is-success { color: #86e3bb; }
.web-auth-message.is-warning { color: #ffd77a; }
.web-auth-message.is-error { color: #ff9aab; }
@media (max-width: 640px) {
  .hero-auth-trigger { top: 14px; left: 14px; }
  .hero-auth-trigger span:last-child { display: none; }
  .hero-auth-trigger { width: 38px; padding: 0; }
  .editor-header-actions .web-auth-trigger span:last-child,
  .result-benefit-trigger + .web-auth-trigger span:last-child { display: none; }
  .editor-header-actions .web-auth-trigger,
  .result-benefit-trigger + .web-auth-trigger { width: 38px; padding: 0; }
  .web-auth-success { grid-template-columns: 34px 1fr; }
  .web-auth-success button { grid-column: 1 / -1; }
}
.hero-title { max-width: 720px; margin-inline: auto; line-height: 1.16; }
.hero-benefits { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; margin: 16px 0 20px; }
.hero-benefits span { padding: 6px 10px; border: 1px solid rgba(255,255,255,.09); border-radius: 999px; background: rgba(255,255,255,.035); color: #b9b9c8; font-size: 11px; }
.hero-benefits span::before { content: '✓'; margin-right: 5px; color: #54d3a0; font-weight: 800; }
.sponsor-card { margin: 28px 0; padding: 14px 16px; border: 1px solid rgba(83,171,198,.16); border-radius: 14px; background: linear-gradient(110deg,rgba(8,145,178,.06),rgba(255,255,255,.025)); }
.sponsor-label { margin-bottom: 8px; color: #718b94; font-size: 10px; font-weight: 700; letter-spacing: .8px; }
.sponsor-content { display: flex; align-items: center; gap: 16px; }
.sponsor-content > div { flex: 1; min-width: 0; }
.sponsor-content strong { color: #e9edf0; font-size: 14px; }
.sponsor-content p { margin: 4px 0 0; color: #8d9ba0; font-size: 12px; line-height: 1.55; }
.sponsor-content button { min-height: 38px; padding: 0 14px; border: 1px solid rgba(83,171,198,.25); border-radius: 8px; background: rgba(8,145,178,.1); color: #b7e5ef; font: 600 12px var(--font-body); cursor: pointer; }
.btn-reward-export { width: 100%; min-height: 52px; display: flex; align-items: center; justify-content: center; gap: 10px; padding: 7px 12px; border: 1px solid rgba(245,185,66,.3); border-radius: 10px; background: linear-gradient(135deg,rgba(245,185,66,.15),rgba(217,119,6,.08)); color: #ffe2a1; cursor: pointer; }
.btn-reward-icon { width: 30px; height: 30px; display: grid; place-items: center; border-radius: 50%; background: #e9ad37; color: #211705; font-size: 11px; }
.btn-reward-export > span:last-child { display: grid; gap: 2px; text-align: left; }
.btn-reward-export strong { font: 700 13px var(--font-display); }
.btn-reward-export small { color: #ae9a73; font-size: 10px; }
.btn-reward-export.is-unlocked { border-color: rgba(82,211,154,.28); background: rgba(82,211,154,.08); color: #a9efd1; }
.btn-reward-export.is-unlocked .btn-reward-icon { background: #52d39a; }
.commerce-modal,
.test-ad-player { position: fixed; inset: 0; z-index: 2300; display: grid; place-items: center; padding: 20px; }
.commerce-modal-mask { position: absolute; inset: 0; background: rgba(2,3,8,.78); backdrop-filter: blur(9px); }
.commerce-modal[style*="display: flex"] { align-items: center; justify-content: center; }
.commerce-modal-card { position: relative; width: min(100%,420px); padding: 26px; border: 1px solid rgba(255,255,255,.12); border-radius: 18px; background: #151522; box-shadow: 0 28px 80px rgba(0,0,0,.58); }
.commerce-close { position: absolute; top: 12px; right: 12px; width: 40px; height: 40px; border: 0; border-radius: 50%; background: rgba(255,255,255,.06); color: #bdbdca; font-size: 20px; cursor: pointer; }
.commerce-kicker { color: #9c83e8; font: 700 10px var(--font-display); letter-spacing: 1.5px; }
.commerce-kicker-gold { color: #e9b64d; }
.commerce-modal-card h2 { margin: 7px 0 8px; color: #f4f4f8; font: 700 21px var(--font-display); }
.commerce-intro { margin: 0 0 18px; color: #9797a7; font-size: 13px; line-height: 1.65; }
.benefit-list { display: grid; gap: 1px; overflow: hidden; border: 1px solid rgba(255,255,255,.08); border-radius: 11px; background: rgba(255,255,255,.08); }
.benefit-list > div { min-height: 44px; display: flex; align-items: center; justify-content: space-between; padding: 0 12px; background: #191927; color: #a5a5b4; font-size: 12px; }
.benefit-list strong { color: #e9e9ef; }
.benefits-modal-header { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.benefits-modal-header h2 { margin: 7px 0 0; }
.benefits-modal-date { margin-top: 2px; padding: 3px 8px; border: 1px solid rgba(255,255,255,.1); border-radius: 6px; background: rgba(255,255,255,.05); color: #8c8c9c; font-size: 11px; font-weight: 700; }
/* 权益中心全屏面板：头部固定，内容区滚动（手机+电脑统一） */
#benefits-modal { padding: 0; align-items: stretch; justify-content: flex-start; }
#benefits-modal .commerce-modal-card {
  width: 100%; max-width: none; min-height: 100vh; border-radius: 0;
  display: flex; flex-direction: column; padding: 0;
}
#benefits-modal .benefits-modal-header { flex-shrink: 0; padding: 26px 56px 0 26px; }
#benefits-modal .benefits-modal-body {
  flex: 1 1 auto; overflow-y: auto; padding: 0 26px 26px;
  -webkit-overflow-scrolling: touch;
}
#benefits-modal .commerce-close { top: 16px; right: 16px; }

/* 桌面端内容区限制最大宽度，避免卡片拉伸过宽 */
@media (min-width: 768px) {
  #benefits-modal .benefits-modal-header { max-width: 720px; margin: 0 auto; padding: 26px 40px 0; }
  #benefits-modal .benefits-modal-body {
    width: 100%; max-width: 720px; margin: 0 auto; padding: 0 40px 40px;
    align-self: center;
  }
}
.benefit-section-title { margin: 20px 0 10px; color: #8c8c9c; font: 700 11px var(--font-display); letter-spacing: .8px; }
.benefit-section-hint { font: 700 9px var(--font-display); letter-spacing: .5px; color: #54d3a0; border: 1px solid rgba(84,211,160,.3); border-radius: 999px; padding: 1px 7px; margin-left: 6px; vertical-align: middle; }
.platform-stats { display: grid; gap: 10px; }
.platform-stat-group { overflow: hidden; border: 1px solid rgba(255,255,255,.08); border-radius: 13px; background: #151522; }
.platform-stat-heading { min-height: 38px; padding: 0 12px; display: flex; align-items: center; justify-content: space-between; gap: 10px; border-bottom: 1px solid rgba(255,255,255,.07); }
.platform-stat-heading strong { color: #e9e9ef; font-size: 12px; }
.platform-stat-heading span { color: #777789; font-size: 10px; }
.platform-stat-group:first-child .platform-stat-heading strong { color: #c4b5fd; }
.platform-stat-group:last-child .platform-stat-heading strong { color: #86efac; }
.platform-stat-group .site-stats { margin: 0; border: 0; border-radius: 0; }
.site-stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1px; overflow: hidden; border: 1px solid rgba(255,255,255,.08); border-radius: 11px; background: rgba(255,255,255,.08); margin-bottom: 6px; }
.site-stats .site-stat-item { padding: 13px 8px; background: #191927; text-align: center; }
.site-stat-num { font-size: 21px; font-weight: 800; color: #e9e9ef; line-height: 1.1; }
.site-stat-label { margin-top: 4px; font-size: 11px; color: #8a8a99; }
.benefit-card { margin-bottom: 10px; padding: 14px; border: 1px solid rgba(255,255,255,.1); border-radius: 14px; background: linear-gradient(180deg,#1e1e2d,#191927); }
.benefit-card-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 12px; }
.benefit-card-label { display: flex; align-items: center; gap: 9px; color: #d6d6e3; font-size: 13px; font-weight: 700; }
.benefit-card-icon { width: 22px; height: 22px; color: #9c83e8; }
.benefit-card-icon path { fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.benefit-card-value { color: #e9e9ef; font-size: 13px; }
.benefit-card-value span { color: #ffd77a; font-size: 16px; }
.benefit-card-actions { display: flex; gap: 8px; }
.benefit-card-actions button { flex: 1; min-height: 36px; padding: 0 10px; border: 1px solid rgba(255,255,255,.12); border-radius: 8px; background: rgba(255,255,255,.06); color: #d6d6e3; font: 600 12px var(--font-body); cursor: pointer; transition: background .15s, border-color .15s; }
.benefit-card-actions button:hover { background: rgba(255,255,255,.1); border-color: rgba(255,255,255,.18); }
.benefit-card-actions .ai-ad-btn { border-color: rgba(245,185,66,.25); background: rgba(245,185,66,.1); color: #ffe2a1; }
.benefit-card-actions .ai-ad-btn:hover { background: rgba(245,185,66,.16); }
.benefit-card-actions .invite-btn { border-color: rgba(156,131,232,.25); background: rgba(156,131,232,.1); color: #d9cfff; }
.benefit-card-actions .invite-btn:hover { background: rgba(156,131,232,.16); }
.benefit-card-actions .unlock-4k-btn { border-color: rgba(245,185,66,.3); background: linear-gradient(135deg,rgba(245,185,66,.16),rgba(217,119,6,.08)); color: #ffe2a1; }
.benefit-card-actions .unlock-4k-btn:hover { background: linear-gradient(135deg,rgba(245,185,66,.22),rgba(217,119,6,.12)); }
.benefit-card-actions .unlock-4k-btn.is-unlocked { border-color: rgba(82,211,154,.28); background: rgba(82,211,154,.08); color: #a9efd1; cursor: default; }
.benefit-list-compact { margin-top: 6px; }
.benefit-invite-label { color: #9c83e8; }
.commerce-stats { margin-top: 12px; border: 1px solid rgba(255,255,255,.08); border-radius: 11px; background: rgba(255,255,255,.025); overflow: hidden; }
.commerce-stats summary { min-height: 42px; display: flex; align-items: center; gap: 7px; padding: 0 12px; color: #b5b5c2; font-size: 12px; font-weight: 700; cursor: pointer; list-style: none; }
.commerce-stats summary::-webkit-details-marker { display: none; }
.commerce-stats summary span { color: #707080; font-size: 10px; font-weight: 500; }
.commerce-stats summary::after { content: '⌄'; margin-left: auto; color: #777787; }
.commerce-stats[open] summary::after { transform: rotate(180deg); }
.commerce-stats-grid { display: grid; grid-template-columns: repeat(3,1fr); gap: 1px; border-top: 1px solid rgba(255,255,255,.07); background: rgba(255,255,255,.06); }
.commerce-stats-grid div { min-height: 64px; display: grid; place-content: center; gap: 3px; background: #181826; text-align: center; }
.commerce-stats-grid strong { color: #f0f0f5; font: 700 16px var(--font-display); }
.commerce-stats-grid span { color: #747484; font-size: 9px; }
.commerce-note { margin: 12px 0 16px; color: #767687; font-size: 11px; line-height: 1.5; }
.commerce-primary,
.commerce-secondary { width: 100%; min-height: 44px; border-radius: 9px; font: 700 13px var(--font-body); cursor: pointer; }
.commerce-primary { border: 0; background: #6941d7; color: #fff; }
.commerce-primary-gold { background: #d99a25; color: #211705; }
.commerce-secondary { margin-top: 8px; border: 1px solid rgba(255,255,255,.09); background: transparent; color: #9292a1; }
.reward-summary { display: flex; align-items: center; gap: 12px; margin-bottom: 18px; padding: 13px; border: 1px solid rgba(245,185,66,.16); border-radius: 11px; background: rgba(245,185,66,.06); }
.reward-summary > span { width: 48px; height: 48px; display: grid; place-items: center; border-radius: 10px; background: #d99a25; color: #211705; font: 800 16px var(--font-display); }
.reward-summary div { display: grid; gap: 3px; }
.reward-summary strong { color: #f3e4c4; font-size: 13px; }
.reward-summary small { color: #9d8e71; font-size: 10px; }
.test-ad-player { background: #080910; }
.test-ad-content { width: min(100%,440px); text-align: center; }
.test-ad-badge { display: inline-flex; padding: 5px 9px; border: 1px solid rgba(255,255,255,.12); border-radius: 999px; color: #858594; font-size: 10px; }
.test-ad-visual { position: relative; width: 180px; height: 130px; margin: 26px auto 18px; display: grid; place-items: center; overflow: hidden; border: 1px solid rgba(245,185,66,.22); border-radius: 18px; background: radial-gradient(circle at 50% 45%,rgba(245,185,66,.3),transparent 55%),#14141f; }
.test-ad-visual span { color: #ffe3a2; font: 800 34px var(--font-display); letter-spacing: 5px; }
.test-ad-visual i,.test-ad-visual b { position: absolute; inset: 14px; border: 1px solid rgba(255,255,255,.07); border-radius: 11px; transform: rotate(8deg); }
.test-ad-visual b { transform: rotate(-8deg); }
.test-ad-content h2 { margin: 0 0 8px; color: #f2f2f6; font-size: 20px; }
.test-ad-content p { margin: 0 auto 20px; max-width: 340px; color: #858595; font-size: 12px; line-height: 1.6; }
.test-ad-progress { height: 5px; overflow: hidden; border-radius: 99px; background: rgba(255,255,255,.08); }
.test-ad-progress i { display: block; width: 0; height: 100%; background: #e9ad37; transition: width 1s linear; }
.test-ad-content > strong { display: block; margin: 12px 0; color: #d4c39d; font-size: 12px; }
#test-ad-cancel { min-height: 40px; padding: 0 18px; border: 0; background: transparent; color: #777786; cursor: pointer; }
.result-sidebar .btn-save { height: 48px; border-radius: 10px; background: #6941d7; box-shadow: 0 8px 20px rgba(105,65,215,.26); animation: none; font-size: 14px; }
.result-sidebar .btn-save::before { display: none; }
.btn-standard-copy { display: grid; gap: 1px; text-align: left; line-height: 1.15; }
.btn-standard-copy strong { font: 700 13px var(--font-display); }
.btn-standard-copy small { color: rgba(255,255,255,.68); font-size: 10px; font-weight: 500; letter-spacing: 0; }
.result-sidebar .btn-edit { height: 44px; border-radius: 9px; background: #191927; box-shadow: none; font-size: 13px; }
.result-ai-card { margin-top: 14px; overflow: hidden; border: 1px solid rgba(120,192,221,.18); border-radius: 11px; background: rgba(8,145,178,.06); }
.result-ai-card summary { min-height: 46px; display: flex; align-items: center; gap: 9px; padding: 0 14px; cursor: pointer; list-style: none; }
.result-ai-card summary::-webkit-details-marker { display: none; }
.result-ai-card summary::after { content: '⌄'; margin-left: auto; color: #718b96; transition: transform .2s ease; }
.result-ai-card[open] summary::after { transform: rotate(180deg); }
.result-ai-card summary .result-ai-kicker { margin: 0; font-size: 9px; }
.result-ai-card strong { color: #e9e9f0; font-size: 13px; }
.result-ai-content { padding: 0 14px 14px; border-top: 1px solid rgba(120,192,221,.1); }
.result-ai-card .btn-ai-preview { width: 100%; height: 42px; margin-top: 12px; border-radius: 8px; background: rgba(8,145,178,.13); border-color: rgba(103,205,230,.25); color: #bdeaf5; box-shadow: none; font-size: 13px; }
.result-ai-card .btn-edit { margin-top: 8px; }

@media (max-width: 980px) {
  .result-page { padding: 12px; }
  .result-workspace { grid-template-columns: minmax(0,1fr); }
  .result-proofing { min-height: 600px; }
  .result-sidebar { width: 100%; }
}
@media (max-width: 640px) {
  .result-page { padding: 0 0 calc(88px + env(safe-area-inset-bottom)); }
  .result-page > .page-header { border-width: 0 0 1px; border-radius: 0; }
  .result-workspace { width: 100%; min-width: 0; padding: 0; gap: 0; }
  .result-proofing,
  .result-sidebar { width: 100%; min-width: 0; border-radius: 0; border-inline: 0; }
  .result-proofing { min-height: 0; box-shadow: none; }
  .result-proofing-head { align-items: flex-start; flex-direction: column; gap: 10px; }
  .result-view-switch { width: 100%; }
  .result-view-switch button { flex: 1; min-height: 42px; }
  .result-stage { min-height: 58dvh; }
  .result-layer { max-height: calc(58dvh - 32px); }
  .result-stage-content { max-width: calc(100% - 24px); max-height: calc(100% - 24px); }
  .result-stage:fullscreen .result-fullscreen-bar { top: 10px; left: 10px; right: 10px; align-items: stretch; flex-direction: column; gap: 8px; }
  .result-stage:fullscreen .result-fullscreen-meta { align-self: flex-start; }
  .result-stage:fullscreen .result-fullscreen-actions { justify-content: space-between; }
  .result-fullscreen-view-switch button { padding-inline: 9px; }
  .result-fullscreen-exit { padding-inline: 11px; }
  .result-compare-control { width: calc(100% - 24px); gap: 7px; padding-left: 8px; }
  .result-compare-control > span { display: none; }
  .result-tool-row {
    min-height: 54px;
    flex-wrap: nowrap;
    gap: 6px;
    padding: 6px 8px;
    overflow-x: auto;
    overscroll-behavior-x: contain;
    scrollbar-width: none;
    -webkit-overflow-scrolling: touch;
  }
  .result-tool-row::-webkit-scrollbar { display: none; }
  .result-tool-hint { display: none; }
  .result-tool-group { flex: 0 0 auto; gap: 1px; padding: 2px; border-radius: 8px; }
  .result-tool-group button { min-height: 40px; padding-inline: 9px; border-radius: 6px; font-size: 11px; }
  .result-zoom-tools { margin-left: 0; }
  .result-zoom-tools output { min-width: 38px; font-size: 10px; }
  .result-zoom-tools button { min-width: 32px; padding-inline: 6px; }
  .result-sidebar { padding: 16px 16px 22px; box-shadow: none; }
  .result-delivery-overview {
    display: grid;
    grid-template-columns: repeat(2,minmax(0,1fr));
    margin-bottom: 12px;
    overflow: hidden;
    border: 1px solid rgba(255,255,255,.09);
    border-radius: 11px;
    background: #141421;
  }
  .result-delivery-overview .result-summary {
    min-width: 0;
    min-height: 66px;
    display: grid;
    align-content: center;
    align-items: start;
    justify-content: stretch;
    gap: 5px;
    padding: 10px 12px;
    border: 0;
    border-right: 1px solid rgba(255,255,255,.07);
    border-bottom: 1px solid rgba(255,255,255,.07);
  }
  .result-delivery-overview .result-summary-label { margin: 0; font-size: 9px; letter-spacing: .08em; }
  .result-delivery-overview .result-summary strong { gap: 7px; font-size: 12px; white-space: nowrap; }
  .result-delivery-overview .result-status-dot { width: 6px; height: 6px; box-shadow: 0 0 0 3px rgba(82,211,154,.12); }
  .result-delivery-overview .result-summary p { display: none; }
  .result-delivery-overview .info-section,
  .result-delivery-overview .info-card { display: contents; }
  .result-delivery-overview .info-row {
    min-width: 0;
    min-height: 66px;
    display: grid;
    align-content: center;
    align-items: start;
    justify-content: stretch;
    gap: 5px;
    padding: 10px 12px;
    border: 0;
  }
  .result-delivery-overview .info-row:first-child { border-bottom: 1px solid rgba(255,255,255,.07); }
  .result-delivery-overview .info-row:nth-child(2) { border-right: 1px solid rgba(255,255,255,.07); }
  .result-delivery-overview .info-label { font-size: 9px; }
  .result-delivery-overview .info-value { overflow: hidden; font-size: 11px; text-overflow: ellipsis; white-space: nowrap; }
  .result-delivery-overview .result-info-value-action { width: 100%; justify-content: space-between; }
  .result-delivery-overview .result-info-value-action button { min-height: 26px; padding-inline: 7px; }
  .result-delivery-overview .result-content-count-row { display: none; }
  .result-delivery-overview .result-output-format-row { display: none; }
  .result-ai-card { margin-top: 12px; }
  .result-ai-card summary { min-height: 52px; padding-inline: 12px; }
  .result-ai-card summary strong { min-width: 0; overflow: hidden; font-size: 12px; text-overflow: ellipsis; white-space: nowrap; }
  .result-ai-content { padding: 0 12px 12px; }
  .result-sidebar .action-section { position: fixed; left: 0; right: 0; bottom: 0; z-index: 120; flex-direction: row; padding: 10px 16px calc(10px + env(safe-area-inset-bottom)); background: rgba(13,13,24,.95); border-top: 1px solid rgba(255,255,255,.1); backdrop-filter: blur(16px); }
  .result-sidebar .btn-save { order: 2; }
  .result-sidebar .btn-edit { order: 1; }
  .result-sidebar .btn-save,
  .result-sidebar .btn-edit { flex: 1; }
}

.feedback-confirm-title {
  margin: 0 0 8px;
  font-family: var(--font-display);
  font-size: 19px;
}

.feedback-confirm-message {
  margin: 0 0 22px;
  color: var(--text-secondary);
  font-size: 14px;
  line-height: 1.6;
}

.feedback-confirm-actions {
  display: flex;
  gap: 10px;
}

.feedback-confirm-cancel,
.feedback-confirm-submit {
  flex: 1;
  min-height: 44px;
  border-radius: var(--radius-md);
  border: 1px solid var(--glass-border);
  color: var(--text-primary);
  cursor: pointer;
}

.feedback-confirm-cancel { background: var(--glass); }
.feedback-confirm-submit {
  border-color: transparent;
  background: linear-gradient(135deg, var(--accent-1), var(--accent-2));
  font-weight: 700;
}

.feedback-confirm.danger .feedback-confirm-submit {
  background: linear-gradient(135deg, #dc2626, #ef4444);
}

@media (max-width: 480px) {
  .feedback-confirm {
    align-items: flex-end;
    padding: 12px max(12px, env(safe-area-inset-right)) calc(12px + env(safe-area-inset-bottom)) max(12px, env(safe-area-inset-left));
  }

  .feedback-confirm.has-preview .feedback-confirm-card {
    padding: 20px 18px 18px;
    border-radius: 20px;
  }

  .feedback-confirm-preview {
    grid-template-columns: 100px minmax(0, 1fr);
    gap: 10px;
  }

  .feedback-confirm-import-preview {
    grid-template-columns: 100px minmax(0, 1fr);
    gap: 10px;
  }

  .feedback-confirm-preview img {
    width: 100px;
    height: 78px;
  }

  .feedback-confirm-import-preview img {
    width: 100px;
    height: 78px;
  }

  .feedback-confirm-actions {
    gap: 8px;
  }

  .feedback-confirm-cancel,
  .feedback-confirm-submit {
    min-height: 48px;
  }
}

@media (max-width: 640px) {
  .hero-section { padding-top: 72px; }
  .hero-benefit-trigger { top: 14px; right: 14px; }
  .hero-title { font-size: 28px; }
  .hero-subtitle { font-size: 17px; }
  .hero-benefits { margin-top: 14px; }
  .sponsor-content { align-items: flex-start; flex-direction: column; }
  .sponsor-content button { width: 100%; }
  .editor-benefit-trigger span,
  .result-benefit-trigger span { display: none; }
  .benefit-trigger { padding-inline: 9px; }
  .project-import-btn { min-height: 56px; }
  .project-export-btn { min-width: 44px; min-height: 44px; padding: 0; border-radius: 50%; }
  .project-export-btn span,
  .project-export-btn kbd { display: none; }
  .editor-ai-btn { min-width: 44px; width: 44px; min-height: 44px; padding: 0; border-radius: 50%; }
  .editor-ai-btn span { display: none; }
  .shortcut-help-btn { display: none; }
  .result-page { padding-bottom: calc(146px + env(safe-area-inset-bottom)); }
  .result-sidebar .action-section { grid-template-columns: minmax(0,1.25fr) minmax(0,.75fr); display: grid; gap: 8px; }
  .result-sidebar .btn-reward-export { grid-column: 1 / -1; grid-row: 1; min-height: 50px; justify-content: flex-start; padding-inline: 14px; }
  .result-sidebar .btn-save { grid-column: 1; grid-row: 2; min-width: 0; height: 50px; padding-inline: 10px; order: initial; }
  .result-sidebar .btn-edit { grid-column: 2; grid-row: 2; min-width: 0; height: 50px; padding-inline: 8px; order: initial; }
  .result-sidebar .btn-save .btn-standard-copy { min-width: 0; }
  .result-sidebar .btn-save .btn-standard-copy strong,
  .result-sidebar .btn-save .btn-standard-copy small { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .result-export-card summary { min-height: 50px; }
  .result-export-card summary span { flex: 1; }
  .commerce-modal-card { padding: 24px 18px 20px; }
}

@media (max-width: 380px) {
  .result-sidebar .action-section { padding-inline: 10px; }
  .result-sidebar .btn-save .btn-icon { display: none; }
  .result-sidebar .btn-save .btn-standard-copy strong { font-size: 12px; }
  .result-sidebar .btn-edit { gap: 5px; font-size: 12px; }
}

/* ===== Controlled Glass Material System ===== */
.hero-section,
.feature-card,
.sponsor-card,
.page-header,
.step-tabs,
.canvas-toolbar,
.control-panel,
.result-proofing,
.result-sidebar {
  border-color: var(--glass-stroke);
  background-color: var(--glass-surface);
  box-shadow: var(--glass-shadow);
  -webkit-backdrop-filter: var(--glass-filter);
  backdrop-filter: var(--glass-filter);
}

.hero-section {
  background-image:
    linear-gradient(135deg, rgba(124, 58, 237, 0.13), rgba(236, 72, 153, 0.055) 52%, rgba(245, 158, 11, 0.035)),
    linear-gradient(rgba(17, 15, 35, 0.7), rgba(17, 15, 35, 0.7));
}

.feature-card {
  background-image:
    linear-gradient(145deg, rgba(124, 58, 237, 0.075), rgba(236, 72, 153, 0.025)),
    linear-gradient(var(--glass-surface), var(--glass-surface));
}

.sponsor-card {
  background-image:
    linear-gradient(110deg, rgba(8, 145, 178, 0.085), rgba(124, 58, 237, 0.025)),
    linear-gradient(var(--glass-surface), var(--glass-surface));
}

.history-search-field,
.history-sort-select,
.result-export-card,
.result-sidebar .info-card {
  border-color: var(--glass-stroke);
  background-color: var(--glass-surface-strong);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.045), 0 8px 22px rgba(0, 0, 0, 0.16);
  -webkit-backdrop-filter: blur(14px) saturate(125%);
  backdrop-filter: blur(14px) saturate(125%);
}

.history-search-field:focus-within,
.history-sort-select:focus {
  background-color: rgba(32, 24, 58, 0.84);
}

.control-panel,
.result-sidebar {
  background-color: var(--glass-surface-strong);
}

.canvas-toolbar {
  background-color: rgba(14, 13, 29, 0.76);
}

.result-page > .page-header,
.editor-page > .page-header,
.editor-page > .step-tabs,
.editor-page > .control-panel {
  border-color: var(--glass-stroke);
  background-color: var(--glass-surface-strong);
  box-shadow: var(--glass-shadow);
}

/* The working canvas stays opaque so image colour and edge checks remain accurate. */
.editor-page > .canvas-container,
.result-stage {
  -webkit-backdrop-filter: none;
  backdrop-filter: none;
}

@supports not ((-webkit-backdrop-filter: blur(1px)) or (backdrop-filter: blur(1px))) {
  .hero-section,
  .feature-card,
  .sponsor-card,
  .page-header,
  .step-tabs,
  .canvas-toolbar,
  .control-panel,
  .result-proofing,
  .result-sidebar {
    background-color: rgba(17, 15, 35, 0.96);
  }
}

@media (max-width: 640px) {
  .hero-section,
  .feature-card,
  .sponsor-card,
  .page-header,
  .step-tabs,
  .canvas-toolbar,
  .control-panel,
  .result-proofing,
  .result-sidebar {
    box-shadow: 0 10px 28px rgba(0, 0, 0, 0.24), inset 0 1px 0 rgba(255, 255, 255, 0.06);
    -webkit-backdrop-filter: blur(10px) saturate(115%);
    backdrop-filter: blur(10px) saturate(115%);
  }
}

/* Keep modal material after legacy component declarations in the cascade. */
.commerce-modal > .commerce-modal-card,
.feedback-confirm > .feedback-confirm-card,
.ai-modal > .ai-modal-content {
  border-color: rgba(255, 255, 255, 0.13);
  background: linear-gradient(145deg, rgba(29, 25, 52, 0.92), rgba(13, 13, 26, 0.86));
  box-shadow: 0 28px 80px rgba(0, 0, 0, 0.58), inset 0 1px 0 rgba(255, 255, 255, 0.085);
  -webkit-backdrop-filter: blur(24px) saturate(140%);
  backdrop-filter: blur(24px) saturate(140%);
}

.commerce-modal > .commerce-modal-mask,
.feedback-confirm > .feedback-confirm-mask,
.ai-modal > .ai-modal-mask {
  background: rgba(3, 3, 10, 0.72);
  -webkit-backdrop-filter: blur(10px) saturate(110%);
  backdrop-filter: blur(10px) saturate(110%);
}

@media (max-width: 640px) {
  .commerce-modal > .commerce-modal-card,
  .feedback-confirm > .feedback-confirm-card,
  .ai-modal > .ai-modal-content {
    -webkit-backdrop-filter: blur(14px) saturate(120%);
    backdrop-filter: blur(14px) saturate(120%);
  }
}

/* ===== Refined Internal Hierarchy ===== */
.flow-step {
  border-color: rgba(255, 255, 255, 0.075);
  background: var(--panel-fill-soft);
  box-shadow: 0 9px 24px rgba(0, 0, 0, 0.18), inset 0 1px 0 rgba(255, 255, 255, 0.035);
}

.flow-line {
  opacity: 0.62;
}

.feature-card {
  border-color: rgba(255, 255, 255, 0.095);
}

.feature-icon {
  border: 1px solid rgba(196, 181, 253, 0.1);
  box-shadow: 0 6px 16px rgba(124, 58, 237, 0.12), inset 0 1px 0 rgba(255, 255, 255, 0.06);
}

.history-item {
  border-color: rgba(255, 255, 255, 0.09);
}

.history-item::after {
  border-color: transparent;
}

.geometry-panel,
.text-edit-panel,
.inspector-details {
  border-color: rgba(255, 255, 255, 0.07);
  background: var(--panel-fill-soft);
}

.physical-size-panel {
  border-color: rgba(167, 139, 250, 0.13);
  background: rgba(124, 58, 237, 0.04);
}

.alignment-preview-panel {
  border-color: rgba(34, 211, 238, 0.12);
  background: linear-gradient(135deg, rgba(34, 211, 238, 0.03), rgba(124, 58, 237, 0.035));
}

.inspector-header,
.result-proofing-head,
.result-summary {
  border-color: var(--divider-soft);
}

.result-tool-row,
.result-export-fields,
.info-row + .info-row {
  border-color: var(--divider-soft);
}

.result-sidebar .info-card {
  border: 1px solid var(--divider-soft);
  background-color: var(--panel-fill-soft);
  box-shadow: none;
  -webkit-backdrop-filter: none;
  backdrop-filter: none;
}

.result-export-card {
  border-color: rgba(255, 255, 255, 0.075);
  background-color: rgba(255, 255, 255, 0.032);
  box-shadow: none;
}

.result-ai-card {
  border-color: rgba(103, 205, 230, 0.13);
  background: rgba(8, 145, 178, 0.045);
}

.flow-step-icon,
.feature-icon,
.ai-btn-text .ui-icon,
.canvas-toolbar .ui-icon,
.control-panel button:not(#btn-delete-content):not([data-content-action="delete"]) .ui-icon,
.result-tool-row .ui-icon {
  color: #b9adf2;
}

.inspector-header b {
  border: 1px solid rgba(196, 181, 253, 0.1);
  background: rgba(124, 58, 237, 0.17);
}

@media (max-width: 640px) {
  .result-delivery-overview {
    border-color: rgba(255, 255, 255, 0.065);
    background: rgba(255, 255, 255, 0.026);
  }

  .result-delivery-overview .result-summary,
  .result-delivery-overview .info-row:first-child,
  .result-delivery-overview .info-row:nth-child(2) {
    border-color: var(--divider-soft);
  }
}

/* ===== Clear Information Typography ===== */
.section-title,
.header-title,
.canvas-toolbar-title strong,
.physical-size-header strong,
.inspector-header,
.result-title,
.result-export-card summary strong {
  color: var(--type-heading);
}

.section-title,
.header-title,
.result-title {
  letter-spacing: 0.2px;
}

.physical-size-header strong,
.canvas-toolbar-title strong,
.inspector-details summary,
.edit-label,
.result-export-card summary strong {
  font-family: var(--font-display);
  font-size: 12px;
  font-weight: 700;
  line-height: 1.35;
}

.inspector-details summary,
.edit-label {
  color: var(--type-label);
}

.project-name-field > span,
.physical-size-fields label > span,
.numeric-grid label,
.image-size-row label,
.result-export-field > span,
.result-logo-field > span,
.result-sidebar .info-label {
  color: var(--type-label);
  font-size: 11px;
  font-weight: 600;
  line-height: 1.35;
  letter-spacing: 0.08px;
}

.result-summary-label,
.result-ai-kicker {
  color: var(--type-label);
  font-size: 10px;
  font-weight: 700;
  line-height: 1.3;
  letter-spacing: 0.8px;
}

.canvas-toolbar-title span,
.editor-history-state,
.geometry-hint,
#physical-size-status,
.input-count,
.result-tool-hint,
.result-summary p,
.result-ai-card p,
.result-export-card summary span {
  color: var(--type-caption);
  line-height: 1.5;
}

.geometry-values span {
  color: var(--type-label);
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.12px;
}

.geometry-values strong,
.physical-size-area strong,
.result-sidebar .info-value,
.result-export-field output,
.result-zoom-tools output,
.alignment-snap-suggestion strong,
.alignment-magnifier-meta strong {
  color: var(--type-data);
  font-family: var(--font-display);
  font-variant-numeric: tabular-nums;
  font-feature-settings: "tnum" 1;
  letter-spacing: 0.1px;
}

.geometry-values strong {
  font-size: 14px;
  font-weight: 700;
}

.result-sidebar .info-value {
  font-size: 13px;
  font-weight: 700;
}

.result-summary strong {
  color: var(--type-heading);
  font-family: var(--font-display);
  font-size: 15px;
  font-weight: 700;
  line-height: 1.35;
}

.control-panel input[type="number"],
.control-panel input[type="text"],
.result-sidebar input[type="text"],
.result-sidebar input[type="date"],
.result-sidebar select {
  font-variant-numeric: tabular-nums;
  font-feature-settings: "tnum" 1;
}

@media (max-width: 640px) {
  .result-delivery-overview .result-summary-label,
  .result-delivery-overview .info-label {
    font-size: 9px;
    line-height: 1.25;
  }

  .result-delivery-overview .result-summary strong {
    font-size: 12px;
  }

  .result-delivery-overview .info-value {
    font-size: 11px;
  }
}

/* ===== Unified Feedback States ===== */
.feedback-toast {
  border-color: rgba(82, 211, 154, 0.24);
  background:
    linear-gradient(110deg, rgba(82, 211, 154, 0.08), transparent 42%),
    rgba(18, 18, 36, 0.9);
  box-shadow: 0 16px 42px rgba(0, 0, 0, 0.42), inset 0 1px 0 rgba(255, 255, 255, 0.075);
  -webkit-backdrop-filter: blur(20px) saturate(135%);
  backdrop-filter: blur(20px) saturate(135%);
}

.feedback-toast::before {
  width: 22px;
  height: 22px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: rgba(82, 211, 154, 0.13);
  color: var(--state-success);
  font-size: 12px;
}

.feedback-toast.warning {
  border-color: rgba(243, 189, 98, 0.27);
  background:
    linear-gradient(110deg, rgba(243, 189, 98, 0.09), transparent 42%),
    rgba(18, 18, 36, 0.9);
}

.feedback-toast.warning::before {
  background: rgba(243, 189, 98, 0.13);
  color: var(--state-warning);
}

.feedback-toast.error {
  border-color: rgba(248, 113, 113, 0.28);
  background:
    linear-gradient(110deg, rgba(248, 113, 113, 0.09), transparent 42%),
    rgba(18, 18, 36, 0.9);
}

.feedback-toast.error::before {
  background: rgba(248, 113, 113, 0.13);
  color: var(--state-error);
}

.loading-mask {
  background: rgba(3, 3, 10, 0.72);
  -webkit-backdrop-filter: blur(10px) saturate(110%);
  backdrop-filter: blur(10px) saturate(110%);
}

.loading-box {
  min-width: 188px;
  padding: 20px 24px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: var(--radius-lg);
  background: rgba(20, 18, 39, 0.88);
  color: var(--type-heading);
  box-shadow: 0 22px 60px rgba(0, 0, 0, 0.48), inset 0 1px 0 rgba(255, 255, 255, 0.075);
  -webkit-backdrop-filter: blur(22px) saturate(135%);
  backdrop-filter: blur(22px) saturate(135%);
}

.loading-spinner {
  width: 38px;
  height: 38px;
  border-color: rgba(255, 255, 255, 0.09);
  border-top-color: var(--accent-1);
  border-right-color: var(--accent-2);
  box-shadow: 0 0 18px rgba(124, 58, 237, 0.16);
}

.empty-history,
.history-search-empty,
.empty-tip,
.ai-gallery-empty,
.ai-preview-box {
  border-color: rgba(167, 139, 250, 0.16);
  background: rgba(124, 58, 237, 0.028);
  color: var(--type-caption);
}

.empty-history,
.history-search-empty,
.empty-tip,
.ai-gallery-empty {
  border-style: dashed;
}

.empty-tip {
  padding: 18px 14px;
  border-width: 1px;
  border-radius: var(--radius-md);
}

.empty-icon {
  color: var(--state-info);
  opacity: 0.76;
  filter: drop-shadow(0 6px 18px rgba(124, 58, 237, 0.22));
}

.empty-text,
.history-search-empty strong {
  color: var(--type-heading);
}

.result-stage-empty {
  padding: 8px 12px;
  border: 1px solid rgba(167, 139, 250, 0.16);
  border-radius: 999px;
  background: rgba(17, 15, 35, 0.82);
  color: var(--type-label);
  box-shadow: 0 8px 22px rgba(0, 0, 0, 0.24);
  -webkit-backdrop-filter: blur(12px);
  backdrop-filter: blur(12px);
}

.ai-gallery-error {
  margin: 8px 0;
  border: 1px solid rgba(248, 113, 113, 0.2);
  border-radius: var(--radius-md);
  background: rgba(248, 113, 113, 0.045);
}

.ai-gallery-error-text {
  color: var(--state-error);
}

.feedback-confirm-icon {
  border: 1px solid rgba(243, 189, 98, 0.18);
  background: rgba(243, 189, 98, 0.11);
  color: var(--state-warning);
}

.feedback-confirm.danger .feedback-confirm-icon {
  border-color: rgba(248, 113, 113, 0.2);
  background: rgba(248, 113, 113, 0.11);
  color: var(--state-error);
}

@media (max-width: 640px) {
  .toast-region {
    top: max(12px, env(safe-area-inset-top));
    width: min(calc(100% - 24px), 420px);
  }

  .feedback-toast {
    padding: 12px 13px;
    font-size: 13px;
    -webkit-backdrop-filter: blur(14px) saturate(120%);
    backdrop-filter: blur(14px) saturate(120%);
  }

  .action-toast-region {
    bottom: calc(76px + env(safe-area-inset-bottom));
    width: min(calc(100% - 24px), 420px);
  }

  .empty-history {
    padding: 42px 20px;
  }

  .loading-box {
    min-width: 172px;
    padding: 18px 20px;
    -webkit-backdrop-filter: blur(14px) saturate(120%);
    backdrop-filter: blur(14px) saturate(120%);
  }
}

/* ===== Mobile operation workspace ===== */
@media (max-width: 767px), (max-width: 899px) and (orientation: landscape) and (max-height: 520px) {
  :root {
    --mobile-bottom-bar-height: 72px;
  }

  .action-toast-region {
    bottom: calc(var(--mobile-bottom-bar-height) + 12px + env(safe-area-inset-bottom));
    width: min(calc(100% - 24px), 420px);
  }

  .page-editor.active {
    overflow: hidden;
    overscroll-behavior: none;
  }

  .editor-page {
    width: 100%;
    height: var(--mobile-viewport-height, 100dvh);
    min-height: 0;
    overflow: hidden;
  }

  .editor-page > .page-header {
    position: relative;
    z-index: 110;
    flex: 0 0 auto;
    min-height: 56px;
    padding:
      max(8px, env(safe-area-inset-top))
      max(12px, env(safe-area-inset-right))
      8px
      max(12px, env(safe-area-inset-left));
  }

  .editor-page > .step-tabs {
    position: relative;
    z-index: 105;
    flex: 0 0 auto;
    min-height: 60px;
    padding: 7px max(12px, env(safe-area-inset-right)) 7px max(12px, env(safe-area-inset-left));
  }

  .editor-page > .canvas-container {
    flex: 0 0 auto;
    min-height: 0;
    max-height: 43dvh;
    padding: 8px max(8px, env(safe-area-inset-right)) 10px max(8px, env(safe-area-inset-left));
    overflow: visible;
  }

  .editor-page > .canvas-container.canvas-zoomed {
    overflow: hidden;
  }

  .canvas-gesture-status {
    position: absolute;
    right: max(12px, env(safe-area-inset-right));
    bottom: 12px;
    z-index: 80;
    display: flex;
    min-height: 44px;
    align-items: center;
    gap: 7px;
    padding: 4px 5px 4px 11px;
    border: 1px solid rgba(255, 255, 255, 0.14);
    border-radius: 12px;
    color: rgba(255, 255, 255, 0.82);
    background: rgba(10, 10, 24, 0.82);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.3);
    backdrop-filter: blur(16px) saturate(125%);
    pointer-events: none;
    font-size: 11px;
  }

  .canvas-gesture-coach {
    position: absolute;
    top: 66px;
    left: 50%;
    z-index: 95;
    display: grid;
    grid-template-columns: 72px minmax(0, 1fr) auto;
    width: min(360px, calc(100% - 24px));
    min-height: 100px;
    align-items: center;
    gap: 10px;
    padding: 10px;
    border: 1px solid rgba(167, 139, 250, 0.42);
    border-radius: 16px;
    color: #fff;
    background: rgba(13, 12, 29, 0.94);
    box-shadow: 0 18px 46px rgba(0, 0, 0, 0.46), 0 0 0 3px rgba(124, 58, 237, 0.1);
    backdrop-filter: blur(20px) saturate(130%);
    transform: translateX(-50%);
  }

  .canvas-gesture-coach[hidden] {
    display: none;
  }

  .gesture-coach-demo {
    position: relative;
    width: 72px;
    height: 64px;
    overflow: hidden;
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 12px;
    background: linear-gradient(145deg, rgba(124, 58, 237, 0.2), rgba(34, 211, 238, 0.08));
  }

  .gesture-coach-track {
    position: absolute;
    top: 31px;
    left: 17px;
    width: 38px;
    height: 1px;
    background: rgba(196, 181, 253, 0.42);
  }

  .gesture-coach-touch {
    position: absolute;
    top: 24px;
    width: 16px;
    height: 16px;
    border: 2px solid #fff;
    border-radius: 50%;
    background: #7c3aed;
    box-shadow: 0 0 0 5px rgba(124, 58, 237, 0.2), 0 0 14px rgba(124, 58, 237, 0.65);
  }

  .gesture-coach-touch-one {
    left: 14px;
    animation: gesture-coach-drag 3.2s ease-in-out infinite;
  }

  .gesture-coach-touch-left,
  .gesture-coach-touch-right {
    opacity: 0;
    animation: gesture-coach-pinch 3.2s ease-in-out infinite;
  }

  .gesture-coach-touch-left { left: 25px; --gesture-x: -12px; }
  .gesture-coach-touch-right { right: 25px; --gesture-x: 12px; }

  .gesture-coach-copy {
    min-width: 0;
    display: grid;
    gap: 3px;
  }

  .gesture-coach-copy strong {
    margin-bottom: 2px;
    color: #f5f3ff;
    font-size: 13px;
  }

  .gesture-coach-copy span {
    color: rgba(255, 255, 255, 0.7);
    font-size: 11px;
    line-height: 1.35;
  }

  .gesture-coach-copy b {
    margin-right: 4px;
    color: #c4b5fd;
  }

  .canvas-gesture-coach button {
    min-width: 64px;
    min-height: 44px;
    padding: 0 10px;
    border: 1px solid rgba(167, 139, 250, 0.38);
    border-radius: 10px;
    color: #fff;
    background: linear-gradient(135deg, rgba(124, 58, 237, 0.88), rgba(99, 102, 241, 0.78));
    touch-action: manipulation;
  }

  .canvas-gesture-coach:not([hidden]) ~ .canvas-gesture-status {
    opacity: 0;
  }

  .mobile-content-actions {
    position: absolute;
    top: 66px;
    left: 50%;
    z-index: 92;
    display: flex;
    min-height: 56px;
    align-items: center;
    gap: 8px;
    padding: 6px;
    border: 1px solid rgba(103, 232, 249, 0.32);
    border-radius: 14px;
    background: rgba(10, 12, 25, 0.92);
    box-shadow: 0 12px 32px rgba(0, 0, 0, 0.4), 0 0 0 3px rgba(34, 211, 238, 0.08);
    backdrop-filter: blur(18px) saturate(125%);
    transform: translateX(-50%);
    animation: mobile-content-actions-in 160ms ease-out both;
  }

  .mobile-content-actions[hidden],
  .canvas-gesture-coach:not([hidden]) ~ .mobile-content-actions {
    display: none;
  }

  .mobile-content-actions > span {
    padding-left: 7px;
    color: #a5f3fc;
    font-size: 11px;
    font-weight: 700;
    white-space: nowrap;
  }

  .mobile-content-actions.overlap-cycling > span {
    padding: 7px 9px;
    border: 1px solid rgba(196, 181, 253, 0.3);
    border-radius: 9px;
    background: rgba(124, 58, 237, 0.18);
    color: #ede9fe;
  }

  .mobile-content-actions.overlap-cycling > [data-content-action="duplicate"] {
    display: none;
  }

  .mobile-content-actions button {
    min-width: 48px;
    min-height: 44px;
    padding: 0 10px;
    border: 0;
    border-radius: 9px;
    color: rgba(255, 255, 255, 0.86);
    background: rgba(255, 255, 255, 0.07);
    touch-action: manipulation;
  }

  .mobile-content-actions button:active {
    background: rgba(124, 58, 237, 0.34);
  }

  .mobile-content-actions .mobile-content-delete {
    color: #fecdd3;
    background: rgba(225, 29, 72, 0.14);
  }

  .mobile-content-actions .mobile-content-lock[aria-pressed="true"] {
    border-color: rgba(196, 181, 253, 0.38);
    background: rgba(124, 58, 237, 0.24);
    color: #ede9fe;
  }

  .mobile-content-actions > button:disabled {
    opacity: 0.42;
    cursor: not-allowed;
  }

  .mobile-content-actions.layer-menu-open {
    border-color: rgba(196, 181, 253, 0.48);
    box-shadow: 0 14px 36px rgba(0, 0, 0, 0.46), 0 0 0 3px rgba(124, 58, 237, 0.14);
  }

  .mobile-layer-menu:not([hidden]) {
    position: absolute;
    top: calc(100% + 8px);
    left: 50%;
    z-index: 4;
    display: grid;
    grid-template-columns: repeat(4, minmax(58px, 1fr));
    gap: 8px;
    width: max-content;
    padding: 7px;
    border: 1px solid rgba(196, 181, 253, 0.34);
    border-radius: 13px;
    background: rgba(10, 11, 25, 0.96);
    box-shadow: 0 16px 38px rgba(0, 0, 0, 0.48), inset 0 1px 0 rgba(255, 255, 255, 0.08);
    transform: translateX(-50%);
    backdrop-filter: blur(18px) saturate(125%);
    -webkit-backdrop-filter: blur(18px) saturate(125%);
    animation: mobile-layer-menu-in 150ms ease-out both;
  }

  .mobile-content-actions .mobile-layer-menu button {
    min-width: 58px;
    min-height: 44px;
    padding: 0 9px;
    border: 1px solid rgba(255, 255, 255, 0.08);
    color: rgba(255, 255, 255, 0.9);
    background: rgba(255, 255, 255, 0.065);
  }

  .mobile-content-actions .mobile-layer-menu button:disabled {
    opacity: 0.34;
    color: rgba(255, 255, 255, 0.5);
  }

  @keyframes mobile-layer-menu-in {
    from { opacity: 0; transform: translateX(-50%) translateY(-4px) scale(0.98); }
    to { opacity: 1; transform: translateX(-50%) translateY(0) scale(1); }
  }

  .content-item .content-toolbar {
    display: none;
  }

  @keyframes mobile-content-actions-in {
    from { opacity: 0; }
    to { opacity: 1; }
  }

  @keyframes gesture-coach-drag {
    0%, 10% { opacity: 1; transform: translateX(0); }
    38% { opacity: 1; transform: translateX(28px); }
    45%, 100% { opacity: 0; transform: translateX(28px); }
  }

  @keyframes gesture-coach-pinch {
    0%, 48% { opacity: 0; transform: translateX(0); }
    58%, 72% { opacity: 1; transform: translateX(0); }
    92% { opacity: 1; transform: translateX(var(--gesture-x)); }
    100% { opacity: 0; transform: translateX(var(--gesture-x)); }
  }

  .canvas-gesture-status strong {
    min-width: 36px;
    color: #c4b5fd;
    font-variant-numeric: tabular-nums;
    text-align: right;
  }

  .canvas-gesture-status button {
    min-width: 52px;
    min-height: 44px;
    padding: 0 10px;
    border: 1px solid rgba(167, 139, 250, 0.42);
    border-radius: 9px;
    color: #fff;
    background: rgba(124, 58, 237, 0.58);
    pointer-events: auto;
    touch-action: manipulation;
  }

  .canvas-gesture-status button[hidden] {
    display: none;
  }

  .canvas-is-pinching .canvas-gesture-status {
    border-color: rgba(34, 211, 238, 0.5);
    box-shadow: 0 0 0 3px rgba(34, 211, 238, 0.1), 0 8px 24px rgba(0, 0, 0, 0.3);
  }

  .canvas-is-pinching .canvas-wrapper {
    cursor: grabbing;
  }

  .canvas-toolbar {
    min-height: 48px;
    padding: 4px 4px 4px 10px;
  }

  .canvas-toolbar-title strong {
    font-size: 12px;
  }

  .editor-history-actions button {
    width: 44px;
    min-width: 44px;
    height: 44px;
  }

  .editor-page > .control-panel {
    position: relative;
    flex: 1 1 0;
    min-height: 0;
    margin: 0;
    padding:
      14px
      max(14px, env(safe-area-inset-right))
      calc(var(--mobile-bottom-bar-height) + env(safe-area-inset-bottom) + 24px)
      max(14px, env(safe-area-inset-left));
    overflow-x: hidden;
    overflow-y: auto;
    border-radius: 18px 18px 0 0;
    overscroll-behavior-y: contain;
    scroll-behavior: smooth;
    scroll-padding: 16px 0 calc(var(--mobile-bottom-bar-height) + env(safe-area-inset-bottom) + 28px);
    scrollbar-width: thin;
    touch-action: pan-y;
    -webkit-overflow-scrolling: touch;
  }

  .editor-page > .control-panel::-webkit-scrollbar {
    width: 4px;
  }

  .editor-page > .control-panel::-webkit-scrollbar-thumb {
    border-radius: 999px;
    background: rgba(167, 139, 250, 0.35);
  }

  .control-panel::before {
    position: sticky;
    top: 0;
    z-index: 4;
    display: block;
    margin: -7px auto 7px;
    transform: none;
  }

  #panel-frame,
  #panel-content {
    min-height: 100%;
  }

  .page-editor button,
  .page-editor summary,
  .page-editor select,
  .page-editor input:not([type="range"]):not([type="checkbox"]):not([type="color"]),
  .page-editor textarea {
    min-height: 44px;
    touch-action: manipulation;
  }

  .page-editor input:not([type="range"]):not([type="checkbox"]):not([type="color"]),
  .page-editor textarea,
  .page-editor select {
    font-size: 16px;
  }

  .header-back-btn,
  .benefit-trigger {
    min-height: 44px;
  }

  .header-back-btn {
    padding-inline: 13px;
  }

  .color-list {
    gap: 8px;
  }

  .color-item {
    width: 44px;
    height: 44px;
    border-width: 3px;
  }

  .border-width-item,
  .screen-edit-mode-btn {
    min-height: 44px;
    padding: 8px 14px;
  }

  .physical-size-toggle,
  .switch-row,
  .result-export-check {
    min-height: 44px;
  }

  .physical-size-toggle input,
  .switch-row input,
  .result-export-check input {
    width: 22px;
    height: 22px;
  }

  .btn-row {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 880;
    min-height: calc(var(--mobile-bottom-bar-height) + env(safe-area-inset-bottom));
    margin: 0;
    padding:
      10px
      max(14px, env(safe-area-inset-right))
      calc(10px + env(safe-area-inset-bottom))
      max(14px, env(safe-area-inset-left));
    border-top: 1px solid rgba(255, 255, 255, 0.11);
    background: rgba(12, 12, 25, 0.94);
    box-shadow: 0 -12px 34px rgba(0, 0, 0, 0.36);
    backdrop-filter: blur(20px) saturate(125%);
    transition: opacity 160ms ease, transform 180ms ease;
  }

  .btn-row .btn-secondary,
  .btn-row .btn-primary {
    height: 52px;
    min-height: 52px;
  }

  .btn-row .btn-secondary {
    flex: 0.82;
    font-size: 13px;
  }

  .btn-row .btn-primary {
    flex: 1.8;
    font-size: 14px;
    letter-spacing: 0.3px;
  }

  #text-edit-panel,
  #image-edit-panel {
    left: max(8px, env(safe-area-inset-left));
    right: max(8px, env(safe-area-inset-right));
    bottom: calc(var(--mobile-bottom-bar-height) + env(safe-area-inset-bottom) + 8px);
    max-height: min(62dvh, calc(var(--mobile-viewport-height, 100dvh) - 176px));
    padding-bottom: 20px;
    overscroll-behavior-y: contain;
    scroll-padding: 58px 0 18px;
    scrollbar-width: thin;
    -webkit-overflow-scrolling: touch;
    transform: translateY(var(--mobile-inspector-drag-y, 0));
    transition: max-height 180ms ease, padding 180ms ease, transform 180ms ease-out;
  }

  #text-edit-panel.mobile-inspector-dragging,
  #image-edit-panel.mobile-inspector-dragging {
    transition: none;
    user-select: none;
  }

  .mobile-inspector-toggle {
    display: inline-flex;
    min-width: 52px;
    align-items: center;
    justify-content: center;
    border-color: rgba(103, 232, 249, 0.28);
    color: #a5f3fc;
    background: rgba(8, 145, 178, 0.1);
  }

  .mobile-inspector-gesture-coach:not([hidden]) {
    position: absolute;
    top: 68px;
    right: 12px;
    left: 12px;
    z-index: 7;
    display: flex;
    min-height: 48px;
    align-items: center;
    gap: 8px;
    padding: 2px 3px 2px 11px;
    border: 1px solid rgba(103, 232, 249, 0.34);
    border-radius: 12px;
    color: #cffafe;
    background: rgba(8, 47, 73, 0.94);
    box-shadow: 0 10px 26px rgba(0, 0, 0, 0.32), inset 0 1px 0 rgba(255, 255, 255, 0.08);
    backdrop-filter: blur(16px) saturate(125%);
    animation: mobile-inspector-coach-in 180ms ease-out both;
  }

  .mobile-inspector-gesture-coach .ui-icon {
    flex: 0 0 20px;
    width: 20px;
    height: 20px;
    color: #67e8f9;
  }

  .mobile-inspector-gesture-coach span {
    min-width: 0;
    flex: 1;
    font-size: 11px;
    line-height: 1.35;
  }

  .mobile-inspector-gesture-coach button {
    min-width: 60px;
    min-height: 44px;
    padding: 0 9px;
    border: 0;
    border-radius: 9px;
    color: #fff;
    background: rgba(14, 116, 144, 0.68);
    touch-action: manipulation;
  }

  .mobile-inspector-coach-visible .inspector-header {
    margin-bottom: 66px;
  }

  @keyframes mobile-inspector-coach-in {
    from { opacity: 0; transform: translateY(-6px); }
    to { opacity: 1; transform: translateY(0); }
  }

  #text-edit-panel.mobile-inspector-collapsed,
  #image-edit-panel.mobile-inspector-collapsed {
    min-height: 74px;
    max-height: 74px !important;
    padding-bottom: 0;
    overflow: hidden;
  }

  .mobile-inspector-collapsed > :not(.inspector-header) {
    display: none !important;
  }

  .mobile-inspector-collapsed .inspector-header {
    margin-bottom: 0;
    border-bottom-color: transparent;
  }

  .mobile-inspector-collapsed .inspector-header button:not(.mobile-inspector-toggle) {
    display: none;
  }

  #text-edit-panel .inspector-header::before,
  #image-edit-panel .inspector-header::before {
    content: '';
    position: absolute;
    top: 5px;
    left: 50%;
    width: 34px;
    height: 4px;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.18);
    transform: translateX(-50%);
  }

  #text-edit-panel .inspector-header,
  #image-edit-panel .inspector-header {
    cursor: grab;
    touch-action: none;
  }

  #text-edit-panel.mobile-inspector-dragging .inspector-header,
  #image-edit-panel.mobile-inspector-dragging .inspector-header {
    cursor: grabbing;
  }

  #text-edit-panel.mobile-inspector-dragging .inspector-header::before,
  #image-edit-panel.mobile-inspector-dragging .inspector-header::before {
    width: 44px;
    background: rgba(165, 243, 252, 0.72);
  }

  #text-edit-panel::-webkit-scrollbar,
  #image-edit-panel::-webkit-scrollbar {
    width: 4px;
  }

  #text-edit-panel::-webkit-scrollbar-thumb,
  #image-edit-panel::-webkit-scrollbar-thumb {
    border-radius: 999px;
    background: rgba(167, 139, 250, 0.38);
  }

  .page-editor.editor-input-focused .btn-row {
    opacity: 0;
    pointer-events: none;
    transform: translateY(110%);
  }

  .page-editor.editor-input-focused #text-edit-panel,
  .page-editor.editor-input-focused #image-edit-panel {
    bottom: max(8px, env(safe-area-inset-bottom));
    max-height: calc(var(--mobile-viewport-height, 100dvh) - 24px);
  }

  .content-toolbar {
    gap: 6px;
    padding: 5px;
  }

  .content-toolbar button {
    min-width: 48px;
    min-height: 44px;
    padding-inline: 10px;
  }

  .handle::before,
  .content-handle::before,
  .text-resize-handle::before,
  .content-rotate-handle::before {
    inset: auto;
    left: 50%;
    top: 50%;
    width: 44px;
    height: 44px;
    min-width: 44px;
    min-height: 44px;
    transform: translate(-50%, -50%);
    border-radius: 50%;
  }

  .handle {
    transform: scale(1.18);
    background: rgba(12, 12, 28, 0.88);
    border-width: 2.5px;
    box-shadow: 0 0 0 3px rgba(124, 58, 237, 0.18), 0 5px 14px rgba(0, 0, 0, 0.36);
  }

  .content-handle {
    transform: scale(1.35);
    background: rgba(12, 12, 28, 0.92);
    box-shadow: 0 0 0 3px rgba(124, 58, 237, 0.16), 0 4px 12px rgba(0, 0, 0, 0.34);
  }

  .text-resize-handle {
    width: 18px;
    height: 18px;
    right: 2px;
    bottom: 2px;
    box-shadow: 0 0 0 3px rgba(124, 58, 237, 0.2), 0 4px 12px rgba(0, 0, 0, 0.36);
  }

  .text-resize-handle::after {
    content: '';
    position: absolute;
    right: 2px;
    bottom: 2px;
    width: 7px;
    height: 7px;
    border-right: 1.5px solid rgba(255, 255, 255, 0.92);
    border-bottom: 1.5px solid rgba(255, 255, 255, 0.92);
    pointer-events: none;
  }

  .content-rotate-handle {
    width: 24px;
    height: 24px;
    bottom: -42px;
    box-shadow: 0 0 0 3px rgba(34, 211, 238, 0.18), 0 4px 12px rgba(0, 0, 0, 0.36);
  }

  .content-transform-feedback:not([hidden]) {
    position: absolute;
    left: 50%;
    top: 50%;
    z-index: 60;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 72px;
    min-height: 36px;
    padding: 7px 12px;
    border: 1px solid rgba(103, 232, 249, 0.42);
    border-radius: 999px;
    background: rgba(8, 10, 22, 0.88);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.36), inset 0 1px 0 rgba(255, 255, 255, 0.08);
    color: #ecfeff;
    font-size: 12px;
    font-weight: 750;
    line-height: 1;
    letter-spacing: 0.02em;
    white-space: nowrap;
    pointer-events: none;
    transform: translate(-50%, -50%);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
  }

  .content-transform-feedback[data-kind="rotate"] {
    color: #cffafe;
  }

  .content-transform-feedback[data-kind="position"] {
    min-width: 104px;
    color: #e0f2fe;
  }

  .content-transform-feedback.is-snapped {
    border-color: rgba(196, 181, 253, 0.78);
    background: rgba(76, 29, 149, 0.88);
    box-shadow: 0 0 0 3px rgba(139, 92, 246, 0.18), 0 8px 24px rgba(0, 0, 0, 0.36);
  }

  .touch-adjusting .content-toolbar {
    opacity: 0;
    pointer-events: none;
    transform: translateX(-50%) translateY(-4px);
  }

  .content-alignment-guide:not([hidden]) {
    position: absolute;
    z-index: 90;
    display: block;
    pointer-events: none;
    filter: drop-shadow(0 0 4px rgba(196, 181, 253, 0.9));
  }

  .content-alignment-guide-x:not([hidden]) {
    top: 0;
    bottom: 0;
    width: 1px;
    background: repeating-linear-gradient(to bottom, rgba(196, 181, 253, 0.95) 0 6px, transparent 6px 11px);
    transform: translateX(-0.5px);
  }

  .content-alignment-guide-y:not([hidden]) {
    left: 0;
    right: 0;
    height: 1px;
    background: repeating-linear-gradient(to right, rgba(196, 181, 253, 0.95) 0 6px, transparent 6px 11px);
    transform: translateY(-0.5px);
  }

  .content-alignment-guide.is-edge {
    filter: drop-shadow(0 0 3px rgba(103, 232, 249, 0.72));
  }

  .content-alignment-guide-x.is-edge {
    background: rgba(103, 232, 249, 0.82);
  }

  .content-alignment-guide-y.is-edge {
    background: rgba(103, 232, 249, 0.82);
  }

  .touch-adjusting .touch-active {
    filter: brightness(1.22);
    box-shadow: 0 0 0 5px rgba(34, 211, 238, 0.22), 0 5px 18px rgba(34, 211, 238, 0.32);
  }

  .result-sidebar .action-section {
    padding-right: max(12px, env(safe-area-inset-right));
    padding-left: max(12px, env(safe-area-inset-left));
  }

  .result-tool-group button,
  .result-sidebar button,
  .result-export-card summary,
  .result-export-field input[type="text"],
  .result-export-field input[type="date"],
  .result-export-field select {
    min-height: 44px;
    touch-action: manipulation;
  }

  .result-tool-group button {
    min-width: 44px;
  }

  .result-export-field input[type="text"],
  .result-export-field input[type="date"],
  .result-export-field select {
    height: 44px;
    font-size: 16px;
  }
}

@media (max-width: 899px) and (orientation: landscape) and (max-height: 520px) {
  :root {
    --mobile-bottom-bar-height: 64px;
  }

  .editor-page {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(320px, 360px);
    grid-template-rows: auto auto minmax(0, 1fr);
    gap: 8px;
    padding:
      max(6px, env(safe-area-inset-top))
      max(8px, env(safe-area-inset-right))
      max(6px, env(safe-area-inset-bottom))
      max(8px, env(safe-area-inset-left));
  }

  .editor-page > .page-header {
    grid-column: 1 / -1;
    grid-row: 1;
    min-height: 48px;
    padding-top: max(4px, env(safe-area-inset-top));
    padding-bottom: 4px;
    border: 1px solid var(--glass-border);
    border-radius: 12px;
  }

  .editor-page > .step-tabs {
    grid-column: 2;
    grid-row: 2;
    min-height: 52px;
    padding-block: 4px;
    border: 1px solid var(--glass-border);
    border-radius: 12px;
  }

  .editor-page > .canvas-container {
    grid-column: 1;
    grid-row: 2 / 4;
    max-height: none;
    min-width: 0;
    min-height: 0;
    padding: 8px;
    overflow: hidden;
    border: 1px solid var(--glass-border);
    border-radius: 14px;
  }

  .editor-page > .canvas-container .canvas-toolbar {
    min-height: 44px;
  }

  .editor-page > .control-panel {
    grid-column: 2;
    grid-row: 3;
    width: auto;
    min-height: 0;
    padding:
      8px
      8px
      calc(var(--mobile-bottom-bar-height) + env(safe-area-inset-bottom) + 10px);
    border: 1px solid var(--glass-border);
    border-radius: 14px;
  }

  .editor-page > .control-panel::before,
  .frame-tip,
  .alignment-preview-hint,
  .geometry-hint,
  #physical-size-status {
    display: none;
  }

  .edit-section {
    margin-bottom: 8px;
  }

  #panel-frame {
    display: flex;
    flex-direction: column;
  }

  #panel-frame > .edit-section { order: 1; }
  #panel-frame > .geometry-panel { order: 2; }
  #panel-frame > .alignment-snap-suggestion { order: 3; }
  #panel-frame > .alignment-preview-panel { order: 4; }
  #panel-frame > .physical-size-panel { order: 5; }
  #panel-frame > .btn-row { order: 6; }

  .edit-label {
    margin-bottom: 4px;
    font-size: 12px;
  }

  .border-width-list,
  .screen-edit-modes {
    gap: 8px;
  }

  .border-width-item,
  .screen-edit-mode-btn {
    padding-inline: 12px;
  }

  .alignment-preview-panel,
  .geometry-panel,
  .physical-size-panel {
    margin-top: 8px;
    padding: 8px;
  }

  .alignment-preview-panel {
    display: block;
  }

  .alignment-preview-body {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 6px;
  }

  .alignment-preview-header,
  .physical-size-header {
    margin-bottom: 6px;
  }

  .alignment-preview-header,
  .alignment-preview-actions {
    grid-column: 1 / -1;
  }

  .alignment-preview-header {
    margin-bottom: 0;
  }

  .alignment-preview-actions,
  .geometry-actions {
    gap: 8px;
  }

  .alignment-patterns,
  .alignment-snap-row {
    margin-top: 0;
  }

  .alignment-patterns > span {
    display: none;
  }

  .alignment-patterns button {
    flex: 1;
    min-width: 0;
    padding-inline: 6px;
  }

  .alignment-snap-row {
    gap: 0;
  }

  .alignment-snap-row > span {
    display: none;
  }

  .geometry-values {
    gap: 5px;
    margin-bottom: 6px;
  }

  .geometry-values span {
    padding: 4px;
  }

  .project-name-field {
    margin-bottom: 6px;
  }

  .physical-size-toggle {
    margin-top: 4px;
  }

  .physical-size-panel:not([open]) {
    padding-block: 4px;
  }

  .physical-size-panel:not([open]) .physical-size-header {
    min-height: 44px;
  }

  .add-content-bar {
    gap: 8px;
    margin-bottom: 8px;
  }

  .add-btn {
    min-height: 52px;
    flex-direction: row;
    justify-content: center;
    gap: 6px;
    padding: 4px 7px;
  }

  .add-icon {
    width: 32px;
    height: 32px;
    flex: 0 0 32px;
    border-radius: 8px;
  }

  .add-icon .ui-icon {
    font-size: 18px;
  }

  .add-soon {
    top: 3px;
    right: 3px;
    padding: 2px 4px;
  }

  .screen-edit-bar {
    min-height: 52px;
    margin-bottom: 8px;
    padding: 4px 8px;
  }

  .btn-row {
    right: max(8px, env(safe-area-inset-right));
    left: auto;
    width: min(360px, calc(52vw - max(16px, env(safe-area-inset-right))));
    min-height: calc(var(--mobile-bottom-bar-height) + env(safe-area-inset-bottom));
    padding:
      8px
      8px
      calc(8px + env(safe-area-inset-bottom));
    border-left: 1px solid rgba(255, 255, 255, 0.08);
  }

  #text-edit-panel,
  #image-edit-panel {
    right: max(12px, env(safe-area-inset-right));
    left: auto;
    width: min(352px, calc(52vw - 20px));
    max-height: calc(var(--mobile-viewport-height, 100dvh) - var(--mobile-bottom-bar-height) - 28px);
  }

  .btn-row .btn-secondary,
  .btn-row .btn-primary {
    height: 46px;
    min-height: 46px;
  }

  .page-result.active {
    overflow: hidden;
  }

  .result-page {
    width: 100%;
    max-width: none;
    height: 100dvh;
    min-height: 0;
    display: grid;
    grid-template-rows: 48px minmax(0, 1fr);
    gap: 8px;
    padding:
      max(6px, env(safe-area-inset-top))
      max(8px, env(safe-area-inset-right))
      max(6px, env(safe-area-inset-bottom))
      max(8px, env(safe-area-inset-left));
    overflow: hidden;
  }

  .result-page > .page-header {
    min-height: 48px;
    padding: 4px 10px;
    border: 1px solid var(--glass-border);
    border-radius: 12px;
  }

  .result-workspace {
    min-height: 0;
    grid-template-columns: minmax(0, 1fr) minmax(286px, 36vw);
    gap: 8px;
    padding-top: 0;
    overflow: hidden;
  }

  .result-proofing,
  .result-sidebar {
    min-height: 0;
    border-radius: 14px;
  }

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

  .result-proofing-head {
    min-height: 52px;
    padding: 4px 8px 4px 12px;
  }

  .result-badge {
    display: none;
  }

  .result-title {
    font-size: 15px;
  }

  .result-view-switch {
    width: auto;
    flex: 0 0 auto;
  }

  .result-view-switch button {
    min-width: 52px;
    min-height: 44px;
    padding-inline: 10px;
  }

  .result-stage {
    min-height: 0;
    height: auto;
  }

  .result-layer {
    max-height: calc(100dvh - 176px);
  }

  .result-tool-row {
    min-height: 52px;
    flex-wrap: nowrap;
    gap: 6px;
    padding: 4px 6px;
    overflow-x: auto;
    scrollbar-width: none;
  }

  .result-tool-row::-webkit-scrollbar {
    display: none;
  }

  .result-tool-hint {
    display: none;
  }

  .result-tool-group {
    flex: 0 0 auto;
  }

  .result-tool-group button {
    min-width: 44px;
    min-height: 44px;
    padding-inline: 8px;
  }

  .result-zoom-tools {
    margin-left: 0;
  }

  .result-zoom-tools output {
    min-width: 38px;
  }

  .result-sidebar {
    height: 100%;
    align-self: stretch;
    padding: 10px;
    overflow-y: auto;
    overscroll-behavior: contain;
    scrollbar-gutter: stable;
  }

  .result-delivery-overview {
    display: grid;
    grid-template-columns: minmax(0, 0.8fr) minmax(0, 1.2fr);
    gap: 8px;
    margin-bottom: 8px;
  }

  .result-summary {
    min-width: 0;
    padding: 8px;
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 10px;
    background: rgba(255, 255, 255, 0.025);
  }

  .result-summary-label {
    margin-bottom: 6px;
  }

  .result-summary strong {
    font-size: 13px;
  }

  .result-summary p,
  .result-content-count-row,
  .result-output-format-row {
    display: none;
  }

  .result-sidebar .info-section {
    min-width: 0;
    margin: 0;
  }

  .result-sidebar .info-card {
    height: 100%;
    padding: 3px 9px;
  }

  .result-sidebar .info-row {
    min-height: 34px;
  }

  .result-export-card,
  .result-ai-card {
    margin: 0 0 8px;
  }

  .result-export-card summary,
  .result-ai-card summary {
    min-height: 44px;
  }

  .result-sidebar .action-section {
    gap: 7px;
  }

  .result-sidebar .btn-save,
  .result-sidebar .btn-reward-export,
  .result-sidebar .btn-edit {
    min-height: 48px;
    height: 48px;
  }
}

@media (prefers-reduced-motion: reduce) {
  #text-edit-panel,
  #image-edit-panel {
    transition: none !important;
  }

  .mobile-inspector-gesture-coach {
    animation: none !important;
  }

  .gesture-coach-touch-one {
    display: none;
  }

  .gesture-coach-touch-left,
  .gesture-coach-touch-right {
    opacity: 1;
    animation: none !important;
    transform: translateX(var(--gesture-x));
  }
}

@media (max-width: 767px) and (orientation: portrait) {
  #text-edit-panel,
  #image-edit-panel {
    max-height: min(52dvh, calc(var(--mobile-viewport-height, 100dvh) - 176px));
  }

  .page-editor.editor-input-focused #text-edit-panel,
  .page-editor.editor-input-focused #image-edit-panel {
    max-height: min(44dvh, calc(var(--mobile-viewport-height, 100dvh) - 96px));
  }

  .page-editor.editor-input-focused .mobile-content-actions {
    display: none;
  }

  .page-editor.editor-input-focused .inspector-header button:not(.mobile-keyboard-done) {
    display: none;
  }

  .page-editor.editor-input-focused .mobile-keyboard-done {
    min-width: 88px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
  }
}

@media (max-width: 360px) {
  .mobile-content-actions > [data-content-action="duplicate"] {
    display: none;
  }
}

.mobile-content-actions .mobile-content-locate {
  border: 1px solid rgba(103, 232, 249, 0.3);
  color: #cffafe;
  background: rgba(8, 145, 178, 0.14);
}

.content-item.content-locate-pulse {
  animation: content-locate-pulse 650ms ease-out both;
}

@media (max-width: 767px), (max-width: 899px) and (orientation: landscape) and (max-height: 520px) {
  .page-editor.mobile-inspector-expanded .mobile-content-actions {
    right: max(12px, env(safe-area-inset-right));
    left: auto;
    width: 52px;
    min-height: 52px;
    padding: 2px;
    transform: none;
  }

  .page-editor.mobile-inspector-expanded .mobile-content-actions > :not(.mobile-content-locate) {
    display: none;
  }

  .page-editor.mobile-inspector-expanded .mobile-content-locate {
    width: 48px;
    min-width: 48px;
    padding: 0;
  }
}

@keyframes content-locate-pulse {
  0% { box-shadow: 0 0 0 0 rgba(103, 232, 249, 0.72); }
  45% { box-shadow: 0 0 0 9px rgba(103, 232, 249, 0.22); }
  100% { box-shadow: 0 0 0 2px rgba(103, 232, 249, 0); }
}

@media (max-width: 767px), (max-width: 899px) and (orientation: landscape) and (max-height: 520px) {
  .desktop-content-visibility {
    display: none !important;
  }

  .desktop-hidden-layer-recovery {
    display: none !important;
  }

  .mobile-content-actions .mobile-layer-menu:not([hidden]) {
    top: calc(100% + 8px);
    left: 50%;
    width: min(360px, calc(100vw - 16px));
    max-height: min(50dvh, 380px);
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding: 10px;
    overflow: hidden;
    border: 1px solid rgba(196, 181, 253, 0.34);
    border-radius: 16px;
    background: rgba(10, 11, 25, 0.98);
    transform: translateX(-50%);
  }

  .mobile-layer-header {
    min-height: 44px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding-bottom: 7px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  }

  .mobile-layer-header > div {
    min-width: 0;
    display: grid;
    gap: 2px;
    text-align: left;
  }

  .mobile-layer-header strong {
    color: #f5f3ff;
    font-size: 13px;
  }

  .mobile-layer-header span {
    color: #8f8ba2;
    font-size: 10px;
  }

  .mobile-content-actions .mobile-layer-header button {
    min-width: 56px;
    min-height: 44px;
  }

  .mobile-layer-list {
    min-height: 52px;
    max-height: 184px;
    display: grid;
    gap: 6px;
    overflow-y: auto;
    overscroll-behavior: contain;
    scrollbar-width: thin;
  }

  .mobile-layer-menu.is-renaming .mobile-layer-list {
    max-height: 92px;
  }

  .mobile-content-actions .mobile-layer-item {
    width: 100%;
    min-width: 0;
    min-height: 52px;
    display: grid;
    grid-template-columns: minmax(0, 1fr) 44px;
    align-items: center;
    gap: 8px;
    padding: 0 4px 0 0;
    border: 1px solid rgba(255, 255, 255, 0.075);
    border-radius: 9px;
    text-align: left;
  }

  .mobile-content-actions .mobile-layer-menu .mobile-layer-select {
    width: 100%;
    min-width: 0;
    min-height: 52px;
    display: grid;
    grid-template-columns: 36px minmax(0, 1fr) auto;
    align-items: center;
    gap: 9px;
    padding: 5px 4px 5px 8px;
    border: 0;
    background: transparent;
    text-align: left;
  }

  .mobile-content-actions .mobile-layer-menu .mobile-layer-visibility {
    width: 44px;
    min-width: 44px;
    height: 44px;
    min-height: 44px;
    padding: 0;
    display: grid;
    place-items: center;
    color: #a5f3fc;
    background: rgba(8, 145, 178, 0.13);
  }

  .mobile-layer-visibility svg {
    width: 19px;
    height: 19px;
    fill: none;
    stroke: currentColor;
    stroke-width: 1.8;
    stroke-linecap: round;
    stroke-linejoin: round;
  }

  .mobile-content-actions .mobile-layer-item.active {
    border-color: rgba(103, 232, 249, 0.55);
    background: rgba(8, 145, 178, 0.14);
    box-shadow: inset 3px 0 0 #22d3ee;
  }

  .mobile-content-actions .mobile-layer-item.is-hidden {
    border-style: dashed;
  }

  .mobile-content-actions .mobile-layer-item.is-hidden .mobile-layer-select {
    opacity: 0.58;
  }

  .mobile-content-actions .mobile-layer-item.is-hidden .mobile-layer-visibility {
    color: #c4b5fd;
    background: rgba(124, 58, 237, 0.18);
  }

  .mobile-content-actions .mobile-layer-item.is-hidden .mobile-layer-type {
    filter: grayscale(1);
  }

  .mobile-layer-type {
    width: 34px;
    height: 34px;
    display: grid;
    place-items: center;
    border-radius: 9px;
    color: #ddd6fe;
    background: rgba(124, 58, 237, 0.22);
    font-size: 12px;
    font-weight: 750;
  }

  .mobile-content-actions .mobile-layer-type.is-image-preview {
    overflow: hidden;
    padding: 0;
    border: 1px solid rgba(103, 232, 249, 0.28);
    background: #090b14;
  }

  .mobile-content-actions .mobile-layer-thumbnail {
    width: 100%;
    height: 100%;
    display: block;
    object-fit: cover;
    pointer-events: none;
  }

  .mobile-content-actions .mobile-layer-type.is-text-preview {
    font-size: 13px;
  }

  .mobile-layer-copy {
    min-width: 0;
    display: grid;
    gap: 2px;
  }

  .mobile-layer-copy strong,
  .mobile-layer-copy small {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .mobile-layer-copy strong {
    color: #f5f3ff;
    font-size: 12px;
  }

  .mobile-layer-copy small,
  .mobile-layer-order {
    color: #918da4;
    font-size: 9px;
  }

  .mobile-layer-order {
    white-space: nowrap;
  }

  .mobile-layer-actions {
    display: grid;
    grid-template-columns: repeat(5, minmax(0, 1fr));
    gap: 6px;
  }

  .mobile-content-actions .mobile-layer-actions button {
    min-width: 0;
    min-height: 44px;
    padding: 0 3px;
    font-size: 10px;
  }

  .mobile-content-actions .mobile-layer-actions .mobile-layer-delete {
    color: #fecdd3;
    background: rgba(225, 29, 72, 0.14);
  }

  .mobile-layer-rename-form:not([hidden]) {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 52px 52px;
    align-items: end;
    gap: 6px;
    padding: 8px;
    border: 1px solid rgba(103, 232, 249, 0.28);
    border-radius: 11px;
    background: rgba(8, 47, 73, 0.42);
  }

  .mobile-layer-rename-form label {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
  }

  .mobile-layer-rename-form input {
    width: 100%;
    min-width: 0;
    min-height: 44px;
    padding: 0 10px;
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: 8px;
    outline: none;
    color: #fff;
    background: rgba(255, 255, 255, 0.07);
    font-size: 16px;
  }

  .mobile-layer-rename-form input:focus {
    border-color: #67e8f9;
    box-shadow: 0 0 0 3px rgba(34, 211, 238, 0.14);
  }

  .mobile-content-actions .mobile-layer-rename-form button {
    min-width: 52px;
    min-height: 44px;
    padding: 0 5px;
  }
}

/* ===== Tablet canvas toolbar ===== */
.canvas-toolbar-status {
  min-width: 0;
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 10px;
}

.canvas-toolbar-status .editor-save-status,
.canvas-toolbar-status .editor-history-actions {
  margin-left: 0;
}

@media (min-width: 641px) and (max-width: 1023px) {
  .canvas-toolbar {
    min-height: 50px;
    gap: 10px;
    padding: 2px 5px 2px 10px;
  }

  .canvas-toolbar-title {
    flex: 1 1 auto;
  }

  .canvas-toolbar-title span,
  .canvas-toolbar .editor-history-state,
  .canvas-toolbar .editor-history-actions kbd {
    display: none;
  }

  .canvas-toolbar-status {
    flex: 0 0 auto;
    gap: 8px;
  }

  .canvas-toolbar .editor-save-status {
    min-width: 92px;
    max-width: 112px;
    min-height: 30px;
    padding-inline: 8px;
    overflow: hidden;
  }

  .canvas-toolbar .editor-save-status span {
    overflow: hidden;
    text-overflow: ellipsis;
  }

  .canvas-toolbar .editor-history-actions {
    gap: 6px;
    padding-left: 8px;
  }

  .canvas-toolbar .editor-history-actions button {
    min-width: 64px;
    height: 44px;
    padding-inline: 8px;
  }
}

/* ===== Tablet editor workspace ===== */
@media (min-width: 768px) and (max-width: 1023px) and (min-height: 521px) {
  .page-editor.active {
    overflow-x: hidden;
    overflow-y: auto;
    overscroll-behavior-y: contain;
  }

  .editor-page {
    width: 100%;
    height: auto;
    min-height: 100dvh;
  }

  .editor-page > .canvas-container {
    min-height: clamp(430px, 56dvh, 650px);
    padding: 16px;
  }

  .editor-page > .control-panel {
    width: calc(100% - 32px);
    max-width: none;
    min-height: 0;
    margin: 0 16px 24px;
    padding: 18px;
    flex: 0 0 auto;
    overflow: visible;
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-xl);
  }

  .editor-page > .control-panel::before {
    display: none;
  }

  #panel-frame {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    grid-template-areas:
      "tip tip"
      "mode mode"
      "preview geometry"
      "snap snap"
      "size size"
      "actions actions";
    align-items: start;
    gap: 12px 14px;
  }

  #panel-frame > .frame-tip {
    grid-area: tip;
    padding: 2px 0 4px;
  }

  #panel-frame > .edit-section {
    grid-area: mode;
    margin: 0;
  }

  #panel-frame > .alignment-preview-panel {
    grid-area: preview;
  }

  #panel-frame > .geometry-panel {
    grid-area: geometry;
  }

  #panel-frame > .alignment-snap-suggestion {
    grid-area: snap;
  }

  #panel-frame > .physical-size-panel {
    grid-area: size;
  }

  #panel-frame > .btn-row {
    grid-area: actions;
    margin-top: 0;
  }

  #panel-frame > .alignment-preview-panel,
  #panel-frame > .geometry-panel,
  #panel-frame > .physical-size-panel {
    min-width: 0;
    margin-top: 0;
  }

  #panel-content {
    width: 100%;
    max-width: 760px;
    margin-inline: auto;
  }

  .tablet-content-overview {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    align-items: start;
    gap: 14px;
    margin-bottom: 14px;
  }

  .tablet-content-column {
    min-width: 0;
    display: grid;
    align-content: start;
    gap: 12px;
  }

  .tablet-content-column > .add-content-bar,
  .tablet-content-column > .screen-edit-bar,
  .tablet-content-column > .desktop-layer-panel,
  .tablet-content-column > .screen-settings-details {
    margin: 0;
  }

  .tablet-content-settings .screen-settings-details {
    padding: 0 12px 10px;
    overflow: hidden;
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 14px;
    background: rgba(16, 16, 32, 0.52);
  }

  .tablet-content-settings .screen-settings-summary {
    min-height: 46px;
    display: flex;
    align-items: center;
    gap: 8px;
    margin: 0 -12px 8px;
    padding: 0 12px;
    color: var(--type-heading);
    cursor: pointer;
    list-style: none;
  }

  .tablet-content-settings .screen-settings-summary::-webkit-details-marker {
    display: none;
  }

  .tablet-content-settings .screen-settings-summary span {
    margin-left: auto;
    color: var(--type-caption);
    font-size: 10px;
  }

  .tablet-content-settings .screen-settings-summary::after {
    content: '⌄';
    color: #9f8aca;
    transition: transform 180ms ease;
  }

  .tablet-content-settings .screen-settings-details[open] > .screen-settings-summary::after {
    transform: rotate(180deg);
  }

  .tablet-content-settings .screen-settings-details:not([open]) {
    padding-bottom: 0;
  }

  .tablet-content-settings .screen-settings-details:not([open]) > .screen-settings-summary {
    margin-bottom: 0;
  }

  .tablet-content-settings .screen-settings-details .edit-section:last-child {
    margin-bottom: 0;
  }

  .page-editor.active #panel-frame,
  .page-editor.active #panel-content {
    padding-bottom: 86px;
  }

  .page-editor.active #panel-frame > .btn-row,
  .page-editor.active #panel-content > .btn-row {
    position: fixed;
    left: 50%;
    right: auto;
    bottom: max(12px, env(safe-area-inset-bottom));
    z-index: 880;
    width: min(760px, calc(100% - 32px));
    min-height: 68px;
    margin: 0;
    padding: 8px;
    box-sizing: border-box;
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 16px;
    background: rgba(12, 12, 25, 0.92);
    box-shadow: 0 16px 42px rgba(0, 0, 0, 0.42), inset 0 1px 0 rgba(255, 255, 255, 0.07);
    -webkit-backdrop-filter: blur(20px) saturate(125%);
    backdrop-filter: blur(20px) saturate(125%);
    opacity: 1;
    visibility: visible;
    transform: translateX(-50%);
    transition: opacity 160ms ease, transform 180ms ease, visibility 0s linear;
  }

  .page-editor.active.editor-input-focused #panel-frame > .btn-row,
  .page-editor.active.editor-input-focused #panel-content > .btn-row {
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transform: translate(-50%, calc(100% + 24px));
    transition: opacity 140ms ease, transform 180ms ease, visibility 0s linear 180ms;
  }

  .page-editor.active .btn-row .btn-secondary,
  .page-editor.active .btn-row .btn-primary {
    height: 50px;
    min-height: 50px;
  }

  .page-editor.active .btn-row .btn-primary {
    flex: 1.8;
  }
}

@media (min-width: 768px) and (max-width: 1023px) {
  .page-editor .tablet-keyboard-toolbar {
    display: grid;
  }
}

@media (min-width: 768px) and (max-width: 1023px) and (min-height: 521px) and (prefers-reduced-motion: reduce) {
  .page-editor.active #panel-frame > .btn-row,
  .page-editor.active #panel-content > .btn-row,
  .page-editor .tablet-keyboard-toolbar {
    transition: none;
  }
}

.tablet-content-overview,
.tablet-content-column {
  min-width: 0;
}


.led-toast {
  position: fixed; left: 50%; bottom: 32px; transform: translateX(-50%);
  background: rgba(20,22,30,.95); color: #fff; padding: 10px 18px; border-radius: 10px;
  font-size: 14px; z-index: 9999; box-shadow: 0 10px 30px rgba(0,0,0,.4);
  opacity: 1; transition: opacity .4s; pointer-events: none;
}
.led-toast-success { background: rgba(20,90,40,.96); }
.led-toast-error { background: rgba(120,30,30,.96); }
