/* ===== 全局样式 ===== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

/* 禁止移动端双击缩放和触摸缩放 */
html {
    touch-action: manipulation;
    -webkit-text-size-adjust: 100%;
    -ms-text-size-adjust: 100%;
}

body {
    touch-action: manipulation;
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
    user-select: none;
    -webkit-touch-callout: none;
    -webkit-tap-highlight-color: transparent;
}

/* 输入框和文本域允许选择 */
input, textarea, [contenteditable] {
    -webkit-user-select: text;
    -moz-user-select: text;
    -ms-user-select: text;
    user-select: text;
}

:root {
    --primary: #3ddc84;
    --primary-dark: #2ba866;
    --primary-light: #6ee7a8;
    --bg: #f0f2f5;
    --bg-gradient: linear-gradient(135deg, #e8f5e9 0%, #f0f2f5 50%, #e3f2fd 100%);
    --card-bg: #ffffff;
    --text: #2c3e50;
    --text-light: #7f8c8d;
    --border: #e8e8e8;
    --shadow: 0 2px 12px rgba(0, 0, 0, 0.06);
    --shadow-hover: 0 8px 24px rgba(61, 220, 132, 0.15);
    --radius: 14px;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'PingFang SC', 'Microsoft YaHei', sans-serif;
    background: var(--bg-gradient);
    background-attachment: fixed;
    color: var(--text);
    line-height: 1.6;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

a {
    text-decoration: none;
    color: inherit;
}

.container {
    max-width: 960px;
    margin: 0 auto;
    padding: 0 16px;
    width: 100%;
}

/* ===== 页头 ===== */
.site-header {
    background: linear-gradient(135deg, #2ba866 0%, #3ddc84 50%, #6ee7a8 100%);
    color: #fff;
    padding: 14px 0;
    box-shadow: 0 4px 20px rgba(43, 168, 102, 0.25);
    position: sticky;
    top: 0;
    z-index: 100;
    backdrop-filter: blur(10px);
}

.site-header .container {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.site-header .logo {
    font-size: 20px;
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 10px;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
}

.site-header .logo-img {
    height: clamp(36px, 7vw, 56px);
    width: auto;
    border-radius: 12px;
    object-fit: contain;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
}

.site-header nav a {
    margin-left: 16px;
    font-size: 14px;
    opacity: 0.9;
    transition: all 0.2s;
    padding: 6px 12px;
    border-radius: 8px;
}

.site-header nav a:hover {
    opacity: 1;
    background: rgba(255, 255, 255, 0.2);
}

/* ===== 主内容区 ===== */
main {
    flex: 1;
    padding: 24px 0 48px;
}

.page-title {
    font-size: 22px;
    margin-bottom: 20px;
    padding-bottom: 12px;
    border-bottom: 2px solid var(--primary);
    display: inline-block;
}

/* ===== 应用列表（卡片网格） ===== */
.app-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 16px;
}

.app-card {
    background: var(--card-bg);
    border-radius: var(--radius);
    padding: 16px;
    box-shadow: var(--shadow);
    border: 1px solid rgba(255, 255, 255, 0.8);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    display: flex;
    gap: 14px;
    cursor: pointer;
}

.app-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-hover);
    border-color: var(--primary-light);
}

.app-icon {
    width: clamp(56px, 14vw, 72px);
    height: clamp(56px, 14vw, 72px);
    border-radius: 14px;
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: clamp(24px, 6vw, 32px);
    color: #fff;
    flex-shrink: 0;
    overflow: hidden;
}

.app-icon img {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.app-info {
    flex: 1;
    min-width: 0;
}

.app-name {
    font-size: 16px;
    font-weight: 600;
    margin-bottom: 4px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.app-meta {
    font-size: 12px;
    color: var(--text-light);
    margin-bottom: 8px;
}

.app-meta span {
    margin-right: 8px;
    white-space: nowrap; /* 防止图标与文字被换行拆开 */
}

.app-category {
    display: inline-block;
    background: linear-gradient(135deg, rgba(61, 220, 132, 0.15), rgba(43, 168, 102, 0.15));
    color: var(--primary-dark);
    padding: 3px 10px;
    border-radius: 6px;
    font-size: 11px;
    font-weight: 500;
}

/* ===== 按钮 ===== */
.btn {
    display: inline-block;
    padding: 8px 18px;
    border-radius: 10px;
    font-size: 14px;
    font-weight: 500;
    border: none;
    cursor: pointer;
    transition: all 0.2s;
    text-align: center;
}

.btn-primary {
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
    color: #fff;
    box-shadow: 0 2px 8px rgba(61, 220, 132, 0.3);
}

.btn-primary:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(61, 220, 132, 0.4);
}

.btn-primary:active {
    transform: translateY(0);
    box-shadow: 0 1px 4px rgba(61, 220, 132, 0.3);
}

.btn-primary:disabled {
    background: #bdc3c7;
    box-shadow: none;
    cursor: not-allowed;
    transform: none;
}

.btn-block {
    display: block;
    width: 100%;
}

.btn-large {
    padding: 14px 24px;
    font-size: 16px;
    border-radius: 12px;
}

/* ===== 验证码下载区域 ===== */
.captcha-box {
    display: flex;
    width: 100%;
    gap: 10px;
    align-items: center;
    margin-bottom: 12px;
    flex-wrap: wrap;
}

.captcha-box #captcha-img {
    height: 42px;
    width: auto;
    flex-shrink: 0;
    border-radius: 6px;
    cursor: pointer;
    border: 1px solid var(--border);
}

.captcha-box #captcha-input {
    flex: 1;
    min-width: 120px;
    width: 100%;
    padding: 10px 12px;
    border: 1px solid var(--border);
    border-radius: 8px;
    font-size: 14px;
    outline: none;
    box-sizing: border-box;
}

