/* ================================================================
   CHILD UFO — Aerospace Telemetry Status Panel
   Magna Historia — Miniature instrument cluster
   ================================================================
   Material: Brushed metal (matching session cockpit)
   Gauges: SVG circular with animated stroke-dashoffset
   Ambient: Scan line sweep, LED blink, shimmer on gauges
   ================================================================ */

/* ── Base Panel ─────────────────────────────────────────── */
.child-ufo {
  position: relative;
  /* Brushed metal material */
  background:
    repeating-linear-gradient(90deg, transparent, transparent 1px, rgba(255,255,255,0.004) 1px, rgba(255,255,255,0.004) 2px),
    linear-gradient(160deg, rgba(255,255,255,0) 0%, rgba(255,255,255,0.015) 35%, rgba(255,255,255,0.03) 50%, rgba(255,255,255,0.015) 65%, rgba(255,255,255,0) 100%),
    #0b0b14;
  border: 1px solid rgba(184,143,60,0.1);
  /* Chamfered corners */
  clip-path: polygon(
    14px 0, calc(100% - 14px) 0,
    100% 14px, 100% calc(100% - 14px),
    calc(100% - 14px) 100%, 14px 100%,
    0 calc(100% - 14px), 0 14px
  );
  padding: 20px 28px 18px;
  overflow: hidden;
  box-shadow:
    inset 0 1px 0 rgba(255,255,255,0.04),
    inset 0 -1px 0 rgba(0,0,0,0.3),
    0 4px 24px rgba(0,0,0,0.3);
  transition: transform 0.6s cubic-bezier(0.22,1,0.36,1), opacity 0.4s ease;
}

/* ── Absorption animation (cockpit entry) ──────────────── */
.child-ufo--absorbing {
  transform: scale(0.4) translateX(60%) translateY(-20%);
  opacity: 0;
  pointer-events: none;
}

/* ── Celebration pulse (post-session gauge update) ─────── */
.child-ufo--celebration {
  animation: ufoCelebrate 1.5s ease-out;
}
@keyframes ufoCelebrate {
  0% { box-shadow: inset 0 1px 0 rgba(255,255,255,0.04), 0 0 0 rgba(184,143,60,0); }
  30% { box-shadow: inset 0 1px 0 rgba(255,255,255,0.04), 0 0 30px rgba(184,143,60,0.2), 0 0 60px rgba(184,143,60,0.1); }
  100% { box-shadow: inset 0 1px 0 rgba(255,255,255,0.04), 0 0 0 rgba(184,143,60,0); }
}

/* ── Scan Line Sweep ───────────────────────────────────── */
.ufo-scan {
  position: absolute;
  inset: 0;
  background: linear-gradient(
    90deg,
    transparent 0%,
    rgba(184,143,60,0.02) 35%,
    rgba(184,143,60,0.07) 50%,
    rgba(184,143,60,0.02) 65%,
    transparent 100%
  );
  transform: translateX(-100%);
  animation: ufoSweep 10s ease-in-out infinite;
  pointer-events: none;
  z-index: 0;
}
@keyframes ufoSweep {
  0% { transform: translateX(-100%); }
  40% { transform: translateX(100%); }
  100% { transform: translateX(100%); }
}

/* ── LED Indicators ────────────────────────────────────── */
.ufo-leds {
  position: absolute;
  top: 14px;
  right: 18px;
  display: flex;
  gap: 7px;
  z-index: 1;
}
.ufo-led {
  width: 3px;
  height: 3px;
  border-radius: 50%;
  background: #22c55e;
  box-shadow: 0 0 4px rgba(34,197,94,0.4);
}
.ufo-led:nth-child(1) { animation: ledBlink 3.1s ease-in-out infinite; }
.ufo-led:nth-child(2) { animation: ledBlink 5.3s ease-in-out infinite 1s; }
.ufo-led:nth-child(3) { animation: ledBlink 7.7s ease-in-out infinite 2s; }
@keyframes ledBlink {
  0%, 88%, 100% { opacity: 1; }
  92% { opacity: 0.15; }
}

/* Standby LEDs (amber) */
.ufo-led--amber {
  background: #f59e0b;
  box-shadow: 0 0 4px rgba(245,158,11,0.4);
}

