:root {
  --bg-dark: #0C0C0C;
  --bg-darker: #080808;
  --panel: #1C1C1C;
  --panel-elevated: #222222;
  --border: #2E2E2E;
  --border-subtle: #252525;
  --text: #E8E8E8;
  --text-bright: #FFFFFF;
  --text-muted: #8A8A8A;
  --text-dim: #5A5A5A;
  --primary: #4F8BFF;
  --primary-hover: #6B9FFF;
  --primary-active: #3A75E8;
  --success: #4ADE80;
  --danger: #EF4444;
  --warning: #F59E0B;
  --shadow-soft: 0 2px 8px rgba(0, 0, 0, 0.4);
  --shadow-medium: 0 4px 16px rgba(0, 0, 0, 0.5);
  --shadow-strong: 0 8px 32px rgba(0, 0, 0, 0.6);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  color: var(--text);
  background: var(--bg-dark);
  min-height: 100vh;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 40px;
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  background: rgba(12, 12, 12, 0.95);
  backdrop-filter: blur(12px);
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.03);
  z-index: 50;
}

.brand__title { 
  font-weight: 700;
  font-size: 20px;
  letter-spacing: -0.3px;
  color: var(--text-bright);
}

.layout {
  display: flex;
  justify-content: center;
  padding: 48px 32px 80px;
  min-height: calc(100vh - 80px);
}

@media (max-width: 980px) {
  .layout { padding: 32px 20px 80px; }
}

.panel {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 40px;
  box-shadow: var(--shadow-medium);
}

.panel--main {
  width: 100%;
  max-width: 960px;
  border-color: rgba(255, 255, 255, 0.25);
}

.panel__header {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-bottom: 10px;
}

.panel__title {
  font-size: 16px;
  margin: 0;
}

.btn {
  appearance: none;
  border: 1px solid var(--border);
  background: var(--panel-elevated);
  color: var(--text);
  padding: 10px 18px;
  border-radius: 6px;
  cursor: pointer;
  font-size: 14px;
  font-weight: 600;
  transition: all 0.15s ease;
  letter-spacing: 0.01em;
}

.btn:hover {
  background: #2A2A2A;
  border-color: #3A3A3A;
}

.btn:active {
  transform: scale(0.98);
}

.btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.btn--primary {
  background: var(--primary);
  color: var(--text-bright);
  border-color: var(--primary);
  font-weight: 700;
}

.btn--primary:hover {
  background: var(--primary-hover);
  border-color: var(--primary-hover);
  box-shadow: 0 0 0 3px rgba(79, 139, 255, 0.15);
}

.btn--danger {
  background: var(--danger);
  color: var(--text-bright);
  border-color: var(--danger);
  font-weight: 700;
}

.btn--danger:hover {
  background: #DC2626;
  border-color: #DC2626;
  box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.15);
}

.btn--run {
  background: var(--primary);
  color: var(--text-bright);
  border-color: var(--primary);
  padding: 13px 36px;
  font-size: 15px;
  font-weight: 700;
  border-radius: 6px;
  letter-spacing: 0.02em;
}

.btn--run:hover {
  background: var(--primary-hover);
  border-color: var(--primary-hover);
  box-shadow: 0 0 0 4px rgba(79, 139, 255, 0.2), 0 4px 12px rgba(79, 139, 255, 0.3);
}

.pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 12px;
  border-radius: 4px;
  background: var(--panel-elevated);
  border: 1px solid var(--border);
  font-size: 12px;
  color: var(--text);
  font-weight: 600;
}

.scene-manager {
  margin-bottom: 24px;
  padding-bottom: 24px;
  border-bottom: 1px solid var(--border);
}

.scene-manager__title {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin: 0 0 12px 0;
}

.scene-manager__name-row {
  display: flex;
  gap: 8px;
  margin-bottom: 16px;
}

.scene-manager__name-input {
  flex: 1;
}

.scene-manager__list-title {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin: 0 0 8px 0;
}

.scene-manager__toggle {
  display: flex;
  align-items: center;
  gap: 8px;
  background: none;
  border: none;
  padding: 8px 0;
  cursor: pointer;
  width: 100%;
  margin-bottom: 4px;
}

.scene-manager__toggle-icon {
  font-size: 10px;
  color: var(--text-muted);
  transition: transform 0.2s;
}

.scene-manager__toggle-icon.expanded {
  transform: rotate(90deg);
}

