/* ===== Arts Studio v2 - Skywork.ai Inspired ===== */

:root {
  --bg-primary: #0d0d14;
  --bg-secondary: #13131d;
  --bg-tertiary: #1a1a28;
  --bg-surface: #1e1e2e;
  --bg-elevated: #252536;
  --border: #2a2a3e;
  --border-light: #353548;
  --text-primary: #e4e4e7;
  --text-secondary: #a1a1aa;
  --text-muted: #71717a;
  --text-dim: #52525b;
  --accent: #7c3aed;
  --accent-hover: #6d28d9;
  --accent-light: rgba(124, 58, 237, 0.15);
  --accent-gradient: linear-gradient(135deg, #7c3aed, #3b82f6);
  --success: #10b981;
  --success-bg: rgba(16, 185, 129, 0.12);
  --warning: #f59e0b;
  --warning-bg: rgba(245, 158, 11, 0.12);
  --error: #ef4444;
  --error-bg: rgba(239, 68, 68, 0.12);
  --gold: #e5a411;
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 14px;
  --radius-xl: 20px;
  --transition: all 0.2s ease;
}

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

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', sans-serif;
  background: var(--bg-primary);
  color: var(--text-primary);
  min-height: 100vh;
}

/* ===== Layout ===== */
.studio { display: flex; flex-direction: column; min-height: 100vh; }

/* ===== Header ===== */
.header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 24px; height: 56px; background: var(--bg-secondary);
  border-bottom: 1px solid var(--border); flex-shrink: 0; z-index: 100;
  position: sticky; top: 0;
}
.header-left { display: flex; align-items: center; }
.header-right { display: flex; align-items: center; margin-left: auto; }
.logo { display: flex; align-items: center; }
.site-title { font-size: 18px; font-weight: 600; color: var(--text-primary); margin-left: 10px; }
.header-actions { display: flex; gap: 8px; align-items: center; }
.header-btn {
  display: flex; align-items: center; gap: 6px; padding: 6px 12px;
  background: var(--bg-tertiary); border: 1px solid var(--border);
  border-radius: var(--radius-sm); color: var(--text-muted); font-size: 12px;
  cursor: pointer; transition: var(--transition);
}
.header-btn:hover { border-color: var(--accent); color: var(--accent); }
.header-btn svg { width: 16px; height: 16px; }

/* ===== Page Content ===== */
.page-content {
  flex: 1; overflow-y: auto; padding: 0 24px 60px;
  max-width: 960px; margin: 0 auto; width: 100%;
}

/* ===== Hero ===== */
.hero-section { text-align: center; padding: 20px 0 12px; }
.hero-tagline { font-size: 14px; color: var(--text-muted); }
.hero-tagline em { font-style: normal; background: var(--accent-gradient); -webkit-background-clip: text; -webkit-text-fill-color: transparent; background-clip: text; font-weight: 600; }

/* ===== Prompt Box ===== */
.prompt-section {
  position: sticky; top: 56px; z-index: 50;
  background: var(--bg-primary); padding-bottom: 16px;
  border-bottom: 1px solid var(--border); margin-bottom: 24px;
}
.prompt-box {
  display: flex; align-items: flex-start; gap: 12px;
  background: var(--bg-tertiary); border: 1px solid var(--border);
  border-radius: var(--radius-lg); padding: 14px 16px;
  transition: border-color 0.2s;
}
.prompt-box:focus-within { border-color: var(--accent); }
.prompt-box textarea {
  flex: 1; background: none; border: none; outline: none;
  color: var(--text-primary); font-size: 15px; font-family: inherit;
  resize: none; line-height: 1.5; min-height: 44px;
}
.prompt-box textarea::placeholder { color: var(--text-dim); }

.prompt-ref { display: flex; align-items: center; gap: 8px; flex-shrink: 0; }
.prompt-upload-btn {
  width: 40px; height: 40px; display: flex; align-items: center; justify-content: center;
  background: var(--bg-elevated); border: 1px solid var(--border); border-radius: var(--radius-md);
  color: var(--text-muted); cursor: pointer; transition: var(--transition);
}
.prompt-upload-btn:hover { border-color: var(--accent); color: var(--accent); }
.prompt-upload-btn svg { width: 20px; height: 20px; }

