/* ─── podcli — Shared Styles ─── */

:root {
  --bg: #0b0b0d;
  --surface: #131316;
  --surface2: #1b1b20;
  --border: #252530;
  --border-hover: #35354a;
  --text: #e8e8e2;
  --text2: #77776f;
  --text3: #4e4e48;
  --accent: #d4874a;
  --accent-hover: #e09860;
  --accent-subtle: rgba(212, 135, 74, 0.10);
  --accent-glow: rgba(212, 135, 74, 0.25);
  --green: #4ade80;
  --green-subtle: rgba(74, 222, 128, 0.07);
  --green-border: rgba(74, 222, 128, 0.18);
  --red: #f87171;
  --red-subtle: rgba(248, 113, 113, 0.07);
  --red-border: rgba(248, 113, 113, 0.18);
  --blue: #60a5fa;
  --blue-subtle: rgba(96, 165, 250, 0.08);
  --blue-border: rgba(96, 165, 250, 0.18);
  --radius: 12px;
  --radius-sm: 8px;
  --ease: cubic-bezier(0.4, 0, 0.2, 1);
  --ease-out: cubic-bezier(0.23, 1, 0.32, 1);
}

* { margin: 0; padding: 0; box-sizing: border-box; }

body {
  font-family: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, sans-serif;
  background: var(--bg); color: var(--text); min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}

/* ─── Layout ─── */
.app { max-width: 1080px; margin: 0 auto; padding: 48px 32px 96px; }
.header { margin-bottom: 36px; }
.logo { font-size: 13px; font-weight: 700; letter-spacing: 1.2px; color: var(--text3); margin-bottom: 10px; text-transform: uppercase; text-decoration: none; }
.logo span { color: var(--accent); }
h1 { font-size: 28px; font-weight: 700; letter-spacing: -0.5px; line-height: 1.15; }
.layout { display: grid; grid-template-columns: 1fr 340px; gap: 40px; align-items: start; }
.main-col { min-width: 0; }
.preview-col { position: relative; }

/* ─── Preview Panel ─── */
.preview-panel { position: sticky; top: 32px; }
.preview-player {
  background: #000; border: 1px solid var(--border);
  border-radius: var(--radius); overflow: hidden; position: relative;
}
.preview-player video {
  width: 100%; display: block; background: #000;
}
.preview-player video.vertical {
  max-height: 480px; width: auto; margin: 0 auto;
}
.preview-empty {
  aspect-ratio: 16/9; display: flex; flex-direction: column;
  align-items: center; justify-content: center; gap: 8px;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); color: var(--text3); font-size: 13px;
}
.preview-empty .pe-icon { font-size: 28px; opacity: 0.3; }