.scene-manager__toggle-title {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.scene-manager__toggle:hover .scene-manager__toggle-title {
  color: var(--text);
}

.scene-manager__collapsible {
  margin-bottom: 12px;
}

.scene-manager__list {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin-bottom: 12px;
}

.scene-manager__empty {
  padding: 16px;
  text-align: center;
  color: var(--text-muted);
  font-size: 13px;
  background: var(--panel-elevated);
  border: 1px dashed var(--border);
  border-radius: 6px;
  margin-bottom: 12px;
}

.scene-manager__slot {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  background: var(--panel-elevated);
  border: 1px solid var(--border);
  border-radius: 6px;
  font-size: 13px;
  color: var(--text);
  cursor: pointer;
  transition: background 0.15s;
}

.scene-manager__slot:hover {
  background: rgba(255, 255, 255, 0.06);
}

.scene-manager__slot--active {
  border-color: var(--primary);
  background: rgba(79, 139, 255, 0.08);
}

.scene-manager__slot-name {
  flex: 1;
  font-weight: 500;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.scene-manager__slot-date {
  font-size: 11px;
  color: var(--text-dim);
  white-space: nowrap;
}

.scene-manager__slot-delete {
  background: none;
  border: none;
  color: var(--text-dim);
  cursor: pointer;
  font-size: 14px;
  padding: 2px 4px;
  line-height: 1;
  border-radius: 4px;
  transition: color 0.15s, background 0.15s;
}

.scene-manager__slot-delete:hover {
  color: var(--danger);
  background: rgba(239, 68, 68, 0.1);
}

.scene-manager__actions {
  display: flex;
  gap: 8px;
}

/* White borders on buttons within scene controls for clarity */
.scene-controls__content .btn {
  border-color: rgba(255, 255, 255, 0.25);
}

.builder__top-actions {
  display: flex;
  gap: 10px;
  margin-bottom: 36px;
  padding-bottom: 28px;
  border-bottom: 1px solid var(--border);
}

.builder__add-actions {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
  margin-bottom: 32px;
}

@media (max-width: 768px) {
  .builder__add-actions {
    grid-template-columns: repeat(2, 1fr);
  }
}

.scene-defaults {
  background: var(--panel-elevated);
  border: 1px solid rgba(255, 255, 255, 0.25);
  border-radius: 6px;
  padding: 24px;
  margin-bottom: 32px;
}

.scene-defaults__title {
  font-size: 11px;
  font-weight: 700;
  margin: 0 0 20px 0;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 1.2px;
}

.scene-defaults__row {
  display: flex;
  align-items: center;
  gap: 24px;
  margin-bottom: 18px;
}

.scene-defaults__row:last-child {
  margin-bottom: 0;
}

.scene-defaults__label {
  font-size: 13px;
  font-weight: 600;
  min-width: 150px;
  color: var(--text);
  letter-spacing: 0.01em;
}

.radio-group {
  display: flex;
  gap: 6px;
}

.radio-option {
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  font-size: 13px;
  color: var(--text);
  padding: 8px 14px;
  background: var(--panel);
  border: 1px solid var(--border-subtle);
  border-radius: 6px;
  transition: all 0.15s ease;
  font-weight: 500;
}

.radio-option:hover {
  background: var(--panel-elevated);
  border-color: var(--border);
}

.radio-option input[type="radio"] {
  cursor: pointer;
  width: 16px;
  height: 16px;
  accent-color: var(--primary);
}

.select {
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 8px 12px;
  font-size: 13px;
  font-family: inherit;
  background: var(--panel-elevated);
  color: var(--text);
  cursor: pointer;
  font-weight: 500;
  transition: all 0.15s ease;
}

.select:hover {
  border-color: var(--primary);
  background: var(--panel);
}

.select:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(79, 139, 255, 0.15);
}

.scene {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.line {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 16px;
  margin-bottom: 6px;
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 18px;
  align-items: center;
  transition: all 0.15s ease;
  position: relative;
  margin-left: 60px;
  cursor: move;
}

.line--actor {
  border-color: rgba(59, 130, 246, 0.5);
  box-shadow: 0 0 8px rgba(59, 130, 246, 0.3), inset 0 0 8px rgba(59, 130, 246, 0.1);
}

.line--partner {
  border-color: rgba(239, 68, 68, 0.5);
  box-shadow: 0 0 8px rgba(239, 68, 68, 0.3), inset 0 0 8px rgba(239, 68, 68, 0.1);
  cursor: move;
  user-select: none;
}

.line--partner * {
  cursor: move !important;
  user-select: none;
}

.line--partner .btn,
.line--partner button {
  cursor: pointer !important;
}

.line--sfx {
  border-color: rgba(249, 115, 22, 0.5);
  box-shadow: 0 0 8px rgba(249, 115, 22, 0.3), inset 0 0 8px rgba(249, 115, 22, 0.1);
  cursor: move;
  user-select: none;
}

.line--sfx * {
  cursor: move !important;
  user-select: none;
}

.line--sfx .btn,
.line--sfx button {
  cursor: pointer !important;
}

.line--beat,
.line--pause {
  border-color: rgba(16, 185, 129, 0.5);
  box-shadow: 0 0 8px rgba(16, 185, 129, 0.3), inset 0 0 8px rgba(16, 185, 129, 0.1);
  cursor: move;
  user-select: none;
}

.line--beat *,
.line--pause * {
  cursor: move !important;
  user-select: none;
}

.line--beat .btn,
.line--beat button,
.line--pause .btn,
.line--pause button {
  cursor: pointer !important;
}

.line:hover {
  border-color: #3A3A3A;
  background: #252525;
}

.start-marker {
  position: absolute;
  left: -75px;  /* Adjust this value to move the marker left/right */
  top: 16px;
  width: 50px;
  height: 50px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer !important;
}

.start-marker * {
  cursor: pointer !important;
}

.start-marker__label {
  position: absolute;
  top: 0;
  left: 50%;
  transform: translateX(-50%);
  font-size: 9px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: #10B981;
  white-space: nowrap;
}

.start-marker__triangle {
  width: 24px;
  height: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  border-radius: 4px;
  transition: all 0.2s ease;
  color: var(--border);
  border: 1.5px solid var(--border);
  background: transparent;
  position: absolute;
  top: 18px;
  left: 50%;
  transform: translateX(-50%);
}

.start-marker:hover .start-marker__triangle {
  border-color: #3A3A3A;
  color: #666;
  transform: translateX(-50%) scale(1.1);
}

.start-marker--active .start-marker__triangle {
  background: rgba(16, 185, 129, 0.2);
  border-color: #10B981;
  color: #10B981;
}

.start-marker--active:hover .start-marker__triangle {
  background: rgba(16, 185, 129, 0.3);
  border-color: #059669;
  color: #059669;
}

.badge {
  font-size: 10px;
  font-weight: 700;
  padding: 5px 10px;
  border-radius: 4px;
  text-transform: uppercase;
  letter-spacing: 0.8px;
}

.badge--actor { 
  background: rgba(59, 130, 246, 0.2);
  color: #EAF2FF;
  border: 1px solid rgba(59, 130, 246, 0.4);
}
.badge--partner { 
  background: rgba(239, 68, 68, 0.2);
  color: #FFECEC;
  border: 1px solid rgba(239, 68, 68, 0.4);
}
.badge--sfx { 
  background: rgba(249, 115, 22, 0.2);
  color: #FFF1E8;
  border: 1px solid rgba(249, 115, 22, 0.4);
}
.badge--beat { 
  background: rgba(16, 185, 129, 0.2);
  color: #E7FFF4;
  border: 1px solid rgba(16, 185, 129, 0.4);
}

.line__text {
  white-space: pre-wrap;
  line-height: 1.65;
  font-size: 15px;
  color: var(--text-bright);
  font-weight: 400;
}

.actor-line-text {
  line-height: 1.8;
  user-select: none;
  cursor: pointer;
}

.actor-word {
  display: inline;
  transition: all 0.15s ease;
  cursor: pointer;
}

.actor-word:hover {
  background: rgba(79, 139, 255, 0.08);
  border-radius: 3px;
  padding: 1px 2px;
  margin: -1px -2px;
}

.actor-word--cue {
  background: rgba(79, 139, 255, 0.15);
  border: 1.5px solid var(--primary);
  border-radius: 4px;
  padding: 2px 4px;
  margin: -2px -4px;
  font-weight: 500;
}

.actor-word--selecting {
  background: rgba(79, 139, 255, 0.25);
  border: 1.5px solid var(--primary-hover);
  border-radius: 4px;
  padding: 2px 4px;
  margin: -2px -4px;
}

.line__meta {
  font-size: 12px;
  color: var(--text-dim);
  margin-top: 8px;
  letter-spacing: 0.01em;
}

.line__actions {
  display: flex;
  gap: 8px;
  align-self: center;
}

.scene-controls {
  margin-bottom: 24px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--panel);
  overflow: hidden;
}

.scene-controls__toggle {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  background: transparent;
  border: none;
  color: var(--text);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.2s;
  text-align: left;
}

.scene-controls__toggle:hover {
  background: rgba(255, 255, 255, 0.03);
}

.scene-controls__title {
  text-transform: uppercase;
  letter-spacing: 0.5px;
  font-size: 13px;
  color: white;
}

.scene-controls__icon {
  font-size: 12px;
  color: var(--text-muted);
  transition: transform 0.2s;
}

.scene-controls__toggle.collapsed .scene-controls__icon {
  transform: rotate(-90deg);
}

.scene-controls__content {
  padding: 16px 20px 20px 20px;
  display: block;
}

.scene-controls__content.hidden {
  display: none;
}

/* Landing screen */
.landing {
  margin-bottom: 24px;
}

.landing__cards {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

.landing__card {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  text-align: left;
  padding: 24px;
  background: var(--panel-elevated);
  border: 1px solid var(--border);
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.15s ease;
  font-family: inherit;
  color: var(--text);
}

.landing__card:hover {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(79, 139, 255, 0.15);
}

.landing__card:first-child {
  border-color: rgba(239, 68, 68, 0.5);
  box-shadow: 0 0 12px rgba(239, 68, 68, 0.3);
}

.landing__card:first-child:hover {
  border-color: rgba(239, 68, 68, 0.8);
  box-shadow: 0 0 16px rgba(239, 68, 68, 0.4);
}

.landing__card:last-child {
  border-color: rgba(59, 130, 246, 0.5);
  box-shadow: 0 0 12px rgba(59, 130, 246, 0.3);
}

.landing__card:last-child:hover {
  border-color: rgba(59, 130, 246, 0.8);
  box-shadow: 0 0 16px rgba(59, 130, 246, 0.4);
}

.landing__card-title {
  font-size: 16px;
  font-weight: 700;
  color: var(--text-bright);
  margin-bottom: 6px;
}

.landing__card-sub {
  font-size: 13px;
  color: var(--text-muted);
  line-height: 1.4;
}

.landing__back {
  margin-top: 16px;
}

/* Browse screen */
.browse {
  margin-bottom: 24px;
}

.browse__back {
  margin-top: 16px;
  padding: 8px 16px;
  font-size: 14px;
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text);
  cursor: pointer;
  border-radius: 6px;
  transition: all 0.15s;
}

.browse__back:hover {
  background: var(--panel-elevated);
  border-color: var(--primary);
}

.browse__title {
  font-size: 16px;
  font-weight: 600;
  color: var(--text-bright);
  margin: 0 0 16px 0;
}

.browse__list {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin-bottom: 16px;
}

.browse__list:empty {
  display: none;
}

.browse__empty {
  padding: 24px;
  text-align: center;
  color: var(--text-muted);
  font-size: 14px;
  background: var(--panel-elevated);
  border: 1px dashed var(--border);
  border-radius: 8px;
  margin-bottom: 16px;
}

.browse__actions {
  display: flex;
  gap: 8px;
}

.builder__add-actions {
  display: flex;
  gap: 12px;
  margin-bottom: 24px;
}

/* Hide individual Add buttons but keep Record Scene and Record Lines */
#btnAddActor,
#btnAddPartner,
#btnAddSfx,
#btnAddBeat {
  display: none;
}

