/* Beat Board (prefix bt-) */

.bt-root {
  display: flex;
  flex-direction: column;
  height: 100%;
  min-height: 0;
  min-width: 0;
}
.bt-body {
  flex: 1;
  min-height: 0;
  min-width: 0;
  display: flex;
  flex-direction: column;
}
.bt-view-timeline .bt-body,
.bt-view-list .bt-body { overflow: auto; }

/* ---------------------------------------------------------------- top strips */

.bt-logline {
  display: flex;
  align-items: baseline;
  gap: var(--s-2);
  padding: var(--s-2) var(--s-5);
  border-bottom: 1px solid var(--border);
  color: var(--text-2);
  font-style: italic;
}
.bt-logline-label {
  font-style: normal;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--violet-ink);
  flex: none;
}
.bt-ghostbar {
  display: flex;
  align-items: center;
  gap: var(--s-3);
  padding: var(--s-2) var(--s-5);
  background: var(--c-soft);
  border-bottom: 1px solid var(--border);
  color: var(--text);
}
.bt-ghostbar > .icon { color: var(--c-ink); flex: none; }

.bt-search { width: 220px; max-width: 32vw; }
.bt-tag-filter { min-width: 140px; }
.bt-filter-btn {
  display: inline-flex;
  align-items: center;
  gap: var(--s-2);
  height: var(--control-h-sm);
  padding: 0 var(--s-3);
  border: var(--bw-thin) solid var(--field-line);
  border-radius: var(--r-pill);
  background: var(--field-bg);
  color: var(--text);
  font: inherit;
  font-size: var(--fs-sm);
  font-weight: 600;
  cursor: pointer;
}
.bt-filter-btn:hover { background: var(--hover); }
.bt-filter-btn.is-on { background: var(--violet-soft); border-color: var(--violet-ink); }
.bt-filter-dots { display: inline-flex; }
.bt-filter-dots .dot {
  width: 10px; height: 10px; border-radius: 50%;
  background: var(--c); border: 1.5px solid var(--line);
  margin-left: -3px;
}
.bt-filter-dots .dot:first-child { margin-left: 0; }

/* ---------------------------------------------------------------- empty */

.bt-empty {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: var(--s-6);
  padding: var(--s-8) var(--s-5);
  overflow: auto;
}
.bt-empty-deck { position: relative; width: 220px; height: 110px; }
.bt-empty-card {
  position: absolute;
  top: 10px;
  width: 120px;
  height: 80px;
  border: var(--bw) solid var(--line);
  border-radius: var(--r-sm);
  background: var(--c-soft);
  box-shadow: var(--shadow-sm);
  border-top: 12px solid var(--c);
}
.bt-empty-card:nth-child(1) { left: 0; transform: rotate(-8deg); }
.bt-empty-card:nth-child(2) { left: 50px; top: 0; transform: rotate(2deg); z-index: 1; }
.bt-empty-card:nth-child(3) { left: 100px; transform: rotate(9deg); }

/* ---------------------------------------------------------------- board */

.bt-board {
  flex: 1;
  min-height: 0;
  display: flex;
  align-items: stretch;
  gap: var(--s-4);
  padding: var(--s-4) var(--s-5) var(--s-5);
  overflow-x: auto;
  overflow-y: hidden;
  background-image: radial-gradient(var(--canvas-dot) 1.2px, transparent 1.3px);
  background-size: 18px 18px;
}
.bt-lane {
  flex: 0 0 286px;
  width: 286px;
  display: flex;
  flex-direction: column;
  min-height: 0;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-top: 5px solid var(--c);
  border-radius: var(--r-md);
}
.bt-lane.is-dragging { opacity: 0.45; }
.bt-board.dnd-over > .bt-lane.dnd-before { box-shadow: -6px 0 0 -2px var(--violet); }
.bt-board.dnd-over > .bt-lane.dnd-after { box-shadow: 6px 0 0 -2px var(--violet); }

