/* ===========================================================
   INFO PANEL STYLES — RESPONSIVE & FIXED NEON CORNERS
   =========================================================== */

:root {
  /* Theme colors */
  --hud-bg: #041014;
  --hud-cyan: #00ffff;
  --hud-cyan-soft: #bff7ff;
  --hud-cyan-mid: #00c9d9;
  --hud-border: rgba(0, 255, 255, 0.35);
  --hud-panel: rgba(4, 16, 20, 0.92);
  --hud-glow: 0 0 14px rgba(0, 255, 255, 0.18),
    inset 0 0 8px rgba(0, 255, 255, 0.06);
  --hud-orange: #ff9d1e;

  /* Layout geometry */
  --toolbar-top: 18px;
  --toolbar-left: 24px;
  --toolbar-h: 56px;
  --hud-gap: 16px;

  /* Responsive width range */
  --panel-min: 270px;
  --panel-max: 420px;
}

/* ===========================================================
   MOUNT AREA
   =========================================================== */
#infopanel-mount {
  position: relative;
  width: 100%;
  z-index: 0;
}

/* ===========================================================
   PANEL CONTAINER (fluid)
   =========================================================== */
.hud-panel {
  position: relative;
  width: 100%;
  background: var(--hud-panel);
  border: 1px solid var(--hud-border);
  border-radius: 18px;
  box-shadow: var(--hud-glow);
  padding: clamp(12px, 2.4vw, 18px);
  color: var(--hud-cyan-soft);
  font-family: "Inter", system-ui, Segoe UI, Roboto, Arial;
  font-size: clamp(12px, 1.1vw, 14px);
  overflow-x: hidden;
  overflow-y: auto;
  height: 100%;
  box-sizing: border-box;
}

.info-panel,
.info-panel * {
  max-width: 100%;
  box-sizing: border-box;
}

/* ===========================================================
   NEON CORNERS
   =========================================================== */
.corner {
  position: absolute;
  width: clamp(84px, 28%, 120px); /* responsive length */
  height: 20px;
  border: 1.8px solid var(--hud-cyan);
  opacity: 0.65;
  pointer-events: none; /* purely decorative */
}
.tl { left: -2px; top: -2px; border-right: none; border-bottom: none; border-radius: 10px 0 0 0; }
.tr { right: -2px; top: -2px; border-left: none; border-bottom: none; border-radius: 0 10px 0 0; }
.bl { left: -2px; bottom: -2px; border-right: none; border-top: none; border-radius: 0 0 0 10px; }
.br { right: -2px; bottom: -2px; border-left: none; border-top: none; border-radius: 0 0 10px 0; }

/* ===========================================================
   CLOSE BUTTON
   =========================================================== */
.ip-close {
  position: absolute;
  top: 8px;
  right: 8px;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  border: 1px solid var(--hud-border);
  background: rgba(0, 255, 255, 0.06);
  color: #eaffff;
  font-weight: 900;
  line-height: 28px;
  text-align: center;
  box-shadow: var(--hud-glow);
  cursor: pointer;
}
.ip-close:hover { filter: brightness(1.08); }

/* ===========================================================
   GRID: LOGO + SUMMARY
   =========================================================== */
.ip-grid {
  display: grid;
  grid-template-columns: clamp(84px, 26%, 110px) 1fr;
  gap: clamp(8px, 2vw, 14px);
  align-items: center;
  margin-bottom: 6px;
}

/* ===========================================================
   LOGO BLOCK
   =========================================================== */
.ip-logo {
  position: relative;
  width: clamp(84px, 26vw, 110px);
  height: clamp(84px, 26vw, 110px);
  border: 1px solid var(--hud-border);
  border-radius: 10px;
  background: #072228;
  box-shadow: var(--hud-glow);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  background-position: center !important;
  background-repeat: no-repeat !important;
  background-size: contain !important;
}
#infopanel-logo {
  max-width: calc(100% - 12px) !important;
  max-height: calc(100% - 12px) !important;
  object-fit: contain !important;
  border-radius: 8px;
}
#infopanel-logo[src=""],
#infopanel-logo:not([src]),
#infopanel-logo[src="about:blank"] { display: none !important; }
.ip-logo .ip-placeholder { position: absolute; inset: 10px; opacity: 0.85; }
.ph-box { fill: none; stroke: var(--hud-cyan); stroke-opacity: 0.45; stroke-width: 2; }
.ph-mountain { fill: rgba(0, 255, 255, 0.12); stroke: var(--hud-cyan); stroke-opacity: 0.35; stroke-width: 1.2; }
.ph-sun { fill: rgba(0, 255, 255, 0.35); }

