/* 黑白灰高级技术主题 - 立体感 */
:root {
    --bg: #0a0a0a;
    --bg-elevated: #111111;
    --bg-card: #161616;
    --bg-input: #1e1e1e;
    --border: #2a2a2a;
    --border-subtle: #222222;
    --text-primary: #f0f0f0;
    --text-secondary: #888888;
    --text-tertiary: #888888;
    --white: #ffffff;
    --black: #000000;
    --gray-100: #f5f5f5;
    --gray-200: #e5e5e5;
    --gray-300: #d4d4d4;
    --gray-400: #a3a3a3;
    --gray-500: #737373;
    --gray-600: #525252;
    --gray-700: #404040;
    --gray-800: #262626;
    --gray-900: #171717;
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.3);
    --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.4);
    --shadow-lg: 0 8px 24px rgba(0, 0, 0, 0.5);
    --shadow-glow: 0 0 20px rgba(255, 255, 255, 0.03);
}

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

html {
    font-size: 16px;
}

@media screen and (max-width: 375px) {
    html {
        font-size: 14px;
    }
}

@media screen and (min-width: 414px) {
    html {
        font-size: 18px;
    }
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'SF Pro Display', 'SF Pro Text', 'Helvetica Neue', sans-serif;
    background: var(--bg);
    color: var(--text-primary);
    min-height: 100vh;
    -webkit-font-smoothing: antialiased;
    letter-spacing: -0.01em;
    font-size: 1rem;
    line-height: 1.5;
}

#app {
    max-width: 430px;
    margin: 0 auto;
    min-height: 100vh;
    position: relative;
}

.page {
    min-height: 100vh;
    padding: 0 20px 120px;
    display: none;
    flex-direction: column;
}

.page--login {
    justify-content: center;
    padding: 0 24px 60px;
}

.page--home {
    padding-top: 16px;
}

/* 顶部栏 */
.top-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    position: sticky;
    top: 0;
    background: rgba(0, 0, 0, 0.9);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    z-index: 10;
    margin: 0 -20px;
    padding: 26px 20px;
}

.page-title {
    font-size: 1.1rem;
    font-weight: 500;
    letter-spacing: 0.02em;
    color: var(--text-primary);
}

.icon-btn {
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: transparent;
    border: 1px solid var(--border);
    border-radius: 10px;
    color: var(--text-primary);
    cursor: pointer;
    transition: all 0.15s ease;
}

.icon-btn:active {
    background: var(--gray-900);
    transform: scale(0.95);
}

.user-info {
    display: flex;
    align-items: center;
    gap: 12px;
}