/* Record actions — sits outside scene controls, above the scene */
.scene-controls__record-actions {
  display: flex;
  gap: 12px;
  margin-top: 12px;
  margin-bottom: 16px;
}

/* Record buttons styling - red for Record Fresh Lines, blue for Record Over Lines */
#btnRecordScene {
  border-color: rgba(239, 68, 68, 0.5);
  box-shadow: 0 0 8px rgba(239, 68, 68, 0.3);
}

#btnRecordScene:hover {
  border-color: rgba(239, 68, 68, 0.8);
  box-shadow: 0 0 12px rgba(239, 68, 68, 0.4);
}

#btnRecordLines {
  border-color: rgba(59, 130, 246, 0.5);
  box-shadow: 0 0 8px rgba(59, 130, 246, 0.3);
}

#btnRecordLines:hover {
  border-color: rgba(59, 130, 246, 0.8);
  box-shadow: 0 0 12px rgba(59, 130, 246, 0.4);
}

.log-container {
  position: fixed;
  bottom: 20px;
  right: 20px;
  z-index: 100;
}

.log-toggle {
  position: relative;
  bottom: auto;
  left: auto;
  transform: none;
  background: var(--panel-elevated);
  color: var(--text-muted);
  border: 1px solid var(--border);
  border-bottom: none;
  border-radius: 6px 6px 0 0;
  padding: 8px 20px;
  font-size: 10px;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.15s ease;
  letter-spacing: 1px;
  text-transform: uppercase;
}

