:root {
  --bg: #090d17;
  --panel: #0d1320;
  --panel-2: #111828;
  --border: rgba(255, 255, 255, 0.09);
  --border-strong: rgba(255, 255, 255, 0.16);
  --text: #eceff5;
  --muted: #8b93a6;
  --muted-2: #5c6479;
  --lime: #c8f24e;
  --lime-dim: rgba(200, 242, 78, 0.14);
  --lime-line: rgba(200, 242, 78, 0.35);
  --track: rgba(255, 255, 255, 0.12);
  --danger: #ff6b6b;
  --radius: 16px;
  --radius-sm: 11px;
  --mono: ui-monospace, "SF Mono", "JetBrains Mono", Menlo, Consolas, monospace;
  --sans: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  font-family: var(--sans);
  color: var(--text);
  background:
    radial-gradient(1200px 600px at 12% -10%, #131b30 0%, transparent 60%),
    radial-gradient(1000px 500px at 100% 0%, #0f1526 0%, transparent 55%),
    var(--bg);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

code {
  font-family: var(--mono);
  font-size: 0.9em;
  color: #cdd3e0;
  background: rgba(255, 255, 255, 0.06);
  padding: 1px 6px;
  border-radius: 6px;
}

.is-hidden { display: none !important; }

.wrap {
  max-width: 1280px;
  margin: 0 auto;
  padding: 40px 28px 56px;
}

/* ---------- HERO ---------- */
.hero {
  display: flex;
  gap: 32px;
  align-items: flex-start;
  justify-content: space-between;
  flex-wrap: wrap;
  margin-bottom: 34px;
}

.hero__text { max-width: 720px; }

.eyebrow {
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--muted-2);
  margin: 0 0 18px;
}

.hero__title {
  margin: 0;
  font-weight: 900;
  letter-spacing: -0.02em;
  line-height: 0.98;
  font-size: clamp(38px, 6vw, 72px);
}

.hero__line-1 { display: block; color: var(--text); }

.hero__line-2 {
  display: block;
  font-family: "Playfair Display", Georgia, serif;
  font-style: italic;
  font-weight: 600;
  color: var(--lime);
  letter-spacing: -0.01em;
}

.hero__sub {
  margin: 20px 0 0;
  max-width: 520px;
  color: var(--muted);
  font-size: 15px;
}

.notice {
  width: 320px;
  max-width: 100%;
  background: rgba(17, 24, 40, 0.7);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px 20px;
  backdrop-filter: blur(6px);
}

.notice__head {
  display: flex;
  align-items: center;
  gap: 9px;
  font-weight: 600;
  font-size: 14px;
}

.notice__mark { color: var(--lime); font-size: 13px; }

.notice__body {
  margin: 9px 0 0;
  color: var(--muted);
  font-size: 13px;
}

/* ---------- BANNER ---------- */
.banner {
  margin: 0 0 22px;
  padding: 13px 18px;
  border: 1px solid rgba(255, 107, 107, 0.4);
  background: rgba(255, 107, 107, 0.08);
  color: #ffd9d9;
  border-radius: var(--radius-sm);
  font-size: 14px;
}
.banner--hidden { display: none; }

/* ---------- GRID ---------- */
.grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 20px;
}

.panel {
  background: linear-gradient(180deg, var(--panel) 0%, #0b111d 100%);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 22px 22px 24px;
  min-width: 0;
}

.panel__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 4px;
}

.panel__eyebrow {
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.16em;
  color: var(--muted-2);
}

.panel__title {
  margin: 2px 0 20px;
  font-size: 24px;
  font-weight: 800;
  letter-spacing: -0.01em;
}

.panel__note {
  margin: 16px 0 0;
  color: var(--muted-2);
  font-size: 12.5px;
  line-height: 1.5;
}

.badge {
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.04em;
  padding: 5px 10px;
  border-radius: 999px;
  border: 1px solid var(--border);
  color: var(--muted);
  white-space: nowrap;
}
.badge--ok { color: var(--lime); border-color: var(--lime-line); background: var(--lime-dim); }

.linkbtn {
  background: none;
  border: none;
  color: var(--text);
  font-family: var(--sans);
  font-size: 13px;
  cursor: pointer;
  text-decoration: underline;
  text-underline-offset: 3px;
  padding: 4px;
}
.linkbtn:hover { color: var(--lime); }

.subhead {
  margin: 22px 0 12px;
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.01em;
}
.subhead--tight { margin-top: 24px; }

/* ---------- DROPZONE ---------- */
.dropzone {
  border: 1.5px dashed rgba(255, 255, 255, 0.16);
  border-radius: var(--radius-sm);
  padding: 30px 18px;
  text-align: center;
  cursor: pointer;
  transition: border-color 0.15s ease, background 0.15s ease;
}
.dropzone:hover,
.dropzone:focus-visible { border-color: var(--lime-line); background: rgba(200, 242, 78, 0.04); outline: none; }
.dropzone.is-drag { border-color: var(--lime); background: var(--lime-dim); }

.dropzone__arrow {
  width: 40px;
  height: 40px;
  margin: 0 auto 12px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.05);
  color: var(--muted);
}
.dropzone__title { margin: 0; font-weight: 600; font-size: 14px; }
.dropzone__hint { margin: 6px 0 0; color: var(--muted-2); font-size: 12.5px; }

