/*
  Video Enhancer page. Uses only the site's existing tokens (colors, radii, shadows, easing) from style.css
  and reuses .panel / .btn / .field / .alert / .kv / .table / .tab. Everything here is prefixed ve- / cmp-.
*/

.ve .panel + .panel { margin-top: 22px; }
.ve-actions { margin-top: 22px; }

/* ---- step indicator ---- */
.ve-steps { list-style: none; margin: 0 0 22px; padding: 0; display: flex; gap: 10px; flex-wrap: wrap; justify-content: center; }
.ve-steps li {
  display: inline-flex; align-items: center; gap: 9px; padding: 8px 16px 8px 12px; border-radius: 999px;
  font-size: .84rem; font-weight: 700; color: var(--ink-3);
  background: linear-gradient(180deg, var(--surface-2), var(--surface-1));
  box-shadow: inset 0 1px 0 var(--bevel-hi), inset 0 -2px #00000080;
}
.ve-step-n {
  width: 24px; height: 24px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center;
  font-family: var(--font-display); font-size: .86rem; background: var(--bg-1); box-shadow: var(--etch);
}
.ve-steps li.is-active { color: var(--accent-ink); background: linear-gradient(180deg, var(--accent-hi), var(--accent) 65%, #93a400); box-shadow: inset 0 2px #ffffff8c, 0 4px 0 var(--accent-lo); }
.ve-steps li.is-active .ve-step-n { background: #0b0f0033; box-shadow: none; color: var(--accent-ink); }
.ve-steps li.is-done { color: var(--ink-1); }
.ve-steps li.is-done .ve-step-n:after { content: "✓"; }
.ve-steps li.is-done .ve-step-n { font-size: 0; }
.ve-steps li.is-done .ve-step-n:after { font-size: .85rem; color: var(--good); }

/* ---- status strip ---- */
.ve-status { padding: 16px 20px; }
.ve-status-row { display: flex; flex-wrap: wrap; gap: 10px 14px; align-items: center; }
.ve-pill { display: inline-flex; align-items: center; gap: 8px; font-size: .8rem; color: var(--ink-2); padding: 6px 13px; border-radius: 999px; background: linear-gradient(180deg, var(--surface-3), var(--surface-1)); box-shadow: inset 0 1px 0 var(--bevel-hi), inset 0 -1px #00000080; }
.ve-pill b { color: var(--ink-1); font-weight: 700; }
.ve-pill.is-on { color: var(--good); }
.ve-pill.is-off { color: var(--ink-3); }
.ve-pill .ve-mark { font-family: var(--font-display); }

/* ---- drop zone ---- */
.ve-drop {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 8px; text-align: center; cursor: pointer;
  padding: 44px 22px; border-radius: var(--radius-lg);
  background: linear-gradient(180deg, var(--bg-1), var(--surface-1)); box-shadow: var(--etch);
  outline: 2px dashed var(--ink-4); outline-offset: -10px; transition: outline-color .2s var(--ease), box-shadow .2s var(--ease);
}
.ve-drop:hover, .ve-drop:focus-visible, .ve-drop.is-over { outline-color: var(--accent); box-shadow: var(--etch), 0 0 40px -18px var(--accent-glow); }
.ve-drop.is-disabled { opacity: .5; pointer-events: none; }
.ve-drop-icon { width: 54px; height: 54px; border-radius: 16px; display: flex; align-items: center; justify-content: center; font-size: 1.4rem; color: var(--accent-ink); background: linear-gradient(160deg, var(--accent-hi), var(--accent-lo)); box-shadow: inset 0 2px #fff9, 0 5px 0 var(--accent-lo), 0 0 30px -8px var(--accent-glow); }
.ve-drop-title { font-weight: 700; font-size: 1.05rem; }
.ve-drop-hint { color: var(--ink-3); font-size: .84rem; }

/* ---- progress bars ---- */
.ve-progress { margin-top: 18px; display: flex; flex-direction: column; gap: 9px; }
.ve-progress-label { font-size: .9rem; color: var(--ink-2); display: flex; gap: 10px; align-items: baseline; flex-wrap: wrap; }
.ve-progress-meta { font-size: .78rem; }
.ve-bar { height: 12px; border-radius: 999px; overflow: hidden; background: linear-gradient(180deg, var(--bg-1), var(--surface-1)); box-shadow: var(--etch); }
.ve-bar-fill { height: 100%; width: 0; border-radius: 999px; background: linear-gradient(90deg, var(--accent-lo), var(--accent-hi)); box-shadow: 0 0 16px var(--accent-glow); transition: width .35s var(--ease); }
.ve-bar.is-indeterminate .ve-bar-fill { width: 34%; animation: ve-slide 1.5s var(--ease) infinite; }
@keyframes ve-slide { 0% { transform: translateX(-120%); } 100% { transform: translateX(320%); } }
@media (prefers-reduced-motion: reduce) { .ve-bar.is-indeterminate .ve-bar-fill { animation: none; width: 100%; opacity: .5; } }

/* ---- selected file ---- */
.ve-file { margin-top: 20px; display: grid; gap: 22px; grid-template-columns: minmax(260px, 1.1fr) 1fr; align-items: start; }
.ve-file-player video, .cmp-v { display: block; width: 100%; background: #000; border-radius: var(--radius-lg); box-shadow: var(--slab); }
.ve-file-player video { max-height: 340px; }
.ve-file-side { display: flex; flex-direction: column; gap: 14px; min-width: 0; }
.ve-file-name { font-family: var(--font-display); font-weight: 700; font-size: 1.15rem; word-break: break-word; direction: auto; }
.ve-kv { margin: 0; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); }
.ve-kv .kv-item { padding: 10px 13px; }
.ve-kv dd { margin: 4px 0 0; direction: ltr; text-align: right; font-family: var(--font-display); letter-spacing: .03em; }
.ve-kv dt { margin: 0; }
@media (max-width: 860px) { .ve-file { grid-template-columns: 1fr; } }

/* ---- presets ---- */
.ve-presets { display: grid; gap: 14px; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); }
.ve-preset {
  font: inherit; text-align: right; cursor: pointer; border: none; color: var(--ink-1); display: flex; flex-direction: column; gap: 6px;
  padding: 16px 16px 18px; border-radius: var(--radius-lg);
  background: linear-gradient(165deg, var(--surface-2), var(--bg-1)); box-shadow: var(--slab);
  transition: transform .2s var(--ease-soft), box-shadow .2s var(--ease-soft);
}
.ve-preset:hover { transform: translateY(-3px); box-shadow: var(--slab-lifted); }
.ve-preset[aria-checked="true"] { box-shadow: var(--slab), 0 0 0 2px var(--accent), 0 0 40px -16px var(--accent-glow); }
.ve-preset-name { font-family: var(--font-display); font-weight: 700; font-size: 1.1rem; display: flex; align-items: center; gap: 8px; }
.ve-preset[aria-checked="true"] .ve-preset-name:before { content: "✓"; color: var(--accent-hi); }
.ve-preset-short { font-size: .66rem; letter-spacing: .2em; color: var(--accent); direction: ltr; text-align: right; }
.ve-preset-desc { font-size: .82rem; color: var(--ink-3); line-height: 1.8; }

/* ---- plan preview ---- */
.ve-plan { margin-top: 20px; display: flex; flex-direction: column; gap: 12px; }
.ve-chips { display: flex; flex-wrap: wrap; gap: 8px; }
.ve-chip { font-size: .78rem; padding: 6px 12px; border-radius: 999px; color: var(--ink-1); background: linear-gradient(180deg, var(--surface-3), var(--surface-1)); box-shadow: inset 0 1px 0 var(--bevel-hi), inset 0 -1px #00000080; direction: ltr; }
.ve-chip small { color: var(--ink-3); margin-inline-end: 6px; direction: rtl; }
.ve-notes { margin: 0; padding: 0 20px 0 0; color: var(--ink-2); font-size: .86rem; line-height: 1.95; }
.ve-notes li::marker { color: var(--accent); }
.ve-warn { color: #ffe3b0; }
.ve-warn li::marker { color: var(--warn); }

/* ---- advanced ---- */
.ve-adv { margin-top: 20px; border-radius: var(--radius-lg); background: linear-gradient(180deg, var(--surface-1), var(--bg-1)); box-shadow: var(--etch); }
.ve-adv > summary { cursor: pointer; padding: 14px 18px; font-weight: 700; color: var(--ink-2); list-style: none; display: flex; align-items: center; justify-content: space-between; }
.ve-adv > summary::-webkit-details-marker { display: none; }
.ve-adv > summary:after { content: "＋"; color: var(--accent); }
.ve-adv[open] > summary:after { content: "－"; }
.ve-adv-body { padding: 4px 18px 18px; display: flex; flex-direction: column; gap: 18px; }
.ve-adv .field-hint.is-off { color: var(--warn); }
.ve-range { display: flex; align-items: center; gap: 12px; }
.ve-range input[type=range] { flex: 1; accent-color: var(--accent); }
.ve-range output { min-width: 44px; text-align: center; direction: ltr; font-family: var(--font-display); color: var(--accent-hi); }

/* ---- stages ---- */
.ve-stages { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); }
.ve-stages li { padding: 11px 14px; border-radius: var(--radius-md); font-size: .86rem; color: var(--ink-4); display: flex; align-items: center; gap: 10px; background: linear-gradient(180deg, var(--surface-2), var(--bg-1)); box-shadow: inset 0 1px 0 var(--bevel-hi), inset 0 -1px #00000073; }
.ve-stages .ve-dot { width: 18px; text-align: center; font-family: var(--font-display); }
.ve-stages li.is-done { color: var(--ink-2); }
.ve-stages li.is-done .ve-dot { color: var(--good); }
.ve-stages li.is-active { color: var(--accent-hi); box-shadow: inset 0 1px 0 var(--bevel-hi-strong), 0 0 0 1px var(--accent), 0 0 30px -14px var(--accent-glow); font-weight: 700; }
.ve-stages li.is-skip { opacity: .4; text-decoration: line-through; }

/* ---- compare ---- */
.cmp { display: flex; flex-direction: column; gap: 12px; direction: ltr; }
.cmp-stage { position: relative; border-radius: var(--radius-lg); overflow: hidden; background: #000; box-shadow: var(--slab); user-select: none; touch-action: pan-y; }
.cmp-stage .cmp-v { box-shadow: none; border-radius: 0; width: 100%; height: auto; }
.cmp-orig { position: relative; z-index: 1; }
.cmp-enh { position: absolute; inset: 0; z-index: 2; height: 100%; object-fit: contain; clip-path: inset(0 0 0 var(--cmp, 50%)); }
.cmp-tag { position: absolute; top: 12px; z-index: 4; font-size: .72rem; letter-spacing: .1em; padding: 5px 11px; border-radius: 999px; color: var(--ink-1); background: #080b10cc; box-shadow: inset 0 1px 0 var(--bevel-hi); pointer-events: none; font-family: var(--font-body); direction: rtl; }
.cmp-tag-orig { left: 12px; }
.cmp-tag-enh { right: 12px; color: var(--accent-hi); }
.cmp-handle { position: absolute; top: 0; bottom: 0; left: var(--cmp, 50%); z-index: 5; width: 4px; margin-left: -2px; cursor: ew-resize; background: linear-gradient(180deg, var(--accent-hi), var(--accent-lo)); box-shadow: 0 0 16px var(--accent-glow); }
.cmp-handle span { position: absolute; top: 50%; left: 50%; width: 40px; height: 40px; margin: -20px 0 0 -20px; border-radius: 50%; display: flex; align-items: center; justify-content: center; color: var(--accent-ink); font-weight: 700; background: linear-gradient(180deg, var(--accent-hi), var(--accent)); box-shadow: inset 0 2px #fff9, 0 4px 0 var(--accent-lo), 0 8px 18px -6px #000; }
.cmp-bar { display: flex; align-items: center; gap: 12px; }
.cmp-bar .player-seek { flex: 1; }
.cmp.is-split .cmp-stage { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; background: transparent; box-shadow: none; overflow: visible; }
.cmp.is-split .cmp-orig, .cmp.is-split .cmp-enh { position: relative; clip-path: none; inset: auto; border-radius: var(--radius-lg); box-shadow: var(--slab); }
.cmp.is-split .cmp-handle { display: none; }
.cmp.is-split .cmp-tag { top: 10px; }
.cmp.is-split .cmp-tag-orig { left: 20px; }
.cmp.is-split .cmp-tag-enh { right: auto; left: calc(50% + 15px); }
@media (max-width: 640px) { .cmp.is-split .cmp-stage { grid-template-columns: 1fr; } .cmp.is-split .cmp-tag-enh { left: 20px; top: auto; } }

.ve-result-plan { margin: 20px 0; }
.ve-table { min-width: 0; }
.ve-table td:not(:first-child) { direction: ltr; text-align: right; font-family: var(--font-display); }
.ve-table td.is-changed { color: var(--accent-hi); }
.ve-table td:first-child { color: var(--ink-3); }