.log-toggle:hover {
  background: var(--panel);
  color: var(--text);
  padding-top: 10px;
}

.log-panel {
  background: var(--bg-darker);
  border: 1px solid var(--border);
  border-radius: 6px;
  box-shadow: var(--shadow-medium);
  max-height: 400px;
  max-width: 600px;
  margin-top: 8px;
  display: flex;
  flex-direction: column;
}

.log-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
  background: var(--panel-elevated);
}

.log-title {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--text-muted);
}

.log-close {
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-size: 24px;
  line-height: 1;
  cursor: pointer;
  padding: 0;
  width: 24px;
  height: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 4px;
  transition: all 0.15s ease;
}

.log-close:hover {
  background: rgba(255, 255, 255, 0.1);
  color: var(--text);
}

.log {
  background: var(--bg-darker);
  color: var(--text-muted);
  font-family: 'SF Mono', Monaco, 'Cascadia Code', 'Roboto Mono', Consolas, monospace;
  font-size: 11px;
  white-space: pre-wrap;
  line-height: 1.6;
  padding: 20px;
  margin: 0;
  overflow: auto;
  flex: 1;
}

.now {
  background: white;
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 16px;
}

.now__text {
  font-size: 22px;
  line-height: 1.2;
  margin-top: 10px;
}

.now__sub {
  margin-top: 10px;
  color: var(--text-muted);
  font-size: 13px;
}

.dlg::backdrop {
  background: rgba(0, 0, 0, 0.75);
  backdrop-filter: blur(2px);
}

.dlg {
  border: none;
  padding: 0;
  background: transparent;
}

.dlg__card {
  width: min(600px, calc(100vw - 28px));
  border: 2px solid white;
  border-radius: 8px;
  padding: 32px;
  background: var(--panel);
  box-shadow: var(--shadow-strong);
}

.dlg__title {
  font-weight: 700;
  font-size: 18px;
  margin-bottom: 24px;
  color: var(--text-bright);
  letter-spacing: -0.01em;
}

.field { display: block; }
.field__label { 
  font-size: 12px;
  color: var(--text-muted);
  margin-bottom: 8px;
  font-weight: 600;
  letter-spacing: 0.01em;
}

