/* PixelLove — UI do jogo */
.pl-root {
  --pl-brand: #e8457a;
  --pl-accent: #ffb84d;
  --pl-ink: #2a1d2e;
  --pl-paper: #fff4e6;
  position: relative;
  overflow: hidden;
  background: #140d24;
  font-family: 'Pixelify Sans', 'Press Start 2P', monospace;
  color: var(--pl-paper);
  user-select: none;
  -webkit-user-select: none;
  touch-action: none;
}
.pl-root.pl-demo { touch-action: auto; pointer-events: none; }
.pl-canvas { display: block; image-rendering: pixelated; image-rendering: crisp-edges; }

/* HUD */
.pl-hud { position: absolute; top: 14px; left: 14px; right: 14px; display: flex; justify-content: space-between; gap: 8px; pointer-events: none; z-index: 5; }
.pl-hud-left, .pl-hud-right { display: flex; gap: 6px; align-items: center; }
.pl-chip {
  font-family: 'Press Start 2P', monospace; font-size: 10px; line-height: 1;
  padding: 9px 11px; background: #f6e3b4; color: #5a3420;
  box-shadow: 0 0 0 2px #5a3420, 0 0 0 4px #c47a3f, 0 0 0 6px #5a3420, 0 5px 0 4px rgba(0,0,0,.25);
}
.pl-chip-heart { color: #c2335f; }
.pl-icon {
  pointer-events: auto; width: 38px; height: 38px; border: 0; cursor: pointer;
  background: #f6e3b4; color: #5a3420; font-size: 16px;
  box-shadow: 0 0 0 2px #5a3420, 0 0 0 4px #c47a3f, 0 0 0 6px #5a3420;
}
.pl-icon:active { transform: translateY(1px); }

/* toast */
.pl-toast {
  position: absolute; left: 50%; top: 96px; transform: translate(-50%, -10px); opacity: 0;
  transition: opacity .25s, transform .25s; z-index: 6; pointer-events: none;
  font-size: 15px; padding: 8px 14px; background: var(--pl-brand); color: #fff; white-space: nowrap;
  box-shadow: 0 0 0 2px var(--pl-ink), 0 4px 0 0 rgba(0,0,0,.35);
  max-width: 92%; overflow: hidden; text-overflow: ellipsis;
}
.pl-toast.show { opacity: 1; transform: translate(-50%, 0); }

/* diálogo (pergaminho com moldura de madeira) */
.pl-dialog {
  position: absolute; left: 50%; bottom: 16px; transform: translateX(-50%);
  width: min(94%, 820px); z-index: 8; cursor: pointer;
  background: linear-gradient(#fbecc4, #f3dba6); color: #4a2a1a; padding: 18px 20px 20px;
  box-shadow: 0 0 0 3px #4a2a1a, 0 0 0 7px #c47a3f, 0 0 0 9px #e3a564, 0 0 0 12px #4a2a1a, 0 12px 0 8px rgba(0,0,0,.28);
}
.pl-dialog::before { content: ''; position: absolute; inset: 6px; border: 2px dashed rgba(122, 74, 44, .25); pointer-events: none; }
.pl-speaker {
  position: absolute; top: -22px; left: 18px; font-family: 'Press Start 2P', monospace; font-size: 10px;
  background: #c47a3f; color: #fff4e0; padding: 8px 10px; box-shadow: 0 0 0 3px #4a2a1a, inset 0 -3px 0 #9a5a2c;
  max-width: 70%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; text-shadow: 1px 1px 0 #4a2a1a;
}
.pl-dlg-body { display: flex; gap: 16px; align-items: stretch; }
.pl-text { flex: 1; min-height: 110px; font-size: clamp(16px, 2.3vw, 21px); line-height: 1.45; white-space: pre-wrap; word-break: break-word; }
.pl-portrait-box { width: 132px; flex-shrink: 0; display: flex; flex-direction: column; align-items: center; gap: 6px; }
.pl-portrait-canvas {
  width: 120px; height: 120px; image-rendering: pixelated; background: linear-gradient(#bfe6f2, #8fc7dc);
  box-shadow: 0 0 0 3px #4a2a1a, 0 0 0 6px #c47a3f, 0 0 0 8px #4a2a1a;
}
.pl-portrait-name { font-family: 'Press Start 2P', monospace; font-size: 8px; color: #7a4a2c; text-align: center; max-width: 132px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; margin-top: 4px; }
.pl-next { position: absolute; right: 164px; bottom: 8px; font-size: 13px; color: #c2335f; animation: pl-bounce .6s infinite alternate steps(2); }
@keyframes pl-bounce { to { transform: translateY(3px); } }
@media (max-width: 560px) {
  .pl-portrait-box { width: 88px; }
  .pl-portrait-canvas { width: 80px; height: 80px; }
  .pl-next { right: 116px; }
  .pl-dialog { padding: 16px 14px 18px; }
}

/* foto */
.pl-photo { position: absolute; inset: 0; z-index: 9; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 14px; background: rgba(12, 6, 24, .72); cursor: pointer; }
.pl-photo[hidden] { display: none; }
.pl-polaroid { margin: 0; background: #fffdf7; padding: 10px 10px 0; box-shadow: 0 0 0 3px var(--pl-ink), 0 12px 0 0 rgba(0,0,0,.35); transform: rotate(-2deg); max-width: min(86vw, 520px); }
.pl-photo.in .pl-polaroid { animation: pl-pop .45s cubic-bezier(.2, 1.4, .4, 1); }
@keyframes pl-pop { from { transform: rotate(-8deg) scale(.6); opacity: 0; } to { transform: rotate(-2deg) scale(1); opacity: 1; } }
.pl-polaroid img { display: block; max-width: 100%; max-height: min(58vh, 520px); object-fit: contain; image-rendering: auto; }
.pl-polaroid figcaption { color: var(--pl-ink); font-size: 16px; text-align: center; padding: 10px 6px 12px; }
.pl-hint { font-size: 13px; opacity: .8; }

/* telas */
.pl-screen {
  position: absolute; inset: 0; z-index: 30; display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 16px; padding: 24px; text-align: center;
  background: radial-gradient(ellipse at 50% 30%, #3a1d5c 0%, #1a1033 55%, #0e0820 100%);
}
.pl-screen[hidden] { display: none; }
.pl-screen.pl-title { background: radial-gradient(ellipse at 50% 40%, rgba(58,29,92,.35) 0%, rgba(26,16,51,.72) 60%, rgba(14,8,32,.9) 100%); }
.pl-screen.pl-title::before { opacity: .3; }
.pl-screen::before {
  content: ''; position: absolute; inset: 0; pointer-events: none; opacity: .55;
  background-image: radial-gradient(1px 1px at 12% 18%, #fff, transparent), radial-gradient(1px 1px at 72% 12%, #fff, transparent),
    radial-gradient(1px 1px at 34% 72%, #fff, transparent), radial-gradient(1px 1px at 88% 64%, #fff, transparent),
    radial-gradient(1px 1px at 52% 42%, #ffd34d, transparent), radial-gradient(1px 1px at 18% 88%, #ff8fb3, transparent);
}
.pl-screen > * { position: relative; }
.pl-kicker { font-family: 'Press Start 2P', monospace; font-size: 10px; letter-spacing: 2px; color: var(--pl-accent); }
.pl-h1 { font-family: 'Press Start 2P', monospace; font-size: clamp(18px, 4vw, 34px); line-height: 1.4; margin: 0; color: #fff; text-shadow: 3px 3px 0 var(--pl-brand), 6px 6px 0 var(--pl-ink); max-width: 900px; }
.pl-h2 { font-family: 'Press Start 2P', monospace; font-size: clamp(14px, 2.6vw, 22px); line-height: 1.5; margin: 0; color: #fff; max-width: 760px; text-shadow: 3px 3px 0 var(--pl-ink); }
.pl-date, .pl-theme { font-size: 18px; color: #ffd1e0; }
.pl-theme { font-size: 15px; opacity: .8; }
.pl-names { font-size: 20px; color: #ffd1e0; }
.pl-help { font-size: 13px; opacity: .65; }
.pl-duo { display: flex; align-items: center; gap: 10px; }
.pl-portrait { width: 160px; height: 160px; image-rendering: pixelated; }
@media (max-width: 560px) { .pl-portrait { width: 120px; height: 120px; } }
.pl-duo-heart { color: var(--pl-brand); font-size: 28px; animation: pl-beat 1s infinite; }
@keyframes pl-beat { 50% { transform: scale(1.25); } }
.pl-row { display: flex; gap: 12px; flex-wrap: wrap; justify-content: center; }
.pl-btn {
  font-family: 'Press Start 2P', monospace; font-size: 12px; border: 0; cursor: pointer; text-decoration: none; display: inline-block;
  padding: 15px 20px; background: var(--pl-brand); color: #fff; text-shadow: 1px 1px 0 rgba(0,0,0,.35);
  box-shadow: 0 0 0 3px var(--pl-ink), inset -4px -4px 0 0 rgba(0,0,0,.25), inset 4px 4px 0 0 rgba(255,255,255,.25), 0 6px 0 0 rgba(0,0,0,.35);
}
.pl-btn:hover { filter: brightness(1.08); }
.pl-btn:active { transform: translateY(3px); box-shadow: 0 0 0 3px var(--pl-ink), inset 4px 4px 0 0 rgba(0,0,0,.25); }
.pl-btn-ghost { background: transparent; color: var(--pl-paper); box-shadow: 0 0 0 3px var(--pl-paper); }
.pl-blink { animation: pl-blink 1.2s infinite steps(2); }
@keyframes pl-blink { 50% { filter: brightness(1.25); } }
.pl-proposal .pl-h2 { font-size: clamp(18px, 3.4vw, 30px); color: #ffd1e0; }

.pl-banner {
  position: absolute; top: 60px; left: 50%; transform: translateX(-50%); z-index: 7;
  font-family: 'Press Start 2P', monospace; font-size: clamp(11px, 1.8vw, 15px); white-space: nowrap;
  background: var(--pl-accent); color: var(--pl-ink); padding: 10px 14px; box-shadow: 0 0 0 3px var(--pl-ink);
  animation: pl-pop .5s;
}
.pl-watermark {
  position: absolute; right: 12px; bottom: 12px; z-index: 4; pointer-events: none;
  font-family: 'Press Start 2P', monospace; font-size: 10px; color: #fff; background: rgba(232, 69, 122, .85); padding: 6px 8px;
}
.pl-fade { position: absolute; inset: 0; background: #0b0618; opacity: 0; pointer-events: none; transition: opacity .4s; z-index: 20; }
.pl-fade.on { opacity: 1; }

/* controles touch */
.pl-touch { position: absolute; left: 0; right: 0; bottom: 0; height: 0; z-index: 7; display: none; }
@media (pointer: coarse) { .pl-touch { display: block; } }
.pl-dpad { position: absolute; left: 18px; bottom: 18px; width: 132px; height: 132px; }
.pl-d {
  position: absolute; width: 44px; height: 44px; border: 0; font-size: 14px; color: var(--pl-paper);
  background: rgba(20, 13, 36, .55); box-shadow: 0 0 0 2px rgba(255,255,255,.35); touch-action: none;
}
.pl-d:active { background: rgba(232, 69, 122, .7); }
.pl-d-up { left: 44px; top: 0; } .pl-d-down { left: 44px; bottom: 0; }
.pl-d-left { left: 0; top: 44px; } .pl-d-right { right: 0; top: 44px; }
.pl-a {
  position: absolute; right: 22px; bottom: 40px; width: 68px; height: 68px; border-radius: 50%; border: 0;
  font-family: 'Press Start 2P', monospace; font-size: 16px; color: #fff; background: rgba(232, 69, 122, .8);
  box-shadow: 0 0 0 3px rgba(255,255,255,.4); touch-action: none;
}
.pl-a:active { transform: scale(.94); }
.pl-root:has(.pl-dialog:not([hidden])) .pl-joy, .pl-root:has(.pl-mem:not([hidden])) .pl-joy { opacity: .35; }

/* ---------- v5: missão, joystick, cartas, abertura, final ---------- */
.pl-quest {
  pointer-events: none; max-width: min(62vw, 440px); padding: 9px 12px 10px; background: #f6e3b4; color: #5a3420;
  box-shadow: 0 0 0 2px #5a3420, 0 0 0 4px #c47a3f, 0 0 0 6px #5a3420, 0 5px 0 4px rgba(0,0,0,.25);
}
.pl-q-phase { font-family: 'Press Start 2P', monospace; font-size: 9px; line-height: 1.4; color: #c2335f; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pl-q-goal { font-size: 15px; line-height: 1.25; margin-top: 5px; }
.pl-q-dots { display: flex; gap: 5px; margin-top: 7px; }
.pl-q-dots span { width: 12px; height: 12px; background: #ead2a2; box-shadow: inset 0 0 0 2px #8a5a3a; }
.pl-q-dots span.on { background: #e8457a; box-shadow: inset 0 0 0 2px #7a1f3e, inset 3px 3px 0 0 rgba(255,255,255,.35); }
@media (max-width: 560px) { .pl-quest { max-width: calc(100vw - 80px); } .pl-q-goal { font-size: 13px; } }

.pl-joy {
  position: absolute; left: 22px; bottom: 26px; width: 124px; height: 124px; border-radius: 50%; touch-action: none;
  background: radial-gradient(circle, rgba(20,13,36,.25) 0%, rgba(20,13,36,.5) 70%); box-shadow: 0 0 0 3px rgba(255,255,255,.35), inset 0 0 0 10px rgba(255,255,255,.05);
}
.pl-joy.on { box-shadow: 0 0 0 3px rgba(255,184,77,.8), inset 0 0 0 10px rgba(255,255,255,.07); }
.pl-knob {
  position: absolute; left: 50%; top: 50%; width: 54px; height: 54px; margin: -27px 0 0 -27px; border-radius: 50%; pointer-events: none;
  background: radial-gradient(circle at 35% 30%, #fff4e6 0%, #f3cfa0 45%, #c47a3f 100%); box-shadow: 0 0 0 3px #4a2a1a, 0 4px 0 rgba(0,0,0,.35);
}

.pl-mem { position: absolute; inset: 0; z-index: 9; display: flex; align-items: center; justify-content: center; padding: 16px; background: rgba(12, 6, 24, .62); }
.pl-mem[hidden] { display: none; }
.pl-mem.in .pl-mem-card { animation: pl-letter .5s cubic-bezier(.2, 1.3, .4, 1); }
@keyframes pl-letter { from { transform: translateY(40px) rotate(-4deg) scale(.7); opacity: 0; } to { transform: none; opacity: 1; } }
.pl-mem-card {
  position: relative; width: min(100%, 440px); max-height: 100%; display: flex; flex-direction: column; gap: 10px; padding: 16px 16px 18px;
  background: #fbf1dc; color: #4a2a1a; text-align: left;
  background-image: radial-gradient(#f0dfbd 1px, transparent 1px); background-size: 8px 8px;
  box-shadow: 0 0 0 3px #4a2a1a, 0 0 0 7px #e8b7c4, 0 0 0 10px #4a2a1a, 0 14px 0 6px rgba(0,0,0,.3);
}
.pl-mem-top { display: flex; justify-content: space-between; align-items: center; }
.pl-mem-kicker { font-family: 'Press Start 2P', monospace; font-size: 9px; color: #c2335f; letter-spacing: 1px; }
.pl-mem-stamp { width: 30px; height: 34px; display: grid; place-items: center; color: #fff; font-size: 16px; background: #e8457a; box-shadow: 0 0 0 2px #fbf1dc, 0 0 0 4px #e8457a; outline: 2px dashed #fbf1dc; outline-offset: -5px; transform: rotate(6deg); }
.pl-mem-frame { background: #2a1d2e; padding: 4px; box-shadow: 0 4px 0 rgba(0,0,0,.18); }
.pl-mem-snap { display: block; width: 100%; height: auto; image-rendering: pixelated; }
.pl-mem-meta { font-size: 14px; color: #8a5a3a; }
.pl-mem-title { margin: 0; font-family: 'Press Start 2P', monospace; font-size: 12px; line-height: 1.5; color: #4a2a1a; }
.pl-mem-text { margin: 0; font-size: clamp(16px, 2.2vw, 19px); line-height: 1.45; overflow: auto; max-height: 32vh; white-space: pre-wrap; }
.pl-mem-btn { align-self: center; margin-top: 4px; font-size: 11px; padding: 13px 18px; }
@media (max-height: 520px) { .pl-mem-frame { display: none; } }

.pl-intro { gap: 14px; }
.pl-intro-duo { display: flex; align-items: center; gap: 12px; }
.pl-frame { display: flex; flex-direction: column; align-items: center; gap: 8px; }
.pl-frame .pl-portrait {
  width: 132px; height: 132px; background: linear-gradient(#bfe6f2, #8fc7dc);
  box-shadow: 0 0 0 3px #4a2a1a, 0 0 0 7px #c47a3f, 0 0 0 9px #e3a564, 0 0 0 12px #4a2a1a, 0 10px 0 6px rgba(0,0,0,.3);
}
.pl-frame:last-child .pl-portrait { background: linear-gradient(#ffd6e6, #f3a8c4); }
.pl-frame-name { margin-top: 10px; font-family: 'Press Start 2P', monospace; font-size: 10px; background: #f6e3b4; color: #5a3420; padding: 6px 9px; box-shadow: 0 0 0 2px #5a3420; max-width: 150px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pl-script { margin: 4px 0 0; font-family: 'Dancing Script', cursive; font-weight: 700; font-size: clamp(24px, 4.2vw, 36px); line-height: 1.2; color: #ffd1e0; text-shadow: 2px 2px 0 rgba(42,29,46,.8); max-width: 720px; }
.pl-intro .pl-h1 { font-size: clamp(14px, 2.6vw, 22px); }
@media (max-width: 560px) { .pl-frame .pl-portrait { width: 104px; height: 104px; } .pl-intro-duo { gap: 6px; } }
.pl-place { font-size: 16px; color: #ffe6b0; }

.pl-banner-script { font-family: 'Dancing Script', cursive; font-weight: 700; font-size: clamp(22px, 3.6vw, 32px); background: rgba(42,29,46,.78); color: #ffd1e0; box-shadow: 0 0 0 3px #ffd1e0, 0 0 0 6px rgba(42,29,46,.78); padding: 10px 22px; white-space: normal; text-align: center; max-width: 92%; }
.pl-banner-big { top: 18%; font-size: clamp(12px, 2.2vw, 18px); line-height: 1.6; padding: 14px 18px; white-space: normal; text-align: center; max-width: 92%; background: #fbf1dc; color: #c2335f; box-shadow: 0 0 0 3px #4a2a1a, 0 0 0 7px #e8b7c4, 0 0 0 10px #4a2a1a; }
.pl-end .pl-script { font-size: clamp(22px, 3.4vw, 30px); }
.pl-screen.pl-end, .pl-screen.pl-proposal { background: radial-gradient(ellipse at 50% 40%, rgba(58,29,92,.55) 0%, rgba(26,16,51,.78) 70%, rgba(14,8,32,.9) 100%); }
.pl-root.pl-noctl .pl-touch { display: none; }
