    *, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

    :root {
      --bg: #faf9f7;
      --bg-card: #ffffff;
      --text: #1a1a1a;
      --text-muted: #6b6b6b;
      --accent: #c9a961;
      --accent-hover: #b8944d;
      --border: #e8e6e3;
      --border-hover: #d4d1cc;
      --error: #b91c1c;
      --warning: #d97706;
    }

    body {
      font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
      background: var(--bg);
      color: var(--text);
      line-height: 1.6;
      min-height: 100vh;
    }

    .container {
      max-width: 900px;
      margin: 0 auto;
      padding: 48px 24px 80px;
    }

    header {
      text-align: center;
      margin-bottom: 48px;
    }

    h1 {
      font-family: 'Playfair Display', Georgia, serif;
      font-size: clamp(1.75rem, 4vw, 2.5rem);
      font-weight: 500;
      letter-spacing: -0.02em;
      margin-bottom: 8px;
    }

    .tagline {
      color: var(--text-muted);
      font-size: 0.95rem;
      font-weight: 300;
    }

    /* Upload Sections */
    .upload-grid {
      display: grid;
      grid-template-columns: 1fr 1fr;
      gap: 20px;
      margin-bottom: 24px;
    }

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

    .upload-zone {
      background: var(--bg-card);
      border: 2px dashed var(--border);
      border-radius: 12px;
      padding: 32px 20px;
      text-align: center;
      cursor: pointer;
      transition: all 0.2s ease;
      position: relative;
    }

    .upload-zone:hover { border-color: var(--border-hover); background: #fefefe; }
    .upload-zone.dragover { border-color: var(--accent); background: #fffdf8; }
    .upload-zone.has-files { border-style: solid; border-color: var(--accent); }

    .upload-zone input[type="file"] {
      position: absolute;
      inset: 0;
      opacity: 0;
      cursor: pointer;
    }

    .upload-icon {
      width: 40px;
      height: 40px;
      margin: 0 auto 12px;
      opacity: 0.4;
    }

    .upload-label {
      font-family: 'Playfair Display', serif;
      font-size: 1rem;
      font-weight: 500;
      margin-bottom: 4px;
    }

    .upload-hint {
      font-size: 0.8rem;
      color: var(--text-muted);
    }

    .upload-preview {
      display: flex;
      flex-wrap: wrap;
      gap: 8px;
      justify-content: center;
      margin-top: 12px;
    }

    .upload-preview img {
      width: 56px;
      height: 56px;
      object-fit: cover;
      border-radius: 6px;
      border: 1px solid var(--border);
    }

    /* Ref Modes */
    .ref-modes {
      display: none;
      justify-content: center;
      gap: 16px;
      margin-bottom: 24px;
      flex-wrap: wrap;
    }

    .ref-modes.visible { display: flex; }

    .ref-mode-label {
      display: flex;
      align-items: center;
      gap: 6px;
      font-size: 0.9rem;
      cursor: pointer;
      padding: 8px 12px;
      background: var(--bg-card);
      border: 1px solid var(--border);
      border-radius: 6px;
      transition: all 0.2s;
    }

    .ref-mode-label:hover { border-color: var(--border-hover); }
    .ref-mode-label input { accent-color: var(--accent); }
    .ref-mode-label.checked { border-color: var(--accent); background: #fffdf8; }

    /* Prompt Section */
    .prompt-section { margin-bottom: 24px; }

    .prompt-wrapper { position: relative; }

    .prompt-textarea {
      width: 100%;
      padding: 16px 20px;
      font-size: 1rem;
      font-family: 'Inter', sans-serif;
      border: 2px solid var(--border);
      border-radius: 12px;
      background: var(--bg-card);
      resize: vertical;
      min-height: 80px;
      transition: all 0.2s ease;
    }

    .prompt-textarea:focus { outline: none; border-color: var(--accent); }
    .prompt-textarea::placeholder { color: var(--text-muted); }

    .prompt-warning {
      display: none;
      font-size: 0.8rem;
      color: var(--warning);
      margin-top: 6px;
      text-align: right;
    }

    .prompt-warning.visible { display: block; }

    .prompt-counter {
      position: absolute;
      bottom: 8px;
      right: 12px;
      font-size: 0.75rem;
      color: var(--text-muted);
    }

    .enhanced-badge {
      position: absolute;
      top: 10px;
      right: 12px;
      padding: 3px 10px;
      font-size: 0.7rem;
      font-weight: 500;
      letter-spacing: 0.04em;
      text-transform: uppercase;
      color: #fff;
      background: var(--accent);
      border-radius: 12px;
    }

    .prompt-actions {
      display: flex;
      align-items: center;
      gap: 12px;
      margin-top: 8px;
    }

    .enhance-btn {
      padding: 8px 16px;
      font-family: 'Inter', sans-serif;
      font-size: 0.85rem;
      font-weight: 500;
      color: var(--text);
      background: var(--bg-card);
      border: 1px solid var(--accent);
      border-radius: 8px;
      cursor: pointer;
      transition: all 0.2s ease;
    }

    .enhance-btn:hover:not(:disabled) {
      background: var(--accent);
      color: #fff;
    }

    .enhance-btn:disabled {
      opacity: 0.4;
      cursor: not-allowed;
    }

    .enhance-hint {
      font-size: 0.78rem;
      color: var(--text-muted);
      font-style: italic;
    }

    /* Example Chips */
    .example-chips {
      display: flex;
      gap: 8px;
      flex-wrap: wrap;
      margin-top: 12px;
    }

    .chip {
      padding: 6px 12px;
      font-size: 0.8rem;
      background: var(--bg-card);
      border: 1px solid var(--border);
      border-radius: 16px;
      cursor: pointer;
      transition: all 0.2s;
    }

    .chip:hover { border-color: var(--accent); background: #fffdf8; }

    .prompt-hint {
      font-size: 0.78rem;
      color: var(--text-muted);
      margin-top: 8px;
      line-height: 1.5;
      font-style: italic;
    }

    .editorial-chips-wrap {
      margin-top: 16px;
      padding-top: 14px;
      border-top: 1px dashed var(--border);
    }

    .editorial-chips-label {
      font-size: 0.72rem;
      text-transform: uppercase;
      letter-spacing: 0.08em;
      color: var(--text-muted);
      margin-bottom: 8px;
    }

    .editorial-chips {
      display: flex;
      gap: 8px;
      flex-wrap: wrap;
    }

    .editorial-chip {
      padding: 6px 12px;
      font-size: 0.8rem;
      background: transparent;
      border: 1px solid var(--border);
      border-radius: 16px;
      cursor: pointer;
      transition: all 0.2s;
      color: var(--text-muted);
    }

    .editorial-chip:hover { border-color: var(--accent); color: var(--text); background: #fffdf8; }
    .editorial-chip.active { border-color: var(--accent); color: var(--text); background: #fffdf8; }

    /* Generate Button */
    .generate-btn {
      display: block;
      width: 100%;
      max-width: 280px;
      margin: 0 auto 48px;
      padding: 16px 28px;
      font-family: 'Inter', sans-serif;
      font-size: 0.95rem;
      font-weight: 500;
      letter-spacing: 0.04em;
      text-transform: uppercase;
      color: #fff;
      background: var(--text);
      border: none;
      border-radius: 8px;
      cursor: pointer;
      transition: all 0.2s ease;
    }

    .generate-btn:hover:not(:disabled) { background: #333; transform: translateY(-1px); }
    .generate-btn:disabled { opacity: 0.4; cursor: not-allowed; }

    /* Results Section */
    .results-section { margin-bottom: 32px; }

    .results-header {
      font-family: 'Playfair Display', serif;
      font-size: 1.25rem;
      text-align: center;
      margin-bottom: 24px;
    }

    .gallery {
      display: grid;
      grid-template-columns: 1fr 1fr;
      gap: 16px;
    }

    @media (max-width: 560px) {
      .gallery { grid-template-columns: 1fr; gap: 12px; }
    }

    .gallery-item {
      position: relative;
      aspect-ratio: 3/4;
      background: var(--bg-card);
      border-radius: 12px;
      overflow: hidden;
      border: 1px solid var(--border);
    }

    .gallery-item img {
      width: 100%;
      height: 100%;
      object-fit: cover;
    }

    .gallery-item.loading {
      background: linear-gradient(90deg, #f0efed 25%, #faf9f7 50%, #f0efed 75%);
      background-size: 200% 100%;
      animation: shimmer 1.5s infinite;
    }

    @keyframes shimmer {
      0% { background-position: 200% 0; }
      100% { background-position: -200% 0; }
    }

    .placeholder {
      position: absolute;
      inset: 0;
      display: flex;
      flex-direction: column;
      align-items: center;
      justify-content: center;
      color: var(--text-muted);
    }

    .placeholder-icon {
      width: 48px;
      height: 48px;
      opacity: 0.3;
      margin-bottom: 8px;
    }

    /* Image Actions */
    .img-actions {
      position: absolute;
      bottom: 12px;
      left: 12px;
      right: 12px;
      display: flex;
      gap: 8px;
      opacity: 0;
      transition: opacity 0.2s;
    }

    .gallery-item:hover .img-actions { opacity: 1; }

    .img-btn {
      flex: 1;
      padding: 10px 14px;
      font-size: 0.85rem;
      font-weight: 500;
      color: var(--text);
      background: rgba(255, 255, 255, 0.95);
      border: none;
      border-radius: 6px;
      cursor: pointer;
      transition: background 0.2s;
    }

    .img-btn:hover { background: #fff; }

    /* Inline Edit */
    .inline-edit {
      display: none;
      position: absolute;
      bottom: 0;
      left: 0;
      right: 0;
      background: rgba(255, 255, 255, 0.98);
      padding: 12px;
      border-top: 1px solid var(--border);
    }

    .inline-edit.active { display: block; }

    .inline-edit input {
      width: 100%;
      padding: 10px 12px;
      font-size: 0.9rem;
      border: 1px solid var(--border);
      border-radius: 6px;
      margin-bottom: 8px;
    }

    .inline-edit input:focus { outline: none; border-color: var(--accent); }

    .inline-edit-btns {
      display: flex;
      gap: 8px;
    }

    .inline-edit-btns button {
      flex: 1;
      padding: 8px;
      font-size: 0.85rem;
      border-radius: 6px;
      cursor: pointer;
      border: none;
    }

    .btn-cancel { background: #eee; }
    .btn-apply { background: var(--text); color: #fff; }

    /* Regenerate Button */
    .regenerate-btn {
      display: none;
      width: 100%;
      max-width: 200px;
      margin: 20px auto 0;
      padding: 12px 20px;
      font-size: 0.9rem;
      font-weight: 500;
      color: var(--text);
      background: var(--bg-card);
      border: 1px solid var(--border);
      border-radius: 8px;
      cursor: pointer;
      transition: all 0.2s;
    }

    .regenerate-btn:hover { border-color: var(--accent); }
    .regenerate-btn.visible { display: block; }

    /* Status */
    .status {
      text-align: center;
      font-size: 0.9rem;
      color: var(--text-muted);
      margin-top: 16px;
      min-height: 24px;
    }

    /* Toast */
    .toast {
      position: fixed;
      bottom: 24px;
      left: 50%;
      transform: translateX(-50%) translateY(100px);
      background: var(--text);
      color: #fff;
      padding: 12px 24px;
      border-radius: 8px;
      font-size: 0.9rem;
      opacity: 0;
      transition: all 0.3s ease;
      z-index: 1000;
    }

    .toast.visible { transform: translateX(-50%) translateY(0); opacity: 1; }
    .toast.error { background: var(--error); }

    .hidden { display: none !important; }

    /* Score Badges */
    .score-badges {
      position: absolute;
      top: 12px;
      right: 12px;
      display: flex;
      gap: 6px;
      z-index: 10;
    }

    .badge {
      padding: 4px 8px;
      font-size: 0.75rem;
      font-weight: 600;
      background: rgba(0, 0, 0, 0.6);
      color: #fff;
      border-radius: 12px;
      backdrop-filter: blur(4px);
    }

    /* Hero Button */
    .btn-hero {
      background: var(--accent);
      color: #fff;
    }
    .btn-hero:hover {
      background: var(--accent-hover);
    }