.actor-token-display {
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--bg);
  min-height: 60px;
  line-height: 1.6;
  font-size: 15px;
  margin-bottom: 8px;
  color: var(--text-bright);
}
.field__input {
  width: 100%;
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 10px 12px;
  font-size: 14px;
  font-family: inherit;
  background: var(--panel-elevated);
  color: var(--text);
  transition: all 0.15s ease;
}

.field__input:focus {
  outline: none;
  border-color: var(--primary);
  background: var(--panel);
  box-shadow: 0 0 0 3px rgba(79, 139, 255, 0.15);
}

.dlg__actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 12px;
}

/* ── Import Script dialog ─────────────────────────────────────────────────── */

.import-intro {
  font-size: 14px;
  color: #fff;
  margin: 0 0 16px;
  padding: 10px 14px;
  border: 1px solid rgba(255, 255, 255, 0.4);
  border-radius: 6px;
  line-height: 1.4;
}

.import-row {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 12px;
  flex-wrap: wrap;
}

.import-details {
  margin-bottom: 12px;
}

.import-details > summary {
  cursor: pointer;
  list-style: none;
}

.import-details > summary::-webkit-details-marker {
  display: none;
}

.import-details > summary .import-row__hint {
  appearance: none;
  border: 1px solid var(--border);
  background: var(--panel-elevated);
  color: var(--text);
  padding: 10px 18px;
  border-radius: 6px;
  font-size: 14px;
  font-weight: 600;
  transition: all 0.15s ease;
}

.import-details > summary:hover .import-row__hint {
  background: #2A2A2A;
  border-color: #3A3A3A;
}

.import-details__body {
  padding: 10px 0 0 32px;
}

.import-row__number {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: var(--accent);
  color: #fff;
  font-size: 12px;
  font-weight: 700;
  flex-shrink: 0;
}

.import-row__hint {
  font-size: 13px;
  color: var(--text-muted);
  line-height: 1.3;
}

.import-row__hint--bold {
  font-weight: 600;
  color: #fff;
  font-size: 14px;
}

.import-row__note {
  font-size: 12px;
  color: var(--text-muted);
  margin: 0 0 8px;
  line-height: 1.3;
}

.btn--outline-red {
  border-color: rgba(239, 68, 68, 0.5);
  box-shadow: 0 0 8px rgba(239, 68, 68, 0.3);
}

.btn--outline-red:hover {
  border-color: rgba(239, 68, 68, 0.8);
  box-shadow: 0 0 12px rgba(239, 68, 68, 0.4);
}

.btn--outline-blue {
  border-color: rgba(59, 130, 246, 0.5);
  box-shadow: 0 0 8px rgba(59, 130, 246, 0.3);
}

.btn--outline-blue:hover {
  border-color: rgba(59, 130, 246, 0.8);
  box-shadow: 0 0 12px rgba(59, 130, 246, 0.4);
}

.btn--outline-green {
  border-color: rgba(16, 185, 129, 0.5);
  box-shadow: 0 0 8px rgba(16, 185, 129, 0.3);
}

.btn--outline-green:hover {
  border-color: rgba(16, 185, 129, 0.8);
  box-shadow: 0 0 12px rgba(16, 185, 129, 0.4);
}

.btn--outline-orange {
  border-color: rgba(249, 115, 22, 0.5);
  box-shadow: 0 0 8px rgba(249, 115, 22, 0.3);
}

.btn--outline-orange:hover {
  border-color: rgba(249, 115, 22, 0.8);
  box-shadow: 0 0 12px rgba(249, 115, 22, 0.4);
}

.import-fallback {
  font-size: 12px;
  color: var(--text-muted);
  margin: 4px 0 12px;
  line-height: 1.4;
  text-align: center;
}

.import-status {
  margin: 8px 0;
  padding: 8px 10px;
  background: var(--panel-elevated);
  border: 1px solid var(--border);
  border-radius: 6px;
  font-size: 13px;
  color: var(--text);
}

#characterSelection .field__label,
#characterSelection {
  color: var(--text);
}

.advanced-section {
  margin-top: 16px;
  margin-bottom: 16px;
}

.advanced-section__toggle {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 12px;
  background: var(--panel-elevated);
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--text);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.15s ease;
  font-family: inherit;
}

.advanced-section__toggle:hover {
  background: var(--panel);
  border-color: var(--primary);
}

.advanced-section__icon {
  font-size: 10px;
  transition: transform 0.2s ease;
  color: var(--text-muted);
}

.advanced-section__icon.expanded {
  transform: rotate(90deg);
}

.advanced-section__title {
  flex: 1;
  text-align: left;
}

.advanced-section__badge {
  font-size: 11px;
  color: var(--text-muted);
  padding: 2px 8px;
  background: var(--bg);
  border-radius: 4px;
}

.advanced-section__content {
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid var(--border);
}

.toggle-switch {
  position: relative;
  display: inline-block;
  width: 51px;
  height: 31px;
}

.toggle-switch input {
  opacity: 0;
  width: 0;
  height: 0;
}

