/* A shared, locally served Bilibili mark; original pixels are preserved. */
#memories #sync-badge{display:block;width:62px;height:62px;min-height:0;padding:0;flex:0 0 62px;background:transparent;border:0;border-radius:18px;overflow:hidden;box-shadow:0 3px 10px #89536416}
#sync-badge img{display:block;width:100%;height:100%;object-fit:cover;border-radius:26%;filter:saturate(.72)}
#memories .sync-copy{flex-direction:row;align-items:center;min-width:0}
#memories .sync-copy>div{min-width:0}
#shop .shop-summary{grid-template-columns:1fr 1.2fr 1fr}
#shop .shop-medal-metric{display:grid;grid-template-columns:1fr 1fr;gap:16px}
#shop .shop-medal-data,#shop .shop-watch-metric{min-width:0;display:flex;flex-direction:column;justify-content:center}
#shop .shop-watch-metric{border-left:1px solid var(--art-edge);padding-left:16px}
#shop .shop-medal-data>span{font-size:11px;color:var(--muted)}
#shop .shop-medal-data>strong{font-family:var(--serif);font-size:25px;font-weight:500;margin:7px 0;color:var(--deep)}
#shop .shop-medal-data>small{font-size:11px;color:var(--muted)}
.activity-calculation{border-top:1px solid var(--art-edge);padding-top:15px;margin-top:18px}
.activity-calculation h4{font-size:13px;margin:0 0 12px;color:var(--deep)}
#shop .activity-calculation .shop-rules-grid{display:grid;grid-template-columns:1fr;gap:10px}
.activity-calculation .shop-rules-grid p{display:grid;gap:4px;font-size:11px;line-height:1.8;margin:0}
#lottery-history-list{max-height:480px;overflow:auto;overscroll-behavior:contain;scrollbar-width:thin}

