.app .wrap.wide { width: calc(100% - 40px); max-width: none; }
.center { text-align: center; }
.muted { color: var(--muted); font-weight: 500; }
.error { color: var(--danger); font-size: 14px; margin: 12px 0 0; }
.hint { color: var(--muted); font-size: 13px; margin: -4px 0 10px; }

/* ---------- Upload ---------- */
.upload-view { max-width: 720px; padding: 64px 0; text-align: center; }
h1.small { font-size: clamp(30px, 4.5vw, 44px); margin-bottom: 8px; }
.upload-view .lead { margin-inline: auto; font-size: 17px; }
.drop { display: block; margin-top: 28px; border: 2px dashed var(--line); border-radius: 20px; background: var(--bg-2); padding: 64px 24px; cursor: pointer; transition: border-color 0.15s, background 0.15s; }
.drop:hover, .drop.over { border-color: var(--accent); background: #17171f; }
.drop-inner { display: grid; justify-items: center; gap: 6px; color: var(--muted); }
.drop-inner svg { color: var(--accent); margin-bottom: 6px; }
.drop-inner strong { color: var(--text); font-size: 20px; font-family: var(--heading); }
.drop.disabled { pointer-events: none; opacity: 0.5; }

.progress-box { margin-top: 20px; text-align: left; }
.progress-label { display: flex; justify-content: space-between; font-size: 14px; color: var(--muted); margin-bottom: 6px; }
.bar { height: 8px; background: var(--bg-3); border-radius: 99px; overflow: hidden; }
.bar i { display: block; height: 100%; width: 0; background: var(--accent); border-radius: 99px; transition: width 0.25s; }

/* ---------- Editor ---------- */
.editor { display: grid; grid-template-columns: 1fr 400px; height: calc(100vh - 65px); }
@media (max-width: 900px) { .editor { grid-template-columns: 1fr; height: auto; } }
.stage { display: grid; place-items: center; padding: 20px; background: #070709; min-height: 0; }
.player { position: relative; width: 100%; height: calc(100vh - 105px); min-height: 0; display: grid; place-items: center; }
@media (max-width: 900px) { .player { height: 60vh; } }
.player video { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; background: #000; border-radius: 10px; }
.cap-layer { position: absolute; pointer-events: none; overflow: hidden; }
.cap { position: absolute; left: 50%; transform: translate(-50%, -50%); width: 88%; text-align: center; line-height: 1.12; white-space: normal; overflow-wrap: anywhere; }
.cap .w { display: inline-block; margin-inline: 0.1em; transition: transform 0.08s; }
.cap.box { width: auto; max-width: 88%; padding: 0.08em 0.35em; border-radius: 0.12em; }

.panel { border-left: 1px solid var(--line); background: var(--bg-2); display: flex; flex-direction: column; min-height: 0; }
@media (max-width: 900px) { .panel { border-left: 0; border-top: 1px solid var(--line); } }
.group { padding: 16px 18px; border-bottom: 1px solid var(--line); }
.group.grow { flex: 1; min-height: 160px; display: flex; flex-direction: column; }
.group.row { display: flex; align-items: flex-end; justify-content: space-between; gap: 12px; }
.label { font: 700 12px var(--body); text-transform: uppercase; letter-spacing: 0.08em; color: var(--muted); margin: 0 0 10px; }
.row.tight { display: flex; gap: 8px; align-items: center; }
.grow { flex: 1; }

.styles { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.style-btn { height: 64px; border-radius: 10px; border: 1px solid var(--line); background: linear-gradient(160deg, #2b2440, #15151d); color: #fff; cursor: pointer; display: grid; place-items: center; padding: 4px; overflow: hidden; }
.style-btn span { font-size: 15px; white-space: nowrap; }
.style-btn[aria-pressed="true"] { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent) inset; }

.seg { display: inline-flex; background: var(--bg-3); border-radius: 10px; padding: 3px; }
.seg button { border: 0; background: none; color: var(--muted); font: 600 13px var(--body); padding: 7px 12px; border-radius: 8px; cursor: pointer; text-transform: capitalize; }
.seg button[aria-pressed="true"] { background: var(--text); color: #111; }
.toggle { display: inline-flex; align-items: center; gap: 8px; font: 700 12px var(--body); letter-spacing: 0.05em; color: var(--muted); cursor: pointer; padding-bottom: 8px; }
.toggle input { accent-color: var(--accent); width: 16px; height: 16px; }

select { flex: 1; min-width: 0; background: var(--bg-3); color: var(--text); border: 1px solid var(--line); border-radius: 10px; padding: 9px 10px; font: 14px var(--body); }
.btn.ghost { background: none; }

.lines { list-style: none; margin: 0; padding: 0; overflow: auto; flex: 1; min-height: 0; display: grid; align-content: start; gap: 2px; }
.lines li { display: grid; grid-template-columns: 52px 1fr; gap: 8px; align-items: start; padding: 6px 6px; border-radius: 8px; }
.lines li.active { background: rgba(255, 230, 0, 0.08); }
.lines .t { font: 12px ui-monospace, Consolas, monospace; color: var(--muted); background: none; border: 0; cursor: pointer; padding: 3px 0; text-align: left; }
.lines .t:hover { color: var(--accent); }
.lines [contenteditable] { outline: none; padding: 2px 6px; border-radius: 6px; font-size: 14px; }
.lines [contenteditable]:focus { background: var(--bg-3); box-shadow: 0 0 0 1px var(--line) inset; }
.empty { color: var(--muted); font-size: 14px; padding: 8px 0; }

.export { padding: 16px 18px; border-top: 1px solid var(--line); background: var(--bg-2); }
.export .note { margin: 10px 0 0; font-size: 13px; }

/* ---------- Busy overlay ---------- */
.busy { position: fixed; inset: 0; z-index: 50; background: rgba(11, 11, 15, 0.9); display: grid; place-content: center; justify-items: center; text-align: center; gap: 4px; }
.busy p { margin: 0; }
#busyText { font-family: var(--heading); font-size: 20px; margin-top: 18px; }
.spinner { width: 48px; height: 48px; border-radius: 50%; border: 4px solid var(--bg-3); border-top-color: var(--accent); animation: spin 0.8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .spinner { animation-duration: 2.5s; } }

/* ---------- Motion ---------- */
.upload-view > * { animation: fadeUp 0.6s cubic-bezier(.2,.8,.2,1) both; }
.upload-view > :nth-child(2) { animation-delay: 0.06s; }
.upload-view > :nth-child(3) { animation-delay: 0.12s; }
.drop { transition: border-color 0.2s, background 0.2s, transform 0.2s; }
.drop:hover, .drop.over { transform: translateY(-2px); }
.drop.over .drop-inner svg { animation: bob 0.8s ease-in-out infinite; }
@keyframes bob { 50% { transform: translateY(-6px); } }
.editor { animation: fadeUp 0.45s cubic-bezier(.2,.8,.2,1) both; }
.style-btn { transition: transform 0.15s, border-color 0.2s, box-shadow 0.2s; }
.style-btn:hover { transform: translateY(-2px); border-color: #45455c; }
.style-btn[aria-pressed="true"] { transform: translateY(-2px); }
.seg button { transition: background 0.2s, color 0.2s; }
.seg button:hover:not([aria-pressed="true"]) { color: var(--text); }
.lines li { transition: background 0.2s; }
.lines li:hover { background: rgba(255, 255, 255, 0.03); }
.bar i { position: relative; overflow: hidden; }
.bar i::after { content: ""; position: absolute; inset: 0; background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.5), transparent); animation: shimmer 1.2s linear infinite; }
@keyframes shimmer { from { transform: translateX(-100%); } to { transform: translateX(100%); } }
#downloadBtn:not([hidden]) { animation: pop 0.4s cubic-bezier(.2,1.4,.4,1) both; }
@keyframes pop { from { transform: scale(0.9); opacity: 0; } to { transform: none; opacity: 1; } }
