/* 蜜桃、奶油黄和薄荷构成贴纸相册，视觉变量集中维护。 */
:root {
    color-scheme: light;
    --paper: #fff4ee;
    --white: #fffdfa;
    --ink: #493239;
    --muted: #80646a;
    --accent: #ad4968;
    --accent-hover: #913a58;
    --line: #ead6d4;
    --mint: #e1efe3;
    --yellow: #ffe8a3;
    font-family: "Microsoft YaHei", "PingFang SC", sans-serif;
    font-size: 16px;
    line-height: 1.65;
    color: var(--ink);
    background: var(--paper);
    -webkit-font-smoothing: antialiased;
}

* {
    box-sizing: border-box;
}

[hidden] {
    display: none !important;
}

body {
    margin: 0;
}

button {
    font: inherit;
}

button, a {
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
}

a {
    color: inherit;
    text-underline-offset: 4px;
}

:focus-visible {
    outline: 3px solid var(--accent);
    outline-offset: 3px;
}

::selection {
    background: var(--yellow);
    color: var(--ink);
}

.page-shell {
    width: min(1240px, calc(100% - 64px));
    margin-inline: auto;
}

/* 首页按真实视口高度分配三行；许可等文档页不受满屏约束。 */
.showcase-page {
    height: 100vh;
    height: 100dvh;
    overflow: hidden;
    background-image: radial-gradient(circle at 8% 16%, #ffe6cf 0, transparent 36%), radial-gradient(circle at 94% 90%, #e5eddf 0, transparent 31%), radial-gradient(#d9b9ad66 .8px, transparent .8px);
    background-size: auto, auto, 20px 20px;
}

.showcase-page > .page-shell {
    height: 100%;
    padding-block: clamp(12px, 2.6vh, 28px) 12px;
    display: grid;
    grid-template-rows:auto minmax(0, 1fr) auto;
    gap: clamp(8px, 1.8vh, 18px);
    position: relative;
    z-index: 1;
}

.site-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    min-height: 56px;
    padding: 0 4px;
}

.site-brand {
    display: inline-flex;
    align-items: center;
    gap: 12px;
    min-width: 0;
    max-width: 70%;
    text-decoration: none;
    font-size: 19px;
    font-weight: 750;
    overflow-wrap: anywhere;
}

.brand-mark {
    width: 40px;
    height: 40px;
    flex: 0 0 40px;
    padding: 5px;
    color: var(--accent);
    background: #ffe2df;
    border-radius: 12px;
    transform: rotate(-7deg);
    transition: transform 200ms ease;
}

.site-brand:hover .brand-mark {
    transform: rotate(6deg);
}

.header-actions {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 14px;
}

.header-note {
    color: var(--muted);
    font-size: 12px;
}

.header-note span {
    color: var(--accent);
    font-size: 24px;
    padding-left: 6px;
}

.upload-button {
    min-height: 44px;
    padding: 7px 12px;
    border-radius: 14px;
}

.upload-button svg {
    width: 17px;
    height: 17px;
}

.showcase {
    display: grid;
    grid-template-columns:minmax(0, 290px) minmax(0, 1fr);
    gap: clamp(20px, 4vw, 52px);
    min-height: 0;
    padding: 12px 6px 6px;
}

/* 超长人物内容单独滚动；隐藏滚动条但保留键盘、触摸与滚轮访问。 */
.profile {
    min-width: 0;
    min-height: 0;
    max-height: 100%;
    align-self: center;
    padding: 16px 14px 24px;
    overflow: auto;
    scrollbar-width: none;
    overscroll-behavior: contain;
    border-radius: 20px;
}

.profile::-webkit-scrollbar {
    display: none;
}

.profile-people {
    display: grid;
    gap: 12px;
}

