:root {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  color: #211d34;
  background: #f4f3fa;
  --ink: #211d34;
  --muted: #625a73;
  --accent: #6037b3;
  --border: #dfdbea;
}

*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; }
button, select { font: inherit; }
button { cursor: pointer; }
button:disabled { cursor: default; }
button:focus-visible, select:focus-visible, a:focus-visible,
.segmented input:focus-visible + label { outline: 3px solid #946de9; outline-offset: 3px; }

.topbar { background: #211c35; color: #fff; border-bottom: 4px solid #d4c7f8; }
.topbar-inner { max-width: 73rem; min-height: 4.25rem; margin: 0 auto; padding: 0 1.5rem; display: flex; align-items: center; justify-content: space-between; }
.brand { display: flex; align-items: center; gap: .65rem; font-size: 1.55rem; font-weight: 850; letter-spacing: .12em; }
.topbar-note { color: #ded6ee; font-size: .9rem; font-weight: 550; }
.workspace { max-width: 73rem; margin: 0 auto; padding: 2.5rem 1.5rem 1.4rem; }
.intro { margin-bottom: 1.6rem; }
.intro-label { display: flex; align-items: center; gap: .48rem; color: var(--accent); font-size: .875rem; font-weight: 750; letter-spacing: .055em; }
.intro-label span { width: .5rem; height: .5rem; border: 2px solid var(--accent); border-radius: 2px; transform: rotate(45deg); }
h1 { margin: .32rem 0 .48rem; font-size: clamp(2.6rem, 6vw, 4.25rem); font-weight: 850; line-height: 1.04; letter-spacing: -.055em; }
h1 span { color: #6d46c0; }
.intro p { margin: 0; color: var(--muted); font-size: 1.05rem; line-height: 1.55; }

.editor { display: grid; grid-template-columns: minmax(0, 1fr) minmax(17rem, 22rem); gap: 1rem; align-items: stretch; }
.panel { min-width: 0; background: #fff; border: 1px solid var(--border); border-radius: 1.15rem; overflow: hidden; box-shadow: 0 12px 28px #32214c09; }
.panel-heading { display: flex; align-items: center; justify-content: space-between; min-height: 3.5rem; padding: .7rem 1.1rem; border-bottom: 1px solid #edeaf3; }
h2 { margin: 0; font-size: 1rem; font-weight: 750; }
.chip { padding: .25rem .55rem; border-radius: .4rem; background: #efe8fb; color: #503189; font-size: .875rem; font-weight: 720; font-variant-numeric: tabular-nums; }
.viewer { display: flex; flex-direction: column; }
.stage { flex: 1; min-height: 25.5rem; display: grid; place-items: center; padding: 1.4rem; background-color: #171626; background-image: radial-gradient(#827b9b45 1px, transparent 1px); background-size: 16px 16px; }
.frame { position: relative; display: grid; place-items: center; width: min(100%, 34rem); aspect-ratio: 16/9; overflow: hidden; border: 1px solid #82769a; border-radius: .6rem; background: #252138; color: #e4dcf7; }
.frame[data-ratio='portrait'] { width: min(100%, 12.6rem); aspect-ratio: 9/16; }
.frame[data-ratio='square'] { width: min(100%, 21.3rem); aspect-ratio: 1; }
.frame canvas { display: block; width: 100%; height: 100%; position: absolute; inset: 0; }
.empty { display: grid; justify-items: center; gap: .68rem; padding: .6rem; text-align: center; }
.empty svg { color: #b9a9e3; }
.empty p { margin: 0; font-weight: 600; font-size: .9375rem; }
.viewer-footer { display: flex; justify-content: space-between; gap: .4rem; padding: .9rem 1.05rem; color: var(--muted); font-size: .875rem; font-variant-numeric: tabular-nums; }
.separator { margin: 0 .18rem; }

.settings-body { display: grid; gap: .95rem; padding: 1.05rem; }
.dropzone { padding: 1rem .4rem .86rem; border: 1.5px dashed #b6a4d8; border-radius: .83rem; background: #f8f5fd; text-align: center; }
.dropzone.is-over { background: #eee4ff; border-color: #6a43c3; }
.dropzone > svg { margin-bottom: .4rem; color: #764cbd; display: inline-block; }
.file-button { display: block; margin: 0 auto; color: #51299d; background: #fff; border: 1px solid #d4c3eb; border-radius: .55rem; padding: .55rem .76rem; font-size: .94rem; font-weight: 740; }
.file-button:hover:not(:disabled) { background: #f1e9fc; }
.file-name { margin: .48rem 0 .16rem; color: var(--muted); font-size: .875rem; overflow-wrap: anywhere; }
.file-name.has-file { color: #39276a; font-weight: 680; }
.file-formats { margin: 0; color: var(--muted); font-size: .8rem; }
.sample-button { justify-self: center; background: none; border: none; padding: 0 .3rem .15rem; color: #5b369e; font-size: .875rem; font-weight: 660; text-decoration: underline; text-underline-offset: .18em; }
.sample-button:disabled { color: #797486; }
.ratio-field { margin: 0; padding: 0; border: 0; }
.ratio-field legend, .duration-row label { color: var(--ink); font-size: .925rem; font-weight: 700; }
.segmented { display: grid; grid-template-columns: repeat(3, 1fr); gap: .2rem; padding: .19rem; margin-top: .45rem; border-radius: .55rem; background: #efedf5; }
.segmented input { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }
.segmented label { display: grid; place-items: center; min-height: 2.15rem; border: 1px solid transparent; color: var(--muted); font-weight: 650; font-size: .9rem; border-radius: .4rem; cursor: pointer; }
.segmented input:checked + label { background: #fff; border-color: #dacdf0; color: #4b2693; box-shadow: 0 1px 4px #341d5410; }
.segmented input:disabled + label { cursor: default; }
.duration-row { display: flex; align-items: center; justify-content: space-between; gap: .55rem; }
.select-wrap { position: relative; }
.select-wrap::after { content: ''; position: absolute; right: .7rem; top: .75rem; width: .42rem; height: .42rem; transform: rotate(45deg); border-right: 1.5px solid #675a7b; border-bottom: 1.5px solid #675a7b; pointer-events: none; }
select { appearance: none; min-height: 2.25rem; border: 1px solid var(--border); border-radius: .45rem; background: #fff; color: var(--ink); padding: .35rem 1.45rem .35rem .55rem; font-size: .875rem; font-weight: 650; }
.actions { display: grid; gap: .45rem; }
.primary { min-height: 2.75rem; display: grid; place-items: center; border: 1px solid transparent; border-radius: .6rem; background: #6339b9; color: #fff; font-weight: 750; text-decoration: none; text-align: center; }
.primary:hover:not(:disabled) { background: #5428a5; }
.primary:disabled { background: #ece8f1; color: #62596e; }
.download { background: #2b2250; }
progress { width: 100%; height: .45rem; accent-color: #6339b9; }
.status { min-height: 1.1rem; margin: 0; color: var(--muted); font-size: .875rem; line-height: 1.3; }
.status.is-error { color: #a02443; }
.privacy { display: flex; align-items: center; gap: .45rem; color: var(--muted); margin: 1.05rem 0 0; font-size: .875rem; line-height: 1.4; }
.privacy svg { flex: 0 0 17px; }

@media (max-width: 760px) {
  .editor { grid-template-columns: 1fr; }
  .settings { grid-row: 1; }
  .stage { min-height: 17rem; }
  .frame { width: min(100%, 26rem); }
  .frame[data-ratio='square'] { width: min(100%, 17rem); }
  .frame[data-ratio='portrait'] { width: min(100%, 10rem); }
}

@media (max-width: 390px) {
  .topbar-inner { padding: 0 .85rem; }
  .workspace { padding: 1.6rem .85rem 1.25rem; }
  .viewer-footer { padding-inline: .7rem; }
}
