/* React interface layer for Waft Wave.
   The existing DigiPRO editor/MIDI/data modules still mount into the same panel target. */

#waft-react-root {
  min-height: 100%;
}

.waft-react-topbar .brand {
  min-width: min(420px, 46vw);
}

.waft-react-main {
  max-width: 1680px;
}

.modal-grid-full {
  grid-column: 1 / -1;
}

.modal-inline-label {
  gap: 6px;
  align-items: center;
}

.modal-help-text {
  margin-top: 10px;
}

.modal-details-field {
  margin-top: 10px;
}

.midi-health-card {
  display: grid;
  gap: 10px;
  margin-bottom: 12px;
  padding: 12px;
  border: 1px solid rgba(76, 201, 240, 0.2);
  border-radius: 12px;
  background: rgba(76, 201, 240, 0.045);
}

.midi-health-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.midi-health-kicker {
  display: block;
  color: var(--muted);
  font-size: 9px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.midi-health-heading h3 {
  margin: 2px 0 0;
  font-size: 14px;
}

.midi-health-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 6px;
}

.midi-health-item {
  position: relative;
  min-width: 0;
  padding: 8px 8px 8px 24px;
  border: 1px solid rgba(230, 237, 243, 0.08);
  border-radius: 8px;
  background: rgba(0, 0, 0, 0.14);
}

.midi-health-item::before {
  content: '';
  position: absolute;
  top: 12px;
  left: 9px;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--faint);
  box-shadow: 0 0 0 3px rgba(107, 119, 133, 0.12);
}

.midi-health-item[data-state="ok"]::before {
  background: var(--ok);
  box-shadow: 0 0 0 3px rgba(82, 255, 168, 0.12);
}

.midi-health-item[data-state="warn"]::before {
  background: var(--warn);
  box-shadow: 0 0 0 3px rgba(251, 191, 36, 0.12);
}

.midi-health-item[data-state="bad"]::before {
  background: var(--danger);
  box-shadow: 0 0 0 3px rgba(255, 92, 122, 0.12);
}

.midi-health-item span,
.midi-health-item strong {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.midi-health-item span {
  color: var(--muted);
  font-size: 9px;
  text-transform: uppercase;
}

.midi-health-item strong {
  margin-top: 3px;
  color: var(--text);
  font-size: 10px;
}

.midi-mode-switch {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 6px;
}

.midi-mode-switch .btn {
  width: 100%;
}

.midi-mode-switch .btn[aria-pressed="true"] {
  border-color: rgba(76, 201, 240, 0.55);
  background: rgba(76, 201, 240, 0.15);
  color: var(--text);
}

.midi-speed-row {
  flex-wrap: nowrap;
}

.midi-device-setup {
  margin-bottom: 2px;
}

.modal-first-paragraph {
  margin-top: 0;
}

.about-license {
  margin: 10px 0 0;
}

.about-list {
  margin: 10px 0 0;
  padding-left: 18px;
}

.about-support-panel {
  margin-top: 14px;
  padding: 0;
  overflow: hidden;
  border-color: rgba(76, 201, 240, 0.22);
  background: rgba(76, 201, 240, 0.04);
}

.about-support-panel > summary {
  display: flex;
  min-height: 48px;
  align-items: center;
  justify-content: space-between;
  padding: 9px 11px;
  list-style: none;
}

.about-support-panel > summary::-webkit-details-marker {
  display: none;
}

.about-support-panel > summary::after {
  display: grid;
  width: 22px;
  height: 22px;
  flex: 0 0 auto;
  place-items: center;
  border: 1px solid var(--border-strong);
  border-radius: 999px;
  color: var(--muted);
  content: "+";
  font-size: 16px;
  line-height: 1;
}

.about-support-panel[open] > summary {
  border-bottom: 1px solid var(--border);
}

.about-support-panel[open] > summary::after {
  content: "−";
}

.about-support-panel > summary > span {
  display: grid;
  gap: 2px;
}

.about-support-panel > summary strong {
  font-size: 13px;
}

.about-support-panel > summary small,
.about-support-panel-content > p {
  color: var(--muted);
  font-size: 11px;
}

.about-support-panel-content {
  display: grid;
  gap: 10px;
  padding: 10px;
}

.about-support-panel-content > p {
  margin: 0;
  line-height: 1.45;
}

.about-kofi-frame {
  display: block;
  width: 100%;
  height: min(600px, 62vh);
  border: 0;
  border-radius: 8px;
  background: #f9f9f9;
}

.ww-3d-panel {
  margin: 0 12px 12px;
  border: 1px solid rgba(230, 237, 243, 0.10);
  border-radius: 14px;
  overflow: hidden;
  background:
    radial-gradient(circle at 18% 12%, rgba(76, 201, 240, 0.11), transparent 34%),
    linear-gradient(180deg, rgba(18, 28, 40, 0.78), rgba(6, 12, 10, 0.96));
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.035), 0 18px 60px rgba(0, 0, 0, 0.18);
}

.ww-3d-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 12px;
  border-bottom: 1px solid rgba(230, 237, 243, 0.08);
}

.ww-3d-panel.is-collapsed .ww-3d-header {
  border-bottom: 0;
}

.ww-3d-titleblock {
  min-width: 180px;
}

.ww-3d-kicker {
  color: rgba(139, 233, 253, 0.78);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.ww-3d-titleblock h2 {
  margin: 2px 0 0;
  font-size: 18px;
  line-height: 1.15;
}

.ww-3d-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  flex-wrap: wrap;
  gap: 8px;
}

.ww-3d-body {
  padding: 12px;
}

.ww-3d-canvas {
  display: block;
  width: 100%;
  min-height: clamp(420px, 52vh, 680px);
  border: 1px solid rgba(112, 255, 190, 0.12);
  border-radius: 12px;
  background: #030907;
  cursor: grab;
  touch-action: none;
}

.ww-3d-canvas:active {
  cursor: grabbing;
}

.ww-3d-controls {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  margin-top: 10px;
}

.ww-3d-controls label {
  display: grid;
  gap: 6px;
  min-width: 0;
  padding: 8px 10px;
  border: 1px solid rgba(230, 237, 243, 0.08);
  border-radius: 12px;
  background: rgba(230, 237, 243, 0.035);
}

.ww-3d-controls span {
  font-size: 11px;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.ww-3d-controls input[type="range"] {
  width: 100%;
  padding: 0;
}

.ww-3d-help {
  margin-top: 8px;
}

@media (max-width: 800px) {
  .waft-react-topbar {
    align-items: flex-start;
    flex-direction: column;
  }

  .waft-react-topbar .brand {
    min-width: 0;
  }

  .top-actions {
    justify-content: flex-start;
    width: 100%;
  }

  .pill {
    max-width: 100%;
  }

  .ww-3d-header {
    align-items: flex-start;
    flex-direction: column;
  }

  .ww-3d-actions {
    justify-content: flex-start;
    width: 100%;
  }

  .ww-3d-controls {
    grid-template-columns: 1fr;
  }

  .midi-health-heading {
    align-items: flex-start;
  }

  .midi-health-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .midi-speed-row {
    align-items: stretch;
    flex-direction: column;
  }

  .midi-speed-row .turbo-slider {
    width: 100%;
    max-width: none;
  }

  #midiModal .modal-footer {
    position: sticky;
    bottom: -12px;
    z-index: 3;
    margin-right: -12px;
    margin-left: -12px;
    padding: 10px 12px 12px;
    border-top: 1px solid var(--border);
    background: rgba(15, 22, 32, 0.97);
  }

  #midiModal .modal-footer .btn {
    flex: 1 1 140px;
  }
}
