:root {
  --bg: #F7F7F8;
  --surface: #FFFFFF;
  --text: #1F1F1F;
  --text-secondary: #6B6B70;
  --border: #E4E4E7;
  --accent: #2563EB;
  --accent-dark: #1D4ED8;
  --warn-text: #B45309;
  --warn-bg: #FEF3C7;
}

html, body {
  background: var(--bg);
  color: var(--text);
  font-family: 'Inter', system-ui, sans-serif;
  font-size: 15px;
  line-height: 1.5;
}

h1, h2, h3 {
  font-family: 'Inter', system-ui, sans-serif;
  color: var(--text);
}

.app-shell {
  max-width: 760px;
  margin: 0 auto;
  padding: 0 16px 64px;
}

/* ---------- header ---------- */
.app-header {
  position: sticky;
  top: 0;
  z-index: 50;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
}

.app-header .brand {
  display: flex;
  align-items: center;
  gap: 10px;
  max-width: 760px;
  margin: 0 auto;
  padding: 14px 16px;
}

.app-header .brand-icon {
  width: 34px;
  height: 34px;
  border-radius: 9px;
  background: var(--accent);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  flex: none;
}

.app-header .brand-name {
  font-weight: 600;
  font-size: 16px;
  color: var(--text);
}

/* ---------- generic section heading ---------- */
.section-title {
  font-size: 20px;
  font-weight: 600;
  margin: 32px 0 12px;
  color: var(--text);
}

.section-title:first-of-type {
  margin-top: 24px;
}

.hint-text {
  font-size: 13px;
  color: var(--text-secondary);
}

/* ---------- warning block ---------- */
.warning-card {
  background: var(--warn-bg);
  border: 1px solid #FCE3A6;
  border-radius: 14px;
  padding: 18px 20px;
  margin-top: 20px;
}

.warning-card .warning-title {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--warn-text);
  font-weight: 600;
  font-size: 16px;
  margin-bottom: 8px;
}

.warning-card ul {
  margin: 8px 0 14px;
  padding-left: 20px;
  color: #8a5a12;
  font-size: 14px;
}

.warning-card .form-check-label {
  color: var(--warn-text);
  font-size: 14px;
  font-weight: 500;
}

.warning-card .form-check-input:checked {
  background-color: var(--warn-text);
  border-color: var(--warn-text);
}

/* ---------- cards ---------- */
.card-surface {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 22px;
  margin-top: 20px;
}

/* ---------- dropzone ---------- */
.dropzone {
  border: 2px dashed var(--border);
  border-radius: 14px;
  padding: 28px 16px;
  text-align: center;
  cursor: pointer;
  transition: border-color .15s ease, background-color .15s ease;
  background: var(--bg);
}

.dropzone:hover {
  border-color: var(--accent);
}

.dropzone.is-dragover {
  border-color: var(--accent);
  background: #EFF4FE;
}

.dropzone .dz-icon {
  font-size: 30px;
  color: var(--accent);
  margin-bottom: 10px;
}

.dropzone .dz-title {
  font-weight: 500;
  margin-bottom: 4px;
}

.dropzone img.dz-preview {
  max-width: 100%;
  max-height: 260px;
  border-radius: 10px;
  margin-top: 14px;
  object-fit: contain;
}

.upload-error {
  color: #B42318;
  font-size: 13px;
  margin-top: 8px;
}

/* ---------- demo preview strip (empty state) ---------- */
.demo-strip {
  display: flex;
  gap: 12px;
  margin-top: 16px;
  flex-wrap: wrap;
}

.demo-shape {
  flex: 1 1 0;
  min-width: 88px;
  background: #EDEDF0;
  border: 1px solid var(--border);
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #9B9BA1;
  font-size: 18px;
  position: relative;
}

.demo-shape span {
  position: absolute;
  bottom: 6px;
  font-size: 11px;
  color: var(--text-secondary);
}

.shape-16x9 { aspect-ratio: 16 / 9; }
.shape-9x16 { aspect-ratio: 9 / 16; max-width: 90px; }
.shape-1x1  { aspect-ratio: 1 / 1; max-width: 110px; }

/* ---------- format tiles ---------- */
.format-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  margin-top: 14px;
}

.format-tile {
  border: 2px solid var(--border);
  border-radius: 14px;
  background: var(--surface);
  padding: 14px 10px;
  text-align: center;
  cursor: pointer;
  transition: border-color .15s ease, box-shadow .15s ease;
}

.format-tile:hover {
  border-color: #b7c8f5;
}

.format-tile.is-active {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, .12);
}

