* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; overflow: hidden; }
body {
  font-family: -apple-system, Segoe UI, Roboto, sans-serif;
  background: #1a1a1f;
  color: #e6e6e6;
  display: flex;
  flex-direction: column;
}

.seq-step.hihat-open.active {
    background-color: #38bdf8 !important;
    box-shadow: 0 0 4px rgba(56, 189, 248, 0.5);
}

.seq-step.active.accent {
    background-color: #f59e0b !important;
    box-shadow: 0 0 6px rgba(245, 158, 11, 0.6);
    border: 1px solid #fff;
}

.seq-step.active.accent::after {
    content: '';
    position: absolute;
    top: 2px;
    right: 2px;
    width: 5px;
    height: 5px;
    background-color: #fff;
    border-radius: 50%;
}

main {
  flex: 1;
  display: grid;
  grid-template-columns: 180px 1fr;
  overflow: hidden;
  min-height: 0;
}

/* В режиме нотации скрываем основной таймлайн и палитру */
body.notation-mode main {
  display: none !important;
}

aside {
  background: #20202a;
  border-right: 1px solid #333;
  padding: 14px 10px;
  overflow-y: auto;
}
aside h3 {
  font-size: 10px; text-transform: uppercase; letter-spacing: 1px;
  color: #888; margin-bottom: 8px;
}
.palette-item {
  padding: 8px 10px;
  margin-bottom: 5px;
  border-radius: 5px;
  cursor: grab;
  font-size: 13px;
  font-weight: 500;
  border-left: 4px solid;
  background: #2a2a34;
  user-select: none;
  transition: transform 0.1s;
}
.palette-item:hover { transform: translateX(2px); }
.palette-item:active { cursor: grabbing; }

