.pg-lock-matrix-plus {
  margin: 0 0 18px;
  padding: 14px;
  border: 1px solid rgba(247, 129, 102, 0.22);
  border-radius: 14px;
  background:
    radial-gradient(circle at 100% 0%, rgba(247, 129, 102, 0.14), transparent 40%),
    rgba(13, 17, 23, 0.82);
  box-shadow: 0 24px 60px -40px rgba(247, 129, 102, 0.7);
}

.pg-lock-matrix-plus__bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  flex-wrap: wrap;
  margin-bottom: 12px;
}

.pg-lock-matrix-plus__eyebrow {
  margin: 0 0 4px;
  color: #f78166;
  font: 700 10px/1.3 "JetBrains Mono", ui-monospace, monospace;
  letter-spacing: 0.16em;
}

.pg-lock-matrix-plus__title {
  margin: 0;
  color: #e6edf3;
  font: 700 15px/1.4 Inter, system-ui, sans-serif;
}

.pg-lock-matrix-plus__copy {
  margin: 2px 0 0;
  color: #8b949e;
  font-size: 12px;
  line-height: 1.65;
}

.pg-lock-matrix-plus__actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.pg-lock-matrix-plus__actions button {
  min-height: 34px;
  padding: 0 12px;
  border: 1px solid rgba(247, 129, 102, 0.32);
  border-radius: 999px;
  background: rgba(247, 129, 102, 0.08);
  color: #ffd8cc;
  cursor: pointer;
  font: 700 12px/1 "JetBrains Mono", ui-monospace, monospace;
  transition: transform 0.18s ease, border-color 0.18s ease, background 0.18s ease;
}

.pg-lock-matrix-plus__actions button:hover,
.pg-lock-matrix-plus__actions button:focus-visible {
  border-color: #f78166;
  background: rgba(247, 129, 102, 0.18);
  transform: translateY(-1px);
}

.pg-lock-matrix-plus__stage {
  display: grid;
  grid-template-columns: minmax(0, 0.88fr) minmax(14rem, 0.62fr);
  gap: 10px;
}

.pg-lock-matrix-plus__timeline,
.pg-lock-matrix-plus__explain {
  min-width: 0;
  padding: 12px;
  border: 1px solid rgba(255, 255, 255, 0.07);
  border-radius: 10px;
  background: rgba(22, 27, 34, 0.74);
}

.pg-lock-matrix-plus__step {
  margin: 0 0 6px;
  color: #79c0ff;
  font: 700 11px/1.4 "JetBrains Mono", ui-monospace, monospace;
  letter-spacing: 0.1em;
}

.pg-lock-matrix-plus__headline {
  margin: 0 0 6px;
  color: #e6edf3;
  font-size: 14px;
  font-weight: 700;
  line-height: 1.45;
}

.pg-lock-matrix-plus__body {
  margin: 0;
  color: #8b949e;
  font-size: 12px;
  line-height: 1.65;
}

.pg-lock-matrix-plus__hint {
  margin: 8px 0 0;
  color: #f78166;
  font: 700 11px/1.5 "JetBrains Mono", ui-monospace, monospace;
}

.pg-lock-cell {
  position: relative;
  outline: none;
}

.pg-lock-cell::after {
  content: '';
  position: absolute;
  inset: 4px;
  border-radius: 7px;
  border: 1px solid transparent;
  pointer-events: none;
  transition: border-color 0.16s ease, box-shadow 0.16s ease, transform 0.16s ease;
}

.pg-lock-cell:hover::after,
.pg-lock-cell:focus-visible::after,
.pg-lock-cell.is-pg-lock-hover::after,
.pg-lock-cell.is-pg-lock-active::after {
  border-color: rgba(247, 129, 102, 0.82);
  box-shadow: 0 0 0 2px rgba(247, 129, 102, 0.14), 0 0 28px rgba(247, 129, 102, 0.24);
  transform: scale(1.04);
}

