:root {
  --bg: #0f1218;
  --panel: #171b24;
  --text: #e8eaef;
  --muted: #8b93a7;
  --accent: #6ea8fe;
  --border: #2a3142;
  --danger: #f87171;
  font-family: system-ui, -apple-system, Segoe UI, Roboto, sans-serif;
}

* {
  box-sizing: border-box;
}

.fc-body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--text);
}

.fc-header {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.75rem 1.25rem;
  border-bottom: 1px solid var(--border);
  background: var(--panel);
}

.fc-brand {
  display: flex;
  align-items: baseline;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.fc-header-project {
  font-size: 0.85rem;
  color: var(--accent);
  font-weight: 600;
  max-width: 280px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.fc-nav {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
}

.fc-nav a {
  color: var(--muted);
  text-decoration: none;
  padding: 0.35rem 0.6rem;
  border-radius: 6px;
  font-size: 0.9rem;
}

.fc-nav a:hover {
  color: var(--text);
  background: rgba(255, 255, 255, 0.06);
}

.fc-nav a.is-active {
  color: var(--accent);
  background: rgba(110, 168, 254, 0.12);
}

.fc-main {
  max-width: 960px;
  margin: 0 auto;
  padding: 1.25rem;
}

.fc-card {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 1.25rem;
}

.fc-card h2 {
  margin-top: 0;
  font-size: 1.25rem;
}

.fc-muted {
  color: var(--muted);
  font-size: 0.92rem;
}

.fc-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  align-items: center;
  margin: 0.75rem 0;
}

.fc-input,
.fc-textarea,
input[type='text'],
input[type='number'],
textarea {
  background: #0c0f14;
  border: 1px solid var(--border);
  color: var(--text);
  border-radius: 6px;
  padding: 0.45rem 0.6rem;
  min-width: 120px;
}

.fc-textarea {
  width: 100%;
  resize: vertical;
}

button {
  background: var(--accent);
  color: #0b1020;
  border: none;
  border-radius: 6px;
  padding: 0.45rem 0.85rem;
  font-weight: 600;
  cursor: pointer;
}

button:hover {
  filter: brightness(1.05);
}

.fc-btn-secondary {
  background: #3b455a;
  color: var(--text);
}

.fc-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
  margin-top: 0.75rem;
}

.fc-table th,
.fc-table td {
  border: 1px solid var(--border);
  padding: 0.4rem 0.5rem;
  text-align: left;
}

.fc-list {
  margin: 0.5rem 0 0;
  padding-left: 1.25rem;
}

.fc-storyboard-hint {
  margin: 0 0 0.75rem;
  max-width: 48rem;
  line-height: 1.45;
  font-size: 0.9rem;
}

.fc-storyboard-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem 0.75rem;
  align-items: center;
  margin-bottom: 0.35rem;
}

.fc-storyboard-scene-list {
  list-style: none;
  padding-left: 0;
}

.fc-storyboard-scene-item {
  margin: 0 0 1rem;
  padding: 0.75rem 1rem;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.02);
}

.fc-storyboard-scene-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  align-items: center;
  margin-bottom: 0.5rem;
}

.fc-storyboard-scene-range {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem 1rem;
  align-items: center;
  margin-bottom: 0.65rem;
  font-size: 0.86rem;
}

.fc-storyboard-range-label {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
}

.fc-storyboard-range-input {
  width: 4.5rem;
}

.fc-storyboard-lyrics-preview {
  margin: 0 0 0.75rem;
  padding: 0.55rem 0.65rem;
  border-radius: 8px;
  background: rgba(12, 16, 24, 0.45);
  border: 1px solid var(--border);
  font-size: 0.82rem;
}

.fc-storyboard-lyrics-head {
  font-weight: 600;
  font-size: 0.76rem;
  color: var(--muted);
  margin-bottom: 0.4rem;
}

.fc-storyboard-lyrics-empty {
  margin: 0;
  font-size: 0.8rem;
}

