:root {
  --bg: #e9f4ff;
  --bg-soft: #f6fbff;
  --card: rgba(255, 255, 255, 0.76);
  --card-border: rgba(37, 99, 235, 0.16);
  --text: #102a4c;
  --text-dim: #5b7799;
  --accent: #2f7bff;
  --accent-2: #06b6d4;
  --success: #0d9f6e;
  --danger: #e5484d;
  --radius: 16px;
  --radius-sm: 10px;
  --shadow: 0 20px 50px -26px rgba(37, 99, 235, 0.35);
}

* { box-sizing: border-box; }

.hidden { display: none !important; }

html, body { margin: 0; padding: 0; min-height: 100%; }
html { -webkit-text-size-adjust: 100%; }

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  background: var(--bg);
  color: var(--text);
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
  position: relative;
  overflow-x: hidden;
}

/* Light tech backdrop: soft blue glows + engineering grid + dot matrix + rings */
.bg-grid {
  position: fixed; inset: 0; z-index: -1; overflow: hidden; pointer-events: none;
  background:
    radial-gradient(circle at 84% 16%, transparent 0 118px, rgba(47, 123, 255, 0.12) 119px 120px, transparent 121px),
    radial-gradient(circle at 84% 16%, transparent 0 156px, rgba(6, 182, 212, 0.09) 157px 158px, transparent 159px),
    radial-gradient(circle at 10% 82%, transparent 0 168px, rgba(6, 182, 212, 0.10) 169px 170px, transparent 171px),
    radial-gradient(circle at 10% 82%, transparent 0 206px, rgba(47, 123, 255, 0.07) 207px 208px, transparent 209px),
    radial-gradient(46% 42% at 14% 6%, rgba(56, 189, 248, 0.30), transparent 66%),
    radial-gradient(42% 40% at 90% 0%, rgba(47, 123, 255, 0.22), transparent 66%),
    radial-gradient(52% 46% at 80% 94%, rgba(6, 182, 212, 0.18), transparent 66%),
    linear-gradient(180deg, #f4faff 0%, #e8f3ff 52%, #ddebff 100%);
}

.bg-grid::before {
  content: ""; position: absolute; inset: 0;
  background-image:
    linear-gradient(rgba(47, 123, 255, 0.06) 1px, transparent 1px),
    linear-gradient(90deg, rgba(47, 123, 255, 0.06) 1px, transparent 1px);
  background-size: 46px 46px;
  -webkit-mask-image: radial-gradient(ellipse 92% 74% at 50% 24%, #000 38%, transparent 100%);
  mask-image: radial-gradient(ellipse 92% 74% at 50% 24%, #000 38%, transparent 100%);
}

.bg-grid::after {
  content: ""; position: absolute; inset: 0;
  background-image: radial-gradient(rgba(37, 99, 235, 0.26) 1.1px, transparent 1.1px);
  background-size: 23px 23px;
  -webkit-mask-image: linear-gradient(180deg, rgba(0,0,0,.85), rgba(0,0,0,.15) 55%, transparent 88%);
  mask-image: linear-gradient(180deg, rgba(0,0,0,.85), rgba(0,0,0,.15) 55%, transparent 88%);
  opacity: 0.3;
}

.container { max-width: 960px; margin: 0 auto; padding: 52px 20px 40px; }

/* Hero */
.hero { text-align: center; margin-bottom: 28px; }
.logo {
  display: inline-flex; align-items: center; gap: 10px;
  padding: 6px 14px 6px 8px; border-radius: 999px;
  background: rgba(255, 255, 255, 0.72); border: 1px solid var(--card-border);
  margin-bottom: 20px; font-weight: 600; font-size: 15px;
  box-shadow: 0 6px 20px -14px rgba(37, 99, 235, 0.5);
}
.hero h1 {
  font-size: clamp(26px, 5vw, 42px); margin: 0 0 12px; letter-spacing: -0.02em;
  background: linear-gradient(135deg, #0e2a4f 28%, #2f7bff 78%);
  -webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: transparent;
}
.subtitle { color: var(--text-dim); margin: 0 auto; max-width: 620px; line-height: 1.65; font-size: 15px; }

.platforms { display: flex; flex-wrap: wrap; gap: 10px; justify-content: center; margin-top: 22px; }
.chip {
  display: inline-flex; align-items: center; gap: 8px; padding: 6px 13px;
  border-radius: 999px; background: rgba(255, 255, 255, 0.66);
  border: 1px solid var(--card-border); font-size: 13px; color: var(--text-dim);
}
.dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; background: var(--accent); }

/* Tabs */
.tabs {
  display: flex; gap: 6px; margin: 30px 0 20px; padding: 5px;
  background: rgba(255, 255, 255, 0.62); border: 1px solid var(--card-border);
  border-radius: 14px; width: fit-content; max-width: 100%; overflow-x: auto;
}
.tab {
  appearance: none; border: none; background: transparent; color: var(--text-dim);
  padding: 9px 18px; border-radius: 10px; font-size: 14px; font-weight: 600;
  cursor: pointer; white-space: nowrap; transition: all 0.16s; font-family: inherit;
}
.tab:hover { color: var(--text); }
.tab.active { background: linear-gradient(135deg, var(--accent), var(--accent-2)); color: #fff; }
.tabs-inline { margin: 0 0 16px; }

.panel { display: none; animation: fade 0.25s ease; }
.panel.active { display: block; }
@keyframes fade { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

/* Card */
.card {
  background: var(--card); border: 1px solid var(--card-border);
  border-radius: var(--radius); padding: 22px; backdrop-filter: blur(12px);
  box-shadow: var(--shadow); margin-bottom: 18px;
}

.input-row { display: flex; gap: 12px; }
.input-wrap { position: relative; flex: 1; }
#link-input {
  width: 100%; padding: 14px 46px 14px 16px; font-size: 15px; color: var(--text);
  background: rgba(255, 255, 255, 0.85); border: 1px solid var(--card-border);
  border-radius: var(--radius-sm); outline: none; font-family: inherit;
  transition: border-color 0.2s, box-shadow 0.2s;
}
#link-input::placeholder { color: #93aac6; }
#link-input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(47, 123, 255, 0.16); }
.icon-btn {
  position: absolute; right: 6px; top: 50%; transform: translateY(-50%);
  background: transparent; border: none; color: var(--text-dim); cursor: pointer;
  padding: 8px; border-radius: 8px; display: flex;
}
.icon-btn:hover { background: rgba(47, 123, 255, 0.1); color: var(--text); }

.primary-btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 0 26px; font-size: 15px; font-weight: 600; color: #fff;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  border: none; border-radius: var(--radius-sm); cursor: pointer;
  min-width: 120px; white-space: nowrap; transition: transform 0.15s, box-shadow 0.15s, opacity 0.15s;
}
.primary-btn:hover:not(:disabled) { transform: translateY(-1px); box-shadow: 0 10px 26px -10px rgba(47, 123, 255, 0.65); }
.primary-btn:disabled { opacity: 0.65; cursor: not-allowed; }
.btn-spinner {
  width: 15px; height: 15px; border: 2px solid rgba(255, 255, 255, 0.3);
  border-top-color: #fff; border-radius: 50%; display: none; animation: spin 0.7s linear infinite;
}
.btn-spinner.show { display: inline-block; }
@keyframes spin { to { transform: rotate(360deg); } }

.hint { margin: 12px 2px 0; font-size: 12.5px; color: var(--text-dim); line-height: 1.5; }

/* Dropzone */
.dropzone { text-align: center; padding: 40px 22px; cursor: pointer; transition: border-color 0.2s, background 0.2s; }
.dropzone:hover, .dropzone.dragover { border-color: var(--accent); background: rgba(47, 123, 255, 0.07); }
.dz-icon { color: var(--accent); margin-bottom: 8px; }
.dz-title { font-size: 16px; font-weight: 600; margin: 6px 0 6px; }
.dz-sub { color: var(--text-dim); font-size: 13px; margin: 0; }

/* Editor preview */
.editor-head { display: flex; gap: 10px; flex-wrap: wrap; margin-bottom: 12px; }
.badge { font-size: 12.5px; padding: 5px 11px; border-radius: 999px; background: rgba(47, 123, 255, 0.12); color: #1f63d6; border: 1px solid rgba(47, 123, 255, 0.28); }
.badge.soft { background: rgba(255, 255, 255, 0.62); color: var(--text-dim); border-color: var(--card-border); }

.preview-wrap { position: relative; border-radius: 12px; overflow: hidden; background: #000; line-height: 0; user-select: none; }
.preview-wrap img { width: 100%; height: auto; display: block; }
.preview-wrap canvas { position: absolute; inset: 0; width: 100%; height: 100%; cursor: crosshair; touch-action: none; }
.preview-play {
  position: absolute; right: 12px; bottom: 12px; z-index: 3;
  width: 48px; height: 48px; border-radius: 50%; padding: 0;
  display: grid; place-items: center; cursor: pointer; color: #fff;
  border: 1px solid rgba(255, 255, 255, 0.5);
  background: rgba(8, 20, 38, 0.62);
  backdrop-filter: blur(8px); box-shadow: 0 8px 24px rgba(0, 0, 0, 0.35);
  transition: background 0.18s, transform 0.18s;
}
.preview-play:hover { background: rgba(8, 20, 38, 0.82); transform: scale(1.05); }
.link-btn { background: none; border: none; color: var(--accent); font: inherit; font-size: 12.5px; cursor: pointer; padding: 4px 2px; margin-left: auto; }
.download-hint { margin: 10px 0 0; font-size: 12px; color: var(--text-dim); line-height: 1.6; }

/* Fullscreen media preview */
body.modal-open { overflow: hidden; }
.media-modal {
  position: fixed; inset: 0; z-index: 300; display: flex; align-items: center; justify-content: center;
  padding: calc(12px + env(safe-area-inset-top, 0px)) 12px calc(12px + env(safe-area-inset-bottom, 0px));
  background: rgba(4, 12, 24, 0.84); backdrop-filter: blur(10px);
}
.media-modal-inner { width: min(920px, 100%); max-height: 100%; display: flex; flex-direction: column; gap: 10px; }
.media-modal-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; color: #fff; padding: 0 4px; }
.media-modal-head strong { font-size: 14px; font-weight: 600; }
.modal-close {
  width: 38px; height: 38px; border-radius: 50%; cursor: pointer; color: #fff;
  border: 1px solid rgba(255, 255, 255, 0.25); background: rgba(255, 255, 255, 0.1);
  font-size: 22px; line-height: 1;
}
.media-modal-body { flex: 1; min-height: 0; display: flex; align-items: center; justify-content: center; }
.modal-video { width: auto; max-width: 100%; max-height: calc(100vh - 220px); max-height: calc(100dvh - 220px); border-radius: 12px; background: #000; }
.modal-image { max-width: 100%; max-height: calc(100vh - 220px); max-height: calc(100dvh - 220px); border-radius: 12px; object-fit: contain; }
.media-modal-actions { display: flex; gap: 10px; justify-content: flex-end; }
.modal-hint { margin: 0; text-align: center; font-size: 11.5px; color: rgba(255, 255, 255, 0.62); }

.editor-actions { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-top: 12px; flex-wrap: wrap; }
.tip { font-size: 12.5px; color: var(--text-dim); }
.row-actions { display: flex; gap: 8px; align-items: center; }
.row-actions.wrap { flex-wrap: wrap; gap: 14px; }
.inline-select {
  padding: 9px 12px; border-radius: 9px; background: rgba(255, 255, 255, 0.85);
  color: var(--text); border: 1px solid var(--card-border); font-family: inherit; font-size: 14px;
}

/* Tool cards */
.grid-cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(255px, 100%), 1fr)); gap: 14px; margin-bottom: 18px; }
.tool-card {
  background: var(--card); border: 1px solid var(--card-border); border-radius: var(--radius);
  padding: 20px; display: flex; flex-direction: column; gap: 10px;
}
.tool-card.wide { grid-column: 1 / -1; }
.tool-card h3 { margin: 0; font-size: 16px; }
.tool-card > p { margin: 0 0 4px; color: var(--text-dim); font-size: 13px; line-height: 1.55; }
.tool-card.premium { border-color: rgba(47, 123, 255, 0.35); box-shadow: 0 12px 34px -24px rgba(47, 123, 255, 0.8); }
.price-tag {
  font-size: 11.5px; font-weight: 600; color: #0b63c8; vertical-align: middle;
  background: rgba(47, 123, 255, 0.1); border: 1px solid rgba(47, 123, 255, 0.25);
  padding: 2px 8px; border-radius: 999px; margin-left: 6px;
}
.dedup-list {
  margin: 0; padding-left: 18px; color: var(--text-dim);
  font-size: 12.5px; line-height: 1.85;
}
.pc-price small { font-size: 14px; font-weight: 500; -webkit-text-fill-color: var(--text-dim); }

/* Cartoon avatar picker */
.avatar-picker { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 10px; }
.avatar-item {
  display: flex; flex-direction: column; align-items: center; gap: 6px;
  padding: 8px 6px; border-radius: 12px; cursor: pointer;
  border: 1px solid var(--card-border); background: rgba(255, 255, 255, 0.6);
  color: var(--text-dim); font: inherit; font-size: 12.5px; line-height: 1.2;
  transition: border-color 0.16s, background 0.16s, box-shadow 0.16s, color 0.16s;
}
.avatar-item img { width: 100%; max-width: 64px; aspect-ratio: 1; object-fit: contain; display: block; }
.avatar-item:hover { border-color: rgba(47, 123, 255, 0.45); background: rgba(255, 255, 255, 0.92); }
.avatar-item.active {
  border-color: var(--accent); color: var(--text); background: rgba(47, 123, 255, 0.1);
  box-shadow: 0 0 0 3px rgba(47, 123, 255, 0.14);
}
.avatar-group-title {
  grid-column: 1 / -1; display: flex; align-items: center; gap: 10px;
  margin: 4px 0 0; font-size: 12.5px; font-weight: 600; color: var(--text-dim);
}
.avatar-group-title::after {
  content: ""; flex: 1; height: 1px; background: var(--card-border);
}

/* Fields */
.field { display: flex; flex-direction: column; gap: 6px; font-size: 13px; color: var(--text-dim); }
.field > span b { color: var(--text); font-weight: 600; }
.field select, .field input[type="text"] {
  padding: 9px 11px; border-radius: 9px; background: rgba(255, 255, 255, 0.85);
  color: var(--text); border: 1px solid var(--card-border); font-family: inherit; font-size: 14px;
  outline: none;
}
.field select:focus, .field input[type="text"]:focus { border-color: var(--accent); }
.field input[type="range"] { width: 100%; accent-color: var(--accent); }
.field input[type="color"] { width: 100%; height: 36px; border: 1px solid var(--card-border); border-radius: 9px; background: rgba(255,255,255,0.85); cursor: pointer; }
.voice-row { display: flex; gap: 8px; align-items: center; }
.voice-row select { flex: 1; min-width: 0; }
.voice-row .btn { flex: 0 0 auto; }
.form-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(150px, 100%), 1fr)); gap: 12px; margin-bottom: 12px; }
.check { display: inline-flex; align-items: center; gap: 7px; font-size: 13px; color: var(--text-dim); cursor: pointer; }
.check input { accent-color: var(--accent); width: 16px; height: 16px; }