.prompt-ref-preview { position: relative; }
.prompt-ref-preview.hidden { display: none; }
.prompt-ref-preview img { width: 40px; height: 40px; border-radius: var(--radius-sm); object-fit: cover; border: 1px solid var(--border); }
.prompt-ref-remove {
  position: absolute; top: -6px; right: -6px; width: 18px; height: 18px;
  background: var(--error); color: #fff; border: none; border-radius: 50%;
  font-size: 12px; line-height: 1; cursor: pointer; display: flex;
  align-items: center; justify-content: center;
}

/* Safety Badge (inline in prompt box) */
.safety-badge {
  display: none; align-items: center; gap: 5px; padding: 4px 10px;
  border-radius: var(--radius-xl); font-size: 11px; font-weight: 600;
  cursor: pointer; transition: var(--transition); flex-shrink: 0;
  white-space: nowrap; border: 1px solid transparent;
}
.safety-badge.visible { display: inline-flex; }
.safety-badge.checking { color: var(--accent); background: var(--accent-light); border-color: rgba(124,58,237,0.2); }
.safety-badge.safe { color: var(--success); background: var(--success-bg); border-color: rgba(16,185,129,0.2); }
.safety-badge.warning { color: var(--warning); background: var(--warning-bg); border-color: rgba(245,158,11,0.2); }
.safety-badge.danger { color: var(--error); background: var(--error-bg); border-color: rgba(239,68,68,0.2); }
.safety-badge .badge-spinner {
  width: 12px; height: 12px; border: 2px solid var(--accent-light);
  border-top-color: var(--accent); border-radius: 50%;
  animation: spin 0.8s linear infinite;
}
.safety-badge svg { width: 14px; height: 14px; }
.safety-badge:hover { opacity: 0.85; }

/* Prompt Controls */
.prompt-controls {
  display: flex; align-items: center; gap: 12px; margin-top: 10px;
  padding: 0 4px;
}
.mode-btns { display: flex; gap: 4px; }
.mode-select {
  padding: 0 12px; height: 40px; background: var(--bg-tertiary); border: 1px solid var(--border);
  border-radius: var(--radius-sm); color: var(--text-primary); font-size: 13px;
  cursor: pointer; font-weight: 500; flex-shrink: 0; appearance: auto;
}
.mode-select:hover { border-color: var(--border-light); }
.mode-select:focus { border-color: var(--accent); outline: none; }

