/* Pixelhue device panel — copy of Pixelflow/Unico 2.5's chassis schematic.
 *
 * Class names, dimensions, colors, and chassis ventilation-slot SVG backgrounds
 * are lifted from the Pixelflow source at
 *   NovaStar-Main/crates/pixelhue/pixelflow-app/cube/src/pages/devices/components/
 * and verified against the production bundle CSS at
 *   NovaStar-Main/crates/pixelhue/pixelflow-app/app/web/unicos/static/main-*.css
 *
 * The chassis renders in the neutral "no signal" state because there's no live
 * device behind a marketing site. Click any port for capability popover via
 * pixelhue-panel.js.
 */

/* ----- Outer wrapper -------------------------------------------------- */

.pxh-panel {
  --pxh-bg: #2a2f3a;
  --pxh-text: #d4dbef;
  --pxh-muted: rgba(212, 219, 239, 0.5);
  background: var(--pxh-bg);
  border-radius: 10px;
  padding: 18px;
  margin: 30px 0 10px;
  color: var(--pxh-text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  position: relative;
}

.pxh-panel-title {
  color: #fff;
  font-size: 1.05rem;
  margin: 0 0 12px;
  padding: 0 6px;
  font-weight: 600;
}

/* Horizontal scroll wrapper for narrow viewports. The chassis stays at its
   real desktop pixel size so the layout doesn't reshuffle on mobile — users
   just swipe horizontally to pan, with a fade hint on the right edge when
   there's content off-screen. */
.pxh-panel-scroll {
  overflow-x: auto;
  overflow-y: visible;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: thin;
  scrollbar-color: rgba(255, 255, 255, 0.2) transparent;
  /* Right-edge fade — visual cue there's more to scroll on small viewports. */
  mask-image: linear-gradient(to right, #000 0%, #000 calc(100% - 24px), transparent 100%);
  -webkit-mask-image: linear-gradient(to right, #000 0%, #000 calc(100% - 24px), transparent 100%);
}
.pxh-panel-scroll::-webkit-scrollbar { height: 6px; }
.pxh-panel-scroll::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.2);
  border-radius: 3px;
}
/* When chassis fits the viewport, drop the fade so it doesn't look weird. */
@media (min-width: 1024px) {
  .pxh-panel-scroll { mask-image: none; -webkit-mask-image: none; }
}

/* ----- Chassis frame -------------------------------------------------- */

/* Outer frame — navy with Pixelflow's signature blue glow */
.device-panel {
  background: linear-gradient(180deg, #1d3656 0%, #0c1f3a 100%);
  border: 1px solid #3d6ab0;
  border-radius: 10px;
  padding: 10px;
  width: max-content;
  /* No max-width: 100% — that constrains the frame to viewport while inner
     chassis content overflows, drawing a truncated blue box. Let the frame
     match its real content width and let .pxh-panel-scroll handle overflow. */
  box-shadow:
    0 0 0 1px rgba(61, 106, 176, 0.4),
    0 0 18px rgba(74, 145, 230, 0.35),
    inset 0 1px 0 rgba(255, 255, 255, 0.06);
  position: relative;
}

.device-panel-title {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 4px 10px 8px;
  font-size: .82rem;
  font-weight: 600;
  color: #fff;
}
.device-panel-title::before {
  content: "";
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #36c75c;
  box-shadow: 0 0 6px rgba(54, 199, 92, 0.7);
}

.device-panel-middle {
  background: #323b4b;
  border-radius: 4px;
  padding: 0;
}

/* ----- N20/P20 body --------------------------------------------------- */

.N20-content {
  display: flex;
  background-color: #323b4b;
  border-radius: 4px;
}
.N20-content .left-wrapper {
  display: flex;
  flex-direction: column;
  width: 410px;
  flex-shrink: 0;
}
.N20-content .left-wrapper .interface-group {
  min-width: 0;
  flex: 1;
  padding: 0 4px;
}
.N20-content .right-wrapper {
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
  width: 540px;  /* fits OPT(236) + AUDIO(100) + POWER(139) + 65px slack */
}
.N20-content .right-wrapper .slot-top,
.N20-content .right-wrapper .slot-middle,
.N20-content .right-wrapper .slot-bottom {
  justify-content: space-between;
}

/* Horizontal strips — uniform height so all 3 input rows line up. Inside the
   right-wrapper the slots have their own fixed widths (n20-opt-group: 236px,
   n20-audio: 100px, power: 139px), so the right-wrapper sizes naturally to
   ~475px and slots sit flush against each other. */
.N20-content .slot-top,
.N20-content .slot-middle,
.N20-content .slot-bottom {
  display: flex;
  justify-content: flex-start;
  height: 78px;
  border: 1px solid #000;
  border-radius: 2px;
  position: relative;
}
/* Inside the left-wrapper, space the 4 input slots evenly across the 431px */
.N20-content .left-wrapper .slot-top,
.N20-content .left-wrapper .slot-middle,
.N20-content .left-wrapper .slot-bottom {
  justify-content: space-between;
}

/* ----- Slot (interface-group) ---------------------------------------- */

.interface-group {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  min-width: 107px;
  padding: 0 13px;
  cursor: pointer;
  background-repeat: no-repeat;
  background-position: center bottom 6px;
  position: relative;
  transition: background-color .12s;
}
.interface-group:hover {
  background-color: rgba(26, 145, 250, 0.15);
  box-shadow: inset 0 0 0 2px #6db9fc;
  z-index: 1;
}
.interface-group-no-padding { padding: 0; }
.interface-group-have-border {
  border-right: 2px solid #000;
  border-left: 2px solid #000;
}
.interface-group .title {
  flex: 0 0 auto;
  align-self: center;
}
.interface-group .content {
  display: flex;
  flex: 1;
  align-items: center;
  justify-content: space-around;
}

/* Slot title — hanging tab from top, rounded-bottom (InterfaceTitle styled-component) */
.interface-title {
  height: 16px;
  font-size: 11px;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.18);
  border-radius: 0 0 8px 8px;
  display: flex;
  justify-content: center;
  align-items: center;
  font-weight: 600;
  padding: 0 9px;
  color: rgba(255, 255, 255, 0.95);
  white-space: nowrap;
  text-transform: uppercase;
  letter-spacing: .04em;
}
.interface-title.t-input   { background: #42AB6C; margin-left: -9px; padding: 0 9px; }
.interface-title.t-output  { background: #3D75E1; padding: 0 4.5px; }
.interface-title.t-aux     { background: #3D75E1; padding: 0 12px; }
.interface-title.t-mvr     { background: #3D75E1; padding: 0 8px; }
.interface-title.t-opt     { background: #3D75E1; padding: 0 20px; }
.interface-title.t-audio   { background: #3D75E1; padding: 0 13px; }
.interface-title.t-main    { background: #D5BC27; color: #000; padding: 0 8px; }

/* ----- Per-slot chassis SVG backgrounds (the ventilation slots) ------- */

.N20-content .slot-top .n20-sdi-interface-group {
  /* Chassis vent decoration removed — read cleaner without the slot SVG bg. */
}
.N20-content .slot-middle .output-interface-group {
  background-image: url("/panel-icons/chassis/output-slot.svg");
  background-position: center bottom 8px;
}
.N20-content .n20-interface-group {
  /* No chassis-decoration vents — the port row + labels read cleaner without. */
}

/* Input mode indicator — sits between DP and HDMI ports. 2 stacked LEDs
   with arrows pointing to the active source (DP left, HDMI right). On the
   real device only ONE LED is lit at a time (whichever port is selected).
   Since we have no live signal, both LEDs render as dim "idle". */
.input-mode-indicator {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  align-self: center;
  padding: 0 2px;
  margin-top: -10px;  /* align with the port row, not the labels */
}
.mode-row {
  display: flex;
  align-items: center;
  gap: 2px;
}
.mode-led {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: radial-gradient(circle at 30% 30%, #2a5f3a 0%, #0d1f15 70%);
  box-shadow: inset 0 0 1px rgba(255, 255, 255, 0.2);
}
.mode-arrow {
  width: 0;
  height: 0;
  border-top: 3px solid transparent;
  border-bottom: 3px solid transparent;
  opacity: 0.55;
}
.mode-arrow-left  { border-right: 4px solid rgba(255, 255, 255, 0.7); }
.mode-arrow-right { border-left:  4px solid rgba(255, 255, 255, 0.7); }
.N20-content .slot-bottom .mvr-slot,
.N20-content .slot-bottom .aux-slot,
.N20-content .slot-bottom .control-slot {
  /* Chassis vent decoration removed for a cleaner read. */
}
.N20-content .slot-bottom .control-slot .title { width: 74px; }

/* AUX slot — N ports with number above and per-port label below */
.aux-content {
  display: flex !important;
  flex-direction: row;
  align-items: center !important;
  justify-content: space-around;
  width: 100%;
  gap: 6px;
  padding: 2px 4px;
}
.content-interface-group.port-with-num-label {
  flex-direction: column;
  gap: 1px;
  justify-content: center;
  align-items: center;
  flex: 0 0 auto;
  min-width: 30px;
}
.content-interface-group.port-with-num-label > .port-label {
  margin-top: 1px;
}
/* P10 OUTPUT slot needs more room because it has 4 ports per slot (1 HDMI 2.0 + 3 HDMI 1.3) */
.p10-output {
  min-width: 180px !important;
  padding: 0 8px !important;
}
.p10-output .aux-content { gap: 4px; }

/* ----- P10-specific slot styles ----- */

/* SDI inputs on P10: 2 BNC stacked vertically (IN + LOOP) with label below */
.p10-sdi-slot { min-width: 60px; padding: 0 4px !important; }
.p10-sdi-content {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  flex: 1;
  gap: 2px;
  padding-bottom: 4px;
}
.p10-sdi-stack {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
}
.p10-sdi-txt {
  font-size: 8px;
  color: rgba(255, 255, 255, 0.5);
  letter-spacing: -.02em;
  white-space: nowrap;
}

/* AUDIO on P10: LINE IN/OUT title ABOVE the ports, ports stacked vertically */
.p10-audio-slot { min-width: 110px; padding: 0 6px !important; }
.p10-audio-content {
  display: flex !important;
  flex-direction: row !important;
  align-items: flex-start !important;
  justify-content: space-around !important;
  width: 100%;
  gap: 6px;
  padding: 2px 4px;
}
.p10-audio-col {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
}
.p10-audio-col-title {
  font-size: 9px;
  color: rgba(255, 255, 255, 0.6);
  white-space: nowrap;
  margin-bottom: 1px;
  font-weight: 500;
}
.p10-audio-port-row {
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 3px;
}
.p10-audio-num {
  font-size: 9px;
  color: rgba(255, 255, 255, 0.65);
  font-variant-numeric: tabular-nums;
}

/* P10 power slot — just an IEC inlet, narrower than P20's switch+inlet */
.p10-power-slot { width: 60px !important; }

/* P10 ETHERNET stack within CONTROL — same layout as DANTE on P20-DS */
.p10-eth-stack {
  display: flex !important;
  flex-direction: column !important;
  align-items: center !important;
  justify-content: center;
  gap: 4px;
}
.p10-eth-stack .control-sub-label {
  margin-top: 2px;
}

/* DANTE slot — 2 RJ45 stacked vertically, index number to the right of each */
.dante-content {
  display: flex !important;
  flex-direction: column !important;
  align-items: center !important;
  justify-content: center !important;
  gap: 4px;
  padding: 4px 6px;
}
.dante-port-row {
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 4px;
}
.dante-port-num {
  font-size: 10px;
  color: rgba(255, 255, 255, 0.7);
  font-variant-numeric: tabular-nums;
  line-height: 1;
}

/* CONTROL slot — ETHERNET group + GENLOCK group side by side */
.control-content {
  display: flex !important;
  flex-direction: row;
  align-items: center !important;
  justify-content: space-around;
  gap: 8px;
  width: 100%;
  padding: 4px 6px;
}
.control-sub {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
}
.control-sub-ports {
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 4px;
}
.control-sub-label {
  font-size: 9px;
  color: rgba(255, 255, 255, 0.55);
  letter-spacing: .04em;
  line-height: 1;
  text-align: center;
  white-space: nowrap;
  width: max-content;
}

/* ----- INPUT SDI slot (slot-top inputs 9-12) — "IN-12G-SDI-LOOP" text + 2 BNC ports */

.slot-3-content {
  position: relative;
  color: rgba(255, 255, 255, 0.9);
  font-size: 12px;
  padding-bottom: 8px;
  display: flex;
  flex: 1;
  align-items: center;
  justify-content: space-around;
}
.slot-3-content .n20-sdi-txt {
  position: absolute;
  bottom: 0;
  width: max-content;
  max-width: 100%;
  transform: scale(.75);
  transform-origin: center bottom;
  color: rgba(255, 255, 255, 0.5);
  opacity: 1;
  text-align: center;
  left: 50%;
  translate: -50% 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: clip;
}
/* Don't let the absolutely-positioned label leak into neighboring slots */
.interface-group.n20-sdi-interface-group { overflow: hidden; }

/* ----- OUTPUT slot — 2x HDMI 2.0 numbered with "HDMI 2.0" label */

.content-interface-group {
  position: relative;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
}
.content-interface-group.port-with-label {
  flex-direction: column;
  gap: 2px;
  justify-content: center;
}
.port-label {
  font-size: 9px;
  color: rgba(255, 255, 255, 0.65);
  letter-spacing: .02em;
  text-align: center;
  white-space: nowrap;
  line-height: 1;
}
/* Output ports: number sits ABOVE the port, "HDMI 2.0" label centered BELOW
   both ports across the slot (not under each individual port). */
.content-interface-group.port-with-num {
  flex-direction: column;
  gap: 2px;
  justify-content: center;
}
.port-num {
  font-size: 9px;
  color: rgba(255, 255, 255, 0.55);
  line-height: 1;
  font-variant-numeric: tabular-nums;
}
.output-content {
  display: grid !important;
  grid-template-columns: 1fr 1fr;
  grid-template-rows: 1fr auto;
  align-items: center !important;
  justify-items: center;
  width: 100%;
  padding: 4px 6px 2px;
  gap: 0 6px;
}
.output-type-label {
  grid-column: 1 / -1;
  font-size: 9px;
  color: rgba(255, 255, 255, 0.55);
  text-align: center;
  letter-spacing: .04em;
  line-height: 1;
  margin-top: 2px;
}
.interface-order {
  position: absolute;
  bottom: 33px;
  right: 0;
  color: rgba(255, 255, 255, 0.5);
  font-size: 12px;
  transform: scale(.75);
}
.interface-order-n20 {
  bottom: 30px;
  right: 5px;
}
.n20-interface-type {
  position: absolute;
  font-size: 12px;
  transform: scale(.75);
  color: rgba(255, 255, 255, 0.5);
  bottom: 0;
  left: 50%;
  margin-left: -30px;
  display: flex;
  align-items: center;
  gap: 2px;
  white-space: nowrap;
}
.n20-interface-type .output-interface-type { padding: 0 4px; }
.n20-interface-type .output-left-border,
.n20-interface-type .output-right-border {
  width: 7px;
  height: 12px;
  display: inline-block;
}
.n20-interface-type .output-left-border  { border-left: 1px solid rgba(255,255,255,.5); border-bottom: 1px solid rgba(255,255,255,.5); border-radius: 0 0 0 4px; }
.n20-interface-type .output-right-border { border-right: 1px solid rgba(255,255,255,.5); border-bottom: 1px solid rgba(255,255,255,.5); border-radius: 0 0 4px 0; }

/* ----- OPT slot (8 fiber ports in 2×4 grid) -------------------------- */

.n20-opt-group {
  width: 236px;
  height: 100%;
  border-right: 2px solid #000;
}
.n20-opt-group .OPT { height: 100%; }
.n20-opt-group .OPT .content {
  padding-bottom: 12px;
  display: flex;
  flex-direction: column !important;
  flex-wrap: wrap !important;
  align-items: flex-start !important;
  height: 66px !important;
}
.opt-port {
  display: flex;
  flex-direction: column;
  height: 100%;
  justify-content: space-evenly;
  margin-left: 9px;
}
.opt-port:first-child { margin-left: 0; }
.opt-port-item {
  display: flex;
  flex-direction: row-reverse;
  height: 100%;
  justify-content: center;
  align-items: center;
  flex: 1;
  position: relative;
}
.opt-port-item-order {
  margin-top: 4px;
  margin-left: 5px;
  font-size: 12px;
  transform: scale(.75);
  color: #fff;
  opacity: .5;
}

/* ----- AUDIO slot (2x LINE IN vertical + 2x LINE OUT vertical) ------- */

.n20-audio {
  width: 100px;
  border-left: 1px solid #000;
  border-right: 1px solid #000;
  display: flex;
  flex-direction: column;
  align-items: center;
  flex-shrink: 0;
}
.n20-audio-title {
  height: 17px;
  width: 62px;
  font-size: 12px;
  border-radius: 0 0 8px 8px;
  background-color: #3d75e1;
  color: #fff;
  text-align: center;
  margin-left: 17px;
  display: flex;
  align-items: center;
  justify-content: center;
  align-self: flex-start;
}
.n20-audio-interface {
  display: flex;
  height: 76px;
  justify-content: flex-end;
  color: #fff;
  gap: 6px;
  padding: 0 4px;
}
.n20-audio-interface-in,
.n20-audio-interface-out {
  display: flex;
  flex-direction: column;
  margin-top: 15px;
}
.n20-audio-interface-item {
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
}
.n20-audio-interface-item:last-child { margin-top: 6px; }
.n20-audio-interface-item-order {
  font-size: 12px;
  transform: scale(.75);
  opacity: .5;
  position: absolute;
  right: 0;
  top: 2px;
  color: #fff;
}
.n20-audio-interface-out .n20-audio-interface-item-order { right: 6px; }
.n20-audio-interface-title {
  font-size: 11px;
  opacity: .72;
  color: #fff;
  text-align: center;
  margin-top: 2px;
  white-space: nowrap;
  letter-spacing: -.02em;
  /* Allow horizontal overflow so "LINE IN" / "LINE OUT" stay on one line
     even if the column is narrower than the text width. */
  overflow: visible;
  width: max-content;
  align-self: center;
}

/* ----- POWER slot ---------------------------------------------------- */

.N20-content .power {
  width: 92px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.power-content {
  display: flex !important;
  flex-direction: column !important;
  align-items: center !important;
  justify-content: center !important;
  gap: 4px;
  padding-top: 4px;
  padding-bottom: 4px;
}
/* Rocker switch: black housing with white rocker showing "ON | O OFF" */
.power-switch {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  background: #0a0c10;
  border: 1px solid #2a2f3a;
  border-radius: 2px;
  padding: 1px 3px;
  font-size: 7px;
  font-weight: 700;
  color: rgba(255, 255, 255, 0.75);
  letter-spacing: .04em;
  line-height: 1;
}
.power-switch-label { line-height: 1; }
.power-switch-rocker {
  display: inline-block;
  width: 6px;
  height: 9px;
  background: linear-gradient(180deg, #d4d8e0 0%, #8b8f99 100%);
  border: 1px solid #1a1c22;
  border-radius: 1px;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.5);
}

/* ----- CONTROL slot — ETHERNET + GENLOCK ----------------------------- */

.internet-port {
  position: relative;
  display: flex;
  justify-content: space-between;
  align-items: center;
  width: 98px;
  margin-bottom: 13px;
  margin-top: 4px;
  gap: 4px;
}
.internet-port-eth {
  position: relative;
  font-size: 12px;
  color: rgba(255, 255, 255, 0.9);
  transform: scale(.75);
  opacity: .7;
  margin-top: 2px;
  text-align: center;
  width: 100%;
  display: block;
}
.internet-port .order-left,
.internet-port .order-right {
  position: absolute;
  top: -14px;
  font-size: 12px;
  transform: scale(.75);
  opacity: .5;
  color: #fff;
}
.internet-port .order-left { right: 64px; }
.internet-port .order-right { right: 16px; }

.n-genlock-interface-group {
  position: relative;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: space-evenly;
  width: 80px;
  margin-bottom: 6px;
}
.n-genlock-interface-group .n-genlock-interface-txt {
  text-align: center;
  width: 120px;
  color: #fff;
  font-size: 12px;
  transform: scale(.75);
  position: absolute;
  bottom: -8px;
  opacity: .5;
  left: -20px;
}

/* ----- InterfaceComponent (the port atom) ---------------------------- */

.cube-interface-base {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.interface-component {
  display: inline-block;
  background-repeat: no-repeat;
  background-position: center;
  background-size: contain;
  border: 1px solid transparent;
  border-radius: 3px;
  cursor: pointer;
  transition: transform .12s, filter .12s;
  position: relative;
  outline: none;
  background-color: transparent;
  margin: 0;
  padding: 0;
}
.interface-component:hover {
  transform: translateY(-1px);
  filter: drop-shadow(0 0 4px rgba(255, 215, 0, 0.6));
}
.interface-component:focus-visible {
  outline: 2px solid #ffd700;
  outline-offset: 2px;
}
.interface-component[aria-expanded="true"] {
  filter: drop-shadow(0 0 6px rgba(255, 215, 0, 0.8));
}

.ic-hdmi { width: 36px; height: 14px; background-image: url("/panel-icons/hdmi.svg"); }
.ic-dp   { width: 38px; height: 14px; background-image: url("/panel-icons/dp.svg"); }
.ic-sdi  { width: 22px; height: 24px; background-image: url("/panel-icons/sdi.svg"); }
.ic-opt  { width: 28px; height: 19px; background-image: url("/panel-icons/opt.svg"); }
.ic-eth  { width: 26px; height: 19px; background-image: url("/panel-icons/eth.svg"); }
.ic-audio { width: 14px; height: 14px; background-image: url("/panel-icons/audio.svg"); }
.ic-power { width: 36px; height: 24px; background-image: url("/panel-icons/power.svg"); }
.ic-fastethernet { width: 30px; height: 30px; background-image: url("/panel-icons/fastethernet.svg"); }

/* OPT cards specifically size their interface-component */
.opt-port-item .interface-component {
  width: 28px;
  height: 19px;
}
.N20-content .Input .content .interface-component,
.N20-content .MVR .content .interface-component,
.N20-content .AUX .content .interface-component,
.N20-content .Output .content .interface-component {
  margin-bottom: 6px;
}

/* ----- Popover ------------------------------------------------------- */

/* Popover is appended to document.body as position:fixed (set by JS) so it's
   not clipped by .pxh-panel's overflow-x. */
.pxh-popover {
  position: fixed;
  z-index: 10000;
  background: #1a1c22;
  border: 1px solid rgba(255, 215, 0, 0.4);
  border-radius: 8px;
  padding: 14px 16px;
  min-width: 240px;
  max-width: 320px;
  color: #fff;
  font-size: .85rem;
  line-height: 1.45;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.6);
  pointer-events: auto;
  animation: pxhFade .12s ease-out;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}
@keyframes pxhFade {
  from { opacity: 0; transform: translateY(-4px); }
  to   { opacity: 1; transform: translateY(0); }
}
.pxh-popover h4 {
  color: #ffd700;
  margin: 0 0 6px;
  font-size: .92rem;
  font-weight: 700;
}
.pxh-popover .pxh-popover-sub {
  color: rgba(255, 255, 255, 0.65);
  font-size: .72rem;
  margin: 0 0 10px;
  letter-spacing: .04em;
  text-transform: uppercase;
}
.pxh-popover ul { list-style: none; padding: 0; margin: 0 0 8px; }
.pxh-popover li {
  padding: 3px 0;
  color: rgba(255, 255, 255, 0.85);
  font-size: .82rem;
}
.pxh-popover li::before {
  content: "▸ ";
  color: #ffd700;
  margin-right: 4px;
}
.pxh-popover-close {
  position: absolute;
  top: 6px; right: 8px;
  background: transparent;
  border: 0;
  color: rgba(255, 255, 255, 0.5);
  cursor: pointer;
  font-size: 1rem;
  padding: 4px 6px;
  line-height: 1;
}
.pxh-popover-close:hover { color: #fff; }

/* ----- Q8 vertical card-slot configurator ----- */

/* Bay rows: inputs (6 bays) on top, outputs (4 bays) below. Each row
   uses flex so bays fill available width. No horizontal overflow. */
.q8v-bay-row {
  display: flex;
  gap: 4px;
  padding: 4px 4px 0;
}
.q8v-input-row { /* 6 input bays */ }
.q8v-output-row { padding-top: 0; }

/* Individual card bay — tall, narrow vertical slot. Click to cycle cards. */
.q8v-slot {
  flex: 1;
  min-width: 80px;
  background: #0a1220;
  border: 1px solid #1c2c44;
  border-radius: 4px;
  display: flex;
  flex-direction: column;
  min-height: 280px;
  transition: border-color .12s, background-color .12s;
  cursor: pointer;
  user-select: none;
  position: relative;
}
.q8v-slot:hover { border-color: rgba(93, 173, 226, 0.6); background: #0d1628; }
.q8v-slot-empty { border-style: dashed; }
.q8v-slot-empty:hover { border-color: rgba(31, 142, 74, 0.7); }

/* Slot title chip — green for input, blue for output */
.q8v-title {
  font-size: .65rem;
  font-weight: 700;
  text-align: center;
  color: #fff;
  padding: 3px 4px;
  letter-spacing: .04em;
  text-transform: uppercase;
  border-radius: 0 0 6px 6px;
  margin: 0 auto;
  width: 80%;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.18);
}
.q8v-title-input { background: #1f8e4a; }
.q8v-title-output { background: #2b6cd4; }

/* Card name label — small chip showing which card is installed */
.q8v-card-name {
  font-size: .58rem;
  color: rgba(255, 255, 255, 0.7);
  text-align: center;
  padding: 4px 4px 2px;
  line-height: 1.2;
  word-break: break-word;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

/* Port stack — vertical column of port groups inside each bay */
.q8v-port-stack {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 6px 2px;
}
.q8v-pgrp {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
}
.q8v-prow {
  display: flex;
  flex-wrap: wrap;
  gap: 2px;
  justify-content: center;
}
.q8v-prow .interface-component {
  width: 18px;
  height: 10px;
}
.q8v-plabel {
  font-size: .52rem;
  color: rgba(255, 255, 255, 0.4);
  text-align: center;
  line-height: 1.1;
  white-space: nowrap;
}

/* Empty bay — dashed border + plus icon + "Click to add" */
.q8v-empty-bay {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  color: rgba(255, 255, 255, 0.25);
  font-size: .75rem;
  gap: 6px;
  padding: 12px 8px;
  text-align: center;
}
.q8v-plus {
  font-size: 2rem;
  line-height: 1;
  color: rgba(255, 255, 255, 0.18);
  transition: color .12s;
}
.q8v-slot-empty:hover .q8v-plus { color: rgba(31, 142, 74, 0.8); }
.q8v-add-text { font-size: .72rem; }
.q8v-change-hint {
  font-size: .58rem;
  color: rgba(255, 255, 255, 0.2);
  text-align: center;
  padding: 2px 0 4px;
  transition: color .12s;
}
.q8v-slot-filled:hover .q8v-change-hint { color: rgba(93, 173, 226, 0.7); }

/* Card picker popup — appears below the clicked slot */
.q8v-picker {
  background: #1a1e2a;
  border: 1px solid rgba(93, 173, 226, 0.6);
  border-radius: 8px;
  padding: 8px 0;
  min-width: 260px;
  max-width: 340px;
  box-shadow: 0 8px 28px rgba(0, 0, 0, 0.6);
  animation: pxhFade .12s ease-out;
  max-height: 400px;
  overflow-y: auto;
}
.q8v-picker-title {
  font-size: .78rem;
  font-weight: 600;
  color: #fff;
  padding: 6px 14px 8px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}
.q8v-picker-opt {
  display: flex;
  flex-direction: column;
  width: 100%;
  text-align: left;
  padding: 10px 14px;
  background: transparent;
  border: 0;
  color: #d4dbef;
  cursor: pointer;
  font-size: .82rem;
  transition: background .1s;
  border-bottom: 1px solid rgba(255, 255, 255, 0.04);
}
.q8v-picker-opt:hover { background: rgba(93, 173, 226, 0.15); }
.q8v-picker-opt-active {
  background: rgba(31, 142, 74, 0.2);
  border-left: 3px solid #1f8e4a;
}
.q8v-picker-name { font-weight: 600; }
.q8v-picker-ports {
  font-size: .72rem;
  color: rgba(255, 255, 255, 0.5);
  margin-top: 2px;
}

/* Control card section below the 10 bays */
.q8v-control {
  background: #0f1825;
  border: 1px solid #1c2c44;
  border-radius: 4px;
  margin: 4px 4px 0;
  padding: 10px 14px;
}
.q8v-ctrl-title {
  font-size: .72rem;
  font-weight: 700;
  color: #d5bc27;
  text-transform: uppercase;
  letter-spacing: .06em;
  margin-bottom: 8px;
}
.q8v-ctrl-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 16px;
}
.q8v-ctrl-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.q8v-chip {
  display: inline-block;
  background: #1c2c44;
  color: #5dade2;
  font-size: .68rem;
  font-weight: 600;
  padding: 3px 8px;
  border-radius: 3px;
  letter-spacing: .03em;
}

/* Actions row */
.q8v-actions {
  margin-top: 10px;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}
.q8v-actions .btn-solid,
.q8v-actions .btn-outline {
  font-size: .88rem;
  padding: 8px 18px;
}

/* Configuration summary */
.q8v-summary {
  background: #0f1825;
  border: 1px solid #1c2c44;
  border-radius: 4px;
  margin: 4px 4px 0;
  padding: 14px;
}
.q8v-summary-header {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-bottom: 8px;
}
.q8v-summary-header h4 {
  color: #fff;
  font-size: .95rem;
  margin: 0;
}
.q8v-slot-count {
  font-size: .78rem;
  color: rgba(255, 255, 255, 0.5);
}
.q8v-summary-io {
  color: #5dade2;
  font-size: .88rem;
  line-height: 1.5;
  margin: 0 0 4px;
  font-weight: 500;
}
.q8v-summary-ctrl {
  font-size: .78rem;
  color: rgba(255, 255, 255, 0.45);
  margin: 0;
}

/* Mobile: drop the outer card styling so the chassis isn't visually
   constrained by a too-narrow border. Title sits in the article column
   like a normal heading; the chassis scrolls full-bleed below it. */
@media (max-width: 820px) {
  .pxh-panel {
    background: transparent;
    padding: 0;
    margin: 24px 0 10px;
    border-radius: 0;
  }
  .pxh-panel-title {
    color: var(--color-text, #2a2f3a);
    font-size: 1rem;
    padding: 0;
    margin-bottom: 10px;
  }
  /* Full-bleed scroll: extend beyond the article column gutters so the
     chassis has more room before it has to scroll. */
  .pxh-panel-scroll {
    margin-left: calc(50% - 50vw);
    margin-right: calc(50% - 50vw);
    padding: 14px 16px;
    background: #2a2f3a;
    border-radius: 0;
    /* Right-edge fade still shows it's scrollable */
    mask-image: linear-gradient(to right, transparent 0%, #000 12px, #000 calc(100% - 18px), transparent 100%);
    -webkit-mask-image: linear-gradient(to right, transparent 0%, #000 12px, #000 calc(100% - 18px), transparent 100%);
  }
  /* Keep the blue chassis frame — it just needs to render at its REAL
     content width (not constrained to phone width), which is handled by
     dropping `max-width: 100%` in the base .device-panel rule above. */
  .pxh-popover {
    min-width: auto;
    max-width: calc(100vw - 24px);
    padding: 12px 14px;
    font-size: .88rem;
  }
}

/* Touch devices: expand the click/tap target around each port so finger
   accuracy isn't an issue, without changing the visual size of the icon. */
@media (hover: none) and (pointer: coarse) {
  .interface-component { position: relative; }
  .interface-component::before {
    content: "";
    position: absolute;
    inset: -6px;
  }
}