.captcha-box #captcha-input:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(61, 220, 132, 0.15);
}

#captcha-msg {
    text-align: center;
    margin-top: 8px;
    font-size: 13px;
    color: var(--text-light);
    min-height: 18px;
}

/* 设备检测状态 */
.device-status {
    text-align: center;
    margin-bottom: 12px;
    font-size: 14px;
    min-height: 22px;
}

.device-ok {
    color: #2e7d32;
    font-weight: 500;
}

.device-error {
    color: #c62828;
    font-weight: 500;
}

.device-warn {
    color: #e65100;
    font-weight: 500;
}

/* ===== 应用详情页 ===== */
.app-detail {
    background: var(--card-bg);
    border-radius: var(--radius);
    padding: 24px;
    box-shadow: var(--shadow);
    border: 1px solid rgba(255, 255, 255, 0.8);
}

.app-detail-header {
    display: flex;
    gap: 20px;
    align-items: center;
    margin-bottom: 24px;
}

.app-detail-header .app-icon {
    width: clamp(80px, 22vw, 120px);
    height: clamp(80px, 22vw, 120px);
    border-radius: 20px;
    font-size: clamp(36px, 10vw, 48px);
}

.app-detail-header .app-info h1 {
    font-size: 24px;
    margin-bottom: 6px;
}

.app-detail-header .app-info .app-meta {
    font-size: 14px;
}

.detail-section {
    margin-bottom: 24px;
}

.detail-section h2 {
    font-size: 16px;
    margin-bottom: 10px;
    color: var(--text);
    display: flex;
    align-items: center;
    gap: 6px;
}

.detail-section h2::before {
    content: '';
    width: 4px;
    height: 16px;
    background: var(--primary);
    border-radius: 2px;
}

.detail-section p {
    color: var(--text-light);
    font-size: 14px;
    white-space: pre-wrap;
}

/* 安装提示 */
.install-tip {
    background: #fff8e1;
    border: 1px solid #ffe082;
    border-radius: 8px;
    padding: 14px;
    font-size: 13px;
    color: #795548;
    margin-bottom: 20px;
}

