.death-bar {
  position: fixed;
  left: 1rem;
  bottom: 1rem;
  z-index: 250;
  width: min(460px, calc(100vw - 2rem));
  max-width: calc(100vw - 1rem);
  max-height: calc(100dvh - 1rem);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background: rgba(5, 5, 5, 0.96);
  border: 1px solid var(--editor-selected, #e7ff5d);
  border-radius: 0.85rem;
  box-shadow: 0 0 30px rgba(231, 255, 93, 0.22), 0 18px 60px rgba(0, 0, 0, 0.7);
  color: var(--color-text, #f7f2ec);
  font-family: var(--font-body, system-ui, sans-serif);
}

.death-bar.is-minimized {
  width: min(500px, calc(100vw - 2rem));
}

.death-bar.is-minimized .death-bar-body,
.death-bar.minimized .death-bar-body {
  display: none;
}

.death-bar.is-maximized {
  top: 1rem !important;
  right: auto !important;
  bottom: 1rem !important;
  left: 1rem !important;
  width: min(680px, calc(100vw - 2rem));
  max-height: calc(100dvh - 2rem);
}

.death-bar.is-dragging {
  user-select: none;
  box-shadow: 0 0 0 2px rgba(231, 255, 93, 0.38), 0 24px 80px rgba(0, 0, 0, 0.8);
}

.death-bar-head {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 0.55rem;
  flex: 0 0 auto;
  padding: 0.55rem;
  cursor: grab;
  background: linear-gradient(90deg, rgba(255, 48, 48, 0.2), rgba(231, 255, 93, 0.08));
  border-bottom: 1px solid rgba(231, 255, 93, 0.18);
}

.death-bar-head:active {
  cursor: grabbing;
}

.death-bar-title {
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 0.45rem;
  white-space: nowrap;
}

.death-grip {
  display: inline-grid;
  place-items: center;
  width: 1.45rem;
  height: 1.45rem;
  border-radius: 999px;
  background: rgba(255, 48, 48, 0.2);
  color: #ff3030;
  text-shadow: 0 0 12px rgba(255, 48, 48, 0.72);
}

.death-target-pill {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  color: var(--color-muted, #b6aaa0);
  font-size: 0.78rem;
}

.death-target-pill b {
  color: var(--color-action, #e7ff5d);
  font-weight: 700;
}

.death-bar-head-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 0.35rem;
}

.death-bar-body {
  flex: 1 1 auto;
  min-height: 0;
  display: grid;
  gap: 0.65rem;
  padding: 0.65rem;
  overflow: auto;
  overscroll-behavior: contain;
  scrollbar-gutter: stable;
}

.death-quick-actions {
  position: sticky;
  top: 0;
  z-index: 2;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.45rem;
  padding: 0.35rem;
  background: rgba(5, 5, 5, 0.95);
  border: 1px solid rgba(231, 255, 93, 0.2);
  border-radius: 0.7rem;
  backdrop-filter: blur(12px);
}

.death-panel {
  border: 1px solid rgba(231, 255, 93, 0.18);
  border-radius: 0.75rem;
  overflow: hidden;
  background: rgba(255, 255, 255, 0.025);
}

.death-panel-toggle {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  border: 0 !important;
  border-bottom: 1px solid rgba(231, 255, 93, 0.14) !important;
  border-radius: 0 !important;
  background: rgba(231, 255, 93, 0.08) !important;
  text-align: left;
}

.death-panel:not(.is-open) .death-panel-content {
  display: none;
}

.death-panel-content {
  display: grid;
  gap: 0.55rem;
  padding: 0.65rem;
}

.death-bar button,
.death-bar select,
.death-bar input {
  border: 1px solid var(--color-border, rgba(255, 255, 255, 0.18));
  background: #0b0b0b;
  color: var(--color-text, #f7f2ec);
  padding: 0.48rem 0.55rem;
  border-radius: 0.5rem;
}

.death-bar button {
  cursor: pointer;
  min-height: 2.1rem;
}

.death-bar button:hover,
.death-bar button:focus-visible {
  border-color: var(--color-action, #e7ff5d);
  box-shadow: 0 0 0 2px rgba(231, 255, 93, 0.12);
}

.death-bar-body label,
.death-bar-body .death-bar-field {
  display: grid;
  gap: 0.35rem;
  margin: 0;
  font-size: 0.86rem;
  color: var(--color-muted, #b6aaa0);
}

.death-bar-body input,
.death-bar-body select,
.death-bar-body textarea {
  width: 100%;
  background: #080808;
  color: #f7f2ec;
  border: 1px solid rgba(231, 255, 93, 0.35);
  border-radius: 0.55rem;
  padding: 0.55rem 0.65rem;
}

.death-bar-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.45rem;
}

.death-bar-row.triple {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.death-bar hr {
  width: 100%;
  border: 0;
  border-top: 1px solid rgba(231, 255, 93, 0.22);
}

.death-bar .small-note {
  margin: 0;
  color: var(--color-muted, #b6aaa0);
  font-size: 0.78rem;
  line-height: 1.45;
}

body.is-editing [data-editable] {
  outline: 1px dashed rgba(231, 255, 93, 0.5);
  outline-offset: 4px;
  cursor: crosshair;
}

body.is-editing .is-selected-edit-target,
.is-selected-edit-target {
  outline: 2px solid var(--color-action, #e7ff5d) !important;
  outline-offset: 4px;
}

body.is-editing .media-card.is-selected-edit-target,
body.is-editing .product-card-media.is-selected-edit-target,
.media-card.is-selected-edit-target,
.product-card-media.is-selected-edit-target {
  box-shadow: 0 0 0 2px #e7ff5d, 0 0 30px rgba(231, 255, 93, 0.25);
}

.editor-handle {
  position: absolute;
  z-index: 240;
  padding: 0.25rem 0.45rem;
  background: var(--editor-selected, #e7ff5d);
  color: #000;
  font-size: 0.75rem;
  pointer-events: none;
}

@media (max-width: 720px) {
  .death-bar,
  .death-bar.is-minimized {
    left: 0.5rem;
    right: auto;
    bottom: 0.5rem;
    width: calc(100vw - 1rem);
    max-height: calc(100dvh - 1rem);
  }

  .death-bar.is-maximized {
    top: 0.5rem !important;
    bottom: 0.5rem !important;
    left: 0.5rem !important;
    width: calc(100vw - 1rem);
    max-height: calc(100dvh - 1rem);
  }

  .death-bar-head {
    grid-template-columns: 1fr;
  }

  .death-bar-head-actions,
  .death-quick-actions,
  .death-bar-row.triple {
    grid-template-columns: 1fr 1fr;
  }

  .death-bar-head-actions {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }
}