.bt-lane-head {
  display: flex;
  align-items: center;
  gap: var(--s-1);
  padding: var(--s-2) var(--s-2) var(--s-2) var(--s-1);
  border-bottom: 1px solid var(--border);
  background: var(--c-soft);
  border-radius: var(--r-sm) var(--r-sm) 0 0;
  cursor: grab;
}
.bt-lane-head:active { cursor: grabbing; }
.bt-lane-grip { display: inline-flex; color: var(--text-muted); opacity: 0.7; }
.bt-lane-dot {
  width: 18px; height: 18px; flex: none;
  border-radius: 50%;
  border: var(--bw) solid var(--line);
  background: var(--c);
  box-shadow: 1px 1px 0 0 var(--shadow-color);
  cursor: pointer;
  padding: 0;
}
.bt-lane-dot:hover { transform: scale(1.12); }
.bt-lane-titles { flex: 1; min-width: 0; display: flex; flex-direction: column; padding-left: var(--s-1); }
.bt-lane-name {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: var(--fs-lg);
  line-height: 1.2;
  color: var(--text);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 100%;
}
input.bt-lane-name { font-size: var(--fs-md); height: 28px; }
.bt-lane-meta { display: flex; gap: var(--s-2); color: var(--text-2); font-weight: 600; }
.bt-lane-count {
  display: inline-block;
  min-width: 18px;
  padding: 0 6px;
  border-radius: var(--r-pill);
  background: var(--c);
  color: var(--on-candy);
  text-align: center;
  font-weight: 700;
}
.bt-pop { display: flex; flex-direction: column; gap: var(--s-2); padding: var(--s-2); }

.bt-lane-cards {
  flex: 1;
  min-height: 60px;
  overflow-y: auto;
  padding: var(--s-3) var(--s-3) var(--s-4);
  display: flex;
  flex-direction: column;
  gap: var(--s-3);
}
.bt-lane-cards.dnd-over { background: var(--c-soft); }
.bt-lane-hidden { text-align: center; padding: var(--s-2); }

.bt-add-card {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--s-1);
  min-height: 36px;
  border: var(--bw-thin) dashed var(--border);
  border-radius: var(--r-sm);
  background: transparent;
  color: var(--text-2);
  font: inherit;
  font-weight: 600;
  font-size: var(--fs-sm);
  cursor: pointer;
}
.bt-add-card:hover { border-color: var(--c-ink); color: var(--c-ink); background: var(--surface); }
.bt-add-card.is-alone { min-height: 96px; }

.bt-lane-new { flex: 0 0 180px; display: flex; }
.bt-add-lane {
  width: 100%;
  min-height: 120px;
  max-height: 160px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--s-2);
  border: var(--bw) dashed var(--border);
  border-radius: var(--r-md);
  background: color-mix(in srgb, var(--surface) 60%, transparent);
  color: var(--text-2);
  font: inherit;
  font-weight: 700;
  cursor: pointer;
}
.bt-add-lane:hover { border-color: var(--violet-ink); color: var(--violet-ink); background: var(--violet-soft); }

/* ---------------------------------------------------------------- the card sticker */

.bt-card {
  position: relative;
  flex: none;
  display: flex;
  flex-direction: column;
  gap: var(--s-1);
  padding: var(--s-2) var(--s-3) var(--s-3);
  border: var(--bw) solid var(--line);
  border-top: 9px solid var(--c);
  border-radius: var(--r-sm);
  background: var(--c-soft);
  box-shadow: var(--shadow-sm);
  color: var(--text);
  cursor: grab;
  transition: transform 0.08s ease, box-shadow 0.08s ease;
}
.bt-card:hover { transform: translate(-1px, -1px); box-shadow: 3px 3px 0 0 var(--shadow-color); }
.bt-card:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }
.bt-card.is-dragging { opacity: 0.4; transform: rotate(-2deg); }
.bt-lane-cards.dnd-over > .bt-card.dnd-before::before,
.bt-lane-cards.dnd-over > .bt-card.dnd-after::after {
  content: '';
  position: absolute;
  left: -2px; right: -2px;
  height: 4px;
  border-radius: 2px;
  background: var(--violet-ink);
}
.bt-card.dnd-before::before { top: calc(-1 * var(--s-2) - 9px); }
.bt-card.dnd-after::after { bottom: calc(-1 * var(--s-2) - 2px); }