/* ─── Style Preview (vertical phone mockup) ─── */
.style-preview {
  aspect-ratio: 9/16; width: 100%;
  background: #111114; border: 1px solid var(--border);
  border-radius: var(--radius); overflow: hidden;
  position: relative; user-select: none;
}
.style-preview .sp-bg {
  position: absolute; inset: 0;
  background:
    radial-gradient(ellipse at 35% 30%, rgba(80,60,40,0.18) 0%, transparent 60%),
    radial-gradient(ellipse at 65% 55%, rgba(50,50,70,0.12) 0%, transparent 50%),
    linear-gradient(180deg, #16161a 0%, #111114 100%);
}
.style-preview .sp-person {
  position: absolute; top: 18%; left: 50%; transform: translateX(-50%);
  width: 55%; aspect-ratio: 3/4;
  background: radial-gradient(ellipse at 50% 35%, rgba(140,120,100,0.15) 0%, rgba(80,70,60,0.06) 60%, transparent 80%);
  border-radius: 50% 50% 44% 44%;
}
.style-preview .sp-gradient {
  position: absolute; bottom: 0; left: 0; right: 0; height: 55%;
  background: linear-gradient(to top, rgba(0,0,0,0.8) 0%, rgba(0,0,0,0.4) 40%, transparent 100%);
  pointer-events: none;
}
.style-preview .sp-captions {
  position: absolute; left: 0; right: 0;
  display: flex; flex-direction: column; align-items: center;
  padding: 0 20px; text-align: center;
  font-family: Arial, Helvetica, sans-serif;
  line-height: 1.35; transition: all 0.3s var(--ease);
}
.style-preview .sp-word {
  display: inline; transition: all 0.25s var(--ease);
}
.style-preview .sp-logo {
  position: absolute; top: 14px; left: 14px;
  width: 32px; height: 32px; border-radius: 7px;
  overflow: hidden;
}
.preview-clip-range {
  padding: 8px 12px; background: var(--surface);
  border-top: 1px solid var(--border);
  font-size: 12px; color: var(--text2);
  display: flex; align-items: center; justify-content: space-between;
}
.preview-clip-range .clip-name {
  font-weight: 600; color: var(--text);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  max-width: 200px;
}
.preview-back {
  padding: 0; background: none; border: none; color: var(--accent);
  font-family: inherit; font-size: 12px; font-weight: 600;
  cursor: pointer; transition: opacity 0.15s;
}
.preview-back:hover { opacity: 0.7; }
.preview-settings {
  margin-top: 12px; display: flex; flex-wrap: wrap; gap: 6px;
}
.preview-tag {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 5px 10px; background: var(--surface);
  border: 1px solid var(--border); border-radius: 8px;
  font-size: 11px; color: var(--text2); font-weight: 500;
  transition: all 0.2s var(--ease);
}
.preview-tag strong { color: var(--text); font-weight: 600; text-transform: capitalize; }
.preview-tag.changed { border-color: var(--accent); background: var(--accent-subtle); }

/* ─── Live Phone Preview ─── */
.phone-frame {
  width: 100%; max-width: 280px; margin: 0 auto;
  aspect-ratio: 9/16; position: relative;
  background: #000; border-radius: 28px;
  border: 8px solid #1a1a1a;
  box-shadow: 0 8px 32px rgba(0,0,0,0.5), inset 0 0 0 1px rgba(255,255,255,0.06);
  overflow: hidden;
}
.phone-frame video,
.phone-frame .phone-poster {
  position: absolute; inset: 0; width: 100%; height: 100%;
  object-fit: cover; background: #000;
}
.phone-frame .phone-notch {
  position: absolute; top: 10px; left: 50%; transform: translateX(-50%);
  width: 84px; height: 22px; background: #000;
  border-radius: 100px; z-index: 5;
  box-shadow: inset 0 0 0 1px rgba(255,255,255,0.04);
}
.phone-frame .phone-caption {
  position: absolute; left: 10px; right: 10px;
  display: flex; flex-direction: column; align-items: center;
  padding: 0 8px; text-align: center; pointer-events: none;
  font-family: Arial, Helvetica, sans-serif; line-height: 1.3;
  z-index: 2; transition: all 0.2s var(--ease);
  max-height: 32%;  /* never grow beyond the lower-third caption zone */
  overflow: hidden;
}
.phone-frame .phone-caption .pc-word {
  display: inline; transition: all 0.2s var(--ease);
}
.phone-frame .phone-gradient {
  position: absolute; inset: auto 0 0 0; height: 50%;
  background: linear-gradient(to top, rgba(0,0,0,0.75) 0%, rgba(0,0,0,0.35) 45%, transparent 100%);
  pointer-events: none; z-index: 1;
}
.phone-frame .phone-logo {
  position: absolute; top: 28px; left: 12px; width: 28px; height: 28px;
  border-radius: 6px; overflow: hidden; z-index: 3;
  background: rgba(0,0,0,0.5);
}
.phone-frame .phone-empty {
  position: absolute; inset: 0; display: flex; flex-direction: column;
  align-items: center; justify-content: center; gap: 6px;
  color: rgba(255,255,255,0.4); font-size: 11px; text-align: center; padding: 0 24px;
}

/* ─── TikTok Wireframe Overlay ─── */
.phone-frame .tt-overlay {
  position: absolute; inset: 0; pointer-events: none; z-index: 4;
  color: rgba(255,255,255,0.95); font-family: -apple-system, BlinkMacSystemFont, sans-serif;
}
.phone-frame .tt-top {
  position: absolute; top: 38px; left: 0; right: 0;
  display: flex; justify-content: center; align-items: center; gap: 14px;
  font-size: 13px; font-weight: 700;
  text-shadow: 0 1px 4px rgba(0,0,0,0.45);
}
.phone-frame .tt-top .tt-tab { opacity: 0.65; position: relative; padding-bottom: 4px; }
.phone-frame .tt-top .tt-tab.active { opacity: 1; }
.phone-frame .tt-top .tt-tab.active::after {
  content: ""; position: absolute; left: 25%; right: 25%; bottom: 0;
  height: 2px; border-radius: 2px; background: #fff;
}
.phone-frame .tt-top .tt-divider {
  width: 1px; height: 12px; background: rgba(255,255,255,0.4);
}
.phone-frame .tt-top .tt-following-dot {
  position: absolute; top: -2px; right: -6px;
  width: 5px; height: 5px; border-radius: 50%; background: #ff3b5c;
}
.phone-frame .tt-search {
  position: absolute; top: 38px; right: 12px;
  width: 18px; height: 18px;
  filter: drop-shadow(0 1px 3px rgba(0,0,0,0.55));
}

/* Right action rail */
.phone-frame .tt-rail {
  position: absolute; right: 8px; bottom: 44px;
  display: flex; flex-direction: column; align-items: center; gap: 12px;
}
.phone-frame .tt-rail .tt-action {
  display: flex; flex-direction: column; align-items: center; gap: 2px;
  font-size: 10px; font-weight: 700;
  text-shadow: 0 1px 3px rgba(0,0,0,0.75);
  color: #fff;
}
.phone-frame .tt-rail .tt-icon {
  width: 28px; height: 28px;
  display: flex; align-items: center; justify-content: center;
  filter: drop-shadow(0 1px 4px rgba(0,0,0,0.7));
}

/* Avatar with +follow badge */
.phone-frame .tt-rail .tt-avatar-wrap {
  position: relative; width: 34px; height: 34px; margin-bottom: 4px;
}
.phone-frame .tt-rail .tt-avatar {
  width: 34px; height: 34px; border-radius: 50%;
  background: #2a2a2a;
  border: 2px solid #fff;
  display: flex; align-items: center; justify-content: center;
  overflow: hidden;
  box-shadow: 0 2px 6px rgba(0,0,0,0.45);
}
.phone-frame .tt-rail .tt-avatar svg {
  width: 22px; height: 22px; opacity: 0.45;
}
.phone-frame .tt-rail .tt-follow {
  position: absolute; bottom: -7px; left: 50%; transform: translateX(-50%);
  width: 16px; height: 16px; border-radius: 50%;
  background: #ff3b5c; color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-weight: 900; font-size: 12px; line-height: 1;
  border: 1.5px solid rgba(0,0,0,0); /* spacing illusion */
}

/* Music disc at bottom of rail */
.phone-frame .tt-rail .tt-disc {
  width: 32px; height: 32px; border-radius: 50%;
  background:
    radial-gradient(circle at 50% 50%, #555 0 5px, #1a1a1a 5px 14px, #2a2a2a 14px);
  border: 1.5px solid rgba(255,255,255,0.18);
  box-shadow: 0 2px 6px rgba(0,0,0,0.5);
  animation: tt-spin 6s linear infinite;
}
@keyframes tt-spin { to { transform: rotate(360deg); } }

/* Bottom-left text block */
.phone-frame .tt-bottom {
  position: absolute; left: 12px; right: 56px; bottom: 42px;
  display: flex; flex-direction: column; gap: 3px;
  text-shadow: 0 1px 4px rgba(0,0,0,0.7); color: #fff;
}
.phone-frame .tt-bottom .tt-handle {
  font-weight: 800; font-size: 12px; line-height: 1.2;
  letter-spacing: 0.3px;
}
.phone-frame .tt-bottom .tt-desc {
  font-size: 10.5px; line-height: 1.35;
  overflow: hidden;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical;
}
.phone-frame .tt-bottom .tt-desc .tt-hash { color: #fff; }
.phone-frame .tt-bottom .tt-desc .tt-more { opacity: 0.7; font-weight: 600; margin-left: 2px; }
.phone-frame .tt-bottom .tt-translate {
  font-size: 10px; opacity: 0.55;
}
.phone-frame .tt-bottom .tt-music {
  display: flex; align-items: center; gap: 5px;
  font-size: 10px; opacity: 0.95; margin-top: 1px;
}
.phone-frame .tt-bottom .tt-music-note { font-size: 11px; line-height: 1; }

/* Bottom nav */
.phone-frame .tt-nav {
  position: absolute; left: 0; right: 0; bottom: 0;
  display: flex; justify-content: space-around; align-items: center;
  height: 36px; padding: 0 6px;
  background: rgba(0,0,0,0.65);
  border-top: 1px solid rgba(255,255,255,0.06);
}
.phone-frame .tt-nav .tt-nav-item {
  display: flex; flex-direction: column; align-items: center; gap: 2px;
  font-size: 8px; font-weight: 700; opacity: 0.78;
}
.phone-frame .tt-nav .tt-nav-item.active { opacity: 1; }
.phone-frame .tt-nav .tt-nav-icon { width: 18px; height: 18px; }
.phone-frame .tt-nav .tt-plus {
  width: 36px; height: 22px; border-radius: 6px;
  position: relative; display: flex; align-items: center; justify-content: center;
  background: #fff; color: #000;
  font-weight: 900; font-size: 14px; line-height: 1;
  box-shadow:
    -3px 0 0 #25f4ee,
    3px 0 0 #fe2c55;
}

/* Wireframe toggle button under the phone */
.preview-toggle-row {
  display: flex; justify-content: center; align-items: center;
  gap: 12px; margin-top: 10px; font-size: 11px; color: var(--text2);
}
.preview-toggle-row label {
  display: flex; align-items: center; gap: 6px; cursor: pointer;
  user-select: none;
}
.preview-toggle-row input[type="checkbox"] {
  width: 14px; height: 14px; accent-color: var(--accent);
}

/* ─── Spec Recap Card ─── */
.spec-recap {
  margin-top: 14px; padding: 12px 14px;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); font-size: 11px;
}
.spec-recap .sr-row {
  display: flex; justify-content: space-between; align-items: center;
  padding: 5px 0; border-bottom: 1px dashed var(--border);
}
.spec-recap .sr-row:last-child { border-bottom: none; }
.spec-recap .sr-key {
  color: var(--text3); text-transform: uppercase; letter-spacing: 0.5px;
  font-weight: 600; font-size: 10px;
}
.spec-recap .sr-val {
  color: var(--text); font-weight: 600; font-family: var(--font-mono);
  font-size: 11px; max-width: 60%;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.spec-recap .sr-swatch {
  display: inline-block; width: 10px; height: 10px; border-radius: 2px;
  border: 1px solid var(--border); margin-right: 6px; vertical-align: middle;
}

/* ─── Sections ─── */
.section { margin-bottom: 24px; }
.section-label { font-size: 11px; font-weight: 700; letter-spacing: 0.8px; color: var(--text2); margin-bottom: 10px; text-transform: uppercase; }

/* ─── Form Elements ─── */
input[type="text"], input[type="number"], select, textarea {
  width: 100%; background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 11px 14px;
  color: var(--text); font-family: inherit; font-size: 14px;
  outline: none; transition: border-color 0.2s var(--ease), box-shadow 0.2s var(--ease);
}
input[type="text"]:focus, input[type="number"]:focus, select:focus, textarea:focus {
  border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-subtle);
}
textarea {
  font-family: 'SF Mono', 'Fira Code', 'JetBrains Mono', monospace;
  font-size: 12px; resize: vertical; min-height: 120px; line-height: 1.7;
}
select {
  appearance: none; cursor: pointer; padding-right: 34px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6' viewBox='0 0 10 6' fill='none'%3E%3Cpath d='M1 1L5 5L9 1' stroke='%2377776f' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 14px center;
}

/* ─── Buttons ─── */
.btn {
  padding: 10px 18px; border-radius: var(--radius); font-family: inherit;
  font-size: 13px; font-weight: 600; cursor: pointer; border: none;
  transition: transform 0.12s var(--ease), background 0.15s var(--ease), border-color 0.15s var(--ease), color 0.15s var(--ease), opacity 0.15s var(--ease);
  display: inline-flex;
  align-items: center; justify-content: center; gap: 6px; text-decoration: none;
}
.btn:active:not(:disabled) { transform: scale(0.97); }
.btn-primary { background: var(--accent); color: #fff; }
.btn-primary:hover:not(:disabled) { background: var(--accent-hover); }
.btn-primary:disabled { opacity: 0.25; cursor: not-allowed; }
.btn-ghost { background: transparent; color: var(--text2); border: 1px solid var(--border); }
.btn-ghost:hover { border-color: var(--border-hover); color: var(--text); }
.btn-danger { background: transparent; color: var(--text3); border: 1px solid var(--border); }
.btn-danger:hover:not(:disabled) { border-color: var(--red-border); color: var(--red); background: var(--red-subtle); }
.btn-sm { padding: 6px 12px; font-size: 12px; border-radius: var(--radius-sm); }
.btn-go {
  width: 100%; padding: 14px; font-size: 15px; justify-content: center;
  background: var(--accent); color: #fff; border-radius: var(--radius);
}
.btn-go:hover:not(:disabled) { background: var(--accent-hover); box-shadow: 0 4px 24px var(--accent-glow); }
.btn-go:disabled { opacity: 0.25; cursor: not-allowed; }
.pill { display: inline-block; padding: 3px 10px; border-radius: 20px; font-size: 11px; font-weight: 600; }
.pill-blue { background: var(--accent-subtle); color: var(--accent); }

/* ─── Drop Zone ─── */
.drop-zone {
  border: 1.5px dashed var(--border); border-radius: var(--radius);
  padding: 32px 20px; text-align: center; cursor: pointer;
  transition: all 0.2s var(--ease); position: relative; overflow: hidden;
}
.drop-zone:hover { border-color: var(--border-hover); background: rgba(255,255,255,0.012); }
.drop-zone.drag-over { border-color: var(--accent); background: var(--accent-subtle); box-shadow: 0 0 0 4px var(--accent-subtle); }
.drop-zone.uploading { border-color: var(--accent); border-style: solid; pointer-events: none; }
.drop-zone .icon { font-size: 28px; margin-bottom: 8px; opacity: 0.35; line-height: 1; }
.drop-zone .label { font-size: 13px; color: var(--text2); line-height: 1.5; }
.drop-zone .label strong { color: var(--accent); font-weight: 600; }
.drop-zone input[type="file"] { position: absolute; inset: 0; opacity: 0; cursor: pointer; }
.upload-bar { position: absolute; bottom: 0; left: 0; height: 3px; background: var(--accent); border-radius: 0 2px 2px 0; transition: width 0.25s var(--ease); }
.drop-zone .dz-icon { font-size: 28px; opacity: 0.3; margin-bottom: 8px; }
.drop-zone .dz-text { font-size: 13px; color: var(--text2); line-height: 1.5; }
.drop-zone .dz-text strong { color: var(--accent); font-weight: 600; }

/* ─── File Badge ─── */
.file-badge {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 14px; background: var(--green-subtle);
  border: 1px solid var(--green-border); border-radius: var(--radius);
}
.file-badge .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--green); flex-shrink: 0; }
.file-badge .name { font-size: 13px; color: var(--green); font-weight: 600; flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.file-badge .meta { font-size: 11px; color: var(--text2); flex-shrink: 0; }

/* ─── Tabs ─── */
.tabs { display: flex; gap: 2px; background: var(--surface); border-radius: var(--radius); padding: 3px; margin-bottom: 14px; }
.tab {
  flex: 1; text-align: center; padding: 8px 12px;
  border-radius: calc(var(--radius) - 3px); font-size: 13px;
  font-weight: 600; color: var(--text2); cursor: pointer;
  transition: all 0.2s var(--ease); user-select: none;
}
.tab:hover:not(.active) { color: var(--text); }
.tab.active { background: var(--accent); color: #fff; }

/* ─── Settings ─── */
.settings-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-bottom: 14px; }
.field-label { font-size: 11px; color: var(--text2); font-weight: 600; display: block; margin-bottom: 6px; }
.row { display: flex; gap: 10px; align-items: flex-end; }
.row > * { flex: 1; }

/* ─── Asset pills ─── */
.asset-pill {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 5px 8px 5px 10px; background: var(--surface2);
  border: 1px solid var(--border); border-radius: 20px;
  font-size: 12px; color: var(--text); max-width: 200px;
}
.asset-pill-icon { display: flex; align-items: center; flex-shrink: 0; color: var(--text2); }
.asset-pill-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 500; }
.asset-pill-x {
  display: flex; align-items: center; justify-content: center;
  width: 18px; height: 18px; border-radius: 50%; border: none;
  background: transparent; color: var(--text3); font-size: 14px;
  cursor: pointer; flex-shrink: 0; padding: 0; line-height: 1;
  transition: all 0.15s var(--ease);
}
.asset-pill-x:hover { background: var(--surface); color: var(--red); }
.asset-add {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 5px 12px; background: transparent;
  border: 1px dashed var(--border); border-radius: 20px;
  font-size: 12px; color: var(--text3); cursor: pointer;
  font-family: inherit; font-weight: 500;
  transition: all 0.15s var(--ease);
}
.asset-add:hover:not(:disabled) { border-color: var(--border-hover); color: var(--text2); }

/* ─── Overflow menu ─── */
.overflow-menu {
  position: absolute; right: 0; top: calc(100% + 4px); z-index: 50;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-sm);
  padding: 4px; min-width: 120px; box-shadow: 0 8px 24px rgba(0,0,0,0.4);
}
.overflow-menu-label {
  padding: 6px 10px 4px; font-size: 10px; font-weight: 600;
  color: var(--text3); text-transform: uppercase; letter-spacing: 0.5px;
}
.overflow-menu-item {
  display: block; width: 100%; text-align: left; padding: 6px 10px;
  background: none; border: none; color: var(--text2); font-size: 12px;
  font-family: inherit; cursor: pointer; border-radius: 6px;
  transition: all 0.1s var(--ease);
}
.overflow-menu-item:hover { background: var(--surface2); color: var(--text); }