/* ---------- FILE CHIP ---------- */
.chip {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: 14px;
  padding: 12px 12px 12px 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--panel-2);
}
.chip--hidden { display: none; }
.chip__icon {
  flex: 0 0 auto;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: var(--lime);
  color: #0a0e19;
}
.chip__meta { display: flex; flex-direction: column; min-width: 0; flex: 1; }
.chip__name {
  font-size: 13.5px;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.chip__size { font-size: 12px; color: var(--muted-2); margin-top: 1px; }
.chip__remove {
  flex: 0 0 auto;
  background: none;
  border: none;
  color: var(--muted);
  font-size: 20px;
  line-height: 1;
  cursor: pointer;
  padding: 4px 6px;
  border-radius: 8px;
}
.chip__remove:hover { color: var(--danger); background: rgba(255, 107, 107, 0.1); }

/* ---------- FIELDS ---------- */
.field { display: block; margin-bottom: 14px; }
.field__label {
  display: block;
  font-size: 12.5px;
  color: var(--muted);
  margin-bottom: 7px;
}

.input,
.select select {
  width: 100%;
  font-family: var(--sans);
  font-size: 14px;
  color: var(--text);
  background: var(--panel-2);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 11px 13px;
}
.input::placeholder { color: var(--muted-2); }
.input:focus,
.select select:focus { outline: none; border-color: var(--lime-line); box-shadow: 0 0 0 3px rgba(200, 242, 78, 0.12); }
.input:disabled { opacity: 0.5; cursor: not-allowed; }

.select { position: relative; display: block; }
.select select {
  appearance: none;
  -webkit-appearance: none;
  padding-right: 38px;
  cursor: pointer;
}
.select::after {
  content: "";
  position: absolute;
  right: 15px;
  top: 50%;
  width: 8px;
  height: 8px;
  border-right: 2px solid var(--muted);
  border-bottom: 2px solid var(--muted);
  transform: translateY(-70%) rotate(45deg);
  pointer-events: none;
}
.select option { background: #0d1320; color: var(--text); }

/* ---------- CONFIRM CHECKBOX ---------- */
.confirm {
  display: flex;
  gap: 11px;
  align-items: flex-start;
  margin-top: 16px;
  font-size: 13px;
  color: var(--muted);
  cursor: pointer;
}
.confirm input {
  flex: 0 0 auto;
  width: 18px;
  height: 18px;
  margin-top: 1px;
  accent-color: var(--lime);
  cursor: pointer;
}

/* ---------- PREVIEW ---------- */
.preview-frame {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 236px;
}
.preview-stage {
  position: relative;
  overflow: hidden;
  border-radius: 12px;
  background: #05070d;
  border: 1px solid var(--border);
}
.preview-stage.fmt-wide { width: 100%; aspect-ratio: 16 / 9; }
.preview-stage.fmt-square { width: 100%; max-width: 420px; margin-inline: auto; aspect-ratio: 1 / 1; }
.preview-stage.fmt-vertical { height: 440px; aspect-ratio: 9 / 16; margin-inline: auto; }

#previewVideo {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.preview-watermark {
  position: absolute;
  right: 5%;
  bottom: 5%;
  font-weight: 600;
  --wm-scale: 1;
  font-size: clamp(
    calc(11px * var(--wm-scale)),
    calc(4.2cqw * var(--wm-scale)),
    calc(20px * var(--wm-scale))
  );
  color: rgba(255, 255, 255, 0.95);
  text-shadow: 0 2px 8px rgba(0, 0, 0, 0.65);
  pointer-events: none;
  max-width: 70%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.preview-watermark.pos-tl { top: 5%; bottom: auto; left: 5%; right: auto; }
.preview-watermark.pos-tc { top: 5%; bottom: auto; left: 50%; right: auto; transform: translateX(-50%); }
.preview-watermark.pos-tr { top: 5%; bottom: auto; right: 5%; left: auto; }
.preview-watermark.pos-bl { bottom: 5%; top: auto; left: 5%; right: auto; }
.preview-watermark.pos-bc { bottom: 5%; top: auto; left: 50%; right: auto; transform: translateX(-50%); }
.preview-watermark.pos-br { bottom: 5%; top: auto; right: 5%; left: auto; }

.preview-empty {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  text-align: center;
  padding: 0 22px;
  color: var(--muted-2);
  font-size: 13px;
}

/* ---------- CONTROLS ---------- */
.controls {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: 16px;
}
.play-btn {
  flex: 0 0 auto;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  border: 1px solid var(--border-strong);
  background: var(--panel-2);
  color: var(--text);
  display: grid;
  place-items: center;
  cursor: pointer;
}
.play-btn:hover:not(:disabled) { border-color: var(--lime-line); color: var(--lime); }
.play-btn:disabled { opacity: 0.45; cursor: not-allowed; }
.play-btn.is-playing .play-btn__play { display: none; }
.play-btn:not(.is-playing) .play-btn__pause { display: none; }

.time {
  flex: 0 0 auto;
  font-family: var(--mono);
  font-size: 11.5px;
  color: var(--muted);
  white-space: nowrap;
}

/* ---------- FORMATS ---------- */
.formats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  margin-bottom: 24px;
}
.fmt {
  border: 1px solid var(--border);
  background: var(--panel-2);
  border-radius: var(--radius-sm);
  padding: 14px 8px 12px;
  cursor: pointer;
  color: var(--muted);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  transition: border-color 0.15s ease, background 0.15s ease, color 0.15s ease;
}
.fmt:hover { border-color: var(--border-strong); }
.fmt.is-active { border-color: var(--lime); background: var(--lime-dim); color: var(--text); }
.fmt__glyph { height: 22px; display: grid; place-items: center; }
.fmt__box { display: block; border: 1.5px solid currentColor; border-radius: 3px; }
.fmt.is-active .fmt__box { border-color: var(--lime); }
.fmt__name { font-size: 12.5px; font-weight: 600; }
.fmt__ratio { font-family: var(--mono); font-size: 10.5px; color: var(--muted-2); }
.fmt.is-active .fmt__ratio { color: var(--lime); }

/* ---------- SLIDERS ---------- */
.slider { margin-bottom: 18px; }
.slider__top {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-bottom: 9px;
  font-size: 13px;
}
.slider__val { font-family: var(--mono); font-size: 12px; color: var(--lime); }

input[type="range"] {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: 6px;
  border-radius: 999px;
  background: var(--track);
  outline: none;
  cursor: pointer;
}
input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 17px;
  height: 17px;
  border-radius: 50%;
  background: var(--lime);
  border: 3px solid var(--bg);
  box-shadow: 0 0 0 1px var(--lime);
  cursor: pointer;
}
input[type="range"]::-moz-range-thumb {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: var(--lime);
  border: 3px solid var(--bg);
  box-shadow: 0 0 0 1px var(--lime);
  cursor: pointer;
}
input[type="range"]::-moz-range-track { background: transparent; }
input[type="range"]:focus-visible { box-shadow: 0 0 0 3px rgba(200, 242, 78, 0.2); }