.user-text {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.nickname {
    font-size: 1.1rem;
    font-weight: 500;
    letter-spacing: 0.01em;
}

.blessing {
    font-size: 0.8rem;
    color: var(--text-tertiary);
    letter-spacing: 0.02em;
    max-width: 200px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.top-bar--home {
    justify-content: space-between;
}

.top-bar-left {
    flex: 1;
    min-width: 0;
}

/* 头像 */
.avatar {
    width: 32px;
    height: 32px;
    border-radius: 8px;
    background: var(--white);
    color: var(--black);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 13px;
    font-weight: 600;
    flex-shrink: 0;
    overflow: hidden;
}

.avatar-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

/* 登录 */
.login-hero {
    text-align: center;
    margin-bottom: 48px;
}

.hero-icon {
    width: 64px;
    height: 64px;
    margin: 0 auto 24px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.hero-title {
    font-size: 1.8rem;
    font-weight: 600;
    margin-bottom: 8px;
    letter-spacing: -0.03em;
    color: var(--white);
}

.hero-subtitle {
    font-size: 1rem;
    color: var(--text-tertiary);
    letter-spacing: 0.01em;
}

.login-card {
    background: linear-gradient(145deg, var(--bg-card), var(--bg-elevated));
    border: 1px solid var(--border);
    border-radius: 16px;
    padding: 24px;
    box-shadow:
        var(--shadow-lg),
        inset 0 1px 0 rgba(255, 255, 255, 0.03);
}

.tab-bar {
    display: flex;
    position: relative;
    background: var(--bg-input);
    border-radius: 10px;
    padding: 3px;
    margin-bottom: 24px;
}

.tab-item {
    flex: 1;
    padding: 10px;
    border: none;
    background: transparent;
    color: var(--text-tertiary);
    font-size: 0.95rem;
    font-weight: 500;
    cursor: pointer;
    position: relative;
    z-index: 1;
    transition: color 0.2s;
}

.tab-item.active {
    color: var(--white);
}

.tab-indicator {
    position: absolute;
    top: 3px;
    left: 0;
    width: 50%;
    height: calc(100% - 6px);
    background: var(--gray-800);
    border-radius: 8px;
    transition: left 0.2s ease;
    z-index: 0;
}

/* 表单 */
.form-group {
    margin-bottom: 12px;
}

.form-input {
    width: 100%;
    padding: 14px 16px;
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: 10px;
    font-size: 1.1rem;
    color: var(--white);
    outline: none;
    transition: border-color 0.2s;
    letter-spacing: 0.01em;
}

.form-input:focus {
    border-color: var(--gray-600);
}

.form-input::placeholder {
    color: var(--text-tertiary);
}

.form-input--center {
    text-align: center;
    font-size: 1.8rem;
    font-weight: 600;
    font-variant-numeric: tabular-nums;
}

/* 记住账号 */
.remember-check {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 16px;
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
}

.remember-check input {
    display: none;
}

.remember-box {
    width: 16px;
    height: 16px;
    border: 1.5px solid var(--gray-600);
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: all 0.15s ease;
}

.remember-check input:checked + .remember-box {
    background: var(--white);
    border-color: var(--white);
}

.remember-check input:checked + .remember-box::after {
    content: '';
    width: 4px;
    height: 8px;
    border: solid var(--black);
    border-width: 0 1.5px 1.5px 0;
    transform: rotate(45deg) translate(-0.5px, -0.5px);
}

.remember-text {
    font-size: 0.95rem;
    color: var(--text-tertiary);
}

/* 按钮 */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 13px 24px;
    border-radius: 10px;
    font-size: 1rem;
    font-weight: 500;
    border: none;
    cursor: pointer;
    transition: all 0.15s ease;
    letter-spacing: 0.02em;
    box-shadow: var(--shadow-sm);
}

.btn:disabled {
    opacity: 0.3;
    cursor: not-allowed;
}

.btn--primary {
    background: var(--white);
    color: var(--black);
}

.btn--primary:not(:disabled):active {
    background: var(--gray-200);
    transform: scale(0.98);
}

.btn--outline {
    background: transparent;
    border: 1px solid var(--border);
    color: var(--white);
}

.btn--outline:active {
    background: var(--gray-900);
}

.btn--danger {
    background: var(--gray-800);
    color: var(--white);
    border: 1px solid var(--gray-700);
}

.btn--danger:active {
    background: var(--gray-700);
}

.btn--ghost {
    background: transparent;
    color: var(--text-secondary);
}

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

/* 操作卡片 */
.action-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
    margin: 12px 0 32px;
}

.action-card {
    background: linear-gradient(145deg, var(--bg-card), var(--bg-elevated));
    border: 1px solid var(--border);
    border-radius: 14px;
    padding: 20px;
    cursor: pointer;
    transition: all 0.15s ease;
    box-shadow: var(--shadow-md);
}

.action-card:active {
    transform: scale(0.98);
    background: var(--gray-900);
}

.action-card--primary {
    background: var(--white);
    border-color: var(--white);
}

.action-card--primary .action-icon {
    color: var(--black);
}

.action-card--primary .action-title {
    color: var(--black);
}

.action-card--primary .action-desc {
    color: var(--gray-600);
}

.action-icon {
    color: var(--text-secondary);
    margin-bottom: 12px;
}

.action-title {
    display: block;
    font-size: 1rem;
    font-weight: 500;
    margin-bottom: 4px;
    color: var(--white);
}

.action-desc {
    display: block;
    font-size: 0.85rem;
    color: var(--text-tertiary);
}

/* 区块 */
.section {
    margin-bottom: 24px;
}

.section-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 12px;
}

.section-title {
    font-size: 0.8rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--text-tertiary);
}

/* 房间卡片 */
.room-card {
    background: linear-gradient(145deg, var(--bg-card), var(--bg-elevated));
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 16px;
    margin-bottom: 8px;
    cursor: pointer;
    transition: all 0.15s ease;
    box-shadow: var(--shadow-md);
    position: relative;
}

.room-card:active {
    background: var(--gray-900);
}

.room-main {
    margin-bottom: 10px;
}

.room-code {
    font-size: 1.3rem;
    font-weight: 600;
    font-family: 'SF Mono', 'SF Pro Text', 'Menlo', monospace;
    letter-spacing: 0.1em;
    display: block;
    margin-bottom: 4px;
    color: var(--white);
}

.room-name {
    font-size: 0.95rem;
    color: var(--text-tertiary);
}