/* ─── Progress ─── */
.progress-track { background: var(--surface2); border-radius: 4px; height: 4px; overflow: hidden; margin: 8px 0; }
.progress-fill { height: 100%; background: var(--accent); border-radius: 4px; transition: width 0.5s var(--ease); }
.progress-fill.indeterminate { width: 35% !important; animation: shimmer 1.4s ease-in-out infinite; }
.status-line { font-size: 13px; color: var(--text2); display: flex; justify-content: space-between; }
.spinner { width: 16px; height: 16px; border: 2px solid var(--border); border-top-color: var(--accent); border-radius: 50%; animation: spin 0.6s linear infinite; flex-shrink: 0; }
.spinner.sm { width: 14px; height: 14px; border-width: 1.5px; }

/* ─── Clip List ─── */
.clip-item {
  display: flex; align-items: center; gap: 12px;
  padding: 12px 14px; margin-bottom: 4px;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); transition: all 0.15s var(--ease);
  cursor: pointer;
}
.clip-item:hover { border-color: var(--border-hover); }
.clip-item.dimmed { opacity: 0.35; }
.clip-item.active-clip { border-color: rgba(212, 135, 74, 0.3); background: rgba(212, 135, 74, 0.03); }
.clip-item.selected { border-color: var(--accent); background: rgba(212, 135, 74, 0.04); }
.checkbox {
  width: 20px; height: 20px; border-radius: 6px;
  border: 1.5px solid var(--border); display: flex;
  align-items: center; justify-content: center;
  cursor: pointer; transition: all 0.15s var(--ease); flex-shrink: 0;
}
.checkbox:hover { border-color: var(--accent); }
.checkbox.checked { background: var(--accent); border-color: var(--accent); }
.clip-info { flex: 1; min-width: 0; }
.clip-title { font-size: 13px; font-weight: 600; line-height: 1.4; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.clip-meta { font-size: 12px; color: var(--text2); margin-top: 2px; }
.clip-meta .err { color: var(--red); }
.clip-actions { display: flex; gap: 4px; flex-shrink: 0; }
.clip-status { width: 22px; height: 22px; border-radius: 50%; display: flex; align-items: center; justify-content: center; flex-shrink: 0; font-size: 11px; font-weight: 700; }
.clip-status.pending { border: 1.5px dashed var(--border); }
.clip-status.rendering { border: 2px solid var(--border); border-top-color: var(--accent); animation: spin 0.6s linear infinite; }
.clip-status.exported { background: var(--green-subtle); color: var(--green); }
.status-dot { width: 22px; height: 22px; border-radius: 50%; display: flex; align-items: center; justify-content: center; flex-shrink: 0; font-size: 12px; }
.status-dot.ok { background: var(--green-subtle); color: var(--green); }
.status-dot.fail { background: var(--red-subtle); color: var(--red); }

/* ─── Error ─── */
.error-bar { padding: 12px 16px; background: var(--red-subtle); border: 1px solid var(--red-border); border-radius: var(--radius); margin-bottom: 20px; font-size: 13px; color: var(--red); display: flex; align-items: center; gap: 10px; }
.error-bar span { flex: 1; }
.spacer { height: 1px; background: var(--border); margin: 28px 0; opacity: 0.4; }

/* ─── Modal ─── */
.modal-overlay { position: fixed; inset: 0; background: rgba(0,0,0,0.88); backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px); z-index: 1000; display: flex; align-items: center; justify-content: center; cursor: pointer; animation: fadeIn 0.15s var(--ease); }
.modal-body { max-width: 380px; width: 92%; cursor: default; animation: scaleIn 0.2s var(--ease); }
.modal-body video { width: 100%; border-radius: 16px; box-shadow: 0 24px 64px rgba(0,0,0,0.5); }