/* Long letters use the same textarea in a native modal, so drafts cannot diverge. */
.letter-body-tools{display:flex;align-items:center;justify-content:space-between;gap:12px;margin-bottom:8px}
.letter-body-tools label{font:inherit}
#letter-expand{display:inline-flex;gap:5px;align-items:center;justify-content:center;border:1px solid var(--art-edge);background:var(--surface-soft);color:var(--deep);padding:5px 9px;border-radius:10px;font:inherit;font-size:11px;min-height:32px;cursor:pointer}
#letter-expand[hidden]{display:none}
#letter-expand>span{font-size:20px;line-height:1}
#letter-body-home>textarea{width:100%;display:block}
body.frame-modal-open,html.frame-modal-open{overflow:hidden;overscroll-behavior:none}
dialog.letter-editor{position:fixed;inset:auto;left:0;top:var(--editor-top,0px);margin:0;width:100vw;max-width:100vw;height:var(--editor-height,100dvh);max-height:var(--editor-height,100dvh);padding:0;border:0;border-radius:0;background:var(--art-paper,#f6f8f2);color:var(--deep);box-shadow:none;overflow:hidden}
.letter-editor[open]{display:flex;flex-direction:column}
.letter-editor-toolbar{display:flex;align-items:center;justify-content:space-between;gap:20px;padding:20px max(24px,calc((100vw - 880px)/2));border-bottom:1px solid var(--art-edge);flex:none}
.letter-editor-toolbar .small-label{font-size:9px;margin:0 0 6px}
.letter-editor-toolbar h2{font:500 22px/1.5 var(--serif);margin:0}
#letter-editor-done{border:1px solid var(--art-edge);background:var(--art-mint);color:var(--deep);padding:10px 18px;border-radius:14px;font:inherit;font-size:13px;white-space:nowrap;cursor:pointer}
#letter-editor-slot{flex:1;min-height:0;display:flex;padding:16px max(24px,calc((100vw - 880px)/2)) 0}
.letter-editor #letter-body{display:block;flex:1;width:100%;height:100%;min-height:0;max-height:none;resize:none;box-sizing:border-box;background:var(--art-card);border:1px solid var(--art-edge);border-radius:18px;padding:22px;color:var(--deep);font-family:inherit;font-size:16px;line-height:1.95;outline-offset:3px;overscroll-behavior:contain;touch-action:auto}
.letter-editor-foot{display:flex;justify-content:space-between;gap:12px;flex:none;padding:12px max(24px,calc((100vw - 880px)/2)) max(16px,env(safe-area-inset-bottom));font-size:11px;color:var(--muted)}
.mobile-sidebar{display:none}
html[data-theme=dark] #sync-badge img{filter:saturate(.65) brightness(.92)}
html[data-theme=dark] .letter-editor{background:var(--surface)}
html[data-theme=dark] #letter-editor-done{background:var(--surface-soft)}

@media(max-width:760px){
 :root{--phone-dock:0px}
 body{padding-bottom:0}
 .mobile-dock{display:none!important}
 #home.hero{height:100svh;min-height:470px}
 .site-header .brand[role=button]{cursor:pointer;border-radius:10px}
 .site-header .brand[role=button]:focus-visible{outline:2px solid var(--art-focus);outline-offset:4px}
 #back-top{bottom:max(18px,env(safe-area-inset-bottom))}
 #toast-stack{bottom:20px}
 dialog.mobile-sidebar{position:fixed;inset:0 auto 0 0;width:min(82vw,310px);height:100dvh;max-width:none;max-height:100dvh;margin:0;padding:0;border:0;border-radius:0 26px 26px 0;overflow:auto;overscroll-behavior:contain;background:var(--art-paper,#f6f8f2);color:var(--deep);box-shadow:20px 0 70px #1b392332}
 dialog.mobile-sidebar[open]{display:block;animation:sidebar-arrive .3s cubic-bezier(.2,.75,.2,1) both}
 .mobile-sidebar::backdrop{background:#13261e66;backdrop-filter:blur(3px)}
 .sidebar-close{position:absolute;top:12px;right:12px;width:36px;height:36px;border-radius:50%;border:1px solid var(--art-edge);background:var(--art-card);color:var(--muted);font-family:inherit;font-size:24px;line-height:1;cursor:pointer;z-index:1}
 .sidebar-profile{display:flex;flex-direction:column;align-items:flex-start;gap:8px;padding:32px 26px 24px;border-bottom:1px solid var(--art-edge);background:linear-gradient(145deg,var(--art-mint),var(--art-paper))}
 #sidebar-avatar{width:62px;height:62px;object-fit:cover;border-radius:21px;border:3px solid var(--art-card);background:var(--art-card);margin-bottom:3px}
 #sidebar-name{font-family:var(--serif);font-size:20px;font-weight:500;line-height:1.45;overflow-wrap:anywhere;max-width:100%}
 #sidebar-identity{font-size:11px;color:var(--muted);line-height:1.6}
 .sidebar-links{display:grid;grid-template-columns:1fr;gap:5px;padding:15px 16px max(24px,env(safe-area-inset-bottom))}
 .sidebar-links a{display:flex;align-items:center;min-height:43px;padding:9px 18px;border-radius:13px;color:var(--deep);font-size:13px;letter-spacing:.08em;text-decoration:none;transition:background .2s,translate .2s}
 .sidebar-links a.active{background:var(--art-mint);box-shadow:inset 3px 0 0 var(--art-focus)}
 .sidebar-links a:active{translate:3px 0}
 @keyframes sidebar-arrive{from{opacity:0;translate:-100% 0}to{opacity:1;translate:0 0}}
 html[data-theme=dark] .mobile-sidebar{background:var(--surface)}
 html[data-theme=dark] .sidebar-profile{background:linear-gradient(145deg,var(--surface-soft),var(--surface))}
 html[data-theme=dark] .sidebar-links a.active{background:var(--surface-soft)}

 #memories{padding-top:76px;scroll-margin-top:0}
 #memories>.section-heading{margin-bottom:18px}
 #memories .section-heading .section-desc{font-size:12px;margin-top:8px}
 #memories .sync-panel{display:grid;grid-template-columns:minmax(0,1fr);align-items:center;gap:10px;padding:15px 17px;margin-bottom:10px;border-radius:22px}
 #memories .sync-copy{display:flex;flex-direction:row;align-items:center;gap:12px;width:100%}
 #memories #sync-badge{width:47px;height:47px;min-height:0;flex:0 0 47px;border-radius:15px}
 #memories #sync-title{font-size:14px;line-height:1.45;margin:0 0 4px;overflow-wrap:anywhere}
 #memories #sync-desc{font-size:10px;line-height:1.55;margin:0}
 #memories .sync-actions{display:flex;flex-direction:row;justify-content:flex-end;width:100%;padding-left:59px}
 #memories .sync-actions .btn{min-height:32px;width:auto;flex:0 1 auto;font-size:11px;padding:6px 15px;border-width:1px}
 #memories .sync-actions .btn.primary{font-size:11px;padding:6px 15px;border-width:1px}
 #memories .memory-grid.memory-deck-ready{padding:8px 12px 23px}
 #memories .memory-deck-ready .memory-card{min-height:176px}
 #memories .memory-deck-ready .memory-copy{padding:16px 12px 16px 8px}
 #memories .memory-deck-ready .memory-copy h3{font-size:15px;margin:5px 0}
 #memories .memory-deck-ready .memory-copy p{font-size:11px;line-height:1.7;margin:4px 0}
 #memories .memory-deck-ready .memory-meta{font-size:9px;line-height:1.55}
 #memories .memory-deck-ready:focus-visible{outline:2px solid var(--art-focus);outline-offset:4px;border-radius:20px}
 .memory-deck-controls{display:none!important}
 #memories .yearring-panel{display:grid!important;grid-template-columns:minmax(0,1fr) 100px;align-items:center;gap:10px;min-height:152px;padding:18px 16px;margin-top:12px;border-radius:23px}
 #memories .yearring-copy .small-label{font-size:8px;letter-spacing:.12em;margin:0 0 6px}
 #memories .yearring-copy h3{font-size:23px;margin:0 0 6px}
 #memories .yearring-copy p{font-size:11px;line-height:1.7;margin:0}
 #memories .rings{width:110px;height:110px;transform:scale(.78);margin:0 -5px;align-self:center}
 #memories .ring-days{width:110px;height:110px}
 #memories .ring-days strong{font-size:32px}

 #shop .shop-summary{grid-template-columns:minmax(0,1fr) minmax(0,1.28fr) minmax(0,.78fr);gap:8px;margin-bottom:10px}
 #shop .shop-summary>.shop-medal-metric{grid-column:auto!important;order:0;display:flex;flex-direction:column;align-items:stretch;justify-content:center;gap:9px;border:1px solid var(--art-edge);border-radius:18px;padding:13px 10px;background:var(--art-card);box-shadow:var(--art-shadow);min-height:0}
 #shop .shop-summary>.shop-medal-metric :is(span,strong,small){font-family:inherit;margin:0;line-height:1.55}
 #shop .shop-medal-data{display:grid;grid-template-columns:1fr auto;gap:2px 5px;align-items:center}
 #shop .shop-medal-data>span{font-size:10px;white-space:nowrap}
 #shop .shop-medal-data>strong{font-size:13px!important;font-weight:500}
 #shop .shop-medal-data>small{grid-column:1/-1;font-size:9px}
 #shop .shop-watch-metric{display:grid;grid-template-columns:1fr;gap:2px;border-left:0;border-top:1px solid var(--art-edge);padding:8px 0 0}
 #shop .shop-summary .shop-watch-metric>span{font-size:10px}
 #shop .shop-summary .shop-watch-metric>strong{font-size:13px;line-height:1.45;margin:0}
 #shop .shop-summary .shop-watch-metric>small{font-size:8px;line-height:1.6;overflow-wrap:anywhere}
 #shop .shop-summary>.shop-points-main,#shop .shop-summary>.shop-redeemed-metric{padding:13px 9px;display:flex;flex-direction:column;justify-content:center;min-height:0}
 #shop .shop-summary :is(#shop-points,.shop-redeemed-metric>strong){font-size:15px;margin:6px 0}
 #shop .shop-summary :is(#shop-points-note,.shop-redeemed-metric>small){font-size:8px;line-height:1.6}
 #shop>.magic-lottery{margin-top:8px;padding:21px 17px}
 #shop .lottery-balance{margin:14px 0}
 #shop .ritual-description{margin:10px 0}
 #shop .lottery-status{margin:12px 0;font-size:10px}
 #shop .lottery-odds{margin-top:12px}
 .letter-editor-toolbar{padding:14px 16px;gap:12px}
 .letter-editor-toolbar h2{font-size:17px}
 .letter-editor-toolbar .small-label{font-size:8px}
 #letter-editor-done{font-size:12px;padding:9px 13px}
 #letter-editor-slot{padding:10px 12px 0}
 .letter-editor #letter-body{padding:17px 15px;border-radius:15px}
 .letter-editor-foot{padding:10px 15px max(12px,env(safe-area-inset-bottom));font-size:10px}
}
@media(max-width:760px) and (max-height:700px){
 #home.hero{min-height:0}
 #memories{padding-top:72px}
 #memories>.section-heading{margin-bottom:10px}
 #memories .section-heading .eyebrow{margin-bottom:4px;font-size:7px}
 #memories .section-heading h2{font-size:23px;line-height:1.4}
 #memories .section-heading .section-desc{margin-top:4px;font-size:10px}
 #memories .sync-panel{padding:10px 13px;gap:6px;margin-bottom:6px}
 #memories #sync-badge{width:39px;height:39px;flex-basis:39px}
 #memories .sync-copy{gap:9px}
 #memories #sync-title{font-size:12px}
 #memories #sync-desc{font-size:9px;line-height:1.4}
 #memories .sync-actions{padding-left:48px}
 #memories .sync-actions .btn,#memories .sync-actions .btn.primary{min-height:29px;padding:4px 11px;font-size:10px}
 #memories .memory-deck-ready .memory-card{min-height:140px}
 #memories .memory-deck-ready .memory-copy{padding:10px 9px 10px 6px}
 #memories .memory-deck-ready .memory-copy h3{font-size:13px}
 #memories .memory-deck-ready .memory-copy p{font-size:10px;line-height:1.55}
 #memories .memory-deck-ready .memory-meta{font-size:8px}
 #memories .memory-grid.memory-deck-ready{padding:5px 10px 21px}
 #memories .yearring-panel{min-height:112px;padding:10px 12px;grid-template-columns:minmax(0,1fr) 76px;margin-top:8px}
 #memories .yearring-copy h3{font-size:20px;margin-bottom:4px}
 #memories .yearring-copy p{font-size:10px;line-height:1.55}
 #memories .yearring-copy .small-label{font-size:7px;margin-bottom:4px}
 #memories .rings{width:85px;height:85px;transform:scale(.66);margin:0 -5px}
 #shop .shop-summary>.shop-medal-metric{padding:10px 8px;gap:6px}
 #shop>.magic-lottery{padding:18px 15px}
 .sidebar-profile{padding:20px 22px 15px;gap:5px}
 #sidebar-avatar{width:47px;height:47px;border-radius:16px}
 #sidebar-name{font-size:17px}
 .sidebar-links{padding-top:10px;gap:2px}
 .sidebar-links a{min-height:36px;padding:7px 15px;font-size:12px}
}
@media(prefers-reduced-motion:reduce){dialog.mobile-sidebar[open]{animation:none}}
.sr-only{position:absolute!important;width:1px!important;height:1px!important;padding:0!important;margin:-1px!important;overflow:hidden!important;clip:rect(0,0,0,0)!important;clip-path:inset(50%)!important;white-space:nowrap!important;border:0!important}
dialog.letter-editor[open]{animation:none}
.letter-editor::backdrop{background:var(--art-paper,#f6f8f2)}
.letter-editor #letter-body{font-weight:400}
@media(max-width:760px){body.rings-in-view #back-top{opacity:0;visibility:hidden;pointer-events:none}}
@media(max-width:760px) and (max-height:700px){#memories .yearring-panel{margin-top:6px}}