.room-meta {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.room-time {
    font-size: 0.85rem;
    color: var(--text-tertiary);
    font-variant-numeric: tabular-nums;
}

.status-badge {
    font-size: 0.8rem;
    padding: 3px 8px;
    border-radius: 4px;
    font-weight: 500;
    letter-spacing: 0.02em;
}

.status-badge.active {
    background: var(--white);
    color: var(--black);
}

.status-badge.finished {
    background: var(--gray-800);
    color: var(--text-tertiary);
}

.result-badge {
    font-size: 0.8rem;
    padding: 2px 6px;
    border-radius: 4px;
    font-weight: 600;
    position: absolute;
    top: 12px;
    right: 12px;
}
.result-badge.win {
    background: #2d4a2e;
    color: #6fcf6f;
}
.result-badge.lose {
    background: #4a2d2d;
    color: #f07171;
}
.result-badge.tie {
    background: var(--gray-800);
    color: var(--text-tertiary);
}

/* 空状态 */
.empty {
    text-align: center;
    padding: 60px 20px;
    color: var(--text-tertiary);
}

.empty svg {
    margin-bottom: 16px;
    opacity: 0.2;
}

.empty p {
    font-size: 13px;
}

/* 房间页头部 */
.room-banner {
    background: linear-gradient(145deg, var(--bg-card), var(--bg-elevated));
    border: 1px solid var(--border);
    border-radius: 14px;
    padding: 20px;
    margin-bottom: 24px;
    box-shadow:
        var(--shadow-lg),
        inset 0 1px 0 rgba(255, 255, 255, 0.03);
}

.banner-label {
    font-size: 11px;
    color: var(--text-tertiary);
    text-transform: uppercase;
    letter-spacing: 0.08em;
    display: block;
    margin-bottom: 12px;
}

.banner-code-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 8px;
}

.banner-code {
    font-size: 2rem;
    font-weight: 600;
    font-family: 'SF Mono', 'SF Pro Text', 'Menlo', monospace;
    letter-spacing: 0.15em;
    color: var(--white);
}

.copy-btn {
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: transparent;
    border: 1px solid var(--border);
    border-radius: 8px;
    color: var(--text-secondary);
    cursor: pointer;
    transition: all 0.15s ease;
}

.copy-btn:active {
    background: var(--gray-800);
}

.banner-title {
    font-size: 0.95rem;
    color: var(--text-tertiary);
}

/* 玩家列表 */
.player-list {
    background: linear-gradient(145deg, var(--bg-card), var(--bg-elevated));
    border: 1px solid var(--border);
    border-radius: 12px;
    overflow: hidden;
    box-shadow: var(--shadow-md);
}

.player-row {
    display: flex;
    align-items: center;
    padding: 14px 16px;
    cursor: pointer;
    transition: background 0.1s ease;
}

.player-row:not(:last-child) {
    border-bottom: 1px solid var(--border-subtle);
}

.player-row:active {
    background: var(--gray-900);
}

.player-avatar {
    width: 36px;
    height: 36px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1rem;
    font-weight: 600;
    color: var(--black);
    margin-right: 12px;
    flex-shrink: 0;
    overflow: hidden;
}

.player-avatar > span {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 100%;
}

.player-avatar-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.player-detail {
    flex: 1;
}

.player-name-row {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-bottom: 2px;
}

.player-name {
    font-size: 1rem;
    font-weight: 500;
    color: var(--white);
}

.badge {
    font-size: 0.75rem;
    padding: 2px 6px;
    border-radius: 4px;
    font-weight: 500;
}

.badge--me {
    background: var(--white);
    color: var(--black);
}

.player-score-label {
    font-size: 0.85rem;
    color: var(--text-tertiary);
    font-variant-numeric: tabular-nums;
}

.player-score-value {
    font-size: 1.2rem;
    font-weight: 700;
    font-family: 'SF Mono', 'SF Pro Text', 'Menlo', monospace;
    font-variant-numeric: tabular-nums;
}

.positive {
    color: #22c55e;
}

.negative {
    color: #ef4444;
}

.zero {
    color: var(--text-tertiary);
}

/* 底部操作 */
.bottom-actions {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    padding: 16px 20px;
    padding-bottom: max(16px, env(safe-area-inset-bottom));
    background: rgba(0, 0, 0, 0.95);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-top: 1px solid var(--border);
    display: flex;
    gap: 10px;
    max-width: 430px;
    margin: 0 auto;
    z-index: 10;
}

.bottom-actions .btn {
    flex: 1;
}

/* 计分页 */
.score-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
    margin-bottom: 20px;
}

.score-card {
    background: linear-gradient(145deg, var(--bg-card), var(--bg-elevated));
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 16px;
    text-align: center;
    cursor: pointer;
    transition: all 0.15s ease;
    box-shadow: var(--shadow-md);
}

.score-card:active {
    transform: scale(0.98);
    background: var(--gray-900);
}

.score-card .player-avatar {
    margin: 0 auto 10px;
}

