:root {
  --bg: #0c0d14;
  --surface: #151722;
  --surface-hover: #1c1e2d;
  --surface-active: #23263a;
  --line: #26283b;
  --text: #f4f4f8;
  --muted: #9597ab;
  --accent: #7c65ff;
  --accent-hover: #6a52f0;
  --accent-light: rgba(124, 101, 255, 0.12);
  --accent-gradient: linear-gradient(135deg, #7c65ff 0%, #a855f7 100%);
  --success: #10b981;
  --danger: #ef4444;
  --note: #292418;
  --font-sans: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  color-scheme: dark;
}

@media (prefers-color-scheme: light) {
  :root {
    --bg: #f8f9fc;
    --surface: #ffffff;
    --surface-hover: #f1f3f9;
    --surface-active: #e7eaf3;
    --line: #e2e4ed;
    --text: #161720;
    --muted: #64677d;
    --accent: #604be8;
    --accent-hover: #5039d9;
    --accent-light: rgba(96, 75, 232, 0.08);
    --accent-gradient: linear-gradient(135deg, #604be8 0%, #9333ea 100%);
    --note: #fff8e6;
    color-scheme: light;
  }
}

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

body {
  background: var(--bg);
  color: var(--text);
  font: 16px/1.55 var(--font-sans);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* Base elements (shared with legal pages) */
a {
  color: var(--accent);
  text-decoration: none;
}
a:hover {
  text-decoration: underline;
}

h1 {
  font-size: 26px;
  font-weight: 700;
  line-height: 1.25;
  margin: 12px 0 6px;
}

h2 {
  font-size: 20px;
  font-weight: 600;
  margin: 20px 0 10px;
}

h3 {
  font-size: 16px;
  font-weight: 600;
  margin: 12px 0 6px;
}

p {
  margin: 8px 0;
}

.muted, .meta {
  color: var(--muted);
  font-size: 14px;
}

.draft {
  padding: 10px 14px;
  border-radius: 8px;
  background: var(--note);
  margin-bottom: 16px;
}

li {
  margin: 4px 0;
}

.cta {
  display: inline-block;
  margin: 16px 0;
  padding: 12px 20px;
  border-radius: 10px;
  background: var(--accent);
  color: #fff;
  font-weight: 600;
  text-decoration: none;
}

/* App Container Layout */
.app-container {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  max-width: 540px;
  margin: 0 auto;
  width: 100%;
}

/* App Header */
.app-header {
  padding: 14px 16px;
  border-bottom: 1px solid var(--line);
  background: var(--bg);
  position: sticky;
  top: 0;
  z-index: 100;
  backdrop-filter: blur(10px);
}

.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.brand {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 700;
  font-size: 19px;
  color: var(--text);
  text-decoration: none;
}
.brand:hover {
  text-decoration: none;
}

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

.tg-link {
  font-size: 13px;
  padding: 6px 12px;
  border-radius: 20px;
  background: var(--surface);
  border: 1px solid var(--line);
  color: var(--muted);
  font-weight: 500;
}
.tg-link:hover {
  color: var(--text);
  text-decoration: none;
  border-color: var(--accent);
}

/* App Main */
.app-main {
  flex: 1;
  padding: 16px 16px 48px;
}

.screen {
  animation: fadeIn 0.25s ease-out;
}

.hidden {
  display: none !important;
}

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

/* Hero */
.hero-text {
  text-align: center;
  margin-bottom: 24px;
}

.hero-text h1 {
  font-size: 26px;
  letter-spacing: -0.02em;
}

.subtitle {
  color: var(--muted);
  font-size: 15px;
  margin-top: 4px;
}

/* Form Sections */
.section-block {
  margin-bottom: 20px;
}

.block-label {
  display: block;
  font-size: 14px;
  font-weight: 600;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 10px;
}

.optional-tag, .photo-count {
  font-weight: 400;
  text-transform: none;
}

/* Package Selection Cards */
.package-cards {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.package-card {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 16px;
  border-radius: 14px;
  background: var(--surface);
  border: 1.5px solid var(--line);
  color: var(--text);
  cursor: pointer;
  text-align: left;
  transition: all 0.2s ease;
  font-family: inherit;
  width: 100%;
}

.package-card:hover {
  background: var(--surface-hover);
  border-color: rgba(124, 101, 255, 0.4);
}

.package-card.active {
  border-color: var(--accent);
  background: var(--surface-active);
  box-shadow: 0 0 0 1px var(--accent);
}

.pkg-icon {
  font-size: 24px;
  flex-shrink: 0;
}

.pkg-info {
  flex: 1;
  display: flex;
  flex-direction: column;
}

.pkg-title {
  font-weight: 600;
  font-size: 15px;
}

.pkg-desc {
  font-size: 12px;
  color: var(--muted);
  margin-top: 2px;
}

.pkg-price {
  font-weight: 700;
  font-size: 16px;
  color: var(--accent);
  flex-shrink: 0;
}

/* Photo Upload Box */
.upload-dropzone {
  border: 2px dashed var(--line);
  border-radius: 14px;
  background: var(--surface);
  text-align: center;
  padding: 24px 16px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.upload-dropzone:hover, .upload-dropzone.dragover {
  border-color: var(--accent);
  background: var(--accent-light);
}

.upload-trigger {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  cursor: pointer;
}

.upload-icon {
  font-size: 32px;
}

.upload-text {
  font-size: 15px;
}

.upload-hint {
  font-size: 13px;
  color: var(--muted);
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  border: 0;
}

/* Thumbnails Grid */
.thumbnails-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  margin-top: 12px;
}

.thumb-item {
  position: relative;
  aspect-ratio: 1;
  border-radius: 10px;
  overflow: hidden;
  background: var(--surface);
  border: 1px solid var(--line);
}

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

.thumb-remove {
  position: absolute;
  top: 4px;
  right: 4px;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.7);
  color: #fff;
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 700;
  transition: background 0.15s ease;
}
.thumb-remove:hover {
  background: var(--danger);
}

/* Prompt Input & Chips */
.text-input {
  width: 100%;
  padding: 12px 14px;
  border-radius: 12px;
  background: var(--surface);
  border: 1px solid var(--line);
  color: var(--text);
  font: inherit;
  font-size: 14px;
  transition: border-color 0.2s ease;
}

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

.prompt-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 8px;
}

.chip-btn {
  padding: 6px 11px;
  border-radius: 20px;
  background: var(--surface);
  border: 1px solid var(--line);
  color: var(--muted);
  font-size: 12px;
  font-family: inherit;
  cursor: pointer;
  transition: all 0.15s ease;
}

.chip-btn:hover {
  color: var(--text);
  border-color: var(--accent);
}

/* Terms Row */
.terms-row {
  margin: 18px 0;
}

.checkbox-label {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  font-size: 13px;
  color: var(--muted);
  cursor: pointer;
}

.checkbox-label input {
  margin-top: 3px;
  accent-color: var(--accent);
  width: 16px;
  height: 16px;
}

/* Action Buttons */
.cta-container {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: 20px;
}

.primary-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 52px;
  padding: 12px 20px;
  border-radius: 14px;
  background: var(--accent-gradient);
  color: #fff;
  border: none;
  cursor: pointer;
  font-family: inherit;
  font-size: 16px;
  font-weight: 600;
  text-decoration: none;
  text-align: center;
  box-shadow: 0 4px 14px rgba(124, 101, 255, 0.35);
  transition: transform 0.15s ease, opacity 0.15s ease;
}

.primary-btn:active {
  transform: scale(0.98);
}

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

.btn-subtext {
  font-size: 12px;
  font-weight: 400;
  opacity: 0.85;
}

.secondary-btn {
  min-height: 48px;
  padding: 10px 18px;
  border-radius: 12px;
  background: var(--surface);
  border: 1px solid var(--line);
  color: var(--text);
  font-family: inherit;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s ease;
}
.secondary-btn:hover {
  background: var(--surface-hover);
}

.text-link-btn {
  background: none;
  border: none;
  color: var(--muted);
  font-size: 13px;
  font-family: inherit;
  cursor: pointer;
  padding: 8px;
}
.text-link-btn:hover {
  color: var(--text);
  text-decoration: underline;
}

/* Loading & Processing Cards */
.loading-card, .rendering-card, .error-card {
  text-align: center;
  padding: 40px 20px;
  border-radius: 16px;
  background: var(--surface);
  border: 1px solid var(--line);
  margin-top: 16px;
}

.spinner {
  width: 44px;
  height: 44px;
  border: 3px solid var(--line);
  border-top-color: var(--accent);
  border-radius: 50%;
  margin: 0 auto 20px;
  animation: spin 0.8s linear infinite;
}

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

.pulse-ring {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: var(--accent);
  margin: 0 auto 20px;
  box-shadow: 0 0 0 0 rgba(124, 101, 255, 0.7);
  animation: pulse 1.6s infinite;
}

@keyframes pulse {
  0% { transform: scale(0.9); box-shadow: 0 0 0 0 rgba(124, 101, 255, 0.7); }
  70% { transform: scale(1); box-shadow: 0 0 0 16px rgba(124, 101, 255, 0); }
  100% { transform: scale(0.9); box-shadow: 0 0 0 0 rgba(124, 101, 255, 0); }
}

.progress-bar-container {
  width: 100%;
  height: 8px;
  border-radius: 4px;
  background: var(--line);
  margin: 20px 0 12px;
  overflow: hidden;
}

.progress-bar {
  width: 15%;
  height: 100%;
  background: var(--accent-gradient);
  border-radius: 4px;
  transition: width 0.5s ease;
}

.progress-status {
  font-size: 14px;
  color: var(--accent);
  font-weight: 500;
}

.estimate-note {
  font-size: 12px;
  color: var(--muted);
  margin-top: 14px;
}

/* Storyboard Card */
.storyboard-header {
  text-align: center;
  margin-bottom: 16px;
}

.badge-pill {
  display: inline-block;
  padding: 4px 10px;
  border-radius: 20px;
  background: var(--accent-light);
  color: var(--accent);
  font-size: 12px;
  font-weight: 600;
}

.badge-pill.success {
  background: rgba(16, 185, 129, 0.12);
  color: var(--success);
}

.storyboard-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 20px;
}