.toggle-switch__slider {
  position: absolute;
  cursor: pointer;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: #ccc;
  transition: 0.3s;
  border-radius: 31px;
}

.toggle-switch__slider:before {
  position: absolute;
  content: "";
  height: 23px;
  width: 23px;
  left: 4px;
  bottom: 4px;
  background-color: white;
  transition: 0.3s;
  border-radius: 50%;
}

.toggle-switch input:checked + .toggle-switch__slider {
  background-color: #34C759;
}

.toggle-switch input:checked + .toggle-switch__slider:before {
  transform: translateX(20px);
}

.toggle-switch__slider:hover {
  opacity: 0.9;
}

.recorder__row {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 10px;
}

.recorder__audio {
  width: 100%;
}

.sfx-instruction {
  font-size: 13px;
  color: var(--text-muted);
  padding: 12px 16px;
  background: var(--panel);
  border-radius: 6px;
  margin-bottom: 12px;
  border: 1px solid var(--border-subtle);
}

.sfx-countdown-indicator {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 16px;
  background: var(--panel);
  border-radius: 6px;
  margin-bottom: 12px;
  border: 1px solid var(--border-subtle);
}

.sfx-countdown-icon {
  font-size: 18px;
  line-height: 1;
}

.sfx-countdown-text {
  font-size: 14px;
  color: var(--text);
  font-weight: 500;
}

/* Insert zones and drag-and-drop */
.insert-zone {
  position: relative;
  height: 16px;
  margin: 0;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}

.insert-zone__line {
  position: absolute;
  width: 100%;
  height: 2px;
  background: transparent;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
  opacity: 0;
}

.insert-zone:hover .insert-zone__line {
  background: rgba(255, 255, 255, 0.8);
  box-shadow: 0 0 8px rgba(255, 255, 255, 0.4), 0 0 16px rgba(255, 255, 255, 0.2);
  opacity: 1;
}

.insert-zone__plus {
  background: rgba(255, 255, 255, 0.95);
  width: 28px;
  height: 28px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 0 12px rgba(255, 255, 255, 0.6), 0 2px 8px rgba(0, 0, 0, 0.3);
  transition: all 0.2s ease;
  transform: scale(0.8);
  opacity: 0;
  position: relative;
}

.insert-zone__plus::before {
  content: '';
  position: absolute;
  width: 20px;
  height: 20px;
  background: #1A1A1A;
  border-radius: 50%;
  z-index: 1;
}

.insert-zone__plus::after {
  content: '+';
  color: white;
  font-size: 20px;
  font-weight: 400;
  line-height: 0;
  z-index: 2;
  position: absolute;
  top: 43%;  /* ADJUST THIS: Lower % = move up, Higher % = move down */
  left: 49%;  /* ADJUST THIS: Lower % = move left, Higher % = move right */
  transform: translate(-50%, -50%);
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}

.insert-zone:hover .insert-zone__plus {
  transform: scale(1);
  opacity: 1;
}

/* Blue line only shows on targeted insert zone via .drag-over class */

.insert-zone.drag-over {
  background: rgba(79, 139, 255, 0.1);
  border-radius: 4px;
}

.insert-zone.drag-over .insert-zone__line {
  background: rgba(79, 139, 255, 0.8);
  box-shadow: 0 0 12px rgba(79, 139, 255, 0.6);
  opacity: 1;
  height: 3px;
}

.insert-zone.drag-over .insert-zone__plus {
  background: rgba(79, 139, 255, 0.95);
  color: white;
  transform: scale(1.1);
  opacity: 1;
}

.line.dragging {
  opacity: 0.5;
  transform: scale(0.98);
}

.line__text {
  cursor: text;
}

.line--beat .line__text,
.line--pause .line__text {
  cursor: move !important;
}

/* Autocue Overlay */
.autocue-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.85);
  backdrop-filter: blur(4px);
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
}

.autocue-window {
  background: var(--panel);
  border-radius: 8px;
  box-shadow: var(--shadow-strong);
  width: 100%;
  height: 80vh;
  max-width: var(--half-screen, 50vw);
  min-width: 320px;
  min-height: 250px;
  max-height: 95vh;
  display: flex;
  flex-direction: column;
  cursor: move;
  border: 1px solid var(--border);
  position: relative;
}

.autocue-resize-handle {
  position: absolute;
  bottom: 0;
  right: 0;
  width: 20px;
  height: 20px;
  cursor: nwse-resize;
  z-index: 10;
  border-radius: 0 0 8px 0;
}

.autocue-resize-handle::before,
.autocue-resize-handle::after {
  content: '';
  position: absolute;
  background: var(--text-dim);
  border-radius: 1px;
}

.autocue-resize-handle::before {
  width: 10px;
  height: 2px;
  bottom: 6px;
  right: 4px;
  transform: rotate(-45deg);
}

.autocue-resize-handle::after {
  width: 6px;
  height: 2px;
  bottom: 4px;
  right: 2px;
  transform: rotate(-45deg);
}

.autocue-resize-handle:hover::before,
.autocue-resize-handle:hover::after {
  background: var(--primary);
}

.still-there-overlay {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.85);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
  border-radius: 8px;
}

