:root{
  --fb-blue:#3b5998;
  --fb-blue-dark:#2d4373;
  --fb-light:#dfe3ee;
  --paper:#f5f0e3;
  --ink:#2a2a2a;
  --accent:#e23b3b;
  --tape:rgba(225,210,150,.55);
  --shadow:6px 6px 0 rgba(0,0,0,.18);
}

*{box-sizing:border-box}
html,body{margin:0;padding:0}
body{
  font-family:Tahoma, Geneva, Verdana, sans-serif;
  color:var(--ink);
  min-height:100vh;
  position:relative;
  overflow-x:hidden;
}

/* ---------- FONDO ---------- */
.bg{position:fixed;inset:0;z-index:-2;background:#cdd9e6}
.bg-arch{position:absolute;inset:0;width:100%;height:100%;object-fit:cover;
  image-rendering:pixelated;filter:saturate(.8) contrast(1.05);opacity:.95}
.bg-grain{position:absolute;inset:0;pointer-events:none;mix-blend-mode:multiply;opacity:.32;
  background-image:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='120' height='120'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E")}
.bg-scan{position:absolute;inset:0;pointer-events:none;opacity:.10;
  background:repeating-linear-gradient(to bottom,#000 0 1px,transparent 1px 3px)}

/* ---------- TOPBAR ---------- */
.topbar{position:sticky;top:0;z-index:50;background:var(--fb-blue);
  border-bottom:3px solid var(--fb-blue-dark);box-shadow:0 3px 0 rgba(0,0,0,.25)}
.topbar-in{max-width:1100px;margin:0 auto;display:flex;align-items:center;gap:14px;
  padding:8px 14px}
.logo{font-family:'Press Start 2P',monospace;color:#fff;font-size:15px;letter-spacing:1px;
  text-shadow:2px 2px 0 #1c2b4a}
.fakesearch{flex:1}
.fakesearch input{width:100%;max-width:240px;border:2px inset #9fb0d6;border-radius:3px;
  padding:3px 8px;font-family:Tahoma;background:#eaf0fb;color:#556}
.topbar-right{color:#dfe3ee;font-size:12px}
.topbar-right b{color:#fff;background:var(--accent);padding:1px 6px;border-radius:3px;
  text-transform:uppercase;font-size:11px}

/* ---------- LAYOUT ---------- */
.wrap{max-width:1100px;margin:0 auto;padding:18px 14px 60px}

.sticker-shadow{box-shadow:var(--shadow)}

/* perfil */
.profile{display:flex;gap:18px;align-items:flex-start;flex-wrap:wrap;
  background:var(--paper);border:1px solid #cbb;border-radius:4px;padding:16px;margin-bottom:20px;
  position:relative}
.profile-pic{position:relative;flex:0 0 auto;transform:rotate(-2deg)}
.profile-pic img{width:120px;height:120px;object-fit:cover;border:6px solid #fff;
  box-shadow:0 2px 6px rgba(0,0,0,.3);image-rendering:auto;display:block;filter:contrast(1.05) saturate(.95)}
.profile-info{flex:1;min-width:220px}
.profile-info h1{font-family:'Press Start 2P';font-size:22px;margin:.1em 0 .35em;color:var(--fb-blue-dark);
  text-shadow:2px 2px 0 #d8c98f}
.verified{color:#1779e0;font-size:16px}
.tagline{margin:.2em 0 .6em;font-size:15px}
.meta{list-style:none;margin:.4em 0;padding:0;font-size:13px;color:#555;line-height:1.8}
.badges{margin-top:8px;display:flex;gap:8px;flex-wrap:wrap}
.badge{font-family:'Press Start 2P';font-size:9px;background:var(--accent);color:#fff;
  padding:6px 8px;border-radius:3px;transform:rotate(-2deg);box-shadow:2px 2px 0 rgba(0,0,0,.25)}
.badge.alt{background:var(--fb-blue);transform:rotate(2deg)}
.poke{margin-left:auto;text-align:right}
.poke button{font-family:Tahoma;background:linear-gradient(#fff,#e3e8f3);border:1px solid #9fb0d6;
  border-radius:4px;padding:6px 10px;cursor:pointer;font-weight:bold;color:var(--fb-blue-dark)}
.poke button:active{transform:translateY(1px)}
.poke-msg{display:block;font-size:12px;color:var(--accent);margin-top:6px;min-height:1em;font-weight:bold}

/* tape decorativa */
.tape{position:absolute;width:70px;height:24px;background:var(--tape);
  box-shadow:0 1px 2px rgba(0,0,0,.2);z-index:3}
.tape-tl{top:-10px;left:-12px;transform:rotate(-28deg)}

/* columnas */
.columns{display:grid;grid-template-columns:1fr 340px;gap:22px;align-items:start}

.section-title{font-family:'Press Start 2P';font-size:14px;color:#fff;background:var(--fb-blue);
  display:inline-block;padding:8px 12px;border-radius:3px;margin:0 0 4px;
  box-shadow:3px 3px 0 rgba(0,0,0,.25);transform:rotate(-1deg)}
.section-sub{font-size:12px;color:#444;margin:6px 0 14px;background:rgba(255,255,255,.55);
  display:inline-block;padding:2px 6px;border-radius:3px}

/* ---------- MURO DE FOTOS ---------- */
.photo-wall{columns:3 200px;column-gap:14px}
.polaroid{break-inside:avoid;margin:0 0 18px;background:#fff;padding:8px 8px 0;
  border:1px solid #e7e1cf;box-shadow:4px 5px 0 rgba(0,0,0,.18);position:relative;
  cursor:pointer;transition:transform .18s ease, box-shadow .18s ease}
.polaroid img,.polaroid video{display:block;width:100%;height:auto;background:#222;
  filter:contrast(1.06) saturate(.92) sepia(.06)}
.polaroid figcaption{font-family:'VT323',monospace;font-size:18px;line-height:1.05;
  color:#333;padding:7px 4px 10px;text-align:center}
.polaroid .tape{top:-9px;left:50%;margin-left:-35px}
.polaroid:hover{transform:rotate(0deg) scale(1.03);z-index:5;box-shadow:7px 8px 0 rgba(0,0,0,.25)}
.polaroid:nth-child(3n){transform:rotate(2.2deg)}
.polaroid:nth-child(3n+1){transform:rotate(-2.4deg)}
.polaroid:nth-child(4n){transform:rotate(1.3deg)}
.polaroid:nth-child(5n){transform:rotate(-1.4deg)}
.play-badge{position:absolute;top:14px;right:14px;background:var(--accent);color:#fff;
  font-size:11px;padding:2px 6px;border-radius:3px;font-weight:bold;z-index:4}

/* ---------- GUESTBOOK ---------- */
.guestbook{position:sticky;top:64px}
.gb-form{background:var(--paper);border:1px solid #cbb;border-radius:4px;padding:12px;
  display:flex;flex-direction:column;gap:8px}
.gb-form input,.gb-form textarea{font-family:Tahoma;font-size:14px;border:2px inset #cfc6ad;
  border-radius:3px;padding:7px;background:#fffdf5;resize:vertical}
.gb-form input:focus,.gb-form textarea:focus{outline:2px solid var(--fb-blue);background:#fff}
.gb-form-bottom{display:flex;align-items:center;justify-content:space-between}
.gb-count{font-size:11px;color:#999}
.gb-form button{font-family:'Press Start 2P';font-size:10px;background:var(--accent);color:#fff;
  border:none;border-radius:3px;padding:9px 12px;cursor:pointer;box-shadow:2px 2px 0 rgba(0,0,0,.3)}
.gb-form button:disabled{opacity:.5;cursor:wait}
.gb-form button:active{transform:translateY(1px)}
.gb-error{color:var(--accent);font-size:12px;margin:0;min-height:0}
.gb-error:not(:empty){min-height:1em;margin-top:2px}

.gb-live{font-size:12px;color:#333;margin:12px 0 8px;background:rgba(255,255,255,.6);
  display:inline-block;padding:3px 8px;border-radius:3px;font-weight:bold}
.dot{display:inline-block;width:8px;height:8px;background:#3ec46d;border-radius:50%;
  margin-right:4px;box-shadow:0 0 0 0 rgba(62,196,109,.7);animation:pulse 1.6s infinite}
@keyframes pulse{0%{box-shadow:0 0 0 0 rgba(62,196,109,.6)}70%{box-shadow:0 0 0 7px rgba(62,196,109,0)}100%{box-shadow:0 0 0 0 rgba(62,196,109,0)}}

.gb-list{list-style:none;margin:0;padding:0;display:flex;flex-direction:column;gap:10px;
  max-height:70vh;overflow-y:auto}
.gb-item{background:#fff;border:1px solid #e3ddca;border-left:5px solid var(--fb-blue);
  border-radius:3px;padding:9px 11px;box-shadow:3px 3px 0 rgba(0,0,0,.12);
  animation:pop .25s ease}
.gb-item.fresh{border-left-color:var(--accent);background:#fffbe9}
@keyframes pop{from{opacity:0;transform:translateY(-6px)}to{opacity:1;transform:none}}
.gb-item .who{font-weight:bold;color:var(--fb-blue-dark);font-size:14px}
.gb-item .txt{margin:3px 0;font-size:14px;word-wrap:break-word;overflow-wrap:anywhere}
.gb-item .when{font-size:11px;color:#999}
.gb-loading{color:#777;font-style:italic;list-style:none}

/* ---------- LIGHTBOX ---------- */
.lightbox{position:fixed;inset:0;z-index:200;background:rgba(10,12,20,.88);
  display:flex;align-items:center;justify-content:center;padding:20px}
.lightbox[hidden]{display:none}
.lightbox figure{margin:0;max-width:92vw;max-height:92vh;text-align:center}
.lightbox img{max-width:92vw;max-height:80vh;border:8px solid #fff;
  box-shadow:0 10px 40px rgba(0,0,0,.6);image-rendering:auto}
.lightbox figcaption{font-family:'VT323',monospace;font-size:26px;color:#fff;margin-top:12px}
.lb-close{position:absolute;top:16px;right:20px;background:var(--accent);color:#fff;border:none;
  font-size:20px;width:42px;height:42px;border-radius:50%;cursor:pointer;box-shadow:2px 2px 0 rgba(0,0,0,.4)}

/* ---------- FOOTER ---------- */
.footer{text-align:center;margin-top:40px;color:#333;background:rgba(255,255,255,.55);
  padding:14px;border-radius:4px}
.footer-small{font-size:11px;color:#777;margin-top:6px}

/* ---------- FAB + BOTTOM SHEET (mobile) ---------- */
/* en desktop estan ocultos: el guestbook vive como sidebar */
.fab,.sheet-backdrop,.sheet-close,.gb-preview{display:none}

/* preview de firmas inline (se muestra en mobile) */
.gb-preview{margin-top:34px;padding-top:22px;border-top:3px dashed rgba(59,89,152,.4)}
.gb-preview .gb-list{max-height:none;margin-bottom:14px}
.gb-preview-cta{display:block;width:100%;font-family:'Press Start 2P',monospace;font-size:11px;
  line-height:1.5;color:#fff;background:var(--fb-blue);border:none;border-radius:6px;
  padding:15px 14px;cursor:pointer;box-shadow:3px 4px 0 rgba(0,0,0,.3)}
.gb-preview-cta:active{transform:translateY(2px);box-shadow:3px 2px 0 rgba(0,0,0,.3)}

/* ---------- RESPONSIVE ---------- */
@media(max-width:820px){
  .columns{grid-template-columns:1fr}
  .photo-wall{columns:2 150px}
  .poke{margin-left:0;text-align:left;width:100%}
  .profile-info h1{font-size:18px}
  .gb-preview{display:block}

  /* el guestbook deja de ocupar lugar en el flujo: se vuelve panel deslizable */
  .guestbook{
    position:fixed;left:0;right:0;bottom:0;top:auto;z-index:160;
    max-height:86vh;overflow-y:auto;-webkit-overflow-scrolling:touch;
    margin:0;padding:18px 16px calc(20px + env(safe-area-inset-bottom));
    background:var(--paper);border-top:4px solid var(--fb-blue);
    border-radius:18px 18px 0 0;box-shadow:0 -8px 30px rgba(0,0,0,.35);
    transform:translateY(105%);transition:transform .28s cubic-bezier(.2,.8,.2,1);
    visibility:hidden;
  }
  .guestbook::before{content:"";position:absolute;top:7px;left:50%;width:46px;height:5px;
    margin-left:-23px;background:#c3b9a0;border-radius:3px}
  body.sheet-open .guestbook{transform:translateY(0);visibility:visible}
  .gb-list{max-height:none}

  /* boton flotante siempre visible */
  .fab{display:inline-flex;align-items:center;gap:8px;position:fixed;z-index:150;
    right:14px;bottom:calc(16px + env(safe-area-inset-bottom));
    font-family:'Press Start 2P',monospace;font-size:11px;color:#fff;
    background:var(--accent);border:none;border-radius:30px;
    padding:14px 18px;box-shadow:0 6px 0 rgba(0,0,0,.3),0 8px 20px rgba(0,0,0,.3);
    cursor:pointer}
  .fab:active{transform:translateY(2px);box-shadow:0 4px 0 rgba(0,0,0,.3)}
  .fab-count{background:#fff;color:var(--accent);font-size:10px;border-radius:20px;
    padding:3px 7px;min-width:20px;text-align:center}
  .fab-count:empty{display:none}
  body.sheet-open .fab{display:none}

  /* backdrop oscuro detras del panel */
  .sheet-backdrop{display:block;position:fixed;inset:0;z-index:155;
    background:rgba(10,12,20,.5);opacity:0;pointer-events:none;transition:opacity .25s}
  body.sheet-open .sheet-backdrop{opacity:1;pointer-events:auto}

  /* boton cerrar dentro del panel */
  .sheet-close{display:flex;align-items:center;justify-content:center;
    position:absolute;top:12px;right:12px;z-index:2;width:34px;height:34px;
    border:none;border-radius:50%;background:var(--fb-blue);color:#fff;
    font-size:16px;cursor:pointer;box-shadow:2px 2px 0 rgba(0,0,0,.3)}
}
@media(max-width:460px){
  .photo-wall{columns:2 130px}
  .logo{font-size:12px}
}