.score-card-name {
    display: block;
    font-size: 0.85rem;
    color: var(--text-tertiary);
    margin-bottom: 6px;
}

.score-card-value {
    font-size: 1.5rem;
    font-weight: 600;
    font-family: 'SF Mono', 'SF Pro Text', 'Menlo', monospace;
    font-variant-numeric: tabular-nums;
}

.score-bar {
    display: flex;
    justify-content: space-around;
    background: linear-gradient(145deg, var(--bg-card), var(--bg-elevated));
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 16px;
    margin-bottom: 24px;
    box-shadow: var(--shadow-md);
}

.bar-item {
    text-align: center;
}

.bar-name {
    display: block;
    font-size: 0.8rem;
    color: var(--text-tertiary);
    margin-bottom: 4px;
}

.bar-score {
    font-size: 1.1rem;
    font-weight: 600;
    font-family: 'SF Mono', 'SF Pro Text', 'Menlo', monospace;
    font-variant-numeric: tabular-nums;
}

/* 历史记录 */
.record-list {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.record-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.record-date {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-secondary);
    padding: 0 4px;
    text-align: center;
}

.record-item {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    padding: 10px 14px;
    background: var(--bg-card);
    border: 1px solid var(--border-subtle);
    border-radius: 8px;
    gap: 4px 0;
}

.record-name {
    flex: 1;
    font-size: 1rem;
    color: var(--text-primary);
    font-weight: 500;
}

.record-score {
    font-size: 1.1rem;
    font-weight: 600;
    font-variant-numeric: tabular-nums;
}

.record-time {
    width: 100%;
    font-size: 11px;
    color: var(--text-tertiary);
    margin-top: 2px;
}

/* 弹窗 */
.overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.85);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    z-index: 1000;
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
}

.dialog {
    width: 100%;
    max-width: 320px;
    background: linear-gradient(145deg, var(--bg-card), var(--bg-elevated));
    border: 1px solid var(--border);
    border-radius: 16px;
    padding: 24px;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.6);
}

.dialog-title {
    font-size: 1.2rem;
    font-weight: 600;
    text-align: center;
    margin-bottom: 20px;
    color: var(--white);
}

.dialog-footer {
    display: flex;
    gap: 10px;
    margin-top: 16px;
}

.dialog-footer .btn {
    flex: 1;
}

/* 计分弹窗 */
.dialog--score {
    max-width: 340px;
}

.score-current {
    text-align: center;
    font-size: 1rem;
    color: var(--text-secondary);
    margin-bottom: 16px;
    font-variant-numeric: tabular-nums;
}

.quick-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
    margin-bottom: 16px;
}

.quick-btn {
    padding: 12px;
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: 8px;
    color: var(--white);
    font-size: 1rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.1s ease;
    font-family: 'SF Mono', 'SF Pro Text', 'Menlo', monospace;
}

.quick-btn:active {
    background: var(--gray-800);
    transform: scale(0.95);
}

.score-preview {
    text-align: center;
    font-size: 13px;
    color: var(--text-secondary);
    margin-top: 12px;
}

.score-preview strong {
    color: var(--white);
    font-size: 16px;
    font-weight: 600;
    font-family: 'SF Mono', 'SF Pro Text', 'Menlo', monospace;
}

/* 分享 */
.share-qr {
    display: flex;
    justify-content: center;
    align-items: center;
    background: var(--white);
    border-radius: 12px;
    margin-bottom: 16px;
    width: 180px;
    height: 180px;
    margin-left: auto;
    margin-right: auto;
    padding: 10px;
}

.share-qr canvas,
.share-qr img {
    width: 100% !important;
    height: 100% !important;
}

.share-qr img {
    width: 180px;
    height: 180px;
    display: block;
}

.share-link {
    display: none;
}

.share-link:active {
    border-color: var(--gray-600);
}

/* ========== 自定义 Toast ========== */
.c-toast {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%) scale(0.8);
    color: var(--white);
    padding: 14px 24px;
    border-radius: 12px;
    font-size: 1rem;
    display: flex;
    align-items: center;
    gap: 8px;
    z-index: 10000;
    opacity: 0;
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    border: 1px solid rgba(255, 255, 255, 0.08);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.5);
    pointer-events: none;
    max-width: 280px;
    text-align: center;
    justify-content: center;
    position: fixed;
    overflow: hidden;
}

.c-toast::before {
    content: '';
    position: absolute;
    inset: 0;
    background: rgba(30, 30, 30, 0.88);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    z-index: -1;
    border-radius: inherit;
}

.c-toast--show {
    opacity: 1;
    transform: translate(-50%, -50%) scale(1);
}

