/**
 * ZomB Pet Widget — Digivice-style handheld device
 */

/* ─── BODY ─────────────────────────────────────────────────────────── */

.zomb-pet-widget {
  position: fixed;
  bottom: 90px;
  right: 20px;
  width: 242px;
  background:
    radial-gradient(ellipse at 35% 4%, rgba(255,255,255,0.05) 0%, transparent 55%),
    linear-gradient(168deg, #1d1d1d 0%, #101010 45%, #1b0808 100%);
  border-radius: 22px 22px 42px 42px;
  border: 1.5px solid #262626;
  box-shadow:
    0 0 0 1px #080808,
    0 20px 70px rgba(0,0,0,0.92),
    0 0 50px rgba(150,15,15,0.18),
    inset 0 1px 1px rgba(255,255,255,0.06),
    inset 0 -2px 4px rgba(0,0,0,0.6);
  font-family: 'Courier New', monospace;
  z-index: 9998;
  display: none;
  padding: 10px 14px 18px;
  user-select: none;
  overflow: hidden;
}

.zomb-pet-widget.visible { display: block; }

.zomb-pet-widget.zpw-pulse-action {
  animation: zpw-device-tap 0.18s ease-out;
}

.zomb-pet-widget.zpw-pulse-page {
  animation: zpw-device-page 0.28s ease-out;
}

.zomb-pet-widget.zpw-pulse-slot {
  animation: zpw-device-slot 0.22s ease-out;
}

.zomb-pet-widget.zpw-pulse-battle {
  animation: zpw-device-battle 0.42s ease-out;
}

.zomb-pet-widget.zpw-pulse-action .zpw-screen,
.zomb-pet-widget.zpw-pulse-page .zpw-screen,
.zomb-pet-widget.zpw-pulse-slot .zpw-screen {
  box-shadow:
    inset 0 0 28px rgba(48,255,92,0.22),
    0 0 14px rgba(50,220,80,0.18);
}

.zomb-pet-widget.zpw-pulse-battle .zpw-screen {
  box-shadow:
    inset 0 0 34px rgba(255,40,40,0.34),
    0 0 20px rgba(255,50,50,0.24);
}

.zomb-pet-widget.zpw-pulse-action .zpw-led-off,
.zomb-pet-widget.zpw-pulse-page .zpw-led-off,
.zomb-pet-widget.zpw-pulse-slot .zpw-led-off {
  background: #42dd55;
  border-color: #74ff82;
  box-shadow: 0 0 8px rgba(80,255,100,0.7);
}

.zomb-pet-widget.zpw-pulse-battle .zpw-led-off {
  background: #ff2222;
  border-color: #ff7777;
  box-shadow: 0 0 12px rgba(255,30,30,0.9);
}

@keyframes zpw-device-tap {
  0% { transform: translateY(0); }
  45% { transform: translateY(1px); }
  100% { transform: translateY(0); }
}

@keyframes zpw-device-page {
  0% { transform: translateX(0); }
  25% { transform: translateX(-2px); }
  60% { transform: translateX(2px); }
  100% { transform: translateX(0); }
}

@keyframes zpw-device-slot {
  0% { transform: rotate(0deg); }
  35% { transform: rotate(-0.8deg); }
  70% { transform: rotate(0.8deg); }
  100% { transform: rotate(0deg); }
}

@keyframes zpw-device-battle {
  0% { transform: translate(0, 0) rotate(0deg); }
  18% { transform: translate(-2px, 1px) rotate(-0.8deg); }
  36% { transform: translate(2px, -1px) rotate(0.8deg); }
  54% { transform: translate(-1px, -1px) rotate(-0.5deg); }
  72% { transform: translate(1px, 1px) rotate(0.5deg); }
  100% { transform: translate(0, 0) rotate(0deg); }
}

/* ─── TOP BAR (drag handle) ─────────────────────────────────────────── */

.zpw-top-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-bottom: 8px;
  cursor: grab;
}

.zpw-top-bar:active { cursor: grabbing; }

.zpw-leds { display: flex; gap: 5px; align-items: center; }

.zpw-led {
  width: 7px;
  height: 7px;
  border-radius: 50%;
}

.zpw-led-on {
  background: #cc2020;
  box-shadow: 0 0 6px #cc2020, 0 0 2px #ff4444;
  animation: zpw-pulse 2.4s ease-in-out infinite;
}

.zpw-led-off {
  background: #1a0808;
  border: 1px solid #2a1515;
}

@keyframes zpw-pulse {
  0%, 100% { opacity: 1; }
  50%       { opacity: 0.35; }
}