.ip-logo-recovery-overlay {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  gap: 4px;
  background: rgba(4, 12, 22, 0.72);
  color: #eaffff;
  text-align: center;
  border-radius: 10px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease;
  backdrop-filter: blur(6px);
}
.ip-logo-block {
  display: flex;
  flex-direction: column;
  gap: 10px;
  align-items: flex-start;
}
.ip-details-row {
  width: 100%;
  margin: clamp(4px, 1vw, 8px) 0;
}
.ip-details-btn {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: 30px;
  border: 1px solid rgba(170, 176, 184, 0.55);
  background: rgba(152, 160, 168, 0.18);
  color: #e6e9ed;
  padding: 6px 12px;
  border-radius: 10px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  font-size: 11px;
  cursor: pointer;
  box-shadow: var(--hud-glow);
  position: relative;
  overflow: hidden;
}
.ip-details-btn::before {
  content: "";
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(rgba(230, 233, 237, 0.08) 1px, transparent 1px),
    linear-gradient(90deg, rgba(230, 233, 237, 0.08) 1px, transparent 1px);
  background-size: 12px 12px;
  opacity: 0.45;
  pointer-events: none;
}
.ip-details-btn > * { position: relative; z-index: 1; }
.ip-details-btn:hover { filter: brightness(1.08); }
.ip-logo-recovery-overlay__label {
  font-size: clamp(10px, 1vw, 12px);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #9ffaff;
}
.ip-logo-recovery-overlay__timer {
  font-size: clamp(16px, 1.8vw, 18px);
  font-weight: 700;
  color: #ffffff;
  text-shadow: 0 0 8px rgba(0, 255, 255, 0.6);
}
.ip-logo-recovery-overlay.is-active {
  opacity: 1;
  pointer-events: auto;
}
.ip-logo--recovery #infopanel-logo {
  filter: blur(1.5px);
  opacity: 0.45;
}

/* ===========================================================
   OWNER NAME + STRUCTURE INTEGRITY BAR
   =========================================================== */