.c-toast-icon {
    display: flex;
    align-items: center;
    flex-shrink: 0;
}

.c-toast--success .c-toast-icon {
    color: #22c55e;
}

.c-toast--fail .c-toast-icon {
    color: #ef4444;
}

/* ========== 自定义 Confirm Dialog ========== */
.c-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.75);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 32px;
    z-index: 10000;
    opacity: 0;
    transition: opacity 0.2s ease;
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
}

.c-overlay--show {
    opacity: 1;
}

.c-dialog {
    width: 100%;
    max-width: 300px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 16px;
    padding: 28px 24px 20px;
    transform: scale(0.9);
    transition: transform 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.6);
}

.c-overlay--show .c-dialog {
    transform: scale(1);
}

.c-dialog-title {
    font-size: 17px;
    font-weight: 600;
    text-align: center;
    margin-bottom: 10px;
    color: var(--white);
}

.c-dialog-msg {
    font-size: 14px;
    color: var(--text-secondary);
    text-align: center;
    line-height: 1.6;
    margin-bottom: 24px;
}

.c-dialog-btns {
    display: flex;
    gap: 10px;
}

.c-dialog-btn {
    flex: 1;
    padding: 12px;
    border: none;
    border-radius: 10px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.15s ease;
}

.c-dialog-btn--cancel {
    background: var(--bg-input);
    color: var(--text-secondary);
    border: 1px solid var(--border);
}

.c-dialog-btn--cancel:active {
    background: var(--gray-800);
}

.c-dialog-btn--ok {
    background: var(--white);
    color: var(--black);
}

.c-dialog-btn--ok:active {
    background: var(--gray-200);
    transform: scale(0.97);
}

/* 设置弹窗头像 */
.setting-avatar-wrap {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    margin-bottom: 16px;
}

.setting-avatar-preview {
    width: 64px;
    height: 64px;
    border-radius: 16px;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg-input);
    border: 2px solid var(--border);
}

.setting-avatar-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.btn--sm {
    padding: 6px 14px;
    font-size: 0.85rem;
}

.setting-number {
    text-align: center;
    font-size: 0.85rem;
    color: var(--text-tertiary);
    margin-bottom: 12px;
    cursor: pointer;
    letter-spacing: 0.05em;
}

.setting-number:active {
    color: var(--text-primary);
}

/* 头像选择器弹窗 */
.dialog--avatar {
    max-width: 360px;
    max-height: 75vh;
    display: flex;
    flex-direction: column;
}

.avatar-upload-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    width: 100%;
    padding: 12px;
    margin-bottom: 16px;
    background: var(--bg-input);
    border: 1px dashed var(--border);
    border-radius: 10px;
    color: var(--text-secondary);
    font-size: 0.95rem;
    cursor: pointer;
    transition: all 0.15s ease;
}

.avatar-upload-btn:active {
    background: var(--gray-800);
    border-color: var(--gray-600);
}

.avatar-grid {
    overflow-y: auto;
    padding: 4px 0;
    max-height: 50vh;
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.avatar-category-title {
    font-size: 11px;
    font-weight: 600;
    color: var(--text-tertiary);
    text-transform: uppercase;
    letter-spacing: 0.08em;
    padding: 0 2px;
}

.avatar-category-grid {
    display: grid;
    grid-template-columns: repeat(6, 1fr);
    gap: 8px;
}

.avatar-item {
    aspect-ratio: 1;
    border-radius: 10px;
    border: 2px solid transparent;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 4px;
    transition: all 0.15s ease;
    background: var(--bg-input);
}

.avatar-item:active {
    transform: scale(0.92);
}

.avatar-item--selected {
    border-color: var(--white);
    background: var(--gray-800);
}

.avatar-item img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    display: block;
}

/* 底部弹窗 */
.overlay--bottom {
    align-items: flex-end;
}

.more-panel {
    width: 100%;
    max-width: 430px;
    max-height: 80vh;
    background: linear-gradient(145deg, var(--bg-card), var(--bg-elevated));
    border: 1px solid var(--border);
    border-radius: 16px 16px 0 0;
    box-shadow: 0 -10px 40px rgba(0, 0, 0, 0.5);
    display: flex;
    flex-direction: column;
}

.more-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 20px 20px 0;
}

.more-title {
    font-size: 1.2rem;
    font-weight: 600;
    color: var(--white);
}

.more-close {
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: transparent;
    border: 1px solid var(--border);
    border-radius: 8px;
    color: var(--text-secondary);
    cursor: pointer;
    transition: all 0.15s ease;
}

.more-close:active {
    background: var(--gray-800);
}

.more-body {
    padding: 20px;
    overflow-y: auto;
    flex: 1;
}

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