/* Buttons */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 11px 18px; font-size: 14px; font-weight: 600; border-radius: var(--radius-sm);
  border: 1px solid var(--card-border); cursor: pointer; transition: all 0.15s;
  text-decoration: none; font-family: inherit; color: var(--text); background: rgba(255, 255, 255, 0.68);
}
.btn:hover { transform: translateY(-1px); }
.btn:disabled { opacity: 0.6; cursor: not-allowed; transform: none; }
.btn-primary { background: linear-gradient(135deg, var(--accent), var(--accent-2)); border: none; color: #fff; }
.btn-ghost { background: rgba(255, 255, 255, 0.68); }
.btn-ghost:hover { background: rgba(255, 255, 255, 0.98); }
.btn-sm { padding: 7px 13px; font-size: 13px; }

/* Copy blocks */
.copy-block { background: rgba(255, 255, 255, 0.58); border: 1px solid var(--card-border); border-radius: 10px; padding: 12px 14px; margin-top: 10px; }
.copy-head { display: flex; justify-content: space-between; align-items: center; font-size: 12.5px; color: var(--text-dim); margin-bottom: 6px; }
.copy-btn { background: transparent; border: 1px solid var(--card-border); color: var(--accent); border-radius: 7px; padding: 3px 10px; font-size: 12px; cursor: pointer; font-family: inherit; }
.copy-btn:hover { background: rgba(47, 123, 255, 0.12); }
.copy-text { margin: 0; font-size: 14px; line-height: 1.6; white-space: pre-wrap; }
.copy-text.mono { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 12.5px; color: var(--text-dim); max-height: 220px; overflow: auto; }

/* Result */
.result { margin-top: 6px; }
.result.hidden { display: none; }
.result-card { background: var(--card); border: 1px solid var(--card-border); border-radius: var(--radius); padding: 20px; margin-bottom: 16px; }
.result-card.error { border-color: rgba(251, 113, 133, 0.4); background: rgba(251, 113, 133, 0.06); }
.result-card h4 { margin: 0 0 12px; font-size: 15px; }
.video-preview {
  display: block; width: auto; height: auto;
  max-width: 100%; max-height: 70vh;
  margin-inline: auto;
  border-radius: var(--radius-sm); background: #000;
}
.meta { margin-top: 14px; }
.meta-title { font-size: 15px; font-weight: 600; margin: 0 0 6px; line-height: 1.4; }
.meta-author { font-size: 13px; color: var(--text-dim); margin: 0; }
.actions { display: flex; gap: 10px; margin-top: 16px; flex-wrap: wrap; }
.error-title { color: var(--danger); font-weight: 600; margin: 0 0 6px; }
.error-msg { color: var(--text-dim); margin: 0; line-height: 1.5; word-break: break-word; }

/* Pricing */
.pricing-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(270px, 100%), 1fr)); gap: 16px; }
.price-card { background: var(--card); border: 1px solid var(--card-border); border-radius: var(--radius); padding: 22px; }
.price-card.free { border-color: rgba(52, 211, 153, 0.4); }
.pc-head { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.pc-head h3 { margin: 0; font-size: 17px; }
.pc-badge { font-size: 12px; padding: 3px 10px; border-radius: 999px; background: rgba(52, 211, 153, 0.16); color: var(--success); border: 1px solid rgba(52, 211, 153, 0.35); }
.pc-badge.soft { background: rgba(255, 255, 255, 0.7); color: var(--text-dim); border-color: var(--card-border); }
.pc-desc { color: var(--text-dim); font-size: 13px; margin: 8px 0 4px; }
.pc-price { font-size: 34px; font-weight: 700; margin: 8px 0; background: linear-gradient(135deg, #0e2a4f, #2f7bff); -webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: transparent; }
.price-card ul { margin: 12px 0 0; padding-left: 18px; color: var(--text-dim); font-size: 13.5px; line-height: 1.9; }
.tier-list { display: flex; flex-direction: column; gap: 10px; margin-top: 12px; }
.tier { display: flex; flex-direction: column; gap: 3px; padding: 11px 13px; background: rgba(255, 255, 255, 0.6); border-radius: 10px; border: 1px solid var(--card-border); }
.tier span { font-weight: 600; font-size: 14px; }
.tier b { font-weight: 400; color: var(--text-dim); font-size: 12.5px; }
.pack-list { display: flex; flex-direction: column; gap: 10px; margin-top: 12px; }
.pack { display: flex; align-items: center; gap: 12px; padding: 12px 14px; background: rgba(255, 255, 255, 0.6); border-radius: 10px; border: 1px solid var(--card-border); }
.pack-price { font-weight: 700; font-size: 15px; color: #2f7bff; min-width: 64px; }
.pack b { margin-left: auto; font-weight: 500; color: var(--text-dim); font-size: 12.5px; }
.pack-btn { width: 100%; font: inherit; text-align: left; color: var(--text); cursor: pointer; transition: all .18s; }
.pack-btn:hover { border-color: var(--accent); background: rgba(47, 123, 255, 0.07); }
.pack-btn span { font-size: 13.5px; }

/* Hero top + points chip */
.hero-top { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.points-chip {
  display: inline-flex; align-items: center; gap: 6px; padding: 7px 14px; font: inherit; font-size: 13px;
  color: var(--text-dim); background: rgba(255, 255, 255, 0.72); border: 1px solid var(--card-border);
  border-radius: 999px; cursor: pointer; transition: all .18s; white-space: nowrap;
}
.points-chip b { color: var(--accent); font-size: 15px; }
.points-chip:hover { border-color: var(--accent); color: var(--text); }

/* Points payment modal */
.pay-modal {
  position: fixed; inset: 0; z-index: 72; display: flex; align-items: center; justify-content: center;
  padding: 20px; background: rgba(9, 25, 45, 0.55); backdrop-filter: blur(4px); overflow: auto;
}
.pay-card {
  width: min(420px, 100%); background: #fff; border-radius: 18px; padding: 22px;
  box-shadow: 0 32px 80px -24px rgba(9, 25, 45, 0.6);
}
.pay-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.pay-head strong { font-size: 17px; }
.pay-sub { margin: 4px 0 0; font-size: 12.5px; color: var(--text-dim); line-height: 1.5; }
.pay-close {
  flex: none; width: 34px; height: 34px; border: none; border-radius: 50%; background: rgba(37, 99, 235, 0.08);
  color: var(--text-dim); font-size: 20px; line-height: 1; cursor: pointer; font-family: inherit;
}
.pay-close:hover { background: rgba(37, 99, 235, 0.16); color: var(--text); }
.pay-balance-row {
  display: flex; align-items: baseline; gap: 6px; margin: 16px 0 14px; padding: 10px 14px;
  background: rgba(47, 123, 255, 0.07); border-radius: 10px; font-size: 13px; color: var(--text-dim);
}
.pay-balance-row b { font-size: 20px; color: var(--accent); }
.pay-short { margin-left: auto; color: #b7791f; font-size: 12px; }
.pay-packs { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.pay-pack {
  display: flex; flex-direction: column; gap: 4px; align-items: center; padding: 12px 6px;
  border: 1.5px solid var(--card-border); border-radius: 12px; background: rgba(255, 255, 255, 0.7);
  font: inherit; cursor: pointer; color: var(--text); transition: all .18s;
}
.pay-pack:hover { border-color: var(--accent); }
.pay-pack.active { border-color: var(--accent); background: rgba(47, 123, 255, 0.09); box-shadow: 0 0 0 3px rgba(47, 123, 255, 0.12); }
.pay-pack-count { font-size: 14px; font-weight: 600; }
.pay-pack-price { font-size: 12.5px; color: var(--text-dim); }
.pay-qr-wrap { margin: 16px auto 10px; display: flex; align-items: center; justify-content: center; min-height: 180px; }
.pay-qr-wrap img { width: 200px; height: 200px; object-fit: contain; border-radius: 12px; border: 1px solid var(--card-border); background: #fff; }
.pay-qr-empty { text-align: center; font-size: 13px; color: var(--text-dim); padding: 26px 12px; border: 1px dashed var(--card-border); border-radius: 12px; }
.pay-contact { text-align: center; font-size: 13px; color: var(--text); margin: 0 0 14px; white-space: pre-wrap; }
.pay-main-btn { width: 100%; }
.pay-note { margin: 10px 0 0; font-size: 11.5px; color: var(--text-dim); text-align: center; line-height: 1.6; }
.pay-wait { display: flex; align-items: center; gap: 14px; padding: 20px 16px; margin: 12px 0 14px; background: rgba(47, 123, 255, 0.07); border-radius: 12px; }
.pay-wait strong { font-size: 14px; }

/* Dedup-only landing */
.container.narrow { max-width: 720px; padding-top: 40px; }
.container.narrow .card { box-shadow: 0 14px 36px -30px rgba(37, 99, 235, 0.5); }
.hero.hero-compact { margin-bottom: 20px; }
.hero-compact .logo { margin-bottom: 0; font-size: 14px; }
.hero-compact h1 { font-size: 27px; margin: 14px 0 6px; }
.hero-compact .subtitle { font-size: 13.5px; max-width: 520px; }

.dedup-main { padding: 18px; }
.dedup-main .dropzone {
  padding: 32px 18px; border: 1.5px dashed var(--card-border);
  border-radius: 12px; background: rgba(255, 255, 255, 0.5);
}
.dedup-main .dropzone:hover,
.dedup-main .dropzone.dragover { border-color: var(--accent); }
.dedup-main #video-editor { margin-top: 4px; }
.dedup-main .video-preview { margin: 4px auto 12px; }
.btn-block { width: 100%; }

.dedup-list {
  display: grid; grid-template-columns: 1fr 1fr; gap: 8px;
  margin: 14px 0 16px; padding: 0; list-style: none;
}
.dedup-list li {
  position: relative; padding: 9px 12px 9px 24px; font-size: 12.5px; color: var(--text-dim);
  background: rgba(255, 255, 255, 0.55); border: 1px solid var(--card-border); border-radius: 8px;
}
.dedup-list li::before {
  content: ""; position: absolute; left: 11px; top: 50%; width: 5px; height: 5px;
  margin-top: -2.5px; border-radius: 50%; background: var(--accent); opacity: 0.55;
}

/* Billing strip */
.billing { padding: 16px 18px; }
.billing-top { display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap; margin-bottom: 10px; }
.billing-price { font-size: 21px; font-weight: 700; line-height: 1; }
.billing-price b { color: var(--accent); }
.billing-price small { font-size: 12px; font-weight: 500; color: var(--text-dim); margin-left: 2px; }
.billing-note { font-size: 12px; color: var(--text-dim); }
.billing .pack-list { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; margin: 0; }
.billing .pack { flex-direction: column; align-items: flex-start; gap: 2px; padding: 9px 11px; background: rgba(255, 255, 255, 0.55); }
.billing .pack .pack-price { font-size: 14px; min-width: 0; }
.billing .pack span { font-size: 11.5px; }
.billing .pack b { margin-left: 0; font-size: 10.5px; }

@media (max-width: 640px) {
  .container.narrow { padding: 26px 14px 30px; }
  .hero-compact h1 { font-size: 23px; }
  .dedup-main { padding: 14px; }
  .dedup-main .dropzone { padding: 26px 14px; }
  .dedup-list { gap: 6px; }
  .dedup-list li { padding: 8px 8px 8px 22px; font-size: 12px; }
  .billing { padding: 14px; }
  .billing .pack-list { gap: 6px; }
  .billing .pack { padding: 8px; }
}


.notice {
  margin-top: 14px; padding: 12px 14px; font-size: 12px; line-height: 1.7; color: #6b7f94;
  background: rgba(255, 255, 255, 0.5); border: 1px solid var(--card-border);
  border-left: 3px solid rgba(217, 155, 18, 0.5); border-radius: 10px;
}

/* Footer & toast */
.foot { margin-top: 26px; text-align: center; color: #869db6; font-size: 11.5px; line-height: 1.7; }
.foot p { margin: 2px 0; }
.foot a { color: #2f7bff; text-decoration: none; }
.foot a:hover { text-decoration: underline; }

/* Legal pages (privacy policy) */
.legal { max-width: 780px; margin: 0 auto; }
.legal h1 { font-size: 22px; margin: 0 0 6px; }
.legal h2 { font-size: 15px; margin: 24px 0 8px; color: var(--text); }
.legal p, .legal li { font-size: 13.5px; line-height: 1.9; color: #4a6076; }
.legal ul { margin: 6px 0; padding-left: 20px; }
.legal li { margin: 4px 0; }
.legal .meta { color: #7d94b1; font-size: 12px; margin-bottom: 16px; }
.legal a { color: #2f7bff; }
.legal-back { margin-top: 28px; }

.toast {
  position: fixed; left: 50%; bottom: 28px; transform: translateX(-50%) translateY(20px);
  background: rgba(255, 255, 255, 0.97); border: 1px solid var(--card-border);
  color: var(--text); padding: 12px 20px; border-radius: 12px; font-size: 14px;
  opacity: 0; pointer-events: none; transition: all 0.25s; z-index: 50; max-width: 90vw;
  box-shadow: 0 14px 44px -18px rgba(15, 42, 76, 0.45);
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
.toast.error { border-color: rgba(229, 72, 77, 0.45); }
.toast.success { border-color: rgba(13, 159, 110, 0.45); }

/* Sticky processing banner so long tasks never look frozen */
.task-banner {
  position: fixed; left: 50%; bottom: 84px; transform: translateX(-50%);
  display: flex; align-items: center; gap: 12px; z-index: 48;
  background: rgba(255, 255, 255, 0.98); border: 1px solid rgba(47, 123, 255, 0.28);
  border-radius: 14px; padding: 12px 18px; max-width: min(92vw, 420px);
  box-shadow: 0 18px 48px -20px rgba(15, 42, 76, 0.5);
}
.task-banner.hidden { display: none; }
.tb-spinner {
  width: 18px; height: 18px; flex: none; border-radius: 50%;
  border: 2px solid rgba(47, 123, 255, 0.22); border-top-color: #2f7bff;
  animation: tb-spin 0.8s linear infinite;
}
.tb-text { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.tb-text strong { font-size: 13.5px; color: var(--text); }
.tb-text span { font-size: 12px; color: var(--text-dim); }
@keyframes tb-spin { to { transform: rotate(360deg); } }

.retention { margin: 10px 0 0; font-size: 12px; color: #a36c00; background: rgba(251, 191, 36, 0.12); border-radius: 8px; padding: 7px 10px; }

/* Loading overlay inside buttons */
.loading-label { opacity: 0.8; }

button, .btn, .tab { touch-action: manipulation; }

@media (max-width: 620px) {
  .container {
    padding: 30px max(14px, env(safe-area-inset-left)) calc(28px + env(safe-area-inset-bottom))
      max(14px, env(safe-area-inset-right));
  }
  .hero { margin-bottom: 20px; }
  .hero h1 { font-size: clamp(24px, 7vw, 32px); }
  .subtitle { font-size: 14px; line-height: 1.7; }
  .platforms { gap: 8px; margin-top: 16px; }
  .chip { padding: 6px 11px; font-size: 12.5px; }

  .tabs {
    width: 100%; margin: 18px 0 16px; gap: 4px; scrollbar-width: none;
    position: sticky; top: env(safe-area-inset-top, 0px); z-index: 25;
    background: rgba(233, 244, 255, 0.95); backdrop-filter: blur(14px);
    box-shadow: 0 10px 24px -22px rgba(15, 42, 76, 0.65);
  }
  .tabs::-webkit-scrollbar { display: none; }
  .tab { flex: 1; min-width: 0; padding: 10px 6px; font-size: 13.5px; }

  .card { padding: 16px; border-radius: 14px; }
  .tool-card { padding: 16px; }
  .dropzone { padding: 32px 16px; }

  .input-row { flex-direction: column; }
  .primary-btn { width: 100%; padding: 14px; }
  .tool-card > .btn { width: 100%; }
  .card > .btn { width: 100%; }

  /* 16px avoids automatic zoom when focusing inputs on iOS. */
  #link-input,
  .field select,
  .field input[type="text"],
  .inline-select { font-size: 16px; }

  .editor-actions { flex-direction: column; align-items: stretch; }
  .form-grid { grid-template-columns: 1fr; }
  .row-actions { flex-wrap: wrap; }
  .row-actions .btn { flex: 1 1 auto; }
  .actions { flex-direction: column; }
  .actions .btn { width: 100%; }
  .copy-btn { padding: 6px 12px; }

  .video-preview { max-height: 62vh; max-height: 62dvh; }
  #video-editor, #img-editor, #link-result, #video-result, #img-result, #transcript-box { scroll-margin-top: calc(66px + env(safe-area-inset-top, 0px)); }
  .panel { scroll-margin-top: calc(70px + env(safe-area-inset-top, 0px)); }
  .pack { flex-wrap: wrap; }
  .pack b { margin-left: auto; }
  .notice { padding: 14px; font-size: 12.5px; }

  .avatar-picker { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
  .avatar-item { padding: 8px 4px; font-size: 12px; }
  .avatar-item img { max-width: 58px; }

  .preview-play { width: 52px; height: 52px; }
  .media-modal-inner { gap: 12px; }
  .media-modal-head strong { font-size: 13.5px; }
  .modal-close { width: 40px; height: 40px; }
  .modal-video, .modal-image { max-height: calc(100vh - 250px); max-height: calc(100dvh - 250px); }
  .media-modal-actions { flex-direction: column; }
  .media-modal-actions .btn { width: 100%; }
  .foot { margin-top: 28px; padding-bottom: env(safe-area-inset-bottom); }

  .toast {
    bottom: calc(18px + env(safe-area-inset-bottom));
    width: calc(100% - 28px);
    max-width: 420px;
    text-align: center;
  }

  .task-banner {
    bottom: calc(82px + env(safe-area-inset-bottom));
    width: calc(100% - 28px);
    max-width: 420px;
    padding: 11px 15px;
  }
}

@media (max-width: 380px) {
  .container { padding-left: max(10px, env(safe-area-inset-left)); padding-right: max(10px, env(safe-area-inset-right)); }
  .card, .tool-card { padding: 14px; }
  .pc-price { font-size: 30px; }
}

/* ===== Customer service chat ===== */
.chat-fab {
  position: fixed; right: 22px; bottom: 22px; z-index: 60;
  display: inline-flex; align-items: center; gap: 7px;
  padding: 11px 16px; border: none; border-radius: 999px;
  background: linear-gradient(135deg, #2f7bff, #06b6d4);
  color: #fff; font-size: 13.5px; font-weight: 600; cursor: pointer;
  box-shadow: 0 14px 30px -12px rgba(47, 123, 255, .65);
  transition: transform .18s ease, box-shadow .18s ease;
}
.chat-fab:hover { transform: translateY(-2px); box-shadow: 0 18px 34px -12px rgba(47, 123, 255, .72); }
.chat-fab.active { opacity: .92; }
.chat-dot {
  position: absolute; top: 4px; right: 8px; width: 9px; height: 9px;
  border-radius: 50%; background: #ff4d6d; border: 2px solid #fff;
}

.chat-panel {
  position: fixed; right: 22px; bottom: 84px; z-index: 61;
  width: 372px; max-width: calc(100vw - 24px);
  height: 540px; max-height: calc(100vh - 120px);
  display: flex; flex-direction: column;
  background: rgba(255, 255, 255, .96);
  backdrop-filter: blur(14px);
  border: 1px solid var(--card-border); border-radius: 20px;
  box-shadow: 0 30px 70px -30px rgba(16, 42, 76, .5);
  overflow: hidden;
}
.chat-head {
  display: flex; align-items: flex-start; justify-content: space-between; gap: 10px;
  padding: 15px 16px 12px;
  background: linear-gradient(135deg, rgba(47, 123, 255, .1), rgba(6, 182, 212, .08));
  border-bottom: 1px solid var(--card-border);
}
.chat-head strong { font-size: 15px; }
.chat-head p { margin: 3px 0 0; font-size: 12px; color: var(--text-dim); }
.chat-body {
  flex: 1; overflow-y: auto; padding: 14px; display: flex; flex-direction: column; gap: 10px;
  background: rgba(246, 251, 255, .6);
}
.chat-empty { margin: auto; font-size: 12.5px; color: var(--text-dim); text-align: center; padding: 0 16px; line-height: 1.7; }
.chat-msg { display: flex; flex-direction: column; gap: 3px; max-width: 82%; }
.chat-msg.mine { align-self: flex-end; align-items: flex-end; }
.chat-msg.theirs { align-self: flex-start; align-items: flex-start; }
.chat-bubble {
  padding: 9px 12px; border-radius: 14px; font-size: 13.5px; line-height: 1.55;
  white-space: pre-wrap; word-break: break-word;
}
.chat-msg.mine .chat-bubble { background: linear-gradient(135deg, #2f7bff, #5b8dff); color: #fff; border-bottom-right-radius: 5px; }
.chat-msg.theirs .chat-bubble { background: #fff; color: var(--text); border: 1px solid var(--card-border); border-bottom-left-radius: 5px; }
.chat-bubble .chat-img { display: block; max-width: 220px; max-height: 240px; border-radius: 10px; cursor: zoom-in; }
.chat-time { font-size: 11px; color: var(--text-dim); }
.chat-preview {
  position: relative; padding: 8px 14px 0; display: flex; align-items: center; gap: 8px;
  border-top: 1px solid var(--card-border); background: #fff;
}
.chat-preview img { width: 54px; height: 54px; object-fit: cover; border-radius: 8px; border: 1px solid var(--card-border); }
.chat-preview button {
  position: absolute; top: 4px; left: 58px; width: 20px; height: 20px; border-radius: 50%;
  border: none; background: rgba(16, 42, 76, .75); color: #fff; font-size: 12px; line-height: 1; cursor: pointer;
}
.chat-compose {
  display: flex; align-items: flex-end; gap: 8px; padding: 10px 12px 12px;
  border-top: 1px solid var(--card-border); background: #fff;
}
.chat-compose textarea {
  flex: 1; resize: none; max-height: 96px; padding: 9px 11px; font-size: 13.5px; line-height: 1.5;
  border: 1px solid var(--card-border); border-radius: 12px; background: var(--bg-soft);
  color: var(--text); font-family: inherit; outline: none;
}
.chat-compose textarea:focus { border-color: rgba(47, 123, 255, .55); box-shadow: 0 0 0 3px rgba(47, 123, 255, .1); }
.chat-img-btn {
  flex: none; width: 38px; height: 38px; display: inline-flex; align-items: center; justify-content: center;
  border: 1px solid var(--card-border); border-radius: 11px; background: var(--bg-soft);
  color: var(--text-dim); cursor: pointer;
}
.chat-img-btn:hover { color: var(--accent); border-color: rgba(47, 123, 255, .45); }
.chat-send { flex: none; height: 38px; padding: 0 16px; border-radius: 11px; font-size: 13.5px; }
.pay-chat-link { display: block; margin: 2px 0 8px; font-size: 13px; }

@media (max-width: 640px) {
  .chat-fab { right: 14px; bottom: 14px; padding: 10px 14px; font-size: 13px; }
  .chat-panel {
    right: 10px; left: 10px; bottom: 74px; width: auto;
    height: min(72vh, 560px);
  }
  .chat-bubble .chat-img { max-width: 180px; }
}

/* ===== Admin customer service ===== */
.nav-badge {
  display: inline-block; margin-left: 8px; padding: 1px 7px;
  border-radius: 999px; background: var(--danger); color: #fff;
  font-size: 11px; font-weight: 700; vertical-align: middle;
}
.chat-admin-grid { display: grid; grid-template-columns: 300px minmax(0, 1fr); gap: 16px; align-items: start; }
.chat-threads { display: flex; flex-direction: column; gap: 8px; max-height: 560px; overflow-y: auto; }
.chat-thread {
  width: 100%; display: flex; flex-direction: column; gap: 4px;
  padding: 10px 12px; text-align: left; cursor: pointer;
  background: #fff; border: 1px solid var(--card-border); border-radius: 12px;
  color: var(--text); font-family: inherit; transition: border-color .15s ease, box-shadow .15s ease;
}
.chat-thread:hover { border-color: rgba(47, 123, 255, .45); }
.chat-thread.active { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(47, 123, 255, .12); }
.ct-top { display: flex; align-items: center; justify-content: space-between; font-size: 12px; color: var(--text-dim); }
.ct-top b { font-size: 13px; color: var(--text); }
.ct-last { margin: 0; font-size: 12.5px; color: var(--text-dim); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ct-meta { display: flex; align-items: center; justify-content: space-between; font-size: 11.5px; color: var(--text-dim); }
.ct-unread { font-style: normal; padding: 0 7px; border-radius: 999px; background: var(--danger); color: #fff; font-weight: 700; font-size: 11px; }
.chat-conv-card { display: flex; flex-direction: column; min-height: 520px; }
.conv-head { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; padding-bottom: 10px; border-bottom: 1px solid var(--card-border); flex-wrap: wrap; }
.chat-conv {
  flex: 1; display: flex; flex-direction: column; gap: 10px;
  padding: 12px 2px; min-height: 380px; max-height: 460px; overflow-y: auto;
}
.conv-compose { display: flex; align-items: flex-end; gap: 8px; padding-top: 10px; border-top: 1px solid var(--card-border); }
.conv-compose textarea {
  flex: 1; resize: none; padding: 10px 12px; font-size: 13.5px; line-height: 1.5;
  border: 1px solid var(--card-border); border-radius: 12px; background: var(--bg-soft);
  color: var(--text); font-family: inherit; outline: none;
}
.conv-compose textarea:focus { border-color: rgba(47, 123, 255, .55); box-shadow: 0 0 0 3px rgba(47, 123, 255, .1); }
@media (max-width: 860px) {
  .chat-admin-grid { grid-template-columns: 1fr; }
  .chat-threads { max-height: 240px; }
  .chat-conv { min-height: 280px; max-height: 360px; }
}

/* ===== Feature tabs ===== */
.feat-tabs {
  display: inline-flex; gap: 4px; padding: 4px; margin: -8px auto 0;
  background: rgba(255, 255, 255, 0.55); border: 1px solid var(--card-border);
  border-radius: 999px;
}
.feat-tab {
  padding: 7px 15px; border: none; border-radius: 999px;
  background: transparent; color: var(--text-dim); font-size: 13px; font-weight: 500;
  cursor: pointer; transition: color .15s ease, background .15s ease;
}
.feat-tab:hover { color: var(--text); }
.feat-tab.active {
  color: #fff;
  background: linear-gradient(135deg, #2f7bff, #5b8dff);
  box-shadow: 0 6px 16px -8px rgba(47, 123, 255, .55);
}

/* ===== Feature cards (dedup, vwm, image share this layout) ===== */
.feat-card .dropzone {
  padding: 32px 18px; border: 1.5px dashed var(--card-border);
  border-radius: 12px; background: rgba(255, 255, 255, 0.5);
}
.feat-card .dropzone:hover, .feat-card .dropzone.dragover { border-color: var(--accent); }
.feat-card .video-preview { margin: 4px auto 12px; }
.feat-card #video-editor,
.feat-card #vwm-editor,
.feat-card #img-editor { margin-top: 4px; }

/* ===== Region selector ===== */
.region-wrap {
  position: relative; display: block; width: fit-content; max-width: 100%;
  margin: 6px auto 10px; overflow: hidden; border-radius: var(--radius-sm); background: #000;
  line-height: 0;
}
.region-target {
  display: block; width: auto; height: auto;
  max-width: 100%; max-height: 70vh;
  user-select: none; -webkit-user-drag: none;
}
.region-target.img-target { background: #fff; }
.region-canvas {
  position: absolute; inset: 0; width: 100%; height: 100%;
  cursor: crosshair; pointer-events: auto; touch-action: none;
}
.region-list {
  display: flex; flex-wrap: wrap; gap: 6px; margin: 4px 0 6px;
}
.region-chip {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 4px 8px; font-size: 11.5px; color: var(--text);
  background: rgba(47, 123, 255, 0.1); border: 1px solid rgba(47, 123, 255, 0.35);
  border-radius: 999px;
}
.region-chip b { font-size: 10.5px; color: #fff; background: var(--accent); padding: 1px 5px; border-radius: 999px; }
.region-chip button {
  width: 16px; height: 16px; padding: 0; border: none; border-radius: 50%;
  background: rgba(16, 42, 76, .18); color: #fff; font-size: 11px; line-height: 1; cursor: pointer;
}
.region-actions { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin: 4px 0 10px; }

/* Playback controls live outside the canvas so scrubbing never fights the selection layer. */
.video-controls {
  display: flex; align-items: center; gap: 10px;
  margin: -2px 0 10px; padding: 0 2px;
}
.video-controls button {
  flex: 0 0 auto; padding: 6px 14px; border-radius: 999px; cursor: pointer;
  border: 1px solid var(--card-border); background: var(--bg-soft); color: var(--text); font-size: 12.5px;
}
.video-controls input[type="range"] { flex: 1 1 auto; min-width: 0; accent-color: var(--accent); cursor: pointer; }
.video-controls .time {
  flex: 0 0 auto; min-width: 78px; text-align: right;
  font-size: 12px; color: var(--text-dim); font-variant-numeric: tabular-nums;
}

/* ===== Image sub-tabs ===== */
.img-subtabs { display: flex; gap: 2px; margin: 8px 0 14px; }
.img-subtab {
  padding: 6px 14px; border: 1px solid var(--card-border); border-radius: 999px;
  background: var(--bg-soft); color: var(--text-dim); font-size: 12.5px; font-weight: 500;
  cursor: pointer; transition: all .15s ease;
}
.img-subtab.active { background: var(--accent); color: #fff; border-color: var(--accent); }

/* ===== Image add panel ===== */
.img-add-row {
  display: flex; align-items: center; gap: 10px; margin: 10px 0; font-size: 13px;
}
.img-add-row > label:first-child {
  flex: 0 0 70px; color: var(--text-dim); font-weight: 500;
}
.img-add-row input[type="text"],
.img-add-row select {
  flex: 1; padding: 8px 11px; font-size: 13px;
  border: 1px solid var(--card-border); border-radius: 8px;
  background: var(--bg-soft); color: var(--text); font-family: inherit;
  outline: none;
}
.img-add-row input[type="text"]:focus,
.img-add-row select:focus {
  border-color: rgba(47, 123, 255, .55); box-shadow: 0 0 0 3px rgba(47, 123, 255, .1);
}
.img-add-row input[type="color"] { width: 40px; height: 32px; padding: 0; border: 1px solid var(--card-border); border-radius: 6px; cursor: pointer; }
.img-add-row input[type="range"] { flex: 1; cursor: pointer; }
.img-add-row.img-add-toggle { justify-content: flex-start; }
.img-add-toggle { display: inline-flex; align-items: center; gap: 8px; cursor: pointer; font-size: 12.5px; }

/* ===== Billing grid ===== */
.billing-grid {
  display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px;
  margin-bottom: 12px;
}
.bill-row {
  display: flex; flex-direction: column; gap: 4px;
  padding: 10px 12px; background: rgba(255, 255, 255, 0.55);
  border: 1px solid var(--card-border); border-radius: 10px;
  font-size: 12px; color: var(--text-dim);
}
.bill-row b { font-size: 15px; font-weight: 700; color: var(--accent); }

/* ===== Media preview image ===== */
.media-preview { width: 100%; max-height: 520px; border-radius: var(--radius-sm); background: #000; display: block; object-fit: contain; }

@media (max-width: 640px) {
  .feat-tabs { width: 100%; justify-content: space-between; }
  .feat-tab { padding: 6px 10px; font-size: 12px; }
  .billing-grid { grid-template-columns: 1fr 1fr; }
  .img-add-row { flex-wrap: wrap; }
  .img-add-row > label:first-child { flex: 0 0 100%; }
  .region-wrap canvas { touch-action: none; }
  .region-wrap .region-target { max-height: 62dvh; }
  #vwm-editor, #video-editor, #img-editor { scroll-margin-top: 14px; }
  .img-add-row input, #chat-input { font-size: 16px; }
  .video-controls .time { min-width: 66px; font-size: 11px; }
}