.still-there-box {
  text-align: center;
  padding: 32px 40px;
}

.still-there-title {
  font-size: 28px;
  font-weight: 700;
  color: var(--text-bright);
  margin: 0 0 8px 0;
}

.still-there-subtitle {
  font-size: 15px;
  color: var(--text-dim);
  margin: 0 0 24px 0;
}

.still-there-actions {
  display: flex;
  gap: 12px;
  justify-content: center;
}

.autocue-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 24px;
  border-bottom: 1px solid var(--border);
  background: var(--panel-elevated);
  border-radius: 7px 7px 0 0;
}

.autocue-title {
  font-weight: 700;
  font-size: 16px;
  color: var(--text-bright);
  letter-spacing: -0.01em;
}

.autocue-close {
  background: transparent;
  border: 1px solid var(--border);
  font-size: 20px;
  line-height: 1;
  color: var(--text-muted);
  cursor: pointer;
  padding: 0;
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 4px;
  transition: all 0.15s ease;
}

.autocue-close:hover {
  background: var(--danger);
  border-color: var(--danger);
  color: var(--text-bright);
}

.autocue-content {
  padding: 0 48px;
  flex: 1;
  overflow: hidden;
  position: relative;
  display: flex;
  flex-direction: column;
}

.autocue-placeholder {
  text-align: center;
  color: var(--text-muted);
  font-size: 15px;
  line-height: 1.6;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  flex: 1;
  padding: 32px;
}

/* Autocue anchor layout: actor line fixed at 40% from top */
.autocue-anchor-layout {
  position: relative;
  width: 100%;
  flex: 1;
  min-height: 0;
}

.autocue-context-zone {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 60%;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  padding: 0 0 12px 0;
}

.autocue-context-zone .autocue-line-text {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  direction: rtl;
  text-align: left;
}

.autocue-actor-zone {
  position: absolute;
  top: 28%;
  left: 0;
  right: 0;
  bottom: 0;
  overflow: hidden;
  padding-bottom: 24px;
}

.autocue-actor-zone__scroll {
  width: 100%;
  height: 100%;
  overflow: visible;
  position: relative;
  /* Push content start down so the eye-line is still at ~40% of the full layout */
  padding-top: 16.7%;
}

.autocue-actor-zone__track {
  position: absolute;
  left: 0;
  right: 0;
  will-change: transform;
}

/* Crossfade transition wrapper */
.autocue-fade {
  animation: autocueFadeIn 0.35s ease-out;
}

@keyframes autocueFadeIn {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: translateY(0); }
}


/* Sticky header: label + timer row inside the actor line. During scrolling,
   a counter-transform keeps it pinned while text flows behind it. Needs
   position:relative + z-index + background to sit above the scrolling text. */
.autocue-line-header {
  position: relative;
  z-index: 2;
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--panel-elevated);
  margin: -20px -24px 8px;
  padding: 14px 24px 8px;
  border-radius: 4px 4px 0 0;
  will-change: transform;
}

.autocue-line-header .autocue-line-label {
  margin-bottom: 0;
}

.autocue-line {
  padding: 20px 24px;
  border-radius: 6px;
}

.autocue-line--context {
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--border-subtle);
  opacity: 0.85;
}

.autocue-line--current {
  background: var(--panel-elevated);
  border: 2px solid var(--primary);
  box-shadow: 0 0 0 4px rgba(79, 139, 255, 0.1);
}

.autocue-line--actor { border-color: rgba(59, 130, 246, 0.5); }
.autocue-line--actor.autocue-line--current { box-shadow: 0 0 8px rgba(59, 130, 246, 0.2); }

.autocue-line--partner { border-color: rgba(239, 68, 68, 0.5); }
.autocue-line--partner.autocue-line--current { box-shadow: 0 0 8px rgba(239, 68, 68, 0.2); }

.autocue-line--sfx { border-color: rgba(249, 115, 22, 0.5); }
.autocue-line--sfx.autocue-line--current { box-shadow: 0 0 8px rgba(249, 115, 22, 0.2); }

.autocue-line--pause { border-color: rgba(16, 185, 129, 0.5); }
.autocue-line--pause.autocue-line--current { box-shadow: 0 0 8px rgba(16, 185, 129, 0.2); }

.autocue-line-label {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--primary);
  margin-bottom: 8px;
}

.autocue-line--current .autocue-line-label {
  color: var(--primary);
}

.autocue-line--context .autocue-line-label {
  color: var(--text-muted);
}

.autocue-line--actor .autocue-line-label { color: rgba(59, 130, 246, 0.9); }
.autocue-line--partner .autocue-line-label { color: rgba(239, 68, 68, 0.9); }
.autocue-line--sfx .autocue-line-label { color: rgba(249, 115, 22, 0.9); }
.autocue-line--pause .autocue-line-label { color: rgba(16, 185, 129, 0.9); }

.autocue-line-text {
  line-height: 1.6;
  color: var(--text);
}

.autocue-line--current .autocue-line-text {
  line-height: 1.7;
  color: var(--text-bright);
  font-weight: 500;
}