.workspace {
  padding: 16px;
  overflow: auto;
  background: #1a1a1f;
  min-height: 0;
}
.timeline {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  min-height: 90px;
  padding: 10px;
  background: #22222a;
  border-radius: 8px;
  border: 1px dashed #3a3a45;
  align-items: flex-start;
}
.timeline.drag-over { border-color: #4a7bd1; background: #262630; }
.timeline:empty::before {
  content: "Перетащите сюда секции из панели слева";
  color: #555; font-size: 13px; padding: 30px;
  width: 100%; text-align: center;
}

.block {
  border-radius: 6px;
  padding: 8px 10px;
  position: relative;
  cursor: grab;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  min-height: 70px;
  border: 1px solid rgba(0,0,0,0.3);
  user-select: none;
  transition: box-shadow 0.15s;
}
.block:hover { box-shadow: 0 0 0 2px rgba(255,255,255,0.2); }
.block.dragging { opacity: 0.4; }

.block.collapsed .block-bars, .block.collapsed .block-controls { display: none !important; }
.block.collapsed { 
  min-height: 36px !important; 
  width: 140px !important;
  padding: 8px 10px; 
}
.block.collapsed .block-header::after { content: " (свернуто)"; font-size: 10px; color: #888; font-weight: normal; margin-left: 6px; }

.block-header {
  display: flex;
  align-items: center;
  font-size: 13px;
  font-weight: 600;
  color: rgba(0,0,0,0.85);
  cursor: pointer;
}
.block-controls {
  position: absolute;
  bottom: 8px;
  left: 8px;
  display: flex;
  gap: 2px;
  opacity: 0;
  transition: opacity 0.15s;
  z-index: 2;
}
.block:hover .block-controls { opacity: 1; }
.block-controls button {
  background: rgba(0,0,0,0.25);
  border: none;
  color: rgba(0,0,0,0.85);
  padding: 2px 6px;
  font-size: 12px;
  border-radius: 3px;
  min-width: 22px;
}
.block-controls button:hover { background: rgba(0,0,0,0.4); }

.block-controls button.active-page-break {
  background: #4a7bd1;
  color: #fff;
}

.block-bars {
  display: flex;
  gap: 2px;
  margin-top: 6px;
  margin-bottom: 22px;
  align-items: center;
  flex-wrap: nowrap;
}
.bar {
  width: 32px;
  height: 32px;
  background: rgba(0,0,0,0.25);
  border-radius: 3px;
  cursor: pointer;
  position: relative;
  transition: all 0.1s;
  border: 1px solid transparent;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.bar:hover {
  background: rgba(0,0,0,0.4);
  border-color: rgba(255,255,255,0.3);
}
.bar.selected {
  border-color: #fff;
  box-shadow: 0 0 0 2px rgba(255,255,255,0.5);
}
.bar.filled {
  background: rgba(255,255,255,0.35);
}
.bar-number {
  font-size: 9px;
  color: rgba(0,0,0,0.6);
  pointer-events: none;
}
.bar.filled .bar-number {
  color: rgba(0,0,0,0.85);
  font-weight: 700;
}

.phrase-divider {
  width: 2px;
  height: 32px;
  background: rgba(0,0,0,0.55);
  margin: 0 2px;
  border-radius: 1px;
  flex-shrink: 0;
}

/* ============================================ */
/* СЕТКА (Нижняя панель) */
/* ============================================ */
.bottom-panel {
  flex-shrink: 0;
  background: #20202a;
  border-top: 1px solid #333;
  display: none; /* Скрыта по умолчанию */
  flex-direction: column;
  overflow: hidden;
  height: 320px;
}
.bottom-panel.expanded { 
  display: flex; /* Мгновенное появление */
}

/* В режиме нотации сетка чуть ниже (250px) */
body.notation-mode .bottom-panel.expanded {
  height: 250px;
}

.bottom-header {
  display: flex;
  align-items: center;
  padding: 6px 14px;
  background: #2a2a34;
  border-bottom: 1px solid #333;
  gap: 12px;
  flex-shrink: 0;
  min-height: 32px;
}
.bottom-header .title { font-size: 12px; font-weight: 600; color: #ccc; }
.bottom-header .context { margin-left: auto; font-size: 11px; color: #888; }
.bottom-header .context b { color: #4a7bd1; }
.bottom-header .toggle-btn {
  margin-left: auto;
  background: transparent;
  border: none;
  color: #888;
  font-size: 14px;
  padding: 2px 6px;
  cursor: pointer;
}
.bottom-header .toggle-btn:hover { color: #fff; }

.bottom-content {
  flex: 1;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1px;
  background: #333;
  min-height: 0;
  overflow: hidden;
}
.bottom-section {
  background: #1a1a1f;
  overflow: auto;
  padding: 12px;
}
.bottom-section h4 {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: #888;
  margin-bottom: 8px;
}

.section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 8px;
}
.section-header h4 {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: #888;
  margin: 0;
}
.view-toggle {
  background: transparent;
  border: 1px solid transparent;
  color: #666;
  font-size: 10px;
  padding: 2px 8px;
  border-radius: 3px;
  cursor: pointer;
  transition: all 0.15s;
  letter-spacing: 0.3px;
}
.view-toggle:hover {
  color: #4a7bd1;
  border-color: #4a7bd1;
  background: rgba(74, 123, 209, 0.08);
}

.seq-container { display: flex; flex-direction: column; gap: 3px; }
.seq-row {
  display: grid;
  grid-template-columns: 50px repeat(16, 1fr);
  gap: 2px;
  align-items: center;
}
.seq-label {
  font-size: 11px;
  font-weight: 700;
  text-align: right;
  padding-right: 6px;
  color: #aaa;
}
.seq-step {
  aspect-ratio: 1;
  border-radius: 3px;
  border: 1px solid #333;
  background: #2a2a34;
  cursor: pointer;
  transition: all 0.08s;
  max-height: 22px;
  user-select: none;
}
.seq-step:hover { border-color: #555; }
.seq-step.beat-start { border-left: 2px solid #555; }
.seq-step.hihat.active { background: linear-gradient(180deg, #f6ad55, #dd6b20); border-color: #c05621; }
.seq-step.snare.active { background: linear-gradient(180deg, #63b3ed, #2b6cb0); border-color: #2c5282; }
.seq-step.kick.active { background: linear-gradient(180deg, #fc8181, #c53030); border-color: #9b2c2c; }
.seq-step.pedal-hh.active { background: linear-gradient(180deg, #a78bfa, #7c3aed); border-color: #6d28d9; }
.seq-step.tom1.active { background: linear-gradient(180deg, #a78bfa, #7c3aed); border-color: #6d28d9; }
.seq-step.tom2.active { background: linear-gradient(180deg, #f472b6, #db2777); border-color: #be185d; }
.seq-step.tom3.active { background: linear-gradient(180deg, #34d399, #059669); border-color: #047857; }
.seq-step.crash.active { background: linear-gradient(180deg, #fde047, #ca8a04); border-color: #a16207; }
.seq-step.ride.active { background: linear-gradient(180deg, #93c5fd, #3b82f6); border-color: #2563eb; }

.seq-beat-nums {
  display: grid;
  grid-template-columns: 50px repeat(16, 1fr);
  gap: 2px;
  margin-bottom: 2px;
}
.seq-beat-num { text-align: center; font-size: 9px; color: #666; }
.seq-beat-num.main { color: #4a7bd1; font-weight: 700; }

.seq-actions { 
    display: flex; 
    gap: 6px; 
    margin-top: 10px; 
    padding-top: 10px;
    border-top: 1px solid #2a2a34;
}
.seq-actions button { 
    font-size: 11px; 
    padding: 5px 10px;
    background: #2a2a34;
    color: #ccc;
    border: 1px solid #3a3a45;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.12s ease;
    font-weight: 500;
}
.seq-actions button:hover { 
    background: #3a3a45;
    color: #fff;
    border-color: #4a7bd1;
}
.seq-actions button:active { transform: scale(0.97); }

.seq-actions button[data-seq-act="clear"] { color: #fc8181; border-color: rgba(252, 129, 129, 0.3); }
.seq-actions button[data-seq-act="clear"]:hover { background: rgba(252, 129, 129, 0.12); border-color: #fc8181; }
.seq-actions button[data-seq-act="random"] { color: #93c5fd; border-color: rgba(147, 197, 253, 0.3); }
.seq-actions button[data-seq-act="random"]:hover { background: rgba(147, 197, 253, 0.12); border-color: #93c5fd; }
.seq-actions button[data-seq-act="copy-all"] { color: #4a7bd1; border-color: rgba(74, 123, 209, 0.4); }
.seq-actions button[data-seq-act="copy-all"]:hover { background: rgba(74, 123, 209, 0.15); border-color: #4a7bd1; }
.seq-placeholder { color: #555; font-size: 12px; text-align: center; padding: 40px 20px; }

.notation-box {
  background: #1a1a1f;
  border: 1px solid #333;
  border-radius: 6px;
  padding: 10px;
  min-height: 150px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #ffffff;
}
.notation-box svg { max-width: 100%; height: auto; display: block; color: #ffffff; }
.notation-box .placeholder { color: #888; font-size: 12px; }
.notation-error { color: #fc8181; font-size: 11px; margin-top: 6px; }

/* ============================================ */
/* ПОЛНАЯ НОТАЦИЯ */
/* ============================================ */
.full-notation-panel {
  display: none;
  flex-direction: column;
  flex: 1;
  min-height: 0;
  background: #1a1a1f;
  border-top: 1px solid #333;
  overflow: hidden;
}
.full-notation-panel.expanded { 
  display: flex; 
}

.full-notation-header {
  display: flex;
  align-items: center;
  padding: 6px 14px;
  background: #2a2a34;
  border-bottom: 1px solid #333;
  flex-shrink: 0;
}
.full-notation-header .title { font-size: 12px; font-weight: 600; color: #ccc; }
.full-notation-header .header-actions {
  margin-left: auto;
  display: flex;
  gap: 8px;
}
.full-notation-header .close-btn {
  background: transparent;
  border: none;
  color: #888;
  font-size: 14px;
  cursor: pointer;
}
.full-notation-header .close-btn:hover { color: #fff; }

.full-notation-content {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 20px;
  background: #fafbfc;
  display: flex;
  justify-content: center;
  align-items: flex-start;
}
.full-notation-content svg { max-width: 100%; height: auto; display: block; }
.full-notation-content .placeholder { color: #888; font-size: 13px; margin-top: 40px; }

.full-notation-panel:fullscreen {
  position: fixed !important;
  top: 0 !important;
  left: 0 !important;
  width: 100vw !important;
  height: 100vh !important;
  border: none !important;
  background: #1a1a1f !important;
}
.full-notation-panel:fullscreen .full-notation-content { height: calc(100vh - 40px) !important; }
.full-notation-panel:fullscreen .full-notation-wrapper { max-width: 100% !important; height: 100%; overflow-y: auto; }

/* ============================================ */
/* МИНИ-ТАЙМЛАЙН */
/* ============================================ */
#miniTimeline {
  display: none; /* Скрыт в обычном режиме */
  gap: 4px;
  padding: 6px 8px;
  background: #1a202c;
  border-bottom: 1px solid #4a5568;
  overflow-x: auto;
  overflow-y: hidden;
  min-height: 36px;
  align-items: center;
  scrollbar-width: thin;
  flex-shrink: 0;
}

/* В режиме нотации показываем мини-таймлайн */
body.notation-mode #miniTimeline {
  display: flex !important;
}

#miniTimeline::-webkit-scrollbar { height: 4px; }
#miniTimeline::-webkit-scrollbar-thumb { background: #4a5568; border-radius: 2px; }

.mini-block {
  display: flex;
  gap: 1px;
  padding: 2px 3px;
  border-radius: 4px;
  flex-shrink: 0;
  opacity: 0.85;
}
.mini-block:hover { opacity: 1; }

.mini-bar {
  width: 6px;
  height: 18px;
  background: rgba(255,255,255,0.12);
  border-radius: 1px;
  cursor: pointer;
  transition: all 0.15s;
}
.mini-bar:hover { background: rgba(255,255,255,0.4); transform: scaleY(1.2); }
.mini-bar.filled { background: rgba(255,255,255,0.5); }
.mini-bar.selected {
  background: #fff;
  box-shadow: 0 0 0 2px #4299e1, 0 0 8px rgba(66,153,225,0.6);
  transform: scaleY(1.3);
}
.mini-empty { color: #718096; font-size: 12px; padding: 0 8px; font-style: italic; }

/* ============================================ */
/* ОСТАЛЬНОЕ */
/* ============================================ */
.color-intro { background: #6ba8d8; border-color: #5a97c7; }
.color-verse { background: #7bc47b; border-color: #6ab36a; }
.color-chorus { background: #e8a85c; border-color: #d7974b; }
.color-bridge { background: #c87bc4; border-color: #b76ab3; }
.color-solo { background: #e87b7b; border-color: #d76a6a; }
.color-outro { background: #8a8ad8; border-color: #7979c7; }

.drop-indicator { width: 3px; background: #4a7bd1; align-self: stretch; border-radius: 2px; margin: 0 2px; }

.timeline-break {
  width: 100%; height: 12px; flex-basis: 100%; border-bottom: 1px dashed #3a3a45; margin: 4px 0; position: relative;
}
.timeline-break::before {
  content: "Новая строка"; position: absolute; left: 10px; top: -8px; background: #22222a; padding: 0 6px; font-size: 10px; color: #555;
}

.timeline.compact .bar { width: 16px; height: 16px; }
.timeline.compact .bar-number { display: none; }
.timeline.compact .phrase-divider { width: 1px; }
.timeline.compact .block { min-height: 46px !important; padding: 6px 8px !important; width: fit-content !important; }
.timeline.compact .block.collapsed { width: 140px !important; }
.timeline.compact .block-header { font-size: 11px !important; }
.timeline.compact .block-controls { bottom: 4px; left: 6px; gap: 1px; }
.timeline.compact .block-controls button { font-size: 10px; padding: 1px 4px; min-width: 18px; }

.notation-chunk { margin-bottom: 4px; display: flex; align-items: flex-start; gap: 10px; }
.notation-chunk-content { 
    flex: 1; overflow-x: auto; cursor: pointer; transition: filter 0.15s, background 0.15s; border-radius: 4px; padding: 4px;
}
.notation-chunk-content:hover { filter: brightness(1.04); background: rgba(74, 123, 209, 0.05); }
.notation-chunk-content:active { filter: brightness(0.98); }
.notation-chunk-content svg { max-width: 100%; height: auto; display: block; }
.full-notation-wrapper { max-width: 950px; margin: 0 auto; background: white; padding: 20px; border-radius: 8px; width: 100%; }
.section-divider { border-top: 2px dashed #ccc; margin: 12px 0; position: relative; }
.section-divider-label { position: absolute; top: -10px; left: 20px; background: white; padding: 0 8px; font-size: 11px; font-weight: 600; color: #555; text-transform: uppercase; letter-spacing: 1px; }

.modal-overlay { display: none; position: fixed; inset: 0; background: rgba(0,0,0,0.7); z-index: 100; align-items: center; justify-content: center; backdrop-filter: blur(4px); }
.modal-overlay.active { display: flex; }
.modal { background: #24242c; border: 1px solid #333; border-radius: 10px; width: 90%; max-width: 560px; max-height: 80vh; display: flex; flex-direction: column; box-shadow: 0 20px 60px rgba(0,0,0,0.5); }
.modal-header { padding: 14px 20px; border-bottom: 1px solid #333; display: flex; align-items: center; gap: 12px; }
.modal-header h2 { font-size: 15px; font-weight: 600; flex: 1; }
.modal-close { background: transparent; border: none; color: #888; font-size: 18px; cursor: pointer; padding: 0 6px; }
.modal-close:hover { color: #fff; }
.modal-body { padding: 16px 20px; overflow-y: auto; flex: 1; }
.songs-list { display: flex; flex-direction: column; gap: 6px; }
.song-item { display: flex; align-items: center; gap: 10px; padding: 10px 12px; background: #1a1a1f; border: 1px solid #333; border-radius: 6px; cursor: pointer; transition: all 0.1s; }
.song-item:hover { border-color: #4a7bd1; background: #1f1f28; }
.song-item.active { border-color: #4a7bd1; background: #262630; box-shadow: 0 0 0 1px #4a7bd1 inset; }
.song-item-info { flex: 1; min-width: 0; }
.song-item-name { font-size: 13px; font-weight: 600; color: #e6e6e6; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.song-item-meta { font-size: 11px; color: #888; margin-top: 2px; }
.song-item-actions { display: flex; gap: 4px; opacity: 0; transition: opacity 0.15s; }
.song-item:hover .song-item-actions { opacity: 1; }
.song-item-actions button { padding: 3px 7px; font-size: 11px; }
.modal-footer { padding: 12px 20px; border-top: 1px solid #333; display: flex; gap: 8px; justify-content: space-between; align-items: center; }
.songs-count { font-size: 11px; color: #888; }
.empty-songs { text-align: center; padding: 40px 20px; color: #888; font-size: 13px; }

.nav-buttons { margin-left: 12px; display: inline-flex; gap: 4px; vertical-align: middle; }
.nav-btn { background: #4a5568; border: none; color: #fff; padding: 3px 10px; border-radius: 4px; cursor: pointer; font-size: 11px; transition: background 0.15s; }
.nav-btn:hover { background: #4299e1; }
.nav-btn:disabled { opacity: 0.3; cursor: not-allowed; }

.context-menu { position: fixed; display: none; background: #2a2a34; border: 1px solid #4a4a55; border-radius: 6px; box-shadow: 0 8px 24px rgba(0,0,0,0.5); z-index: 2000; min-width: 180px; overflow: hidden; }
.context-menu-item { padding: 8px 12px; font-size: 12px; color: #e6e6e6; cursor: pointer; transition: background 0.1s; }
.context-menu-item:hover { background: #4a7bd1; }
.context-menu-item.disabled { color: #666; cursor: not-allowed; }
.context-menu-item.disabled:hover { background: transparent; }

.full-notation-wrapper svg { color: #333333 !important; }
.full-notation-wrapper svg * { stroke: #333333 !important; fill: #333333 !important; stroke-width: 0.8 !important; stroke-linecap: round !important; stroke-linejoin: round !important; opacity: 1 !important; }

@media print {
  body > *:not(.full-notation-panel) { display: none !important; }
  header, .site-header, .global-header, nav, aside, .workspace, .bottom-panel, .modal-overlay, .context-menu { display: none !important; }
  html, body { height: auto !important; overflow: visible !important; background: white !important; }
  body { display: block !important; }
  main { display: none !important; }
  .full-notation-panel { height: auto !important; overflow: visible !important; border: none !important; background: white !important; display: block !important; }
  .full-notation-content { overflow: visible !important; background: white !important; padding: 0 !important; display: block !important; }
  .full-notation-wrapper { box-shadow: none !important; padding: 10px !important; max-width: 100% !important; }
  .notation-chunk { page-break-inside: avoid; break-inside: avoid; }
  .section-divider { page-break-before: auto; }
  .page-break-before { page-break-before: always !important; break-before: page !important; }
}

.seq-step.playing { background: #f97316 !important; border-color: #c2410c !important; box-shadow: 0 0 8px rgba(249, 115, 22, 0.6); transform: scale(1.15); transition: transform 0.05s, background 0.05s; }
.seq-step.playing:not(.active) { background: rgba(249, 115, 22, 0.4) !important; border-color: #f97316 !important; }










/* Делаем разделитель похожим на ручку для перетаскивания */
.draggable-divider {
    cursor: ew-resize; /* Курсор изменения размера */
    display: flex;
    align-items: center;
    justify-content: center;
    color: #94a3b8;
    font-size: 10px;
    letter-spacing: -2px;
    transition: all 0.2s;
    user-select: none;
}

.draggable-divider:hover {
    color: #0071e3;
    background: rgba(0, 113, 227, 0.1);
    transform: scaleX(1.5);
}

.draggable-divider:active {
    color: #0056b3;
    transform: scaleX(1.8);
}