body.death-rig-studio > *:not(#game):not(.death-rig-lab-panel):not(script) {
  display: none !important;
}

.death-rig-lab-panel {
  position: fixed;
  inset: 0;
  z-index: 60;
  display: grid;
  grid-template-rows: 64px minmax(0, 1fr) 84px;
  width: 100vw;
  height: 100vh;
  color: #edf3eb;
  pointer-events: none;
  background:
    linear-gradient(90deg, rgba(5, 9, 9, 0.5), transparent 27%, transparent 73%, rgba(5, 9, 9, 0.55)),
    linear-gradient(180deg, rgba(5, 9, 9, 0.8), transparent 15%, transparent 82%, rgba(5, 9, 9, 0.86));
}

.death-rig-lab-panel *,
.death-rig-lab-panel *::before,
.death-rig-lab-panel *::after {
  box-sizing: border-box;
}

.death-rig-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 10px 18px;
  pointer-events: auto;
  background: rgba(8, 14, 13, 0.94);
  border-bottom: 1px solid rgba(176, 203, 179, 0.2);
  box-shadow: 0 10px 32px rgba(0, 0, 0, 0.25);
}

.death-rig-head span {
  display: block;
  color: #d4a94c;
  font-size: 0.64rem;
  font-weight: 900;
  letter-spacing: 0.1em;
}

.death-rig-head h2 {
  margin: 1px 0 0;
  font-size: 1rem;
}

.death-rig-head-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.death-rig-head-actions b {
  padding: 5px 9px;
  color: #17140d;
  font-size: 0.7rem;
  background: #e3bf65;
  border-radius: 999px;
}

.death-rig-head a {
  padding: 6px 9px;
  color: #d9e5da;
  font-size: 0.7rem;
  text-decoration: none;
  background: rgba(255, 255, 255, 0.07);
  border: 1px solid rgba(255, 255, 255, 0.13);
  border-radius: 5px;
}

.death-rig-studio-grid {
  display: grid;
  grid-template-columns: minmax(230px, 280px) minmax(300px, 1fr) minmax(340px, 410px);
  min-height: 0;
  pointer-events: none;
}

.death-cause-panel,
.death-assets-panel {
  min-height: 0;
  overflow: auto;
  padding: 14px;
  pointer-events: auto;
  background: rgba(8, 14, 13, 0.91);
  scrollbar-width: thin;
  scrollbar-color: rgba(214, 178, 90, 0.58) rgba(255, 255, 255, 0.04);
}

.death-cause-panel {
  border-right: 1px solid rgba(176, 203, 179, 0.16);
}

.death-assets-panel {
  border-left: 1px solid rgba(176, 203, 179, 0.16);
}

.death-panel-title,
.death-timeline-copy {
  display: flex;
  align-items: center;
  gap: 9px;
}

.death-panel-title > span,
.death-timeline-copy > span {
  display: grid;
  flex: 0 0 auto;
  width: 24px;
  height: 24px;
  place-items: center;
  color: #17140d;
  font-size: 0.72rem;
  font-weight: 900;
  background: #d8b45e;
  border-radius: 50%;
}

.death-panel-title div,
.death-timeline-copy div {
  display: grid;
  gap: 1px;
}

.death-panel-title strong,
.death-timeline-copy strong {
  font-size: 0.8rem;
}

.death-panel-title small,
.death-timeline-copy small {
  color: rgba(228, 238, 229, 0.57);
  font-size: 0.64rem;
}

.death-cause-list {
  display: grid;
  gap: 6px;
  margin-top: 12px;
}

.death-quick-classify {
  display: grid;
  gap: 6px;
  margin-top: 11px;
  padding: 9px;
  background: rgba(74, 102, 91, 0.14);
  border: 1px solid rgba(144, 190, 169, 0.22);
  border-radius: 6px;
}

.death-quick-classify.is-active {
  background: rgba(216, 180, 94, 0.13);
  border-color: rgba(225, 190, 102, 0.56);
  box-shadow: inset 3px 0 #e0bb61;
}

.death-quick-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 7px;
}

.death-quick-head strong {
  color: #f3d890;
  font-size: 0.72rem;
}

.death-quick-head button,
.death-quick-actions button {
  padding: 4px 6px;
  color: #e9f0e8;
  font-size: 0.56rem;
  font-weight: 800;
  background: rgba(255, 255, 255, 0.07);
  border: 1px solid rgba(255, 255, 255, 0.13);
  border-radius: 4px;
  cursor: pointer;
}

