*, *::before, *::after { box-sizing: border-box; }

html, body {
  margin: 0;
  min-height: 100%;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background: #0a0c10;
  color: #e8eaed;
}

.pp-scene {
  min-height: 100vh;
  background: linear-gradient(180deg, #12141a 0%, #060608 100%);
  transition: filter 0.4s;
}

.pp-scene.is-danger { filter: saturate(1.4) contrast(1.1); }
.pp-scene.is-dead { filter: brightness(0.3); }

.pp-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  border-bottom: 1px solid rgba(255,255,255,0.08);
  font-size: 0.85rem;
}

.pp-header a { color: #8ab4f8; text-decoration: none; }
.pp-header a:hover { text-decoration: underline; }
.pp-title { opacity: 0.7; letter-spacing: 0.08em; text-transform: uppercase; font-size: 0.75rem; }

.pp-room {
  position: relative;
  min-height: calc(100vh - 49px);
  padding: 24px;
  overflow: hidden;
}

.pp-lives-bar {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.pp-lives {
  display: flex;
  gap: 6px;
}

.pp-life {
  color: #f28b82;
  font-size: 1.1rem;
  line-height: 1;
  transition: opacity 0.3s;
}

.pp-life--lost {
  opacity: 0.2;
  color: #666;
}

.pp-status {
  margin: 32px 0 8px;
  max-width: 520px;
  line-height: 1.5;
  opacity: 0.85;
}

.pp-round {
  margin: 0;
  font-size: 0.8rem;
  opacity: 0.5;
}

.pp-entity {
  position: absolute;
  right: -80px;
  bottom: 10%;
  width: 140px;
  height: 220px;
  background: radial-gradient(ellipse at 50% 30%, rgba(180,40,60,0.5), rgba(20,0,0,0.95));
  border-radius: 40% 40% 10% 10%;
  opacity: 0;
  transform: translateX(40px) scale(0.85);
  transition: opacity 0.5s, transform 0.5s, right 0.5s;
  box-shadow: 0 0 60px rgba(200,30,50,0.4);
}

.pp-entity::before,
.pp-entity::after {
  content: '';
  position: absolute;
  top: 28%;
  width: 14px;
  height: 14px;
  background: #ff2222;
  border-radius: 50%;
  box-shadow: 0 0 12px #f00;
}

.pp-entity::before { left: 28%; }
.pp-entity::after { right: 28%; }

.pp-entity.is-visible { opacity: 1; transform: translateX(0) scale(1); }
.pp-entity.level-1 { right: 8%; opacity: 0.35; }
.pp-entity.level-2 { right: 14%; opacity: 0.55; }
.pp-entity.level-3 { right: 22%; opacity: 0.75; }
.pp-entity.level-4 { right: 30%; opacity: 0.95; }

.pp-dialog-stack {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  pointer-events: none;
  z-index: 20;
}

.pp-dialog {
  pointer-events: auto;
  background: #fff;
  color: #202124;
  border-radius: 8px;
  box-shadow: 0 12px 48px rgba(0,0,0,0.45), 0 0 0 1px rgba(0,0,0,0.08);
  max-width: 420px;
  width: 100%;
  padding: 0;
  animation: pp-pop 0.25s ease;
}

@keyframes pp-pop {
  from { opacity: 0; transform: scale(0.92) translateY(8px); }
  to { opacity: 1; transform: none; }
}

.pp-dialog-head {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 16px 18px 0;
  font-size: 0.95rem;
  font-weight: 600;
}

.pp-dialog-icon {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  background: #f1f3f4;
}

.pp-dialog-body {
  padding: 12px 18px 18px;
  font-size: 0.9rem;
  line-height: 1.45;
}

.pp-dialog-body strong { color: #1a73e8; }

.pp-dialog-foot {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  padding: 0 18px 16px;
}

.pp-dialog-btn {
  padding: 8px 20px;
  border-radius: 4px;
  border: none;
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  font-family: inherit;
}

.pp-dialog-btn--block {
  background: #fff;
  color: #1a73e8;
  border: 1px solid #dadce0;
}

.pp-dialog-btn--block:hover { background: #f8f9fa; }

.pp-dialog-btn--allow {
  background: #1a73e8;
  color: #fff;
}

.pp-dialog-btn--allow:hover { background: #1765cc; }

.pp-artifacts {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 15;
  overflow: hidden;
}

.pp-artifact {
  pointer-events: auto;
}

.pp-artifact--file {
  position: absolute;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  width: 88px;
  padding: 8px 6px;
  background: #fff;
  border: 1px solid #dadce0;
  border-radius: 6px;
  box-shadow: 0 4px 16px rgba(0,0,0,0.35);
  cursor: pointer;
  font-family: inherit;
  animation: pp-file-in 0.35s ease;
}

@keyframes pp-file-in {
  from { opacity: 0; transform: scale(0.7) translateY(12px); }
  to { opacity: 1; transform: none; }
}

.pp-artifact-icon { font-size: 1.6rem; }

.pp-artifact-name {
  font-size: 0.62rem;
  color: #202124;
  word-break: break-all;
  line-height: 1.2;
  text-align: center;
}

.pp-artifact--window {
  position: absolute;
  width: min(280px, 42vw);
  background: #ececec;
  border: 1px solid #999;
  border-radius: 6px 6px 0 0;
  box-shadow: 0 8px 28px rgba(0,0,0,0.45);
  animation: pp-file-in 0.3s ease;
}

.pp-fake-win-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 6px 10px;
  background: linear-gradient(180deg, #f6f6f6, #ddd);
  font-size: 0.72rem;
  color: #333;
}

.pp-fake-win-x {
  border: none;
  background: #ccc;
  border-radius: 3px;
  width: 20px;
  height: 20px;
  cursor: pointer;
  font-size: 11px;
}

.pp-fake-win-body {
  padding: 12px;
  min-height: 72px;
  background: #fff;
  font-size: 0.8rem;
  color: #888;
}

.pp-artifact--toast {
  position: fixed;
  right: 16px;
  bottom: 16px;
  max-width: 280px;
  padding: 12px 14px;
  background: #323232;
  color: #fff;
  border-radius: 8px;
  box-shadow: 0 6px 24px rgba(0,0,0,0.4);
  z-index: 30;
  animation: pp-toast-in 0.3s ease;
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 0.82rem;
}

.pp-artifact--toast.is-out { opacity: 0; transition: opacity 0.4s; }

@keyframes pp-toast-in {
  from { opacity: 0; transform: translateX(20px); }
  to { opacity: 1; transform: none; }
}

.pp-artifact--glitch {
  position: fixed;
  inset: 0;
  pointer-events: none;
  background: repeating-linear-gradient(
    0deg,
    transparent,
    transparent 2px,
    rgba(255,0,0,0.03) 2px,
    rgba(255,0,0,0.03) 4px
  );
  animation: pp-glitch 0.15s steps(2) infinite;
  z-index: 14;
}

@keyframes pp-glitch {
  50% { transform: translateX(2px); opacity: 0.6; }
}

.pp-artifact--cache {
  position: absolute;
  left: 12px;
  bottom: 80px;
  padding: 10px 14px;
  background: rgba(30,30,40,0.92);
  border: 1px solid rgba(255,255,255,0.15);
  border-radius: 6px;
  font-size: 0.78rem;
  color: #aaa;
}

.pp-file-preview {
  position: fixed;
  inset: 0;
  z-index: 45;
  background: rgba(0,0,0,0.55);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.pp-file-preview[hidden] { display: none !important; }

.pp-file-preview-box {
  background: #fff;
  color: #202124;
  border-radius: 8px;
  padding: 24px 28px;
  max-width: 360px;
  width: 100%;
  position: relative;
  text-align: center;
}

.pp-file-preview-close {
  position: absolute;
  top: 10px;
  right: 10px;
  border: none;
  background: none;
  font-size: 16px;
  cursor: pointer;
  color: #666;
}

.pp-file-preview-name {
  font-weight: 600;
  word-break: break-all;
  margin: 0 0 12px;
}

.pp-file-preview-body {
  margin: 0;
  color: #5f6368;
  font-size: 0.9rem;
}

.pp-enabled {
  margin: 20px 0 12px;
  padding: 12px 14px;
  background: rgba(255,255,255,0.04);
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 6px;
  max-width: 480px;
  font-size: 0.8rem;
}

.pp-enabled-label {
  display: block;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  opacity: 0.6;
  margin-bottom: 8px;
}

.pp-enabled ul {
  margin: 0;
  padding: 0;
  list-style: none;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.pp-enabled li {
  padding: 4px 10px;
  background: rgba(26,115,232,0.2);
  border: 1px solid rgba(26,115,232,0.35);
  border-radius: 999px;
  font-size: 0.75rem;
  color: #8ab4f8;
}

.pp-enabled li.pp-enabled--creepy {
  background: rgba(234,67,53,0.2);
  border-color: rgba(234,67,53,0.45);
  color: #f28b82;
}

.pp-feed--screen {
  width: 200px;
  height: 120px;
  object-fit: contain;
  border-radius: 6px;
  border: 2px solid rgba(180,40,60,0.6);
  background: #000;
}

.pp-feed--label,
.pp-feed--data {
  padding: 8px 12px;
  font-size: 0.78rem;
  background: rgba(180,40,60,0.12);
  border: 1px solid rgba(180,40,60,0.35);
  border-radius: 6px;
  align-self: center;
}

.pp-media {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin: 12px 0;
  max-width: 520px;
}

.pp-feed--cam {
  width: 160px;
  height: 120px;
  object-fit: cover;
  border-radius: 6px;
  border: 2px solid rgba(234,67,53,0.5);
  transform: scaleX(-1);
}

.pp-feed--mic {
  padding: 10px 16px;
  background: rgba(234,67,53,0.15);
  border: 1px solid rgba(234,67,53,0.4);
  border-radius: 6px;
  font-size: 0.85rem;
  animation: pp-mic-pulse 1.5s ease infinite;
}

@keyframes pp-mic-pulse {
  50% { opacity: 0.65; }
}

.pp-overlay {
  position: fixed;
  inset: 0;
  z-index: 50;
  background: rgba(0,0,0,0.82);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.pp-overlay[hidden] { display: none !important; }

.pp-overlay-box {
  background: #1a1d24;
  border: 1px solid rgba(255,255,255,0.12);
  border-radius: 12px;
  padding: 32px 28px;
  max-width: 440px;
  text-align: center;
}

.pp-overlay-box h1,
.pp-overlay-box h2 {
  margin: 0 0 12px;
  font-size: 1.5rem;
}

.pp-overlay-box p {
  margin: 0 0 12px;
  line-height: 1.5;
  opacity: 0.9;
}

.pp-credit {
  font-size: 0.7rem;
  letter-spacing: 0.3em;
  text-transform: uppercase;
  opacity: 0.6;
  margin-bottom: 8px !important;
}

.pp-rule { color: #fbbc04; font-size: 0.9rem; }

.pp-btn {
  display: inline-block;
  margin: 8px 4px 0;
  padding: 10px 22px;
  border-radius: 6px;
  border: 1px solid rgba(255,255,255,0.2);
  background: #2a2f3a;
  color: #fff;
  font-family: inherit;
  font-size: 0.9rem;
  cursor: pointer;
  text-decoration: none;
}

.pp-btn--primary { background: #1a73e8; border-color: #1a73e8; }
.pp-btn--ghost { background: transparent; }

.pp-overlay--dead .pp-overlay-box h2 { color: #ea4335; }

.pp-flash {
  animation: pp-flash 0.4s ease;
}

@keyframes pp-flash {
  0%, 100% { background: transparent; }
  50% { background: rgba(234,67,53,0.25); }
}
