:root {
  --bg-dark: #090d16;
  --panel-bg: rgba(17, 24, 39, 0.75);
  --card-bg: rgba(30, 41, 59, 0.5);
  --border-color: rgba(255, 255, 255, 0.08);
  --border-focus: #38bdf8;
  --accent-primary: #6366f1;
  --accent-cyan: #38bdf8;
  --accent-purple: #a855f7;
  --text-main: #f8fafc;
  --text-muted: #94a3b8;
  --radius-lg: 16px;
  --radius-md: 10px;
}

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

body {
  background-color: var(--bg-dark);
  color: var(--text-main);
  font-family: 'Outfit', -apple-system, sans-serif;
  min-height: 100vh;
  overflow-x: hidden;
}

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

/* Header */
.app-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px 28px;
  background: var(--panel-bg);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border-color);
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
}

.brand-icon {
  font-size: 28px;
  background: rgba(99, 102, 241, 0.15);
  padding: 8px;
  border-radius: 12px;
  border: 1px solid rgba(99, 102, 241, 0.3);
}

.brand h1 {
  font-size: 20px;
  font-weight: 800;
  letter-spacing: -0.5px;
}

.brand h1 span {
  background: linear-gradient(135deg, var(--accent-cyan), var(--accent-purple));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.brand-tag {
  font-size: 11px;
  font-family: 'JetBrains Mono', monospace;
  color: var(--text-muted);
  letter-spacing: 1px;
}

.header-right {
  display: flex;
  align-items: center;
  gap: 16px;
}

.partner-selector-box {
  display: flex;
  align-items: center;
  gap: 8px;
  background: rgba(15, 23, 42, 0.8);
  border: 1px solid var(--border-color);
  padding: 4px 8px;
  border-radius: var(--radius-md);
}

.partner-selector-box select {
  background: transparent;
  border: none;
  color: var(--text-main);
  font-size: 13px;
  font-weight: 600;
  padding: 4px 8px;
  width: auto;
  outline: none;
  cursor: pointer;
}

.key-input-wrapper {
  display: flex;
  align-items: center;
  gap: 6px;
  background: rgba(0, 0, 0, 0.4);
  padding: 4px 10px;
  border-radius: 6px;
  border: 1px solid rgba(255, 255, 255, 0.05);
}

.key-icon {
  font-size: 12px;
}

.key-input-wrapper input {
  background: transparent;
  border: none;
  color: var(--text-main);
  font-family: 'JetBrains Mono', monospace;
  font-size: 12px;
  width: 180px;
  outline: none;
}

.pin-badge {
  display: flex;
  align-items: center;
  gap: 8px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border-color);
  padding: 6px 12px;
  border-radius: 9999px;
}

.pin-badge .dot {
  width: 8px;
  height: 8px;
  background: #10b981;
  border-radius: 50%;
  box-shadow: 0 0 8px #10b981;
}

.pin-badge input {
  background: transparent;
  border: none;
  color: var(--text-main);
  font-family: 'JetBrains Mono', monospace;
  width: 60px;
  outline: none;
  font-size: 14px;
}

/* Studio Grid */
.studio-grid {
  display: grid;
  grid-template-columns: 480px 1fr;
  flex: 1;
  height: calc(100vh - 75px);
  overflow: hidden;
}

