/* PASSPORT TAB (2026-10-30) — js/passport-tab.js. The tab opens on your closed
   passport + your private collection, with a Friends side. Open shows the
   stamp page you already had as a book (data-pp="decorate"): cover, ID and
   Visa pages in front, pages turned by js/passport-turn.js, Add / Edit and the
   GLB press unchanged. ?passbook=0 brings the old tab back. */
#tab-passport[data-pp="home"] > :not(#pp-home) { display: none !important; }
#tab-passport[data-pp="decorate"] > #pp-home { display: none !important; }
#tab-passport[data-pp="home"] { overflow: hidden !important; }

#pp-home {
    flex: 1; min-height: 0; overflow-y: auto; -webkit-overflow-scrolling: touch;
    padding: 4px 16px 28px; font-family: var(--font-ui, Figtree, sans-serif); color: var(--ink, #1a1a1a);
}
.pp-title { text-align: center; padding: 6px 0 12px; }
.pp-title h1 { margin: 0; }
.pp-seg { display: flex; background: #e9e2d3; border-radius: 100px; padding: 4px; margin-bottom: 14px; }
.pp-seg button { flex: 1; border: 0; background: none; border-radius: 100px; padding: 9px 0; font: 800 13px var(--font-ui, Figtree, sans-serif); color: #7a7263; cursor: pointer; }
.pp-seg button.on { background: #fffdf7; color: #1a1a1a; box-shadow: 0 1px 4px rgba(0,0,0,.12); }
.pp-side { display: none; }
.pp-side.on { display: block; }

/* the closed passport */
.pp-closed { display: flex; gap: 14px; align-items: center; }
.pp-mini {
    flex: none; width: 112px; aspect-ratio: .7; border-radius: 6px 12px 12px 6px; position: relative; cursor: pointer; border: 0; padding: 0;
    background: radial-gradient(120% 90% at 30% 20%, color-mix(in srgb, var(--cv) 87%, #fff), var(--cv) 55%, color-mix(in srgb, var(--cv) 70%, #000));
    box-shadow: inset 6px 0 8px -4px rgba(0,0,0,.45), 0 10px 22px rgba(0,0,0,.25);
    display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 8px; transition: transform .2s;
}
.pp-mini:active { transform: scale(.97) rotate(-1deg); }
.pp-mini i { width: 44%; aspect-ratio: 1; background: linear-gradient(135deg,#bf953f,#fcf6ba 40%,#b38728 60%,#fbf5b7);
    -webkit-mask: var(--ppb-logo) center/contain no-repeat; mask: var(--ppb-logo) center/contain no-repeat; }
.pp-mini b { font: 900 10.5px var(--font-ui, Figtree, sans-serif); letter-spacing: .2em;
    background: linear-gradient(135deg,#bf953f 0%,#fcf6ba 40%,#b38728 60%,#fbf5b7 100%); -webkit-background-clip: text; background-clip: text; color: transparent; }
.pp-closed-side { flex: 1; min-width: 0; }
.pp-who { font: 900 19px var(--font-ui, Figtree, sans-serif); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pp-sub { font: 500 12.5px var(--font-ui, Figtree, sans-serif); color: #7a7263; margin: 2px 0 10px; }
.pp-btns { display: flex; flex-wrap: wrap; gap: 6px; }
.pp-pill { border: 0; border-radius: 100px; padding: 8px 12px; font: 800 12px var(--font-ui, Figtree, sans-serif); background: #1a1a1a; color: #fff; cursor: pointer; }
.pp-pill.alt { background: #e9e2d3; color: #1a1a1a; }
.pp-pill:disabled { opacity: .4; }

.pp-h2 { font: 900 17px var(--font-ui, Figtree, sans-serif); margin: 24px 0 10px; display: flex; justify-content: space-between; align-items: baseline; }
.pp-h2 small { font: 700 12px var(--font-ui, Figtree, sans-serif); color: #7a7263; }
.pp-counters { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; }
.pp-counters div { background: #fffdf7; border: 1px solid #e4dccb; border-radius: 14px; padding: 10px 2px; text-align: center; }
.pp-counters b { display: block; font: 900 20px var(--font-ui, Figtree, sans-serif); }
.pp-counters small { font: 800 9px var(--font-ui, Figtree, sans-serif); letter-spacing: .1em; color: #7a7263; }
.pp-series { background: #fffdf7; border: 1px solid #e4dccb; border-radius: 16px; padding: 12px 14px; margin-bottom: 8px; }
.pp-series-h { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; font: 800 14px var(--font-ui, Figtree, sans-serif); }
.pp-series-h small { flex: none; font: 700 12px var(--font-ui, Figtree, sans-serif); color: #7a7263; }
.pp-bar { height: 6px; background: #eee6d4; border-radius: 6px; margin: 8px 0 10px; overflow: hidden; }
.pp-bar i { display: block; height: 100%; background: var(--accent-green, #27ae60); border-radius: 6px; }
.pp-thumbs { display: flex; gap: 6px; overflow-x: auto; scrollbar-width: none; }
.pp-thumbs::-webkit-scrollbar { display: none; }
.pp-thumbs img { flex: none; width: 46px; height: 46px; object-fit: contain; }
.pp-thumbs img.sil { filter: grayscale(1) brightness(1.6) contrast(.4); opacity: .45; }
.pp-count-line { font: 800 15px var(--font-ui, Figtree, sans-serif); margin-top: 6px; }
.pp-sort { display: flex; gap: 6px; margin-bottom: 10px; }
.pp-sort button { border: 1px solid #e4dccb; background: #fffdf7; border-radius: 100px; padding: 6px 11px; font: 800 11.5px var(--font-ui, Figtree, sans-serif); cursor: pointer; color: #1a1a1a; }
.pp-sort button.on { background: #1a1a1a; color: #fff; border-color: #1a1a1a; }
.pp-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.pp-grid button { border: 1px solid #e4dccb; background: #fffdf7; border-radius: 14px; padding: 8px 6px 7px; cursor: pointer; text-align: center; min-width: 0; color: #1a1a1a; }
.pp-grid img { width: 100%; aspect-ratio: 1; object-fit: contain; display: block; }
.pp-grid b { display: block; font: 800 10.5px/1.2 var(--font-ui, Figtree, sans-serif); margin-top: 3px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pp-grid small { font: 600 9.5px var(--font-ui, Figtree, sans-serif); color: #7a7263; }
.pp-grid .on-page { color: #b38728; }
.pp-more { display: block; width: 100%; margin-top: 10px; }
.pp-note { font: 500 12.5px/1.45 var(--font-ui, Figtree, sans-serif); color: #7a7263; background: #ece5d6; border-radius: 12px; padding: 10px 12px; margin-top: 14px; }
.pp-empty { color: #7a7263; font-size: 13px; text-align: center; padding: 18px 0; }

/* friends */
.pp-search { display: flex; align-items: center; gap: 8px; background: #fffdf7; border: 1px solid #e4dccb; border-radius: 14px; padding: 11px 13px; }
.pp-search input { flex: 1; border: 0; background: none; font: 600 15px var(--font-ui, Figtree, sans-serif); outline: none; min-width: 0; color: #1a1a1a; }
.pp-friend { display: flex; align-items: center; gap: 12px; background: #fffdf7; border: 1px solid #e4dccb; border-radius: 16px; padding: 10px 12px; margin-top: 8px; width: 100%; cursor: pointer; text-align: left; color: #1a1a1a; }
.pp-friend .pp-mini { width: 44px; border-radius: 3px 6px 6px 3px; box-shadow: inset 3px 0 4px -2px rgba(0,0,0,.45), 0 3px 8px rgba(0,0,0,.2); pointer-events: none; }
.pp-friend .pp-mini i { width: 60%; }
.pp-friend > div { flex: 1; min-width: 0; }
.pp-friend strong { display: block; font: 900 15px var(--font-ui, Figtree, sans-serif); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pp-friend small { display: block; font: 500 12px var(--font-ui, Figtree, sans-serif); color: #7a7263; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pp-friend em { font-style: normal; font: 800 11px var(--font-ui, Figtree, sans-serif); color: #7a7263; flex: none; }
.pp-codehit { margin-top: 10px; background: #fffdf7; border: 1px dashed #c9bc9e; border-radius: 16px; padding: 12px 14px; }
.pp-codehit b { display: block; font: 800 14px var(--font-ui, Figtree, sans-serif); margin-bottom: 8px; }

/* Decorate: the old stamp page gets a way back */
/* Share, opposite Add / Edit (the tab is just the passport since 2026-10-31) */
.stamp-header .pp-share { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); z-index: 3; }
#tab-passport[data-stamp-edit="true"] .pp-share { display: none; }

/* sheets */
.pp-scrim { position: fixed; inset: 0; z-index: 100002; background: rgba(0,0,0,.35); display: none; }
.pp-scrim.on { display: block; }
.pp-sheet {
    position: fixed; left: 0; right: 0; bottom: 0; z-index: 100003; max-width: 520px; margin: 0 auto;
    background: #F4F1EA; color: #1a1a1a; border-radius: 22px 22px 0 0;
    padding: 10px 18px calc(24px + var(--safe-bottom, env(safe-area-inset-bottom, 0px)));
    transform: translateY(105%); transition: transform .28s ease; box-shadow: 0 -10px 40px rgba(0,0,0,.25);
    max-height: 88vh; overflow: auto; font-family: var(--font-ui, Figtree, sans-serif);
}
.pp-sheet.on { transform: none; }
.pp-grab { width: 40px; height: 5px; border-radius: 5px; background: #d6cdb9; margin: 0 auto 12px; }
.pp-sheet h3 { margin: 0 0 4px; font: 900 19px var(--font-ui, Figtree, sans-serif); }
.pp-lead { margin: 0 0 14px; font: 500 13px/1.45 var(--font-ui, Figtree, sans-serif); color: #7a7263; }
.pp-opt { margin: 14px 0; }
.pp-opt > b { display: block; font: 800 13px var(--font-ui, Figtree, sans-serif); margin-bottom: 6px; }
.pp-opt > small { display: block; font: 500 12px var(--font-ui, Figtree, sans-serif); color: #7a7263; margin-top: 5px; }
.pp-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.pp-chips button { border: 1px solid #e4dccb; background: #fffdf7; border-radius: 100px; padding: 8px 12px; font: 800 12px var(--font-ui, Figtree, sans-serif); cursor: pointer; color: #1a1a1a; }
.pp-chips button.on { background: #1a1a1a; color: #fff; border-color: #1a1a1a; }
.pp-toggle { display: flex; align-items: center; justify-content: space-between; gap: 10px; background: #fffdf7; border: 1px solid #e4dccb; border-radius: 14px; padding: 12px 14px; }
.pp-toggle span { font: 800 13px var(--font-ui, Figtree, sans-serif); }
.pp-toggle small { display: block; font: 500 11.5px var(--font-ui, Figtree, sans-serif); color: #7a7263; }
.pp-sw { flex: none; width: 46px; height: 28px; border-radius: 28px; background: #d6cdb9; border: 0; position: relative; cursor: pointer; transition: background .2s; }
.pp-sw::after { content: ""; position: absolute; top: 3px; left: 3px; width: 22px; height: 22px; border-radius: 50%; background: #fff; transition: transform .2s; box-shadow: 0 1px 3px rgba(0,0,0,.2); }
.pp-sw.on { background: var(--accent-green, #27ae60); }
.pp-sw.on::after { transform: translateX(18px); }
.pp-link { display: flex; align-items: center; gap: 8px; background: #fffdf7; border: 1px dashed #c9bc9e; border-radius: 14px; padding: 10px 10px 10px 14px; font: 700 12.5px 'JetBrains Mono', monospace; margin: 10px 0; }
.pp-link span { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pp-qr { display: block; width: 150px; height: 150px; margin: 6px auto 0; image-rendering: pixelated; background: #fff; padding: 8px; border-radius: 12px; }
.pp-swatches { display: flex; gap: 10px; flex-wrap: wrap; }
.pp-swatches button { width: 40px; height: 40px; border-radius: 50%; border: 3px solid transparent; background: var(--c); cursor: pointer; box-shadow: 0 0 0 1px rgba(0,0,0,.15); }
.pp-swatches button.on { border-color: var(--accent-gold, #FFD93D); }
.pp-input { width: 100%; box-sizing: border-box; border: 1px solid #e4dccb; background: #fffdf7; border-radius: 12px; padding: 11px 12px; font: 600 14px var(--font-ui, Figtree, sans-serif); color: #1a1a1a; }
.pp-wide { width: 100%; padding: 13px; margin-top: 6px; }

/* the passport as a book (2026-10-31): fills the space on any screen */
#tab-passport[data-pp="decorate"] .stamp-carousel-container { overflow: visible; display: flex; align-items: center; justify-content: center; padding: 2px 10px 0 4px; }
#stamp-carousel.pp-book { display: block; flex: none; overflow: visible; scroll-snap-type: none; touch-action: pan-y; }
#tab-passport[data-pp="decorate"] #stamp-dots { display: none; }
.pp-tbar { display: none; align-items: center; gap: 8px; }
#tab-passport[data-pp="decorate"] .pp-tbar { display: flex; }
.pp-tbar button { width: 38px; height: 38px; border-radius: 50%; border: 0; background: #fffdf7; color: #1a1a1a; font: 800 20px var(--font-ui, Figtree, sans-serif); line-height: 1; cursor: pointer; box-shadow: 0 2px 8px rgba(0,0,0,.18); }
.pp-tbar button:disabled, #tab-passport[data-pp="decorate"] .stamp-page-ctrl:disabled { opacity: .3; }
.pp-tlbl { font: 700 12px 'JetBrains Mono', monospace; min-width: 96px; text-align: center; color: #7a7263; letter-spacing: .04em; }
/* page − / ‹ PAGE › / + sit left, clear of the D-PAD button bottom-right */
#tab-passport[data-pp="decorate"] .stamp-dots-row { justify-content: flex-start; gap: 10px; padding-left: 14px; }

/* Passport = full-screen takeover (2026-10-31): header, NOW VISITING ticker
   and boost strip hide while it's open; the tab bar stays. */
body.pp-full { --header-height: 0px !important; }
body.pp-full #currency-header, body.pp-full .nv-strip, body.pp-full .bf-strip { display: none !important; }