.death-quick-classify p {
  margin: 0;
  overflow: hidden;
  color: #eef3ec;
  font-size: 0.59rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.death-quick-classify > small {
  color: rgba(228, 238, 229, 0.58);
  font-size: 0.56rem;
  line-height: 1.42;
}

.death-quick-actions {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 4px;
}

.death-cause-list button {
  display: grid;
  gap: 2px;
  padding: 9px 10px;
  color: #e9f0e8;
  text-align: left;
  background: rgba(255, 255, 255, 0.055);
  border: 1px solid rgba(255, 255, 255, 0.11);
  border-radius: 5px;
  cursor: pointer;
}

.death-cause-list button:hover {
  background: rgba(216, 180, 94, 0.12);
  border-color: rgba(216, 180, 94, 0.34);
}

.death-cause-list button.is-active {
  background: rgba(216, 180, 94, 0.2);
  border-color: #d8b45e;
  box-shadow: inset 3px 0 #e9c876;
}

.death-cause-list strong {
  font-size: 0.74rem;
}

.death-cause-list small {
  color: rgba(228, 238, 229, 0.53);
  font-size: 0.62rem;
}

.death-cause-detail {
  display: grid;
  gap: 5px;
  margin-top: 12px;
  padding: 10px;
  background: rgba(0, 0, 0, 0.2);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 5px;
}

.death-cause-detail span {
  color: #d6b35d;
  font-size: 0.6rem;
  font-weight: 900;
  text-transform: uppercase;
}

.death-cause-detail strong {
  font-size: 0.76rem;
}

.death-cause-detail p,
.death-rig-note,
.death-rig-status {
  margin: 0;
  color: rgba(228, 238, 229, 0.6);
  font-size: 0.66rem;
  line-height: 1.48;
}

.death-rig-note {
  margin-top: 10px;
}

.death-rig-lab-panel.is-quick-classifying .death-rig-roles,
.death-rig-lab-panel.is-quick-classifying .death-rig-selected,
.death-rig-lab-panel.is-quick-classifying .death-rig-controls {
  display: none;
}

.death-rig-stage {
  position: relative;
  min-width: 0;
  pointer-events: none;
}

.death-stage-label {
  position: absolute;
  top: 16px;
  left: 50%;
  display: grid;
  gap: 2px;
  min-width: 260px;
  padding: 8px 12px;
  text-align: center;
  transform: translateX(-50%);
  background: rgba(7, 12, 12, 0.76);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 6px;
  backdrop-filter: blur(7px);
}

.death-stage-label span {
  color: #d4a94c;
  font-size: 0.58rem;
  font-weight: 900;
}

.death-stage-label strong {
  font-size: 0.82rem;
}

.death-stage-label small {
  color: rgba(228, 238, 229, 0.58);
  font-size: 0.61rem;
}

.death-rig-roles {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 5px;
}

.death-rig-buttons {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 5px;
}

.death-rig-roles {
  margin-top: 12px;
}

.death-rig-roles button,
.death-rig-buttons button {
  min-height: 32px;
  padding: 5px 4px;
  color: #e6eee6;
  font-size: 0.68rem;
  font-weight: 800;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.13);
  border-radius: 5px;
  cursor: pointer;
}

.death-rig-roles button.is-active,
.death-rig-buttons button.primary,
.death-rig-buttons.compact button.is-active {
  color: #17140d;
  background: #d8b45e;
  border-color: #e7c976;
}

.death-rig-buttons button:disabled {
  color: rgba(228, 238, 229, 0.32);
  background: rgba(255, 255, 255, 0.025);
  border-color: rgba(255, 255, 255, 0.07);
  cursor: not-allowed;
}

.death-rig-selected {
  min-height: 28px;
  margin: 7px 0;
  padding: 6px 7px;
  overflow: hidden;
  color: #f4dfaa;
  font-size: 0.64rem;
  text-overflow: ellipsis;
  white-space: nowrap;
  background: rgba(216, 180, 94, 0.08);
  border: 1px solid rgba(216, 180, 94, 0.2);
  border-radius: 5px;
}

.death-rig-palette {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 3px;
  max-height: 178px;
  overflow: auto;
  padding: 3px;
  background: rgba(0, 0, 0, 0.18);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 5px;
}

.death-rig-palette button {
  position: relative;
  display: grid;
  grid-template-rows: 45px 16px;
  height: 66px;
  padding: 2px;
  overflow: hidden;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 3px;
  cursor: pointer;
}

.death-rig-palette button.is-selected {
  border-color: #f0c65e;
  box-shadow: inset 0 0 0 1px #f0c65e;
}

.death-rig-palette button.is-focused {
  background: rgba(216, 180, 94, 0.14);
  outline: 1px solid rgba(240, 198, 94, 0.54);
}

.death-rig-palette img {
  width: 100%;
  height: 45px;
  object-fit: contain;
  image-rendering: pixelated;
}

.death-rig-palette span {
  position: absolute;
  right: 1px;
  bottom: 1px;
  padding: 0 2px;
  color: #fff;
  font-size: 0.5rem;
  font-weight: 900;
  background: rgba(0, 0, 0, 0.72);
  border-radius: 2px;
}