/* ---------- WATERMARK SWITCH ---------- */
.wm-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}
.wm-note { margin: 0; font-size: 12.5px; color: var(--muted-2); }

.switch { position: relative; display: inline-block; flex: 0 0 auto; cursor: pointer; }
.switch input { position: absolute; opacity: 0; width: 100%; height: 100%; margin: 0; cursor: pointer; }
.switch__track {
  display: block;
  width: 42px;
  height: 24px;
  border-radius: 999px;
  background: var(--track);
  position: relative;
  transition: background 0.18s ease;
}
.switch__track::after {
  content: "";
  position: absolute;
  top: 3px;
  left: 3px;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: #d7dbe4;
  transition: transform 0.18s ease, background 0.18s ease;
}
.switch input:checked + .switch__track { background: var(--lime); }
.switch input:checked + .switch__track::after { transform: translateX(18px); background: #0a0e19; }
.switch input:focus-visible + .switch__track { box-shadow: 0 0 0 3px rgba(200, 242, 78, 0.25); }

.wm-opacity { margin-top: 14px; margin-bottom: 14px; }
.wm-opacity input:disabled { opacity: 0.45; cursor: not-allowed; }

.wm-pos {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 6px;
}
.wm-pos__btn {
  height: 32px;
  border-radius: 9px;
  border: 1px solid var(--border);
  background: var(--panel-2);
  color: var(--muted);
  font-size: 14px;
  line-height: 1;
  cursor: pointer;
  transition: border-color 0.15s ease, color 0.15s ease, background 0.15s ease;
}
.wm-pos__btn:hover:not(:disabled) { border-color: var(--lime-line); color: var(--text); }
.wm-pos__btn.is-active { border-color: var(--lime-line); background: var(--lime-dim); color: var(--lime); }
.wm-pos__btn:disabled { opacity: 0.45; cursor: not-allowed; }

/* ---------- EXPORT ---------- */
.export {
  margin-top: 22px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: linear-gradient(180deg, #0e1626 0%, #0b111d 100%);
  padding: 26px 28px;
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 24px 32px;
  align-items: center;
}
.export__title { margin: 0 0 8px; font-size: 20px; font-weight: 800; }
.export__desc { margin: 0; color: var(--muted); font-size: 13.5px; max-width: 620px; }
.export__action { display: flex; flex-direction: column; align-items: stretch; gap: 8px; min-width: 260px; }
.export__hint { margin: 0; font-size: 12px; color: var(--muted-2); text-align: center; }

.btn {
  font-family: var(--sans);
  font-size: 15px;
  font-weight: 700;
  color: #0a0e19;
  background: var(--lime);
  border: none;
  border-radius: 12px;
  padding: 14px 22px;
  cursor: pointer;
  transition: filter 0.15s ease, transform 0.05s ease;
}
.btn:hover:not(:disabled) { filter: brightness(1.06); }
.btn:active:not(:disabled) { transform: translateY(1px); }
.btn:disabled { background: rgba(255, 255, 255, 0.1); color: var(--muted-2); cursor: not-allowed; }

.progress { grid-column: 1 / -1; }
.progress__bar {
  width: 100%;
  height: 8px;
  border-radius: 999px;
  background: var(--track);
  overflow: hidden;
}
.progress__fill {
  height: 100%;
  width: 0%;
  background: var(--lime);
  border-radius: 999px;
  transition: width 0.2s ease;
}
.progress__status { margin: 10px 0 0; font-size: 13px; color: var(--muted); }

.result {
  grid-column: 1 / -1;
  border: 1px solid var(--lime-line);
  background: var(--lime-dim);
  border-radius: var(--radius-sm);
  padding: 14px 18px;
  font-size: 13.5px;
}
.result.is-error { border-color: rgba(255, 107, 107, 0.45); background: rgba(255, 107, 107, 0.08); color: #ffd9d9; }
.result code { background: rgba(0, 0, 0, 0.25); }
.result ul { margin: 8px 0 0; padding-left: 18px; }
.result li { margin: 2px 0; }

/* ---------- FOOT ---------- */
.foot {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  margin-top: 40px;
  padding-top: 20px;
  border-top: 1px solid var(--border);
  color: var(--muted-2);
  font-size: 12.5px;
}

/* ---------- RESPONSIVE ---------- */
@media (max-width: 1040px) {
  .grid { grid-template-columns: 1fr; }
  .preview-stage.fmt-wide { max-width: 620px; margin-inline: auto; }
  .export { grid-template-columns: 1fr; }
  .export__action { min-width: 0; }
}

@media (max-width: 560px) {
  .wrap { padding: 28px 18px 44px; }
  .notice { width: 100%; }
}

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; }
}
