/* ============================================================
   DETAIL OVERLAY — per-piece expanded view
   ============================================================ */

#detail-overlay {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(5, 5, 16, 0.75);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.35s cubic-bezier(0.22, 1, 0.36, 1);
  padding: 20px;
  overflow-y: auto;
}

#detail-overlay.open {
  opacity: 1;
  pointer-events: auto;
}

#detail-panel {
  position: relative;
  width: 100%;
  max-width: 820px;
  max-height: calc(100vh - 40px);
  overflow-y: auto;
  background: #09091a;
  border: 1px solid rgba(255, 255, 255, 0.07);
  border-radius: 16px;
  box-shadow:
    0 0 0 1px rgba(0, 212, 255, 0.07),
    0 32px 80px rgba(0, 0, 0, 0.6),
    0 0 120px rgba(0, 212, 255, 0.04);
  transform: scale(0.96) translateY(12px);
  transition:
    transform 0.45s cubic-bezier(0.22, 1, 0.36, 1),
    opacity 0.35s ease;
  opacity: 0;
  scrollbar-width: thin;
  scrollbar-color: rgba(0, 212, 255, 0.2) transparent;
}

#detail-panel::-webkit-scrollbar { width: 4px; }
#detail-panel::-webkit-scrollbar-track { background: transparent; }
#detail-panel::-webkit-scrollbar-thumb { background: rgba(0, 212, 255, 0.18); border-radius: 4px; }

#detail-overlay.open #detail-panel {
  transform: scale(1) translateY(0);
  opacity: 1;
}

/* Close button */
#detail-close {
  position: sticky;
  top: 16px;
  float: right;
  margin: 16px 16px 0 0;
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 50%;
  color: rgba(255, 255, 255, 0.4);
  font-size: 18px;
  font-weight: 300;
  line-height: 1;
  cursor: pointer;
  transition: background 0.2s, color 0.2s, border-color 0.2s;
  z-index: 10;
}

#detail-close:hover {
  background: rgba(0, 212, 255, 0.1);
  border-color: rgba(0, 212, 255, 0.3);
  color: var(--blue);
}

/* Header */
#detail-header {
  padding: 40px 48px 0;
  position: relative;
  overflow: hidden;
}

.detail-bg-num {
  position: absolute;
  top: -10px;
  right: 36px;
  font-family: 'Space Grotesk', sans-serif;
  font-size: 140px;
  font-weight: 500;
  color: rgba(255, 255, 255, 0.025);
  line-height: 1;
  letter-spacing: -0.04em;
  pointer-events: none;
  user-select: none;
}

.detail-eyebrow {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 14px;
}

.detail-num-badge {
  font-family: 'Space Grotesk', sans-serif;
  font-size: 10px;
  font-weight: 500;
  letter-spacing: 0.18em;
  color: var(--blue);
  background: rgba(0, 212, 255, 0.07);
  border: 1px solid rgba(0, 212, 255, 0.18);
  border-radius: 4px;
  padding: 4px 10px;
  text-transform: uppercase;
}

.detail-system-type {
  font-size: 10px;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.2);
}

#detail-title {
  font-family: 'Space Grotesk', sans-serif;
  font-size: clamp(28px, 4vw, 40px);
  font-weight: 300;
  letter-spacing: -0.02em;
  color: rgba(255, 255, 255, 0.92);
  line-height: 1.1;
  margin-bottom: 20px;
}

#detail-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  margin-bottom: 32px;
}

#detail-tags span {
  font-size: 9px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  padding: 4px 11px;
  border: 1px solid rgba(0, 212, 255, 0.15);
  border-radius: 20px;
  color: rgba(0, 212, 255, 0.6);
}

/* Divider */
.detail-divider {
  height: 1px;
  background: linear-gradient(90deg,
    rgba(0, 212, 255, 0.15) 0%,
    rgba(122, 92, 255, 0.1) 50%,
    transparent 100%
  );
  margin: 0 48px;
}

/* Body */
#detail-body {
  padding: 32px 48px 48px;
  display: flex;
  flex-direction: column;
  gap: 32px;
}

.detail-section h3 {
  font-size: 9px;
  letter-spacing: 0.28em;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.25);
  margin-bottom: 14px;
  font-weight: 400;
}

.detail-section p {
  font-size: 14px;
  line-height: 1.75;
  color: rgba(255, 255, 255, 0.55);
  font-weight: 300;
  max-width: 640px;
}

/* Math section */
.detail-math-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

@media (max-width: 600px) {
  .detail-math-grid { grid-template-columns: 1fr; }
  #detail-header { padding: 32px 24px 0; }
  #detail-body { padding: 24px 24px 40px; }
  .detail-bg-num { font-size: 90px; }
  .detail-chart-wrap { justify-content: flex-start; }
}

.formula-block {
  background: rgba(0, 0, 0, 0.35);
  border: 1px solid rgba(255, 255, 255, 0.055);
  border-radius: 10px;
  padding: 14px 16px;
  transition: border-color 0.2s;
}

.formula-block:hover {
  border-color: rgba(0, 212, 255, 0.15);
}

.formula-label {
  display: block;
  font-size: 8px;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: rgba(0, 212, 255, 0.5);
  margin-bottom: 8px;
}

.formula-block code {
  display: block;
  font-family: 'Space Grotesk', monospace;
  font-size: 13px;
  color: rgba(255, 255, 255, 0.82);
  line-height: 1.5;
  letter-spacing: 0.02em;
}

.formula-desc {
  display: block;
  margin-top: 7px;
  font-size: 10px;
  color: rgba(255, 255, 255, 0.28);
  line-height: 1.5;
}

/* Chart area */
.detail-chart-wrap {
  display: flex;
  justify-content: flex-end;
  margin-top: 10px;
}

.detail-chart {
  background: rgba(0, 0, 0, 0.3);
  border: 1px solid rgba(255, 255, 255, 0.05);
  border-radius: 10px;
  padding: 12px 16px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.detail-chart-label {
  font-size: 8px;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.2);
}

.detail-chart svg {
  display: block;
}

/* Interaction section */
.detail-interaction-box {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  background: rgba(0, 212, 255, 0.04);
  border: 1px solid rgba(0, 212, 255, 0.1);
  border-radius: 10px;
  padding: 16px 18px;
}

.detail-interaction-icon {
  width: 32px;
  height: 32px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--blue);
  opacity: 0.7;
  margin-top: 1px;
}

.detail-interaction-box p {
  font-size: 13px;
  line-height: 1.65;
  color: rgba(255, 255, 255, 0.5);
  font-weight: 300;
  max-width: none;
}

/* Stats strip */
.detail-stats {
  display: flex;
  flex-wrap: wrap;
  gap: 20px;
}

.detail-stat {
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.detail-stat-value {
  font-family: 'Space Grotesk', monospace;
  font-size: 20px;
  font-weight: 400;
  color: var(--blue);
  line-height: 1;
}

.detail-stat-label {
  font-size: 9px;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.25);
}