/* Style Picks (hot style images) - inline row */
.style-picks {
  display: flex; align-items: center; gap: 8px; flex: 1; min-width: 0; height: 40px;
}
.style-picks-label {
  font-size: 11px; color: var(--text-muted); white-space: nowrap; flex-shrink: 0;
}
.style-picks-scroll {
  display: flex; gap: 6px; overflow-x: auto; padding: 2px 0;
  scrollbar-width: thin; scrollbar-color: var(--border) transparent;
  align-items: center;
}
.style-picks-scroll::-webkit-scrollbar { height: 4px; }
.style-picks-scroll::-webkit-scrollbar-thumb { background: var(--border); border-radius: 2px; }
.style-pick-item {
  width: 34px; height: 34px; border-radius: var(--radius-sm); overflow: hidden;
  border: 2px solid transparent; cursor: pointer; transition: var(--transition);
  flex-shrink: 0; background: var(--bg-tertiary);
}
.style-pick-item:hover { border-color: var(--border-light); transform: scale(1.08); }
.style-pick-item.selected { border-color: var(--accent); box-shadow: 0 0 0 2px var(--accent-light); }
.style-pick-item img { width: 100%; height: 100%; object-fit: cover; }
.style-pick-item.preset { position: relative; width: 48px; height: 48px; }
.style-pick-item.preset .preset-label {
  position: absolute; bottom: 0; left: 0; right: 0; font-size: 8px; text-align: center;
  background: rgba(0,0,0,0.6); color: #fff; padding: 1px 2px; line-height: 1.2;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}

.generate-btn {
  display: flex; align-items: center; gap: 8px; padding: 10px 24px;
  background: var(--accent-gradient); color: #fff; border: none;
  border-radius: var(--radius-md); font-size: 14px; font-weight: 600;
  cursor: pointer; transition: var(--transition); margin-left: auto;
}
.generate-btn:hover { opacity: 0.9; }
.generate-btn:disabled { opacity: 0.4; cursor: not-allowed; }
.generate-btn svg { width: 16px; height: 16px; }

/* Design Button (next to Generate) */
.design-btn {
  display: flex; align-items: center; gap: 6px; padding: 10px 18px;
  background: var(--bg-elevated); border: 1px solid var(--border);
  border-radius: var(--radius-md); font-size: 13px; font-weight: 600;
  color: var(--text-secondary); cursor: pointer; transition: var(--transition);
  white-space: nowrap;
}
.design-btn:hover { border-color: var(--accent); color: var(--accent); }
.design-btn:disabled { opacity: 0.4; cursor: not-allowed; }
.design-btn img { height: 16px; width: auto; }

/* Prompt Dropzone */
.prompt-dropzone {
  border: 2px dashed var(--border-light); border-radius: var(--radius-md);
  padding: 24px; text-align: center; cursor: pointer; margin-top: 12px;
  transition: var(--transition); background: var(--bg-tertiary);
}
.prompt-dropzone:hover, .prompt-dropzone.dragging { border-color: var(--accent); background: var(--accent-light); }
.prompt-dropzone.hidden { display: none; }
.prompt-dropzone svg { width: 32px; height: 32px; margin: 0 auto 8px; color: var(--text-dim); }
.prompt-dropzone p { font-size: 13px; color: var(--text-secondary); margin-bottom: 4px; }
.prompt-dropzone strong { color: var(--accent); }
.prompt-dropzone small { font-size: 11px; color: var(--text-dim); }
/* ===== Result Area ===== */
.result-area { margin-bottom: 32px; }
.result-area.hidden { display: none; }
.result-container {
  background: var(--bg-tertiary); border: 1px solid var(--border);
  border-radius: var(--radius-lg); overflow: hidden;
}
.result-preview {
  position: relative; display: flex; align-items: center; justify-content: center;
  min-height: 200px; max-height: 500px; background: var(--bg-surface);
}
.result-preview.checkerboard {
  background-image:
    linear-gradient(45deg, #1a1a28 25%, transparent 25%),
    linear-gradient(-45deg, #1a1a28 25%, transparent 25%),
    linear-gradient(45deg, transparent 75%, #1a1a28 75%),
    linear-gradient(-45deg, transparent 75%, #1a1a28 75%);
  background-size: 20px 20px;
  background-position: 0 0, 0 10px, 10px -10px, -10px 0;
  background-color: var(--bg-surface);
}
.result-image {
  max-width: 100%; max-height: 500px; width: auto; height: auto;
  object-fit: contain; display: block; margin: auto;
}
.result-actions {
  display: flex; align-items: center; justify-content: space-between;
  padding: 12px 16px; border-top: 1px solid var(--border); flex-wrap: wrap; gap: 8px;
}
.result-info { display: flex; align-items: center; gap: 12px; font-size: 12px; color: var(--text-muted); }
.result-info .filename { font-weight: 500; color: var(--text-secondary); max-width: 200px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.result-info .dimensions { color: var(--text-secondary); }
.result-status { color: var(--success); }
.result-status.error { color: var(--error); }
.result-buttons { display: flex; gap: 8px; align-items: center; }

/* ===== Style Prompt Bar ===== */
.style-prompt-bar {
  display: flex; align-items: center; gap: 8px;
  padding: 10px 16px; background: var(--accent-light);
  border-bottom: 1px solid var(--border); font-size: 13px;
}
.style-prompt-bar.hidden { display: none; }
.style-prompt-label { color: var(--accent); font-weight: 600; white-space: nowrap; }
.style-prompt-text { color: var(--text-secondary); line-height: 1.4; overflow: hidden; text-overflow: ellipsis; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }

/* ===== Before/After Comparison ===== */
.result-comparison {
  display: grid; grid-template-columns: 1fr 1fr; gap: 2px;
  background: var(--border); min-height: 200px;
}
.result-comparison.hidden { display: none; }
.comparison-panel {
  position: relative; display: flex; align-items: center; justify-content: center;
  background: var(--bg-surface); min-height: 200px; max-height: 500px; overflow: hidden;
}
.comparison-label {
  position: absolute; top: 10px; left: 10px; z-index: 2;
  padding: 3px 10px; border-radius: var(--radius-sm);
  font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.5px;
  background: rgba(0,0,0,0.6); color: var(--text-secondary);
}
#afterPanel .comparison-label { background: var(--accent); color: #fff; }
.comparison-image {
  max-width: 100%; max-height: 500px; width: auto; height: auto;
  object-fit: contain; display: block; margin: auto;
}

/* ===== Gallery Modal ===== */
.gallery-modal {
  position: fixed; top: 0; left: 0; right: 0; bottom: 0;
  display: flex; align-items: center; justify-content: center;
  z-index: 1000; padding: 20px;
}
.gallery-modal.hidden { display: none; }
.gallery-modal-overlay {
  position: absolute; top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(0, 0, 0, 0.5); cursor: pointer;
}
.gallery-modal-content {
  position: relative; background: var(--bg-primary); border-radius: var(--radius-lg);
  width: 100%; max-width: 1000px; max-height: 90vh;
  display: flex; flex-direction: column; box-shadow: 0 20px 60px rgba(0,0,0,0.3);
}
.gallery-modal-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 20px; border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}
.gallery-modal-actions {
  display: flex; align-items: center; gap: 16px;
}
.gallery-modal-close {
  width: 32px; height: 32px; border: none; background: transparent;
  font-size: 24px; color: var(--text-muted); cursor: pointer;
  border-radius: var(--radius-sm); transition: var(--transition);
}
.gallery-modal-close:hover { background: var(--bg-tertiary); color: var(--text-primary); }
.gallery-modal-body {
  flex: 1; overflow-y: auto; padding: 20px;
}

/* Gallery grid inside modal */
.gallery-modal .gallery-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 12px; padding: 0;
}

/* Gallery items (favorites-* classes for compat with gallery.js) */
.favorites-item {
  aspect-ratio: 1; cursor: pointer; border: 2px solid transparent;
  border-radius: var(--radius-md); overflow: hidden; transition: var(--transition);
  background: var(--bg-tertiary); position: relative;
}
.favorites-item:hover { border-color: var(--border-light); transform: scale(1.02); }
.favorites-item:hover .favorites-item-actions { opacity: 1; }
.favorites-item.selected { border-color: var(--accent); box-shadow: 0 0 0 2px var(--accent-light); }
.favorites-item.reference { border-color: var(--gold); box-shadow: 0 0 0 2px rgba(229,164,17,0.2); }
.favorites-item img { width: 100%; height: 100%; object-fit: cover; }

/* Image action buttons */
.favorites-item-actions {
  position: absolute; bottom: 0; left: 0; right: 0;
  display: flex; gap: 4px; padding: 8px;
  background: linear-gradient(to top, rgba(0,0,0,0.8), transparent);
  opacity: 0; transition: opacity 0.2s ease;
}
.action-btn {
  flex: 1; padding: 6px 4px; background: rgba(255,255,255,0.9); border: none;
  border-radius: 4px; cursor: pointer; font-size: 11px; font-weight: 500;
  display: flex; flex-direction: column; align-items: center; gap: 2px;
  color: #1f2937; transition: all 0.2s ease;
}
.action-btn:hover { background: #fff; transform: scale(1.05); }
.action-btn svg { width: 14px; height: 14px; }
.action-btn span { line-height: 1; }

/* Compliance badge overlay on gallery thumbnails */
.compliance-overlay {
  position: absolute; top: 6px; right: 6px; width: 22px; height: 22px;
  background: rgba(16, 185, 129, 0.9); border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  box-shadow: 0 1px 4px rgba(0,0,0,0.3); pointer-events: none;
}
.compliance-overlay svg { width: 13px; height: 13px; color: #fff; }

.favorites-empty { grid-column: 1 / -1; text-align: center; padding: 40px 20px; color: var(--text-dim); font-size: 12px; }
.favorites-empty svg { width: 48px; height: 48px; margin: 0 auto 12px; opacity: 0.3; }
.favorites-more { grid-column: 1 / -1; text-align: center; padding: 8px; }
.favorites-more button {
  padding: 8px 20px; background: var(--bg-elevated); border: 1px solid var(--border);
  border-radius: var(--radius-sm); font-size: 12px; color: var(--text-secondary); cursor: pointer;
}
.favorites-more button:hover { border-color: var(--accent); color: var(--accent); }
/* ===== Buttons ===== */
.btn {
  padding: 8px 14px; border: none; border-radius: var(--radius-sm);
  font-size: 13px; font-weight: 500; cursor: pointer; transition: var(--transition);
}
.btn:active { transform: scale(0.98); }
.btn-primary { background: var(--accent); color: #fff; }
.btn-primary:hover { background: var(--accent-hover); }
.btn-primary:disabled { opacity: 0.5; cursor: not-allowed; }
.btn-secondary { background: var(--bg-elevated); color: var(--text-secondary); }
.btn-secondary:hover { background: var(--border); }
.btn-sm { padding: 6px 10px; font-size: 12px; }

.btn-use-image {
  background: var(--success); color: #fff; padding: 8px 16px; border: none;
  border-radius: var(--radius-sm); font-size: 13px; font-weight: 600;
  cursor: pointer; display: flex; align-items: center; gap: 6px; transition: var(--transition);
}
.btn-use-image:hover { background: #059669; }
.btn-use-image.hidden { display: none; }
.btn-use-image svg { width: 16px; height: 16px; }

.btn-collect-save {
  background: var(--success); color: #fff; padding: 8px 16px; border: none;
  border-radius: var(--radius-sm); font-weight: 500; cursor: pointer;
  display: flex; align-items: center; gap: 8px;
}
.btn-collect-save.hidden { display: none; }

.btn-designer {
  background: var(--accent-gradient); color: #fff; padding: 8px 14px; border: none;
  border-radius: var(--radius-md); font-size: 12px; font-weight: 600;
  cursor: pointer; display: flex; align-items: center; gap: 6px; transition: var(--transition);
}
.btn-designer:hover { opacity: 0.9; }
.btn-designer:disabled { opacity: 0.4; cursor: not-allowed; }

/* ===== Upload Queue ===== */
.queue {
  position: fixed; bottom: 80px; right: 24px; width: 320px;
  background: var(--bg-secondary); border: 1px solid var(--border);
  border-radius: var(--radius-lg); padding: 12px; z-index: 50;
  box-shadow: 0 8px 24px rgba(0,0,0,0.4);
}
.queue.hidden { display: none; }
.queue-item {
  display: flex; align-items: center; gap: 10px; padding: 8px;
  background: var(--bg-tertiary); border-radius: var(--radius-sm); margin-bottom: 6px;
}
.queue-item:last-child { margin-bottom: 0; }
.queue-preview { width: 40px; height: 40px; border-radius: 4px; object-fit: cover; background: var(--bg-elevated); }
.queue-info { flex: 1; min-width: 0; }
.queue-name { font-size: 12px; font-weight: 500; color: var(--text-primary); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.queue-progress-row { display: flex; align-items: center; gap: 8px; margin-top: 4px; }
.queue-progress { flex: 1; height: 3px; background: var(--bg-elevated); border-radius: 2px; overflow: hidden; }
.queue-progress-bar { height: 100%; background: var(--accent); transition: width 0.2s; }
.queue-clear-btn { padding: 2px 6px; font-size: 10px; background: var(--bg-elevated); border: none; border-radius: 4px; color: var(--text-muted); cursor: pointer; }
.queue-status { font-size: 10px; font-weight: 500; padding: 2px 6px; border-radius: 8px; }
.queue-status.uploading { color: var(--accent); background: var(--accent-light); }
.queue-status.success { color: var(--success); background: var(--success-bg); }
.queue-status.error { color: var(--error); background: var(--error-bg); }
.queue-status.pending { color: var(--text-dim); background: var(--bg-elevated); }

/* ===== Processing Overlay ===== */
.processing {
  position: absolute; inset: 0; display: none; flex-direction: column;
  align-items: center; justify-content: center;
  background: rgba(13, 13, 20, 0.85); backdrop-filter: blur(4px);
  border-radius: var(--radius-lg); z-index: 10;
}
.processing.active { display: flex; }
.spinner {
  width: 36px; height: 36px; border: 3px solid var(--border);
  border-top-color: var(--accent); border-radius: 50%;
  animation: spin 0.8s linear infinite; margin-bottom: 12px;
}
@keyframes spin { to { transform: rotate(360deg); } }
.processing p { font-size: 13px; color: var(--text-secondary); }

/* ===== Toast ===== */
.toast {
  position: fixed; bottom: 24px; left: 50%;
  transform: translateX(-50%) translateY(100px);
  padding: 10px 20px; background: var(--bg-elevated);
  color: var(--text-primary); border-radius: var(--radius-md);
  font-size: 13px; z-index: 100000; opacity: 0;
  border: 1px solid var(--border); backdrop-filter: blur(12px);
  transition: transform 0.3s, opacity 0.3s;
}
.toast.show { transform: translateX(-50%) translateY(0); opacity: 1; }
.toast.success { background: var(--success); border-color: var(--success); color: #fff; }
.toast.error { background: var(--error); border-color: var(--error); color: #fff; }
/* ===== Auth ===== */
.auth-user { display: flex; align-items: center; gap: 8px; }
.auth-email { font-size: 12px; color: var(--text-muted); max-width: 150px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ===== Login Modal ===== */
.login-modal { position: fixed; inset: 0; z-index: 10000; display: flex; align-items: center; justify-content: center; }
.login-modal.hidden { display: none; }
.modal-overlay { position: absolute; inset: 0; background: rgba(0,0,0,0.6); backdrop-filter: blur(4px); }
.modal-content {
  position: relative; background: var(--bg-secondary); border: 1px solid var(--border);
  border-radius: var(--radius-lg); width: 90%; max-width: 400px;
  box-shadow: 0 20px 40px rgba(0,0,0,0.4);
}
.modal-header { display: flex; align-items: center; justify-content: space-between; padding: 16px 20px; border-bottom: 1px solid var(--border); }
.modal-header h3 { font-size: 16px; font-weight: 600; color: var(--text-primary); }
.modal-close { background: none; border: none; font-size: 24px; color: var(--text-muted); cursor: pointer; line-height: 1; }
.modal-close:hover { color: var(--text-secondary); }
.modal-body { padding: 20px; }
.modal-info { font-size: 13px; color: var(--text-muted); margin-bottom: 16px; text-align: center; }
.form-group { margin-bottom: 16px; }
.form-group label { display: block; font-size: 12px; font-weight: 500; color: var(--text-secondary); margin-bottom: 6px; }
.form-group input {
  width: 100%; padding: 10px 12px; border: 1px solid var(--border);
  border-radius: var(--radius-sm); font-size: 14px; outline: none;
  background: var(--bg-tertiary); color: var(--text-primary);
}
.form-group input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-light); }
.form-group small { display: block; font-size: 11px; color: var(--text-dim); margin-top: 4px; }
.form-actions { display: flex; gap: 8px; margin-top: 20px; }
.form-actions .btn { flex: 1; }

/* ===== Content Safety Modal ===== */
.cs-modal { position: fixed; inset: 0; z-index: 10000; display: flex; align-items: center; justify-content: center; }
.cs-modal.hidden { display: none; }
.cs-modal-overlay { position: absolute; inset: 0; background: rgba(0,0,0,0.6); backdrop-filter: blur(4px); }
.cs-modal-content {
  position: relative; background: var(--bg-secondary); border: 1px solid var(--border);
  border-radius: var(--radius-lg); width: 90%; max-width: 560px;
  max-height: 85vh; overflow-y: auto; box-shadow: 0 20px 40px rgba(0,0,0,0.4);
}
.cs-modal-header { display: flex; align-items: center; justify-content: space-between; padding: 16px 20px; border-bottom: 1px solid var(--border); }
.cs-modal-header h3 { font-size: 16px; font-weight: 600; color: var(--text-primary); }
.cs-modal-body { padding: 24px; }

.cs-upload-panel { text-align: center; }
.cs-dropzone {
  border: 2px dashed var(--border-light); border-radius: var(--radius-lg);
  padding: 32px 24px; cursor: pointer; transition: var(--transition);
  background: var(--bg-tertiary); margin-bottom: 16px;
}
.cs-dropzone:hover { border-color: var(--accent); background: var(--accent-light); }
.cs-dropzone svg { width: 40px; height: 40px; margin: 0 auto 12px; color: var(--text-dim); }
.cs-detect-btn {
  width: 100%; padding: 12px; background: var(--accent-gradient); color: #fff;
  border: none; border-radius: var(--radius-md); font-size: 14px; font-weight: 600;
  cursor: pointer; transition: var(--transition); display: flex; align-items: center;
  justify-content: center; gap: 8px;
}
.cs-detect-btn:hover { opacity: 0.9; }
.cs-detect-btn:disabled { opacity: 0.5; cursor: not-allowed; }

.cs-results-panel { margin-top: 24px; }
.cs-results-panel.hidden { display: none; }
.cs-score-circle {
  width: 100px; height: 100px; border-radius: 50%; display: flex;
  flex-direction: column; align-items: center; justify-content: center;
  margin: 0 auto 20px; font-weight: 700;
}
.cs-score-circle .score-value { font-size: 32px; line-height: 1; }
.cs-score-circle .score-label { font-size: 10px; opacity: 0.8; margin-top: 4px; }
.cs-score-circle.safe { background: var(--success-bg); color: var(--success); border: 2px solid rgba(16,185,129,0.3); }
.cs-score-circle.warning { background: var(--warning-bg); color: var(--warning); border: 2px solid rgba(245,158,11,0.3); }
.cs-score-circle.danger { background: var(--error-bg); color: var(--error); border: 2px solid rgba(239,68,68,0.3); }
.cs-badge {
  display: inline-flex; align-items: center; gap: 6px; padding: 6px 16px;
  border-radius: var(--radius-xl); font-size: 13px; font-weight: 600; margin-bottom: 20px;
}
.cs-badge.safe { background: var(--success-bg); color: var(--success); }
.cs-badge.warning { background: var(--warning-bg); color: var(--warning); }
.cs-badge.danger { background: var(--error-bg); color: var(--error); }
.cs-tags { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 20px; justify-content: center; }
.cs-tag { padding: 4px 12px; background: var(--accent-light); color: var(--accent); border-radius: var(--radius-xl); font-size: 13px; }
.cs-points { display: flex; flex-direction: column; gap: 8px; text-align: left; }
.cs-point {
  display: flex; justify-content: space-between; align-items: center;
  padding: 10px 14px; border-radius: var(--radius-md); font-size: 13px;
}
.cs-point.pass { background: var(--success-bg); color: var(--success); }
.cs-point.fail { background: var(--error-bg); color: var(--error); }

/* CS Scanning Animation */
.cs-scan-steps { display: flex; flex-direction: column; gap: 8px; margin-bottom: 20px; }
.cs-scan-step {
  display: flex; align-items: center; gap: 10px; padding: 10px 14px;
  border-radius: var(--radius-md); font-size: 13px; color: var(--text-muted);
  background: var(--bg-tertiary); opacity: 0; transform: translateY(8px);
  transition: opacity 0.3s, transform 0.3s;
}
.cs-scan-step.visible { opacity: 1; transform: translateY(0); }
.cs-scan-step.checking { color: var(--accent); }
.cs-scan-step.checking .scan-icon { animation: pulse-glow 1.2s ease-in-out infinite; }
.cs-scan-step.pass { color: var(--success); background: var(--success-bg); }
.cs-scan-step.fail { color: var(--error); background: var(--error-bg); }
.cs-scan-step .scan-icon { width: 18px; height: 18px; flex-shrink: 0; display: flex; align-items: center; justify-content: center; }
.cs-scan-step .scan-label { flex: 1; }
.cs-scan-step .scan-result { font-weight: 600; font-size: 12px; }
@keyframes pulse-glow {
  0%, 100% { opacity: 0.5; }
  50% { opacity: 1; }
}
.cs-score-fade { animation: fade-in-up 0.5s ease forwards; }
@keyframes fade-in-up {
  from { opacity: 0; transform: translateY(12px); }
  to { opacity: 1; transform: translateY(0); }
}

/* ===== URL Input ===== */
.url-section { margin-top: 12px; }
.url-row { display: flex; gap: 6px; }
.url-input {
  flex: 1; padding: 8px 10px; border: 1px solid var(--border);
  border-radius: var(--radius-sm); font-size: 12px; outline: none;
  background: var(--bg-tertiary); color: var(--text-primary);
}
.url-input:focus { border-color: var(--accent); }
.url-input::placeholder { color: var(--text-dim); }

/* ===== Tags ===== */
.tag { padding: 3px 8px; background: var(--bg-elevated); border-radius: 4px; font-size: 11px; color: var(--text-secondary); }

/* ===== Scrollbar ===== */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--border-light); }

/* ===== Designer Iframe Modal - 21:9 Widescreen ===== */
.designer-modal {
  position: fixed; inset: 0; z-index: 10000;
  background: rgba(0, 0, 0, 0.85);
  backdrop-filter: blur(8px);
  display: flex; align-items: center; justify-content: center;
  padding: 20px;
  opacity: 0; transition: opacity 0.25s ease;
}
.designer-modal.show { opacity: 1; }

.designer-modal-container {
  position: relative;
  width: min(95vw, calc(90vh * 21 / 9));
  height: min(90vh, calc(95vw * 9 / 21));
  display: flex; flex-direction: column;
  background: #1a1a2e;
  overflow: hidden;
  border-radius: 12px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
  transform: scale(0.98);
  transition: transform 0.25s ease;
}
.designer-modal.show .designer-modal-container {
  transform: scale(1);
}

.designer-modal-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 12px; height: 36px; flex-shrink: 0;
  background: #1a1a2e;
  border-bottom: 1px solid rgba(255,255,255,0.08);
}
.designer-modal-title {
  font-size: 12px; font-weight: 500; color: rgba(255,255,255,0.6);
  display: flex; align-items: center; gap: 8px;
}
.designer-modal-title img { height: 16px; width: auto; }

.designer-modal-close {
  width: 28px; height: 28px; border: none; border-radius: 4px;
  background: transparent; color: rgba(255,255,255,0.5); font-size: 18px;
  cursor: pointer; display: flex; align-items: center; justify-content: center;
  transition: all 0.15s ease;
}
.designer-modal-close:hover {
  background: rgba(255,255,255,0.1); color: #fff;
}

.designer-modal iframe {
  flex: 1; width: 100%; border: none; background: #0d0d14;
}

/* ===== Utility ===== */
.hidden { display: none !important; }
.file-input { display: none; }
