/* ultra_identity.css — W4 Ultrastation "YOU" identity panel + room portrait.
 *
 * A compact fixed card shown at the bottom-left of the viewport when
 * GHELMYON_FEATURE_ULTRASTATION is on.  Hidden by default (no .uid-visible);
 * ultra_identity.js adds the class when the first payload arrives.
 *
 * Structure:
 *   #ultra-identity-panel
 *     .uid-room-wrap          — room establishing shot (location background)
 *     .uid-card               — player identity row
 *       .uid-portrait-wrap    — player portrait (60×80) + fallback avatar
 *       .uid-info             — name / class / location / vitals bars
 *
 * Read-only v1.  Pointer-events left on so the panel can receive hover
 * tooltips in a future pass, but all game input targets pass through.
 */

/* =========================================================================
 * Root panel — hidden until JS adds .uid-visible
 * ========================================================================= */

#ultra-identity-panel {
  position: fixed;
  bottom: 12px;
  left: 12px;
  z-index: 55;            /* above game canvas (z 40), below FX overlay (z 60) */
  width: 260px;
  background: rgba(14, 11, 8, 0.88);
  border: 1px solid rgba(106, 80, 48, 0.65);
  border-radius: 6px;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.65);
  font-family: "JetBrains Mono", "Fira Code", "Consolas", monospace;
  font-size: 12px;
  color: #c8c8c8;
  overflow: hidden;
  /* Hidden until first data — JS adds .uid-visible */
  display: none;
}

/* TEMPORARILY SUPPRESSED (2026-06-05): the legacy left-sidebar character
 * card already shows portrait + name + HP/MP + location, so this read-only
 * v1 YOU panel just stacked a duplicate on top of it (and isn't draggable
 * yet). Keep it hidden until the post-freeze pass makes it draggable/richer
 * and we decide whether it replaces the sidebar card. JS still builds the
 * DOM + wiring (tests intact); this rule keeps it off-screen. Revert by
 * restoring `display: block;`. */
#ultra-identity-panel.uid-visible {
  display: none;
}

/* =========================================================================
 * Room portrait (establishing shot of the current location)
 * ========================================================================= */

.uid-room-wrap {
  position: relative;
  width: 100%;
  height: 100px;
  background: #0d0a07;
  overflow: hidden;
}

.uid-room-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center top;
  display: block;
  image-rendering: pixelated;      /* preserve pixel-art crispness */
}

/* Fallback texture when image is missing or still loading */
.uid-room-placeholder {
  position: absolute;
  inset: 0;
  background: repeating-linear-gradient(
    135deg,
    rgba(50, 35, 15, 0.4) 0px,
    rgba(50, 35, 15, 0.4) 4px,
    rgba(30, 20, 8, 0.4)  4px,
    rgba(30, 20, 8, 0.4)  8px
  );
}

/* =========================================================================
 * Identity card: portrait + text info
 * ========================================================================= */

.uid-card {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  padding: 8px;
}

/* ---------- Portrait ---------- */

.uid-portrait-wrap {
  position: relative;
  flex-shrink: 0;
  width: 52px;
  height: 68px;
  background: #1a1208;
  border: 1px solid rgba(106, 80, 48, 0.5);
  border-radius: 3px;
  overflow: hidden;
}

.uid-portrait-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center top;
  display: block;
  image-rendering: pixelated;
}

/* Letter-avatar fallback when portrait is absent or 404 */
.uid-portrait-fallback {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #1a1208;
  color: rgba(106, 80, 48, 0.7);
  font-size: 24px;
  font-weight: 700;
  user-select: none;
}

/* Content character for the fallback avatar (set via JS textContent on the
   name field — this rule just ensures the fallback div is visible by default
   when the img is hidden; JS toggles display on both) */

/* ---------- Text info ---------- */

.uid-info {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.uid-name {
  font-size: 13px;
  font-weight: 700;
  color: #e8d8b0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.uid-class {
  font-size: 11px;
  color: #a09070;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.uid-location {
  font-size: 10px;
  color: #706050;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-bottom: 4px;
}

/* ---------- Vitals bars ---------- */

.uid-vitals {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.uid-bar-row {
  display: flex;
  align-items: center;
  gap: 4px;
}

.uid-bar-label {
  font-size: 9px;
  color: #706050;
  letter-spacing: 0.5px;
  width: 14px;
  flex-shrink: 0;
  text-align: right;
}

.uid-bar {
  flex: 1;
  height: 6px;
  background: rgba(30, 22, 10, 0.9);
  border-radius: 3px;
  overflow: hidden;
}

.uid-bar-fill {
  height: 100%;
  border-radius: 3px;
  transition: width 0.35s ease, background-color 0.35s ease;
  width: 0%;
}

/* HP bar colours — toggled via JS class on uid-hp-fill */
.uid-hp-fill.hp-high { background: #3a9a3a; }
.uid-hp-fill.hp-mid  { background: #c8900a; }
.uid-hp-fill.hp-low  { background: #c02020; animation: uid-hp-pulse 0.9s ease-in-out infinite; }

@keyframes uid-hp-pulse {
  0%, 100% { opacity: 1; }
  50%       { opacity: 0.65; }
}

/* Mana bar colour — consistent blue */
.uid-mana-fill { background: #3060c0; }

.uid-bar-text {
  font-size: 9px;
  color: #706050;
  min-width: 40px;
  text-align: right;
  flex-shrink: 0;
  font-variant-numeric: tabular-nums;
}

/* =========================================================================
 * Accessibility — reduce motion
 * ========================================================================= */

@media (prefers-reduced-motion: reduce) {
  .uid-hp-fill.hp-low { animation: none; }
  .uid-bar-fill       { transition: none; }
}

/* =========================================================================
 * Responsive — hide on very small screens where it would obstruct play
 * ========================================================================= */

@media (max-width: 480px) {
  #ultra-identity-panel { display: none !important; }
}
