/* YouTube-first Blank Sheet objects. The player remains interactive while
   BookVault movement and resizing stay on separate controls. */
body.bv-native-sheet-active #bvNativeSheetVideoLayer {
  position: absolute;
  z-index: 1;
  inset: 0;
  overflow: visible;
  pointer-events: none;
}

.bv-native-sheet-video {
  position: absolute;
  box-sizing: border-box;
  margin: 0;
  overflow: visible;
  border: 2px solid transparent;
  background: #111827;
  box-shadow: 0 3px 0 rgba(23, 34, 53, 0.16);
  outline: 0;
  pointer-events: none;
  user-select: none;
  -webkit-user-select: none;
}

.bv-native-sheet-video.is-selected {
  border-color: #3156d9;
  box-shadow: 0 0 0 2px rgba(49, 86, 217, 0.14), 0 5px 0 rgba(23, 34, 53, 0.18);
}

.bv-native-sheet-video__move {
  position: absolute;
  z-index: 4;
  top: 0;
  left: 0;
  right: 0;
  height: 30px;
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 0 72px 0 10px;
  box-sizing: border-box;
  border-bottom: 1px solid rgba(23, 34, 53, 0.24);
  background: #f0ede2;
  color: #172235;
  font: 700 10px/1 "Courier Prime", monospace;
  letter-spacing: 0.08em;
  cursor: grab;
  touch-action: none;
  pointer-events: auto;
}

.bv-native-sheet-video__move:active {
  cursor: grabbing;
}

.bv-native-sheet-video__move::before {
  content: "⋮⋮";
  letter-spacing: -0.18em;
  color: #64748b;
}

.bv-native-sheet-video__delete,
.bv-native-sheet-video__controls-toggle,
.bv-native-sheet-video__play-toggle {
  position: absolute;
  z-index: 6;
  top: 3px;
  width: 24px;
  height: 24px !important;
  min-height: 24px !important;
  max-height: 24px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  border: 1px solid #172235;
  border-radius: 2px;
  background: #fffdf7;
  color: #172235;
  box-shadow: 2px 2px 0 rgba(23, 34, 53, 0.18);
  font: 700 16px/1 sans-serif;
  cursor: pointer;
  pointer-events: auto;
}

body.bv-native-sheet-active .bv-native-sheet-video > .bv-native-sheet-video__delete {
  position: absolute !important;
  top: 3px !important;
  right: 4px !important;
  left: auto !important;
}

body.bv-native-sheet-active .bv-native-sheet-video > .bv-native-sheet-video__controls-toggle {
  position: absolute !important;
  top: 3px !important;
  right: 34px !important;
  left: auto !important;
  font-size: 13px;
}

body.bv-native-sheet-active .bv-native-sheet-video > .bv-native-sheet-video__play-toggle {
  position: absolute !important;
  top: 3px !important;
  right: 64px !important;
  left: auto !important;
  font-size: 11px;
}

.bv-native-sheet-video__player {
  position: absolute;
  z-index: 1;
  inset: 30px 0 0;
  overflow: hidden;
  background: #111827;
  pointer-events: auto;
}

.bv-native-sheet-video__player > iframe,
.bv-native-sheet-video__player > div {
  width: 100% !important;
  height: 100% !important;
  border: 0;
}

.bv-native-sheet-video__placeholder,
.bv-native-sheet-video__error {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 18px;
  box-sizing: border-box;
  background: #172235;
  color: #fffdf7;
  text-align: center;
  font: 700 11px/1.35 "Courier Prime", monospace;
}

.bv-native-sheet-video__placeholder::before {
  content: "▶";
  display: block;
  font: 700 34px/1 sans-serif;
}

.bv-native-sheet-video__error a {
  color: #d9e4ff;
}

.bv-native-sheet-video__resize {
  position: absolute;
  z-index: 7;
  right: -5px;
  bottom: -5px;
  width: 30px;
  height: 30px;
  cursor: nwse-resize;
  touch-action: none;
  pointer-events: auto;
}

.bv-native-sheet-video__resize::before,
.bv-native-sheet-video__resize::after {
  content: "";
  position: absolute;
  right: 4px;
  bottom: 4px;
  border-right: 2px solid #3156d9;
  border-bottom: 2px solid #3156d9;
}

.bv-native-sheet-video__resize::before {
  width: 14px;
  height: 14px;
}

.bv-native-sheet-video__resize::after {
  width: 7px;
  height: 7px;
}

.bv-native-sheet-video__settings {
  position: absolute;
  z-index: 12;
  top: calc(100% + 8px);
  left: 0;
  width: min(430px, max(100%, 356px));
  display: none;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 8px;
  padding: 10px;
  box-sizing: border-box;
  border: 2px solid #172235;
  border-radius: 4px;
  background: #fffdf7;
  box-shadow: 5px 5px 0 rgba(23, 34, 53, 0.20);
  color: #172235;
  pointer-events: auto;
}

.bv-native-sheet-video.is-controls-open .bv-native-sheet-video__settings {
  display: grid;
}

.bv-native-sheet-video__field {
  display: grid;
  gap: 4px;
  margin: 0;
  color: #475569;
  font: 700 9px/1 "Courier Prime", monospace;
  letter-spacing: 0.08em;
}

.bv-native-sheet-video__field input[type="text"] {
  width: 100%;
  min-width: 0;
  height: 34px;
  box-sizing: border-box;
  border: 1px solid #172235;
  border-radius: 2px;
  background: #fff;
  color: #172235;
  font: 700 13px/1 "Courier Prime", monospace;
}

