/* rap clips studio — «солнечная кузница»: светлый футуризм с огненными
   акцентами. Селекторы не менять — на них живёт app.js. */

:root {
  --bg: #faf7f2;
  --bg-glow-1: rgba(255, 122, 41, .16);
  --bg-glow-2: rgba(255, 61, 61, .10);
  --panel: rgba(255, 255, 255, .78);
  --card: rgba(255, 252, 247, .92);
  --inset: rgba(255, 255, 255, .95);
  --border: rgba(255, 122, 41, .28);
  --border-bright: rgba(255, 61, 61, .55);
  --text: #241a14;
  --muted: #9b8a7d;
  --accent: #ff3d3d;
  --accent-2: #ff7a29;
  --gold: #ffb545;
  --danger: #e5484d;
  --ok: #14a06b;
  --font-head: "SF Pro Display", -apple-system, "Segoe UI", sans-serif;
  --font-mono: ui-monospace, "SF Mono", "JetBrains Mono", Menlo, monospace;
  font-family: -apple-system, "Inter", "Segoe UI", Arial, sans-serif;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  color: var(--text);
  background:
    radial-gradient(1100px 520px at 88% -12%, var(--bg-glow-1), transparent 60%),
    radial-gradient(900px 520px at -12% 28%, var(--bg-glow-2), transparent 55%),
    radial-gradient(700px 400px at 50% 110%, rgba(255,181,69,.14), transparent 60%),
    linear-gradient(rgba(255,122,41,.05) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255,122,41,.05) 1px, transparent 1px),
    var(--bg);
  background-size: auto, auto, auto, 44px 44px, 44px 44px, auto;
  min-height: 100vh;
}

.hidden { display: none !important; }