.plan-section {
  border-bottom: 1px solid var(--line);
  padding-bottom: 16px;
  margin-bottom: 16px;
}

.scenes-list {
  padding-left: 20px;
  font-size: 14px;
  color: var(--text);
}

.scene-item {
  margin: 8px 0;
  line-height: 1.4;
}

.music-desc {
  font-size: 14px;
  color: var(--muted);
}

.pricing-summary {
  padding: 12px 14px;
  border-radius: 12px;
  background: var(--surface-active);
  margin-bottom: 16px;
}

.price-line {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 16px;
}

.price-line strong {
  font-size: 20px;
  color: var(--accent);
}

.money-back-note {
  font-size: 12px;
  color: var(--muted);
  margin-top: 6px;
}

.checkout-btn {
  flex-direction: row;
  justify-content: space-between;
  padding: 14px 20px;
}

/* Video Ready Card */
.ready-header {
  text-align: center;
  margin-bottom: 16px;
}

.video-preview-card {
  display: flex;
  flex-direction: column;
  align-items: center;
}

.video-wrapper {
  width: 100%;
  max-width: 320px;
  aspect-ratio: 9 / 16;
  border-radius: 16px;
  overflow: hidden;
  background: #000;
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.5);
  margin-bottom: 20px;
}

.video-wrapper video {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
}

.video-actions {
  display: flex;
  flex-direction: column;
  gap: 10px;
  width: 100%;
  max-width: 320px;
}

/* Error Card */
.error-icon {
  font-size: 40px;
  display: block;
  margin-bottom: 12px;
}

.error-support {
  font-size: 12px;
  margin-top: 14px;
}

/* App Footer */
.app-footer {
  padding: 24px 16px calc(24px + env(safe-area-inset-bottom));
  border-top: 1px solid var(--line);
  background: var(--bg);
  text-align: center;
}

.footer-links {
  display: flex;
  justify-content: center;
  gap: 8px;
  font-size: 13px;
  color: var(--muted);
  margin-bottom: 10px;
}

.seller-notice {
  font-size: 12px;
  color: var(--muted);
  line-height: 1.5;
}