.format-tile .ratio-preview {
  margin: 0 auto 10px;
  border: 2px solid var(--text-secondary);
  border-radius: 4px;
  background: #F0F1F3;
}

.format-tile.is-active .ratio-preview {
  border-color: var(--accent);
  background: #EFF4FE;
}

.format-tile[data-ratio="16:9"] .ratio-preview { width: 52px; height: 30px; }
.format-tile[data-ratio="9:16"] .ratio-preview { width: 26px; height: 46px; }
.format-tile[data-ratio="1:1"]  .ratio-preview { width: 38px; height: 38px; }

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

.format-tile .format-sub {
  font-size: 12px;
  color: var(--text-secondary);
}

/* ---------- duration selector ---------- */
.duration-row {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  margin-top: 14px;
}

.duration-btn {
  border: 2px solid var(--border);
  border-radius: 14px;
  background: var(--surface);
  padding: 12px 10px;
  text-align: center;
  cursor: pointer;
  font-family: 'Inter', system-ui, sans-serif;
  font-size: 15px;
  font-weight: 500;
  color: var(--text);
  transition: border-color .15s ease, box-shadow .15s ease;
}

.duration-btn:hover {
  border-color: #b7c8f5;
}

.duration-btn.is-active {
  border-color: var(--accent);
  color: var(--accent);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, .12);
}

/* ---------- description textarea ---------- */
.description-textarea {
  width: 100%;
  min-height: 96px;
  resize: vertical;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--bg);
  color: var(--text);
  font-family: 'Inter', system-ui, sans-serif;
  font-size: 15px;
  line-height: 1.5;
  padding: 12px 14px;
  transition: border-color .15s ease;
}

.description-textarea:focus {
  outline: none;
  border-color: var(--accent);
  background: #fff;
}

.description-textarea::placeholder {
  color: #9B9BA1;
}

/* ---------- primary button ---------- */
.btn-primary-lg {
  background: var(--accent);
  border: none;
  color: #fff;
  font-weight: 600;
  font-size: 16px;
  border-radius: 12px;
  padding: 15px 20px;
  width: 100%;
  margin-top: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  transition: background-color .15s ease;
}

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

.btn-primary-lg:disabled {
  opacity: .55;
  cursor: not-allowed;
}

/* ---------- progress ---------- */
.progress-wrap {
  margin-top: 16px;
  display: none;
}

.progress-wrap.is-visible {
  display: block;
}

.progress-track {
  height: 6px;
  border-radius: 4px;
  background: var(--border);
  overflow: hidden;
}

.progress-bar-fill {
  height: 100%;
  width: 28%;
  background: var(--accent);
  border-radius: 4px;
  animation: progress-slide 1.6s ease-in-out infinite;
}

@keyframes progress-slide {
  0% { margin-left: 0%; width: 20%; }
  50% { margin-left: 55%; width: 35%; }
  100% { margin-left: 0%; width: 20%; }
}

/* ---------- result card ---------- */
.result-card {
  opacity: 0;
  transform: translateY(8px);
  max-height: 0;
  overflow: hidden;
  transition: opacity .35s ease, transform .35s ease, max-height .35s ease;
}

.result-card.is-visible {
  opacity: 1;
  transform: translateY(0);
  max-height: 900px;
}

.result-card video {
  width: 100%;
  border-radius: 12px;
  background: #000;
  margin-top: 12px;
}

.btn-download {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin-top: 14px;
  border: 1px solid var(--accent);
  color: var(--accent);
  background: #fff;
  font-weight: 600;
  border-radius: 10px;
  padding: 10px 16px;
  text-decoration: none;
}

.btn-download:hover {
  background: #EFF4FE;
  color: var(--accent-dark);
}

/* ---------- toast ---------- */
.toast-stack {
  position: fixed;
  top: 16px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 1080;
  width: 100%;
  max-width: 420px;
  padding: 0 12px;
}

.toast-item {
  background: #2B2B2E;
  color: #fff;
  border-radius: 10px;
  padding: 12px 16px;
  font-size: 14px;
  margin-bottom: 10px;
  box-shadow: 0 8px 24px rgba(0,0,0,.18);
  display: flex;
  align-items: flex-start;
  gap: 10px;
}

.toast-item i { color: #F87171; margin-top: 2px; }

/* ---------- responsive ---------- */
@media (max-width: 767px) {
  .app-shell {
    padding: 0 16px 48px;
  }

  .format-grid {
    grid-template-columns: 1fr;
  }

  .duration-row {
    grid-template-columns: 1fr;
  }

  .btn-primary-lg {
    width: 100%;
  }

  .demo-strip {
    flex-wrap: wrap;
  }
}
