/* 乒乓球计分板 - 公共样式（移动端优先，更美观） */
:root {
    --bg: #f5f6f8;
    --bg-subtle: #eef0f4;
    --surface: #ffffff;
    --primary: #5b6bf2;
    --primary-dark: #4c51e8;
    --accent: #7c3aed;
    --text: #1e293b;
    --text-muted: #64748b;
    --border: #e2e8f0;
    --radius: 14px;
    --radius-sm: 10px;
    --radius-lg: 18px;
    --shadow: 0 1px 3px rgba(0,0,0,.06);
    --shadow-md: 0 4px 14px rgba(0,0,0,.08);
    --shadow-lg: 0 10px 40px rgba(0,0,0,.1);
    --safe-top: env(safe-area-inset-top, 0);
    --safe-bottom: env(safe-area-inset-bottom, 0);
    --nav-height: 70px;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    -webkit-tap-highlight-color: transparent;
    -webkit-text-size-adjust: 100%;
    text-size-adjust: 100%;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", Roboto, sans-serif;
    background: var(--bg);
    color: var(--text);
    min-height: 100vh;
    padding-top: var(--safe-top);
    padding-bottom: calc(var(--nav-height) + var(--safe-bottom) + 20px);
    line-height: 1.55;
    font-size: 15px;
    -webkit-font-smoothing: antialiased;
}

/* Bottom nav (legacy .bottom-nav): icon above, text below */
.bottom-nav {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    height: calc(var(--nav-height) + var(--safe-bottom));
    padding: 10px 8px calc(10px + var(--safe-bottom));
    display: flex;
    align-items: center;
    justify-content: space-around;
    gap: 4px;
    z-index: 1000;
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
}

.bottom-nav .nav-item {
    flex: 1;
    min-width: 48px;
    min-height: 52px;
    text-align: center;
    text-decoration: none;
    display: flex !important;
    flex-direction: column !important;
    align-items: center !important;
    justify-content: center !important;
    gap: 4px;
    padding: 8px 6px !important;
    border-radius: 16px;
    white-space: nowrap;
}

.bottom-nav .nav-item .icon {
    font-size: 20px;
    line-height: 1;
    display: block;
}

.bottom-nav .nav-item .label {
    font-size: 11px;
    line-height: 1.1;
    display: block;
}

/* 底部导航 - 手机端更美观 */
.app-nav {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    height: calc(var(--nav-height) + var(--safe-bottom));
    padding-bottom: var(--safe-bottom);
    background: rgba(255,255,255,.95);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    box-shadow: 0 -4px 20px rgba(0,0,0,.06);
    display: flex;
    align-items: center;
    justify-content: space-around;
    z-index: 1000;
    border-top: 1px solid var(--border);
}

.app-nav .nav-item {
    flex: 1;
    text-align: center;
    padding: 10px 6px;
    color: var(--text-muted);
    text-decoration: none;
    font-size: 11px;
    font-weight: 500;
    letter-spacing: 0.02em;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    transition: color .2s ease;
}

.app-nav .nav-item:hover,
.app-nav .nav-item.active {
    color: var(--primary);
    font-weight: 600;
}

.app-nav .nav-item .icon {
    font-size: 20px;
    line-height: 1;
}

/* 触控友好：导航与按钮最小点击区域 */
.btn-primary,
.btn-secondary,
input[type="submit"] {
    min-height: 46px;
}
.app-nav .nav-item {
    min-height: 52px;
    min-width: 48px;
}

/* 页面容器 */
.page-container {
    max-width: 600px;
    margin: 0 auto;
    padding: 18px 16px;
}

@media (min-width: 600px) {
    .page-container {
        padding: 28px 24px;
    }
}

/* 卡片 - 更柔和立体 */
.card {
    background: var(--surface);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 18px;
    margin-bottom: 14px;
    border: 1px solid rgba(0,0,0,.04);
    transition: box-shadow .2s ease;
}

.card:active {
    box-shadow: var(--shadow-md);
}

.card-title {
    font-size: 16px;
    font-weight: 600;
    margin-bottom: 12px;
    color: var(--text);
    letter-spacing: -0.01em;
}

