/* Overlay popup */
.overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.65);
  display: none;
  align-items: center;
  justify-content: center;
  padding: 16px;
  z-index: 2000;
  overflow: auto;
}
.overlay.show {
  display: flex;
}

.popup-info {
  width: min(920px, 100%);
  background: radial-gradient(
      120% 120% at 50% 0%,
      rgba(57, 255, 103, 0.08),
      rgba(0, 0, 0, 0)
    ),
    linear-gradient(180deg, rgba(6, 30, 13, 0.95), rgba(2, 12, 6, 0.95));
  border: 1px solid rgba(57, 255, 103, 0.45);
  border-radius: 16px;
  box-shadow: 0 22px 70px var(--shadow);
  overflow: hidden;
  position: relative;
}

.popup-info-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 14px;
  background: linear-gradient(
    180deg,
    rgba(57, 255, 103, 0.12),
    rgba(57, 255, 103, 0.04)
  );
  border-bottom: 1px solid rgba(57, 255, 103, 0.25);
}

.title {
  display: flex;
  gap: 10px;
  align-items: center;
  color: var(--text);
  letter-spacing: 0.4px;
  font-weight: 600;
}

#btnMute {
  position: relative;
  display: inline-grid;
  place-items: center;
  width: 36px;
  height: 36px;
  padding: 0;
  border-radius: 10px;
  border: 1px solid rgba(57, 255, 103, 0.35);
  background: rgba(0, 0, 0, 0.25);
  cursor: pointer;
}

/* samakan hover feel dengan .close */
#btnMute:hover {
  filter: brightness(1.08);
  transform: translateY(-1px);
}

#btnMute:active {
  transform: scale(0.97);
}

/* ikon speaker */
#btnMute img {
  width: 18px;
  height: 18px;
  display: block;
  pointer-events: none;
  opacity: 0.9;
}

/* =========================
 * Muted state (slash merah)
 * ========================= */
#btnMute.muted::after {
  content: "";
  position: absolute;
  width: 26px;
  height: 2px;
  background: #ef4444; /* merah */
  transform: rotate(-45deg);
  border-radius: 2px;
  box-shadow: 0 0 6px rgba(239, 68, 68, 0.8);
}

/* ikon sedikit redup saat muted */
#btnMute.muted img {
  opacity: 0.45;
}

.led {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--green);
  box-shadow: 0 0 10px rgba(57, 255, 103, 0.9);
}

.button-quiz {
  appearance: none;
  border: 1px solid rgba(57, 255, 103, 0.35);
  background: rgba(0, 0, 0, 0.25);
  color: var(--text);
  padding: 6px 10px;
  border-radius: 10px;
  cursor: pointer;
}

.content {
  display: grid;
  grid-template-columns: 260px 1fr;
  gap: 14px;
  padding: 14px;
}

.portrait {
  border: 1px solid rgba(57, 255, 103, 0.25);
  border-radius: 14px;
  background: linear-gradient(180deg, rgba(0, 0, 0, 0.25), rgba(0, 0, 0, 0.45));
  padding: 12px;
  position: relative;
  overflow: hidden;
}
.portrait::after {
  content: "";
  position: absolute;
  inset: -40%;
  background: repeating-linear-gradient(
    to bottom,
    rgba(57, 255, 103, 0.08) 0px,
    rgba(57, 255, 103, 0.08) 2px,
    rgba(0, 0, 0, 0) 3px,
    rgba(0, 0, 0, 0) 7px
  );
  opacity: 0.45;
  pointer-events: none;
  transform: translateY(-10%);
}

#pixiWrap {
  width: 100%;
  aspect-ratio: 241 / 362;  /* sesuai frame */
  min-height: 200px;
}

#pixiWrap canvas {
  border-radius: 12px;
  box-shadow: inset 0 0 0 1px rgba(57, 255, 103, 0.2);
  width: 100%;
  height: 100%;
  display: block;
}

.dialog {
  border: 1px solid rgba(57, 255, 103, 0.25);
  border-radius: 14px;
  background: linear-gradient(180deg, rgba(0, 0, 0, 0.18), rgba(0, 0, 0, 0.35));
  padding: 12px 12px 14px;
  min-height: 240px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.dialog-text {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  color: var(--text);
  line-height: 1.45;
  white-space: pre-wrap;
  min-height: 120px;
}

.actions {
  margin-top: auto;
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  justify-content: flex-start;
}

.btn {
  padding: 10px 12px;
  border-radius: 12px;
  border: 1px solid rgba(57, 255, 103, 0.35);
  background: rgba(0, 0, 0, 0.22);
  color: var(--text);
  cursor: pointer;
  transition: 0.12s ease;
  font-weight: 600;
}
.btn:hover {
  transform: translateY(-1px);
  filter: brightness(1.05);
}
.btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
  transform: none;
}

.btn.primary {
  background: linear-gradient(
    180deg,
    rgba(57, 255, 103, 0.22),
    rgba(57, 255, 103, 0.08)
  );
  border-color: rgba(57, 255, 103, 0.55);
}

.note {
  color: var(--muted);
  font-size: 12px;
  margin-top: 6px;
}

@media (max-width: 769px) {
  .overlay {
    padding: clamp(12px, 4vw, 16px);
  }

  .popup-info {
    width: 100%;
    max-width: 640px;
    border-radius: 14px;
  }

  .content {
    grid-template-columns: 1fr;
    gap: 12px;
    padding: 12px;
  }

  /* Portrait di tengah */
  .portrait {
    max-width: clamp(220px, 60vw, 300px);
    margin: 0 auto;
    padding: 10px;
  }

  #pixiWrap {
    max-width: 260px;
    width: 100%;
    aspect-ratio: 2 / 2;
    max-width: 160px;
    margin: 0 auto;
  }

  canvas {
    max-width: 100%;
    height: auto;
  }

  .dialog {
    min-height: auto;
    padding: 12px;
  }

  .dialog-text {
    font-size: clamp(13px, 2.8vw, 14px);
  }

  .actions {
    justify-content: center;
  }

  .btn {
    padding: 10px 14px;
    font-size: 14px;
  }
}

@media (max-width: 426px) {
  #btnMute {
    width: 30px;
    height: 30px;
    border-radius: 8px;
  }

  #btnMute img {
    width: 15px;
    height: 15px;
  }

  #btnMute.muted::after {
    width: 22px;
  }

  .popup-info {
    border-radius: 12px;
  }

  .popup-info-header {
    padding: 8px 10px;
  }

  .title {
    font-size: 14px;
    gap: 8px;
  }

  .led {
    width: 8px;
    height: 8px;
  }

  .button-quiz {
    padding: 5px 8px;
    font-size: 12px;
  }

  .portrait {
    max-width: clamp(160px, 72vw, 220px);
    padding: 8px;
    border-radius: 12px;
  }

  #pixiWrap {
    aspect-ratio: 241 / 363;
  }

  .dialog {
    padding: 10px;
    border-radius: 12px;
    gap: 10px;
  }

  .dialog-text {
    font-size: clamp(12px, 3.5vw, 13px);
    line-height: 1.4;
    min-height: 100px;
  }

  .actions {
    gap: 8px;
  }

  .btn {
    padding: 8px 10px;
    font-size: 13px;
    border-radius: 10px;
  }

  .note {
    font-size: 11px;
  }
}