.bv-native-sheet-video__settings button {
  min-height: 34px;
  border: 1px solid #172235;
  border-radius: 2px;
  background: #f2f5ff;
  color: #172235;
  box-shadow: 2px 2px 0 rgba(23, 34, 53, 0.18);
  font: 700 9px/1 "Courier Prime", monospace;
  cursor: pointer;
}

.bv-native-sheet-video__loop {
  grid-column: 1 / -1;
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 30px;
  font: 700 10px/1 "Courier Prime", monospace;
}

.bv-native-sheet-video__loop input {
  width: 18px;
  height: 18px;
  margin: 0;
}

.bv-native-sheet-video-dialog[hidden] {
  display: none !important;
}

.bv-native-sheet-video-dialog {
  position: fixed;
  z-index: 260;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 18px;
  background: rgba(12, 18, 29, 0.46);
}

.bv-native-sheet-video-dialog__panel {
  width: min(390px, calc(100vw - 36px));
  padding: 16px;
  box-sizing: border-box;
  border: 2px solid #172235;
  border-radius: 5px;
  background: #f7f4ea;
  box-shadow: 7px 7px 0 rgba(23, 34, 53, 0.24);
}

.bv-native-sheet-video-dialog__panel h2 {
  margin: 0 0 14px;
  font: 700 15px/1 "Courier Prime", monospace;
  letter-spacing: 0.08em;
}

.bv-native-sheet-video-dialog__panel label {
  display: grid;
  gap: 6px;
  color: #475569;
  font: 700 10px/1 "Courier Prime", monospace;
}

.bv-native-sheet-video-dialog__panel input[type="url"] {
  width: 100%;
  height: 40px;
  padding: 0 10px;
  box-sizing: border-box;
  border: 1px solid #172235;
  border-radius: 2px;
  background: #fff;
  color: #172235;
  font: 13px/1.2 sans-serif;
}

.bv-native-sheet-video-dialog__error {
  min-height: 18px;
  margin: 7px 0 0;
  color: #a33b42;
  font: 700 10px/1.3 "Courier Prime", monospace;
}

.bv-native-sheet-video-dialog__actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 10px;
}

.bv-native-sheet-video-dialog__actions button {
  min-height: 36px;
  padding: 0 12px;
  border: 1px solid #172235;
  border-radius: 2px;
  background: #fffdf7;
  color: #172235;
  box-shadow: 2px 2px 0 rgba(23, 34, 53, 0.18);
  font: 700 10px/1 "Courier Prime", monospace;
  cursor: pointer;
}

.bv-native-sheet-video-dialog__actions [data-video-dialog-add] {
  background: #dce8ff;
}

.bv-native-sheet-video-status {
  position: sticky;
  z-index: 18;
  left: 12px;
  bottom: 10px;
  width: fit-content;
  max-width: min(390px, 84%);
  margin-left: 8px;
  padding: 5px 8px;
  border-left: 3px solid #3156d9;
  background: rgba(251, 250, 244, 0.94);
  color: #667085;
  font: 700 9px/1.25 "Courier Prime", monospace;
  opacity: 0;
  pointer-events: none;
  transition: opacity 100ms ease;
}

.bv-native-sheet-video-status.is-visible {
  opacity: 1;
}

body.bv-native-sheet-active #bvNativeSheetVideoLauncher {
  display: flex;
}

body.bv-native-sheet-active.bv-reader-pen-workspace-open #bvNativeSheetVideoLayer {
  pointer-events: none;
}

body.bv-native-sheet-active.bv-reader-pen-workspace-open .bv-native-sheet-video :is(
  .bv-native-sheet-video__move,
  .bv-native-sheet-video__delete,
  .bv-native-sheet-video__controls-toggle,
  .bv-native-sheet-video__play-toggle,
  .bv-native-sheet-video__player,
  .bv-native-sheet-video__resize,
  .bv-native-sheet-video__settings
) {
  pointer-events: none !important;
}

@media (pointer: coarse), (hover: none) {
  .bv-native-sheet-video__move {
    padding-left: 12px;
  }

  body.bv-native-sheet-active .bv-native-sheet-video > .bv-native-sheet-video__delete,
  body.bv-native-sheet-active .bv-native-sheet-video > .bv-native-sheet-video__controls-toggle,
  body.bv-native-sheet-active .bv-native-sheet-video > .bv-native-sheet-video__play-toggle {
    top: 0 !important;
    width: 30px;
    height: 30px !important;
    min-height: 30px !important;
    max-height: 30px;
  }

  body.bv-native-sheet-active .bv-native-sheet-video > .bv-native-sheet-video__controls-toggle {
    right: 40px !important;
  }

  body.bv-native-sheet-active .bv-native-sheet-video > .bv-native-sheet-video__play-toggle {
    right: 76px !important;
  }

  .bv-native-sheet-video__resize {
    width: 38px;
    height: 38px;
  }

  .bv-native-sheet-video__settings {
    width: min(440px, max(100%, 356px));
  }
}

@media (max-width: 620px) {
  .bv-native-sheet-video__settings {
    width: min(92vw, 400px);
    grid-template-columns: 1fr;
  }

  .bv-native-sheet-video__loop {
    grid-column: 1;
  }
}

@media (prefers-reduced-motion: reduce) {
  .bv-native-sheet-video-status {
    transition: none;
  }
}
