/* V7 universal popup geometry. Only popup presentation is changed. */
#popup{inset:calc(94px + env(safe-area-inset-top,0px)) 0 auto;width:calc(100% - 16px);max-width:484px;height:calc(100dvh - 158px - env(safe-area-inset-top,0px) - env(safe-area-inset-bottom,0px));padding:16px 16px 14px;overflow:hidden}
#popup #popup-content{gap:14px;overflow:auto;min-height:0}
#popup h2{font-size:22px;min-height:30px;padding:0 28px;display:flex;align-items:center;justify-content:center}
#popup .close{right:5px;top:6px;width:36px;height:36px;z-index:2}
#popup .medals{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));justify-items:center;align-content:center;gap:20px 24px;flex:1;min-height:0;margin:0}
#popup .medal{gap:7px;font-size:16px}
#popup .circle{width:clamp(58px,17dvh,90px);height:clamp(58px,17dvh,90px);font-size:42px;letter-spacing:-1px;border-width:3px;box-sizing:border-box}
#popup .rank-1 .circle{background:var(--lime);border-color:white;color:black}
#popup .rank-2 .circle{background:white;border-color:var(--lime);color:black}
#popup .rank-3 .circle{background:#9c9fa4;border-color:white;color:black}
#popup .rank-4 .circle{background:black;border-color:white;color:white}
#popup.stats-popup #popup-content{padding-top:34px}
#popup .stats-toggle{flex:none}
#popup .popup-actions{flex:none;padding:0;gap:4px;grid-template-columns:repeat(auto-fit,minmax(60px,1fr))}
#popup .popup-actions .action{min-height:48px;font-size:13px}
/* Matching four-row panels; opened lists scroll within the shared shell. */
#popup.info-popup #popup-content,#popup.selection-popup #popup-content{gap:12px}
#popup .rule-rows,#popup .trivia-menu{flex:1;min-height:0;display:flex;flex-direction:column;gap:0;margin:0}
#popup .rule-rows p,#popup .trivia-menu>.action,#popup .filter-section>summary{flex:1;min-height:52px;margin:0;padding:10px 4px;display:flex;align-items:center;gap:14px;border-bottom:1px solid #353b43;font-size:15px;line-height:1.4;font-weight:700}
#popup .rule-rows p:last-child,#popup .filter-section:last-child{border-bottom:0}
#popup .rule-rows .ui-icon,#popup .trivia-menu .ui-icon{width:26px;height:26px;flex:none}
#popup .trivia-menu>.action .action-icon{margin:0;width:26px;height:26px}
#popup .filter-section{flex:1;display:flex;flex-direction:column;border:0}
#popup .filter-section[open]{flex:none}
#popup .filter-section[open]>summary{flex:none}
#popup.selection-popup .trivia-menu{min-height:min-content}
#popup .filter-grid{flex:none}
/* Photo review: two columns, contained photographs and overlay labels. */
#popup.details-popup #popup-content{overflow:hidden;gap:8px}
#popup .review-item{gap:8px}
#popup .review-item h3{font-size:16px;line-height:1.25;min-height:30px;width:calc(100% - 30px)}
#popup .review-photo:disabled{opacity:1;cursor:default}
#popup .review-photo{background:#080a0d}
#popup .review-photo img{object-fit:contain}
#popup .details-pager{min-height:40px}
#popup .details-pager button{min-height:40px}
/* Correct-answer detail keeps the complete original image visible. */
#popup.photo-popup #popup-content{display:flex;gap:12px}
#popup .photo-subject{padding:4px 30px 0;font-size:20px;flex:none}
#popup.photo-popup .enlarged-photo{width:100%;height:0;min-height:100px;flex:1;aspect-ratio:auto;object-fit:contain;background:#080a0d}
#popup .photo-fact{font-size:14px;line-height:1.4}
#popup .source-links{gap:12px;flex:none}
#popup.photo-popup .subtle{font-size:11px;line-height:1.3;flex:none}
@media(max-height:620px){#popup{padding:12px}#popup .medals{gap:10px}#popup .circle{width:60px;height:60px;font-size:34px}#popup .rule-rows p,#popup .trivia-menu>.action,#popup .filter-section>summary{font-size:13px;padding:8px 4px;min-height:46px}#popup .review-item h3{font-size:14px}}
#popup .filter-section:last-child>summary{border-bottom:0}
#popup.details-popup .review-photos{grid-template-rows:repeat(2,minmax(0,1fr));min-height:0}
#popup.details-popup .review-photo{aspect-ratio:auto;height:100%;min-height:0}
#popup.details-popup .review-photo img{aspect-ratio:auto}
#popup .review-photo::before{content:'';position:absolute;inset:-12px;background-image:var(--photo);background-size:cover;background-position:center;filter:blur(12px);pointer-events:none}
#popup.details-popup .review-photo img{position:relative;z-index:1;background:transparent}
#popup.details-popup .review-photo>span{z-index:2}
#popup.details-popup .answer-photo::after{content:'';position:absolute;inset:0;border:4px solid var(--lime);z-index:3;pointer-events:none;box-sizing:border-box}
#popup .rule-rows,#popup .trivia-menu:not(:has(details[open])){display:grid;grid-template-rows:repeat(4,minmax(0,1fr))}