.more-section:last-child {
    margin-bottom: 0;
}

.more-section-title {
    font-size: 0.8rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--text-tertiary);
    margin-bottom: 12px;
}

.more-user-info {
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 16px;
}

.more-room-info {
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 12px 16px;
}

.more-info-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px 0;
}

.more-info-row:not(:last-child) {
    border-bottom: 1px solid var(--border-subtle);
}

.more-info-label {
    font-size: 0.95rem;
    color: var(--text-secondary);
}

.more-info-value {
    font-size: 0.95rem;
    color: var(--text-primary);
    font-weight: 500;
}

.more-user-row {
    display: flex;
    align-items: center;
    gap: 12px;
}

.more-avatar {
    width: 48px;
    height: 48px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.3rem;
    font-weight: 600;
    color: var(--black);
    flex-shrink: 0;
    overflow: hidden;
}

.more-avatar > span {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 100%;
}

.more-avatar-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.more-user-detail {
    flex: 1;
}

.more-user-name {
    font-size: 1.2rem;
    font-weight: 500;
    color: var(--white);
    margin-bottom: 4px;
}

.more-user-score {
    font-size: 1rem;
    font-weight: 600;
    font-variant-numeric: tabular-nums;
}

.more-score-list {
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: 12px;
    overflow: hidden;
}

.more-score-row {
    display: flex;
    align-items: center;
    padding: 12px 16px;
}

.more-score-row:not(:last-child) {
    border-bottom: 1px solid var(--border-subtle);
}

.more-score-rank {
    width: 24px;
    font-size: 12px;
    font-weight: 600;
    color: var(--text-tertiary);
    text-align: center;
    margin-right: 8px;
}

.more-score-avatar {
    width: 32px;
    height: 32px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    font-weight: 600;
    color: var(--black);
    margin-right: 10px;
    flex-shrink: 0;
    overflow: hidden;
}

.more-score-avatar > span {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 100%;
}

.more-score-avatar-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.more-score-name {
    flex: 1;
    font-size: 14px;
    color: var(--text-primary);
}

.more-score-value {
    font-size: 16px;
    font-weight: 600;
    font-family: 'SF Mono', 'SF Pro Text', 'Menlo', monospace;
    font-variant-numeric: tabular-nums;
}

/* ========== 更多页面 ========== */
.page--more {
    padding-bottom: 40px;
}

.more-card {
    background: linear-gradient(145deg, var(--bg-card), var(--bg-elevated));
    border: 1px solid var(--border);
    border-radius: 14px;
    padding: 16px;
    margin-bottom: 12px;
    box-shadow: var(--shadow-md);
}

.more-card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 12px;
}

.more-card-label {
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--text-tertiary);
}

.more-card-code {
    font-size: 24px;
    font-weight: 600;
    font-family: 'SF Mono', 'SF Pro Text', 'Menlo', monospace;
    letter-spacing: 0.12em;
    color: var(--white);
    margin-bottom: 4px;
}

.more-card-title {
    font-size: 13px;
    color: var(--text-tertiary);
    margin-bottom: 12px;
}

.more-card-meta {
    display: flex;
    gap: 16px;
}

.more-meta-item {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 12px;
    color: var(--text-secondary);
}

.more-meta-item svg {
    opacity: 0.6;
}

/* 用户信息 */
.more-user-section {
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 14px;
}

.more-user-row {
    display: flex;
    align-items: center;
    gap: 12px;
}

.more-user-avatar {
    width: 48px;
    height: 48px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    font-weight: 600;
    color: var(--black);
    flex-shrink: 0;
    overflow: hidden;
}

.more-user-avatar > span {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 100%;
}

.more-user-avatar-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.more-user-detail {
    flex: 1;
}

.more-user-name {
    font-size: 1.2rem;
    font-weight: 500;
    color: var(--white);
    margin-bottom: 4px;
}

.more-user-score {
    font-size: 1rem;
    font-weight: 600;
    font-variant-numeric: tabular-nums;
}

/* 排名列表 */
.more-player-count {
    font-size: 11px;
    color: var(--text-tertiary);
    font-weight: 500;
}

.more-ranking-list {
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: 10px;
    overflow: hidden;
}

.more-rank-row {
    display: flex;
    align-items: center;
    padding: 12px 14px;
}

.more-rank-row:not(:last-child) {
    border-bottom: 1px solid var(--border-subtle);
}

.more-rank-row.more-rank-top {
    background: rgba(255, 255, 255, 0.02);
}

.more-rank-num {
    width: 24px;
    font-size: 12px;
    font-weight: 600;
    color: var(--text-tertiary);
    text-align: center;
    margin-right: 10px;
}