.zpw-brand {
  font-size: 10px;
  font-weight: bold;
  color: #aa2222;
  letter-spacing: 4px;
  text-transform: uppercase;
}

.zpw-close {
  background: none;
  border: none;
  color: #3a3a3a;
  font-size: 17px;
  cursor: pointer;
  padding: 0;
  line-height: 1;
  transition: color 0.18s;
}

.zpw-close:hover { color: #cc3333; }

/* ─── SCREEN BEZEL ──────────────────────────────────────────────────── */

.zpw-screen-bezel {
  background: #050505;
  border-radius: 11px;
  padding: 8px 8px 0;
  border: 1px solid #161616;
  box-shadow:
    inset 0 4px 18px rgba(0,0,0,0.97),
    inset 0 0 0 1px #0c0c0c,
    0 1px 0 rgba(255,255,255,0.03);
  margin-bottom: 7px;
}

/* ─── LCD SCREEN ────────────────────────────────────────────────────── */

.zpw-screen {
  position: relative;
  border-radius: 5px;
  background: #020d05;   /* phosphor green-tinted LCD black */
  overflow: hidden;
  width: 100%;
  aspect-ratio: 1;
}

.zpw-stage-inner {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
}

.zpw-stage-inner canvas {
  width: 100%;
  height: 100%;
  display: block;
  image-rendering: pixelated;
  image-rendering: crisp-edges;
}

/* Scanlines */
.zpw-scanlines {
  position: absolute;
  inset: 0;
  background: repeating-linear-gradient(
    0deg,
    transparent 0px,
    transparent 2px,
    rgba(0,0,0,0.13) 2px,
    rgba(0,0,0,0.13) 4px
  );
  pointer-events: none;
  z-index: 2;
}

/* Phosphor vignette */
.zpw-screen-vignette {
  position: absolute;
  inset: 0;
  background: radial-gradient(ellipse at 50% 50%, transparent 45%, rgba(0,12,4,0.55) 100%);
  pointer-events: none;
  z-index: 3;
}

/* HUD: pet name/level over bottom of screen */
.zpw-hud {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  padding: 4px 8px 5px;
  background: linear-gradient(transparent, rgba(0,0,0,0.82));
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  z-index: 4;
  pointer-events: none;
}

.zpw-hud-name {
  font-size: 10px;
  font-weight: bold;
  color: #88dd66;
  text-shadow: 0 0 8px rgba(80,200,60,0.7);
  letter-spacing: 0.3px;
}

.zpw-hud-lv {
  font-size: 9px;
  color: #4a7a38;
}

/* Battle overlay (activated via .active class) */
.zpw-battle-overlay {
  position: absolute;
  inset: 0;
  background: rgba(0,8,2,0.92);
  z-index: 5;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 7px;
  padding: 14px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.18s;
}

.zpw-battle-overlay.active {
  opacity: 1;
  pointer-events: all;
}

.zpw-bo-title {
  font-size: 13px;
  font-weight: bold;
  color: #cc2222;
  letter-spacing: 4px;
  text-shadow: 0 0 12px rgba(200,20,20,0.9);
}

.zpw-bo-input {
  width: 100%;
  background: rgba(0,18,6,0.85);
  border: 1px solid #2a7a3a;
  border-radius: 4px;
  color: #88dd66;
  font-family: 'Courier New', monospace;
  font-size: 11px;
  padding: 5px 8px;
  outline: none;
  text-align: center;
  box-sizing: border-box;
  transition: border-color 0.15s;
}

.zpw-bo-input:focus { border-color: #44cc55; }
.zpw-bo-input::placeholder { color: #1e4a28; }

.zpw-bo-hint {
  font-size: 9px;
  color: #2a6635;
  letter-spacing: 0.3px;
}

.zpw-bo-result {
  font-size: 10px;
  color: #55aa44;
  min-height: 13px;
  text-align: center;
}

/* XP rail (thin strip below LCD, inside bezel) */
.zpw-xp-rail {
  height: 3px;
  background: #080808;
  margin-top: 5px;
  border-radius: 0 0 4px 4px;
  overflow: hidden;
}

.zpw-xp-fill {
  height: 100%;
  width: 0;
  background: linear-gradient(90deg, #1a5a25, #44dd55);
  border-radius: 0 0 4px 4px;
  transition: width 0.5s ease;
}

/* ─── INFO STRIP (rarity + buffs) ───────────────────────────────────── */

.zpw-info-strip {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 5px 1px 2px;
  min-height: 18px;
}

.zpw-strip-buffs {
  font-size: 9px;
  color: #444;
}

/* ─── PET SLOTS ─────────────────────────────────────────────────────── */

.zpw-slots {
  display: flex;
  gap: 5px;
  justify-content: center;
  padding: 4px 0 10px;
}

.zpw-slot {
  width: 36px;
  height: 36px;
  background: #0c0c0c;
  border: 1px solid #1e1e1e;
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  cursor: pointer;
  position: relative;
  transition: border-color 0.18s, background 0.18s;
  flex-shrink: 0;
}

.zpw-slot:hover  { border-color: #551515; }
.zpw-slot.active { border-color: #bb2222; background: #180606; box-shadow: 0 0 7px rgba(180,20,20,0.35); }

.zpw-slot-n {
  position: absolute;
  top: 2px; right: 3px;
  font-size: 7px;
  color: #3a3a3a;
  line-height: 1;
}

/* ─── CONTROLS ──────────────────────────────────────────────────────── */

.zpw-controls {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 4px 2px 8px;
}

/* D-PAD */

.zpw-dpad {
  position: relative;
  width: 76px;
  height: 76px;
}

/* horizontal arm */
.zpw-dpad::before {
  content: '';
  position: absolute;
  top: 50%; left: 0; right: 0;
  height: 26px;
  transform: translateY(-50%);
  background: linear-gradient(180deg, #202020, #181818);
  border-radius: 5px;
  box-shadow: inset 0 2px 5px rgba(0,0,0,0.85), 0 1px 0 rgba(255,255,255,0.04);
}

/* vertical arm */
.zpw-dpad::after {
  content: '';
  position: absolute;
  left: 50%; top: 0; bottom: 0;
  width: 26px;
  transform: translateX(-50%);
  background: linear-gradient(90deg, #181818, #202020, #181818);
  border-radius: 5px;
  box-shadow: inset 0 2px 5px rgba(0,0,0,0.85), 0 1px 0 rgba(255,255,255,0.04);
}

.zpw-d {
  position: absolute;
  z-index: 1;
  width: 26px;
  height: 26px;
  background: transparent;
  border: none;
  color: #404040;
  font-size: 7px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  transition: color 0.1s;
}

.zpw-d:hover  { color: #993333; }
.zpw-d:active { color: #cc4444; transform: scale(0.92); }

.zpw-d-up    { top: 0;    left: 50%; transform: translateX(-50%); }
.zpw-d-down  { bottom: 0; left: 50%; transform: translateX(-50%); }
.zpw-d-left  { left: 0;   top: 50%;  transform: translateY(-50%); }
.zpw-d-right { right: 0;  top: 50%;  transform: translateY(-50%); }

.zpw-d-nub {
  position: absolute;
  z-index: 2;
  top: 50%; left: 50%;
  transform: translate(-50%, -50%);
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: #141414;
  box-shadow: inset 0 2px 4px rgba(0,0,0,0.9);
}

/* BUTTON CLUSTER — triangle layout: C top-centre, A bottom-left, B bottom-right */

.zpw-btn-cluster {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 5px;
}

.zpw-btn-row {
  display: flex;
  gap: 10px;
  align-items: center;
}

.zpw-btn {
  border-radius: 50%;
  border: none;
  font-family: 'Courier New', monospace;
  font-weight: bold;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.07s, box-shadow 0.07s;
  line-height: 1;
}

.zpw-btn:active { transform: translateY(2px) !important; }

/* A — grey, earn rot */
.zpw-btn-a {
  width: 28px;
  height: 28px;
  font-size: 9px;
  color: #555;
  background: linear-gradient(145deg, #252525, #181818);
  box-shadow: 0 3px 0 #080808, inset 0 1px 0 rgba(255,255,255,0.07);
}

.zpw-btn-a:hover   { color: #888; }
.zpw-btn-a:active  { box-shadow: 0 1px 0 #080808, inset 0 1px 0 rgba(255,255,255,0.07); }

/* B — red, battle (primary) */
.zpw-btn-b {
  width: 38px;
  height: 38px;
  font-size: 11px;
  color: #ffaaaa;
  background: linear-gradient(145deg, #aa1818, #7a0e0e);
  box-shadow:
    0 4px 0 #380505,
    0 0 14px rgba(180,15,15,0.4),
    inset 0 1px 0 rgba(255,255,255,0.12);
  text-shadow: 0 0 10px rgba(255,80,80,0.7);
}

.zpw-btn-b:hover  { background: linear-gradient(145deg, #cc2020, #991212); }
.zpw-btn-b:active { box-shadow: 0 1px 0 #380505, inset 0 1px 0 rgba(255,255,255,0.12); }

/* C — dark green, heal */
.zpw-btn-c {
  width: 26px;
  height: 26px;
  font-size: 9px;
  color: #336633;
  background: linear-gradient(145deg, #141e14, #0d150d);
  box-shadow: 0 3px 0 #060a06, inset 0 1px 0 rgba(255,255,255,0.04);
}

.zpw-btn-c:hover  { color: #55aa55; }
.zpw-btn-c:active { box-shadow: 0 1px 0 #060a06, inset 0 1px 0 rgba(255,255,255,0.04); }

/* ─── SPEAKER GRILLE ────────────────────────────────────────────────── */

.zpw-speaker {
  height: 9px;
  margin: 4px 18px 2px;
  background-image:
    radial-gradient(circle, #1e1e1e 1.5px, transparent 1.5px);
  background-size: 7px 9px;
  background-position: center;
  opacity: 0.65;
}

/* ─── STATS FOOTER ──────────────────────────────────────────────────── */

.zpw-stats {
  display: flex;
  justify-content: space-between;
  padding: 5px 1px 0;
  font-size: 9px;
  color: #3a3a3a;
  border-top: 1px solid rgba(160,15,15,0.1);
}

.zpw-stats strong { color: #6a2020; }

/* ─── REALTIME BATTLE NOTIFICATION ──────────────────────────────────── */

.zpw-battle-notif {
  position: absolute;
  inset: 0;
  background: rgba(80,0,0,0.94);
  z-index: 6;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 14px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s;
}

.zpw-battle-notif.active {
  opacity: 1;
  animation: zpw-battle-flash 0.35s ease-out;
}

@keyframes zpw-battle-flash {
  0%   { background-color: rgba(255,30,30,0.98); }
  100% { background-color: rgba(80,0,0,0.94); }
}

.zpw-bn-vs {
  font-size: 10px;
  color: #ff5555;
  letter-spacing: 5px;
  font-weight: bold;
}

.zpw-bn-result {
  font-size: 18px;
  font-weight: bold;
  letter-spacing: 2px;
}

.zpw-bn-result.win  { color: #88ff66; text-shadow: 0 0 10px rgba(80,240,40,0.8); }
.zpw-bn-result.loss { color: #ff4444; text-shadow: 0 0 10px rgba(240,20,20,0.8); }
.zpw-bn-result.drop { color: #66ddff; text-shadow: 0 0 10px rgba(60,190,255,0.75); }
.zpw-bn-result.evolve { color: #d990ff; text-shadow: 0 0 12px rgba(190,80,255,0.82); }
.zpw-bn-result.mythic { color: #ffd45a; text-shadow: 0 0 14px rgba(255,180,20,0.9); }
.zpw-bn-result.event { color: #ffdddd; text-shadow: 0 0 10px rgba(255,100,100,0.65); }

.zpw-bn-opp {
  font-size: 9px;
  color: #cc8888;
  letter-spacing: 0.5px;
  max-width: 136px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.zpw-bn-pet {
  max-width: 138px;
  color: #ffd1d1;
  font-size: 10px;
  font-weight: 800;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.zpw-bn-roll {
  color: #ffaaaa;
  font-size: 9px;
  font-weight: 700;
}

.zpw-bn-stats {
  color: #ffdddd;
  font-size: 8px;
  font-weight: 700;
}

.zpw-bn-tags {
  max-width: 138px;
  color: #ffcc55;
  font-size: 8px;
  font-weight: 800;
  overflow: hidden;
  text-overflow: ellipsis;
  text-transform: uppercase;
  white-space: nowrap;
}

.zpw-bn-loot {
  font-size: 11px;
  color: #ffaa22;
  font-weight: bold;
  text-shadow: 0 0 8px rgba(255,150,0,0.6);
}

/* LED battle-mode flash */
.zpw-led-battle {
  background: #ff2020 !important;
  box-shadow: 0 0 14px #ff2020, 0 0 4px #ff8888 !important;
  animation: zpw-led-blink 0.25s steps(1) infinite !important;
}

@keyframes zpw-led-blink {
  0%, 100% { opacity: 1; }
  50%       { opacity: 0; }
}

/* ─── NO-PET / LOADING STATES ───────────────────────────────────────── */

.zpw-no-pet {
  text-align: center;
  color: #1a4020;
  font-size: 11px;
  padding: 20px;
  line-height: 1.8;
}

.zpw-no-pet span {
  display: block;
  font-size: 30px;
  opacity: 0.35;
  margin-bottom: 4px;
}

.zpw-loading {
  color: #1a3a20;
  font-size: 10px;
  text-align: center;
  padding: 30px 10px;
}
