:root {
    color-scheme: light;
    --page: #F0F0F0;
    --paper: #FDFAF2;
    --surface: #FFFFFF;
    --ink: #374151;
    --muted: #6B7280;
    --hairline: #E6E4DD;
    --gold: #D4A574;
    --gold-deep: #B58452;
    font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei", sans-serif;
}

* {
    box-sizing: border-box;
}

html {
    background: var(--page);
}

body {
    min-width: 320px;
    margin: 0;
    overflow-x: hidden;
    color: var(--ink);
    background:
        radial-gradient(circle at 82% 4%, rgba(255, 255, 255, .9), transparent 24rem),
        var(--page);
}

a {
    color: inherit;
}

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

.site-header {
    position: relative;
    z-index: 2;
    width: min(1120px, calc(100% - 40px));
    height: 76px;
    margin: 0 auto;
    display: flex;
    align-items: center;
}

.brand-link {
    display: inline-flex;
    align-items: center;
    gap: 12px;
    font-size: 18px;
    font-weight: 700;
    letter-spacing: .08em;
    text-decoration: none;
}

.brand-link img {
    width: 42px;
    height: 42px;
    border: 1px solid #E8DFC4;
    border-radius: 50%;
}

main {
    width: min(960px, calc(100% - 40px));
    margin: 0 auto;
    padding: 54px 0 72px;
}

.download-panel {
    border: 1px solid rgba(232, 223, 196, .85);
    border-radius: 30px;
    background: rgba(255, 255, 255, .92);
    box-shadow: 0 24px 80px rgba(55, 65, 81, .08);
}

.platform-list {
    min-height: 300px;
    display: flex;
    justify-content: center;
    align-items: center;
    gap: clamp(56px, 14vw, 140px);
    padding: 40px 34px;
}

.platform-entry {
    position: relative;
    width: 128px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-start;
    gap: 10px;
    margin: 0;
    padding: 0;
    border: 0;
    color: inherit;
    background: transparent;
    font: inherit;
    text-align: center;
    text-decoration: none;
    cursor: pointer;
}

.platform-circle {
    position: relative;
    width: 76px;
    height: 76px;
    display: grid;
    place-items: center;
    border: 1px solid #E8DFC4;
    border-radius: 50%;
    background: var(--surface);
    box-shadow: 0 1px 3px rgba(55, 65, 81, .06);
    transition: transform .2s ease, border-color .18s ease, border-radius .2s ease, box-shadow .18s ease;
}

.platform-circle svg {
    width: 36px;
    height: 36px;
    fill: currentColor;
    transition: opacity .15s ease;
}

.platform-qr {
    position: absolute;
    inset: 6px;
    width: calc(100% - 12px);
    height: calc(100% - 12px);
    border-radius: 10px;
    opacity: 0;
    transition: opacity .15s ease .06s;
    pointer-events: none;
}

.platform-icon-apple {
    color: #111827;
}

.platform-icon-android {
    color: #4B5563;
}

.platform-logo {
    width: 46px;
    height: 46px;
    border-radius: 50%;
}

.platform-name {
    position: relative;
    font-size: 15px;
    font-weight: 700;
    line-height: 1.4;
    transition: opacity .15s ease;
}

.platform-hint {
    position: absolute;
    top: 128px;
    left: 0;
    right: 0;
    color: var(--gold-deep);
    font-size: 15px;
    line-height: 1.4;
    opacity: 0;
    visibility: hidden;
    transition: opacity .18s ease .05s, visibility .18s;
    pointer-events: none;
}

.platform-badge {
    position: absolute;
    left: calc(100% + 6px);
    top: -7px;
    padding: 2px 5px;
    border: 1px solid rgba(212, 165, 116, .5);
    border-radius: 999px;
    color: var(--gold-deep);
    font-size: 10px;
    font-weight: 400;
    line-height: 1.4;
    white-space: nowrap;
}

.platform-badge[hidden] {
    display: none;
}

.platform-entry.is-current .platform-circle,
.platform-entry.is-available:hover .platform-circle {
    border-color: var(--gold);
    box-shadow: 0 8px 20px rgba(212, 165, 116, .28);
}

.platform-entry[aria-disabled="true"] {
    opacity: .45;
    cursor: not-allowed;
}

/* 桌面端悬停：图标原地变身二维码（仿微信官网下载页） */
@media (hover: hover) {
    .platform-entry.has-qr:hover .platform-circle,
    .platform-entry.has-qr:focus-visible .platform-circle {
        z-index: 5;
        border-color: var(--gold);
        border-radius: 20px;
        box-shadow: 0 18px 44px rgba(55, 65, 81, .18);
        transform: scale(1.9);
        transform-origin: center;
    }

    .platform-entry.has-qr:hover .platform-circle svg,
    .platform-entry.has-qr:focus-visible .platform-circle svg {
        opacity: 0;
    }

    .platform-entry.has-qr:hover .platform-qr,
    .platform-entry.has-qr:focus-visible .platform-qr {
        opacity: 1;
    }

    .platform-entry.has-qr:hover .platform-name,
    .platform-entry.has-qr:focus-visible .platform-name {
        opacity: 0;
    }

    .platform-entry.has-qr:hover .platform-hint,
    .platform-entry.has-qr:focus-visible .platform-hint {
        opacity: 1;
        visibility: visible;
    }
}