.pg-lock-cell.is-pg-lock-compatible:hover::after,
.pg-lock-cell.is-pg-lock-compatible:focus-visible::after {
  border-color: rgba(63, 185, 80, 0.78);
  box-shadow: 0 0 0 2px rgba(63, 185, 80, 0.12), 0 0 28px rgba(63, 185, 80, 0.2);
}

.pg-lock-row-label.is-pg-lock-active,
.pg-lock-col-label.is-pg-lock-active {
  background: rgba(51, 103, 145, 0.18) !important;
  color: #e6edf3 !important;
}

.pg-lock-cell.is-pg-lock-play::after {
  border-color: #f78166;
  animation: pgLockPulse 0.9s ease-in-out infinite alternate;
}

.pg-lock-cell.is-pg-lock-compatible.is-pg-lock-play::after {
  border-color: #3fb950;
  animation-name: pgLockPulseOk;
}

@keyframes pgLockPulse {
  from { box-shadow: 0 0 0 2px rgba(247, 129, 102, 0.16), 0 0 18px rgba(247, 129, 102, 0.18); }
  to { box-shadow: 0 0 0 4px rgba(247, 129, 102, 0.24), 0 0 42px rgba(247, 129, 102, 0.44); }
}

@keyframes pgLockPulseOk {
  from { box-shadow: 0 0 0 2px rgba(63, 185, 80, 0.14), 0 0 18px rgba(63, 185, 80, 0.16); }
  to { box-shadow: 0 0 0 4px rgba(63, 185, 80, 0.22), 0 0 42px rgba(63, 185, 80, 0.34); }
}

.pg-lock-tooltip {
  position: fixed;
  z-index: 9999;
  width: min(320px, calc(100vw - 24px));
  padding: 12px 13px;
  border: 1px solid rgba(247, 129, 102, 0.32);
  border-radius: 12px;
  background: rgba(13, 17, 23, 0.94);
  color: #c9d1d9;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.45), 0 0 30px rgba(247, 129, 102, 0.12);
  backdrop-filter: blur(12px);
  pointer-events: none;
  opacity: 0;
  transform: translateY(6px) scale(0.98);
  transition: opacity 0.12s ease, transform 0.12s ease;
}

.pg-lock-tooltip.is-visible {
  opacity: 1;
  transform: translateY(0) scale(1);
}

.pg-lock-tooltip__kicker {
  margin: 0 0 6px;
  color: #f78166;
  font: 700 10px/1.3 "JetBrains Mono", ui-monospace, monospace;
  letter-spacing: 0.14em;
}

.pg-lock-tooltip__title {
  margin: 0 0 6px;
  color: #e6edf3;
  font-size: 13px;
  font-weight: 800;
  line-height: 1.45;
}

.pg-lock-tooltip__body {
  margin: 0;
  color: #8b949e;
  font-size: 12px;
  line-height: 1.6;
}

.pg-lock-tooltip__sql {
  display: block;
  margin-top: 8px;
  padding: 7px 8px;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.05);
  color: #a7f3d0;
  font: 700 11px/1.45 "JetBrains Mono", ui-monospace, monospace;
  white-space: normal;
}

.pg-lock-matrix-scroll {
  overflow-x: auto !important;
  overflow-y: hidden;
  -webkit-overflow-scrolling: touch;
}

.pg-lock-matrix-scroll .pg-lock-grid-row {
  min-width: 760px;
}

@media (max-width: 760px) {
  .pg-lock-matrix-plus {
    margin-left: -28px;
    margin-right: -28px;
    border-radius: 12px;
  }

  .pg-lock-matrix-plus__stage {
    grid-template-columns: 1fr;
  }

  .pg-lock-matrix-plus__actions,
  .pg-lock-matrix-plus__actions button {
    width: 100%;
  }

  .pg-lock-matrix-plus__actions button {
    justify-content: center;
  }

  .pg-lock-tooltip {
    left: 12px !important;
    right: 12px;
    top: auto !important;
    bottom: 12px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .pg-lock-cell.is-pg-lock-play::after {
    animation: none;
  }
}