.more-rank-top .more-rank-num {
    color: var(--white);
}

.more-rank-avatar {
    width: 32px;
    height: 32px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    font-weight: 600;
    color: var(--black);
    margin-right: 10px;
    flex-shrink: 0;
    overflow: hidden;
}

.more-rank-avatar > span {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 100%;
}

.more-rank-avatar-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.more-rank-name {
    flex: 1;
    font-size: 1rem;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: 6px;
}

.more-rank-score {
    font-size: 1.2rem;
    font-weight: 600;
    font-family: 'SF Mono', 'SF Pro Text', 'Menlo', monospace;
    font-variant-numeric: tabular-nums;
}

.more-rank-right {
    display: flex;
    align-items: center;
    gap: 10px;
}

.more-add-friend-btn {
    padding: 4px 12px;
    font-size: 0.8rem;
    font-weight: 600;
    color: #000;
    background: #e5c97b;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    white-space: nowrap;
    transition: all 0.15s ease;
}

.more-add-friend-btn:active {
    opacity: 0.8;
    transform: scale(0.95);
}

/* 功能按钮区域 */
.more-actions {
    margin-bottom: 12px;
}

.more-action-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
}

.more-action-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 16px 12px;
    background: linear-gradient(145deg, var(--bg-card), var(--bg-elevated));
    border: 1px solid var(--border);
    border-radius: 12px;
    color: var(--text-primary);
    font-size: 0.85rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.15s ease;
    box-shadow: var(--shadow-sm);
}

.more-action-btn:active:not(:disabled) {
    transform: scale(0.98);
    background: var(--gray-900);
}

.more-action-btn svg {
    opacity: 0.7;
}

.more-action-btn--disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

.more-action-btn--disabled svg {
    opacity: 0.3;
}

/* 结束房间 */
.more-end-section {
    margin-top: 8px;
}

/* 牌友号 */
.user-number {
    font-size: 11px;
    color: var(--text-tertiary);
    letter-spacing: 0.05em;
}

/* 主页导航 */
.home-nav-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 10px;
    margin-bottom: 20px;
}

.home-nav-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 14px 8px;
    background: linear-gradient(145deg, var(--bg-card), var(--bg-elevated));
    border: 1px solid var(--border);
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.15s ease;
    box-shadow: var(--shadow-sm);
}

.home-nav-item:active {
    transform: scale(0.97);
    background: var(--gray-900);
}

.home-nav-icon {
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.home-nav-icon svg {
    opacity: 0.8;
}

.home-nav-label {
    font-size: 0.85rem;
    font-weight: 500;
    color: var(--text-secondary);
}

/* ========== 战绩统计页 ========== */
.stats-content {
    padding: 0 0 40px;
}

.stats-winrate-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    background: linear-gradient(145deg, var(--bg-card), var(--bg-elevated));
    border: 1px solid var(--border);
    border-radius: 16px;
    padding: 24px;
    margin-bottom: 12px;
    box-shadow: var(--shadow-md);
}

.winrate-ring {
    position: relative;
    width: 120px;
    height: 120px;
    margin-bottom: 12px;
}

.winrate-ring svg {
    width: 100%;
    height: 100%;
}

.winrate-text {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    display: flex;
    align-items: baseline;
}

.winrate-number {
    font-size: 2rem;
    font-weight: 700;
    color: var(--white);
    font-family: 'SF Mono', 'SF Pro Text', 'Menlo', monospace;
}

.winrate-percent {
    font-size: 1rem;
    color: var(--text-secondary);
    margin-left: 2px;
}

.winrate-label {
    font-size: 0.85rem;
    color: var(--text-tertiary);
    font-weight: 500;
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 10px;
    margin-bottom: 12px;
}

.stats-grid-item {
    background: linear-gradient(145deg, var(--bg-card), var(--bg-elevated));
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 14px 8px;
    text-align: center;
    box-shadow: var(--shadow-sm);
}

.stats-grid-value {
    display: block;
    font-size: 1.5rem;
    font-weight: 700;
    font-family: 'SF Mono', 'SF Pro Text', 'Menlo', monospace;
    margin-bottom: 4px;
}

.stats-grid-label {
    font-size: 0.8rem;
    color: var(--text-tertiary);
}

.stats-card {
    background: linear-gradient(145deg, var(--bg-card), var(--bg-elevated));
    border: 1px solid var(--border);
    border-radius: 14px;
    padding: 16px;
    margin-bottom: 12px;
    box-shadow: var(--shadow-md);
}

.stats-card-header {
    font-size: 0.8rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--text-tertiary);
    margin-bottom: 12px;
}