.bt-card-top { display: flex; align-items: center; gap: var(--s-1); min-height: 24px; }
.bt-card-menu { opacity: 0.55; }
.bt-card:hover .bt-card-menu, .bt-card:focus-within .bt-card-menu { opacity: 1; }
.bt-card-title {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: var(--fs-lg);
  line-height: 1.25;
  overflow-wrap: anywhere;
}
.bt-card-title.is-empty { color: var(--text-muted); font-style: italic; }
.bt-card-text {
  font-size: var(--fs-sm);
  line-height: 1.45;
  color: var(--text-2);
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  display: -webkit-box;
  -webkit-line-clamp: 7;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.bt-card-tags { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 2px; }
.bt-card-tags .chip { font-size: var(--fs-xs); }

.bt-len {
  font-size: var(--fs-xs);
  font-weight: 700;
  color: var(--text-2);
  white-space: nowrap;
}
.bt-len.is-estimate { font-style: italic; font-weight: 600; }

.bt-scene-chip {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  height: 22px;
  padding: 0 7px;
  border: 1.5px solid var(--line);
  border-radius: var(--r-pill);
  background: var(--c-soft);
  color: var(--text);
  font: inherit;
  font-size: var(--fs-xs);
  font-weight: 700;
  cursor: pointer;
  white-space: nowrap;
}
.bt-scene-chip[data-color="white"] { background: var(--surface); }
.bt-scene-chip:hover { background: var(--c); color: var(--on-candy); }
.bt-scene-chip:focus-visible { outline: 3px solid var(--focus); outline-offset: 1px; }
.bt-scene-chip.is-small { height: 20px; }

.bt-guide-tag, .bt-ghost-tag {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  font-size: var(--fs-xs);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-2);
  white-space: nowrap;
}
.bt-ghost-tag { color: var(--violet-ink); }

.bt-card.is-guide {
  border-style: dashed;
  border-top-style: solid;
  box-shadow: none;
  background: var(--surface);
}
.bt-card.is-guide .bt-card-text { color: var(--text-muted); }

.bt-card.is-ghost {
  border: var(--bw) dashed var(--violet-ink);
  border-top: 9px solid var(--violet);
  background: color-mix(in srgb, var(--violet-soft) 70%, transparent);
  box-shadow: none;
  cursor: default;
}
.bt-card.is-ghost:hover { transform: none; }
.bt-ghost-actions { display: flex; gap: var(--s-2); margin-top: var(--s-1); }
.bt-ghost-btn {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  height: 26px;
  padding: 0 10px;
  border: 1.5px solid var(--line);
  border-radius: var(--r-pill);
  background: var(--surface);
  color: var(--text);
  font: inherit;
  font-size: var(--fs-xs);
  font-weight: 700;
  cursor: pointer;
}
.bt-ghost-btn.is-accept { background: var(--violet); color: var(--on-candy); box-shadow: var(--shadow-sm); }
.bt-ghost-btn:hover { transform: translate(-1px, -1px); }

.bt-card.is-editing { cursor: auto; box-shadow: var(--shadow-md); }
.bt-card.is-editing:hover { transform: none; }
.bt-card-title-input, .bt-card-text-input {
  width: 100%;
  border: var(--bw-thin) solid var(--field-line);
  border-radius: var(--r-xs);
  background: var(--field-bg);
  color: var(--text);
  padding: 4px 6px;
}
.bt-card-title-input { font-family: var(--font-display); font-weight: 600; font-size: var(--fs-lg); }
.bt-card-text-input { font: inherit; font-size: var(--fs-sm); line-height: 1.45; resize: none; overflow: hidden; min-height: 52px; }
.bt-card-title-input:focus, .bt-card-text-input:focus { outline: 3px solid var(--focus); outline-offset: 0; }
.bt-card-edit-hint { color: var(--text-muted); }