.fc-storyboard-lyrics-lines {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.fc-storyboard-lyrics-line {
  display: flex;
  gap: 0.5rem;
  align-items: baseline;
  line-height: 1.4;
}

.fc-storyboard-lyrics-idx {
  flex-shrink: 0;
  font-family: ui-monospace, monospace;
  font-size: 0.72rem;
  color: var(--muted);
  min-width: 2.25rem;
}

.fc-storyboard-lyrics-text {
  white-space: pre-wrap;
  word-break: break-word;
}

.fc-storyboard-scene-head {
  font-weight: 600;
  margin-bottom: 0.35rem;
}

.fc-storyboard-scene-prompt {
  margin: 0;
  white-space: pre-wrap;
  font-size: 0.82rem;
  line-height: 1.45;
  max-height: 280px;
  overflow: auto;
  padding: 0.5rem 0.65rem;
  border-radius: 8px;
  background: rgba(12, 16, 24, 0.65);
  border: 1px solid var(--border);
}

.fc-storyboard-scene-empty {
  margin: 0;
  font-size: 0.86rem;
}

.fc-storyboard-add-form {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  margin-bottom: 0.5rem;
  padding: 0.65rem 0.75rem;
  border: 1px dashed var(--border);
  border-radius: 10px;
  max-width: 36rem;
}

.fc-storyboard-add-labels {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.5rem;
  font-size: 0.78rem;
  color: var(--muted);
}

.fc-storyboard-add-nums {
  display: grid;
  grid-template-columns: 5.5rem 5.5rem;
  gap: 0.5rem;
}

.fc-storyboard-line-input {
  width: 100%;
}

.fc-storyboard-dual-col {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
  align-items: start;
}

@media (max-width: 800px) {
  .fc-storyboard-dual-col {
    grid-template-columns: 1fr;
  }
}

.fc-storyboard-prompt-subhead {
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--muted);
  margin-bottom: 0.35rem;
}

.fc-storyboard-comment-label {
  font-size: 0.82rem;
  margin-top: 0.25rem;
}

.fc-msg {
  color: var(--danger);
}

.fc-pre {
  background: #0c0f14;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0.75rem;
  overflow: auto;
  max-height: 420px;
  font-size: 0.78rem;
}

.fc-loading {
  position: fixed;
  inset: 0;
  background: rgba(10, 12, 18, 0.55);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 50;
  font-weight: 600;
}

/* Явно скрываем оверлей: author `display:flex` не должен перебивать атрибут hidden */
.fc-loading[hidden] {
  display: none !important;
  pointer-events: none;
}

/* --- Сетка: страница, панели, сайдбар с таблицей --- */
.fc-beatgrid-page-head h2 {
  margin: 0 0 0.35rem;
}

.fc-beatgrid-page-head .fc-muted {
  margin: 0 0 1rem;
  max-width: 48rem;
  line-height: 1.5;
}

.fc-beatgrid-page-body {
  display: grid;
  gap: 1.25rem;
  grid-template-columns: 1fr;
  align-items: start;
}

@media (min-width: 1024px) {
  .fc-beatgrid-page-body {
    grid-template-columns: minmax(0, 1fr) 17rem;
  }
}

.fc-beatgrid-page-picker {
  min-width: 0;
}

.fc-beatgrid-page-aside {
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 0.85rem 0.9rem;
  background: rgba(255, 255, 255, 0.02);
}

.fc-beatgrid-aside-title {
  margin: 0 0 0.6rem;
  font-size: 0.95rem;
}

.fc-beatgrid-grid-host {
  font-size: 0.82rem;
  max-height: min(60vh, 520px);
  overflow: auto;
}

.fc-beatgrid-grid-host--empty {
  color: var(--muted);
  line-height: 1.45;
}

.fc-beatgrid-lines-table {
  font-size: 0.78rem;
}

.fc-beatgrid-lines-table th,
.fc-beatgrid-lines-table td {
  padding: 0.35rem 0.45rem;
}

.fc-beatgrid-picker-root.fc-waveform {
  gap: 0.75rem;
}

.fc-beatgrid-panel {
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 1rem 1.15rem;
  background: rgba(255, 255, 255, 0.02);
}

.fc-beatgrid-panel .fc-wave-h:first-child,
.fc-beatgrid-panel .fc-beatgrid-audio-h:first-child {
  margin-top: 0;
}

.fc-beatgrid-panel .fc-wave-status {
  margin-top: 0;
}

.fc-beatgrid-panel .fc-muted:last-child {
  margin-bottom: 0;
}

.fc-beatgrid-main-audio {
  display: block;
  width: 100%;
  max-width: 720px;
  margin: 0 0 0.5rem;
  border-radius: 8px;
}

.fc-beatgrid-audio-h {
  margin-top: 0.25rem;
}

.fc-beatgrid-play-row {
  gap: 0.5rem;
  flex-wrap: wrap;
  margin-bottom: 0.15rem;
}

.fc-beatgrid-logic p {
  margin: 0 0 0.75rem;
  line-height: 1.5;
  max-width: 52rem;
}

.fc-beatgrid-seg-row {
  margin-top: 0.25rem;
}

.fc-beatgrid-sec {
  width: 5.5rem;
  max-width: 100%;
}

.fc-beatgrid-seg-hint {
  margin: 0;
  font-size: 0.82rem;
}

.fc-ws-host {
  width: 100%;
  max-width: 100%;
  box-sizing: border-box;
  min-height: 132px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: rgba(12, 16, 24, 0.6);
  overflow: hidden;
}

.fc-beatgrid-step {
  margin-top: 0.35rem;
}

.fc-beatgrid-ws {
  position: relative;
}