/* 主按钮 */
.btn-primary {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 14px 26px;
    background: linear-gradient(135deg, var(--primary) 0%, var(--accent) 100%);
    color: #fff;
    border: none;
    border-radius: var(--radius-sm);
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: opacity .2s, transform .08s ease, box-shadow .2s;
    box-shadow: 0 4px 14px rgba(91, 107, 242, .35);
}

.btn-primary:hover {
    box-shadow: 0 6px 20px rgba(91, 107, 242, .4);
}

.btn-primary:active {
    transform: scale(0.98);
}

.btn-primary:disabled {
    opacity: .55;
    cursor: not-allowed;
    box-shadow: none;
}

/* 次要按钮 */
.btn-secondary {
    padding: 12px 22px;
    background: var(--surface);
    color: var(--primary);
    border: 1.5px solid var(--primary);
    border-radius: var(--radius-sm);
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: background .2s, color .2s, border-color .2s;
}

.btn-secondary:active {
    background: var(--bg-subtle);
}

/* 头部 */
.app-header {
    background: linear-gradient(135deg, var(--primary) 0%, var(--accent) 100%);
    color: #fff;
    padding: 16px 20px;
    padding-top: calc(16px + var(--safe-top));
    display: flex;
    align-items: center;
    justify-content: space-between;
    min-height: 54px;
    box-shadow: 0 2px 12px rgba(91, 107, 242, .25);
}

.app-header .back-btn,
.app-header .header-btn {
    background: rgba(255,255,255,.22);
    color: #fff;
    border: none;
    padding: 9px 16px;
    border-radius: var(--radius-sm);
    font-size: 14px;
    font-weight: 500;
    text-decoration: none;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    transition: background .2s;
}

.app-header .back-btn:active,
.app-header .header-btn:active {
    background: rgba(255,255,255,.35);
}

.app-header .header-title {
    font-size: 18px;
    font-weight: 600;
    letter-spacing: -0.02em;
}

/* 表单 */
.input-group {
    margin-bottom: 16px;
}

.input-group label {
    display: block;
    font-size: 13px;
    font-weight: 500;
    color: var(--text-muted);
    margin-bottom: 6px;
}

.input-group input,
.input-group select,
.input-group textarea {
    width: 100%;
    padding: 13px 16px;
    border: 1.5px solid var(--border);
    border-radius: var(--radius-sm);
    font-size: 16px;
    background: var(--surface);
    transition: border-color .2s, box-shadow .2s;
}

.input-group input:focus,
.input-group select:focus,
.input-group textarea:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(91, 107, 242, .15);
}

/* 列表项 */
.list-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 15px 0;
    border-bottom: 1px solid var(--border);
}

.list-item:last-child {
    border-bottom: none;
}

/* 空状态 */
.empty-state {
    text-align: center;
    padding: 40px 20px;
    color: var(--text-muted);
    font-size: 14px;
    line-height: 1.6;
}

/* ========== 手机视图增强（小屏更美观） ========== */
@media (max-width: 480px) {
    body {
        font-size: 15px;
        padding-bottom: calc(var(--nav-height) + var(--safe-bottom) + 24px);
    }

    .page-container {
        padding: 16px 14px;
    }

    .card {
        padding: 16px;
        margin-bottom: 12px;
        border-radius: var(--radius);
    }

    .card-title {
        font-size: 15px;
    }

    .btn-primary {
        padding: 14px 24px;
        font-size: 15px;
        border-radius: var(--radius-sm);
    }

    .app-nav .nav-item {
        font-size: 11px;
    }

    .app-header .header-title {
        font-size: 17px;
    }
}

/* 超小屏（如窄屏手机） */
@media (max-width: 360px) {
    .page-container {
        padding: 12px 10px;
    }

    .card {
        padding: 14px;
    }
}

/* 底部导航：小屏也要“够厚”、好点按（只收紧横向空间，避免显得很窄） */
@media (max-width: 480px) {
    .bottom-nav {
        /* 让视觉高度更饱满；同时照顾底部安全区 */
        padding: 10px 6px calc(10px + env(safe-area-inset-bottom)) !important;
        min-height: 68px;
    }
    .bottom-nav .nav-item {
        font-size: 12px !important;
        padding: 10px 6px !important;
        margin: 0 2px !important;
        border-radius: 18px !important;
        min-height: 44px;
        white-space: nowrap;
    }
}