.install-tip strong {
    color: #e65100;
}

/* 二维码区域 */
.qr-section {
    text-align: center;
    padding: 20px;
    background: var(--bg);
    border-radius: var(--radius);
    margin-top: 20px;
}

.qr-section img {
    max-width: 180px;
    margin: 0 auto 10px;
    display: block;
}

.qr-section p {
    font-size: 13px;
    color: var(--text-light);
}

/* ===== 后台管理 ===== */
.admin-login {
    max-width: 360px;
    margin: 60px auto;
    background: var(--card-bg);
    padding: 32px;
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    text-align: center;
}

.admin-login h1 {
    margin-bottom: 20px;
}

.form-group {
    margin-bottom: 16px;
    text-align: left;
}

.form-group label {
    display: block;
    font-size: 14px;
    margin-bottom: 6px;
    font-weight: 500;
}

.form-group input,
.form-group textarea,
.form-group select {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid var(--border);
    border-radius: 8px;
    font-size: 14px;
    font-family: inherit;
}

.form-group textarea {
    min-height: 80px;
    resize: vertical;
}

.admin-table {
    width: 100%;
    border-collapse: collapse;
    background: var(--card-bg);
    border-radius: var(--radius);
    overflow: hidden;
    box-shadow: var(--shadow);
}

.admin-table th,
.admin-table td {
    padding: 12px 16px;
    text-align: left;
    border-bottom: 1px solid var(--border);
}

.admin-table th {
    background: var(--bg);
    font-weight: 600;
    font-size: 13px;
}

.admin-actions a {
    margin-right: 10px;
    font-size: 13px;
    color: var(--primary-dark);
}

.admin-actions a.danger {
    color: #e74c3c;
}

.alert {
    padding: 12px 16px;
    border-radius: 8px;
    margin-bottom: 16px;
    font-size: 14px;
}

.alert-success {
    background: #e8f5e9;
    color: #2e7d32;
}

.alert-error {
    background: #ffebee;
    color: #c62828;
}

/* ===== 页脚 ===== */
.site-footer {
    background: linear-gradient(135deg, #2c3e50 0%, #1a252f 100%);
    color: #bdc3c7;
    text-align: center;
    padding: 24px 0;
    font-size: 13px;
    box-shadow: 0 -2px 10px rgba(0, 0, 0, 0.1);
}

.site-footer a {
    color: var(--primary);
    transition: opacity 0.2s;
}

.site-footer a:hover {
    opacity: 0.8;
}

/* ===== 平台品牌图标（内联SVG，尺寸随文字，颜色继承 currentColor） ===== */
.plat-icon {
    width: 1em;
    height: 1em;
    vertical-align: -0.15em;
    margin-right: 2px;
}

/* ===== 平台徽标 ===== */
.plat-badge {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 10px;
    font-size: 12px;
    line-height: 1.6;
    white-space: nowrap;
    margin-right: 4px;
}

.plat-android {
    background: #e8f5e9;
    color: #2e7d32;
    border: 1px solid #a5d6a7;
}

.plat-ios {
    background: #e3f2fd;
    color: #1565c0;
    border: 1px solid #90caf9;
}

/* ===== iOS 安装中转页 ===== */
.install-redirect {
    max-width: 440px;
    margin: 48px auto;
    background: var(--card-bg);
    padding: 32px 24px;
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    text-align: center;
}

.install-redirect .install-icon {
    font-size: 52px;
    margin-bottom: 12px;
}

.install-redirect h2 {
    font-size: 20px;
    margin-bottom: 12px;
}

.install-redirect .install-desc {
    font-size: 14px;
    color: var(--text-light);
    line-height: 1.7;
    margin-bottom: 20px;
}

/* ===== 响应式 ===== */
@media (max-width: 600px) {
    .app-detail-header {
        flex-direction: column;
        text-align: center;
    }

    .app-detail-header .app-info h1 {
        font-size: 20px;
    }

    .app-grid {
        grid-template-columns: 1fr;
    }
}
