/* =========================================================================
   LetitEdit Video Editor — touch-first workspace
   The page keeps the site chrome; everything below styles the editor app.
   ========================================================================= */

.se-page {
  background:
    radial-gradient(1200px 600px at 50% -10%, rgba(37, 99, 235, 0.10), transparent 70%),
    #f5f7fb;
}

.se-page .breadcrumbs { padding-top: 10px; font-size: 0.78rem; }

/* The tool is the page. Keep the hero short so the preview is reachable
   without a long scroll, especially at 320 px. */
.se-hero { padding: 10px 0 2px; }
.se-hero .eyebrow { font-size: 0.66rem; letter-spacing: 0.09em; }
.se-hero h1 {
  margin: 6px 0 6px;
  font-size: clamp(1.5rem, 4.4vw, 2.15rem);
  line-height: 1.12;
  letter-spacing: -0.025em;
}
.se-hero p { max-width: 74ch; margin: 0; font-size: 0.92rem; line-height: 1.45; color: #475569; }
.se-hero-points {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 14px;
  margin: 8px 0 0;
  padding: 0;
  list-style: none;
  font-size: 0.78rem;
  color: #64748b;
}
.se-hero-points li::before { content: "·"; margin-right: 6px; color: #94a3b8; }

.se-section { padding: 8px 0 40px; }

.se-app {
  --se-bg: #0b1220;
  --se-panel: #111a2c;
  --se-panel-2: #162238;
  --se-line: rgba(148, 163, 184, 0.22);
  --se-line-strong: rgba(148, 163, 184, 0.38);
  --se-text: #e8eefb;
  --se-muted: #9aa8c0;
  --se-blue: #3b82f6;
  --se-blue-strong: #2563eb;
  --se-blue-soft: rgba(59, 130, 246, 0.16);
  --se-danger: #f87171;
  --se-ok: #34d399;
  --se-radius: 18px;
  --se-tap: 44px;
  position: relative;
  max-width: 1020px;
  margin: 0 auto;
  color: var(--se-text);
  background:
    radial-gradient(900px 400px at 85% -10%, rgba(37, 99, 235, 0.28), transparent 60%),
    linear-gradient(180deg, #0c1424 0%, var(--se-bg) 38%, #080e18 100%);
  border: 1px solid rgba(148, 163, 184, 0.18);
  border-radius: 22px;
  box-shadow: 0 30px 70px -30px rgba(15, 23, 42, 0.55), 0 2px 0 rgba(255, 255, 255, 0.03) inset;
  overflow: hidden;
  font-size: 15px;
  line-height: 1.45;
  -webkit-tap-highlight-color: transparent;
}

.se-app *,
.se-app *::before,
.se-app *::after { box-sizing: border-box; }

.se-app button,
.se-app input,
.se-app select,
.se-app textarea {
  font: inherit;
  color: inherit;
}

.se-app button { cursor: pointer; }

.se-app :focus-visible {
  outline: 2px solid #93c5fd;
  outline-offset: 2px;
}

.se-app [hidden] { display: none !important; }

/* ---------------------------------------------------------------- header */

.se-header {
  position: sticky;
  top: var(--se-topbar, 0px);
  z-index: 30;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 12px;
  padding: 10px 12px;
  background: rgba(11, 18, 32, 0.86);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--se-line);
}

.se-name-wrap {
  display: flex;
  align-items: center;
  gap: 9px;
  flex: 1 1 170px;
  min-width: 0;
}

.se-mark {
  flex: 0 0 auto;
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border-radius: 10px;
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.04em;
  color: #fff;
  background: linear-gradient(135deg, #3b82f6, #1d4ed8);
  box-shadow: 0 6px 16px -6px rgba(37, 99, 235, 0.8);
}

.se-name-label { flex: 1 1 auto; min-width: 0; }

.se-name-label input {
  width: 100%;
  min-width: 0;
  padding: 6px 8px;
  border: 1px solid transparent;
  border-radius: 9px;
  background: transparent;
  font-weight: 650;
  letter-spacing: -0.01em;
  text-overflow: ellipsis;
}

.se-name-label input:hover { background: rgba(148, 163, 184, 0.08); }
.se-name-label input:focus { background: rgba(148, 163, 184, 0.1); border-color: var(--se-line-strong); }

.se-save-status {
  flex: 0 0 auto;
  align-self: center;
  font-size: 11.5px;
  color: var(--se-muted);
  white-space: nowrap;
}

.se-save-status[data-tone="ok"] { color: var(--se-ok); }
.se-save-status[data-tone="warn"] { color: #fbbf24; }

.se-header-actions {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-left: auto;
}

.se-icon-btn,
.se-primary-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-width: var(--se-tap);
  min-height: var(--se-tap);
  padding: 0 10px;
  border: 1px solid var(--se-line);
  border-radius: 11px;
  background: rgba(148, 163, 184, 0.07);
  color: var(--se-text);
  transition: background 0.15s ease, border-color 0.15s ease, transform 0.1s ease;
}

.se-icon-btn svg,
.se-primary-btn svg { width: 19px; height: 19px; flex: 0 0 auto; }

.se-icon-btn:hover:not(:disabled),
.se-primary-btn:hover:not(:disabled) { background: rgba(148, 163, 184, 0.14); border-color: var(--se-line-strong); }
.se-icon-btn:active:not(:disabled),
.se-primary-btn:active:not(:disabled) { transform: translateY(1px); }
.se-icon-btn:disabled { opacity: 0.35; cursor: default; }

.se-primary-btn {
  border-color: transparent;
  background: linear-gradient(135deg, #3b82f6, #2563eb);
  color: #fff;
  font-weight: 650;
  box-shadow: 0 8px 18px -10px rgba(37, 99, 235, 0.9);
}

.se-primary-btn:hover:not(:disabled) { background: linear-gradient(135deg, #4f8ff7, #2f6ff0); border-color: transparent; }

/* ----------------------------------------------------------------- stage */

.se-stage {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 210px;
  padding: 14px 12px 6px;
  background:
    radial-gradient(70% 80% at 50% 0%, rgba(59, 130, 246, 0.10), transparent 70%),
    #070c15;
}

.se-frame {
  position: relative;
  width: 100%;
  max-width: 100%;
  border-radius: 14px;
  overflow: hidden;
  background: #000;
  box-shadow: 0 20px 50px -24px rgba(0, 0, 0, 0.9), 0 0 0 1px rgba(148, 163, 184, 0.2);
  touch-action: pan-y;
  user-select: none;
  -webkit-user-select: none;
}

.se-frame canvas {
  display: block;
  width: 100%;
  height: 100%;
  background: #000;
}

.se-canvas-overlay {
  position: absolute;
  inset: 0;
  pointer-events: auto;
  touch-action: pan-y;
}

.se-canvas-overlay.has-selection { pointer-events: auto; }

.se-selection-box {
  position: absolute;
  border: 1.5px solid rgba(96, 165, 250, 0.95);
  border-radius: 4px;
  box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.35), 0 0 0 9999px rgba(2, 6, 23, 0.03);
  transform-origin: center;
  pointer-events: auto;
  /* Let a vertical swipe scroll the page; horizontal drags move the layer.
     The resize and rotate handles stay touch-action: none below. */
  touch-action: pan-y;
  cursor: move;
}

.se-selection-box::after {
  content: "";
  position: absolute;
  inset: -1.5px;
  border-radius: 4px;
  box-shadow: 0 0 0 1px rgba(15, 23, 42, 0.6) inset;
  pointer-events: none;
}

.se-handle {
  position: absolute;
  width: var(--se-tap);
  height: var(--se-tap);
  margin: calc(var(--se-tap) / -2) 0 0 calc(var(--se-tap) / -2);
  border: 0;
  border-radius: 50%;
  background: transparent;
  touch-action: none;
  pointer-events: auto;
}

.se-handle-nw { left: 0; top: 0; cursor: nwse-resize; }
.se-handle-ne { left: 100%; top: 0; cursor: nesw-resize; }
.se-handle-sw { left: 0; top: 100%; cursor: nesw-resize; }
.se-handle-se { left: 100%; top: 100%; cursor: nwse-resize; }

/* Small selections keep the bottom-right resize target and the rotate target;
   the other three 44 px targets would cover the layer being edited. */
.se-selection-box.is-small .se-handle-nw,
.se-selection-box.is-small .se-handle-ne,
.se-selection-box.is-small .se-handle-sw { display: none; }
.se-selection-box.is-small .se-handle::after { inset: 13px; }
.se-selection-box.is-small .se-handle-rotate { top: -30px; }

.se-handle-rotate {
  left: 50%;
  top: -34px;
  margin-left: calc(var(--se-tap) / -2);
  cursor: grab;
}

.se-handle-rotate::before {
  content: "";
  position: absolute;
  left: 50%;
  top: calc(100% - 9px);
  width: 2px;
  height: 16px;
  margin-left: -1px;
  background: rgba(148, 197, 253, 0.9);
}

.se-handle::after {
  content: "";
  position: absolute;
  inset: 9px;
  border-radius: 50%;
  border: 2px solid #bfdbfe;
  background: #2563eb;
  box-shadow: 0 2px 8px rgba(2, 6, 23, 0.55);
}

.se-handle-rotate::after {
  background: transparent;
  border-color: #fff;
  border-left-color: transparent;
  transform: rotate(-30deg);
}

.se-empty {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 18px 16px;
  text-align: center;
  background:
    radial-gradient(80% 100% at 50% 0%, rgba(37, 99, 235, 0.22), transparent 65%),
    linear-gradient(160deg, #0d1729, #070c15);
}

.se-empty-art {
  display: grid;
  place-items: center;
  width: 56px;
  height: 56px;
  margin-bottom: 2px;
  border-radius: 16px;
  color: #93c5fd;
  background: rgba(37, 99, 235, 0.18);
  border: 1px solid rgba(96, 165, 250, 0.32);
}

.se-empty-art svg { width: 30px; height: 30px; }

.se-empty h2 { margin: 0; font-size: 20px; letter-spacing: -0.02em; }
.se-empty p { margin: 0; max-width: 38ch; color: var(--se-muted); font-size: 13.5px; }

.se-upload-btn {
  margin-top: 6px;
  min-height: 46px;
  padding: 0 22px;
  border: 0;
  border-radius: 12px;
  background: linear-gradient(135deg, #3b82f6, #2563eb);
  color: #fff;
  font-weight: 700;
  box-shadow: 0 12px 26px -12px rgba(37, 99, 235, 0.9);
}

.se-upload-btn:hover { background: linear-gradient(135deg, #4f8ff7, #2f6ff0); }

.se-empty-note { font-size: 11.5px !important; opacity: 0.8; }

.se-stage-badge {
  position: absolute;
  right: 8px;
  bottom: 8px;
  padding: 3px 8px;
  border-radius: 999px;
  font-size: 10.5px;
  letter-spacing: 0.02em;
  color: #dbeafe;
  background: rgba(2, 6, 23, 0.7);
  border: 1px solid rgba(148, 163, 184, 0.25);
  backdrop-filter: blur(6px);
  pointer-events: none;
}

/* ------------------------------------------------------------- transport */

.se-controls { padding: 8px 12px 4px; }

.se-transport {
  display: flex;
  align-items: center;
  gap: 10px;
}

.se-play-btn {
  display: grid;
  place-items: center;
  width: 48px;
  height: 48px;
  flex: 0 0 auto;
  border: 0;
  border-radius: 50%;
  color: #fff;
  background: linear-gradient(135deg, #3b82f6, #2563eb);
  box-shadow: 0 10px 22px -10px rgba(37, 99, 235, 0.95);
}

.se-play-btn svg { width: 24px; height: 24px; }
.se-play-btn .se-icon-pause { display: none; }
.se-play-btn.is-playing .se-icon-play { display: none; }
.se-play-btn.is-playing .se-icon-pause { display: block; }

.se-time-readout {
  display: flex;
  align-items: baseline;
  gap: 5px;
  font-variant-numeric: tabular-nums;
  font-feature-settings: "tnum";
  font-size: 14px;
  font-weight: 600;
  letter-spacing: 0.01em;
  white-space: nowrap;
}

.se-time-sep { color: var(--se-muted); font-weight: 400; }
#se-duration { color: var(--se-muted); font-weight: 500; }

.se-mute-btn { margin-left: auto; }
.se-mute-btn .se-icon-muted { display: none; }
.se-mute-btn[aria-pressed="true"] .se-icon-sound { display: none; }
.se-mute-btn[aria-pressed="true"] .se-icon-muted { display: block; }
.se-mute-btn[aria-pressed="true"] { color: #fca5a5; border-color: rgba(248, 113, 113, 0.35); }

.se-seek-wrap { padding: 10px 2px 6px; }

#se-seek {
  -webkit-appearance: none;
  appearance: none;
  display: block;
  width: 100%;
  height: 28px;
  margin: 0;
  background: transparent;
  cursor: pointer;
}

#se-seek::-webkit-slider-runnable-track {
  height: 6px;
  border-radius: 999px;
  background: linear-gradient(to right, #3b82f6 0%, #3b82f6 var(--se-fill, 0%), rgba(148, 163, 184, 0.26) var(--se-fill, 0%), rgba(148, 163, 184, 0.26) 100%);
}

#se-seek::-moz-range-track {
  height: 6px;
  border-radius: 999px;
  background: rgba(148, 163, 184, 0.26);
}

#se-seek::-moz-range-progress {
  height: 6px;
  border-radius: 999px;
  background: #3b82f6;
}

#se-seek::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 20px;
  height: 20px;
  margin-top: -7px;
  border: 3px solid #0b1220;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 2px 8px rgba(2, 6, 23, 0.6);
}

#se-seek::-moz-range-thumb {
  width: 20px;
  height: 20px;
  border: 3px solid #0b1220;
  border-radius: 50%;
  background: #fff;
}

#se-seek:disabled { opacity: 0.4; cursor: default; }

/* ---------------------------------------------------------- moment strip */

.se-moment-strip {
  position: relative;
  margin: 2px 0 10px;
  padding-bottom: 2px;
  border-radius: 10px;
  background: #0a101c;
  border: 1px solid var(--se-line);
  overflow: hidden;
  touch-action: pan-y;
  cursor: pointer;
}

.se-filmstrip {
  display: flex;
  height: 46px;
  overflow: hidden;
  background: #0a101c;
}

.se-film-seg {
  position: relative;
  height: 100%;
  min-width: 2px;
  flex: 0 0 auto;
  border-right: 1px solid rgba(2, 6, 23, 0.9);
  background-color: #162238;
  background-repeat: repeat-x;
  background-position: left center;
  background-size: auto 100%;
}

.se-film-seg:last-child { border-right: 0; }

.se-film-seg::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, rgba(2, 6, 23, 0.06), rgba(2, 6, 23, 0.42));
}

.se-film-empty {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  font-size: 11.5px;
  color: var(--se-muted);
  letter-spacing: 0.02em;
}

.se-overlay-lane {
  position: relative;
  height: 22px;
  border-top: 1px solid var(--se-line);
  background: rgba(15, 23, 42, 0.75);
}

.se-overlay-chip {
  position: absolute;
  top: 3px;
  height: 16px;
  min-width: 18px;
  max-width: calc(100% - 2px);
  padding: 0 5px;
  border: 0;
  border-radius: 5px;
  background: rgba(59, 130, 246, 0.7);
  color: #eff6ff;
  font-size: 9.5px;
  font-weight: 700;
  line-height: 16px;
  text-align: left;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  cursor: pointer;
}

.se-overlay-chip[data-kind="text"] { background: rgba(168, 85, 247, 0.75); }
.se-overlay-chip[data-kind="image"] { background: rgba(16, 185, 129, 0.72); }
.se-overlay-chip[data-kind="shape"] { background: rgba(245, 158, 11, 0.8); }
.se-overlay-chip[data-kind="audio"] { background: rgba(236, 72, 153, 0.7); }
.se-overlay-chip.is-selected { outline: 2px solid #fff; outline-offset: -1px; }

.se-playhead {
  position: absolute;
  top: 0;
  bottom: 0;
  left: 0;
  width: 2px;
  margin-left: -1px;
  background: #f8fafc;
  box-shadow: 0 0 0 1px rgba(2, 6, 23, 0.7);
  pointer-events: none;
  z-index: 3;
}

.se-playhead::before {
  content: "";
  position: absolute;
  top: 0;
  left: 50%;
  width: 10px;
  height: 6px;
  transform: translateX(-50%);
  background: #f8fafc;
  clip-path: polygon(0 0, 100% 0, 50% 100%);
}

/* ------------------------------------------------------------ action bar */

.se-moment-bar { padding: 2px 0 8px; }

.se-moment-head {
  display: flex;
  align-items: baseline;
  gap: 8px;
  min-width: 0;
  padding: 0 2px 6px;
}

.se-moment-label {
  font-size: 12.5px;
  font-weight: 700;
  letter-spacing: 0.01em;
  white-space: nowrap;
}

.se-moment-hint {
  font-size: 11.5px;
  color: var(--se-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.se-actions {
  display: flex;
  gap: 7px;
  overflow-x: auto;
  padding: 2px 2px 6px;
  scrollbar-width: thin;
  scrollbar-color: rgba(148, 163, 184, 0.35) transparent;
  -webkit-overflow-scrolling: touch;
}

.se-actions::-webkit-scrollbar { height: 5px; }
.se-actions::-webkit-scrollbar-thumb { background: rgba(148, 163, 184, 0.3); border-radius: 99px; }

.se-action {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  flex: 0 0 auto;
  min-height: var(--se-tap);
  padding: 0 13px;
  border: 1px solid var(--se-line);
  border-radius: 12px;
  background: rgba(148, 163, 184, 0.08);
  color: var(--se-text);
  font-size: 12.5px;
  font-weight: 600;
  white-space: nowrap;
}

.se-action:hover { background: rgba(148, 163, 184, 0.15); border-color: var(--se-line-strong); }
.se-action svg { width: 17px; height: 17px; }
.se-action.is-accent { border-color: rgba(59, 130, 246, 0.45); background: rgba(37, 99, 235, 0.16); }
.se-action.is-danger { color: #fca5a5; }
.se-action.is-danger:hover { background: rgba(248, 113, 113, 0.12); border-color: rgba(248, 113, 113, 0.3); }

/* --------------------------------------------------------------- layers */

.se-layers {
  margin-top: 2px;
  border: 1px solid var(--se-line);
  border-radius: 14px;
  background: rgba(17, 26, 44, 0.7);
  overflow: hidden;
}

.se-layers-head {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  min-height: 46px;
  padding: 8px 12px;
  border: 0;
  background: transparent;
  text-align: left;
}

.se-layers-title {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-size: 13px;
  font-weight: 700;
  white-space: nowrap;
}

.se-count {
  display: inline-grid;
  place-items: center;
  min-width: 20px;
  height: 20px;
  padding: 0 6px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 700;
  background: var(--se-blue-soft);
  color: #bfdbfe;
}

.se-layers-sub {
  flex: 1;
  min-width: 0;
  font-size: 11.5px;
  color: var(--se-muted);
  text-align: right;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.se-chevron {
  width: 18px;
  height: 18px;
  flex: 0 0 auto;
  color: var(--se-muted);
  transition: transform 0.2s ease;
}

.se-layers-head[aria-expanded="true"] .se-chevron { transform: rotate(180deg); }
.se-layers-head[aria-expanded="false"] + .se-layers-body { display: none; }

.se-layers-body { border-top: 1px solid var(--se-line); padding: 6px; }

.se-layer-list { display: flex; flex-direction: column; gap: 4px; margin: 0; padding: 0; list-style: none; }

.se-layer-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 8px;
  padding: 6px 6px 6px 8px;
  border: 1px solid transparent;
  border-radius: 10px;
  background: rgba(148, 163, 184, 0.045);
}

.se-layer-row.is-selected {
  border-color: rgba(96, 165, 250, 0.5);
  background: rgba(37, 99, 235, 0.14);
}

.se-layer-row.is-hidden { opacity: 0.55; }

.se-layer-main {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  padding: 0;
  border: 0;
  background: transparent;
  text-align: left;
}

.se-layer-icon {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  flex: 0 0 auto;
  border-radius: 9px;
  color: #dbeafe;
  background: rgba(37, 99, 235, 0.22);
}

.se-layer-icon svg { width: 18px; height: 18px; }
.se-layer-row[data-kind="text"] .se-layer-icon { background: rgba(168, 85, 247, 0.2); color: #e9d5ff; }
.se-layer-row[data-kind="image"] .se-layer-icon { background: rgba(16, 185, 129, 0.18); color: #a7f3d0; }
.se-layer-row[data-kind="shape"] .se-layer-icon { background: rgba(245, 158, 11, 0.18); color: #fde68a; }
.se-layer-row[data-kind="audio"] .se-layer-icon { background: rgba(236, 72, 153, 0.18); color: #fbcfe8; }

.se-layer-text { min-width: 0; }
.se-layer-name {
  display: block;
  font-size: 12.5px;
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.se-layer-meta {
  display: block;
  font-size: 10.5px;
  color: var(--se-muted);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.se-layer-controls { display: flex; align-items: center; gap: 2px; }

.se-layer-btn {
  display: grid;
  place-items: center;
  width: var(--se-tap);
  height: var(--se-tap);
  border: 0;
  border-radius: 9px;
  background: transparent;
  color: var(--se-muted);
}

.se-layer-btn:hover { background: rgba(148, 163, 184, 0.14); color: var(--se-text); }
.se-layer-btn[aria-pressed="true"] { color: #fca5a5; }
.se-layer-btn svg { width: 17px; height: 17px; }
.se-layer-btn.is-danger:hover { color: #fca5a5; background: rgba(248, 113, 113, 0.12); }
.se-layer-move { display: flex; flex-direction: row; gap: 0; }
.se-layer-move .se-layer-btn { width: var(--se-tap); height: var(--se-tap); }
.se-layer-move svg { width: 14px; height: 14px; }

/* At 320 px four 44 px buttons leave no room for the layer name. The
   forward/back controls also live in the layer's edit sheet. */
@media (max-width: 379px) {
  .se-layer-move { display: none; }
}

.se-layers-empty {
  margin: 4px 6px 8px;
  font-size: 12px;
  color: var(--se-muted);
  text-align: center;
}

/* -------------------------------------------------------------- toolbar */

.se-toolbar {
  position: sticky;
  bottom: 0;
  z-index: 25;
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 2px;
  padding: 6px 8px calc(6px + env(safe-area-inset-bottom, 0px));
  background: rgba(9, 15, 27, 0.92);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-top: 1px solid var(--se-line);
}

.se-tool {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  min-height: 52px;
  padding: 4px 2px;
  border: 0;
  border-radius: 11px;
  background: transparent;
  color: var(--se-muted);
  font-size: 10.5px;
  font-weight: 600;
}

.se-tool svg { width: 21px; height: 21px; }
.se-tool:hover { background: rgba(148, 163, 184, 0.1); color: var(--se-text); }
.se-tool:active { background: rgba(37, 99, 235, 0.18); color: #dbeafe; }

.se-privacy-note {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  max-width: 1020px;
  margin: 12px auto 0;
  padding: 0 6px;
  font-size: 12px;
  color: #64748b;
}

/* ---------------------------------------------------------------- sheets */

.se-sheet-root { position: relative; z-index: 100; }

.se-sheet-backdrop {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  background: rgba(2, 6, 23, 0.62);
  backdrop-filter: blur(3px);
  -webkit-backdrop-filter: blur(3px);
  animation: se-fade 0.16s ease-out;
}

.se-sheet {
  display: flex;
  flex-direction: column;
  width: 100%;
  max-width: 620px;
  max-height: min(88vh, 780px);
  color: var(--se-text);
  background: linear-gradient(180deg, #131e33, #0d1626);
  border: 1px solid rgba(148, 163, 184, 0.25);
  border-bottom: 0;
  border-radius: 20px 20px 0 0;
  box-shadow: 0 -24px 60px -20px rgba(0, 0, 0, 0.7);
  animation: se-sheet-in 0.22s cubic-bezier(0.22, 0.9, 0.3, 1);
  overflow: hidden;
  touch-action: pan-y;
}

.se-sheet-handle {
  flex: 0 0 auto;
  display: grid;
  place-items: center;
  height: 20px;
  cursor: grab;
}

.se-sheet-handle::before {
  content: "";
  width: 42px;
  height: 4px;
  border-radius: 999px;
  background: rgba(148, 163, 184, 0.4);
}

.se-sheet-head {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 2px 16px 10px;
  border-bottom: 1px solid var(--se-line);
}

.se-sheet-head-text { flex: 1; min-width: 0; }
.se-sheet-title { margin: 0; font-size: 17px; font-weight: 700; letter-spacing: -0.015em; }
.se-sheet-sub { margin: 2px 0 0; font-size: 12px; color: var(--se-muted); }

.se-sheet-close {
  display: grid;
  place-items: center;
  width: var(--se-tap);
  height: var(--se-tap);
  flex: 0 0 auto;
  margin: -8px -8px 0 0;
  border: 0;
  border-radius: 10px;
  background: rgba(148, 163, 184, 0.1);
  color: var(--se-text);
}

.se-sheet-close svg { width: 18px; height: 18px; }
.se-sheet-close:hover { background: rgba(148, 163, 184, 0.18); }

.se-sheet-body {
  flex: 1 1 auto;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 14px 16px calc(18px + env(safe-area-inset-bottom, 0px));
  -webkit-overflow-scrolling: touch;
}

.se-sheet-foot {
  display: flex;
  gap: 8px;
  padding: 10px 16px calc(12px + env(safe-area-inset-bottom, 0px));
  border-top: 1px solid var(--se-line);
  background: rgba(9, 15, 27, 0.6);
}

.se-sheet-foot .se-btn { flex: 1; }

@keyframes se-sheet-in { from { transform: translateY(26px); opacity: 0.5; } to { transform: none; opacity: 1; } }
@keyframes se-fade { from { opacity: 0; } to { opacity: 1; } }

/* ---------------------------------------------------------- form controls */

.se-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  min-height: 44px;
  padding: 0 16px;
  border: 1px solid var(--se-line);
  border-radius: 11px;
  background: rgba(148, 163, 184, 0.1);
  color: var(--se-text);
  font-size: 13px;
  font-weight: 650;
  text-align: center;
}

.se-btn:hover { background: rgba(148, 163, 184, 0.17); }
.se-btn svg { width: 18px; height: 18px; }
.se-btn.se-btn-primary { border-color: transparent; background: linear-gradient(135deg, #3b82f6, #2563eb); color: #fff; }
.se-btn.se-btn-primary:hover { background: linear-gradient(135deg, #4f8ff7, #2f6ff0); }
.se-btn.se-btn-danger { color: #fca5a5; border-color: rgba(248, 113, 113, 0.3); }
.se-btn.se-btn-danger:hover { background: rgba(248, 113, 113, 0.13); }
.se-btn:disabled { opacity: 0.45; cursor: default; }

.se-btn-sm { min-height: var(--se-tap); padding: 0 11px; font-size: 12px; border-radius: 9px; }

.se-field { display: flex; flex-direction: column; gap: 5px; margin: 0 0 12px; }
.se-field:last-child { margin-bottom: 0; }
.se-field > label,
.se-field-label {
  font-size: 11.5px;
  font-weight: 650;
  letter-spacing: 0.02em;
  color: #b6c3d8;
}

.se-field-note { font-size: 11px; color: var(--se-muted); line-height: 1.4; }

.se-input,
.se-select,
.se-textarea {
  width: 100%;
  min-height: 42px;
  padding: 9px 11px;
  border: 1px solid var(--se-line-strong);
  border-radius: 10px;
  background: rgba(7, 12, 21, 0.7);
  color: var(--se-text);
  font-size: 14px;
}

.se-input:focus,
.se-select:focus,
.se-textarea:focus { border-color: #60a5fa; outline: 2px solid rgba(96, 165, 250, 0.25); outline-offset: 0; }

.se-textarea { min-height: 88px; resize: vertical; line-height: 1.45; }
.se-select { appearance: none; background-image: linear-gradient(45deg, transparent 50%, #94a3b8 50%), linear-gradient(135deg, #94a3b8 50%, transparent 50%); background-position: calc(100% - 18px) 19px, calc(100% - 13px) 19px; background-size: 5px 5px; background-repeat: no-repeat; padding-right: 34px; }

.se-range {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: var(--se-tap);
  margin: 0;
  background: transparent;
}

.se-range::-webkit-slider-runnable-track { height: 5px; border-radius: 99px; background: rgba(148, 163, 184, 0.28); }
.se-range::-moz-range-track { height: 5px; border-radius: 99px; background: rgba(148, 163, 184, 0.28); }
.se-range::-webkit-slider-thumb { -webkit-appearance: none; width: 24px; height: 24px; margin-top: -9.5px; border: 3px solid #0d1626; border-radius: 50%; background: #93c5fd; }
.se-range::-moz-range-thumb { width: 24px; height: 24px; border: 3px solid #0d1626; border-radius: 50%; background: #93c5fd; }
.se-range:focus-visible { outline-offset: 2px; }

.se-range-row { display: grid; grid-template-columns: minmax(0, 1fr) 62px; align-items: center; gap: 10px; }
.se-range-value {
  font-size: 12px;
  font-variant-numeric: tabular-nums;
  text-align: right;
  color: #cbd5e1;
}

.se-grid-2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.se-grid-3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }

.se-row { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.se-row-between { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.se-spacer { flex: 1; }

.se-chip-row { display: flex; flex-wrap: wrap; gap: 6px; }

.se-chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  min-height: var(--se-tap);
  padding: 0 11px;
  border: 1px solid var(--se-line);
  border-radius: 10px;
  background: rgba(148, 163, 184, 0.08);
  color: var(--se-text);
  font-size: 12px;
  font-weight: 600;
}

.se-chip:hover { background: rgba(148, 163, 184, 0.15); }
.se-chip[aria-pressed="true"],
.se-chip.is-active { border-color: rgba(96, 165, 250, 0.7); background: rgba(37, 99, 235, 0.2); color: #dbeafe; }

.se-seg { display: grid; grid-template-columns: repeat(auto-fit, minmax(0, 1fr)); gap: 4px; padding: 3px; border-radius: 11px; background: rgba(7, 12, 21, 0.55); border: 1px solid var(--se-line); }
.se-seg button { min-height: var(--se-tap); padding: 0 8px; border: 0; border-radius: 8px; background: transparent; color: var(--se-muted); font-size: 12px; font-weight: 600; }
.se-seg button[aria-pressed="true"] { background: rgba(37, 99, 235, 0.85); color: #fff; }

.se-check { display: flex; align-items: center; gap: 8px; min-height: var(--se-tap); font-size: 13px; }
.se-check input { width: 18px; height: 18px; accent-color: #3b82f6; }

.se-color-row { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.se-color-row input[type="color"] {
  width: 44px;
  height: 40px;
  padding: 3px;
  border: 1px solid var(--se-line-strong);
  border-radius: 9px;
  background: rgba(7, 12, 21, 0.7);
  cursor: pointer;
}

.se-divider { height: 1px; margin: 14px 0; background: var(--se-line); border: 0; }

.se-section-label {
  margin: 16px 0 8px;
  font-size: 11px;
  font-weight: 750;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #7f90aa;
}

.se-section-label:first-child { margin-top: 0; }

.se-note {
  padding: 10px 12px;
  border: 1px solid rgba(148, 163, 184, 0.22);
  border-radius: 10px;
  background: rgba(148, 163, 184, 0.06);
  font-size: 11.5px;
  line-height: 1.45;
  color: #b6c3d8;
}

.se-note.is-warn { border-color: rgba(251, 191, 36, 0.3); background: rgba(251, 191, 36, 0.08); color: #fde68a; }
.se-note.is-error { border-color: rgba(248, 113, 113, 0.3); background: rgba(248, 113, 113, 0.08); color: #fecaca; }
.se-note.is-ok { border-color: rgba(52, 211, 153, 0.3); background: rgba(52, 211, 153, 0.08); color: #a7f3d0; }

/* ------------------------------------------------------------ media grid */

.se-media-tabs { display: flex; gap: 6px; margin-bottom: 12px; }

.se-media-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(128px, 1fr));
  gap: 9px;
}

.se-media-card {
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-width: 0;
  padding: 6px;
  border: 1px solid var(--se-line);
  border-radius: 12px;
  background: rgba(7, 12, 21, 0.55);
  text-align: left;
}

.se-media-thumb {
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 9;
  border-radius: 8px;
  background: #0a101c center / cover no-repeat;
  overflow: hidden;
}

.se-media-thumb span {
  position: absolute;
  right: 5px;
  bottom: 5px;
  padding: 1px 5px;
  border-radius: 4px;
  font-size: 9.5px;
  font-weight: 700;
  background: rgba(2, 6, 23, 0.75);
  color: #e2e8f0;
}

.se-media-name { font-size: 11.5px; font-weight: 600; line-height: 1.25; overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.se-media-meta { font-size: 10.5px; color: var(--se-muted); }
.se-media-actions { display: flex; gap: 4px; margin-top: auto; }
.se-media-actions .se-btn { flex: 1; min-height: var(--se-tap); padding: 0 6px; font-size: 11px; }
.se-media-del { flex: 0 0 auto !important; width: var(--se-tap); padding: 0 !important; }

.se-dropzone {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  padding: 18px 12px;
  margin-bottom: 12px;
  border: 1.5px dashed rgba(148, 163, 184, 0.4);
  border-radius: 13px;
  background: rgba(37, 99, 235, 0.06);
  text-align: center;
}

.se-dropzone p { margin: 0; font-size: 12px; color: var(--se-muted); }
.se-dropzone-actions { display: flex; flex-wrap: wrap; justify-content: center; gap: 6px; }

/* --------------------------------------------------------- filter gallery */

.se-filter-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(78px, 1fr));
  gap: 7px;
}

.se-filter-card {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 5px;
  border: 1px solid var(--se-line);
  border-radius: 10px;
  background: rgba(7, 12, 21, 0.5);
  color: var(--se-text);
  font-size: 10.5px;
  text-align: center;
}

.se-filter-card[aria-pressed="true"] { border-color: #60a5fa; background: rgba(37, 99, 235, 0.18); }

.se-filter-swatch {
  height: 42px;
  border-radius: 6px;
  background:
    linear-gradient(135deg, #f59e0b 0%, #ef4444 34%, #8b5cf6 68%, #0ea5e9 100%);
}

.se-transition-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(102px, 1fr));
  gap: 6px;
  max-height: 270px;
  overflow-y: auto;
  padding: 2px;
}

.se-transition-card {
  min-height: 40px;
  padding: 6px 8px;
  border: 1px solid var(--se-line);
  border-radius: 9px;
  background: rgba(7, 12, 21, 0.5);
  color: var(--se-text);
  font-size: 11px;
  text-align: left;
}

.se-transition-card[aria-pressed="true"] { border-color: #60a5fa; background: rgba(37, 99, 235, 0.18); }

/* ------------------------------------------------------------- keyframes */

.se-kf-bar {
  position: relative;
  height: 26px;
  margin: 4px 0 8px;
  border-radius: 6px;
  background: rgba(148, 163, 184, 0.12);
  cursor: pointer;
}

.se-kf-diamond {
  position: absolute;
  top: 50%;
  width: 13px;
  height: 13px;
  margin: -6.5px 0 0 -6.5px;
  border: 2px solid #e0f2fe;
  border-radius: 2px;
  background: #0ea5e9;
  transform: rotate(45deg);
  cursor: pointer;
}

.se-kf-list { display: flex; flex-direction: column; gap: 5px; }

.se-kf-row {
  display: grid;
  grid-template-columns: 66px minmax(0, 1fr) 74px 32px 32px;
  align-items: center;
  gap: 5px;
  padding: 4px 5px;
  border: 1px solid var(--se-line);
  border-radius: 8px;
  background: rgba(7, 12, 21, 0.45);
  font-size: 11px;
}

.se-kf-row input,
.se-kf-row select { min-height: var(--se-tap); padding: 3px 5px; font-size: 11px; border-radius: 6px; }
.se-kf-row button { min-height: var(--se-tap); min-width: var(--se-tap); padding: 0; border-radius: 6px; border: 1px solid var(--se-line); background: transparent; color: var(--se-muted); }
.se-kf-row button:hover { color: #fff; background: rgba(148, 163, 184, 0.15); }

/* --------------------------------------------------------------- export */

.se-progress {
  height: 10px;
  border-radius: 99px;
  background: rgba(148, 163, 184, 0.2);
  overflow: hidden;
}

.se-progress > span {
  display: block;
  width: 0%;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, #3b82f6, #60a5fa);
  transition: width 0.2s linear;
}

.se-meta-list { display: grid; gap: 6px; margin: 10px 0 0; }
.se-meta-row { display: flex; justify-content: space-between; gap: 12px; font-size: 12px; }
.se-meta-row dt { color: var(--se-muted); }
.se-meta-row dd { margin: 0; font-variant-numeric: tabular-nums; text-align: right; }

/* --------------------------------------------------------------- toasts */

.se-toasts {
  position: fixed;
  left: 50%;
  bottom: calc(78px + env(safe-area-inset-bottom, 0px));
  z-index: 200;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  width: min(94vw, 460px);
  transform: translateX(-50%);
  pointer-events: none;
}

/* A sheet owns the bottom of the screen; keep messages clear of its controls. */
.se-app.has-sheet .se-toasts {
  top: 12px;
  bottom: auto;
}

.se-app.has-sheet .se-toast {
  padding: 8px 12px;
  font-size: 12px;
}

.se-toast {
  max-width: 100%;
  padding: 10px 14px;
  border: 1px solid rgba(148, 163, 184, 0.3);
  border-radius: 11px;
  background: rgba(15, 23, 42, 0.96);
  color: #e2e8f0;
  font-size: 12.5px;
  line-height: 1.4;
  text-align: center;
  box-shadow: 0 14px 30px -12px rgba(0, 0, 0, 0.7);
  animation: se-toast-in 0.2s ease-out;
}

.se-toast[data-tone="ok"] { border-color: rgba(52, 211, 153, 0.45); }
.se-toast[data-tone="warn"] { border-color: rgba(251, 191, 36, 0.45); }
.se-toast[data-tone="error"] { border-color: rgba(248, 113, 113, 0.5); }

@keyframes se-toast-in { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

/* ------------------------------------------------------------ responsive */

@media (max-width: 430px) {
  .se-app { border-radius: 0; border-left: 0; border-right: 0; }
  .se-stage { padding: 10px 8px 4px; }
  .se-controls { padding: 6px 9px 2px; }
  .se-header { padding: 8px 9px; }
  .se-empty h2 { font-size: 18px; }
  .se-empty p { font-size: 12.5px; }
  .se-moment-hint { display: none; }
  .se-save-status { display: none; }
}

@media (min-width: 560px) {
  .se-header { flex-wrap: nowrap; padding: 11px 16px; }
  .se-save-status { display: inline; }
  .se-stage { padding: 18px 18px 8px; }
  .se-controls { padding: 10px 16px 6px; }
  .se-sheet { border-radius: 20px; margin-bottom: 18px; }
  .se-sheet-backdrop { align-items: center; padding: 18px; }
  .se-sheet { border-bottom: 1px solid rgba(148, 163, 184, 0.25); }
}

@media (min-width: 760px) {
  .se-stage { padding: 22px 24px 10px; min-height: 300px; }
  .se-controls { padding: 12px 22px 8px; }
  .se-header { padding: 12px 20px; }
  .se-toolbar { grid-template-columns: repeat(5, minmax(0, 96px)); justify-content: center; }
  .se-tool { min-height: 48px; }
  .se-frame { border-radius: 16px; }
  .se-media-grid { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); }
}

@media (prefers-reduced-motion: reduce) {
  .se-app *,
  .se-app *::before,
  .se-app *::after { animation-duration: 0.01ms !important; animation-iteration-count: 1 !important; transition-duration: 0.01ms !important; }
}

/* ------------------------------------------------------------ guide text */

.se-guide { padding: 10px 0 48px; }
.se-guide-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 28px;
  align-items: start;
}
.se-article h2 { margin: 28px 0 8px; font-size: 1.35rem; letter-spacing: -0.02em; }
.se-article h2:first-child { margin-top: 0; }
.se-article p, .se-article li { color: #334155; }
.se-article .vc-steps { margin: 12px 0 0; }

@media (min-width: 900px) {
  .se-guide-grid { grid-template-columns: minmax(0, 1fr) 300px; gap: 40px; }
}
