/* Frame Studio — warm paper, ink, terracotta and slate. All assets are local. */
*, *::before, *::after { box-sizing: border-box; }
* { margin: 0; padding: 0; }
:root {
  color-scheme: light;
  --bg: #f6f3ed; --surface: #fffdf9; --surface-soft: #eeebe4;
  --text: #1c2b32; --muted: #596971; --border: #dcded7; --control-border: #88949a;
  --accent: #b94732; --accent-soft: #f7e8e1; --on-accent: #fffdf9;
  --blue: #315f79; --blue-soft: #e4edf2; --green: #2f7059; --green-soft: #e7f0e9;
  --red: #b03132; --error-soft: #fae9e6; --shadow: 0 16px 44px #20313a0b;
  --mono: ui-monospace, 'SFMono-Regular', Consolas, 'Liberation Mono', monospace;
  --sans: 'Segoe UI', system-ui, -apple-system, BlinkMacSystemFont, Arial, sans-serif;
  --r: 20px;
  /* Template aliases retained for existing result fragments and privacy links. */
  --cyan: var(--accent); --yellow: var(--accent); --magenta: var(--accent);
}
[data-theme="dark"] {
  color-scheme: dark;
  --bg: #141e24; --surface: #1c2931; --surface-soft: #23333d;
  --text: #f4f2eb; --muted: #b5c1c7; --border: #3b4b53; --control-border: #718792;
  --accent: #ffac91; --accent-soft: #392d2c; --on-accent: #30211d;
  --blue: #a2cce1; --blue-soft: #243c49; --green: #a0d1b8; --green-soft: #263e35;
  --red: #ffb0a8; --error-soft: #432a2c; --shadow: 0 16px 44px #00000020;
}
html { scroll-behavior: smooth; scroll-padding-top: 100px; }
body { min-height: 100vh; display: flex; flex-direction: column; background: var(--bg); color: var(--text); font: 15px/1.6 var(--sans); -webkit-font-smoothing: antialiased; }
button, input, select { font: inherit; }
a { color: inherit; }
svg { display: block; }
img { display: block; max-width: 100%; height: auto; }
button, a, select, input { -webkit-tap-highlight-color: transparent; }
button { cursor: pointer; }
:focus-visible { outline: 3px solid var(--blue); outline-offset: 4px; }
.skip-link { position: fixed; top: 10px; inset-inline-start: 16px; z-index: 200; padding: 10px 18px; background: var(--text); color: var(--surface); border-radius: 10px; transform: translateY(-160%); }
.skip-link:focus { transform: translateY(0); }
header { position: sticky; top: 0; z-index: 100; border-bottom: 1px solid var(--border); background: var(--bg); }
.header-inner { max-width: 1248px; margin: auto; min-height: 80px; padding: 12px 32px; display: flex; align-items: center; justify-content: space-between; gap: 24px; }
.logo { display: flex; align-items: center; gap: 11px; text-decoration: none; min-width: 0; }
.logo-box { width: 39px; height: 39px; flex-shrink: 0; border-radius: 12px; display: grid; place-items: center; color: var(--on-accent); background: var(--accent); }
.logo-box svg { width: 23px; height: 23px; }
.logo-name { font-weight: 750; font-size: 19px; letter-spacing: -.6px; line-height: 1.3; overflow-wrap: anywhere; unicode-bidi: isolate; }
.logo-dot { color: var(--muted); font-weight: 450; }
.header-nav { display: flex; align-items: center; gap: 28px; }
.header-nav a { display: inline-flex; align-items: center; min-height: 44px; white-space: nowrap; text-decoration: none; font-size: 13px; font-weight: 600; color: var(--muted); padding: 8px 0; }
.header-nav a:hover, .header-nav a.active { color: var(--accent); }
.header-right { display: flex; gap: 8px; flex-shrink: 0; }
.lang-select, .theme-toggle { min-height: 44px; border: 1px solid var(--control-border); border-radius: 11px; color: var(--text); background: var(--surface); }
.lang-select { font: 600 12px var(--sans); padding: 0 9px; cursor: pointer; }
.theme-toggle { width: 44px; font-size: 22px; line-height: 1; }
.theme-toggle:hover, .lang-select:hover { border-color: var(--accent); }
main { flex: 1; width: 100%; max-width: 1248px; margin: 0 auto; padding: 52px 32px 72px; }
.hero { display: grid; grid-template-columns: minmax(0, 1.05fr) minmax(0, 1fr); gap: 52px; align-items: center; margin-bottom: 58px; }
.hero-copy { min-width: 0; }
.eyebrow { display: inline-flex; align-items: center; gap: 9px; font-size: 11px; font-weight: 700; letter-spacing: .12em; text-transform: uppercase; color: var(--muted); margin-bottom: 18px; }
.eyebrow-dot { width: 7px; height: 7px; background: var(--accent); border-radius: 50%; }
.hero h1 { font-size: clamp(42px, 5.3vw, 70px); line-height: 1.06; font-weight: 780; letter-spacing: -.055em; margin-bottom: 19px; }
.hero h1 > span { display: block; }
.hero h1 .y, .y { color: var(--accent); }
.hero-lede { font-size: 19px; line-height: 1.6; margin-bottom: 14px; color: var(--text); max-width: 32ch; }
.hero-description { font-size: 12px; line-height: 1.9; color: var(--muted); max-width: 54ch; }
.hero-description strong { color: var(--text); font-weight: 650; }
.hero-tags { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 20px; }
.hero-tags span, .badge { font-size: 11px; font-weight: 650; padding: 5px 11px; border-radius: 7px; background: var(--surface-soft); color: var(--muted); }
.hero-tags span:first-child { color: var(--accent); background: var(--accent-soft); }
.frame-gallery { position: relative; padding: 20px 22px; isolation: isolate; min-width: 0; }
.frame-gallery::before { content: ''; position: absolute; z-index: -1; inset: 0; border-radius: 40% 12% 15% 13%; background: var(--blue-soft); transform: rotate(-4deg); }
.frame-window { padding: 10px; background: var(--surface); border: 1px solid var(--border); border-radius: 16px; box-shadow: 0 18px 30px #20313a18; transform: rotate(2deg); }
.frame-window-top { display: flex; align-items: center; justify-content: space-between; margin: 2px 4px 10px; color: var(--muted); font: 10px var(--mono); }
.frame-dots { display: flex; gap: 5px; }
.frame-dots i { height: 5px; width: 5px; border-radius: 50%; background: var(--border); }
.frame-window img { width: 100%; aspect-ratio: 2.1; object-fit: cover; border-radius: 8px; }
.frame-selection { position: relative; }
.frame-selection::after { content: ''; position: absolute; inset: 10px; border: 1px solid #fff9efaa; border-radius: 3px; }
.frame-strip { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; margin: 17px -2px -8px; transform: rotate(-3deg); }
.frame-tile { padding: 5px; background: var(--surface); border: 1px solid var(--border); border-radius: 9px; box-shadow: 0 8px 15px #20313a12; }
.frame-tile img { width: 100%; height: 57px; object-fit: cover; border-radius: 4px; }
.frame-tile:nth-child(1) img { object-position: 10% center; }
.frame-tile:nth-child(2) img { object-position: 50% center; }
.frame-tile:nth-child(3) img { object-position: 90% center; }
.frame-tile span { display: block; text-align: center; color: var(--muted); font: 9px var(--mono); margin-top: 5px; }
.section-intro { display: flex; justify-content: space-between; align-items: flex-end; gap: 20px; margin-bottom: 18px; }
.section-intro h2 { flex: 1; min-width: 0; font-size: 23px; font-weight: 720; letter-spacing: -.65px; line-height: 1.35; }
.section-intro p { font-size: 13px; color: var(--muted); }
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--r); box-shadow: var(--shadow); min-width: 0; }
.editor-shell { display: grid; grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr); margin-bottom: 14px; overflow: hidden; }
.editor-input { padding: 25px; min-width: 0; }
.editor-settings { padding: 25px; background: var(--surface-soft); border-inline-start: 1px solid var(--border); min-width: 0; }
.card-head { display: flex; align-items: center; gap: 10px; color: var(--text); font-size: 12px; font-weight: 700; letter-spacing: .035em; margin-bottom: 18px; }
.step-number { display: inline-grid; place-items: center; min-width: 27px; height: 27px; font: 10px var(--mono); background: var(--surface-soft); border: 1px solid var(--border); border-radius: 8px; color: var(--muted); }
.editor-settings .step-number { background: var(--surface); }
.upload-zone { position: relative; border: 1.5px dashed #b6c1c4; border-radius: 15px; text-align: center; min-height: 302px; padding: 26px 20px; display: flex; align-items: center; justify-content: center; cursor: pointer; background: var(--bg); transition: border-color .18s, background .18s; }
.upload-zone:hover, .upload-zone.drag-over { border-color: var(--accent); background: var(--accent-soft); }
.upload-zone:focus-within { outline: 3px solid var(--blue); outline-offset: 4px; }
.upload-zone input[type="file"] { position: absolute; inset: 0; width: 100%; height: 100%; opacity: 0; cursor: pointer; z-index: 2; }
#upload-placeholder { display: flex; flex-direction: column; align-items: center; gap: 12px; pointer-events: none; width: 100%; min-width: 0; }
.upload-icon { color: var(--accent); width: 55px; height: 55px; display: grid; place-items: center; border-radius: 16px; background: var(--accent-soft); margin-bottom: 3px; }
.upload-icon svg { width: 27px; height: 27px; }
.upload-title { font-size: 17px; font-weight: 650; line-height: 1.5; }
.upload-browse { padding: 9px 20px; border: 1px solid var(--border); background: var(--surface); font-size: 12px; font-weight: 650; border-radius: 9px; color: var(--text); }
.upload-meta { color: var(--muted); font: 10px/1.8 var(--mono); margin-top: 3px; }
#thumb-state { flex-direction: column; align-items: stretch; gap: 14px; width: 100%; pointer-events: none; min-width: 0; }
#thumb-wrap { position: relative; width: 100%; height: 175px; overflow: hidden; background: var(--surface-soft); border-radius: 10px; }
#thumb-video { display: block; width: 100%; height: 100%; object-fit: contain; }
.thumb-loading { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; font-size: 22px; background: var(--surface-soft); color: var(--muted); }
.thumb-info { min-width: 0; text-align: start; }
.thumb-filename { font-size: 13px; font-weight: 650; overflow-wrap: anywhere; line-height: 1.5; }
.thumb-meta, .thumb-hint { font-size: 11px; color: var(--muted); margin-top: 4px; overflow-wrap: anywhere; }
.editor-note { display: flex; align-items: flex-start; gap: 8px; margin-top: 14px; color: var(--muted); font-size: 11px; line-height: 1.7; }
.editor-note svg { width: 16px; height: 16px; flex-shrink: 0; margin-top: 2px; }
.controls { display: grid; gap: 13px; }
.ctrl label { display: block; font-size: 12px; color: var(--text); font-weight: 650; margin-bottom: 6px; }
.ctrl select { display: block; width: 100%; height: 44px; padding: 0 11px; background: var(--surface); color: var(--text); border: 1px solid var(--control-border); border-radius: 9px; font-size: 13px; cursor: pointer; }
.ctrl-hint { display: block; margin-top: 4px; font-size: 11px; color: var(--muted); line-height: 1.6; }
.trim-section { margin-top: 24px; padding-top: 22px; border-top: 1px solid var(--border); }
.trim-heading { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 16px; }
.trim-heading .card-head { margin: 0; }
.segment-duration { font: 10px var(--mono); white-space: nowrap; color: var(--accent); background: var(--accent-soft); border-radius: 6px; padding: 6px 8px; }
.trim-row { display: grid; grid-template-columns: 40px minmax(0, 1fr) 112px; gap: 10px; align-items: center; margin-bottom: 13px; }
.trim-row label { font-size: 11px; color: var(--muted); }
.trim-row input[type="range"] { width: 100%; min-width: 0; accent-color: var(--accent); height: 44px; cursor: pointer; }
.trim-time { width: 100%; min-width: 0; height: 44px; font: 11px var(--mono); text-align: center; color: var(--text); background: var(--bg); border: 1px solid var(--control-border); border-radius: 8px; padding: 0 4px; }
.trim-bar { height: 5px; position: relative; overflow: hidden; border-radius: 5px; background: var(--border); margin: 4px 0 10px; }
.trim-fill { position: absolute; top: 0; height: 100%; max-width: 100%; border-radius: 5px; background: var(--accent); }
.trim-help { text-align: start; font-size: 10px; line-height: 1.8; }
.est-wrap { margin-top: 14px; }
.est-info { padding: 10px 12px; border-radius: 9px; color: var(--muted); background: var(--surface); border: 1px solid var(--border); font-size: 11px; line-height: 1.6; overflow-wrap: anywhere; }
.est-info strong { color: var(--accent); }
.submit-wrap { margin-top: 18px; }
.btn-submit { width: 100%; min-height: 50px; display: flex; align-items: center; justify-content: center; gap: 10px; padding: 12px 16px; border: 1px solid transparent; border-radius: 11px; background: var(--accent); color: var(--on-accent); font-size: 13px; font-weight: 700; line-height: 1.5; box-shadow: 0 5px 12px #b9473212; transition: transform .18s, box-shadow .18s; }
.btn-submit svg { width: 17px; height: 17px; flex-shrink: 0; }
.btn-submit:hover:not(:disabled) { transform: translateY(-1px); box-shadow: 0 8px 16px #b9473220; }
.btn-submit:disabled { cursor: not-allowed; background: var(--border); color: var(--muted); box-shadow: none; }
button:disabled, select:disabled, input:disabled { cursor: wait; }
.progress-section { padding-top: 18px; }
.progress-content { color: var(--muted); font-size: 12px; }
.progress-bar-track { height: 5px; overflow: hidden; border-radius: 5px; background: var(--border); margin-bottom: 10px; }
.progress-bar-fill { height: 100%; width: 2%; background: var(--accent); border-radius: 5px; }
.progress-label { overflow-wrap: anywhere; }
.progress-timer { color: var(--accent); font: 10px var(--mono); margin-top: 5px; }
.result-section { grid-column: 1 / -1; padding: 0 25px; min-width: 0; }
.result-section:not(:empty) { padding-top: 24px; padding-bottom: 24px; border-top: 1px solid var(--border); }
.msg-error { display: flex; gap: 10px; align-items: flex-start; padding: 14px 16px; background: var(--error-soft); color: var(--red); border: 1px solid var(--red); border-radius: 12px; font-size: 12px; overflow-wrap: anywhere; }
.msg-success-multi { border: 1px solid var(--border); border-radius: 14px; overflow: hidden; background: var(--surface); }
.multi-head { display: flex; align-items: center; gap: 20px; padding: 20px; border-bottom: 1px solid var(--border); background: var(--green-soft); }
.multi-num { font-size: 43px; font-weight: 750; line-height: 1; letter-spacing: -2px; color: var(--green); overflow-wrap: anywhere; }
.multi-meta { min-width: 0; }
.multi-meta p { font-size: 13px; margin-bottom: 8px; }
.success-tags { display: flex; flex-wrap: wrap; gap: 6px; }
.success-tags span { font: 10px var(--mono); color: var(--muted); background: var(--surface); border: 1px solid var(--border); border-radius: 5px; padding: 4px 7px; }
.success-tags .tag-local { color: var(--green); background: var(--green-soft); }
.mode-indicator { display: none; font-size: 11px; padding: 9px 11px; border-radius: 8px; margin-top: 8px; overflow-wrap: anywhere; }
.mode-indicator.visible { display: block; }
.mode-indicator.local { color: var(--green); background: var(--green-soft); }
.mode-indicator.server { color: var(--blue); background: var(--blue-soft); }
.part-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 15px 20px; border-bottom: 1px solid var(--border); }
.part-row:last-child { border: 0; }
.part-info { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.part-name { font-size: 13px; font-weight: 650; }
.part-meta { font-size: 11px; color: var(--muted); overflow-wrap: anywhere; }
.part-dl { display: inline-block; flex-shrink: 0; min-height: 44px; padding: 10px 17px; border-radius: 8px; background: var(--accent); color: var(--on-accent); text-decoration: none; font-size: 11px; font-weight: 700; }
.part-dl:hover { filter: brightness(.95); }
.how-section { padding-top: 52px; margin-top: 18px; }
.how-title { font-size: 23px; font-weight: 720; letter-spacing: -.65px; margin-bottom: 20px; }
.how-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 16px; }
.how-card { min-width: 0; border-top: 1px solid var(--border); padding-top: 22px; }
.how-icon { display: grid; place-items: center; color: var(--blue); background: var(--blue-soft); border-radius: 11px; width: 37px; height: 37px; font: 11px var(--mono); margin-bottom: 15px; }
.how-card:nth-child(2) .how-icon { background: var(--accent-soft); color: var(--accent); }
.how-card:nth-child(3) .how-icon { background: var(--green-soft); color: var(--green); }
.how-head { font-size: 13px; font-weight: 700; margin-bottom: 8px; line-height: 1.5; }
.how-body p { font-size: 12px; line-height: 1.8; color: var(--muted); }
.how-body strong { font-weight: 650; color: var(--text); }
footer { border-top: 1px solid var(--border); }
.footer-inner { max-width: 1248px; margin: auto; padding: 23px 32px; display: flex; align-items: center; justify-content: space-between; gap: 20px; color: var(--muted); font-size: 12px; }
.footer-links { display: flex; gap: 20px; }
footer a { color: var(--muted); text-decoration: none; }
footer a:hover { color: var(--accent); }
.privacy-main { max-width: 900px; padding-top: 54px; }
.privacy-hero { margin-bottom: 30px; }
.privacy-hero h1 { font-size: clamp(34px, 5vw, 52px); line-height: 1.2; font-weight: 750; letter-spacing: -1.8px; margin-bottom: 12px; }
.privacy-hero p { color: var(--muted); font-size: 13px; }
.privacy-main .card { padding: 25px 30px; margin-bottom: 18px; box-shadow: none; border-radius: 14px; }
.privacy-main .card:first-of-type { background: var(--accent-soft); }
.privacy-main h3 { font-size: 13px; font-weight: 700; }
.privacy-main p { overflow-wrap: anywhere; }
.privacy-back { display: inline-block; margin-top: 15px; padding: 10px 0; color: var(--accent); text-decoration: none; font-weight: 650; }
[dir="rtl"] .hero h1 { letter-spacing: -.025em; line-height: 1.25; }
[dir="rtl"] .hero h1, [dir="rtl"] .hero-lede { font-family: Tahoma, var(--sans); }
[dir="rtl"] .hero-description { line-height: 2; }
[dir="rtl"] .eyebrow { letter-spacing: 0; }
[dir="rtl"] .frame-gallery { direction: ltr; }
/* Optional ads inherit the same surfaces and never change the main editor width. */
.ad-slot { width: 100%; max-width: 800px; margin: 20px auto; padding: 0 24px; text-align: center; }
.ad-label { display: block; margin-bottom: 6px; font: 10px var(--mono); color: var(--muted); }
.ad-box { min-height: 90px; display: flex; align-items: center; justify-content: center; overflow: hidden; background: var(--surface); border: 1px solid var(--border); border-radius: 12px; }
.ad-box > * { max-width: 100%; }
.ad-mid .ad-box { min-height: 250px; }
.ad-slot:has(ins[data-ad-status="unfilled"]) { display: none; }
.ad-sticky { display: none; }
.ad-close { position: absolute; top: -29px; inset-inline-end: 10px; width: 30px; height: 30px; border: 1px solid var(--border); background: var(--surface); color: var(--text); border-radius: 8px 8px 0 0; }
@media (min-width: 1600px) { main { padding-top: 70px; } .hero { margin-bottom: 70px; } }
@media (max-width: 1000px) {
  .header-nav { gap: 18px; }
  .hero { gap: 25px; }
  .frame-gallery { padding: 15px; }
  .editor-input, .editor-settings { padding: 21px; }
  .how-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 24px; }
}
@media (max-width: 900px) {
  .header-inner { flex-wrap: wrap; gap: 8px 16px; }
  .header-nav { order: 3; width: 100%; justify-content: center; }
}
@media (max-width: 760px) {
  .header-inner { min-height: 72px; padding: 12px 22px; flex-wrap: wrap; gap: 8px 16px; }
  .header-nav { order: 3; width: 100%; justify-content: center; gap: 28px; }
  .header-nav a { font-size: 12px; padding: 6px 0; }
  main { padding: 36px 22px 50px; }
  .hero { gap: 20px; margin-bottom: 36px; grid-template-columns: minmax(0, 1fr); }
  .hero h1 { font-size: clamp(42px, 8.5vw, 62px); }
  .hero-lede { max-width: none; font-size: 17px; }
  .hero-description { max-width: none; }
  .frame-gallery { max-width: 480px; width: 100%; margin: 8px auto 2px; padding: 16px 22px; }
  .frame-window img { aspect-ratio: 2.8; }
  .frame-tile img { height: 45px; }
  .section-intro { align-items: flex-start; flex-direction: column; gap: 5px; }
  .section-intro h2 { font-size: 21px; }
  .editor-shell { grid-template-columns: minmax(0, 1fr); }
  .editor-settings { border-inline-start: none; border-top: 1px solid var(--border); }
  .upload-zone { min-height: 245px; }
  .result-section { grid-column: 1; padding-inline: 21px; }
  .how-section { padding-top: 34px; }
  .footer-inner { padding: 20px 22px; }
  .ad-sticky { display: block; position: fixed; inset-inline: 0; bottom: 0; z-index: 60; max-width: none; margin: 0; padding: 6px 8px calc(6px + env(safe-area-inset-bottom, 0px)); background: var(--surface); border-top: 1px solid var(--border); }
  .ad-sticky .ad-label { display: none; }
  .ad-sticky .ad-box { min-height: 50px; border: 0; background: transparent; }
  body.has-sticky-ad { padding-bottom: 75px; }
}
@media (max-width: 430px) {
  .header-inner { padding: 12px 16px; gap: 9px; }
  .logo { gap: 7px; max-width: calc(100% - 107px); }
  .logo-name { font-size: 16px; }
  .logo-box { width: 33px; height: 33px; border-radius: 10px; }
  .header-right { gap: 6px; }
  .lang-select { padding-inline: 6px; }
  .theme-toggle { width: 44px; }
  .header-nav { flex-wrap: wrap; gap: 4px 20px; }
  main { padding: 30px 16px 40px; }
  .hero { margin-bottom: 30px; gap: 14px; }
  .eyebrow { font-size: 10px; margin-bottom: 14px; }
  .hero h1 { font-size: 44px; letter-spacing: -.05em; }
  .hero-lede { font-size: 16px; }
  .hero-description { font-size: 11px; }
  .hero-tags { gap: 6px; margin-top: 14px; }
  .hero-tags span { font-size: 10px; padding: 4px 8px; }
  .frame-gallery { display: none; }
  .frame-strip { gap: 7px; margin-top: 12px; }
  .frame-tile img { height: 34px; }
  .editor-input, .editor-settings { padding: 18px; }
  .upload-zone { min-height: 240px; padding: 22px 12px; }
  .upload-title { font-size: 15px; }
  .upload-meta { font-size: 9px; }
  .trim-heading { align-items: flex-start; flex-direction: column; gap: 8px; }
  .trim-row { grid-template-columns: 32px minmax(0, 1fr) 96px; gap: 7px; }
  .trim-time { font-size: 10px; }
  .how-grid { grid-template-columns: minmax(0, 1fr); gap: 22px; }
  .how-card { display: flex; align-items: flex-start; gap: 14px; }
  .how-icon { flex-shrink: 0; margin: 0; }
  .footer-inner { align-items: flex-start; flex-direction: column; gap: 10px; padding: 20px 16px; }
  .multi-head { gap: 12px; padding: 16px; }
  .multi-num { font-size: 34px; }
  .part-row { flex-wrap: wrap; padding: 14px 16px; }
  .privacy-main .card { padding: 20px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; scroll-behavior: auto !important; }
}
