/* Memory diary: one paper canvas, fitted to #app rather than the browser viewport. */
#app #wechat-memory-fullscreen-root {
    --md-bg: #eae7df;
    --md-paper: #f3f4ee;
    --md-ink: #3f463b;
    --md-muted: #717568;
    --md-tape: #68795c;
    --md-tape-light: #879578;
    --md-wash: #dce1d3;
    --md-accent: #506348;
    --md-on-accent: #fffef7;
    --md-serif: "LoveMiOfflineDialogue", "STKaiti", "KaiTi", "Songti SC", serif;
    position: absolute;
    inset: 0;
    z-index: 6250;
    display: none;
    width: 100%;
    height: 100%;
    min-height: 0;
    overflow: hidden;
    border-radius: inherit;
    background: var(--md-bg);
    color: var(--md-ink);
    isolation: isolate;
    -webkit-tap-highlight-color: transparent;
}
#app #wechat-memory-fullscreen-root.is-open { display: block; }
#wechat-memory-fullscreen-root *,
#wechat-memory-fullscreen-root *::before,
#wechat-memory-fullscreen-root *::after { box-sizing: border-box; }
#app #wechat-memory-fullscreen-root :is(.wechat-memory-library-page, .wechat-memory-space-page) {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    min-height: 0;
    margin: 0;
    overflow: hidden;
    border: 0;
    border-radius: 0;
    background: var(--md-bg) url('assets/memory-diary/paper-grain.svg') !important;
    color: var(--md-ink);
    box-shadow: none;
}
#wechat-memory-fullscreen-root .wechat-memory-space-page { z-index: 13; }
#app #wechat-memory-fullscreen-root button { font-family: inherit; touch-action: manipulation; }
#app #wechat-memory-fullscreen-root button:focus-visible,
#app #wechat-memory-fullscreen-root input:focus-visible { outline: 2px solid var(--md-accent); outline-offset: 4px; }
#app #wechat-memory-fullscreen-root .wechat-memory-header {
    display: grid;
    grid-template-columns: 44px minmax(0, 1fr) 44px;
    align-items: center;
    flex: none;
    gap: 8px;
    min-height: 68px;
    margin: 0;
    padding: calc(12px + var(--safe-area-inset-top, env(safe-area-inset-top, 0px))) calc(14px + var(--safe-area-inset-right, env(safe-area-inset-right, 0px))) 12px calc(14px + var(--safe-area-inset-left, env(safe-area-inset-left, 0px)));
    border: 0;
    background: transparent;
    box-shadow: none;
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
}
#app #wechat-memory-fullscreen-root .wechat-memory-header-title {
    min-width: 0;
    margin: 0;
    overflow: hidden;
    color: var(--md-ink);
    font-family: var(--md-serif);
    font-size: 23px;
    font-weight: 400;
    line-height: 1.45;
    letter-spacing: .06em;
    white-space: nowrap;
    text-overflow: ellipsis;
}
#app #wechat-memory-fullscreen-root :is(.wechat-memory-back-btn, .wechat-memory-header-action) {
    display: grid;
    place-items: center;
    width: 44px;
    height: 44px;
    margin: 0;
    padding: 11px;
    border: 0;
    border-radius: 50%;
    background: transparent;
    color: var(--md-ink);
    box-shadow: none;
    transition: transform 140ms cubic-bezier(.23, 1, .32, 1), background-color 140ms ease;
}
#app #wechat-memory-fullscreen-root :is(.wechat-memory-back-btn, .wechat-memory-header-action) svg { width: 22px; height: 22px; }
#app #wechat-memory-fullscreen-root .wechat-memory-back-btn .chat-back-icon { width: 20px; height: 20px; }
#app #wechat-memory-fullscreen-root .wechat-memory-header-action.is-active { background: var(--md-accent); color: var(--md-on-accent); }
#app #wechat-memory-fullscreen-root :is(.wechat-memory-library-body, .wechat-memory-space-body) {
    flex: 1;
    min-height: 0;
    padding: 6px calc(22px + var(--safe-area-inset-right, env(safe-area-inset-right, 0px))) calc(30px + var(--safe-area-inset-bottom, env(safe-area-inset-bottom, 0px))) calc(22px + var(--safe-area-inset-left, env(safe-area-inset-left, 0px))) !important;
    overflow-x: hidden;
    overflow-y: auto;
    overscroll-behavior: contain;
    background: transparent;
    scrollbar-width: none;
    -webkit-overflow-scrolling: touch;
}
#app #wechat-memory-fullscreen-root .wechat-memory-intro { margin: 0 0 30px; color: var(--md-muted); font-size: 12px; line-height: 1.8; text-align: center; letter-spacing: .04em; }
#app #wechat-memory-fullscreen-root .wechat-memory-friend-list { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 30px 18px; padding: 0 2px 8px; }
#app #wechat-memory-fullscreen-root .wechat-memory-friend-card {
    position: relative;
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
    align-items: center;
    gap: 12px;
    width: 100%;
    min-width: 0;
    min-height: 198px;
    margin: 0;
    padding: 32px 10px 18px;
    border: 0;
    border-radius: 1px;
    background: var(--md-paper) url('assets/memory-diary/paper-grain.svg');
    color: var(--md-ink);
    box-shadow: 0 2px 2px rgba(54, 59, 45, .13), 0 8px 14px -12px rgba(54, 59, 45, .3);
    text-align: center;
    cursor: pointer;
    transition: transform 140ms cubic-bezier(.23, 1, .32, 1);
}
#wechat-memory-fullscreen-root .wechat-memory-note-tape {
    position: absolute;
    top: -10px;
    left: 24%;
    width: 52%;
    height: 23px;
    transform: rotate(-3deg);
    pointer-events: none;
}
#wechat-memory-fullscreen-root .wechat-memory-note-tape::before,
#wechat-memory-fullscreen-root .wechat-memory-note-tape::after {
    content: '';
    position: absolute;
    inset: 0;
    background: var(--md-tape) url('assets/memory-diary/paper-grain.svg');
    opacity: .9;
    clip-path: polygon(0 5%, 96% 0, 98% 14%, 96% 27%, 100% 44%, 97% 61%, 100% 84%, 96% 94%, 4% 100%, 5% 82%, 1% 65%, 4% 44%, 0 23%);
}
#wechat-memory-fullscreen-root .wechat-memory-note-tape::after { inset: 10px -3px -7px 5px; background-color: var(--md-tape-light); opacity: .76; }
#wechat-memory-fullscreen-root .wechat-memory-friend-card:nth-child(2n) .wechat-memory-note-tape { transform: rotate(3deg); }
#app #wechat-memory-fullscreen-root .wechat-memory-friend-avatar {
    display: grid;
    place-items: center;
    flex: none;
    width: 80px;
    height: 80px;
    padding: 4px;
    border: 0;
    border-radius: 2px;
    background: #fffef9;
    box-shadow: 0 1px 4px rgba(47, 53, 42, .13);
}
#app #wechat-memory-fullscreen-root :is(.wechat-memory-space-avatar-img, .wechat-memory-friend-avatar-placeholder) {
    display: block;
    width: 100%;
    height: 100%;
    border: 0;
    border-radius: 1px;
    object-fit: cover;
}
#app #wechat-memory-fullscreen-root .wechat-memory-friend-avatar-placeholder { display: grid; place-items: center; background: var(--md-wash); color: var(--md-accent); font-family: var(--md-serif); font-size: 28px; font-weight: 400; }
#app #wechat-memory-fullscreen-root .wechat-memory-friend-meta { width: 100%; min-width: 0; flex: none; }
#app #wechat-memory-fullscreen-root .wechat-memory-friend-name { color: var(--md-ink); font-family: var(--md-serif); font-size: 21px; font-weight: 400; line-height: 1.4; overflow-wrap: anywhere; }
#app #wechat-memory-fullscreen-root .wechat-memory-friend-subtitle { margin-top: 5px; color: var(--md-muted); font-size: 11px; line-height: 1.6; }
#app #wechat-memory-fullscreen-root .wechat-memory-friend-hero {
    display: flex;
    align-items: center;
    gap: 12px;
    margin: 14px 0 30px;
    padding: 0;
    border: 0;
    border-radius: 0;
    background: transparent;
    box-shadow: none;
}
#app #wechat-memory-fullscreen-root .wechat-memory-friend-hero .wechat-memory-friend-avatar { width: 44px; height: 44px; padding: 2px; }
#app #wechat-memory-fullscreen-root .wechat-memory-friend-hero .wechat-memory-friend-meta { width: auto; flex: 1; }
#app #wechat-memory-fullscreen-root .wechat-memory-friend-hero .wechat-memory-friend-name { display: none; }
#app #wechat-memory-fullscreen-root .wechat-memory-month-trigger { min-height: 44px; margin: 0; gap: 12px; padding: 6px 0; color: var(--md-ink); font-family: var(--md-serif); font-size: 18px; line-height: 1.5; }
#app #wechat-memory-fullscreen-root .wechat-memory-calendar-card { margin: 0; padding: 0; border: 0; border-radius: 0; background: transparent !important; color: var(--md-ink); box-shadow: none; backdrop-filter: none; -webkit-backdrop-filter: none; }
#app #wechat-memory-fullscreen-root :is(.wechat-memory-calendar-weekdays, .wechat-memory-calendar-grid) { grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 10px 4px; }
#app #wechat-memory-fullscreen-root .wechat-memory-calendar-weekdays { margin-bottom: 18px; }
#app #wechat-memory-fullscreen-root .wechat-memory-calendar-weekdays span { color: var(--md-muted); font-size: 12px; font-weight: 400; line-height: 1.8; }
#app #wechat-memory-fullscreen-root .wechat-memory-calendar-cell {
    display: grid;
    place-items: center;
    aspect-ratio: 1;
    min-width: 0;
    min-height: 40px;
    margin: 0;
    padding: 0;
    border: 1px solid transparent;
    border-radius: 50%;
    background: transparent;
    color: var(--md-muted);
    box-shadow: none;
    font-size: 15px;
    font-weight: 400;
    opacity: 1;
    transition: transform 140ms cubic-bezier(.23, 1, .32, 1), background-color 140ms ease;
}
#app #wechat-memory-fullscreen-root .wechat-memory-calendar-cell-inner { font: inherit; }
#app #wechat-memory-fullscreen-root .wechat-memory-calendar-cell.empty { visibility: hidden; }
#app #wechat-memory-fullscreen-root .wechat-memory-calendar-cell.has-chat { color: var(--md-accent); background: var(--md-wash); font-weight: 600; cursor: pointer; }
#app #wechat-memory-fullscreen-root .wechat-memory-calendar-cell.is-today { border-color: var(--md-accent); }
#app #wechat-memory-fullscreen-root .wechat-memory-calendar-cell.selected { background: var(--md-accent); color: var(--md-on-accent); }
#app #wechat-memory-fullscreen-root .wechat-memory-calendar-cell.selected::after { display: none; }
#app #wechat-memory-fullscreen-root .wechat-memory-calendar-badge { position: absolute; right: 0; bottom: -3px; min-width: 14px; height: 14px; padding: 0 3px; border: 0; border-radius: 7px; background: var(--md-accent); color: var(--md-on-accent); font-size: 9px; font-weight: 500; line-height: 14px; box-shadow: none; }
#app #wechat-memory-fullscreen-root .wechat-memory-calendar-hint { margin: 26px 0 0; color: var(--md-muted); font-size: 12px; line-height: 1.9; }
#app #wechat-memory-fullscreen-root .wechat-memory-empty { color: var(--md-muted); line-height: 1.8; }
#app #wechat-memory-fullscreen-root .wechat-memory-batch-generate-btn { width: 100%; min-height: 46px; margin-top: 20px; border: 0; border-radius: 4px; background: var(--md-accent); color: var(--md-on-accent); box-shadow: none; font-size: 14px; }
/* Pickers belong to this layer too; they must remain above the calendar after reparenting. */
#app #wechat-memory-fullscreen-root > .modal { position: absolute; inset: 0; z-index: 30; width: 100%; height: 100%; padding: 18px; overflow-y: auto; background: rgba(38, 44, 34, .32); }
#app #wechat-memory-fullscreen-root :is(.wechat-memory-month-picker-content, .wechat-memory-friend-selector-content) { display: flex; flex-direction: column; max-height: 90%; margin: auto; padding: 0; overflow: hidden; border: 0; border-radius: 6px; background: var(--md-paper); color: var(--md-ink); box-shadow: 0 12px 32px rgba(30, 38, 26, .18); }
#app #wechat-memory-fullscreen-root :is(.wechat-memory-month-picker-header, .wechat-memory-month-picker-footer, .wechat-memory-friend-selector-header) { flex: none; }
#app #wechat-memory-fullscreen-root :is(.wechat-memory-month-picker-body, .wechat-memory-friend-selector-body) { min-height: 0; overflow-x: hidden; overflow-y: auto; overscroll-behavior: contain; }
#app #wechat-memory-fullscreen-root :is(.wechat-memory-month-picker-title, .wechat-memory-friend-selector-title, .wechat-memory-friend-selector-item .wechat-memory-friend-name) { color: var(--md-ink); }
#app #wechat-memory-fullscreen-root .wechat-memory-month-picker-kicker { color: var(--md-muted); }
#app #wechat-memory-fullscreen-root :is(.wechat-memory-month-picker-item, .wechat-memory-month-picker-year-btn, .wechat-memory-month-picker-year-input) { border: 0; border-radius: 4px; background: var(--md-wash); color: var(--md-ink); box-shadow: none; }
#app #wechat-memory-fullscreen-root .wechat-memory-month-picker-item.is-active { background: var(--md-accent); color: var(--md-on-accent); }
#app #wechat-memory-fullscreen-root .wechat-memory-month-picker-footer .wallet-modal-btn { flex: 1; min-width: 0; min-height: 44px; border: 0 !important; border-radius: 4px; background: var(--md-wash) !important; color: var(--md-ink) !important; box-shadow: none !important; }
#app #wechat-memory-fullscreen-root :is(.wechat-memory-month-picker-footer .confirm, .wechat-memory-friend-selector-save) { background: var(--md-accent) !important; color: var(--md-on-accent) !important; }
#app #wechat-memory-fullscreen-root .wechat-memory-friend-selector-header { grid-template-columns: 44px minmax(0, 1fr) 44px; border: 0; }
#app #wechat-memory-fullscreen-root :is(.wechat-memory-friend-selector-close, .wechat-memory-friend-selector-save) { min-width: 0; min-height: 44px; padding: 6px 4px; border: 0; border-radius: 4px; box-shadow: none; backdrop-filter: none; -webkit-backdrop-filter: none; }
#app #wechat-memory-fullscreen-root .wechat-memory-friend-selector-title { font-size: 17px; line-height: 1.5; }
#app #wechat-memory-fullscreen-root .wechat-memory-friend-selector-item { border: 0; border-radius: 2px; background: transparent; box-shadow: none; }
#app #wechat-memory-fullscreen-root .wechat-memory-friend-selector-close { color: var(--md-muted); background: transparent; }
#app #wechat-memory-fullscreen-root .wechat-memory-friend-selector-checkbox { accent-color: var(--md-accent); }
#app #wechat-memory-fullscreen-root .modal-close { width: 44px; height: 44px; border: 0 !important; border-radius: 4px !important; background: transparent !important; color: var(--md-ink) !important; box-shadow: none !important; }
#app #wechat-memory-fullscreen-root button:not(:disabled):active { transform: scale(.97); }
html[data-appearance='dark'] #app #wechat-memory-fullscreen-root { --md-bg: #292d27; --md-paper: #363c32; --md-ink: #e4e8dc; --md-muted: #b0b8a6; --md-tape: #75856a; --md-tape-light: #8a987f; --md-wash: #434c3c; --md-accent: #b8c9a8; --md-on-accent: #293224; }
html[data-appearance='dark'] #app #wechat-memory-fullscreen-root .wechat-memory-friend-avatar { background: #c6cebe; }
html[data-appearance='dark'] #app #wechat-memory-fullscreen-root .chat-back-icon { filter: invert(1); }
@media (hover: hover) and (pointer: fine) {
    #app #wechat-memory-fullscreen-root .wechat-memory-friend-card:hover { transform: translateY(-2px); }
    #app #wechat-memory-fullscreen-root :is(.wechat-memory-back-btn, .wechat-memory-header-action):not(.is-active):hover { background: var(--md-wash); }
}
@media (max-width: 360px) {
    #app #wechat-memory-fullscreen-root :is(.wechat-memory-library-body, .wechat-memory-space-body) { padding-right: calc(18px + var(--safe-area-inset-right, env(safe-area-inset-right, 0px))) !important; padding-left: calc(18px + var(--safe-area-inset-left, env(safe-area-inset-left, 0px))) !important; }
    #app #wechat-memory-fullscreen-root .wechat-memory-friend-list { column-gap: 14px; }
    #app #wechat-memory-fullscreen-root .wechat-memory-friend-card { min-height: 180px; padding-right: 7px; padding-left: 7px; }
    #app #wechat-memory-fullscreen-root .wechat-memory-friend-avatar { width: 70px; height: 70px; }
    #app #wechat-memory-fullscreen-root .wechat-memory-friend-name { font-size: 19px; }
    #app #wechat-memory-fullscreen-root .wechat-memory-month-trigger { font-size: 16px; }
}
@media (max-height: 500px) {
    #app #wechat-memory-fullscreen-root .wechat-memory-header { padding-top: calc(4px + var(--safe-area-inset-top, env(safe-area-inset-top, 0px))); padding-bottom: 4px; min-height: 52px; }
    #app #wechat-memory-fullscreen-root .wechat-memory-friend-hero { margin: 8px 0 16px; }
}
@media (prefers-reduced-motion: reduce) {
    #app #wechat-memory-fullscreen-root button { transition: none; }
    #app #wechat-memory-fullscreen-root button:hover,
    #app #wechat-memory-fullscreen-root button:active { transform: none; }
}