.stats-profit {
    font-size: 1.8rem;
    font-weight: 700;
    font-family: 'SF Mono', 'SF Pro Text', 'Menlo', monospace;
    text-align: center;
}

.stats-streak-row {
    display: flex;
    justify-content: space-around;
}

.stats-streak-item {
    text-align: center;
}

.stats-streak-value {
    display: block;
    font-size: 1.5rem;
    font-weight: 700;
    font-family: 'SF Mono', 'SF Pro Text', 'Menlo', monospace;
    margin-bottom: 4px;
}

.stats-streak-label {
    font-size: 0.8rem;
    color: var(--text-tertiary);
}

.stats-record {
    font-size: 1.1rem;
    color: var(--text-secondary);
    text-align: center;
}

.stats-record .positive,
.stats-record .negative {
    font-size: 1.5rem;
    font-weight: 700;
    font-family: 'SF Mono', 'SF Pro Text', 'Menlo', monospace;
}

/* ========== 成就徽章页 ========== */
.achievements-content {
    padding: 0 0 40px;
}

.achievements-summary {
    text-align: center;
    font-size: 1rem;
    color: var(--text-secondary);
    margin-bottom: 16px;
}

.achievements-summary strong {
    color: var(--white);
}

.achievements-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
}

.achievement-item {
    background: linear-gradient(145deg, var(--bg-card), var(--bg-elevated));
    border: 1px solid var(--border);
    border-radius: 14px;
    padding: 16px;
    text-align: center;
    box-shadow: var(--shadow-sm);
    opacity: 0.5;
    filter: grayscale(0.6);
    transition: all 0.2s ease;
}

.achievement-item--unlocked {
    opacity: 1;
    filter: none;
    border-color: rgba(255, 255, 255, 0.1);
}

.achievement-icon {
    width: 40px;
    height: 40px;
    margin: 0 auto 8px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.achievement-icon svg {
    opacity: 0.7;
}

.achievement-item--unlocked .achievement-icon svg {
    opacity: 1;
    color: #e5c97b;
}

.achievement-name {
    font-size: 1rem;
    font-weight: 600;
    color: var(--white);
    margin-bottom: 4px;
}

.achievement-desc {
    font-size: 0.8rem;
    color: var(--text-tertiary);
    line-height: 1.4;
}

.achievement-date {
    font-size: 0.75rem;
    color: var(--text-tertiary);
    margin-top: 6px;
}

/* ========== 好友页 ========== */
.friends-section {
    margin-bottom: 20px;
}

.friends-section-title {
    font-size: 0.8rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--text-tertiary);
    margin-bottom: 10px;
    padding: 0 4px;
}

.friends-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.friend-item {
    display: flex;
    align-items: center;
    padding: 12px 14px;
    background: linear-gradient(145deg, var(--bg-card), var(--bg-elevated));
    border: 1px solid var(--border);
    border-radius: 12px;
    box-shadow: var(--shadow-sm);
}

.friend-avatar {
    width: 40px;
    height: 40px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
    font-weight: 600;
    color: var(--black);
    flex-shrink: 0;
    overflow: hidden;
    margin-right: 12px;
}

.friend-avatar > span {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 100%;
}

.friend-avatar-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.friend-info {
    flex: 1;
}

.friend-name {
    font-size: 1rem;
    font-weight: 500;
    color: var(--text-primary);
}

.friend-number {
    font-size: 0.8rem;
    color: var(--text-tertiary);
    letter-spacing: 0.05em;
}

.friend-actions {
    display: flex;
    gap: 6px;
}

.friends-empty {
    text-align: center;
    padding: 40px 20px;
}

.friends-empty-icon {
    font-size: 40px;
    margin-bottom: 12px;
}

.friends-empty-text {
    font-size: 1rem;
    color: var(--text-tertiary);
    margin-bottom: 16px;
}

/* 好友搜索 */
.friend-search-results {
    max-height: 300px;
    overflow-y: auto;
    margin-top: 12px;
}

.search-result-item {
    display: flex;
    align-items: center;
    padding: 10px 0;
}

.search-result-item .friend-avatar {
    margin-right: 10px;
}

.search-result-item .friend-name {
    flex: 1;
}

.search-empty {
    text-align: center;
    padding: 20px;
    color: var(--text-tertiary);
    font-size: 0.95rem;
}

/* 邀请好友 */
.invite-friend-list {
    max-height: 350px;
    overflow-y: auto;
}

.invite-friend-item {
    display: flex;
    align-items: center;
    padding: 10px 0;
}

.invite-friend-item .friend-avatar {
    margin-right: 10px;
}

.invite-friend-item .friend-info {
    flex: 1;
}

/* 邀请通知 */
.invitation-notify-content {
    padding: 8px 0;
}