/* ─── Animations ─── */
.fade-in { animation: fadeIn 0.3s var(--ease); }
@keyframes fadeIn { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
@keyframes scaleIn { from { opacity: 0; transform: scale(0.96) translateY(4px); } to { opacity: 1; transform: none; } }
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes shimmer { 0% { transform: translateX(-120%); } 100% { transform: translateX(350%); } }
@keyframes clipReveal { from { opacity: 0; transform: translateY(10px) scale(0.98); } to { opacity: 1; transform: none; } }
.clip-reveal { animation: clipReveal 0.35s var(--ease) both; }
@keyframes tagFlash { 0% { border-color: var(--accent); background: var(--accent-subtle); } 100% { border-color: var(--border); background: var(--surface); } }

/* ─── MCP Hints ─── */
.mcp-hints {
  margin-top: 20px;
  padding: 16px; background: var(--surface);
  border: 1px solid var(--border); border-radius: var(--radius);
  animation: fadeIn 0.3s var(--ease);
}
.mcp-hints-header {
  display: flex; align-items: center; gap: 8px; margin-bottom: 12px;
}
.mcp-hints-icon {
  width: 20px; height: 20px; border-radius: 6px;
  background: linear-gradient(135deg, #7c5ae0 0%, #a855f7 100%);
  display: flex; align-items: center; justify-content: center;
  font-size: 10px; color: #fff; font-weight: 800; flex-shrink: 0;
}
.mcp-hints-title {
  font-size: 11px; font-weight: 700; letter-spacing: 0.5px;
  color: var(--text2); text-transform: uppercase;
}
.mcp-hints-subtitle {
  font-size: 11px; color: var(--text3); margin-left: auto;
}
.mcp-hint-list {
  display: flex; flex-direction: column; gap: 6px;
}
.mcp-hint {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 12px; background: var(--bg);
  border: 1px solid var(--border); border-radius: var(--radius-sm);
  cursor: pointer; transition: all 0.15s var(--ease);
  user-select: none;
}
.mcp-hint:hover {
  border-color: #7c5ae055; background: rgba(124, 90, 224, 0.04);
}
.mcp-hint:active { transform: scale(0.99); }
.mcp-hint.copied {
  border-color: var(--green-border); background: var(--green-subtle);
}
.mcp-hint-prompt {
  flex: 1; font-size: 13px; font-weight: 600; color: var(--text);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.mcp-hint-desc {
  font-size: 11px; color: var(--text3); white-space: nowrap; flex-shrink: 0;
}
.mcp-hint-copy {
  display: flex; align-items: center; justify-content: center;
  width: 24px; height: 24px; border-radius: 6px;
  background: transparent; border: none; color: var(--text3);
  cursor: pointer; flex-shrink: 0; font-size: 12px;
  transition: all 0.15s var(--ease);
}
.mcp-hint-copy:hover { background: var(--surface2); color: var(--text); }
.mcp-hint-category {
  display: inline-block; padding: 2px 6px; border-radius: 4px;
  font-size: 9px; font-weight: 700; text-transform: uppercase;
  letter-spacing: 0.5px; flex-shrink: 0;
}
.mcp-hint-category.analyze { background: rgba(168, 85, 247, 0.1); color: #a855f7; }
.mcp-hint-category.create { background: rgba(74, 222, 128, 0.1); color: #4ade80; }
.mcp-hint-category.refine { background: var(--accent-subtle); color: var(--accent); }
.mcp-hint-category.export { background: rgba(251, 191, 36, 0.1); color: #fbbf24; }

/* ─── Nav (knowledge, integration pages) ─── */
.nav { display: flex; align-items: center; justify-content: space-between; margin-bottom: 28px; }
.nav .logo { margin-bottom: 0; }
.nav-link {
  font-size: 13px; font-weight: 600; color: var(--text2);
  text-decoration: none; padding: 6px 14px;
  border-radius: var(--radius-sm); border: 1px solid var(--border);
  transition: all 0.15s var(--ease);
}
.nav-link:hover { border-color: var(--border-hover); color: var(--text); }
.subtitle { font-size: 14px; color: var(--text2); margin-top: 8px; line-height: 1.6; }

/* ─── Knowledge page ─── */
.dir-path {
  display: inline-flex; align-items: center; gap: 6px;
  margin-top: 10px; padding: 5px 12px;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-family: 'JetBrains Mono', monospace; font-size: 11.5px; color: var(--text2);
}
.file-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.file-card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 16px; cursor: pointer;
  transition: all 0.15s var(--ease); position: relative;
}
.file-card:hover { border-color: var(--border-hover); }
.file-card.active { border-color: var(--accent); background: var(--accent-subtle); }
.file-name {
  font-family: 'JetBrains Mono', monospace; font-size: 13px;
  font-weight: 600; color: var(--text); margin-bottom: 4px;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.file-meta { font-size: 11px; color: var(--text3); }
.file-preview { font-size: 12px; color: var(--text2); margin-top: 8px; line-height: 1.5; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.file-delete {
  position: absolute; top: 10px; right: 10px;
  width: 22px; height: 22px; border-radius: 6px;
  background: transparent; border: 1px solid transparent;
  color: var(--text3); cursor: pointer; font-size: 13px;
  display: flex; align-items: center; justify-content: center;
  transition: all 0.15s var(--ease); opacity: 0;
}
.file-card:hover .file-delete { opacity: 1; }
.file-delete:hover { border-color: var(--red-border); color: var(--red); background: var(--red-subtle); }
.editor-panel {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); overflow: hidden; margin-top: 20px;
}
.editor-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 10px 16px; background: var(--surface2);
  border-bottom: 1px solid var(--border);
}
.editor-filename {
  font-family: 'JetBrains Mono', monospace; font-size: 12px;
  font-weight: 600; color: var(--text);
}
.editor-actions { display: flex; gap: 6px; }
.editor-textarea {
  width: 100%; min-height: 320px; padding: 16px;
  background: transparent; border: none; color: var(--text);
  font-family: 'JetBrains Mono', monospace; font-size: 13px;
  line-height: 1.7; resize: vertical; outline: none;
}
.new-file-row { display: flex; gap: 8px; margin-top: 16px; }
.new-file-input {
  flex: 1; padding: 8px 14px;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius-sm); color: var(--text);
  font-family: 'JetBrains Mono', monospace; font-size: 13px;
  outline: none;
}
.new-file-input:focus { border-color: var(--accent); }
.new-file-input::placeholder { color: var(--text3); }
.toast {
  position: fixed; bottom: 24px; right: 24px;
  padding: 10px 18px; border-radius: var(--radius-sm);
  background: var(--green-subtle); border: 1px solid var(--green-border);
  color: var(--green); font-size: 13px; font-weight: 600;
  animation: fadeIn 0.2s var(--ease);
}
.empty-state { text-align: center; padding: 48px 20px; color: var(--text3); font-size: 13px; }

/* ─── Integration page ─── */
.status-bar {
  display: flex; align-items: center; gap: 10px;
  padding: 12px 16px; border-radius: var(--radius);
  font-size: 13px; font-weight: 500; margin-bottom: 32px;
}
.status-bar.ok { background: var(--green-subtle); border: 1px solid var(--green-border); color: var(--green); }
.status-bar.err { background: var(--red-subtle); border: 1px solid var(--red-border); color: var(--red); }
.status-bar.warn { background: var(--blue-subtle); border: 1px solid var(--blue-border); color: var(--blue); }
.status-bar .status-dot { width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; }
.status-bar.ok .status-dot { background: var(--green); }
.status-bar.err .status-dot { background: var(--red); }
.status-bar.warn .status-dot { background: var(--blue); }
.card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 24px; margin-bottom: 20px;
  transition: border-color 0.2s var(--ease);
}
.card:hover { border-color: var(--border-hover); }
.card-label {
  font-size: 11px; font-weight: 700; letter-spacing: 0.8px;
  color: var(--text2); text-transform: uppercase; margin-bottom: 16px;
}
.card-title {
  font-size: 16px; font-weight: 700; margin-bottom: 6px; display: flex;
  align-items: center; gap: 8px;
}
.card-desc { font-size: 13px; color: var(--text2); line-height: 1.6; margin-bottom: 16px; }
.code-block {
  position: relative; background: #0a0a0c; border: 1px solid var(--border);
  border-radius: var(--radius-sm); overflow: hidden;
}
.code-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 8px 14px; background: var(--surface2);
  border-bottom: 1px solid var(--border);
}
.code-filename { font-size: 11px; font-weight: 600; color: var(--text2); font-family: 'JetBrains Mono', monospace; }
.copy-btn {
  padding: 4px 10px; font-size: 11px; font-weight: 600;
  font-family: inherit; color: var(--text2); background: transparent;
  border: 1px solid var(--border); border-radius: 6px; cursor: pointer;
  transition: all 0.15s var(--ease);
}
.copy-btn:hover { border-color: var(--accent); color: var(--accent); }
.copy-btn.copied { border-color: var(--green); color: var(--green); }
pre {
  padding: 16px; overflow-x: auto; font-family: 'JetBrains Mono', monospace;
  font-size: 12.5px; line-height: 1.7; color: var(--text); tab-size: 2;
}
pre .key { color: #60a5fa; }
pre .str { color: #4ade80; }
pre .comment { color: var(--text3); font-style: italic; }
pre .punct { color: var(--text2); }
.steps { counter-reset: step; }
.step {
  position: relative; padding-left: 40px; margin-bottom: 24px;
  counter-increment: step;
}
.step::before {
  content: counter(step);
  position: absolute; left: 0; top: 1px;
  width: 26px; height: 26px; border-radius: 50%;
  background: var(--surface2); border: 1px solid var(--border);
  display: flex; align-items: center; justify-content: center;
  font-size: 12px; font-weight: 700; color: var(--text2);
}
.step-title { font-size: 14px; font-weight: 700; margin-bottom: 6px; }
.step-desc { font-size: 13px; color: var(--text2); line-height: 1.6; }
.step-desc code {
  background: var(--surface2); padding: 2px 7px; border-radius: 5px;
  font-family: 'JetBrains Mono', monospace; font-size: 11.5px;
  color: var(--accent); border: 1px solid var(--border);
}
.tool-grid { display: grid; gap: 8px; }
.tool-item {
  display: flex; align-items: flex-start; gap: 12px;
  padding: 14px 16px; background: var(--surface2);
  border-radius: var(--radius-sm); border: 1px solid transparent;
  transition: border-color 0.15s var(--ease);
}
.tool-item:hover { border-color: var(--border); }
.tool-name {
  font-family: 'JetBrains Mono', monospace; font-size: 12.5px;
  font-weight: 600; color: var(--accent); white-space: nowrap;
}
.tool-desc { font-size: 12.5px; color: var(--text2); line-height: 1.5; }
.divider { height: 1px; background: var(--border); margin: 32px 0; opacity: 0.4; }

/* ─── Presets ─── */
.preset-bar {
  display: flex; gap: 6px; align-items: center; margin-bottom: 14px;
}
.preset-bar select {
  flex: 1; padding: 8px 12px; font-size: 12px;
}
.preset-bar .btn { flex-shrink: 0; }
.preset-save-row {
  display: flex; gap: 6px; align-items: center; margin-bottom: 14px;
  animation: fadeIn 0.2s var(--ease);
}
.preset-save-row input {
  flex: 1; padding: 8px 12px; font-size: 12px;
}

/* ─── Advanced Settings ─── */
.advanced-grid {
  display: grid; grid-template-columns: 1fr 1fr; gap: 10px;
  margin-top: 10px;
}
.advanced-grid .field {
  display: flex; flex-direction: column; gap: 4px;
}
.advanced-grid .field-row {
  display: flex; align-items: center; gap: 8px;
}
.toggle-row {
  display: flex; align-items: center; justify-content: space-between;
  padding: 8px 0;
}
.toggle-row .toggle-label {
  font-size: 12px; color: var(--text2); font-weight: 500;
}
.toggle {
  width: 36px; height: 20px; border-radius: 10px;
  background: var(--surface2); border: 1px solid var(--border);
  cursor: pointer; position: relative;
  transition: all 0.2s var(--ease); flex-shrink: 0;
}
.toggle.on {
  background: var(--accent); border-color: var(--accent);
}
.toggle::after {
  content: ''; position: absolute; top: 2px; left: 2px;
  width: 14px; height: 14px; border-radius: 50%;
  background: #fff; transition: transform 0.2s var(--ease);
}
.toggle.on::after { transform: translateX(16px); }
.range-value {
  font-size: 11px; color: var(--text); font-weight: 600;
  font-variant-numeric: tabular-nums; min-width: 28px; text-align: right;
}
input[type="range"] {
  -webkit-appearance: none; appearance: none;
  width: 100%; height: 4px; border-radius: 2px;
  background: var(--surface2); outline: none;
  cursor: pointer;
}
input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none; appearance: none;
  width: 14px; height: 14px; border-radius: 50%;
  background: var(--accent); cursor: pointer;
  border: 2px solid var(--bg);
  box-shadow: 0 1px 4px rgba(0,0,0,0.3);
}

/* ─── Clip Editing ─── */
.clip-edit-overlay {
  position: fixed; inset: 0; background: rgba(0,0,0,0.6);
  backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px);
  z-index: 100; display: flex; align-items: center; justify-content: center;
  animation: fadeIn 0.15s var(--ease);
}
.clip-edit-panel {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 24px; width: 400px; max-width: 92vw;
  animation: scaleIn 0.2s var(--ease);
}
.clip-edit-panel h3 {
  font-size: 14px; font-weight: 700; margin-bottom: 16px;
}
.clip-edit-panel .edit-field {
  margin-bottom: 12px;
}
.clip-edit-panel .edit-field label {
  font-size: 11px; color: var(--text2); font-weight: 600;
  display: block; margin-bottom: 4px; text-transform: uppercase; letter-spacing: 0.5px;
}
.clip-edit-panel .edit-field input,
.clip-edit-panel .edit-field textarea {
  font-size: 13px; padding: 9px 12px;
}
.clip-edit-panel .edit-field textarea {
  min-height: 60px; font-family: inherit;
}
.clip-edit-panel .time-row {
  display: grid; grid-template-columns: 1fr auto 1fr; gap: 8px; align-items: end;
}
.clip-edit-panel .time-row .arrow {
  color: var(--text3); font-size: 14px; padding-bottom: 10px;
}
.clip-edit-actions {
  display: flex; gap: 8px; justify-content: flex-end; margin-top: 18px;
}
.clip-item .clip-edit-btn {
  opacity: 0; padding: 4px 8px; font-size: 11px;
  transition: opacity 0.15s var(--ease);
  flex-shrink: 0;
}
.clip-item:hover .clip-edit-btn { opacity: 1; }

/* ─── Energy Badges ─── */
.energy-badge {
  display: inline-flex; align-items: center; gap: 3px;
  padding: 1px 6px; border-radius: 4px;
  font-size: 10px; font-weight: 700; letter-spacing: 0.3px;
  flex-shrink: 0;
}
.energy-badge.high { background: rgba(248,113,113,0.1); color: #f87171; }
.energy-badge.medium { background: rgba(251,191,36,0.1); color: #fbbf24; }
.energy-badge.low { background: rgba(96,165,250,0.1); color: #60a5fa; }
.energy-btn {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 5px 10px; background: transparent;
  border: 1px solid var(--border); border-radius: var(--radius-sm);
  font-size: 11px; font-weight: 600; color: var(--text2);
  cursor: pointer; font-family: inherit;
  transition: all 0.15s var(--ease);
}
.energy-btn:hover:not(:disabled) { border-color: var(--border-hover); color: var(--text); }
.energy-btn:disabled { opacity: 0.4; cursor: not-allowed; }

/* ─── Responsive ─── */
@media (max-width: 920px) {
  .app { padding: 36px 20px 80px; }
  .layout { grid-template-columns: 1fr; gap: 0; }
  .preview-col { display: none; }
  .mcp-hint-desc { display: none; }
}
@media (max-width: 640px) {
  .app { padding: 28px 16px 64px; }
  .file-grid { grid-template-columns: 1fr; }
}

/* ── Dashboard shell ── */
.shell { display: flex; min-height: 100vh; }
.sidebar {
  width: 232px; flex-shrink: 0; box-sizing: border-box;
  border-right: 1px solid var(--border); background: var(--surface);
  padding: 22px 14px; position: sticky; top: 0; height: 100vh;
  display: flex; flex-direction: column; gap: 2px; overflow-y: auto;
}
.sidebar-logo { display: flex; align-items: center; padding: 4px 8px 18px; }
.sidebar-logo img { height: 22px; }
.sidebar-section { font-size: 10px; font-weight: 700; letter-spacing: 1px; text-transform: uppercase; color: var(--text3); padding: 16px 12px 6px; }
.sidebar-link {
  display: flex; align-items: center; gap: 10px; padding: 9px 12px;
  border-radius: var(--radius-sm); color: var(--text2);
  text-decoration: none; font-size: 13px; font-weight: 600;
  transition: background 0.12s, color 0.12s;
}
.sidebar-link:hover { background: var(--surface2); color: var(--text); }
.sidebar-link.active { background: var(--accent-subtle); color: var(--accent); }
.sidebar-link .ico { width: 16px; height: 16px; flex-shrink: 0; opacity: 0.85; }
.sidebar-link.disabled { opacity: 0.4; pointer-events: none; }
.sidebar-link .soon { margin-left: auto; font-size: 9px; font-weight: 700; letter-spacing: 0.5px; color: var(--text3); border: 1px solid var(--border); border-radius: 4px; padding: 1px 5px; }
.shell-main { flex: 1; min-width: 0; }
.shell-main .app { margin: 0; max-width: 1080px; }
@media (max-width: 820px) {
  .shell { flex-direction: column; }
  .sidebar { width: 100%; height: auto; position: static; flex-direction: row; flex-wrap: wrap; align-items: center; gap: 4px; }
  .sidebar-logo { padding: 4px 8px; }
  .sidebar-section { display: none; }
}

/* ── Custom clip player ── */
.clip-player { position: relative; background: #000; border-radius: var(--radius); overflow: hidden; width: 100%; }
.clip-player video { display: block; width: 100%; height: auto; cursor: pointer; }
.clip-player-bar {
  position: absolute; left: 0; right: 0; bottom: 0;
  display: flex; align-items: center; gap: 10px; padding: 10px 12px;
  background: linear-gradient(to top, rgba(0,0,0,0.7), transparent);
  opacity: 0; transition: opacity 0.18s;
}
.clip-player:hover .clip-player-bar, .clip-player.paused .clip-player-bar { opacity: 1; }
.clip-player-btn { background: none; border: none; color: #fff; cursor: pointer; font-size: 15px; line-height: 1; padding: 2px; display: flex; }
.clip-player-time { color: #fff; font-size: 11px; font-variant-numeric: tabular-nums; flex-shrink: 0; }
.clip-player-track { flex: 1; height: 4px; border-radius: 2px; background: rgba(255,255,255,0.25); cursor: pointer; position: relative; }
.clip-player-fill { position: absolute; left: 0; top: 0; bottom: 0; border-radius: 2px; background: var(--accent); }

/* ── Thumbnail editor ── */
.thumb-stage { position: relative; width: 100%; aspect-ratio: 9 / 16; background: var(--bg); border-radius: var(--radius); overflow: hidden; border: 1px solid var(--border); }
.thumb-stage img { width: 100%; height: 100%; object-fit: cover; }
.thumb-fields { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 12px; }
.thumb-fields .full { grid-column: 1 / -1; }
.thumb-swatch-row { display: flex; align-items: center; gap: 8px; }
.thumb-swatch-row input[type="color"] { width: 34px; height: 28px; padding: 0; border: 1px solid var(--border); border-radius: 6px; background: none; cursor: pointer; }

/* ── Library card grid ── */
.clip-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 12px; }
.clip-card { position: relative; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; text-decoration: none; color: inherit; transition: border-color 0.12s, transform 0.12s; }
.clip-card:hover { border-color: var(--border-hover); transform: translateY(-2px); }
.clip-card-del { position: absolute; top: 7px; right: 7px; width: 26px; height: 26px; padding: 0; display: flex; align-items: center; justify-content: center; border: none; border-radius: var(--radius-sm); background: rgba(0, 0, 0, 0.55); color: #fff; cursor: pointer; opacity: 0; transition: opacity 0.12s var(--ease), background 0.12s var(--ease); }
.clip-card:hover .clip-card-del { opacity: 1; }
.clip-card-del:hover:not(:disabled) { background: var(--red); }
.clip-card-del:disabled { opacity: 0.4; cursor: default; }
.clip-card-media { aspect-ratio: 9 / 16; width: 100%; display: block; object-fit: cover; background: #000; }
.clip-card-media.empty { display: flex; align-items: center; justify-content: center; color: var(--text3); font-size: 22px; }
.clip-card-body { padding: 10px 11px; }
.clip-card-title { font-size: 12.5px; font-weight: 600; line-height: 1.3; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.clip-card-meta { font-size: 10.5px; color: var(--text3); margin-top: 5px; }
.episode-block + .episode-block { margin-top: 22px; }
.episode-head { display: flex; align-items: baseline; gap: 10px; margin-bottom: 12px; }
.episode-head h2 { font-size: 15px; font-weight: 700; margin: 0; }
.episode-head .sub { font-size: 11px; color: var(--text3); }

/* ── Settings pages (Config / Integrations / MCP) ── */
.set-kv { display: flex; flex-direction: column; gap: 4px; padding: 12px 0; border-bottom: 1px solid var(--border); }
.set-kv:last-child { border-bottom: none; }
.set-kv .k { font-size: 11px; font-weight: 600; letter-spacing: 0.5px; text-transform: uppercase; color: var(--text2); }
.set-kv .v { font-family: var(--font-mono, monospace); font-size: 13px; color: var(--text); word-break: break-all; }
.set-actions { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.set-note { margin-top: 14px; font-size: 12px; padding: 10px 12px; border-radius: var(--radius-sm); }
.set-note.ok { background: var(--green-subtle); color: var(--green); }
.set-note.err { background: var(--red-subtle); color: var(--red); }
.set-file { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.int-row { display: flex; align-items: center; justify-content: space-between; gap: 14px; padding: 14px 0; border-bottom: 1px solid var(--border); }
.int-row:last-child { border-bottom: none; }
.int-row .name { font-size: 14px; font-weight: 600; }
.int-row .desc { font-size: 12px; color: var(--text2); margin-top: 2px; }

/* ── Code block (MCP setup) ── */
.code-block { background: var(--bg); border: 1px solid var(--border); border-radius: var(--radius-sm); overflow: hidden; margin-top: 10px; }
.code-block-head { display: flex; justify-content: space-between; align-items: center; padding: 7px 12px; border-bottom: 1px solid var(--border); font-size: 11px; color: var(--text2); font-family: var(--font-mono, monospace); }
.code-block pre { margin: 0; padding: 13px 14px; font-family: var(--font-mono, monospace); font-size: 12.5px; line-height: 1.6; color: var(--text); overflow-x: auto; white-space: pre; }

/* ── Thumbnail variations ── */
.thumb-variations { display: flex; gap: 8px; margin-top: 12px; }
.thumb-variation { flex: 1; aspect-ratio: 9 / 16; border-radius: var(--radius-sm); overflow: hidden; border: 2px solid transparent; background: #000; cursor: pointer; padding: 0; }
.thumb-variation.selected { border-color: var(--accent); }
.thumb-variation img { width: 100%; height: 100%; object-fit: cover; display: block; }

/* ── Clip detail layout ── */
.clip-media { display: flex; gap: 18px; margin-bottom: 22px; flex-wrap: wrap; }
.clip-media-col { width: 300px; flex-shrink: 0; }
.clip-controls { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 16px; align-items: start; }
.clip-controls .section { margin: 0; }

/* ── Thumbnail template editor ── */
.tmpl-layout { display: flex; gap: 28px; align-items: flex-start; }
.tmpl-preview { width: 300px; flex-shrink: 0; position: sticky; top: 24px; }
.tmpl-fields { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 16px; }
@media (max-width: 900px) { .tmpl-layout { flex-direction: column; } .tmpl-preview { position: static; } }

/* ── Motion layer (respects reduced-motion) ── */
@media (prefers-reduced-motion: no-preference) {
  @keyframes pageIn { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
  @keyframes cardIn { from { opacity: 0; transform: translateY(10px) scale(0.99); } to { opacity: 1; transform: none; } }
  @keyframes riseIn { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

  .shell-main > * { animation: pageIn 0.24s var(--ease-out) both; }

  .reframe-overlay { animation: pageIn 0.16s var(--ease-out) both; }
  .reframe-modal { animation: modalIn 0.2s var(--ease-out) both; }
  @keyframes modalIn { from { opacity: 0; transform: scale(0.97); } to { opacity: 1; transform: none; } }

  .clip-grid .clip-card { animation: cardIn 0.28s var(--ease-out) both; }
  .clip-grid .clip-card:nth-child(1) { animation-delay: 0.02s; }
  .clip-grid .clip-card:nth-child(2) { animation-delay: 0.05s; }
  .clip-grid .clip-card:nth-child(3) { animation-delay: 0.08s; }
  .clip-grid .clip-card:nth-child(4) { animation-delay: 0.11s; }
  .clip-grid .clip-card:nth-child(5) { animation-delay: 0.14s; }
  .clip-grid .clip-card:nth-child(6) { animation-delay: 0.17s; }
  .clip-grid .clip-card:nth-child(n+7) { animation-delay: 0.2s; }

  .clip-controls .section, .tmpl-fields .section { animation: riseIn 0.26s var(--ease-out) both; }
  .clip-controls .section:nth-child(2) { animation-delay: 0.05s; }
  .clip-controls .section:nth-child(3) { animation-delay: 0.1s; }
  .clip-controls .section:nth-child(4) { animation-delay: 0.15s; }

  .thumb-variation { transition: border-color 0.15s var(--ease), transform 0.12s var(--ease); }
  .thumb-variation:hover { transform: translateY(-2px); }
  .thumb-stage img, .clip-card-media { transition: opacity 0.3s var(--ease); }
  .sidebar-link { transition: background 0.14s var(--ease), color 0.14s var(--ease), padding-left 0.14s var(--ease); }
  .sidebar-link:hover { padding-left: 15px; }
  .set-note { animation: riseIn 0.25s var(--ease) both; }
}

/* ── Polish: balanced headings, image outlines, tabular figures ── */
h1, h2, h3 { text-wrap: balance; }
.clip-card-media, .thumb-stage img, .thumb-variation img { outline: 1px solid rgba(255, 255, 255, 0.1); outline-offset: -1px; }
.clip-card-meta, .clip-meta span, .clip-card-title { font-variant-numeric: tabular-nums; }

/* ── Clip detail (player hero + editor) ── */
.clip-detail { display: flex; gap: 28px; align-items: flex-start; }
.clip-detail-player { width: 330px; flex-shrink: 0; position: sticky; top: 24px; }
.clip-detail-editor { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 16px; }
.clip-meta { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 14px; }
.clip-meta span { font-size: 11px; color: var(--text2); background: var(--surface); border: 1px solid var(--border); border-radius: 999px; padding: 4px 10px; }
.thumb-edit { display: flex; gap: 14px; align-items: flex-start; }
.thumb-edit-preview { width: 150px; flex-shrink: 0; }
.thumb-edit-controls { flex: 1; min-width: 0; }
@media (max-width: 820px) { .clip-detail { flex-direction: column; } .clip-detail-player { position: static; width: 100%; max-width: 330px; } }

/* ── Reframe editor ── */
.reframe-overlay { position: fixed; inset: 0; background: rgba(0,0,0,0.72); display: flex; align-items: center; justify-content: center; z-index: 50; padding: 20px; }
.reframe-modal { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 18px; width: min(560px, 95vw); max-height: 92vh; overflow: auto; }
.reframe-stage { position: relative; width: 100%; background: #000; border-radius: var(--radius-sm); overflow: hidden; user-select: none; touch-action: none; cursor: ew-resize; }
.reframe-stage video { width: 100%; display: block; }
.reframe-box { position: absolute; top: 0; bottom: 0; border: 2px solid var(--accent); box-shadow: 0 0 0 9999px rgba(0,0,0,0.5); pointer-events: none; }

/* ── Reframe timeline ── */
.rf-track { position: relative; height: 30px; background: var(--surface2); border: 1px solid var(--border); border-radius: 6px; cursor: pointer; margin-top: 12px; overflow: hidden; }
.rf-kf { position: absolute; top: 0; bottom: 0; width: 3px; background: var(--green); transform: translateX(-1px); pointer-events: none; }
.rf-playhead { position: absolute; top: 0; bottom: 0; width: 2px; background: var(--accent); pointer-events: none; box-shadow: 0 0 6px var(--accent); }

/* ── Reframe trim region/handles ── */
.rf-region { position: absolute; top: 0; bottom: 0; background: var(--accent-subtle); pointer-events: none; }
.rf-handle { position: absolute; top: -2px; bottom: -2px; width: 3px; background: var(--accent); transform: translateX(-1px); pointer-events: none; }

/* ── Reframe timeline polish (grabbable handles) ── */
.rf-track { height: 44px; }
.rf-handle { width: 10px; border-radius: 4px; top: -3px; bottom: -3px; transform: translateX(-5px); cursor: ew-resize; box-shadow: 0 0 0 1px rgba(0,0,0,0.45); z-index: 2; }
.rf-handle::after { content: ""; position: absolute; top: 50%; left: 50%; width: 2px; height: 16px; background: rgba(0,0,0,0.4); transform: translate(-50%,-50%); border-radius: 1px; }
.rf-track:hover .rf-handle { box-shadow: 0 0 0 1px var(--accent-glow); }
.rf-playhead { z-index: 3; }

/* ── Reframe: camera-switch (cut) markers ── */
.rf-cut { position: absolute; top: 0; bottom: 0; width: 2px; background: #facc15; opacity: 0.75; transform: translateX(-1px); pointer-events: none; }