/* ---------------------------------------------------------------- dialogs */

.bt-editor { border-top: 6px solid var(--c); padding-top: var(--s-3); margin-top: calc(-1 * var(--s-2)); }
.bt-editor-convert {
  align-items: center;
  padding: var(--s-2) var(--s-3);
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  background: var(--violet-soft);
  color: var(--text);
}
.bt-editor-convert > .icon { color: var(--violet-ink); flex: none; }
.bt-tags-edit { display: flex; flex-direction: column; gap: var(--s-2); width: 100%; }
.bt-tags-edit .input { flex: 1; min-width: 0; }

.bt-scene-pick {
  max-height: 52vh;
  display: flex;
  flex-direction: column;
  gap: 4px;
  overflow-y: auto;
}
.bt-scene-row {
  display: flex;
  align-items: center;
  gap: var(--s-2);
  width: 100%;
  padding: 6px var(--s-2);
  border: 1px solid var(--border);
  border-left: 6px solid var(--c);
  border-radius: var(--r-xs);
  background: var(--surface);
  color: var(--text);
  font: inherit;
  font-size: var(--fs-sm);
  text-align: left;
  cursor: pointer;
}
.bt-scene-row[data-color="white"] { border-left-color: var(--border); }
.bt-scene-row:hover { background: var(--hover); }
.bt-scene-row.is-active { background: var(--violet-soft); border-color: var(--violet-ink); }
.bt-scene-num {
  flex: none;
  min-width: 28px;
  padding: 1px 6px;
  border-radius: var(--r-xs);
  background: var(--surface-sunken);
  font-weight: 800;
  font-size: var(--fs-xs);
  text-align: center;
  font-variant-numeric: tabular-nums;
}
.bt-build-preview {
  max-height: 220px;
  overflow-y: auto;
  padding: var(--s-2) var(--s-3);
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  background: var(--surface-2);
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.bt-structures { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--s-3); }
.bt-structure {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: var(--s-3);
  border: var(--bw) solid var(--border);
  border-radius: var(--r-md);
  background: var(--surface);
  color: var(--text);
  font: inherit;
  text-align: left;
  cursor: pointer;
}
.bt-structure:hover { border-color: var(--line); }
.bt-structure.is-active { border-color: var(--line); background: var(--violet-soft); box-shadow: var(--shadow-sm); }
.bt-structure-name { font-family: var(--font-display); font-weight: 600; font-size: var(--fs-lg); }
.bt-structure-bar { display: flex; gap: 3px; height: 10px; }
.bt-structure-bar > span { border-radius: 3px; background: var(--c); border: 1px solid var(--line); }

/* ---------------------------------------------------------------- timeline */

.bt-timeline { display: flex; flex-direction: column; min-height: 0; flex: 1; }
.bt-tl-bar { align-items: center; padding: var(--s-3) var(--s-5); border-bottom: 1px solid var(--border); }
.bt-tl-key {
  display: inline-block; width: 18px; height: 10px; border-radius: 3px; margin-right: 4px; vertical-align: middle;
  border: 1.5px solid var(--line); background: var(--yellow);
}
.bt-tl-key.is-estimate { background: var(--yellow-soft); border-style: dashed; }
.bt-tl-key.is-guide { background: var(--surface); border-style: dashed; border-color: var(--text-muted); }

