:root {
    --bg-page: #f2f2f7;
    --bg-card: #fff;
    --bg-section-title: transparent;
    --bg-sub-title: #f7f7fa;
    --color-text: #1d1d1f;
    --color-secondary: #6e6e73;
    --color-muted: #aeaeb2;
    --color-divider: #ececf2;
    --color-border: #e5e5ea;
    --shadow: 0 8px 24px rgba(0, 0, 0, 0.06);
    --btn-blue: #34c759;
    --btn-blue-hover: #2fb350;
    --btn-green: #34c759;
    --btn-green-hover: #2fb350;
    --btn-text: #fff;
}

@media (prefers-color-scheme: dark) {
    :root {
        --bg-page: #1c1c1e;
        --bg-card: #2c2c2e;
        --bg-section-title: #3a3a3c;
        --bg-sub-title: #2c2c2e;
        --color-text: #f5f5f7;
        --color-secondary: #aeaeb2;
        --color-muted: #636366;
        --color-divider: rgba(84, 84, 88, 0.5);
        --color-border: #3a3a3c;
        --shadow: 0 10px 28px rgba(0, 0, 0, 0.28);
        --btn-blue: #248a3d;
        --btn-blue-hover: #2a9d47;
        --btn-green: #248a3d;
        --btn-green-hover: #2a9d47;
        --btn-text: #fff;
    }
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    background: var(--bg-page);
    color: var(--color-text);
    padding: calc(22px + env(safe-area-inset-top)) 14px calc(28px + env(safe-area-inset-bottom));
    line-height: 1.25;
    -webkit-font-smoothing: antialiased;
    text-size-adjust: 100%;
    text-autospace: ideograph-alpha ideograph-numeric;
}

.page-header {
    max-width: 720px;
    margin: 0 auto 18px;
    padding: 2px 4px 0;
}

.page-kicker {
    margin-bottom: 5px;
    color: var(--color-secondary);
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-align: center;
    text-transform: uppercase;
}

h1 {
    font-size: 1.72rem;
    font-weight: 750;
    line-height: 1.08;
    text-align: center;
    color: var(--color-text);
    letter-spacing: 0;
}

.page-author {
    margin-top: 7px;
    color: var(--color-secondary);
    font-size: 0.82rem;
    font-weight: 500;
    text-align: center;
}

#app {
    max-width: 720px;
    margin: 0 auto;
}

.section {
    background: var(--bg-card);
    border: 1px solid var(--color-border);
    border-radius: 14px;
    margin-bottom: 14px;
    overflow: hidden;
    box-shadow: var(--shadow);
}

.section-title {
    background: var(--bg-section-title);
    padding: 10px 14px 7px;
    font-size: 0.76rem;
    font-weight: 700;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--color-secondary);
    border-bottom: 1px solid var(--color-border);
}

.section-sub-title {
    padding: 6px 14px;
    font-size: 0.75rem;
    font-weight: 650;
    color: var(--color-secondary);
    background: var(--bg-sub-title);
    border-bottom: 1px solid var(--color-divider);
    letter-spacing: 0;
}

.module-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    min-height: 43px;
    padding: 7px 10px 7px 14px;
    border-bottom: 1px solid var(--color-divider);
    gap: 10px;
}

.module-item:last-child {
    border-bottom: none;
}

.module-info {
    display: flex;
    align-items: center;
    gap: 7px;
    flex: 1;
    min-width: 0;
}

.module-name {
    min-width: 0;
    color: var(--color-text);
    font-size: 0.92rem;
    font-weight: 520;
    line-height: 1.18;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.module-author {
    flex: 0 0 auto;
    max-width: 38%;
    padding: 2px 6px;
    border-radius: 999px;
    background: var(--bg-page);
    color: var(--color-secondary);
    font-size: 0.68rem;
    font-weight: 600;
    line-height: 1.15;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.module-links {
    display: flex;
    flex: 0 0 auto;
    flex-wrap: wrap;
    gap: 5px;
    justify-content: flex-end;
}

a.install-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    height: 28px;
    min-height: 28px;
    padding: 5px 12px;
    border-radius: 999px;
    background: var(--btn-blue);
    box-shadow: inset 0 -1px 0 rgba(0, 0, 0, 0.12);
    color: var(--btn-text);
    font-size: 0.78rem;
    font-weight: 650;
    line-height: 1;
    text-decoration: none;
    white-space: nowrap;
    transition: background 0.15s ease, transform 0.15s ease;
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
}

a.install-btn:hover {
    background: var(--btn-blue-hover);
}

a.install-btn:active {
    transform: scale(0.96);
}

a.install-btn.alt {
    background: var(--btn-green);
}

a.install-btn.alt:hover {
    background: var(--btn-green-hover);
}

.loading {
    text-align: center;
    padding: 52px 16px;
    color: var(--color-muted);
    font-size: 0.92rem;
}

.error {
    text-align: center;
    padding: 52px 16px;
    color: #ff3b30;
    font-size: 0.9rem;
}

@media (max-width: 520px) {
    body {
        padding: calc(16px + env(safe-area-inset-top)) 10px calc(22px + env(safe-area-inset-bottom));
    }

    .page-header {
        margin-bottom: 12px;
        padding-top: 0;
    }

    .page-kicker {
        margin-bottom: 4px;
        font-size: 0.66rem;
    }

    h1 {
        font-size: 1.42rem;
        line-height: 1.12;
    }

    .page-author {
        margin-top: 6px;
        font-size: 0.78rem;
    }

    .section {
        border-radius: 12px;
        margin-bottom: 12px;
        box-shadow: none;
    }

    .section-title {
        padding: 9px 12px 7px;
        font-size: 0.72rem;
    }

    .section-sub-title {
        padding: 6px 12px;
        font-size: 0.72rem;
    }

    .module-item {
        display: flex;
        align-items: center;
        min-height: 50px;
        padding: 9px 9px 9px 12px;
        gap: 10px;
    }

    .module-info {
        align-items: center;
        flex-direction: row;
        gap: 6px;
        min-width: 0;
    }

    .module-name {
        max-width: 100%;
        font-size: 0.92rem;
        line-height: 1.18;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
    }

    .module-author {
        max-width: 42%;
        padding: 2px 6px 3px;
        font-size: 0.66rem;
    }

    .module-links {
        align-self: center;
        flex: 0 0 auto;
        gap: 6px;
        max-width: none;
        min-width: 0;
        flex-wrap: nowrap;
        overflow: visible;
    }

    a.install-btn {
        height: 32px;
        min-height: 32px;
        max-width: none;
        min-width: 64px;
        padding: 0 13px;
        font-size: 0.8rem;
        line-height: 32px;
        overflow: visible;
        text-overflow: clip;
    }

    .module-item.has-multiple-links .module-links {
        display: flex;
    }

    .module-item.has-multiple-links a.install-btn {
        width: auto;
        min-width: 64px;
        padding-left: 10px;
        padding-right: 10px;
    }
}

@media (max-width: 360px) {
    body {
        padding-left: 8px;
        padding-right: 8px;
    }

    h1 {
        font-size: 1.34rem;
    }
}
