.page {
  height: 100vh;
  padding: 16px;
  display: grid;
  grid-template-columns: 280px 1fr;
  gap: 16px;
  overflow: auto;
  min-height: 0;
  box-sizing: border-box;
}

.remote {
  padding: 12px;
  height: 100%;
  min-height: calc(100vh - 32px);
  min-width: 0;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  box-sizing: border-box;
}

.remoteTitle {
  font-size: var(--text-xs);
  font-weight: 900;
  letter-spacing: 0.8px;
  color: var(--text1);
}

.spacer12 {
  height: 12px;
}

.spacer8 {
  height: 8px;
}

.spacer10 {
  height: 10px;
}

.sectionLabel {
  font-size: var(--text-xs);
  font-weight: 800;
  color: var(--text2);
}

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

.effectsGroup {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.subsectionLabel {
  font-size: var(--text-xs);
  font-weight: 700;
  letter-spacing: 0.02em;
  color: var(--text2);
}

.iconRow {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  align-items: center;
}

.iconGlyph {
  font-size: 18px;
  line-height: 1;
  display: block;
}

.clearIcon {
  display: flex;
  width: 20px;
  height: 20px;
  align-items: center;
  justify-content: center;
}

.bookIcon {
  display: block;
  color: var(--text-muted-on-dark);
}

.modalBackdrop {
  position: fixed;
  inset: 0;
  z-index: var(--z-modal-backdrop);
  border: none;
  padding: 0;
  margin: 0;
  background: var(--color-scrim);
  cursor: default;
}

.modalDialog {
  position: fixed;
  z-index: var(--z-modal);
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  width: 520px;
  max-width: calc(100vw - 32px);
  max-height: calc(100vh - 32px);
  overflow: auto;
  box-sizing: border-box;
  min-width: 0;
  border-radius: var(--radius-lg);
  border: 1px solid var(--stroke);
  background: var(--color-surface-elevated);
  box-shadow: var(--shadow-xl);
  padding: 16px;
  display: grid;
  gap: 12px;
  grid-template-columns: minmax(0, 1fr);
}

.descriptionViewDialog {
  width: min(720px, calc(100vw - 32px));
  max-height: calc(100vh - 48px);
  grid-template-rows: auto 1fr auto;
}

.modalHeader {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.modalTitle {
  font-weight: 900;
  font-size: var(--text-lg);
}

.modalClose {
  border: none;
  background: var(--panel2);
  color: var(--text2);
  border-radius: var(--radius-sm);
  width: 34px;
  height: 34px;
  cursor: pointer;
  font-size: 18px;
  line-height: 1;
}

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

.descriptionViewBody {
  min-height: 360px;
  max-height: min(560px, calc(100vh - 200px));
  overflow: auto;
  padding: 14px 16px;
  border-radius: var(--radius-md);
  border: 1px solid var(--stroke);
  background: var(--color-overlay-dark-3);
}

.descriptionViewProse {
  color: var(--text0);
  font-size: var(--text-md);
  line-height: 1.55;
  word-break: break-word;
}

.descriptionViewEmpty {
  color: var(--text2);
  font-size: var(--text-sm);
}

.radiusRow {
  display: grid;
  grid-template-columns: 120px 1fr 44px;
  align-items: center;
  gap: 8px;
}

.effectsSoundRow {
  margin-top: 4px;
}

.radiusLabel {
  color: var(--text2);
  font-size: var(--text-xs);
  font-weight: 800;
}

.range {
  width: 100%;
}

.radiusValue {
  text-align: right;
  font-variant-numeric: tabular-nums;
  color: var(--text2);
  font-size: var(--text-xs);
}

.storyWrap {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
}

.storyScroll {
  flex: 0 0 70%;
  min-height: 0;
  border-radius: var(--radius-lg);
  border: 1px solid var(--stroke);
  background: var(--color-overlay-dark-2);
  overflow: auto;
  padding: 10px;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  justify-content: flex-start;
  gap: 10px;
}

.historyBtn {
  text-align: left;
  padding: 10px;
  border-radius: var(--scene-tile-radius);
  border: none;
  background: transparent;
  color: inherit;
  cursor: pointer;
  opacity: 0.9;
}

.historyBtn:not(:disabled):not(.historyBtnCurrent):hover {
  background: var(--scene-list-hover-bg);
}

.historyBtn:disabled {
  cursor: default;
  opacity: 0.9;
}

.historyBtnCurrent {
  border: 1px solid var(--scene-list-selected-border);
  background: var(--scene-list-selected-bg);
  cursor: default;
}

.historyBadge {
  color: var(--accent2);
  font-size: var(--text-xs);
  font-weight: 900;
}

.historyMuted {
  color: var(--text2);
  font-size: var(--text-xs);
}

.historyTitle {
  font-weight: 800;
  min-width: 0;
}

.emptyStory {
  color: var(--text2);
  font-size: var(--text-xs);
}

.rightStack {
  min-width: 0;
  display: grid;
  grid-template-rows: auto auto auto;
  gap: 16px;
}

.surfacePad {
  padding: 12px;
}

.previewHeader {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.previewTitle {
  font-size: var(--text-md);
  font-weight: 900;
}

.previewActions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.npcTokenScale {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.snapToGrid {
  display: flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
  cursor: pointer;
  user-select: none;
}

.snapToGridLabel {
  color: var(--text2);
  font-size: var(--text-xs);
  font-weight: 700;
  white-space: nowrap;
}

.npcTokenScaleLabel {
  color: var(--text2);
  font-size: var(--text-xs);
  font-weight: 700;
  white-space: nowrap;
}

.npcTokenScaleRange {
  width: min(140px, 22vw);
  accent-color: var(--color-accent, #c9a227);
}

.videoHint {
  color: var(--text2);
  font-size: var(--text-xs);
  line-height: 1.45;
  margin-bottom: 8px;
}

.previewFrame {
  border-radius: 18px;
  border: 1px solid var(--stroke);
  height: 360px;
  overflow: hidden;
  background: var(--color-overlay-dark-2);
  position: relative;
}

.previewHost {
  position: absolute;
  inset: 0;
}

.previewHostSpawnDrag {
  cursor: copy;
}

.npcSpawnGhost {
  position: absolute;
  z-index: 12;
  width: 28px;
  height: 28px;
  border-radius: 999px;
  transform: translate(-50%, -50%);
  pointer-events: none;
  border: 2px dashed rgba(96, 165, 250, 0.95);
  background: rgba(96, 165, 250, 0.2);
}

.brushCursor {
  position: absolute;
  z-index: 2;
  will-change: left, top;
  transform: translate(-50%, -50%);
  border-radius: 50%;
  border: 1px solid rgba(255, 255, 255, 0.55);
  box-shadow:
    0 0 0 1px rgba(0, 0, 0, 0.3),
    0 0 18px rgba(255, 140, 40, 0.12),
    inset 0 0 18px rgba(255, 140, 40, 0.1);
  background: rgba(255, 160, 60, 0.03);
  pointer-events: none;
}

.brushLayer {
  position: absolute;
  inset: 0;
  z-index: 3;
  cursor: crosshair;
}

.branchTitle {
  font-size: var(--text-md);
  font-weight: 900;
  margin-bottom: 10px;
}

.branchGrid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}

.branchCard {
  border-radius: var(--scene-tile-radius);
  border: 1px solid var(--stroke);
  background: var(--color-overlay-dark-2);
  padding: 12px;
  display: grid;
  gap: 10px;
  min-width: 0;
  max-width: 100%;
}

.branchCardHeader {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  color: var(--text2);
}

.branchOption {
  font-size: 11px;
  font-weight: 900;
}

.branchName {
  font-weight: 900;
  min-width: 0;
}

.branchCardReturn {
  border-color: rgba(0, 120, 212, 0.45);
}

.sideStoryGrid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 12px;
}

.sideStoryTile {
  display: grid;
  gap: 8px;
  padding: 0;
  border: none;
  background: transparent;
  cursor: pointer;
  text-align: left;
  color: inherit;
  font: inherit;
}

.sideStoryTile:hover .sideStoryPreview {
  border-color: rgba(0, 120, 212, 0.55);
}

.sideStoryPreview {
  width: 100%;
  aspect-ratio: 4 / 3;
  border-radius: var(--scene-tile-radius);
  overflow: hidden;
  border: 2px solid var(--stroke);
  background: #0c0c0e;
  position: relative;
}

.sideStoryVideo {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.sideStoryPlaceholder {
  width: 100%;
  height: 100%;
  background: #0c0c0e;
}

.sideStoryTitle {
  font-size: var(--text-xs);
  font-weight: 800;
  line-height: 1.25;
  color: var(--text1);
}

.musicHeader {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.musicEmpty {
  color: var(--text2);
  font-size: var(--text-xs);
}

.audioMeta {
  min-width: 0;
}

.audioBadges {
  display: flex;
  gap: 10px;
  color: var(--text2);
  font-size: var(--text-xs);
}

.audioName {
  font-weight: 800;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.audioControls {
  display: flex;
  flex-direction: column;
  gap: 8px;
  flex-shrink: 0;
  align-items: stretch;
  min-width: 132px;
}

.audioTransport {
  display: flex;
  gap: 10px;
  flex-shrink: 0;
  justify-content: flex-end;
}

.audioVolumeRow {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.audioVolumeIcon {
  flex-shrink: 0;
  width: 16px;
  height: 16px;
  color: var(--text2);
  display: flex;
  align-items: center;
  justify-content: center;
}

.audioVolumeIcon svg {
  display: block;
  width: 16px;
  height: 16px;
}

.audioVolume {
  flex: 1;
  min-width: 0;
  width: 100%;
  margin: 0;
  accent-color: var(--accent-fill-solid);
}

.scrubFill {
  height: 100%;
  background: var(--accent-fill-solid);
}

.timeRow {
  margin-top: 6px;
  display: flex;
  justify-content: space-between;
  color: var(--text2);
  font-size: 11px;
}

.branchEmpty {
  grid-column: 1 / -1;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  color: var(--text2);
  font-size: var(--text-xs);
  padding: 6px 2px;
}

.audioList {
  display: grid;
  gap: 8px;
  max-height: 210px;
  overflow: auto;
}

.audioCard {
  padding: 10px;
  border-radius: 14px;
  border: 1px solid var(--stroke);
  background: var(--color-overlay-dark-2);
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 12px;
}

.audioScrub {
  margin-top: 10px;
  height: 10px;
  border-radius: var(--radius-pill);
  border: 1px solid var(--stroke);
  background: rgba(0, 0, 0, 0.22);
  overflow: hidden;
}

.audioScrubPointer {
  cursor: pointer;
}

.audioScrubDefault {
  cursor: default;
}

.ctxMenuBackdrop {
  position: fixed;
  inset: 0;
  z-index: 40;
  border: none;
  padding: 0;
  margin: 0;
  background: transparent;
  cursor: default;
}

.ctxMenu {
  position: fixed;
  z-index: 41;
  min-width: 200px;
  padding: 6px;
  border-radius: 8px;
  border: 1px solid var(--stroke, #2a2f3a);
  background: var(--color-surface-menu, #1a1e28);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.45);
  display: grid;
  gap: 2px;
}

.ctxItem {
  text-align: left;
  padding: 8px 10px;
  border-radius: 6px;
  border: none;
  background: transparent;
  color: var(--text1, #e8eaef);
  font-size: 13px;
  cursor: pointer;
  width: 100%;
}

.ctxItem:hover {
  background: rgba(255, 255, 255, 0.06);
}