.fc-waveform {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.fc-wave-status {
  margin: 0 0 0.25rem;
  line-height: 1.45;
}

.fc-wave-h {
  margin: 0.5rem 0 0.25rem;
}

.fc-wave-tools {
  flex-wrap: wrap;
  align-items: center;
  gap: 0.35rem 0.5rem;
}

.fc-wave-ms,
.fc-wave-win {
  width: 6.5rem;
  max-width: 100%;
}

.fc-btn-small {
  padding: 0.25rem 0.55rem;
  font-size: 0.8rem;
}

.fc-wave-hint {
  margin: 0;
  font-size: 0.88rem;
  line-height: 1.45;
  max-width: 52rem;
}

.fc-wave-readout {
  margin: 0.25rem 0 0;
  font-size: 0.95rem;
  line-height: 1.5;
}

.fc-wave-readout--secondary {
  color: var(--muted);
}

.fc-wave-readout-ms {
  color: var(--accent, #9cc8ff);
  font-weight: 700;
}

.fc-wave-slider {
  width: 100%;
  max-width: 900px;
  height: 1.5rem;
  margin: 0.15rem 0 0.25rem;
  cursor: pointer;
  accent-color: var(--accent, #6b9ef7);
}

.fc-waveform canvas {
  width: 100%;
  max-width: 900px;
  height: auto;
  display: block;
  cursor: crosshair;
  border-radius: 8px;
  border: 1px solid var(--border);
}

.fc-save-status--ok {
  color: var(--accent, #7cb87c);
}

.fc-save-status--err {
  color: #e88;
}

.fc-anchor-stage {
  position: relative;
  display: inline-block;
  max-width: 100%;
}

.fc-anchor-video {
  display: block;
  max-width: 100%;
  background: #000;
}

.fc-anchor-overlay {
  position: absolute;
  inset: 0;
  pointer-events: auto;
  cursor: crosshair;
}

.fc-anchor-box {
  position: absolute;
  border: 2px solid var(--accent);
  box-sizing: border-box;
  pointer-events: auto;
  cursor: move;
  touch-action: none;
}

.fc-anchor-box-handle {
  position: absolute;
  right: -4px;
  bottom: -4px;
  width: 18px;
  height: 18px;
  border-radius: 4px;
  background: var(--accent);
  border: 2px solid rgba(0, 0, 0, 0.45);
  cursor: nwse-resize;
  box-sizing: border-box;
  touch-action: none;
}

.fc-anchor-controls {
  margin-top: 0.65rem;
  max-width: 28rem;
}

.fc-anchor-side-label {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.82rem;
}

.fc-anchor-side-range {
  flex: 1;
  min-width: 8rem;
}

.fc-anchor-side-num {
  width: 5rem;
}

.fc-scene-video-hint {
  max-width: 52rem;
  margin-bottom: 0.75rem;
  line-height: 1.45;
}

.fc-scene-video-controls {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem 1rem;
  align-items: flex-end;
}

.fc-scene-video-field {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  font-size: 0.82rem;
}

.fc-scene-video-field-label {
  color: var(--muted);
  font-size: 0.78rem;
}

.fc-scene-video-trim {
  width: 6rem;
}

.fc-scene-video-field--file input[type='file'] {
  max-width: 16rem;
}

.fc-meta {
  margin-top: 0.5rem;
  font-size: 0.85rem;
  color: var(--muted);
}

.fc-progress {
  margin-bottom: 0.75rem;
  color: var(--muted);
}

.fc-steps {
  margin: 0.5rem 0 1rem;
  padding-left: 1.25rem;
  color: var(--muted);
  font-size: 0.92rem;
  line-height: 1.45;
}

.fc-steps li {
  margin: 0.35rem 0;
}

.fc-row-wrap {
  align-items: center;
}

.fc-file-label {
  cursor: pointer;
}

.fc-btn-file {
  display: inline-block;
  background: #3b455a;
  color: var(--text);
  border-radius: 6px;
  padding: 0.45rem 0.85rem;
  font-weight: 600;
  font-size: 0.9rem;
}

.fc-file-label:hover .fc-btn-file {
  filter: brightness(1.08);
}

.fc-vid-wrap {
  margin: 0.75rem 0 1rem;
  max-width: 100%;
}

.fc-h3 {
  font-size: 1rem;
  margin: 0 0 0.5rem;
  color: var(--muted);
}

button:disabled {
  opacity: 0.45;
  cursor: not-allowed;
  filter: grayscale(0.2);
}

.fc-active-panel {
  margin-bottom: 1rem;
  padding: 1rem;
  background: rgba(110, 168, 254, 0.06);
  border: 1px solid var(--border);
  border-radius: 8px;
}

.fc-active-grid {
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
}

.fc-label {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  font-size: 0.85rem;
  color: var(--muted);
}

.fc-input-block,
.fc-grow {
  width: 100%;
  max-width: 100%;
}

.fc-grow {
  flex: 1;
  min-width: 160px;
}

.fc-col {
  flex-direction: column;
  align-items: stretch;
}

.fc-col .fc-input,
.fc-col .fc-textarea {
  max-width: 100%;
}

.fc-hr {
  border: none;
  border-top: 1px solid var(--border);
  margin: 1.25rem 0;
}

.fc-meta-block {
  font-size: 0.88rem;
  color: var(--muted);
  line-height: 1.5;
}

.fc-meta-block .fc-k {
  display: inline-block;
  min-width: 7rem;
  color: var(--text);
  opacity: 0.75;
}

.fc-code {
  font-size: 0.8rem;
  word-break: break-all;
}

.fc-btn-inline {
  background: transparent;
  color: var(--accent);
  font-weight: 600;
  padding: 0.2rem 0.5rem;
  margin-left: 0.25rem;
}

.fc-btn-inline:hover {
  text-decoration: underline;
}

.fc-no-active {
  margin: 0.5rem 0 0;
}

.fc-lib-wrap {
  margin: 0.25rem 0 0;
}

.fc-start-simple .fc-start-title {
  margin: 0 0 0.65rem;
  font-size: 1.05rem;
}

.fc-start-block {
  margin-bottom: 1.75rem;
  padding: 1rem 1.1rem;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: rgba(0, 0, 0, 0.15);
}

.fc-start-open {
  border-color: rgba(110, 168, 254, 0.35);
}

.fc-lib-list {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.fc-lib-item {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.65rem;
  padding: 0.65rem 0.75rem;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--panel);
}

.fc-lib-item.is-active {
  border-color: var(--accent);
  background: rgba(110, 168, 254, 0.1);
}

.fc-lib-item-main {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 0.5rem 1rem;
  min-width: 0;
  flex: 1;
}

.fc-lib-item-name {
  font-weight: 700;
}

.fc-lib-item-date {
  font-size: 0.82rem;
  color: var(--muted);
}

.fc-lib-item-desc {
  width: 100%;
  font-size: 0.85rem;
  color: var(--muted);
  margin-top: 0.2rem;
}

.fc-lib-item-id {
  width: 100%;
  font-size: 0.7rem;
  color: var(--muted);
  word-break: break-all;
}

.fc-lib-item-btn {
  flex-shrink: 0;
}

.fc-lib-btns {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin-top: 0.65rem;
  width: 100%;
}

.fc-btn-danger {
  background: #b91c1c;
  color: #fff;
}

.fc-btn-danger:hover {
  filter: brightness(1.08);
}

.fc-lib-edit {
  width: 100%;
  padding-top: 0.35rem;
}

.fc-lib-edit-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin-top: 0.5rem;
}

.fc-btn-primary {
  margin-top: 0.35rem;
}

.fc-active-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem 0.75rem;
  padding: 0.65rem 0.85rem;
  margin-bottom: 1.25rem;
  border-radius: 8px;
  background: rgba(110, 168, 254, 0.12);
  border: 1px solid rgba(110, 168, 254, 0.35);
}

.fc-active-bar-label {
  color: var(--muted);
  font-size: 0.9rem;
}

.fc-active-bar-meta {
  font-size: 0.85rem;
  color: var(--muted);
  flex: 1;
  min-width: 120px;
}

.fc-active-bar-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
}

.fc-active-panel-inner {
  margin-top: 0.75rem;
}

.fc-details {
  margin: 1rem 0 0;
  font-size: 0.92rem;
  color: var(--muted);
}

.fc-details summary {
  cursor: pointer;
  color: var(--accent);
  user-select: none;
}

.fc-details[open] summary {
  margin-bottom: 0.5rem;
}

/* --- Паспорт для агента --- */
.fc-passport-head h2 {
  margin: 0 0 0.35rem;
}

.fc-passport-head .fc-muted {
  margin: 0 0 1.25rem;
  max-width: 48rem;
  line-height: 1.5;
}

.fc-passport-block {
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 1rem 1.15rem;
  background: rgba(255, 255, 255, 0.02);
  max-width: 52rem;
}

.fc-passport-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem 0.75rem;
  align-items: center;
  margin-top: 0.75rem;
}

.fc-passport-fields .fc-label {
  display: block;
  margin-bottom: 0.65rem;
}

.fc-passport-push-row {
  margin-top: 1rem;
  padding-top: 1rem;
  border-top: 1px solid var(--border);
}

.fc-passport-push-hint {
  margin: 0.4rem 0 0;
  max-width: 48rem;
  font-size: 0.86rem;
  line-height: 1.45;
}

.fc-passport-push-hint code {
  font-size: 0.82em;
}