.bt-tl-scroll { flex: 1; min-height: 0; overflow: auto; padding: 0 0 var(--s-5); }
.bt-tl-grid { display: flex; min-width: 100%; }
.bt-tl-labels {
  flex: 0 0 150px;
  position: sticky;
  left: 0;
  z-index: 3;
  background: var(--canvas);
  border-right: 1px solid var(--border);
}
.bt-tl-corner { height: 66px; display: flex; align-items: flex-end; padding: 0 var(--s-3) 6px; border-bottom: 1px solid var(--border); font-weight: 700; }
.bt-tl-label {
  display: flex;
  align-items: flex-start;
  gap: var(--s-2);
  padding: 14px var(--s-3) 0;
  border-bottom: 1px solid var(--border);
  font-family: var(--font-display);
  font-weight: 600;
  background: linear-gradient(90deg, var(--c-soft), transparent);
}
.bt-tl-label-dot { width: 10px; height: 10px; border-radius: 50%; background: var(--c); border: 1.5px solid var(--line); flex: none; margin-top: 5px; }

.bt-tl-trackwrap { flex: 1; min-width: 0; padding-right: var(--s-5); }
.bt-tl-track { position: relative; min-width: 100%; }
.bt-tl-ruler {
  position: relative;
  height: 66px;
  border-bottom: 2px solid var(--line);
  background: var(--surface-2);
}
.bt-tl-tick {
  position: absolute;
  bottom: 0;
  height: 10px;
  border-left: 1.5px solid var(--text-2);
}
.bt-tl-tick > span {
  position: absolute;
  bottom: 11px;
  left: 0;
  transform: translateX(-50%);
  font-size: var(--fs-xs);
  font-weight: 700;
  color: var(--text-2);
  font-variant-numeric: tabular-nums;
}
.bt-tl-tick.is-first > span { transform: none; left: 3px; }
.bt-tl-tick.is-last > span { transform: translateX(-100%); left: -3px; }
.bt-tl-band {
  position: relative;
  border-bottom: 1px solid var(--border);
  background-image: repeating-linear-gradient(90deg, transparent 0, transparent calc(10% - 1px), var(--border) calc(10% - 1px), var(--border) 10%);
}
.bt-tl-break, .bt-tl-end {
  position: absolute;
  top: 0;
  bottom: 0;
  z-index: 2;
  border-left: 2px dashed var(--c-ink);
  pointer-events: none;
}
.bt-tl-end { border-left-color: var(--text-muted); }
.bt-tl-end > span {
  position: absolute; top: 2px; left: 4px;
  font-size: var(--fs-xs); font-weight: 700; color: var(--text-muted); white-space: nowrap;
}
.bt-tl-break-label {
  position: absolute;
  top: 4px;
  left: 0;
  transform: translateX(-50%);
  padding: 1px 8px;
  border: 1.5px solid var(--line);
  border-radius: var(--r-pill);
  background: var(--c);
  color: var(--on-candy);
  font-size: var(--fs-xs);
  font-weight: 700;
  white-space: nowrap;
  box-shadow: 1px 1px 0 0 var(--shadow-color);
}
.bt-tl-break-label.is-low { top: 23px; }
.bt-tl-card {
  position: absolute;
  height: 38px;
  min-width: 10px;
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 0 6px;
  overflow: hidden;
  border: 1.5px solid var(--line);
  border-radius: var(--r-xs);
  background: var(--c);
  color: var(--on-candy);
  font: inherit;
  font-size: var(--fs-xs);
  font-weight: 700;
  text-align: left;
  cursor: pointer;
  box-shadow: 2px 2px 0 0 var(--shadow-color);
  z-index: 1;
}
.bt-tl-card:hover { z-index: 4; transform: translate(-1px, -1px); }
.bt-tl-card:focus-visible { outline: 3px solid var(--focus); outline-offset: 1px; z-index: 4; }
.bt-tl-card.is-estimate, .bt-tl-card.is-default { background: var(--c-soft); color: var(--text); border-style: dashed; box-shadow: none; }
.bt-tl-card.is-default { opacity: 0.85; }
.bt-tl-card.is-guide { background: var(--surface); color: var(--text-2); border-style: dashed; border-color: var(--text-muted); box-shadow: none; }
.bt-tl-card.is-dim { opacity: 0.25; }
.bt-tl-num {
  flex: none;
  padding: 0 4px;
  border-radius: 4px;
  background: var(--surface);
  color: var(--text);
  font-variant-numeric: tabular-nums;
}
.bt-tl-title { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* ---------------------------------------------------------------- list */

.bt-outline {
  display: flex;
  flex-direction: column;
  gap: var(--s-5);
  padding: var(--s-4) var(--s-5) var(--s-7);
  max-width: 1080px;
  width: 100%;
  margin: 0 auto;
}
.bt-ol-lane { border: 1px solid var(--border); border-radius: var(--r-md); background: var(--surface); overflow: hidden; }
.bt-ol-head {
  display: flex;
  align-items: center;
  gap: var(--s-2);
  padding: var(--s-2) var(--s-3);
  background: var(--c-soft);
  border-bottom: 1px solid var(--border);
}
.bt-ol-dot { width: 14px; height: 14px; border-radius: 50%; background: var(--c); border: var(--bw) solid var(--line); }
.bt-ol-name { margin: 0; font-family: var(--font-display); font-weight: 600; font-size: var(--fs-lg); }
.bt-ol-list { list-style: none; margin: 0; padding: 0; min-height: 36px; }
.bt-ol-list.dnd-over { background: var(--c-soft); }
.bt-ol-row {
  position: relative;
  display: flex;
  align-items: flex-start;
  gap: var(--s-2);
  padding: var(--s-2) var(--s-3);
  border-bottom: 1px solid var(--border);
}
.bt-ol-row:last-child { border-bottom: 0; }
.bt-ol-row:hover { background: var(--surface-2); }
.bt-ol-row.is-dragging { opacity: 0.4; }
.bt-ol-list.dnd-over > .bt-ol-row.dnd-before { box-shadow: inset 0 3px 0 0 var(--violet-ink); }
.bt-ol-list.dnd-over > .bt-ol-row.dnd-after { box-shadow: inset 0 -3px 0 0 var(--violet-ink); }
.bt-ol-grip { color: var(--text-muted); cursor: grab; padding-top: 4px; }
.bt-ol-n { min-width: 22px; padding-top: 3px; text-align: right; font-weight: 800; color: var(--text-2); font-size: var(--fs-sm); }
.bt-ol-swatch { width: 12px; height: 12px; margin-top: 6px; border-radius: 3px; background: var(--c); border: 1.5px solid var(--line); flex: none; }
.bt-ol-row.is-guide .bt-ol-swatch { background: var(--surface); border-style: dashed; }
.bt-ol-main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.bt-ol-title { font-weight: 700; }
.bt-ol-text { font-size: var(--fs-sm); color: var(--text-2); white-space: pre-wrap; }
.bt-ol-text.is-empty { color: var(--text-muted); }
.bt-ol-meta { display: flex; align-items: center; gap: var(--s-1); flex: none; }
.bt-ol-pages { min-width: 44px; text-align: right; font-size: var(--fs-sm); font-weight: 700; }
.bt-ol-pages-input {
  width: 56px;
  height: 26px;
  padding: 0 6px;
  border: 1px solid var(--border);
  border-radius: var(--r-xs);
  background: transparent;
  color: var(--text);
  font: inherit;
  font-size: var(--fs-sm);
  text-align: right;
}
.bt-ol-pages-input:hover { border-color: var(--field-line); background: var(--field-bg); }
.bt-ol-pages-input:focus { outline: 3px solid var(--focus); outline-offset: 0; background: var(--field-bg); }
.bt-ol-empty { padding: var(--s-3); text-align: center; }

@media (max-width: 900px) {
  .bt-lane { flex-basis: 250px; width: 250px; }
  .bt-structures { grid-template-columns: 1fr; }
  .bt-tl-labels { flex-basis: 110px; }
}
