:root {
  --bg: #f6f9ff;
  --card: #ffffff;
  --ink: #0d1b33;
  --ink-2: #4a5a78;
  --ink-3: #8a97b0;
  --line: #e3eaf6;
  --blue: #2f7bff;
  --blue-2: #5aa8ff;
  --blue-soft: #eaf3ff;
  --cyan: #38c6f4;
  --green: #12a670;
  --green-soft: #e4f7ef;
  --amber: #e08a00;
  --amber-soft: #fff4e0;
  --red: #e5484d;
  --grad: linear-gradient(135deg, #2f7bff 0%, #38c6f4 100%);
  --grad-soft: linear-gradient(135deg, #eaf3ff 0%, #e6fbff 100%);
  --shadow: 0 1px 2px rgba(16, 40, 90, .05), 0 8px 24px rgba(16, 40, 90, .06);
  --shadow-lg: 0 20px 60px rgba(16, 40, 90, .18);
  --r: 14px;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  font-family: "Manrope", system-ui, -apple-system, sans-serif;
  color: var(--ink);
  background: var(--bg);
  font-size: 14px;
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
}
body::before {
  content: ""; position: fixed; inset: 0; z-index: -1; pointer-events: none;
  background:
    radial-gradient(900px 500px at 85% -10%, rgba(56, 198, 244, .16), transparent 60%),
    radial-gradient(800px 500px at 10% 110%, rgba(47, 123, 255, .10), transparent 60%);
}
a { color: var(--blue); text-decoration: none; }
button { font: inherit; cursor: pointer; }
input, textarea, select { font: inherit; color: inherit; }
h1, h2, h3 { margin: 0; letter-spacing: -.02em; }
h1 { font-size: 26px; font-weight: 800; }
h2 { font-size: 18px; font-weight: 800; }
h3 { font-size: 15px; font-weight: 700; }
.muted { color: var(--ink-2); }
.dim { color: var(--ink-3); }
.small { font-size: 12px; }

/* layout */
.app { display: grid; grid-template-columns: 240px 1fr; min-height: 100vh; }
.side {
  position: sticky; top: 0; height: 100vh; padding: 20px 14px; display: flex; flex-direction: column; gap: 14px;
  background: rgba(255, 255, 255, .75); backdrop-filter: blur(12px); border-right: 1px solid var(--line);
}
.logo { display: flex; align-items: center; gap: 10px; font-weight: 800; font-size: 17px; padding: 4px 8px; }
.logo i { width: 30px; height: 30px; border-radius: 9px; background: var(--grad); display: grid; place-items: center; box-shadow: 0 6px 16px rgba(47, 123, 255, .35); }
.logo i::after { content: ""; width: 10px; height: 10px; border-radius: 50%; border: 2.5px solid #fff; }
.ws-select { width: 100%; padding: 9px 10px; border-radius: 10px; border: 1px solid var(--line); background: #fff; font-weight: 600; }
.nav { display: flex; flex-direction: column; gap: 2px; }
.nav a { display: flex; align-items: center; gap: 10px; padding: 9px 10px; border-radius: 10px; color: var(--ink-2); font-weight: 600; }
.nav a:hover { background: var(--blue-soft); color: var(--ink); }
.nav a.on { background: var(--grad-soft); color: var(--blue); box-shadow: inset 0 0 0 1px #d4e6ff; }
.nav svg { width: 18px; height: 18px; flex: none; }
.side .foot { margin-top: auto; padding: 10px; border-radius: 12px; background: var(--grad-soft); font-size: 12px; color: var(--ink-2); }
.side .foot b { color: var(--ink); font-size: 15px; }
.main { padding: 26px 32px 60px; min-width: 0; }
.head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 18px; flex-wrap: wrap; }
.head p { margin: 4px 0 0; color: var(--ink-2); }

/* controls */
.btn {
  display: inline-flex; align-items: center; gap: 7px; padding: 9px 14px; border-radius: 10px; border: 1px solid var(--line);
  background: #fff; color: var(--ink); font-weight: 700; font-size: 13px; transition: .15s; white-space: nowrap;
}
.btn:hover { border-color: #c9dbf7; box-shadow: var(--shadow); }
.btn.primary { background: var(--grad); color: #fff; border: 0; box-shadow: 0 6px 18px rgba(47, 123, 255, .3); }
.btn.primary:hover { filter: brightness(1.05); }
.btn.ghost { background: transparent; border-color: transparent; color: var(--ink-2); }
.btn.ghost:hover { background: var(--blue-soft); box-shadow: none; }
.btn.sm { padding: 6px 10px; font-size: 12px; border-radius: 8px; }
.btn:disabled { opacity: .55; cursor: default; }
.btn.danger { color: var(--red); }
.input, .textarea, .select {
  width: 100%; padding: 10px 12px; border-radius: 10px; border: 1px solid var(--line); background: #fff; outline: none; transition: .15s;
}
.input:focus, .textarea:focus, .select:focus { border-color: var(--blue-2); box-shadow: 0 0 0 3px rgba(47, 123, 255, .12); }
.textarea { min-height: 90px; resize: vertical; }
label.f { display: block; font-weight: 700; font-size: 12px; color: var(--ink-2); margin: 14px 0 6px; }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.grow { flex: 1; }
.pill {
  display: inline-flex; align-items: center; gap: 6px; padding: 7px 12px; border-radius: 999px; border: 1px solid var(--line);
  background: #fff; font-weight: 700; font-size: 12.5px; color: var(--ink-2); cursor: pointer; user-select: none;
}
.pill.on { background: var(--blue-soft); border-color: #bcd7ff; color: var(--blue); }
.pill select { border: 0; background: transparent; font-weight: 700; color: inherit; outline: none; cursor: pointer; }
.chip { display: inline-flex; align-items: center; gap: 6px; padding: 5px 10px; border-radius: 999px; background: var(--blue-soft); color: var(--blue); font-weight: 700; font-size: 12px; }
.chip button { border: 0; background: none; color: inherit; padding: 0; font-size: 14px; line-height: 1; opacity: .6; }
.chips { display: flex; gap: 6px; flex-wrap: wrap; }

.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--r); box-shadow: var(--shadow); }
.pad { padding: 18px; }
.hero {
  border-radius: 20px; padding: 26px; color: #fff; background: var(--grad); position: relative; overflow: hidden;
  box-shadow: 0 18px 40px rgba(47, 123, 255, .25);
}
.hero::after { content: ""; position: absolute; right: -80px; top: -80px; width: 280px; height: 280px; border-radius: 50%; background: rgba(255, 255, 255, .14); }
.hero h1 { font-size: 28px; }
.hero p { opacity: .92; max-width: 640px; }

/* grid of posts */
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 16px; }
.post {
  background: #fff; border: 1px solid var(--line); border-radius: var(--r); overflow: hidden; cursor: pointer; transition: .18s; position: relative;
  box-shadow: var(--shadow);
}
.post:hover { transform: translateY(-3px); box-shadow: 0 14px 34px rgba(16, 40, 90, .12); border-color: #cfe0fb; }
.post .th { aspect-ratio: 9/14; background: var(--grad-soft) center/cover no-repeat; position: relative; }
.post .th img { width: 100%; height: 100%; object-fit: cover; display: block; }
.post .badge {
  position: absolute; top: 8px; left: 8px; padding: 4px 8px; border-radius: 8px; font-weight: 800; font-size: 12px;
  background: rgba(255, 255, 255, .92); color: var(--ink); backdrop-filter: blur(6px);
}
.post .badge.hot { background: var(--grad); color: #fff; }
.post .kind { position: absolute; top: 8px; right: 8px; width: 26px; height: 26px; border-radius: 8px; background: rgba(13, 27, 51, .55); display: grid; place-items: center; color: #fff; }
.post .kind svg { width: 14px; height: 14px; }
.post .dur { position: absolute; bottom: 8px; right: 8px; padding: 2px 6px; border-radius: 6px; background: rgba(13, 27, 51, .6); color: #fff; font-size: 11px; font-weight: 700; }
.post .save {
  position: absolute; bottom: 8px; left: 8px; width: 30px; height: 30px; border-radius: 9px; border: 0; background: rgba(255, 255, 255, .92);
  display: grid; place-items: center; color: var(--ink-2); opacity: 0; transition: .15s;
}
.post:hover .save, .post .save.on { opacity: 1; }
.post .save.on { color: var(--blue); }
.post .save svg { width: 16px; height: 16px; }
.post .meta { padding: 10px 11px 11px; }
.post .cap { font-weight: 700; font-size: 12.5px; line-height: 1.35; height: 34px; overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.post .by { display: flex; justify-content: space-between; color: var(--ink-3); font-size: 11.5px; margin: 6px 0 8px; }
.stats { display: flex; gap: 5px; flex-wrap: wrap; }
.st { display: inline-flex; align-items: center; gap: 4px; padding: 3px 7px; border-radius: 7px; font-size: 11.5px; font-weight: 800; background: #f1f5fc; color: var(--ink-2); }
.st.g { background: var(--green-soft); color: var(--green); }
.st.b { background: var(--blue-soft); color: var(--blue); }
.st.a { background: var(--amber-soft); color: var(--amber); }
.st svg { width: 12px; height: 12px; }

/* creators */
.cgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 14px; }
.creator { padding: 14px; display: flex; flex-direction: column; gap: 10px; cursor: pointer; transition: .15s; position: relative; }
.creator:hover { border-color: #cfe0fb; box-shadow: 0 12px 30px rgba(16, 40, 90, .1); }
.creator.sel { border-color: var(--blue); box-shadow: 0 0 0 3px rgba(47, 123, 255, .15); }
.ava { width: 44px; height: 44px; border-radius: 50%; object-fit: cover; background: var(--grad-soft); flex: none; border: 2px solid #fff; box-shadow: 0 0 0 1.5px #d4e6ff; }
.ava.lg { width: 84px; height: 84px; }
.creator .nm { font-weight: 800; }
.creator .tops { display: grid; grid-template-columns: repeat(4, 1fr); gap: 4px; }
.creator .tops img, .creator .tops div { width: 100%; aspect-ratio: 9/14; object-fit: cover; border-radius: 7px; background: var(--grad-soft); }
.check { position: absolute; top: 12px; right: 12px; width: 22px; height: 22px; border-radius: 7px; border: 2px solid #c8d6ee; background: #fff; display: grid; place-items: center; }
.creator.sel .check { background: var(--grad); border: 0; }
.creator.sel .check::after { content: "✓"; color: #fff; font-weight: 900; font-size: 13px; }
.src { font-size: 11px; font-weight: 800; padding: 2px 7px; border-radius: 6px; background: #f1f5fc; color: var(--ink-3); }
.src.ai { background: #f0ebff; color: #7a4dff; }

/* modal */
.overlay { position: fixed; inset: 0; background: rgba(13, 27, 51, .42); backdrop-filter: blur(4px); z-index: 50; display: flex; align-items: center; justify-content: center; padding: 24px; animation: fade .15s; }
@keyframes fade { from { opacity: 0; } }
.modal { background: #fff; border-radius: 20px; box-shadow: var(--shadow-lg); width: min(1180px, 100%); height: min(860px, 100%); display: grid; grid-template-columns: 400px 1fr; overflow: hidden; position: relative; }
.modal .x { position: absolute; top: 12px; right: 12px; width: 34px; height: 34px; border-radius: 10px; border: 1px solid var(--line); background: #fff; z-index: 3; font-size: 18px; }
.player { background: #0b1530; display: flex; flex-direction: column; min-height: 0; }
.player .stage { flex: 1; display: flex; align-items: center; justify-content: center; min-height: 0; position: relative; }
.player video, .player .stage img { max-width: 100%; max-height: 100%; display: block; }
.player .carousel-nav { display: flex; gap: 6px; padding: 10px; overflow-x: auto; background: #0b1530; }
.player .carousel-nav img { width: 48px; height: 64px; object-fit: cover; border-radius: 6px; opacity: .55; cursor: pointer; border: 2px solid transparent; }
.player .carousel-nav img.on { opacity: 1; border-color: var(--cyan); }
.player .arrow { position: absolute; top: 50%; transform: translateY(-50%); width: 36px; height: 36px; border-radius: 50%; border: 0; background: rgba(255, 255, 255, .9); font-size: 18px; }
.player .arrow.l { left: 10px; } .player .arrow.r { right: 10px; }
.loader-dark { color: #9fb3d9; font-weight: 600; }
.pane { display: flex; flex-direction: column; min-height: 0; }
.pane .top { padding: 20px 60px 14px 24px; border-bottom: 1px solid var(--line); }
.pane .top .t { font-weight: 800; font-size: 16px; line-height: 1.35; max-height: 44px; overflow: hidden; }
.pane .body { padding: 18px 24px 30px; overflow-y: auto; flex: 1; }
.tiles { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.tile { padding: 10px 12px; border-radius: 12px; border: 1px solid var(--line); }
.tile .k { font-size: 11.5px; font-weight: 700; color: var(--ink-3); }
.tile .v { font-size: 18px; font-weight: 800; margin-top: 2px; }
.tile.g { background: var(--green-soft); border-color: #c7eedd; } .tile.g .v { color: var(--green); }
.tile.b { background: var(--blue-soft); border-color: #cfe2ff; } .tile.b .v { color: var(--blue); }
.tabs { display: flex; gap: 4px; padding: 4px; background: #f1f5fc; border-radius: 12px; margin: 16px 0; }
.tabs button { flex: 1; border: 0; background: none; padding: 8px 6px; border-radius: 9px; font-weight: 700; color: var(--ink-2); font-size: 13px; }
.tabs button.on { background: #fff; color: var(--blue); box-shadow: var(--shadow); }
.seg { display: grid; grid-template-columns: 62px 1fr; gap: 10px; padding: 7px 8px; border-radius: 9px; cursor: pointer; }
.seg:hover { background: var(--blue-soft); }
.seg.on { background: var(--grad-soft); box-shadow: inset 3px 0 0 var(--blue); }
.seg .tc { font-variant-numeric: tabular-nums; color: var(--blue); font-weight: 800; font-size: 12px; padding-top: 1px; }
.block { border: 1px solid var(--line); border-radius: 14px; padding: 14px 16px; margin-bottom: 12px; }
.block h4 { margin: 0 0 8px; font-size: 12px; text-transform: uppercase; letter-spacing: .06em; color: var(--ink-3); }
.block ul { margin: 0; padding-left: 18px; } .block li { margin: 4px 0; }
.block.accent { background: var(--grad-soft); border-color: #d4e6ff; }
.hook { font-size: 16px; font-weight: 800; line-height: 1.35; }
.steps { display: flex; flex-direction: column; gap: 8px; }
.step { display: grid; grid-template-columns: 90px 1fr; gap: 10px; }
.step .tm { font-size: 11.5px; font-weight: 800; color: var(--blue); }
.step .pt { font-weight: 800; font-size: 12.5px; }
.script-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.script-table th { text-align: left; font-size: 11px; text-transform: uppercase; letter-spacing: .05em; color: var(--ink-3); padding: 8px; border-bottom: 1px solid var(--line); }
.script-table td { padding: 10px 8px; border-bottom: 1px solid var(--line); vertical-align: top; }
.script-table td[contenteditable]:focus { outline: 2px solid #cfe2ff; border-radius: 6px; background: #fbfdff; }
.script-table td.tm { color: var(--blue); font-weight: 800; white-space: nowrap; }
.empty { text-align: center; padding: 50px 20px; color: var(--ink-2); }
.empty .ic { width: 60px; height: 60px; border-radius: 18px; background: var(--grad-soft); margin: 0 auto 14px; display: grid; place-items: center; color: var(--blue); }
.empty .ic svg { width: 28px; height: 28px; }
.spin { width: 16px; height: 16px; border-radius: 50%; border: 2px solid currentColor; border-right-color: transparent; animation: sp .7s linear infinite; display: inline-block; vertical-align: -3px; }
@keyframes sp { to { transform: rotate(360deg); } }
.loading { display: flex; align-items: center; gap: 10px; color: var(--ink-2); padding: 30px; justify-content: center; font-weight: 600; }
.toast { position: fixed; bottom: 22px; left: 50%; transform: translateX(-50%); background: var(--ink); color: #fff; padding: 11px 16px; border-radius: 12px; font-weight: 600; z-index: 99; box-shadow: var(--shadow-lg); max-width: 90vw; }
.toast.err { background: var(--red); }
.menu { position: absolute; background: #fff; border: 1px solid var(--line); border-radius: 12px; box-shadow: var(--shadow-lg); padding: 6px; z-index: 60; min-width: 200px; }
.menu button { display: flex; width: 100%; text-align: left; padding: 8px 10px; border: 0; background: none; border-radius: 8px; font-weight: 600; gap: 8px; align-items: center; }
.menu button:hover { background: var(--blue-soft); }
.folder { padding: 12px; cursor: pointer; transition: .15s; }
.folder:hover { box-shadow: 0 12px 30px rgba(16, 40, 90, .1); }
.folder .covers { display: grid; grid-template-columns: repeat(4, 1fr); gap: 4px; margin-bottom: 10px; }
.folder .covers div { aspect-ratio: 9/14; border-radius: 8px; background: var(--grad-soft) center/cover; }
.login { min-height: 100vh; display: grid; place-items: center; }
.login .card { width: 360px; padding: 28px; }
.list-row { display: flex; align-items: center; gap: 12px; padding: 12px 14px; border-bottom: 1px solid var(--line); cursor: pointer; }
.list-row:hover { background: #fafcff; }
.list-row:last-child { border-bottom: 0; }
.kv { display: grid; grid-template-columns: 1fr 1fr; gap: 0 18px; }
@media (max-width: 1000px) {
  .app { grid-template-columns: 1fr; }
  .side { position: static; height: auto; flex-direction: row; flex-wrap: wrap; align-items: center; }
  .side .foot { margin: 0; }
  .nav { flex-direction: row; flex-wrap: wrap; }
  .modal { grid-template-columns: 1fr; overflow-y: auto; height: 100%; }
  .player { min-height: 60vh; }
  .main { padding: 18px; }
  .kv { grid-template-columns: 1fr; }
}