.autocue-line-text--partner {
  font-style: italic;
  color: var(--text-muted);
}

.autocue-line--current .autocue-line-text--partner {
  color: var(--text);
}

.autocue-line-text--sfx,
.autocue-line-text--pause {
  font-style: italic;
  color: var(--text-dim);
}

.autocue-line--current .autocue-line-text--sfx,
.autocue-line--current .autocue-line-text--pause {
  color: var(--text-muted);
  font-weight: 500;
}

/* Cue word underline */
.autocue-cue-word {
  text-decoration: underline;
  text-decoration-color: var(--primary);
  text-underline-offset: 4px;
  text-decoration-thickness: 2px;
}

/* Failsafe timer display */
.autocue-timer {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-muted);
  letter-spacing: 0.03em;
  margin-top: 0;
  font-variant-numeric: tabular-nums;
}

/* Settings panel */
.autocue-settings {
  padding: 20px 24px;
  border-top: 1px solid var(--border);
  background: var(--panel-elevated);
  border-radius: 0 0 7px 7px;
}

.autocue-settings__row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 0;
}

.autocue-settings__row + .autocue-settings__row {
  border-top: 1px solid var(--border-subtle);
}

.autocue-settings__label {
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
  min-width: 140px;
}

.autocue-settings__control {
  display: flex;
  align-items: center;
  gap: 10px;
  flex: 1;
  justify-content: flex-end;
}

.autocue-settings__slider {
  width: 140px;
  accent-color: var(--primary);
  cursor: pointer;
}

.autocue-settings__value {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-muted);
  min-width: 55px;
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.autocue-settings__control input[type="checkbox"] {
  width: 18px;
  height: 18px;
  accent-color: var(--primary);
  cursor: pointer;
}

.autocue-settings__control .select {
  min-width: 180px;
}

/* Record Scene dialog */
.rs-header {
  margin-bottom: 20px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--border);
}

.rs-header__top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
}

.rs-step-count {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-muted);
  padding: 4px 10px;
  background: var(--panel-elevated);
  border: 1px solid var(--border);
  border-radius: 4px;
  font-variant-numeric: tabular-nums;
}

.rs-header__options {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-bottom: 12px;
  flex-wrap: wrap;
}

.rs-header__spacer {
  flex: 1;
}

.rs-checkbox {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  color: var(--text);
  cursor: pointer;
  font-weight: 500;
}

.rs-checkbox input[type="checkbox"] {
  width: 16px;
  height: 16px;
  accent-color: var(--primary);
  cursor: pointer;
}

.rs-btn-small {
  padding: 5px 10px;
  font-size: 12px;
  font-weight: 600;
}

.rs-type-selector {
  display: flex;
  gap: 8px;
}

.rs-type-btn {
  flex: 1;
  text-align: center;
  padding: 8px 16px;
  font-size: 13px;
  font-weight: 600;
  transition: all 0.15s ease;
}

.rs-type-btn--active {
  background: var(--primary);
  color: var(--text-bright);
  border-color: var(--primary);
}

.rs-type-btn--active:hover {
  background: var(--primary-hover);
  border-color: var(--primary-hover);
}

.rs-view {
  min-height: 0;
}

/* Keep-original bar shown after transcription overwrites existing text */
.rs-original {
  margin-top: 6px;
  margin-bottom: 8px;
  padding: 8px 12px;
  background: var(--panel-elevated);
  border: 1px solid var(--border);
  border-radius: 6px;
  min-height: 72px; /* Reserve space for text + button with border to prevent button jumps */
}

.rs-original__text {
  font-size: 13px;
  color: var(--text-muted);
  line-height: 1.4;
  max-height: 80px;
  overflow-y: auto;
  margin-bottom: 6px;
}

.rs-original__label {
  font-weight: 600;
  color: var(--text);
}

.rs-original__btn {
  padding: 4px 10px;
  font-size: 12px;
  border-color: rgba(249, 115, 22, 0.5);
  box-shadow: 0 0 6px rgba(249, 115, 22, 0.2);
}

.rs-original__btn:hover {
  border-color: rgba(249, 115, 22, 0.8);
  box-shadow: 0 0 10px rgba(249, 115, 22, 0.3);
}

/* Lead-in line shown above partner text in partner-only mode */
.rs-lead-in {
  margin-bottom: 12px;
  padding: 10px 14px;
  background: var(--panel-elevated);
  border-left: 3px solid rgba(59, 130, 246, 0.5);
  border-radius: 4px;
}

.rs-lead-in__label {
  font-size: 11px;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 4px;
}

.rs-lead-in__text {
  font-size: 14px;
  color: var(--text);
  line-height: 1.5;
  font-style: italic;
  max-height: 1.5em; /* Fixed to ~one line height */
  overflow-y: auto;
}

.rs-lead-in__text--empty {
  color: var(--text-muted);
  opacity: 0.6;
}

/* Spacer in partner view to match collapsed Advanced Settings height */
.rs-partner-spacer {
  margin-top: 16px;
  margin-bottom: 16px;
  height: 40px; /* matches .advanced-section__toggle: 10px padding*2 + 1px border*2 + ~18px line */
}