/* 两个人物用并列手帐卡展示；头像故障时由脚本单独回退占位图。 */
.profile-person {
    position: relative;
    display: grid;
    grid-template-columns: 62px minmax(0, 1fr);
    align-items: center;
    gap: 12px;
    min-width: 0;
    padding: 10px 11px;
    border: 1px solid #efd9d2;
    border-radius: 17px 20px 16px 19px;
    background: #fffdfaaf;
    box-shadow: 0 3px 0 #e8c9bc88;
    transform: rotate(-.6deg);
    transition: transform 180ms ease, box-shadow 180ms ease;
}

.profile-person:nth-child(even) { transform: rotate(.7deg); }
.profile-person:hover { transform: translateY(-2px) rotate(0); box-shadow: 0 6px 14px #9b5a6218; }
.profile-person-avatar { position: relative; width: 62px; height: 62px; }
.profile-avatar {
    display: block;
    width: 62px;
    height: 62px;
    object-fit: cover;
    border: 3px solid var(--white);
    border-radius: 38% 46% 40% 45%;
    box-shadow: 0 3px 0 #e8c9bc, 0 8px 14px #9b5a6220;
    transform: rotate(-5deg);
    transition: transform 240ms ease;
}
.profile-person:hover .profile-avatar { transform: rotate(3deg) scale(1.04); }
.profile-person-copy { min-width: 0; }
.profile-person-name { margin: 0; font-size: 20px; line-height: 1.3; font-weight: 750; overflow-wrap: anywhere; }

.profile h1 {
    position: relative;
    width: fit-content;
    max-width: 100%;
    margin: 0 0 20px;
    font-size: clamp(30px, 3.6vw, 48px);
    font-weight: 800;
    line-height: 1.25;
    letter-spacing: .04em;
    overflow-wrap: anywhere;
    z-index: 0;
}

.profile h1::after {
    content: "";
    position: absolute;
    z-index: -1;
    left: 0;
    right: -5px;
    bottom: 1px;
    height: 12px;
    background: var(--yellow);
    border-radius: 45%;
    transform: rotate(-3deg);
}

.profile-description { margin: 5px 0 0; color: var(--muted); font-size: 12px; line-height: 1.55; white-space: pre-line; overflow-wrap: anywhere; }
.profile-description:empty, .profile-tags:empty { display: none; }

.profile-tags {
    list-style: none;
    display: flex;
    flex-wrap: wrap;
    gap: 5px 5px;
    padding: 0;
    margin: 7px 0 0;
}

.profile-tags li {
    max-width: 100%;
    padding: 2px 7px;
    border: 1px solid #bf857322;
    border-radius: 9px 12px 8px 12px;
    background: #fbe1e0;
    font-size: 10px;
    color: #65414a;
    overflow-wrap: anywhere;
    box-shadow: 0 2px 0 #bd8b7720;
    transform: rotate(-3deg);
    transition: transform 180ms ease;
}

.profile-tags li:nth-child(3n+2) {
    background: var(--yellow);
    transform: rotate(3deg);
}

.profile-tags li:nth-child(3n) {
    background: var(--mint);
    transform: rotate(-2deg);
}

.profile-tags li:hover {
    transform: translateY(-3px) rotate(0);
}

/* 纪念日用一块轻巧的手帐贴纸承载，数字是卡片唯一的视觉重点。 */
.anniversary-card {
    position: relative;
    display: flex;
    align-items: flex-start;
    gap: 10px;
    width: fit-content;
    max-width: 100%;
    margin-top: 22px;
    padding: 12px 16px 12px 13px;
    border: 1px solid #e9c9c2;
    border-radius: 13px 18px 14px 16px;
    background: linear-gradient(115deg, #fffdf6 0%, #fff0e8 100%);
    box-shadow: 0 3px 0 #e8cbc0;
    transform: rotate(-1deg);
}

.anniversary-heart {
    display: grid;
    place-items: center;
    flex: 0 0 30px;
    width: 30px;
    height: 30px;
    margin-top: 2px;
    border-radius: 11px 9px 12px 9px;
    background: #f8d8d9;
    color: var(--accent);
    font-size: 22px;
    line-height: 1;
    transform: rotate(8deg);
}

.anniversary-copy {
    min-width: 0;
}

.anniversary-title,
.anniversary-count,
.anniversary-start,
.anniversary-status {
    margin: 0;
}

.anniversary-title {
    color: var(--muted);
    font-size: 12px;
    line-height: 1.4;
}

.anniversary-count {
    display: flex;
    align-items: baseline;
    gap: 5px;
    color: var(--accent);
    line-height: 1.2;
}

.anniversary-count strong {
    font-size: 28px;
    font-variant-numeric: tabular-nums;
    letter-spacing: -.04em;
}

.anniversary-count span {
    font-size: 13px;
    font-weight: 700;
}

.anniversary-start,
.anniversary-status {
    color: var(--muted);
    font-size: 10px;
    line-height: 1.5;
    overflow-wrap: anywhere;
}

.anniversary-status:empty {
    display: none;
}

.anniversary-retry {
    min-height: 36px;
    padding: 2px 4px;
    font-size: 11px;
}

.anniversary-retry:hover {
    background: #f5dedc;
}

.profile-feedback {
    margin-top: 12px;
}

.profile-feedback:has(.status-text:empty):has([hidden]) {
    margin-top: 0;
}

.status-text {
    margin: 0;
    font-size: 12px;
    color: var(--muted);
    overflow-wrap: anywhere;
}

.status-text:empty {
    display: none;
}

/* 图片区域占据剩余高度，完整显示照片；控制与提示使用独立网格行。 */
.album {
    min-width: 0;
    min-height: 0;
    display: grid;
    grid-template-rows:minmax(0, 1fr) auto auto;
    gap: 10px;
}

.photo-frame {
    position: relative;
    min-width: 0;
    min-height: 0;
    padding: 9px;
    background: var(--white);
    border: 1px solid #efd8cd;
    border-radius: 24px;
    box-shadow: 0 7px 0 #ebceba, 0 14px 28px #8661431a;
}

.photo-stage {
    position: relative;
    width: 100%;
    height: 100%;
    min-height: 0;
    overflow: hidden;
    border-radius: 16px;
    background: #f5e3d9;
    isolation: isolate;
}

.photo-image {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    display: block;
    /* 保持原始比例并完整显示横竖照片，剩余空间使用相框底色填充。 */
    object-fit: contain;
    object-position: center;
    background: #f5e3d9;
    opacity: 0;
    transition: opacity 250ms ease;
}

.photo-image.is-visible {
    opacity: 1;
}

.photo-tape {
    position: absolute;
    z-index: 3;
    left: 38px;
    top: -10px;
    width: 86px;
    height: 24px;
    border: 1px solid #c49f5430;
    background: repeating-linear-gradient(90deg, #ffe7a9df 0 5px, #ffedbedf 5px 10px);
    clip-path: polygon(3% 0, 98% 3%, 96% 22%, 100% 41%, 97% 60%, 100% 100%, 0 96%, 3% 78%, 0 53%, 3% 30%);
    transform: rotate(-7deg);
    pointer-events: none;
}

.photo-sticker {
    position: absolute;
    z-index: 3;
    right: -9px;
    top: -16px;
    width: 46px;
    height: 46px;
    display: grid;
    place-items: center;
    border: 3px solid var(--white);
    border-radius: 50%;
    background: #fbd1db;
    color: #a44464;
    font-size: 34px;
    line-height: 1;
    transform: rotate(15deg);
    box-shadow: 0 3px 8px #8a455522;
    pointer-events: none;
}

.photo-placeholder {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 12px;
    text-align: center;
    color: var(--muted);
    font-size: 13px;
}

.photo-placeholder-icon {
    display: block;
    width: min(56px, 22%);
    max-height: 56px;
    height: auto;
    object-fit: contain;
}

.album-controls {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 16px;
    padding-top: 5px;
}

.control-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 7px;
    min-width: 44px;
    min-height: 44px;
    padding: 8px 16px;
    border: 1px solid #e7d3cd;
    border-radius: 18px;
    background: #fffdfaab;
    color: var(--ink);
    font-size: 13px;
    cursor: pointer;
    box-shadow: 0 3px 0 #ead6ce;
    transition: transform 180ms ease, box-shadow 180ms ease, background-color 180ms ease;
}

.control-button svg {
    width: 18px;
    height: 18px;
    flex-shrink: 0;
}

.control-button:not(:disabled):hover {
    transform: translateY(-3px) rotate(-1deg);
    background: #fff;
    box-shadow: 0 6px 0 #ead6ce;
}

.control-button:not(:disabled):active {
    transform: translateY(2px);
    box-shadow: 0 1px 0 #ead6ce;
}

.control-button:disabled {
    color: #9e8588;
    background: #fff8f366;
    box-shadow: none;
    cursor: default;
}

.play-button {
    min-width: 116px;
    background: var(--accent);
    border-color: var(--accent);
    color: #fff;
    box-shadow: 0 3px 0 #7f304c;
}

.play-button:not(:disabled):hover {
    background: var(--accent-hover);
    box-shadow: 0 6px 0 #7f304c;
}

.play-button:not(:disabled):active {
    box-shadow: 0 1px 0 #7f304c;
}

.play-icon {
    display: none;
}

.play-button[data-state="paused"] .pause-icon {
    display: none;
}

.play-button[data-state="paused"] .play-icon {
    display: block;
}

.album-feedback {
    min-width: 0;
    min-height: 42px;
    display: grid;
    grid-template-columns:auto minmax(0, 1fr) auto;
    gap: 6px 12px;
    align-items: center;
    padding-inline: 8px;
}

.photo-counter {
    margin: 0;
    border: 1px dashed #c59791;
    border-radius: 8px;
    padding: 2px 8px;
    color: var(--accent);
    font-size: 11px;
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
}

.album-feedback .status-text {
    text-align: right;
}

.text-button {
    min-height: 44px;
    min-width: 44px;
    padding: 5px 10px;
    border: 0;
    border-radius: 10px;
    background: transparent;
    color: var(--accent);
    text-decoration: underline;
    text-underline-offset: 4px;
    cursor: pointer;
    font-size: 13px;
}

.text-button:hover {
    background: #f5dedc;
}

.site-footer {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
    align-items: center;
    gap: 8px;
    min-height: 24px;
    padding-inline: 4px;
    color: var(--muted);
    font-size: 10px;
}

.site-footer > span:last-child {
    justify-self: end;
    text-align: right;
}

/* 备案信息在桌面并排显示，在窄屏可自然换行。 */
.site-footer .footer-records {
    display: flex;
    align-items: center;
    justify-content: center;
    flex-wrap: wrap;
    gap: 4px 12px;
}

/* 备案号始终保持可读、可聚焦，并与首页原有致谢链接保持清晰层级。 */
.site-footer .icp-link {
    display: inline-flex;
    align-items: center;
    min-height: 44px;
    color: inherit;
    font-size: 11px;
    text-decoration: underline;
    text-underline-offset: 3px;
    white-space: nowrap;
}

.site-footer .public-security-link {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    min-height: 44px;
    color: inherit;
    font-size: 11px;
    text-decoration: underline;
    text-underline-offset: 3px;
    white-space: nowrap;
}

.site-footer .public-security-link img {
    display: block;
    flex: 0 0 auto;
    width: 18px;
    height: 20px;
    object-fit: contain;
}

.site-footer .icp-link:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 3px;
    border-radius: 2px;
}

.site-footer a:hover {
    color: var(--accent);
}

.footer-divider {
    margin-inline: 8px;
}

.skip-link {
    position: fixed;
    top: 5px;
    left: 16px;
    z-index: 20;
    padding: 8px 16px;
    border-radius: 8px;
    background: white;
    transform: translateY(-180%);
}

.skip-link:focus {
    transform: none;
}

.noscript-message {
    position: fixed;
    inset: 0 0 auto;
    z-index: 30;
    padding: 8px;
    margin: 0;
    background: var(--yellow);
    text-align: center;
}

/* 装饰固定于视口内，只播放一次入场，不持续干扰阅读。 */
.page-sparkles {
    position: fixed;
    inset: 0;
    overflow: hidden;
    pointer-events: none;
    color: #b57b7b;
}

.page-sparkles span {
    position: absolute;
    animation: sticker-pop 800ms ease both;
}

.page-sparkles span:nth-child(1) {
    top: 26%;
    left: 1.5%;
    color: #cda858;
    font-size: 32px;
    transform: rotate(12deg);
}

.page-sparkles span:nth-child(2) {
    bottom: 12%;
    left: 28%;
    color: #8aab92;
    font-size: 26px;
    animation-delay: 100ms;
}

.page-sparkles span:nth-child(3) {
    top: 12%;
    right: 2%;
    font-size: 30px;
    animation-delay: 200ms;
}

@keyframes sticker-pop {
    from {
        opacity: 0;
        scale: .5;
    }
    to {
        opacity: 1;
        scale: 1;
    }
}

@media (min-width: 768px) and (max-width: 1023px) {
    .page-shell {
        width: calc(100% - 40px);
    }

    .showcase {
        grid-template-columns:minmax(0, 220px) minmax(0, 1fr);
        gap: 24px;
    }

    .profile {
        padding-inline: 6px;
    }

    .album-controls {
        gap: 10px;
    }
}

/* 手机人物信息变紧凑横向卡片，余下高度交给照片和44px按钮。 */
@media (max-width: 767px) {
    .page-shell {
        width: calc(100% - 24px);
    }

    .showcase-page > .page-shell {
        padding-block: 8px;
        gap: 6px;
    }

    .site-header {
        min-height: 44px;
    }

    .site-brand {
        max-width: 100%;
        font-size: 15px;
        gap: 8px;
    }

    .brand-mark {
        width: 32px;
        height: 32px;
        flex-basis: 32px;
    }

    .header-actions {
        gap: 0;
    }

    .header-note {
        display: none;
    }

    .upload-button {
        min-height: 44px;
        padding: 6px 10px;
    }

    .showcase {
        grid-template-columns:minmax(0, 1fr);
        grid-template-rows:minmax(0, min(300px, 38dvh)) minmax(0, 1fr);
        gap: 12px;
        padding: 0 4px 2px;
    }

    .profile {
        align-self: stretch;
        display: flex;
        flex-direction: column;
        gap: 7px;
        padding: 4px 3px;
    }

    .profile h1 {
        grid-column: auto;
        margin: 0 0 2px;
        font-size: 22px;
    }

    .profile h1::after {
        height: 7px;
    }

    .profile-people { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
    .profile-person { grid-template-columns: 42px minmax(0, 1fr); align-items: start; gap: 7px; padding: 7px 6px; border-radius: 12px; }
    .profile-person-avatar, .profile-avatar { width: 42px; height: 42px; }
    .profile-avatar { border-width: 2px; }
    .profile-person-name { font-size: 15px; }

    .profile-description {
        display: -webkit-box;
        -webkit-box-orient: vertical;
        -webkit-line-clamp: 3;
        overflow: hidden;
        font-size: 10px;
        line-height: 1.45;
    }

    .profile-tags {
        margin-top: 5px;
        gap: 3px;
    }

    .profile-tags li {
        padding: 1px 5px;
        font-size: 9px;
        border-radius: 6px;
    }

    .profile-feedback {
        margin-top: 0;
    }

    .anniversary-card {
        align-self: flex-start;
        gap: 7px;
        margin-top: 2px;
        padding: 6px 10px 6px 7px;
        border-radius: 10px 13px 10px 12px;
    }

    .anniversary-heart {
        flex-basis: 24px;
        width: 24px;
        height: 24px;
        font-size: 18px;
    }

    .anniversary-title {
        font-size: 10px;
    }

    .anniversary-count strong {
        font-size: 21px;
    }

    .anniversary-count span,
    .anniversary-start,
    .anniversary-status {
        font-size: 9px;
    }

    .anniversary-retry {
        min-height: 32px;
        font-size: 10px;
    }

    .album {
        gap: 7px;
    }

    .photo-frame {
        padding: 6px;
        border-radius: 19px;
        box-shadow: 0 4px 0 #ebceba, 0 8px 18px #86614318;
    }

    .photo-stage {
        border-radius: 13px;
    }

    .photo-sticker {
        width: 32px;
        height: 32px;
        right: -4px;
        top: -10px;
        font-size: 24px;
        border-width: 2px;
    }

    .photo-tape {
        left: 25px;
        width: 60px;
        height: 18px;
        top: -7px;
    }

    .album-controls {
        gap: 10px;
        padding-top: 3px;
    }

    .control-button {
        padding: 8px 12px;
        gap: 4px;
        font-size: 12px;
        border-radius: 14px;
    }

    .play-button {
        min-width: 88px;
    }

    .album-feedback {
        min-height: 36px;
        gap: 4px 6px;
        padding-inline: 0;
    }

    .album-feedback .status-text {
        font-size: 10px;
    }

    .photo-counter {
        padding: 2px 5px;
        font-size: 10px;
    }

    .site-footer {
        grid-template-columns: 1fr;
        justify-items: center;
        font-size: 9px;
        min-height: 20px;
        text-align: center;
    }

    .site-footer > span:first-child {
        display: none;
    }

    .site-footer .footer-records {
        max-width: 100%;
    }

    .site-footer > span:last-child {
        justify-self: center;
        text-align: center;
    }

    .page-sparkles {
        opacity: .45;
    }
}

/* 矮屏/横屏切回小侧栏和大图并排，避免纵向堆叠撑高。 */
@media (max-height: 520px) and (min-width: 560px) {
    .page-shell {
        width: calc(100% - 32px);
    }

    .showcase-page > .page-shell {
        padding-block: 4px;
        gap: 4px;
    }

    .site-header {
        min-height: 36px;
    }

    .site-brand {
        font-size: 14px;
    }

    .brand-mark {
        width: 28px;
        height: 28px;
        flex-basis: 28px;
    }

    .header-note {
        display: none;
    }

    .showcase {
        grid-template-columns:minmax(0, 180px) minmax(0, 1fr);
        grid-template-rows:minmax(0, 1fr);
        gap: 20px;
        padding-block: 8px 2px;
    }

    .profile {
        display: block;
        padding: 6px;
        align-self: stretch;
    }

    .avatar-wrap {
        width: 56px;
        margin: 0 0 12px 4px;
    }

    .profile-avatar {
        width: 54px;
        height: 54px;
        border-width: 3px;
    }

    .avatar-sticker {
        width: 22px;
        height: 22px;
        font-size: 16px;
    }

    .profile h1 {
        font-size: 25px;
        margin-bottom: 8px;
    }

    .profile-description {
        font-size: 11px;
        line-height: 1.6;
    }

    .profile-tags {
        margin-top: 10px;
        gap: 5px;
    }

    .anniversary-card {
        margin-top: 8px;
        padding: 5px 8px 5px 6px;
    }

    .profile-tags li {
        padding: 2px 7px;
        font-size: 10px;
    }

    .album {
        gap: 5px;
    }

    .album-controls {
        padding-top: 2px;
    }

    .album-feedback {
        min-height: 28px;
    }

    .site-footer {
        min-height: 18px;
        font-size: 9px;
    }
}

/* 尊重减少动态效果设置，保留交互并停止装饰及图片过渡。 */
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation: none !important;
        transition: none !important;
        scroll-behavior: auto !important;
    }
}
