:root {
  --bg: #06070d;
  --surface: #0d0e17;
  --surface-soft: #11121c;
  --surface-card: #11121a;
  --text: #f8f8fc;
  --muted: #a7a7b3;
  --muted-2: #737481;
  --border: #2c2d39;
  --purple: #7b2cff;
  --purple-bright: #9b34ff;
  --purple-soft: #c367ff;
  --radius-xl: 18px;
  --radius-lg: 15px;
  --radius-md: 12px;
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  color-scheme: dark;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; background: var(--bg); }
body {
  min-height: 100dvh;
  color: var(--text);
  background: radial-gradient(circle at 50% -10%, rgba(67,40,140,.16), transparent 34%), var(--bg);
  -webkit-font-smoothing: antialiased;
  overscroll-behavior-y: none;
}
button, input { font: inherit; }
button { color: inherit; }
.screen { display: none; min-height: 100dvh; }
.screen.active { display: block; }

.app-shell {
  width: min(100%, 480px);
  min-height: 100dvh;
  margin: 0 auto;
  background: linear-gradient(180deg, #070812 0%, #06070d 100%);
  position: relative;
}

.topbar {
  min-height: 84px;
  padding: calc(18px + var(--safe-top)) 18px 14px;
  display: grid;
  grid-template-columns: 42px minmax(0, 1fr) auto;
  align-items: center;
  gap: 7px;
  position: sticky;
  top: 0;
  z-index: 20;
  background: linear-gradient(180deg, rgba(7,8,18,.98) 70%, rgba(7,8,18,.92));
  backdrop-filter: blur(14px);
}

.icon-button {
  width: 40px;
  height: 40px;
  display: grid;
  place-items: center;
  border: 0;
  border-radius: 12px;
  background: transparent;
  padding: 0;
}
.icon-button:active { background: rgba(255,255,255,.06); }
.icon-button svg { width: 31px; height: 31px; fill: none; stroke: #f5f5f7; stroke-width: 2.1; stroke-linecap: round; }

.brand { min-width: 0; display: inline-flex; align-items: center; gap: 7px; text-decoration: none; color: var(--text); }
.brand-mark { width: 34px; height: 34px; display: inline-grid; place-items: center; flex: 0 0 auto; }
.brand-mark svg { width: 100%; height: 100%; display: block; }
.brand-name { font-size: clamp(20px, 5.55vw, 24px); font-weight: 760; letter-spacing: -.045em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.wallet {
  height: 46px; border: 1px solid #272834; border-radius: 12px; padding: 0 3px 0 8px;
  background: linear-gradient(180deg, #252632, #1d1e29); display: inline-flex; align-items: center; gap: 5px;
  box-shadow: 0 5px 18px rgba(0,0,0,.16), inset 0 1px 0 rgba(255,255,255,.03); font-size: 13px; font-weight: 600; white-space: nowrap;
}
.wallet svg { width: 22px; height: 22px; fill: none; stroke: #ededf3; stroke-width: 1.7; stroke-linecap: round; }
.wallet-plus { width: 34px; height: 34px; display: grid; place-items: center; margin-left: 1px; border-radius: 9px; background: linear-gradient(145deg, #8f2cff, #b43cff 55%, #6536ff); box-shadow: 0 0 22px rgba(132,46,255,.36); font-size: 28px; font-weight: 400; line-height: 1; }

.home-screen { padding: 8px 18px calc(32px + var(--safe-bottom)); }
.import-panel { position: relative; min-height: 305px; border: 1px solid rgba(126,49,255,.65); border-radius: var(--radius-xl); background: radial-gradient(circle at 50% 34%, rgba(111,49,196,.16), transparent 34%), linear-gradient(145deg, #151126, #0c0b16 72%); box-shadow: inset 0 0 0 1px rgba(120,48,255,.06), 0 0 26px rgba(84,28,160,.06); overflow: hidden; }
.import-panel.dragging { border-color: var(--purple-soft); box-shadow: 0 0 0 2px rgba(155,52,255,.18), 0 0 40px rgba(107,48,255,.2); }
.import-hit-area { width: 100%; min-height: 305px; border: 0; background: transparent; display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 26px 24px 32px; cursor: pointer; }
.folder-orbit { width: 142px; height: 142px; display: grid; place-items: center; position: relative; margin-bottom: 15px; }
.orbit-ring { position: absolute; border-radius: 50%; }
.ring-outer { inset: 0; background: radial-gradient(circle, rgba(103,43,175,.32) 0 45%, rgba(76,28,138,.17) 46% 62%, transparent 63%); filter: blur(.2px); }
.ring-inner { inset: 19px; background: rgba(99,41,176,.26); box-shadow: 0 0 30px rgba(120,51,210,.26); }
.folder-icon { width: 78px; height: 78px; position: relative; z-index: 2; filter: drop-shadow(0 8px 14px rgba(114,44,212,.28)); }
.import-title { font-size: 25px; line-height: 1.2; font-weight: 760; letter-spacing: -.03em; margin-top: 2px; }
.import-subtitle { margin-top: 11px; color: var(--muted); font-size: 17px; line-height: 1.45; font-weight: 470; text-align: center; }
.drop-overlay { position: absolute; inset: 0; display: grid; place-items: center; background: rgba(10,7,21,.88); color: white; font-size: 20px; font-weight: 700; opacity: 0; pointer-events: none; transition: opacity .16s ease; }
.import-panel.dragging .drop-overlay { opacity: 1; }

.recent-section { margin-top: 27px; }
.section-heading-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 12px; }
.section-heading-row h2 { margin: 0; font-size: 20px; line-height: 1.2; font-weight: 760; letter-spacing: -.025em; }
.see-all { border: 0; background: transparent; color: #9a31ff; font-size: 16px; font-weight: 690; padding: 6px 2px 6px 10px; }
.recent-list { display: grid; gap: 9px; }
.video-row { display: grid; grid-template-columns: 118px minmax(0, 1fr) 28px; align-items: center; min-height: 82px; border-radius: var(--radius-md); overflow: hidden; background: linear-gradient(180deg, #11121b, #0e0f17); border: 1px solid rgba(255,255,255,.015); cursor: pointer; }
.video-row:active { transform: scale(.995); background: #14151f; }
.video-thumb-wrap { position: relative; height: 82px; overflow: hidden; background: #171923; }
.video-thumb { width: 100%; height: 100%; display: block; object-fit: cover; }
.duration-badge { position: absolute; right: 6px; bottom: 6px; border-radius: 5px; padding: 3px 5px; background: rgba(12,12,17,.8); color: white; font-size: 11px; line-height: 1; font-weight: 650; backdrop-filter: blur(4px); }
.video-copy { min-width: 0; padding: 0 9px 0 12px; }
.video-title { margin: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 16px; line-height: 1.3; font-weight: 690; letter-spacing: -.015em; }
.video-meta { margin: 5px 0 0; color: #9b9ca9; font-size: 13px; line-height: 1.35; font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.more-button { align-self: stretch; width: 28px; border: 0; background: transparent; display: grid; place-items: center; padding: 0; }
.more-button svg { width: 22px; height: 22px; fill: #ebebf1; }
.support-card { min-height: 88px; margin-top: 34px; border: 1px solid #3a3b48; border-radius: 15px; display: grid; grid-template-columns: 72px minmax(0, 1fr); align-items: center; gap: 8px; padding: 12px 16px 12px 11px; background: linear-gradient(180deg, rgba(14,15,23,.92), rgba(9,10,16,.92)); }
.sparkles { width: 62px; height: 62px; }
.support-card p { margin: 0; font-size: 17px; line-height: 1.45; font-weight: 510; letter-spacing: -.015em; }

/* Generate captions / Language screen */
.workflow-topbar {
  min-height: 82px;
  padding: calc(22px + var(--safe-top)) 18px 10px;
  display: grid;
  grid-template-columns: 44px minmax(0,1fr) 44px;
  align-items: center;
  background: #070811;
}
.workflow-topbar h1 { margin: 0; text-align: center; font-size: 22px; line-height: 1.2; font-weight: 760; letter-spacing: -.025em; }
.workflow-back { width: 42px; height: 42px; border: 0; border-radius: 12px; background: transparent; display: grid; place-items: center; padding: 0; }
.workflow-back:active { background: rgba(255,255,255,.055); }
.workflow-back svg { width: 31px; height: 31px; fill: none; stroke: #f5f5f7; stroke-width: 2.25; stroke-linecap: round; stroke-linejoin: round; }
.workflow-header-spacer { width: 42px; height: 42px; }
.generate-screen { min-height: calc(100dvh - 82px); padding: 13px 18px calc(28px + var(--safe-bottom)); background: linear-gradient(180deg, #070811 0%, #07070f 60%, #07070e 100%); }

.stepper { position: relative; display: grid; grid-template-columns: repeat(3,1fr); align-items: start; margin: 3px 6px 0; height: 112px; }
.stepper-line { position: absolute; top: 25px; height: 2px; z-index: 0; }
.stepper-line.line-one { left: 16.5%; width: 33.5%; background: #38383f; }
.stepper-line.line-one.active { background: linear-gradient(90deg, #a63cff, #7732ff); box-shadow: 0 0 9px rgba(131,51,255,.4); }
.stepper-line.line-two { left: 50%; width: 33.5%; background: #35363b; }
.step { position: relative; z-index: 1; display: flex; flex-direction: column; align-items: center; gap: 10px; color: #9c9ca5; font-size: 14px; font-weight: 620; }
.step-circle { width: 52px; height: 52px; border-radius: 50%; display: grid; place-items: center; background: #0b0b10; border: 2px solid #3b3c42; box-shadow: 0 0 0 3px rgba(0,0,0,.16); }
.step-circle strong { font-size: 16px; font-weight: 700; }
.step.complete, .step.current { color: #f2f2f6; }
.step.complete .step-circle { border-color: #8e36ff; background: #171025; box-shadow: 0 0 0 3px rgba(128,49,255,.15), 0 0 18px rgba(128,49,255,.16); }
.step.complete .step-circle svg { width: 29px; height: 29px; fill: none; stroke: #cf99ff; stroke-width: 2.3; stroke-linecap: round; stroke-linejoin: round; }
.step.current .step-circle { border-color: #e1d8ff; background: linear-gradient(145deg, #8442ff, #6049ff); box-shadow: 0 0 0 3px rgba(102,57,255,.18), inset 0 1px 0 rgba(255,255,255,.3), 0 0 20px rgba(101,64,255,.22); }

.language-card { position: relative; z-index: 5; margin-top: 2px; border: 1px solid #2d2e39; border-radius: 15px; background: linear-gradient(180deg, #11121b, #0e0f17); padding: 20px 16px 17px; box-shadow: inset 0 1px 0 rgba(255,255,255,.015); }
.language-card h2 { margin: 0 0 17px; font-size: 20px; line-height: 1.2; font-weight: 730; letter-spacing: -.025em; }
.language-select-wrap { position: relative; }
.language-select { width: 100%; min-height: 58px; border: 1px solid rgba(127,45,255,.9); border-radius: 11px; background: linear-gradient(180deg, #22222c, #1a1a24); display: grid; grid-template-columns: 34px minmax(0,1fr) 28px; align-items: center; gap: 8px; padding: 0 14px; text-align: left; box-shadow: 0 0 0 1px rgba(126,45,255,.09) inset; }
.language-select .globe-icon { width: 28px; height: 28px; fill: none; stroke: #f7f7fa; stroke-width: 1.7; stroke-linecap: round; }
.language-select > span { font-size: 18px; font-weight: 560; }
.language-select .chevron { width: 26px; height: 26px; fill: none; stroke: #ececf2; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; transition: transform .18s ease; }
.language-select[aria-expanded="true"] .chevron { transform: rotate(180deg); }
.language-menu { position: absolute; left: 0; right: 0; top: calc(100% + 7px); z-index: 30; border: 1px solid #3a3b49; border-radius: 12px; padding: 6px; background: #171821; box-shadow: 0 18px 40px rgba(0,0,0,.42); max-height: 248px; overflow-y: auto; }
.language-menu button { width: 100%; border: 0; border-radius: 8px; padding: 11px 12px; text-align: left; background: transparent; font-size: 16px; }
.language-menu button[aria-selected="true"] { background: rgba(126,45,255,.15); color: #c99bff; }
.language-menu button:active { background: rgba(255,255,255,.06); }

.toggle-row { margin-top: 22px; min-height: 48px; display: flex; align-items: center; justify-content: space-between; gap: 14px; }
.toggle-label-wrap { min-width: 0; display: flex; align-items: center; gap: 8px; color: #dedee5; font-size: 16px; font-weight: 520; }
.info-button { width: 26px; height: 26px; flex: 0 0 26px; border-radius: 50%; border: 1.8px solid #777886; background: transparent; color: #aeb0bd; display: grid; place-items: center; padding: 0; font-family: Georgia, serif; font-size: 16px; font-weight: 700; }
.switch { position: relative; width: 52px; height: 30px; flex: 0 0 52px; border: 0; border-radius: 999px; padding: 3px; background: #3b3c45; transition: background .18s ease; }
.switch span { display: block; width: 24px; height: 24px; border-radius: 50%; background: #f8f8fb; box-shadow: 0 2px 5px rgba(0,0,0,.32); transform: translateX(0); transition: transform .18s ease; }
.switch.on { background: linear-gradient(90deg, #6c25ff, #a22cff); box-shadow: 0 0 16px rgba(127,40,255,.28); }
.switch.on span { transform: translateX(22px); }
.switch.compact { width: 46px; height: 27px; flex-basis: 46px; padding: 3px; }
.switch.compact span { width: 21px; height: 21px; }
.switch.compact.on span { transform: translateX(19px); }

.advanced-card { width: 100%; min-height: 64px; margin-top: 17px; border: 1px solid #2d2e39; border-radius: 14px; background: linear-gradient(180deg, #11121b, #0e0f17); display: flex; align-items: center; justify-content: space-between; padding: 0 17px; font-size: 18px; font-weight: 630; text-align: left; }
.advanced-card svg { width: 26px; height: 26px; fill: none; stroke: #ececf2; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; transition: transform .18s ease; }
.advanced-card[aria-expanded="true"] svg { transform: rotate(180deg); }
.advanced-content { margin-top: 8px; border: 1px solid #282934; border-radius: 13px; background: #0e0f17; padding: 14px 16px; }
.advanced-option-row { display: flex; align-items: center; justify-content: space-between; gap: 14px; }
.advanced-option-row strong { display: block; font-size: 15px; line-height: 1.25; }
.advanced-option-row small { display: block; margin-top: 4px; color: #858692; font-size: 12px; line-height: 1.35; }

.generate-action-area { margin-top: 55px; text-align: center; }
.generate-button { width: 100%; min-height: 58px; border: 0; border-radius: 11px; background: linear-gradient(100deg, #7435ff 0%, #8b2eff 42%, #9e34f5 100%); box-shadow: 0 10px 26px rgba(94,38,255,.2), inset 0 1px 0 rgba(255,255,255,.2); display: flex; align-items: center; justify-content: center; gap: 10px; font-size: 18px; font-weight: 710; letter-spacing: -.015em; }
.generate-button:active { transform: translateY(1px); filter: brightness(.96); }
.generate-button svg { width: 24px; height: 24px; fill: #f4eaff; }
.generate-action-area p { margin: 16px 0 0; color: #a4a4ae; font-size: 14px; font-weight: 500; }

.security-card { min-height: 92px; margin-top: 56px; border: 1px solid #3a3b49; border-radius: 15px; background: linear-gradient(180deg, #0f1018, #0b0c13); display: grid; grid-template-columns: 72px minmax(0,1fr); align-items: center; gap: 8px; padding: 13px 16px 13px 12px; }
.shield-wrap { width: 64px; height: 64px; display: grid; place-items: center; }
.shield-wrap svg { width: 52px; height: 58px; filter: drop-shadow(0 7px 13px rgba(91,47,255,.22)); }
.security-card strong { display: block; font-size: 16px; line-height: 1.3; font-weight: 690; letter-spacing: -.015em; }
.security-card p { margin: 5px 0 0; color: #9c9da8; font-size: 14px; line-height: 1.3; }

.scrim { position: fixed; inset: 0; z-index: 60; background: rgba(0,0,0,.56); backdrop-filter: blur(2px); }
.drawer { position: fixed; z-index: 70; top: 0; bottom: 0; left: 0; width: min(82vw, 320px); padding: calc(26px + var(--safe-top)) 18px 24px; background: #0d0e16; border-right: 1px solid #242632; transform: translateX(-105%); transition: transform .22s ease; box-shadow: 16px 0 48px rgba(0,0,0,.3); }
.drawer.open { transform: translateX(0); }
.drawer-brand { display: flex; align-items: center; gap: 10px; font-size: 22px; font-weight: 760; }
.brand-mark.mini { width: 34px; height: 34px; }
.drawer nav { margin-top: 30px; display: grid; gap: 10px; }
.drawer-item { width: 100%; text-align: left; border: 0; border-radius: 11px; background: transparent; padding: 12px 14px; color: #f4f4f8; font-size: 16px; font-weight: 650; }
.drawer-item.active { background: rgba(126,44,255,.14); color: #bb7cff; }
.drawer-note { padding: 8px 14px; color: #787985; font-size: 13px; line-height: 1.5; }

.toast { position: fixed; left: 50%; bottom: calc(22px + var(--safe-bottom)); z-index: 100; transform: translate(-50%, 18px); width: min(calc(100% - 36px), 420px); padding: 11px 14px; border-radius: 12px; background: rgba(27,28,39,.96); border: 1px solid #353744; box-shadow: 0 12px 40px rgba(0,0,0,.34); color: #f4f4f7; font-size: 14px; line-height: 1.35; opacity: 0; pointer-events: none; transition: opacity .18s ease, transform .18s ease; }
.toast.show { opacity: 1; transform: translate(-50%, 0); }

@media (max-width: 370px) {
  .topbar { padding-left: 12px; padding-right: 12px; gap: 7px; grid-template-columns: 38px minmax(0,1fr) auto; }
  .brand-mark { width: 34px; height: 34px; }
  .brand-name { font-size: 20px; }
  .wallet { height: 42px; font-size: 12px; padding-left: 8px; gap: 5px; }
  .wallet svg { width: 20px; height: 20px; }
  .wallet-plus { width: 31px; height: 31px; font-size: 24px; }
  .home-screen, .generate-screen { padding-left: 14px; padding-right: 14px; }
  .workflow-topbar { padding-left: 12px; padding-right: 12px; }
  .workflow-topbar h1 { font-size: 21px; }
  .import-panel, .import-hit-area { min-height: 285px; }
  .video-row { grid-template-columns: 106px minmax(0,1fr) 26px; }
  .video-title { font-size: 15px; }
  .video-meta { font-size: 12px; }
  .support-card p { font-size: 15px; }
  .stepper { margin-left: 0; margin-right: 0; }
  .language-card { padding-left: 14px; padding-right: 14px; }
  .toggle-label-wrap { font-size: 14px; gap: 6px; }
  .switch { width: 48px; flex-basis: 48px; }
  .switch.on span { transform: translateX(18px); }
  .generate-action-area { margin-top: 44px; }
  .security-card { margin-top: 45px; grid-template-columns: 62px minmax(0,1fr); }
  .security-card strong { font-size: 15px; }
  .security-card p { font-size: 13px; }
}

@media (max-height: 740px) {
  .stepper { height: 102px; }
  .language-card { padding-top: 17px; padding-bottom: 14px; }
  .toggle-row { margin-top: 16px; }
  .advanced-card { margin-top: 12px; min-height: 58px; }
  .generate-action-area { margin-top: 30px; }
  .security-card { margin-top: 32px; }
}

@media (min-width: 481px) {
  body { padding: 20px 0; }
  .app-shell { min-height: calc(100dvh - 40px); border-radius: 28px; overflow: hidden; box-shadow: 0 26px 80px rgba(0,0,0,.45); border: 1px solid #1c1d27; }
  .screen { min-height: calc(100dvh - 40px); }
  .generate-screen { min-height: calc(100dvh - 122px); }
  .topbar { position: sticky; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; transition-duration: 0.01ms !important; animation-duration: 0.01ms !important; animation-iteration-count: 1 !important; }
}

/* Edit captions screen */
.edit-topbar {
  grid-template-columns: 44px minmax(0,1fr) auto;
  gap: 10px;
}
.edit-topbar h1 { text-align: left; }
.edit-actions { display: inline-flex; align-items: center; gap: 10px; }
.export-button {
  min-height: 42px;
  border: 0;
  border-radius: 11px;
  padding: 0 14px;
  background: linear-gradient(135deg, #7d34ff, #a33bff);
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 15px;
  font-weight: 680;
  letter-spacing: -.01em;
  box-shadow: 0 10px 24px rgba(106, 45, 255, .26), inset 0 1px 0 rgba(255,255,255,.2);
}
.export-button svg,
.small-ghost svg {
  width: 20px;
  height: 20px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.9;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.small-ghost {
  width: 36px;
  height: 36px;
  border-radius: 10px;
}
.edit-screen {
  min-height: calc(100dvh - 82px);
  padding: 10px 14px calc(92px + var(--safe-bottom));
  background: linear-gradient(180deg, #070811 0%, #07070f 50%, #06070d 100%);
}
.editor-stage-card {
  background: #05060d;
  border-radius: 18px;
  overflow: hidden;
}
.video-stage {
  position: relative;
  aspect-ratio: 16 / 9;
  background: #0a0b12;
  overflow: hidden;
}
.video-stage img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.caption-overlay {
  position: absolute;
  left: 16px;
  right: 16px;
  display: flex;
  flex-direction: column;
  gap: 2px;
  align-items: center;
  pointer-events: none;
}
.caption-overlay span {
  display: inline-block;
  max-width: 92%;
  text-align: center;
  font-size: clamp(18px, 5vw, 27px);
  line-height: 1.04;
  font-weight: 800;
  letter-spacing: -.035em;
}
.caption-overlay em { font-style: normal; }
.caption-overlay.pos-top { top: 14%; }
.caption-overlay.pos-center { top: 50%; transform: translateY(-50%); }
.caption-overlay.pos-bottom { bottom: 10%; }
.caption-overlay.style-default span {
  color: #fff;
  text-shadow: 0 0 0 #12081e, 0 3px 0 #12081e, 0 -1px 0 #12081e, 1px 0 0 #12081e, -1px 0 0 #12081e, 2px 2px 6px rgba(10,10,18,.7);
}
.caption-overlay.style-default em { color: #ffdc52; }
.caption-overlay.style-classic span {
  color: #fff;
  background: rgba(0,0,0,.62);
  border-radius: 9px;
  padding: 3px 8px 4px;
  text-shadow: none;
}
.caption-overlay.style-bold-yellow span {
  color: #ffd94d;
  text-shadow: 0 2px 0 #140d1d, 0 -1px 0 #140d1d, 1px 0 0 #140d1d, -1px 0 0 #140d1d, 2px 2px 6px rgba(0,0,0,.55);
}
.caption-overlay.style-bold-yellow em { color: #fff; }
.caption-overlay.style-outline span {
  color: rgba(255,255,255,.04);
  -webkit-text-stroke: 2px #fff;
  text-shadow: 0 2px 8px rgba(0,0,0,.45);
}
.caption-overlay.style-outline em { color: transparent; }
.caption-overlay.style-neon span {
  color: #ffd9ff;
  text-shadow: 0 0 4px rgba(213, 107, 255, .9), 0 0 12px rgba(128, 56, 255, .8), 0 2px 10px rgba(0,0,0,.6);
}
.caption-overlay.style-neon em { color: #fff; }
.playback-row {
  display: grid;
  grid-template-columns: 42px 1fr;
  align-items: center;
  gap: 10px;
  padding: 8px 2px 2px;
}
.play-toggle {
  width: 42px;
  height: 42px;
  border: 0;
  border-radius: 50%;
  background: transparent;
  display: grid;
  place-items: center;
}
.play-toggle svg {
  width: 24px;
  height: 24px;
  fill: #fff;
}
.playback-time {
  text-align: center;
  font-size: 14px;
  font-weight: 650;
  letter-spacing: -.02em;
}
.timeline-slider {
  width: 100%;
  margin: 0;
  accent-color: #8f35ff;
}
.caption-list {
  margin-top: 10px;
  display: grid;
  gap: 10px;
}
.caption-row {
  display: grid;
  grid-template-columns: 78px minmax(0,1fr) 74px;
  gap: 10px;
  align-items: center;
  background: #0b0c14;
  border: 1px solid #171925;
  border-radius: 16px;
  padding: 12px;
}
.caption-row.active {
  border-color: #7e36ff;
  box-shadow: 0 0 0 1px rgba(126, 54, 255, .12), inset 0 1px 0 rgba(255,255,255,.02);
}
.caption-time {
  color: #c3c3cf;
  font-size: 12px;
  line-height: 1.35;
  font-weight: 580;
}
.caption-copy {
  font-size: 15px;
  line-height: 1.5;
  font-weight: 620;
  color: #f5f5fa;
}
.caption-actions {
  display: inline-flex;
  justify-content: flex-end;
  gap: 10px;
}
.icon-action {
  width: 30px;
  height: 30px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: #9e43ff;
  display: grid;
  place-items: center;
  padding: 0;
}
.icon-action svg {
  width: 20px;
  height: 20px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.style-section {
  margin-top: 18px;
}
.style-section h2 {
  margin: 0 0 12px;
  font-size: 18px;
  line-height: 1.2;
  font-weight: 720;
}
.style-list {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: 96px;
  gap: 12px;
  overflow-x: auto;
  padding-bottom: 4px;
  scrollbar-width: none;
}
.style-list::-webkit-scrollbar { display: none; }
.style-card {
  border: 1px solid #252735;
  border-radius: 14px;
  background: #0b0c14;
  padding: 10px 8px 8px;
  text-align: center;
}
.style-card.active {
  border-color: #8c39ff;
  box-shadow: 0 0 0 1px rgba(140,57,255,.15);
}
.style-preview {
  min-height: 70px;
  border-radius: 10px;
  border: 1px solid #181a26;
  background: linear-gradient(180deg, #11131d, #090a12);
  display: grid;
  place-items: center;
  font-size: 26px;
  font-weight: 800;
  letter-spacing: -.03em;
}
.style-preview.default { color: #fff; text-shadow: 0 2px 0 #12081e; }
.style-preview.classic { color: #fff; }
.style-preview.classic span { background: rgba(0,0,0,.65); padding: 2px 7px 3px; border-radius: 7px; }
.style-preview.bold-yellow { color: #ffd94d; text-shadow: 0 2px 0 #12081e; }
.style-preview.outline { color: rgba(255,255,255,.06); -webkit-text-stroke: 1.6px #fff; }
.style-preview.neon { color: #f3d8ff; text-shadow: 0 0 8px rgba(162, 65, 255, .9); }
.style-name {
  display: block;
  margin-top: 8px;
  font-size: 13px;
  font-weight: 650;
  color: #e7e7ef;
}
.editor-panel { margin-top: 10px; }
.panel-sheet {
  border: 1px solid #1d1f2c;
  border-radius: 16px;
  padding: 16px;
  background: linear-gradient(180deg, #0d0f17, #090b12);
}
.panel-sheet h3 {
  margin: 0;
  font-size: 18px;
  font-weight: 720;
}
.panel-sheet p {
  margin: 8px 0 0;
  color: #9fa1af;
  font-size: 14px;
  line-height: 1.45;
}
.position-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  margin-top: 16px;
}
.position-chip {
  min-height: 52px;
  border: 1px solid #282b39;
  border-radius: 13px;
  background: #11131b;
  display: grid;
  place-items: center;
  font-size: 14px;
  font-weight: 650;
}
.position-chip.active {
  border-color: #8e36ff;
  color: #d9b4ff;
  background: linear-gradient(180deg, rgba(123,44,255,.16), rgba(123,44,255,.08));
}
.preview-sheet ul {
  margin: 16px 0 0;
  padding-left: 18px;
  color: #e8e8ef;
}
.preview-sheet li {
  margin: 0 0 10px;
  line-height: 1.45;
}
.editor-bottom-nav {
  position: fixed;
  left: 50%;
  transform: translateX(-50%);
  bottom: 0;
  width: min(100%, 480px);
  padding: 10px 10px calc(10px + var(--safe-bottom));
  background: linear-gradient(180deg, rgba(11,12,19,.74), rgba(7,8,14,.97) 28%);
  backdrop-filter: blur(18px);
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 6px;
  z-index: 25;
}
.bottom-tab {
  min-height: 60px;
  border: 0;
  border-radius: 14px;
  background: transparent;
  color: #b0b1bc;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 5px;
  font-size: 12px;
  font-weight: 650;
}
.bottom-tab svg {
  width: 22px;
  height: 22px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.9;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.bottom-tab.active { color: #9a39ff; }
.bottom-tab.active span { color: #9a39ff; }

@media (max-width: 370px) {
  .edit-topbar { gap: 8px; }
  .export-button { padding: 0 11px; font-size: 14px; }
  .edit-screen { padding-left: 12px; padding-right: 12px; }
  .caption-row { grid-template-columns: 68px minmax(0,1fr) 64px; gap: 8px; padding: 11px 10px; }
  .caption-copy { font-size: 14px; }
  .style-list { grid-auto-columns: 88px; gap: 10px; }
  .style-preview { min-height: 64px; font-size: 24px; }
}

@media (min-width: 481px) {
  .editor-bottom-nav { width: min(100%, 480px); border-bottom-left-radius: 28px; border-bottom-right-radius: 28px; }
}

/* Export flow */
.export-topbar { grid-template-columns: 44px minmax(0,1fr) 44px; }
.export-screen {
  min-height: calc(100dvh - 82px);
  padding: 10px 14px calc(28px + var(--safe-bottom));
  background: linear-gradient(180deg, #070811 0%, #07070f 56%, #06070d 100%);
}
.export-stage { min-height: calc(100dvh - 120px); }
.export-preview-card {
  border: 1px solid #171925;
  border-radius: 17px;
  overflow: hidden;
  background: #090a11;
}
.export-video-preview {
  position: relative;
  aspect-ratio: 16 / 9;
  overflow: hidden;
  background: #0b0c12;
}
.export-video-preview img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.preview-play-button {
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  width: 66px;
  height: 66px;
  border: 0;
  border-radius: 50%;
  background: rgba(31, 25, 42, .83);
  display: grid;
  place-items: center;
  box-shadow: 0 10px 30px rgba(0,0,0,.28);
}
.preview-play-button svg {
  width: 29px;
  height: 29px;
  fill: #fff;
}
.export-duration {
  position: absolute;
  left: 10px;
  bottom: 10px;
  padding: 4px 8px;
  border-radius: 7px;
  background: rgba(6,7,13,.82);
  color: #f4f4f7;
  font-size: 12px;
  font-weight: 700;
}
.export-section-title {
  margin: 16px 2px 10px;
  font-size: 19px;
  line-height: 1.2;
  font-weight: 760;
}
.export-settings-card,
.export-toggle-card,
.file-size-card,
.export-security-card,
.export-step-list,
.export-tip-card,
.export-file-card,
.share-file-card,
.share-options-card {
  border: 1px solid #202230;
  background: linear-gradient(180deg, #0e1018, #0a0b12);
  border-radius: 16px;
}
.export-settings-card { padding: 14px; }
.export-settings-card + .export-settings-card { margin-top: 10px; }
.setting-heading-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 12px;
}
.setting-heading-row strong { font-size: 16px; font-weight: 720; }
.setting-heading-row span { color: #a2a3af; font-size: 12px; font-weight: 550; }
.resolution-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0,1fr));
  gap: 10px;
}
.export-choice {
  position: relative;
  min-height: 70px;
  border: 1px solid #292b39;
  border-radius: 13px;
  background: #0c0e15;
  text-align: left;
  padding: 12px 40px 11px 13px;
}
.export-choice strong { display: block; font-size: 16px; font-weight: 720; }
.export-choice small { display: block; margin-top: 4px; color: #9294a0; font-size: 11px; }
.choice-check {
  position: absolute;
  right: 11px;
  top: 50%;
  transform: translateY(-50%);
  width: 23px;
  height: 23px;
  border-radius: 50%;
  background: #f4f0ff;
  color: #6940da;
  display: none;
  place-items: center;
  font-size: 13px;
  font-weight: 900;
}
.export-choice.active {
  border-color: #8f39ff;
  background: linear-gradient(180deg, rgba(118,42,255,.18), rgba(74,27,126,.14));
  box-shadow: inset 0 0 0 1px rgba(143,57,255,.08), 0 0 18px rgba(91,37,183,.08);
}
.export-choice.active .choice-check { display: grid; }
.format-card .export-choice { min-height: 58px; display: flex; align-items: center; }
.export-toggle-card {
  margin-top: 10px;
  padding: 14px;
  display: grid;
  grid-template-columns: 34px minmax(0,1fr) auto;
  gap: 12px;
  align-items: center;
}
.export-toggle-icon {
  width: 32px;
  height: 32px;
  border: 1px solid #616372;
  border-radius: 8px;
  display: grid;
  place-items: center;
  font-size: 15px;
  font-weight: 800;
}
.export-toggle-card strong { display: block; font-size: 15px; }
.export-toggle-card p { margin: 3px 0 0; color: #999ba7; font-size: 12px; line-height: 1.35; }
.file-size-card {
  min-height: 58px;
  margin-top: 10px;
  padding: 0 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.file-size-card > div { display: flex; align-items: center; gap: 10px; min-width: 0; }
.file-size-card svg {
  width: 21px;
  height: 21px;
  fill: none;
  stroke: #c3c4ce;
  stroke-width: 1.7;
  stroke-linecap: round;
  stroke-linejoin: round;
  flex: 0 0 auto;
}
.file-size-card span { color: #e6e6ed; font-size: 14px; font-weight: 600; }
.file-size-card strong { color: #bbbcc7; font-size: 13px; font-weight: 650; white-space: nowrap; }
.primary-export-button {
  width: 100%;
  min-height: 74px;
  margin-top: 12px;
  border: 0;
  border-radius: 13px;
  background: linear-gradient(100deg, #6e2cff 0%, #8833ff 50%, #9f35f3 100%);
  box-shadow: 0 12px 28px rgba(95,37,255,.2), inset 0 1px 0 rgba(255,255,255,.18);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
}
.primary-export-main { display: inline-flex; align-items: center; gap: 9px; font-size: 18px; font-weight: 760; }
.primary-export-main svg {
  width: 21px;
  height: 21px;
  fill: none;
  stroke: #fff;
  stroke-width: 1.9;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.primary-export-button small { font-size: 12px; color: rgba(255,255,255,.82); }
.export-security-card {
  min-height: 68px;
  margin-top: 12px;
  padding: 10px 13px;
  display: grid;
  grid-template-columns: 40px minmax(0,1fr);
  gap: 10px;
  align-items: center;
}
.mini-shield {
  width: 36px;
  height: 42px;
  clip-path: polygon(50% 0, 91% 17%, 85% 70%, 50% 100%, 15% 70%, 9% 17%);
  background: linear-gradient(145deg, #8f2cff, #5b47ff);
  display: grid;
  place-items: center;
  font-size: 16px;
  font-weight: 900;
}
.export-security-card strong { display: block; font-size: 14px; }
.export-security-card p { margin: 3px 0 0; color: #9d9faa; font-size: 12px; }
.progress-stage,
.complete-stage,
.share-stage {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding-top: 18px;
}
.progress-stage h2,
.complete-stage h2 { margin: 18px 0 0; font-size: 22px; font-weight: 780; letter-spacing: -.025em; }
.progress-stage > p,
.complete-stage > p { margin: 7px 0 0; color: #a2a4af; font-size: 14px; text-align: center; }
.progress-ring {
  --progress: 0;
  width: 148px;
  height: 148px;
  border-radius: 50%;
  background: conic-gradient(#7f32ff calc(var(--progress) * 1%), #191b25 0);
  display: grid;
  place-items: center;
  box-shadow: 0 0 24px rgba(126,50,255,.09);
}
.progress-ring > div {
  width: 126px;
  height: 126px;
  border-radius: 50%;
  background: #080a11;
  display: grid;
  place-items: center;
}
.progress-ring strong { font-size: 32px; font-weight: 760; }
.export-step-list { width: 100%; margin-top: 22px; padding: 8px 14px; }
.export-step {
  min-height: 54px;
  display: grid;
  grid-template-columns: 24px 1fr;
  gap: 10px;
  align-items: center;
  border-bottom: 1px solid #191b27;
  color: #8f909d;
}
.export-step:last-child { border-bottom: 0; }
.export-step span {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  border: 2px solid #3a3d4c;
}
.export-step strong { font-size: 14px; font-weight: 650; }
.export-step.active { color: #f4f4f7; }
.export-step.active span { border-color: #9c42ff; box-shadow: 0 0 0 3px rgba(156,66,255,.1); }
.export-step.complete { color: #dcdce5; }
.export-step.complete span {
  border-color: #8a39ff;
  background: #8a39ff;
  position: relative;
}
.export-step.complete span::after {
  content: '✓';
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  font-size: 12px;
  font-weight: 900;
  color: #fff;
}
.export-tip-card { width: 100%; margin-top: 12px; padding: 12px 14px; display: grid; grid-template-columns: 34px 1fr; gap: 10px; align-items: start; }
.export-tip-card > span { font-size: 24px; color: #cdb0ff; }
.export-tip-card strong { font-size: 14px; }
.export-tip-card p { margin: 4px 0 0; color: #9799a4; font-size: 12px; line-height: 1.45; }
.success-orbit {
  width: 132px;
  height: 132px;
  border-radius: 50%;
  background: radial-gradient(circle, #222530 0 49%, #151721 50% 100%);
  display: grid;
  place-items: center;
  position: relative;
}
.success-orbit::before,
.success-orbit::after {
  content: '';
  position: absolute;
  width: 10px;
  height: 10px;
  transform: rotate(45deg);
  border-radius: 2px;
}
.success-orbit::before { left: -8px; top: 34px; background: #933cff; box-shadow: 116px 18px 0 #ff9d16; }
.success-orbit::after { left: 10px; bottom: 9px; background: #ff9800; box-shadow: 109px -5px 0 #27c46c; }
.success-orbit span { color: #31d56f; font-size: 70px; line-height: 1; font-weight: 900; transform: translateY(-2px); }
.export-file-card {
  width: 100%;
  margin-top: 22px;
  padding: 11px;
  display: grid;
  grid-template-columns: 78px minmax(0,1fr);
  gap: 12px;
  align-items: center;
}
.export-file-card img,
.share-file-card img {
  width: 78px;
  height: 78px;
  object-fit: cover;
  border-radius: 10px;
}
.export-file-card strong,
.share-file-card strong { display: block; font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.export-file-card small,
.share-file-card small { display: block; margin-top: 5px; color: #9698a4; font-size: 12px; }
.export-file-card span { display: block; margin-top: 8px; color: #32cd68; font-size: 12px; font-weight: 650; }
.complete-primary,
.complete-secondary {
  width: 100%;
  min-height: 58px;
  border-radius: 13px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  font-size: 16px;
  font-weight: 720;
}
.complete-primary {
  margin-top: 16px;
  border: 0;
  background: linear-gradient(100deg, #6e2cff, #9938f9);
  box-shadow: 0 12px 26px rgba(96,37,255,.18);
}
.complete-secondary {
  margin-top: 10px;
  border: 1px solid #353745;
  background: #090a10;
}
.complete-primary svg,
.complete-secondary svg {
  width: 21px;
  height: 21px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.done-button {
  margin-top: 16px;
  border: 0;
  background: transparent;
  color: #aa4cff;
  font-size: 15px;
  font-weight: 720;
  padding: 10px 18px;
}
.share-stage { align-items: stretch; padding-top: 8px; }
.share-file-card {
  padding: 12px;
  display: grid;
  grid-template-columns: 78px minmax(0,1fr);
  gap: 12px;
  align-items: center;
}
.share-options-card { margin-top: 18px; padding: 16px 12px 14px; }
.share-options-card h2 { margin: 0 0 16px 4px; font-size: 17px; font-weight: 720; }
.share-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 18px 8px;
}
.share-grid button {
  border: 0;
  background: transparent;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 7px;
  padding: 0;
}
.share-grid button strong { font-size: 12px; font-weight: 650; }
.share-app {
  width: 48px;
  height: 48px;
  border-radius: 14px;
  display: grid;
  place-items: center;
  color: #fff;
  font-weight: 800;
  font-size: 20px;
  box-shadow: inset 0 1px 0 rgba(255,255,255,.2);
}
.share-app.whatsapp { background: linear-gradient(145deg, #2bd66d, #15a84f); }
.share-app.telegram { background: linear-gradient(145deg, #39b8f0, #1988cf); }
.share-app.instagram { background: radial-gradient(circle at 68% 74%, #ffdd55 0 10%, #f0446f 38%, #9339da 68%, #5947d8 100%); }
.share-app.youtube { background: #f20d19; }
.share-app.gmail { background: linear-gradient(145deg, #fff 0 45%, #e34b43 46% 60%, #3f85e5 61% 75%, #2da55e 76%); color: #333; }
.share-app.more { background: #1a1c26; border: 1px solid #303342; font-size: 14px; }
.share-cancel { margin-top: auto; }

@media (max-width: 370px) {
  .export-screen { padding-left: 12px; padding-right: 12px; }
  .resolution-grid { gap: 8px; }
  .export-choice { min-height: 66px; padding-left: 11px; padding-right: 34px; }
  .export-toggle-card { grid-template-columns: 30px minmax(0,1fr) auto; gap: 10px; }
  .export-toggle-card .switch { width: 46px; flex-basis: 46px; }
  .export-toggle-card .switch.on span { transform: translateX(16px); }
  .share-grid { gap-left: 4px; gap-right: 4px; }
}
.export-stage[hidden] { display: none !important; }
.success-orbit::before { left: 4px; top: 34px; box-shadow: none; }
.success-orbit::after { left: auto; right: 5px; top: 47px; bottom: auto; box-shadow: none; background: #ff9d16; }
.share-app svg { width: 28px; height: 28px; display: block; fill: #fff; stroke: none; }
.share-app.instagram svg { fill: none; stroke: #fff; stroke-width: 1.7; }
.share-app.instagram .fill-dot { fill: #fff; stroke: none; }
.share-app.youtube svg .play-cut { fill: #fff; }
.share-app.youtube svg > path:first-child { fill: #fff; opacity: 0; }
.share-app.youtube::before { content: ''; position: absolute; inset: 0; background: #f20d19; border-radius: inherit; }
.share-app.youtube svg { position: relative; z-index: 1; }
.share-app.gmail { background: #fff; }
.share-app.gmail svg { fill: #d94841; }
.share-app.gmail .gmail-fold { fill: none; stroke: #4285f4; stroke-width: 1.8; }
.share-app.more svg { fill: #fff; }
.share-app { position: relative; }