.death-rig-palette small {
  overflow: hidden;
  color: rgba(235, 241, 233, 0.58);
  font-size: 0.5rem;
  line-height: 16px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.death-asset-note {
  display: grid;
  gap: 5px;
  margin-top: 7px;
  padding: 7px;
  background: rgba(0, 0, 0, 0.2);
  border: 1px solid rgba(255, 255, 255, 0.09);
  border-radius: 5px;
}

.death-asset-note > div:first-child {
  display: grid;
  gap: 1px;
}

.death-asset-note strong {
  overflow: hidden;
  font-size: 0.66rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.death-asset-note small,
.death-asset-note-actions span {
  color: rgba(228, 238, 229, 0.54);
  font-size: 0.56rem;
}

.death-asset-note textarea {
  width: 100%;
  min-height: 44px;
  padding: 6px;
  resize: vertical;
  color: #f1f4ee;
  font: inherit;
  font-size: 0.64rem;
  background: rgba(0, 0, 0, 0.3);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 4px;
}

.death-asset-note-actions {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  align-items: center;
  gap: 7px;
}

.death-asset-note-actions button {
  padding: 5px 7px;
  color: #e9f0e8;
  font-size: 0.58rem;
  font-weight: 800;
  background: rgba(216, 180, 94, 0.13);
  border: 1px solid rgba(216, 180, 94, 0.3);
  border-radius: 4px;
  cursor: pointer;
}

.death-rig-controls {
  margin-top: 8px;
  padding-top: 8px;
  border-top: 1px solid rgba(255, 255, 255, 0.09);
}

.death-rig-controls h3 {
  margin: 0 0 6px;
  font-size: 0.72rem;
}

.death-rig-fields {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 4px;
  margin-bottom: 6px;
}

.death-rig-fields label,
.death-rig-duration {
  display: grid;
  gap: 2px;
  color: rgba(228, 238, 229, 0.62);
  font-size: 0.58rem;
  font-weight: 700;
}

.death-rig-fields label[hidden] {
  display: none;
}

.death-rig-fields input {
  width: 100%;
  min-width: 0;
  padding: 4px;
  color: #fff;
  background: rgba(0, 0, 0, 0.28);
  border: 1px solid rgba(255, 255, 255, 0.13);
  border-radius: 3px;
}

.death-rig-buttons.compact {
  grid-template-columns: 1fr 1fr;
}

.death-rig-connection {
  display: block;
  min-height: 28px;
  margin-top: 5px;
  padding: 5px 7px;
  color: rgba(150, 220, 231, 0.76);
  font-size: 0.56rem;
  line-height: 1.4;
  background: rgba(78, 166, 185, 0.08);
  border-left: 2px solid rgba(103, 207, 228, 0.48);
}

.death-rig-buttons.visibility {
  grid-template-columns: repeat(3, minmax(0, 1fr));
  margin-top: 5px;
}

.death-rig-buttons.visibility button:first-child {
  color: #ffd8d3;
  border-color: rgba(223, 99, 88, 0.38);
}

.death-rig-visibility {
  display: block;
  margin-top: 4px;
  color: rgba(228, 238, 229, 0.56);
  font-size: 0.56rem;
}

.death-rig-duration {
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  margin: 8px 0 2px;
}

.death-rig-duration output {
  color: #f1d68e;
}

.death-rig-timeline {
  display: grid;
  grid-template-columns: minmax(190px, 0.8fr) minmax(260px, 1.7fr) minmax(360px, 1fr);
  align-items: center;
  gap: 18px;
  padding: 10px 18px;
  pointer-events: auto;
  background: rgba(8, 14, 13, 0.96);
  border-top: 1px solid rgba(176, 203, 179, 0.2);
  box-shadow: 0 -10px 32px rgba(0, 0, 0, 0.28);
}

.death-timeline-track {
  position: relative;
  height: 8px;
  background: rgba(255, 255, 255, 0.09);
  border-radius: 999px;
}

.death-timeline-track i {
  display: block;
  width: 0;
  height: 100%;
  background: linear-gradient(90deg, #8bcdb8, #e6b94f, #b8423d);
  border-radius: inherit;
}

.death-timeline-track .mark {
  position: absolute;
  top: -18px;
  color: rgba(232, 239, 229, 0.6);
  font-size: 0.55rem;
  font-style: normal;
}

.death-timeline-track .impact {
  left: 36%;
}

.death-timeline-track .settle {
  right: 0;
}

.timeline-actions {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

@media (max-width: 980px) {
  .death-rig-lab-panel {
    grid-template-rows: 60px minmax(0, 1fr) 120px;
  }

  .death-rig-studio-grid {
    grid-template-columns: 210px minmax(240px, 1fr) 330px;
  }

  .death-rig-palette {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }

  .death-rig-timeline {
    grid-template-columns: 1fr 1.5fr;
  }

  .timeline-actions {
    grid-column: 1 / -1;
  }
}
