:root {
    --field: #4f8a51;
    --field-dark: #315c39;
    --hay: #efc75e;
    --hay-dark: #b9852e;
    --sky: #dceff5;
    --paper: #fffdf7;
    --ink: #25352b;
    --muted: #64756b;
    --line: #d9e2d9;
    --danger: #a9433f;
    --success: #26704a;
}

* {
    box-sizing: border-box;
}

html {
    min-width: 320px;
    background: #edf6e9;
}

body {
    margin: 0;
    min-height: 100vh;
    color: var(--ink);
    font-family: "Microsoft YaHei", "PingFang SC", "Noto Sans SC", sans-serif;
    background:
        linear-gradient(180deg, var(--sky) 0 210px, #edf6e9 210px 100%);
}

a {
    color: inherit;
}

button {
    font: inherit;
}

.page {
    width: min(1040px, 100%);
    min-height: 100vh;
    margin: 0 auto;
    padding: 18px clamp(14px, 4vw, 34px) 34px;
}

.header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    min-height: 48px;
}

.brand {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    color: var(--ink);
    font-size: 17px;
    font-weight: 900;
    text-decoration: none;
}

.brand-mark {
    position: relative;
    width: 34px;
    height: 34px;
    border-radius: 8px;
    background: repeating-linear-gradient(90deg, var(--hay) 0 4px, #f8dd83 4px 7px);
    box-shadow: inset 0 -5px 0 rgba(126, 82, 31, 0.16);
}

.brand-mark::after {
    content: "";
    position: absolute;
    top: 13px;
    left: 0;
    right: 0;
    height: 6px;
    background: #8d5b35;
}

.back-link,
.refresh-btn {
    min-height: 40px;
    border: 1px solid rgba(37, 53, 43, 0.16);
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.68);
    color: var(--ink);
    font-size: 14px;
    font-weight: 800;
    text-decoration: none;
}

.back-link {
    display: inline-flex;
    align-items: center;
    padding: 8px 14px;
}

.refresh-btn {
    padding: 8px 16px;
    cursor: pointer;
}

.download-intro {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 22px;
    margin: 34px 0 22px;
}

.eyebrow {
    margin: 0 0 6px;
    color: var(--field-dark);
    font-size: 13px;
    font-weight: 900;
}

h1 {
    margin: 0 0 9px;
    font-size: clamp(34px, 7vw, 58px);
    line-height: 1.05;
}

.intro-copy {
    max-width: 650px;
    margin: 0;
    color: #4f6356;
    font-size: 15px;
    line-height: 1.7;
}

.list-status {
    min-height: 24px;
    margin-bottom: 10px;
    color: var(--muted);
    font-size: 13px;
    font-weight: 700;
}

.game-list {
    display: grid;
    gap: 14px;
}

.game-item {
    overflow: hidden;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--paper);
    box-shadow: 0 12px 34px rgba(43, 76, 51, 0.11);
}

.game-main {
    display: grid;
    grid-template-columns: 84px minmax(0, 1fr) auto;
    align-items: center;
    gap: 18px;
    padding: 20px;
}

.game-icon {
    position: relative;
    width: 74px;
    height: 74px;
    border: 1px solid #e5cf8e;
    border-radius: 8px;
    background: #fff3c9;
}

.game-icon::before,
.game-icon::after {
    content: "";
    position: absolute;
    left: 17px;
    right: 17px;
    height: 5px;
    border-radius: 4px;
    background: var(--hay);
    box-shadow: 8px 10px 0 var(--hay-dark), -5px 20px 0 #d6a942, 6px 30px 0 #e3b94b;
}

.game-icon::before {
    top: 16px;
}

.game-icon::after {
    top: 44px;
    left: 12px;
    right: 12px;
    height: 8px;
    background: #8d5b35;
    box-shadow: none;
}

.game-title-row {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 8px;
}

.game-title-row h2 {
    margin: 0;
    font-size: 22px;
}

.version-badge,
.platform-badge {
    padding: 4px 8px;
    border-radius: 6px;
    font-size: 12px;
    font-weight: 900;
}

.version-badge {
    color: #6b491d;
    background: #fff0bd;
}

.platform-badge {
    color: #315c39;
    background: #e1f0df;
}

.game-description {
    margin: 8px 0 10px;
    color: var(--muted);
    font-size: 14px;
    line-height: 1.65;
}

.meta-row {
    display: flex;
    flex-wrap: wrap;
    gap: 8px 18px;
    color: #64756b;
    font-size: 12px;
}

.download-actions {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: 8px;
    min-width: 148px;
}

.download-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 48px;
    padding: 10px 18px;
    border-radius: 8px;
    color: #fff;
    background: var(--field);
    box-shadow: 0 4px 0 var(--field-dark);
    font-weight: 900;
    text-decoration: none;
}

.download-btn.disabled {
    color: #7c857e;
    background: #dfe6df;
    box-shadow: none;
    cursor: not-allowed;
}

.download-hint {
    color: var(--muted);
    font-size: 11px;
    line-height: 1.45;
    text-align: center;
}

.version-details {
    border-top: 1px solid var(--line);
    background: #f7faf5;
}

.version-details summary {
    padding: 13px 20px;
    color: #3d6046;
    font-size: 13px;
    font-weight: 900;
    cursor: pointer;
}

.details-body {
    display: grid;
    gap: 12px;
    padding: 0 20px 18px;
}

.version-list,
.delta-list {
    display: grid;
    gap: 7px;
}

.version-row,
.delta-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    padding: 10px 12px;
    border: 1px solid #dfe8dd;
    border-radius: 8px;
    background: #fff;
    font-size: 12px;
}

.version-row b,
.delta-row b {
    color: var(--ink);
}

.version-row span,
.delta-row span {
    color: var(--muted);
}

.hash-row {
    overflow-wrap: anywhere;
    padding: 10px 12px;
    border-radius: 8px;
    color: #54675a;
    background: #eef5eb;
    font-family: Consolas, monospace;
    font-size: 11px;
    line-height: 1.6;
}

.empty-state,
.error-state {
    padding: 40px 20px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--paper);
    color: var(--muted);
    text-align: center;
}

.error-state {
    color: var(--danger);
}

.footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-top: 22px;
    color: var(--muted);
    font-size: 12px;
}

.footer a {
    color: var(--field-dark);
    font-weight: 800;
}

@media (max-width: 720px) {
    .download-intro {
        align-items: flex-start;
        flex-direction: column;
    }

    .game-main {
        grid-template-columns: 62px minmax(0, 1fr);
        gap: 14px;
        padding: 16px;
    }

    .game-icon {
        width: 58px;
        height: 58px;
    }

    .game-icon::before {
        top: 11px;
    }

    .game-icon::after {
        top: 35px;
    }

    .download-actions {
        grid-column: 1 / -1;
        min-width: 0;
    }

    .version-row,
    .delta-row {
        align-items: flex-start;
        flex-direction: column;
        gap: 4px;
    }
}

@media (max-width: 430px) {
    .header .back-link {
        display: none;
    }

    .download-intro {
        margin-top: 24px;
    }

    h1 {
        font-size: 38px;
    }

    .game-main {
        grid-template-columns: 1fr;
    }

    .game-icon {
        width: 64px;
        height: 64px;
    }

    .footer {
        align-items: flex-start;
        flex-direction: column;
    }
}