/* ── System Label ──────────────────────────────────────── */
.ufo-sys-label {
  font-family: 'Space Mono', monospace;
  font-size: 0.48rem;
  letter-spacing: 0.25em;
  color: rgba(184,143,60,0.22);
  text-align: right;
  margin-bottom: 10px;
  position: relative;
  z-index: 1;
}

/* ── Identity Row ──────────────────────────────────────── */
.ufo-identity {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 16px;
  position: relative;
  z-index: 1;
}
.ufo-avatar {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: rgba(184,143,60,0.12);
  border: 1px solid rgba(184,143,60,0.25);
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: 'Cinzel', serif;
  font-size: 0.95rem;
  color: #b88f3c;
  flex-shrink: 0;
}
.ufo-user-info {
  flex: 1;
  min-width: 0;
}
.ufo-name {
  display: block;
  font-family: 'Cinzel', serif;
  font-size: 1rem;
  color: #e8dcc8;
  letter-spacing: 0.03em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.ufo-tier {
  display: block;
  font-family: 'Space Mono', monospace;
  font-size: 0.5rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  margin-top: 2px;
}
.ufo-tier-free { color: #555; }
.ufo-tier-guardian { color: #b88f3c; }
.ufo-tier-inner { color: #8B5CF6; }
.ufo-tier-daily { color: #06B6D4; }
.ufo-tier-lifetime { color: #d4af37; text-shadow: 0 0 8px rgba(212,175,55,0.3); }

.ufo-status {
  display: flex;
  align-items: center;
  gap: 5px;
  flex-shrink: 0;
}
.ufo-status-dot {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: #22c55e;
  box-shadow: 0 0 4px rgba(34,197,94,0.3);
}
.ufo-status-text {
  font-family: 'Space Mono', monospace;
  font-size: 0.45rem;
  letter-spacing: 0.12em;
  color: rgba(34,197,94,0.6);
  text-transform: uppercase;
}

/* ── Gauges Row ────────────────────────────────────────── */
.ufo-gauges {
  display: flex;
  justify-content: center;
  gap: 20px;
  margin: 0 0 16px;
  position: relative;
  z-index: 1;
}
.ufo-gauge {
  text-align: center;
}
.ufo-gauge svg {
  width: 52px;
  height: 52px;
  display: block;
  margin: 0 auto;
}
.ufo-gauge-bg {
  fill: none;
  stroke: rgba(255,255,255,0.04);
  stroke-width: 2.5;
}
.ufo-gauge-fill {
  fill: none;
  stroke-width: 2.5;
  stroke-linecap: round;
  transform: rotate(-90deg);
  transform-origin: center;
  transition: stroke-dashoffset 1s cubic-bezier(0.4, 0, 0.2, 1);
}
.ufo-gauge-value {
  font-family: 'Space Mono', monospace;
  font-size: 11px;
  fill: #e8dcc8;
}
.ufo-gauge-label {
  display: block;
  font-family: 'Space Mono', monospace;
  font-size: 0.45rem;
  letter-spacing: 0.1em;
  color: rgba(255,255,255,0.25);
  margin-top: 4px;
}

/* ── Active Protocol Section ───────────────────────────── */
.ufo-active {
  border-top: 1px solid rgba(184,143,60,0.06);
  padding-top: 12px;
  position: relative;
  z-index: 1;
}
.ufo-active-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 4px;
}
.ufo-active-label {
  font-family: 'Space Mono', monospace;
  font-size: 0.48rem;
  letter-spacing: 0.15em;
  color: rgba(184,143,60,0.35);
  text-transform: uppercase;
}
.ufo-active-progress {
  font-family: 'Space Mono', monospace;
  font-size: 0.55rem;
  color: rgba(184,143,60,0.5);
  letter-spacing: 0.05em;
}
.ufo-active-name {
  font-family: 'Cinzel', serif;
  font-size: 0.95rem;
  color: #e8dcc8;
  letter-spacing: 0.02em;
  margin-bottom: 8px;
}
.ufo-active-bar {
  width: 100%;
  height: 3px;
  background: rgba(255,255,255,0.04);
  border-radius: 2px;
  overflow: hidden;
  margin-bottom: 8px;
}
.ufo-active-bar-fill {
  height: 100%;
  background: linear-gradient(90deg, #b88f3c, #d4af37);
  border-radius: 2px;
  width: 0%;
  transition: width 1s cubic-bezier(0.4, 0, 0.2, 1);
}
.ufo-next {
  display: flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
  padding: 4px 0;
  transition: opacity 0.2s;
}
.ufo-next:hover { opacity: 0.8; }
.ufo-next-label {
  font-family: 'Space Mono', monospace;
  font-size: 0.48rem;
  letter-spacing: 0.1em;
  color: rgba(184,143,60,0.35);
}
.ufo-next-session {
  font-size: 0.8rem;
  color: var(--th-text-secondary, #8a9ab5);
}

/* ── Goals Strip ───────────────────────────────────────── */
.ufo-goals {
  margin-top: 12px;
  position: relative;
  z-index: 1;
}
.ufo-goals-label {
  font-family: 'Space Mono', monospace;
  font-size: 0.48rem;
  letter-spacing: 0.15em;
  color: rgba(184,143,60,0.35);
  margin-bottom: 8px;
}
.ufo-goals-strip {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding-bottom: 4px;
}
.ufo-goal {
  background: rgba(255,255,255,0.02);
  border: 1px solid rgba(255,255,255,0.04);
  border-radius: 6px;
  padding: 6px 12px;
  white-space: nowrap;
  display: flex;
  gap: 8px;
  align-items: center;
  flex-shrink: 0;
}
.ufo-goal-name {
  font-size: 0.75rem;
  color: #e8dcc8;
}
.ufo-goal-streak {
  font-size: 0.7rem;
  color: #f59e0b;
}

/* ── Standby State (unauthenticated) ───────────────────── */
.child-ufo--standby {
  text-align: center;
}
.ufo-standby-cta {
  border-top: 1px solid rgba(184,143,60,0.06);
  padding-top: 16px;
  margin-top: 8px;
  position: relative;
  z-index: 1;
}
.ufo-standby-text {
  font-family: 'Space Mono', monospace;
  font-size: 0.6rem;
  letter-spacing: 0.15em;
  color: rgba(184,143,60,0.4);
  margin-bottom: 12px;
}
.ufo-init-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 28px;
  font-family: 'Cinzel', serif;
  font-size: 0.8rem;
  letter-spacing: 0.08em;
  color: #e8dcc8;
  background: rgba(184,143,60,0.1);
  border: 1px solid rgba(184,143,60,0.3);
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.3s;
}
.ufo-init-btn:hover {
  background: rgba(184,143,60,0.2);
  border-color: rgba(184,143,60,0.5);
  box-shadow: 0 0 20px rgba(184,143,60,0.15);
}
.ufo-init-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #f59e0b;
  animation: initDotPulse 1.5s ease-in-out infinite;
}
@keyframes initDotPulse {
  0%, 100% { opacity: 0.4; box-shadow: 0 0 2px rgba(245,158,11,0.2); }
  50% { opacity: 1; box-shadow: 0 0 8px rgba(245,158,11,0.5); }
}

/* ── Responsive ────────────────────────────────────────── */
@media (max-width: 768px) {
  .child-ufo {
    padding: 16px 20px 14px;
    clip-path: polygon(
      10px 0, calc(100% - 10px) 0,
      100% 10px, 100% calc(100% - 10px),
      calc(100% - 10px) 100%, 10px 100%,
      0 calc(100% - 10px), 0 10px
    );
  }
  .ufo-gauges {
    gap: 14px;
  }
  .ufo-gauge svg {
    width: 46px;
    height: 46px;
  }
  .ufo-identity {
    gap: 10px;
  }
  .ufo-avatar {
    width: 32px;
    height: 32px;
    font-size: 0.8rem;
  }
  .ufo-name {
    font-size: 0.9rem;
  }
  .ufo-status-text {
    display: none;
  }
}

@media (max-width: 480px) {
  .ufo-gauges {
    gap: 10px;
  }
  .ufo-gauge svg {
    width: 40px;
    height: 40px;
  }
  .ufo-gauge-value {
    font-size: 9px;
  }
  .ufo-gauge-label {
    font-size: 0.4rem;
  }
}

/* ── Reduced Motion ────────────────────────────────────── */
@media (prefers-reduced-motion: reduce) {
  .ufo-scan,
  .ufo-led,
  .ufo-init-dot {
    animation: none !important;
  }
  .ufo-gauge-fill {
    transition: none !important;
  }
  .child-ufo--absorbing {
    transition: none !important;
  }
}