/* ────────── вход ────────── */
.login-screen { min-height: 100vh; display: flex; align-items: center; justify-content: center; }
.login-box { display: flex; flex-direction: column; gap: 14px; width: 300px; }
.login-box h1 {
  font-family: var(--font-mono); font-size: 17px; letter-spacing: .28em;
  text-transform: uppercase; text-align: center; margin-bottom: 10px;
  background: linear-gradient(90deg, var(--accent), var(--accent-2), var(--gold));
  -webkit-background-clip: text; background-clip: text; color: transparent;
}
.login-box input {
  padding: 12px 14px; border-radius: 10px; border: 1px solid var(--border);
  background: var(--inset); color: var(--text); font-size: 14px;
}
.login-box input:focus { outline: none; border-color: var(--border-bright); box-shadow: 0 0 0 3px rgba(255,122,41,.16); }
.login-box button {
  padding: 12px; border-radius: 14px; border: 2px solid #2d211a; cursor: pointer; font-weight: 800;
  color: #fff; background: linear-gradient(180deg, var(--accent-2), var(--accent));
  box-shadow: 0 5px 0 #2d211a, 0 12px 28px rgba(255, 90, 40, .35);
}
.login-box button:active { transform: translateY(5px); box-shadow: 0 0 0 #2d211a; }
.error { color: var(--danger); font-size: 13px; }

/* ────────── лендинг qlolvideo ────────── */
.welcome-screen { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 24px 16px; }
.welcome-box {
  display: flex; flex-direction: column; gap: 14px; max-width: 480px; width: 100%;
  background: var(--panel); backdrop-filter: blur(16px);
  border: 2.5px solid #2d211a; border-radius: 22px; padding: 28px 26px 22px;
  box-shadow: 0 7px 0 #e8d8c4, 0 7px 0 2.5px #2d211a, 0 20px 40px rgba(212,118,40,.14);
  text-align: center;
}
.welcome-title {
  font-family: var(--font-mono); font-size: 34px; letter-spacing: .22em;
  text-transform: uppercase; margin: 0;
  background: linear-gradient(90deg, var(--accent), var(--accent-2), var(--gold));
  -webkit-background-clip: text; background-clip: text; color: transparent;
}
.welcome-sub { margin: 0; font-size: 15px; font-weight: 700; color: var(--text); }
.welcome-feats {
  list-style: none; margin: 6px 0 4px; padding: 0; text-align: left;
  display: flex; flex-direction: column; gap: 8px; font-size: 13.5px; line-height: 1.45;
}
.welcome-feats li {
  background: var(--inset); border: 1px solid var(--border);
  border-radius: 12px; padding: 9px 12px;
}
.welcome-cta { font-size: 17px; padding: 13px 18px; }
.welcome-have { align-self: center; }
.welcome-privacy { margin: 4px 0 0; font-size: 11.5px; }

/* ────────── каркас ────────── */
.app { max-width: 1020px; margin: 0 auto; padding: 18px 16px 64px; }
.topbar { display: flex; align-items: center; gap: 14px; margin-bottom: 22px; }
.project-name {
  flex: 1; font-family: var(--font-head); font-size: 22px; font-weight: 800;
  letter-spacing: .02em; background: transparent; border: none; color: var(--text); padding: 8px 6px;
}
.project-name:focus { outline: 1px solid var(--border-bright); border-radius: 8px; }

.panel {
  position: relative;
  background: var(--panel); backdrop-filter: blur(16px);
  border: 2.5px solid #2d211a; border-radius: 22px;
  padding: 16px; margin-bottom: 16px;
  /* «картонный 3D»: жёсткая офсетная тень как второй слой картона */
  box-shadow: 0 7px 0 #e8d8c4, 0 7px 0 2.5px #2d211a, 0 20px 40px rgba(212,118,40,.14);
}
.panel::before {
  content: ""; position: absolute; inset: 0 0 auto 0; height: 6px; border-radius: 22px 22px 0 0;
  background: linear-gradient(90deg, var(--accent), var(--accent-2), var(--gold));
  opacity: .9;
}
.panel h2 {
  font-family: var(--font-mono); font-size: 11.5px; letter-spacing: .22em;
  text-transform: uppercase; color: var(--accent-2); margin: 0 0 14px;
}

label { display: block; font-family: var(--font-mono); font-size: 10px; letter-spacing: .07em; text-transform: uppercase; color: var(--muted); margin: 8px 0 4px; }
textarea, input[type=text], input[type=number], input:not([type]), select {
  width: 100%; padding: 8px 10px; border-radius: 11px; border: 1.5px solid rgba(45,33,26,.35);
  background: var(--inset); color: var(--text); font-family: inherit; font-size: 13.5px;
  transition: border-color .15s, box-shadow .15s;
}
textarea:focus, input:focus, select:focus {
  outline: none; border-color: var(--border-bright); box-shadow: 0 0 0 3px rgba(255,122,41,.13);
}
textarea { resize: vertical; }

.row { display: flex; align-items: center; gap: 8px; margin-top: 10px; flex-wrap: wrap; }
button {
  padding: 8px 14px; border-radius: 12px; cursor: pointer; font-size: 12.5px; font-weight: 700;
  color: var(--text); background: var(--card); border: 2px solid #2d211a;
  box-shadow: 0 4px 0 #2d211a;
  transition: transform .08s, box-shadow .08s, border-color .15s;
}
button:hover:not(:disabled) { background: #fff; }
button:active:not(:disabled) { transform: translateY(4px); box-shadow: 0 0 0 #2d211a; }
button.primary {
  color: #fff; border: 2px solid #2d211a;
  background: linear-gradient(180deg, var(--accent-2), var(--accent));
  box-shadow: 0 4px 0 #2d211a, 0 10px 26px rgba(255, 90, 40, .35);
}
button.primary:active:not(:disabled) { transform: translateY(4px); box-shadow: 0 0 0 #2d211a; }
button.ghost { background: transparent; border: none; color: var(--muted); padding: 5px 9px; }
button.danger, button.ghost.danger { color: var(--danger); }
button:disabled { opacity: .45; cursor: default; box-shadow: none; }

.status { font-family: var(--font-mono); font-size: 11px; letter-spacing: .05em; color: var(--muted); }
.status::before { content: "◉ "; color: var(--accent-2); }
.status:empty::before { content: ""; }
.status.error { color: var(--danger); } .status.error::before { color: var(--danger); }
.status.done { color: var(--ok); } .status.done::before { color: var(--ok); }

/* ────────── треки ────────── */
.track-card {
  position: relative;
  background: var(--card); border: 2.5px solid #2d211a; border-radius: 18px;
  padding: 14px; margin-bottom: 14px;
  box-shadow: 0 6px 0 #e8d8c4, 0 6px 0 2.5px #2d211a;
}
.track-head { display: flex; align-items: center; gap: 12px; margin-bottom: 10px; }
.pos {
  font-family: var(--font-mono); font-weight: 800; font-size: 15px; min-width: 34px;
  color: var(--accent); text-shadow: 0 0 14px rgba(255,61,61,.35);
}
.t-title { flex: 1; font-weight: 700; font-size: 15.5px; }
.order-btns { display: flex; gap: 2px; }
.track-body { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
@media (max-width: 700px) { .track-body { grid-template-columns: 1fr; } }
.t-audio { width: 100%; }
.t-duration { font-family: var(--font-mono); font-size: 11px; color: var(--muted); }

/* ────────── степпер трека: 5 этапов ────────── */
.stage-tabs {
  display: flex; gap: 6px; margin: 10px 0 12px; overflow-x: auto;
  padding-bottom: 4px; scrollbar-width: none;
}
.stage-tabs::-webkit-scrollbar { display: none; }
.stage-tab {
  display: inline-flex; align-items: center; gap: 7px; flex: none;
  padding: 6px 11px; border-radius: 999px; white-space: nowrap;
  font-size: 11.5px; font-weight: 700; box-shadow: 0 3px 0 #2d211a;
}
.stage-tab:active:not(:disabled) { transform: translateY(3px); box-shadow: 0 0 0 #2d211a; }
.stage-tab .st-num {
  font-family: var(--font-mono); font-size: 10px; font-weight: 800;
  width: 16px; height: 16px; border-radius: 6px; flex: none;
  display: inline-flex; align-items: center; justify-content: center;
  background: rgba(45,33,26,.1);
}
.stage-tab.on,
.stage-tab.on:hover:not(:disabled) {
  color: #fff; background: linear-gradient(180deg, var(--accent-2), var(--accent));
}
.stage-tab.on .st-num { background: rgba(255,255,255,.22); color: #fff; }
.stage-dot { width: 8px; height: 8px; border-radius: 50%; background: #cfc2b4; flex: none; }
.stage-dot.part, .stage-dot.busy { background: var(--accent-2); }
.stage-dot.busy { animation: stage-dot-pulse 1.1s ease-in-out infinite; }
.stage-dot.done { background: var(--ok); }
.stage-dot.error { background: var(--danger); }
@keyframes stage-dot-pulse { 50% { opacity: .35; } }
.stage-pane { display: none; }
.stage-pane.on { display: block; }
.track-head .s-supergen { flex: none; font-size: 12px; padding: 7px 12px; }
.supergen-note { display: block; margin: 2px 0 0; }
.supergen-note:empty { display: none; }
.t-story-quote {
  margin: 4px 0 8px; padding: 10px 12px; border-left: 4px solid var(--accent-2);
  background: var(--inset); border-radius: 0 12px 12px 0;
  font-size: 13px; line-height: 1.5; white-space: pre-wrap;
}
.t-story-quote.empty { color: var(--muted); font-style: italic; }
.t-note-text { margin: 2px 0 0; font-size: 12.5px; line-height: 1.5; }

/* «Готовое»: сетка видео всех сцен */
.final-scenes { margin-top: 16px; padding-top: 14px; border-top: 1px dashed var(--border); }
.final-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 10px;
}
.final-cell { display: flex; flex-direction: column; gap: 4px; }
.final-cell video {
  width: 100%; aspect-ratio: 9/16; object-fit: cover; background: #000;
  border-radius: 12px; border: 2px solid #2d211a;
}
.final-cell .muted { font-size: 11px; text-align: center; }

.add-track { margin-top: 12px; }
.add-track summary {
  cursor: pointer; color: var(--accent-2); font-weight: 700; padding: 8px 0;
  font-family: var(--font-mono); font-size: 12.5px; letter-spacing: .06em; text-transform: uppercase;
}
.track-form { display: flex; flex-direction: column; gap: 10px; margin-top: 12px; }

/* ────────── лист раскадровки / клип ────────── */
.storyboard-block, .clip-block { margin-top: 18px; padding-top: 16px; border-top: 1px dashed var(--border); }
.media-head { display: flex; justify-content: space-between; align-items: center; font-family: var(--font-mono); font-size: 10.5px; letter-spacing: .1em; text-transform: uppercase; color: var(--muted); margin-bottom: 8px; }
.storyboard-box, .media-box {
  background: var(--inset); border: 2px dashed rgba(45,33,26,.4); border-radius: 16px;
  display: flex; align-items: center; justify-content: center; overflow: hidden;
}
.storyboard-box { min-height: 100px; }
.storyboard-box img { width: 100%; height: auto; display: block; }
.media-box { aspect-ratio: 9/16; max-height: 270px; }
.media-box img, .media-box video { width: 100%; height: 100%; object-fit: cover; }
.clip-box { aspect-ratio: 9/16; max-height: 440px; margin: 0 auto; box-shadow: 0 12px 44px rgba(255, 110, 45, .28); }
.clip-download { color: var(--accent); font-family: var(--font-mono); font-size: 12px; text-decoration: none; letter-spacing: .06em; }

/* ────────── сцены: горизонтальная лента ────────── */
.strip-wrap { position: relative; margin-top: 14px; }
.scenes {
  display: flex; flex-direction: row; gap: 12px;
  overflow-x: auto; scroll-snap-type: x mandatory;
  padding: 4px 2px 10px; scrollbar-width: thin;
}
.strip-arrow {
  position: absolute; top: 50%; transform: translateY(-50%); z-index: 3;
  padding: 4px 11px; font-size: 16px; border-radius: 999px; line-height: 1.3;
  box-shadow: 0 3px 0 #2d211a;
}
.strip-arrow:active:not(:disabled) { transform: translateY(calc(-50% + 3px)); box-shadow: 0 0 0 #2d211a; }
.strip-prev { left: -8px; }
.strip-next { right: -8px; }
.scene-card {
  position: relative; flex: 0 0 280px; scroll-snap-align: start;
  display: flex; flex-direction: column; gap: 6px;
  background: #fffdf9; border: 2px solid #2d211a; border-radius: 18px; padding: 12px;
  border-left: 8px solid transparent;
  box-shadow: 0 4px 0 #e8d8c4, 0 4px 0 2px #2d211a;
  transition: border-color .18s, box-shadow .18s, transform .12s;
}
/* один шаблон — две линзы: board показывает кадры, anim — видео */
.scene-card.mode-board .anim-only { display: none; }
.scene-card.mode-anim .board-only { display: none; }
.s-thumbs { display: flex; gap: 8px; }
.s-thumb {
  position: relative; flex: 1; aspect-ratio: 9/16; max-height: 170px;
  border: 2px dashed rgba(45,33,26,.35); border-radius: 12px; overflow: hidden;
  background: var(--inset);
}
.s-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.s-thumb-cap {
  position: absolute; left: 5px; bottom: 3px; font-family: var(--font-mono);
  font-size: 9.5px; letter-spacing: .06em; color: #fff;
  text-shadow: 0 1px 4px rgba(45,33,26,.75); pointer-events: none;
}
.s-midframes { display: flex; gap: 4px; flex-wrap: wrap; }
.s-midframes:empty { display: none; }
.s-midframes img {
  width: 34px; height: 60px; object-fit: cover; border-radius: 7px;
  border: 1.5px solid #2d211a; cursor: zoom-in; display: block;
}
/* референсы кадра: картинки-образцы композиции/света/вайба (картон, как фото
   персонажей) — стилистику всё равно диктует стиль трека, реф только «как снято» */
.s-refs { display: flex; gap: 5px; flex-wrap: wrap; align-items: center; }
.s-ref {
  position: relative; width: 60px; height: 60px; border-radius: 10px; overflow: hidden;
  border: 2px solid #2d211a; box-shadow: 0 2px 0 #e8d8c4, 0 2px 0 2px #2d211a; flex: none;
}
.s-ref img { width: 100%; height: 100%; object-fit: cover; display: block; cursor: zoom-in; }
.s-ref-del {
  position: absolute; top: 0; right: 0; padding: 0 3px; font-size: 10px; line-height: 14px;
  background: rgba(255,255,255,.85); border-radius: 0 0 0 6px;
}
.s-ref-upload {
  cursor: pointer; margin: 0; display: inline-flex; flex: none;
  font-family: inherit; text-transform: none; letter-spacing: normal;
}
.s-ref-btn {
  display: inline-block; padding: 4px 8px; border-radius: 8px; font-size: 11px; font-weight: 700;
  border: 1px dashed var(--border-bright); color: var(--accent-2); white-space: nowrap;
}
.s-ref-btn:hover { box-shadow: 0 3px 12px rgba(255,122,41,.22); }

/* персонажи сцены — чипы поверх скрытого input.s-chars */
.s-chars-chips { display: flex; flex-wrap: wrap; gap: 4px; }
.s-chars-chips:empty { display: none; }
.char-chip { padding: 3px 9px; font-size: 10.5px; border-radius: 999px; box-shadow: 0 2px 0 #2d211a; }
.char-chip.on,
.char-chip.on:hover:not(:disabled) {
  color: #fff; background: linear-gradient(180deg, var(--accent-2), var(--accent));
}
.char-chip:active:not(:disabled) { transform: translateY(2px); box-shadow: 0 0 0 #2d211a; }
.s-prompt-details summary, .style-desc summary {
  cursor: pointer; font-family: var(--font-mono); font-size: 10px;
  letter-spacing: .1em; text-transform: uppercase; color: var(--muted);
  padding: 3px 0; user-select: none;
}
.s-prompt-details summary:hover, .style-desc summary:hover { color: var(--accent-2); }
.s-edit { display: flex; flex-direction: column; gap: 6px; padding-top: 4px; border-top: 1px dashed var(--border); }
.s-board-actions { margin-top: auto; }
.s-gen-mid { font-size: 11.5px; }
.s-video-box { max-height: 320px; }
.scene-card .approve-check { justify-content: center; }
.scene-card.active { border-color: var(--accent-2); border-left-color: var(--accent-2); transform: translateY(-2px); box-shadow: 0 6px 0 #f3c99a, 0 6px 0 2px var(--accent-2), 0 14px 34px rgba(255,122,41,.3); }
.scene-card.shot-extreme-close-up, .scene-card.shot-close-up { border-left-color: var(--accent); }
.scene-card.shot-medium { border-left-color: var(--gold); }
.scene-card.shot-wide, .scene-card.shot-establishing { border-left-color: #2fb0ff; }

.scene-head { display: flex; align-items: center; gap: 10px; }
.s-pos { font-family: var(--font-mono); font-weight: 800; color: var(--accent-2); text-shadow: 0 0 12px rgba(255,122,41,.4); }
.s-time { font-family: var(--font-mono); font-size: 11px; color: var(--muted); flex: 1; }
.s-duration { width: 72px; }
.s-play { font-size: 13px; color: var(--accent); }

.shot-row { display: flex; gap: 8px; margin: 8px 0; }
.shot-row select { width: auto; flex: 1; }
.shot-row input { flex: 1; }
.shot-row .s-duration { flex: 0 0 64px; width: 64px; }

.media-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-top: 12px; }
.media-row.three { grid-template-columns: 1fr 1fr 1fr; }
@media (max-width: 700px) { .media-row, .media-row.three { grid-template-columns: 1fr; } }
.media-col { display: flex; flex-direction: column; gap: 6px; }

.scene-audio-row { display: flex; align-items: center; gap: 10px; margin-top: 10px; }
.scene-audio-row audio { height: 32px; flex: 1; }
.muted { color: var(--muted); font-size: 12.5px; }
.s-provider { width: auto; }

.approve-check {
  display: flex; align-items: center; gap: 9px; cursor: pointer;
  font-size: 12.5px; color: var(--text); font-weight: 700;
  padding: 8px 12px; border-radius: 13px; border: 2px solid #2d211a; background: var(--inset);
  box-shadow: 0 3px 0 #2d211a;
}
.approve-check:active { transform: translateY(3px); box-shadow: 0 0 0 #2d211a; }
.approve-check:has(input:checked) {
  border-color: var(--ok); box-shadow: 0 2px 14px rgba(20,160,107,.22); color: var(--ok);
}
.approve-check input { width: auto; accent-color: var(--ok); }

/* ────────── персонажи ────────── */
.char-card {
  background: var(--card); border: 2px solid #2d211a; border-radius: 20px;
  padding: 14px; margin-bottom: 14px;
  box-shadow: 0 5px 0 #e8d8c4, 0 5px 0 2px #2d211a;
}
.char-head { display: flex; align-items: center; gap: 10px; }
.c-name { flex: 1; font-weight: 700; }
.c-main-label { padding: 6px 10px; font-size: 11.5px; white-space: nowrap; }
.char-photos { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.char-photo { position: relative; width: 76px; height: 76px; border-radius: 14px; overflow: hidden; border: 2px solid #2d211a; box-shadow: 0 3px 0 #e8d8c4, 0 3px 0 2px #2d211a; }
.char-photo img { width: 100%; height: 100%; object-fit: cover; }
.char-photo-del {
  position: absolute; top: 2px; right: 2px; padding: 1px 5px; font-size: 11px;
  background: rgba(255,255,255,.85); border-radius: 6px;
}
.c-upload-label { cursor: pointer; }
.c-upload-btn {
  display: inline-block; padding: 10px 14px; border-radius: 10px; font-size: 13px;
  border: 1px dashed var(--border-bright); color: var(--accent-2);
}
.c-upload-btn:hover { box-shadow: 0 4px 16px rgba(255,122,41,.22); }

/* ────────── атрибуты персонажа (фирменные вещи) ────────── */
.char-attrs-block { margin-top: 10px; padding-top: 8px; border-top: 1px dashed var(--border); }
.attrs-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 6px; }
.attrs-title {
  font-family: var(--font-mono); font-size: 10px; letter-spacing: .1em;
  text-transform: uppercase; color: var(--muted);
}
.attr-add { padding: 3px 9px; font-size: 11px; border-radius: 999px; box-shadow: 0 2px 0 #2d211a; flex: none; }
.attr-add:active:not(:disabled) { transform: translateY(2px); box-shadow: 0 0 0 #2d211a; }
.char-attrs { display: flex; flex-wrap: wrap; gap: 6px; }
.attr-chip {
  display: inline-flex; align-items: center; gap: 5px; padding: 4px 6px; border-radius: 12px;
  background: var(--inset); border: 1.5px solid #2d211a; box-shadow: 0 2px 0 #2d211a;
}
.attr-name {
  padding: 3px 7px; font-size: 11.5px; font-weight: 700; border-radius: 8px;
  border: none; background: transparent; box-shadow: none; color: var(--text);
}
.attr-name:hover:not(:disabled) { background: rgba(255,122,41,.12); }
.attr-name:active:not(:disabled) { transform: none; box-shadow: none; }
.attr-photos { display: flex; gap: 4px; align-items: center; }
.attr-thumb {
  position: relative; width: 40px; height: 40px; border-radius: 8px; overflow: hidden;
  border: 1.5px solid #2d211a; flex: none;
}
.attr-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.attr-photo-del {
  position: absolute; top: 0; right: 0; padding: 0 3px; font-size: 10px; line-height: 14px;
  background: rgba(255,255,255,.85); border-radius: 0 0 0 6px;
}
.attr-upload {
  cursor: pointer; margin: 0; display: inline-flex; flex: none;
  font-family: inherit; text-transform: none; letter-spacing: normal;
}
.attr-upload-btn {
  display: inline-block; padding: 4px 8px; border-radius: 8px; font-size: 11px; font-weight: 700;
  border: 1px dashed var(--border-bright); color: var(--accent-2); white-space: nowrap;
}
.attr-upload-btn:hover { box-shadow: 0 3px 12px rgba(255,122,41,.22); }
.attr-del { padding: 2px 5px; font-size: 11px; flex: none; }

/* ────────── проекты ────────── */
.project-select { width: auto; max-width: 260px; font-weight: 700; }
.kind-badge {
  font-family: var(--font-mono); font-size: 10.5px; letter-spacing: .12em;
  text-transform: uppercase; color: #fff; padding: 5px 10px; border-radius: 999px;
  background: linear-gradient(90deg, var(--accent), var(--accent-2));
  border: 2px solid #2d211a; box-shadow: 0 2px 0 #2d211a;
}
/* Очки генераций: тот же пилюльный бейдж, но «золотой» — это ресурс, не тип. */
.points-badge {
  background: linear-gradient(90deg, var(--gold), var(--accent-2));
  letter-spacing: .04em; white-space: nowrap;
}

/* ────────── выбор/микс стилей (1–3 чипа, первый — основа) ────────── */
.style-picker { margin: 4px 0; }
.style-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.style-chip.base { outline: 2px solid var(--gold); outline-offset: 1px; }
.style-desc { margin-top: 6px; }
.style-desc-body { font-size: 12px; line-height: 1.5; white-space: pre-line; padding: 4px 0 2px; }
.style-chip {
  display: inline-flex; align-items: center; gap: 6px; cursor: pointer;
  font-family: inherit; text-transform: none; letter-spacing: normal;
  font-size: 11.5px; font-weight: 700; padding: 5px 10px; border-radius: 999px;
  border: 1.5px solid #2d211a; background: var(--inset); box-shadow: 0 2px 0 #2d211a;
  transition: transform .08s, box-shadow .08s, background .12s;
  user-select: none; margin: 0;
}
.style-chip input { accent-color: var(--accent); width: auto; }
.style-chip.on {
  color: #fff; background: linear-gradient(180deg, var(--accent-2), var(--accent));
}
.style-chip:active { transform: translateY(3px); box-shadow: 0 0 0 #2d211a; }

/* ────────── общая модалка ────────── */
.modal-overlay {
  position: fixed; inset: 0; z-index: 50; padding: 20px;
  display: flex; align-items: center; justify-content: center;
  background: rgba(45, 33, 26, .45); backdrop-filter: blur(6px);
}
.modal-card {
  position: relative; width: 100%; max-width: 540px;
  max-height: calc(100vh - 40px); overflow-y: auto;
  background: var(--card); border: 2.5px solid #2d211a; border-radius: 22px; padding: 20px;
  box-shadow: 0 7px 0 #e8d8c4, 0 7px 0 2.5px #2d211a, 0 24px 60px rgba(45, 33, 26, .35);
}
.modal-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.modal-title {
  font-family: var(--font-mono); font-size: 12px; font-weight: 800;
  letter-spacing: .2em; text-transform: uppercase; color: var(--accent-2);
}
.modal-close { font-size: 15px; }

.modal-tabs { display: flex; gap: 8px; margin-top: 12px; }
.modal-tab {
  flex: 1; padding: 9px 12px; border-radius: 999px;
  font-family: var(--font-mono); font-size: 11px; letter-spacing: .1em; text-transform: uppercase;
  background: var(--inset); border: 2px solid #2d211a; box-shadow: 0 3px 0 #2d211a;
}
.modal-tab.on { color: #fff; background: linear-gradient(180deg, var(--accent-2), var(--accent)); }

/* карточки-кнопки выбора типа проекта */
.kind-cards { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.kind-card {
  display: flex; flex-direction: column; align-items: center; gap: 4px;
  padding: 16px 10px; border-radius: 18px; text-align: center; font-size: 13.5px;
  background: var(--inset); border: 2px solid #2d211a; box-shadow: 0 4px 0 #2d211a;
}
.kind-card .kind-emoji { font-size: 26px; }
.kind-card.on {
  color: #fff; background: linear-gradient(180deg, var(--accent-2), var(--accent));
  box-shadow: 0 4px 0 #2d211a, 0 10px 26px rgba(255, 90, 40, .35);
}
.kind-card.on .muted { color: rgba(255, 255, 255, .85); }

/* зона выбора обложки в модалке создания */
.cover-drop {
  display: flex; align-items: center; gap: 12px; margin: 0; cursor: pointer;
  padding: 10px; border: 2px dashed rgba(45, 33, 26, .4); border-radius: 16px;
  background: var(--inset);
  font-family: inherit; font-size: 13px; text-transform: none; letter-spacing: normal;
  color: var(--accent-2);
}
.cover-drop:hover { border-color: var(--border-bright); }
.np-cover-preview { width: 84px; height: 84px; object-fit: cover; border-radius: 12px; border: 2px solid #2d211a; flex: none; }

/* ────────── обложки проекта и треков ────────── */
.cover-slot {
  position: relative; display: flex; align-items: center; justify-content: center;
  margin: 0; overflow: hidden; cursor: pointer; flex: none;
  border: 2px solid #2d211a; box-shadow: 0 3px 0 #e8d8c4, 0 3px 0 2px #2d211a;
  background: linear-gradient(135deg, var(--gold), var(--accent-2), var(--accent));
  transition: box-shadow .15s;
}
.cover-slot:hover { box-shadow: 0 3px 0 #e8d8c4, 0 3px 0 2px #2d211a, 0 8px 22px rgba(255, 122, 41, .3); }
.cover-slot img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.cover-ph { color: #fff; font-weight: 800; text-shadow: 0 2px 10px rgba(45, 33, 26, .35); user-select: none; }
.project-cover { width: 64px; height: 64px; border-radius: 14px; }
.project-cover .cover-ph { font-size: 24px; }
.track-cover { width: 120px; height: 120px; border-radius: 16px; }
.track-cover .cover-ph { font-size: 40px; }
@media (max-width: 700px) {
  .track-cover { width: 84px; height: 84px; }
  .track-cover .cover-ph { font-size: 30px; }
}

/* ────────── база персонажей (вкладка «Из базы») ────────── */
.lib-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
  gap: 10px; margin-top: 12px;
}
.lib-card {
  display: flex; flex-direction: column; align-items: center; gap: 6px;
  padding: 10px; border-radius: 16px; text-align: center; font-size: 12.5px; font-weight: 400;
  background: var(--inset); border: 2px solid #2d211a; box-shadow: 0 3px 0 #2d211a;
}
.lib-card b { font-size: 12.5px; overflow-wrap: anywhere; }
.lib-card .muted { font-size: 11px; }
.lib-card.here { cursor: default; }
.lib-thumb {
  width: 72px; height: 72px; border-radius: 12px; overflow: hidden; flex: none;
  display: flex; align-items: center; justify-content: center;
  background: linear-gradient(135deg, var(--gold), var(--accent-2), var(--accent));
  color: #fff; font-weight: 800; font-size: 24px; border: 2px solid #2d211a;
}
.lib-thumb img { width: 100%; height: 100%; object-fit: cover; }


/* ────────── мобильная вёрстка ────────── */
@media (max-width: 700px) {
  .app { padding: 10px 8px 56px; }
  .panel { padding: 12px 10px; border-radius: 16px; margin-bottom: 12px; }
  .topbar { flex-wrap: wrap; gap: 8px; margin-bottom: 12px; }
  .project-select { max-width: 46vw; }
  .project-name { flex: 1 1 100%; order: 5; font-size: 18px; padding: 4px 2px; }
  .track-card { padding: 12px 10px; border-radius: 16px; }
  .track-head { flex-wrap: wrap; }
  .t-title { min-width: 55%; font-size: 14px; }
  .track-head .s-supergen { order: 6; flex: 1 1 auto; }
  /* лента сцен пальцем: стрелки не нужны, карточка почти во весь экран */
  .scene-card { padding: 10px 8px; flex-basis: min(82vw, 260px); }
  .strip-arrow { display: none; }
  .stage-tab { font-size: 10.5px; padding: 5px 8px; gap: 5px; }
  .stage-tabs { gap: 4px; }
  .s-thumb { max-height: 140px; }
  .final-grid { grid-template-columns: repeat(auto-fill, minmax(110px, 1fr)); }
  .row button { flex: 1 1 auto; min-width: 0; }
  .row .status { flex-basis: 100%; }
  .t-audio { width: 100%; }
  textarea { font-size: 13px; }
  .modal-card { width: 94vw; max-height: 88vh; overflow-y: auto; }
  .char-photo { width: 60px; height: 60px; }
  .style-picker { gap: 5px; }
  .style-chip { font-size: 10.5px; padding: 4px 8px; }
  .kind-cards { flex-direction: column; }
}

/* ────────── подпись автора: «сделано :333» = сделано с любовью ────────── */
.made-with {
  position: fixed; right: 14px; bottom: 10px; z-index: 5;
  font-family: var(--font-mono); font-size: 10.5px; letter-spacing: .12em;
  color: var(--muted); opacity: .75; pointer-events: none; user-select: none;
  text-shadow: 0 1px 0 rgba(255,255,255,.7);
}
@media (max-width: 700px) {
  .made-with { right: 10px; bottom: 6px; font-size: 9.5px; }
}

/* компактнее: поля растут по фокусу, пустые не занимают экран */
#character-bible:focus, #story:focus { min-height: 140px; }
textarea { transition: min-height .15s; }
.panel h2 { margin-bottom: 10px; }

/* инструкция на лендинге: нумерованные шаги */
.welcome-steps {
  margin: 2px 0 4px; padding: 0 0 0 4px; text-align: left; list-style: none;
  counter-reset: step; display: flex; flex-direction: column; gap: 6px;
  font-size: 13px; line-height: 1.4;
}
.welcome-steps li { counter-increment: step; display: flex; gap: 9px; align-items: baseline; }
.welcome-steps li::before {
  content: counter(step); flex: none; width: 20px; height: 20px; border-radius: 7px;
  display: inline-flex; align-items: center; justify-content: center;
  font-family: var(--font-mono); font-size: 11px; font-weight: 800; color: #fff;
  background: linear-gradient(180deg, var(--accent-2), var(--accent));
  border: 1.5px solid #2d211a; box-shadow: 0 2px 0 #2d211a;
}

/* компактные этап-табы и плотный стиль-пикер на всю ширину */
.stage-tabs { display: flex; flex-wrap: wrap; gap: 5px; margin: 8px 0 10px; }
.stage-tab { padding: 5px 10px !important; font-size: 11px !important; border-radius: 10px !important; }
.style-picker-wide { display: flex; flex-wrap: wrap; gap: 5px; }
.style-picker-wide .style-chip { font-size: 10.5px; padding: 4px 9px; box-shadow: 0 2px 0 #2d211a; }

/* разбор листа: сетка ячеек с выбором целевой сцены */
.cells-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
  gap: 10px; margin: 8px 0 12px; max-height: 56vh; overflow-y: auto;
}
.cell-card {
  border: 2px solid #2d211a; border-radius: 12px; overflow: hidden;
  background: var(--inset); box-shadow: 0 3px 0 #2d211a;
}
.cell-card img { width: 100%; display: block; aspect-ratio: 3/4; object-fit: cover; }
.cell-foot { display: flex; align-items: center; gap: 6px; padding: 5px 6px; }
.cell-foot select { font-size: 11px; padding: 3px 5px; border-radius: 8px; }
.cell-foot input { width: auto; accent-color: var(--accent); }
