/* Easy Reels Mini App. Colours follow Telegram's theme (the --tg-theme-* variables that
   telegram-web-app.js sets), with light/dark fallbacks outside Telegram. */
:root {
  --bg: var(--tg-theme-bg-color, #ffffff);
  --card: var(--tg-theme-secondary-bg-color, #f2f3f5);
  --fg: var(--tg-theme-text-color, #111111);
  --muted: var(--tg-theme-hint-color, #6b7280);
  --accent: var(--tg-theme-button-color, #2481cc);
  --accent-fg: var(--tg-theme-button-text-color, #ffffff);
  --danger: var(--tg-theme-destructive-text-color, #d93025);
  --radius: 14px;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: var(--tg-theme-bg-color, #17212b);
    --card: var(--tg-theme-secondary-bg-color, #232e3c);
    --fg: var(--tg-theme-text-color, #f5f5f5);
    --muted: var(--tg-theme-hint-color, #8b9aa8);
    --accent: var(--tg-theme-button-color, #5aa9e6);
    --danger: var(--tg-theme-destructive-text-color, #ef5350);
  }
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--fg); }
body {
  font: 16px/1.45 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, system-ui, sans-serif;
  -webkit-text-size-adjust: 100%;
}
#app {
  max-width: 560px;
  margin: 0 auto;
  padding: 16px 16px calc(24px + env(safe-area-inset-bottom));
}
.top { margin: 4px 0 16px; }
h1 { font-size: 24px; margin: 0; letter-spacing: -0.02em; }
h2 { font-size: 18px; margin: 0 0 8px; }
p { margin: 0 0 8px; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.screen { display: flex; flex-direction: column; gap: 12px; }
.screen[hidden] { display: none; }
.card { background: var(--card); border-radius: var(--radius); padding: 16px; }
.card.error h2 { color: var(--danger); }
.upload-cta {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px;
  min-height: 200px; border-radius: var(--radius); cursor: pointer;
  border: 2px dashed color-mix(in srgb, var(--accent) 55%, transparent);
  background: color-mix(in srgb, var(--accent) 8%, transparent);
  -webkit-tap-highlight-color: transparent;
}
.upload-cta:active { transform: scale(0.99); }
.plus {
  width: 64px; height: 64px; border-radius: 50%; display: grid; place-items: center;
  background: var(--accent); color: var(--accent-fg); font-size: 40px; line-height: 1; font-weight: 300;
}
.cta-title { font-size: 18px; font-weight: 600; }
.btn {
  width: 100%; min-height: 50px; border: 0; border-radius: 12px; font: inherit; font-weight: 600;
  background: var(--accent); color: var(--accent-fg); cursor: pointer;
}
.btn.secondary { background: transparent; color: var(--accent); }
.btn[disabled] { opacity: 0.5; }
.btn[hidden] { display: none; }
.file-name { font-weight: 600; word-break: break-all; }
.status { font-weight: 600; }
.bar { height: 8px; border-radius: 4px; overflow: hidden; margin: 10px 0 8px; background: color-mix(in srgb, var(--fg) 12%, transparent); }
.bar-fill { height: 100%; width: 0; background: var(--accent); transition: width 0.3s ease; }
.steps { margin: 8px 0 12px; padding: 0; list-style: none; display: flex; flex-direction: column; gap: 10px; }
.steps li { display: flex; align-items: center; gap: 10px; color: var(--muted); }
.steps li::before {
  content: ""; flex: none; width: 18px; height: 18px; border-radius: 50%;
  border: 2px solid color-mix(in srgb, var(--fg) 25%, transparent);
}
.steps li.done { color: var(--fg); }
.steps li.done::before { border-color: var(--accent); background: var(--accent); }
.steps li.active { color: var(--fg); font-weight: 600; }
.steps li.active::before { border-color: var(--accent); border-top-color: transparent; animation: spin 0.9s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .steps li.active::before { animation: none; border-top-color: var(--accent); } }
video { width: 100%; max-height: 60vh; border-radius: 10px; background: #000; margin: 4px 0 8px; }