/* Control Panel */
.control-panel {
  padding: 24px;
  background: var(--panel-bg);
  border-right: 1px solid var(--border-color);
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.card {
  background: var(--card-bg);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 20px;
}

.card-header {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 16px;
}

.step-num {
  width: 24px;
  height: 24px;
  background: var(--accent-primary);
  color: white;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  font-weight: 800;
}

.card-header h2 {
  font-size: 16px;
  font-weight: 700;
}

/* Template Selector */
.template-selector {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
}

.template-card {
  background: rgba(15, 23, 42, 0.6);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 12px;
  cursor: pointer;
  transition: all 0.2s ease;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.template-card:hover {
  border-color: var(--accent-cyan);
  transform: translateY(-2px);
}

.template-card.active {
  border-color: var(--accent-cyan);
  background: rgba(56, 189, 248, 0.1);
  box-shadow: 0 0 16px rgba(56, 189, 248, 0.2);
}

.template-title {
  font-size: 13px;
  font-weight: 700;
}

.template-ratio {
  font-size: 11px;
  color: var(--text-muted);
  font-family: 'JetBrains Mono', monospace;
}

/* Form Styles */
.form-group {
  margin-bottom: 14px;
}

.form-group label {
  display: block;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-muted);
  margin-bottom: 6px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

input[type="text"], textarea, select {
  width: 100%;
  background: rgba(15, 23, 42, 0.8);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  color: var(--text-main);
  padding: 10px 14px;
  font-family: inherit;
  font-size: 14px;
  transition: border-color 0.2s;
  outline: none;
}

input[type="text"]:focus, textarea:focus, select:focus {
  border-color: var(--border-focus);
}

.form-row {
  display: flex;
  gap: 12px;
}

.form-row .half {
  flex: 1;
}

/* AI Magic Box */
.ai-box {
  background: linear-gradient(135deg, rgba(99, 102, 241, 0.1), rgba(168, 85, 247, 0.1));
  border: 1px dashed rgba(168, 85, 247, 0.4);
  border-radius: var(--radius-md);
  padding: 12px;
  margin-bottom: 16px;
}

.ai-box label {
  font-size: 12px;
  font-weight: 700;
  color: #c084fc;
  display: block;
  margin-bottom: 8px;
}

.ai-input-group {
  display: flex;
  gap: 8px;
}

.btn-magic {
  background: linear-gradient(135deg, #6366f1, #a855f7);
  color: white;
  border: none;
  padding: 0 16px;
  border-radius: var(--radius-md);
  font-weight: 700;
  font-size: 13px;
  cursor: pointer;
  transition: opacity 0.2s;
  white-space: nowrap;
}

.btn-magic:hover {
  opacity: 0.9;
}

/* Action Buttons */
.btn-primary {
  width: 100%;
  background: linear-gradient(135deg, #0284c7, #2563eb);
  color: white;
  border: none;
  padding: 16px;
  border-radius: var(--radius-md);
  font-size: 15px;
  font-weight: 800;
  letter-spacing: 0.5px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  transition: all 0.2s ease;
  box-shadow: 0 4px 20px rgba(37, 99, 235, 0.3);
}

.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 24px rgba(37, 99, 235, 0.5);
}

.btn-primary:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none;
}

/* Progress Box */
.progress-box {
  margin-top: 16px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.progress-bar-bg {
  width: 100%;
  height: 8px;
  background: rgba(255, 255, 255, 0.1);
  border-radius: 9999px;
  overflow: hidden;
}

.progress-bar-fill {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, #38bdf8, #6366f1);
  transition: width 0.4s ease;
}

.progress-status {
  display: flex;
  justify-content: space-between;
  font-size: 12px;
  color: var(--text-muted);
}

/* Download Box */
.download-box {
  margin-top: 16px;
}

.btn-download {
  display: block;
  text-align: center;
  background: #10b981;
  color: white;
  text-decoration: none;
  font-weight: 800;
  padding: 14px;
  border-radius: var(--radius-md);
  font-size: 14px;
  box-shadow: 0 4px 16px rgba(16, 185, 129, 0.3);
  transition: transform 0.2s;
}

.btn-download:hover {
  transform: translateY(-2px);
}

.hidden {
  display: none !important;
}

/* Preview Panel */
.preview-panel {
  display: flex;
  flex-direction: column;
  background: #06090e;
  overflow: hidden;
}

.preview-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 14px 24px;
  border-bottom: 1px solid var(--border-color);
  background: rgba(15, 23, 42, 0.4);
}

.preview-title {
  font-size: 13px;
  font-weight: 800;
  display: flex;
  align-items: center;
  gap: 8px;
}

.live-dot {
  width: 8px;
  height: 8px;
  background: #ef4444;
  border-radius: 50%;
  animation: blink 1.5s infinite;
}

@keyframes blink {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.3; }
}

.aspect-badge {
  font-family: 'JetBrains Mono', monospace;
  font-size: 12px;
  color: var(--text-muted);
  background: rgba(255, 255, 255, 0.05);
  padding: 4px 10px;
  border-radius: 6px;
}

.btn-refresh {
  background: transparent;
  border: 1px solid var(--border-color);
  color: var(--text-muted);
  padding: 6px 12px;
  border-radius: var(--radius-md);
  cursor: pointer;
  font-size: 12px;
}

.btn-refresh:hover {
  color: var(--text-main);
  border-color: var(--text-muted);
}

.preview-viewport-container {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  overflow: hidden;
}

.preview-frame-wrapper {
  background: #000000;
  border-radius: 12px;
  border: 2px solid rgba(255, 255, 255, 0.15);
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.8);
  overflow: hidden;
  position: relative;
  transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

.preview-frame-wrapper iframe {
  border: none;
  width: 100%;
  height: 100%;
}

/* Neural Card Styles */
.neural-card {
  border-color: rgba(168, 85, 247, 0.3);
  background: linear-gradient(180deg, rgba(30, 41, 59, 0.7) 0%, rgba(20, 15, 38, 0.7) 100%);
}

.badge-optional {
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 1px;
  background: rgba(168, 85, 247, 0.2);
  color: #c084fc;
  padding: 4px 8px;
  border-radius: 6px;
  margin-left: auto;
}

.btn-neural {
  width: 100%;
  background: linear-gradient(135deg, #7c3aed, #a855f7);
  color: white;
  border: none;
  padding: 14px;
  border-radius: var(--radius-md);
  font-size: 14px;
  font-weight: 800;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  box-shadow: 0 4px 16px rgba(168, 85, 247, 0.3);
  transition: all 0.2s ease;
}

.btn-neural:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(168, 85, 247, 0.5);
}

.btn-neural:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none;
}