.ip-owner {
  font-size: clamp(16px, 1.6vw, 20px);
  font-weight: 800;
  color: #9ffaff;
  letter-spacing: 0.02em;
  margin: 0 0 6px;
}
.ip-owner-row {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}
.ip-owner-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 6px;
  border-radius: 999px;
  border: 1px solid rgba(255, 196, 92, 0.55);
  background: rgba(255, 196, 92, 0.12);
  color: #ffdca8;
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.12em;
  box-shadow: 0 0 10px rgba(255, 196, 92, 0.35);
  text-transform: uppercase;
}
.ip-owner-badge[hidden] {
  display: none;
}
.ip-owner-badge__icon {
  font-size: 11px;
  line-height: 1;
}
.ip-section-title {
  color: #7fe9ff;
  font-size: clamp(10px, 1vw, 12px);
  letter-spacing: 0.12em;
  font-weight: 700;
  margin-bottom: 6px;
  text-transform: uppercase;
}
.ip-progress {
  --pct: 72%;
  position: relative;
  width: 100%;
  height: clamp(10px, 1.4vw, 14px);
  border-radius: 999px;
  overflow: hidden;
  border: 1px solid var(--hud-border);
  background: rgba(0, 255, 255, 0.07);
  box-shadow: inset 0 0 10px rgba(0, 255, 255, 0.18);
}
.ip-progress-bar {
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: var(--pct);
  background: linear-gradient(90deg, #00c9d9, #22ffcc);
  box-shadow: inset 0 0 16px rgba(0, 255, 255, 0.35);
}
.ip-progress-label {
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  font-size: clamp(10px, 1vw, 13px);
  font-weight: 800;
  color: #656767;
}

.ip-website {
  margin-top: 6px;
}
.ip-website-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  max-width: 100%;
  padding: 2px 0;
  border-radius: 0;
  border: 0;
  background: transparent;
  color: #9adfe8;
  font-size: clamp(10px, 1vw, 12px);
  letter-spacing: 0.04em;
  text-decoration: none;
  opacity: 0.4;
  filter: blur(0.5px);
  transition: box-shadow 0.2s ease, color 0.2s ease, opacity 0.2s ease, filter 0.2s ease;
}
.ip-website-link:hover {
  opacity: 1;
  filter: blur(0);
  color: #c9f5ff;
  box-shadow: 0 0 14px rgba(0, 255, 255, 0.35);
}
.ip-website-icon {
  font-size: 12px;
  line-height: 1;
}
.ip-website-text {
  max-width: 220px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* ===========================================================
   ATTACK / DEFENSE BUTTONS
   =========================================================== */
.ip-stats {
  display: flex;
  gap: clamp(6px, 1.4vw, 10px);
  margin: clamp(6px, 1.6vw, 12px) 0;
}
.ip-stat-btn {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border: 1px solid var(--hud-border);
  border-radius: 10px;
  padding: 2px clamp(6px, 1.2vw, 10px);
  background: rgba(0, 255, 255, 0.06);
  box-shadow: var(--hud-glow);
  color: #eaffff;
  cursor: pointer;
  transition: all 0.2s ease;
}
.ip-stat-btn:hover {
  background: rgba(0, 255, 255, 0.15);
  box-shadow: 0 0 16px rgba(0, 255, 255, 0.4);
}
.ip-stat-icon { font-size: clamp(14px, 1.2vw, 16px); color: var(--hud-cyan); }
.ip-stat-icon--defense { color: #7fe9ff; }
.ip-stat-value { font-size: clamp(13px, 1.1vw, 16px); font-weight: 700; color: #eaffff; }
.ip-stat-btn.active {
  background: rgba(0, 255, 255, 0.18);
  border-color: #00e6ff;
  box-shadow: 0 0 18px rgba(0, 255, 255, 0.8),
    inset 0 0 12px rgba(0, 255, 255, 0.25);
  transform: translateY(-1px);
}

/* ===========================================================
   BUTTON: LAUNCH ATTACK
   =========================================================== */
.cta {
  width: 100%;
  padding: clamp(6px, 1.2vw, 8px);
  border: 1px solid rgba(255, 157, 30, 0.6);
  border-radius: 10px;
  background: linear-gradient(
    180deg,
    rgba(255, 157, 30, 0.2),
    rgba(255, 157, 30, 0.08)
  );
  color: var(--hud-orange);
  font-weight: 900;
  letter-spacing: 0.06em;
  font-size: clamp(11px, 1vw, 13px);
  text-shadow: 0 0 8px rgba(255, 157, 30, 0.45);
  cursor: pointer;
  box-shadow: 0 10px 18px rgba(255, 157, 30, 0.22),
    inset 0 0 10px rgba(255, 255, 255, 0.05);
  margin-bottom: clamp(8px, 1.4vw, 12px);
}

/* ===========================================================
   ENEMY MESSAGES (scrollable area)
   =========================================================== */
.ip-messages { margin-top: 8px; }
.ip-messages-title {
  color: #89efff;
  font-weight: 900;
  letter-spacing: 0.06em;
  font-size: clamp(12px, 1.2vw, 14px);
  margin: 4px 0 6px 2px;
}
.ip-messages-body {
  display: flex;
  flex-direction: column;
  gap: clamp(6px, 1.2vw, 10px);
  max-height: min(420px, 42vh); /* Fix: only this section scrolls */
  overflow-y: auto;
  padding: 6px 2px;
}
.ip-messages-empty {
  margin: 6px 8px;
  color: #9fefff;
  opacity: 0.7;
  font-style: italic;
  font-size: clamp(11px, 1vw, 13px);
}
.ip-messages-body > .emsg,
.ip-messages-body > .msg,
.ip-messages-body > [role="listitem"] {
  border: 1px solid var(--hud-border);
  border-radius: 10px;
  padding: clamp(8px, 1.6vw, 12px);
  background: linear-gradient(180deg, rgba(0, 20, 24, 0.9), rgba(0, 26, 30, 0.9));
  box-shadow: var(--hud-glow);
  color: #c6fbff;
}

/* ===========================================================
   FOOTER
   =========================================================== */
.ip-footer {
  margin-top: 8px;
  border: 1px solid var(--hud-border);
  border-radius: 10px;
  background: rgba(0, 255, 255, 0.05);
  box-shadow: var(--hud-glow);
  display: grid;
  place-items: center;
  padding: clamp(6px, 1.2vw, 10px);
}
.ip-footer span {
  color: var(--hud-orange);
  font-weight: 900;
  letter-spacing: 0.14em;
  font-size: clamp(12px, 1vw, 13px);
}

/* ===========================================================
   RESPONSIVE TWEAKS
   =========================================================== */
@media (max-width: 600px) {
  :root { --toolbar-h: 88px; }
  #infopanel-mount {
    left: max(10px, env(safe-area-inset-left));
    right: max(10px, env(safe-area-inset-right));
  }
  .hud-panel {
    width: auto;
    max-width: 96vw;
  }
}
@media (min-width: 1200px) {
  .hud-panel { width: clamp(320px, 28vw, 460px); }
  .ip-messages-body { max-height: 440px; }
}