.source-dialog {
    width: min(560px, calc(100% - 32px));
    max-height: min(680px, calc(100dvh - 32px));
    margin: auto;
    padding: 0;
    border: 1px solid rgba(232, 223, 196, .9);
    border-radius: 24px;
    color: var(--ink);
    background: #FFFFFF;
    box-shadow: 0 30px 100px rgba(17, 24, 39, .25);
    overflow: auto;
}

.source-dialog::backdrop {
    background: rgba(17, 24, 39, .42);
    backdrop-filter: blur(4px);
}

.dialog-shell {
    padding: 28px;
}

.dialog-heading {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 24px;
}

.dialog-heading h2 {
    margin: 0;
    color: var(--ink);
    font-size: 24px;
}

.dialog-close {
    width: 38px;
    height: 38px;
    flex: 0 0 auto;
    display: grid;
    place-items: center;
    padding: 0;
    border: 0;
    border-radius: 50%;
    color: var(--muted);
    background: var(--paper);
    cursor: pointer;
}

.dialog-close svg {
    width: 19px;
    height: 19px;
    fill: currentColor;
}

.download-sources {
    display: grid;
    gap: 12px;
    margin-top: 22px;
}

.source-item {
    border: 1px solid var(--hairline);
    border-radius: 16px;
    background: var(--surface);
    transition: border-color .18s ease, box-shadow .18s ease, transform .18s ease;
}

.source-item:hover {
    border-color: rgba(212, 165, 116, .65);
    box-shadow: 0 12px 28px rgba(55, 65, 81, .1);
    transform: translateY(-1px);
}

.source-link {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 14px 16px;
    color: inherit;
    text-decoration: none;
}

.source-link::before {
    content: "";
    width: 42px;
    height: 42px;
    flex: 0 0 auto;
    border-radius: 12px;
    background: #FDF6EC url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath fill='%23B58452' d='M11 3h2v10.2l3.6-3.6L18 11l-6 6-6-6 1.4-1.4L11 13.2V3Zm-7 15h16v2H4v-2Z'/%3E%3C/svg%3E") center / 20px 20px no-repeat;
}

.source-link::after {
    content: "›";
    flex: 0 0 auto;
    color: #C9CDD6;
    font-size: 24px;
    line-height: 1;
    transition: color .18s ease;
}

.source-link:hover::after,
.source-link:focus-visible::after {
    color: var(--gold-deep);
}

.source-name {
    flex: 1;
    min-width: 0;
    font-size: 16px;
    font-weight: 700;
}

.source-loading,
.source-empty {
    margin: 0;
    padding: 22px;
    border: 1px dashed var(--hairline);
    border-radius: 16px;
    color: var(--muted);
    text-align: center;
}

footer {
    min-height: 100px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    border-top: 1px solid var(--hairline);
    color: var(--muted);
    font-size: 14px;
}

footer a {
    text-decoration: none;
}

.wechat-browser-guide {
    position: fixed;
    z-index: 50;
    inset: 0;
    display: block;
    padding: 0;
    border: 0;
    color: #FFFFFF;
    background: rgba(17, 24, 39, .84);
    font: inherit;
    font-size: 17px;
    font-weight: 650;
    line-height: 1.6;
    text-align: left;
    cursor: pointer;
}

.wechat-browser-guide-arrow {
    position: absolute;
    top: max(2px, env(safe-area-inset-top));
    right: max(12px, env(safe-area-inset-right));
    font-size: 60px;
    line-height: 1;
}

.wechat-browser-guide-copy {
    position: absolute;
    top: max(72px, calc(env(safe-area-inset-top) + 64px));
    right: max(18px, env(safe-area-inset-right));
    width: min(264px, calc(100vw - 40px));
}

@media (max-width: 720px) {
    .site-header {
        width: min(100% - 32px, 620px);
        height: 68px;
    }

    .brand-link {
        font-size: 17px;
    }

    .brand-link img {
        width: 36px;
        height: 36px;
    }

    main {
        width: min(100% - 28px, 620px);
        padding: 30px 0 52px;
    }

    .download-panel {
        border-radius: 24px;
    }

    .platform-list {
        min-height: 240px;
        gap: clamp(36px, 12vw, 72px);
        padding: 32px 22px;
    }

    .platform-circle {
        width: 64px;
        height: 64px;
    }

    .platform-circle svg {
        width: 30px;
        height: 30px;
    }

    .source-dialog {
        width: calc(100% - 20px);
        max-height: calc(100dvh - 20px);
        border-radius: 21px;
    }

    .dialog-shell {
        padding: 23px 18px 20px;
    }

    .wechat-browser-guide-copy {
        font-size: 16px;
    }

}

@media (prefers-reduced-motion: reduce) {
    * {
        scroll-behavior: auto !important;
        transition: none !important;
    }
}