.active-bg-box {
  margin-top: 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: rgba(16, 185, 129, 0.1);
  border: 1px solid rgba(16, 185, 129, 0.3);
  padding: 10px 14px;
  border-radius: var(--radius-md);
}

.active-bg-info {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  font-weight: 700;
  color: #34d399;
}

.video-dot {
  width: 8px;
  height: 8px;
  background: #34d399;
  border-radius: 50%;
  box-shadow: 0 0 8px #34d399;
}

.btn-remove-bg {
  background: transparent;
  border: 1px solid rgba(239, 68, 68, 0.4);
  color: #f87171;
  font-size: 11px;
  font-weight: 700;
  padding: 4px 8px;
  border-radius: 6px;
  cursor: pointer;
}

/* Photo Card & Presets Styles */
.photo-card {
  border-color: rgba(56, 189, 248, 0.3);
  background: linear-gradient(180deg, rgba(15, 23, 42, 0.8) 0%, rgba(9, 13, 22, 0.8) 100%);
}

.photo-presets-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
  margin-bottom: 14px;
}

.photo-preset-item {
  background: rgba(15, 23, 42, 0.7);
  border: 2px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 6px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.photo-preset-item img {
  width: 100%;
  height: 64px;
  object-fit: cover;
  border-radius: 6px;
}

.photo-preset-item span {
  font-size: 11px;
  font-weight: 700;
  color: var(--text-muted);
}

.photo-preset-item:hover {
  border-color: var(--accent-cyan);
  transform: translateY(-2px);
}

.photo-preset-item.active {
  border-color: var(--accent-cyan);
  background: rgba(56, 189, 248, 0.15);
  box-shadow: 0 0 16px rgba(56, 189, 248, 0.3);
}

.photo-preset-item.active span {
  color: #ffffff;
}

.photo-upload-zone {
  margin-bottom: 16px;
}

.file-input-hidden {
  display: none;
}

.btn-upload {
  width: 100%;
  background: rgba(255, 255, 255, 0.05);
  border: 1px dashed var(--border-color);
  color: var(--text-main);
  padding: 10px;
  border-radius: var(--radius-md);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
}

.btn-upload:hover {
  border-color: var(--accent-cyan);
  background: rgba(56, 189, 248, 0.08);
}

/* Anim Mode Selector */
.anim-mode-box {
  background: rgba(0, 0, 0, 0.3);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 12px;
  margin-bottom: 14px;
}

.anim-mode-title {
  font-size: 12px;
  font-weight: 700;
  color: var(--text-muted);
  margin-bottom: 10px;
  text-transform: uppercase;
}

.anim-mode-options {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.anim-mode-radio {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 10px;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: all 0.2s;
}

.anim-mode-radio:hover {
  background: rgba(255, 255, 255, 0.03);
}

.anim-mode-radio.active {
  border-color: var(--accent-cyan);
  background: rgba(56, 189, 248, 0.1);
}

.anim-mode-radio strong {
  display: block;
  font-size: 13px;
  color: #ffffff;
}

.anim-mode-radio p {
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 2px;
}

.neural-prompt-box {
  margin-bottom: 14px;
  padding: 12px;
  background: rgba(168, 85, 247, 0.08);
  border: 1px dashed rgba(168, 85, 247, 0.3);
  border-radius: var(--radius-md);
}

/* Security Auth Gate Modal */
.auth-gate-overlay {
  position: fixed;
  inset: 0;
  background: rgba(4, 7, 13, 0.92);
  backdrop-filter: blur(20px);
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}

.auth-gate-card {
  background: #0d131f;
  border: 1px solid rgba(255, 255, 255, 0.15);
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.9);
  border-radius: 20px;
  padding: 36px 32px;
  max-width: 440px;
  width: 100%;
  text-align: center;
  animation: modalScale 0.3s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

@keyframes modalScale {
  from { opacity: 0; transform: scale(0.92); }
  to { opacity: 1; transform: scale(1); }
}

.auth-gate-icon {
  font-size: 44px;
  margin-bottom: 16px;
}

.auth-gate-card h2 {
  font-size: 22px;
  font-weight: 800;
  margin-bottom: 10px;
  color: #ffffff;
}

.auth-gate-card p {
  font-size: 14px;
  color: var(--text-muted);
  line-height: 1.5;
  margin-bottom: 24px;
}

.auth-gate-actions {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.btn-gate-primary {
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, #0284c7, #2563eb);
  color: white;
  text-decoration: none;
  font-weight: 800;
  font-size: 15px;
  padding: 14px;
  border-radius: var(--radius-md);
  box-shadow: 0 4px 16px rgba(37, 99, 235, 0.4);
  transition: transform 0.2s;
}

.btn-gate-primary:hover {
  transform: translateY(-2px);
}

.gate-divider {
  display: flex;
  align-items: center;
  text-align: center;
  color: #64748b;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 1px;
  margin: 6px 0;
}

.gate-divider::before, .gate-divider::after {
  content: '';
  flex: 1;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.gate-divider span {
  padding: 0 10px;
}

.gate-pin-row {
  display: flex;
  gap: 8px;
}

.gate-pin-row input {
  flex: 1;
  background: rgba(15, 23, 42, 0.8);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  color: white;
  padding: 10px 14px;
  font-size: 14px;
  outline: none;
}

.btn-gate-unlock {
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.2);
  color: white;
  padding: 0 16px;
  border-radius: var(--radius-md);
  font-weight: 700;
  font-size: 13px;
  cursor: pointer;
  transition: background 0.2s;
}

.btn-gate-unlock:hover {
  background: rgba(255, 255, 255, 0.2);
}


