/* 锋哥麻将计分 - 样式表 */

* { margin: 0; padding: 0; box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

:root {
    --primary: #07C160;
    --primary-dark: #06AD56;
    --danger: #E64340;
    --bg: #F5F6F7;
    --card: #FFFFFF;
    --text: #1A1A1A;
    --text-2: #666666;
    --text-3: #999999;
    --line: #E5E5E5;
    --win: #E64340;
    --loss: #07C160;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'PingFang SC', 'Hiragino Sans GB', 'Microsoft YaHei', sans-serif;
    background: var(--bg);
    color: var(--text);
    line-height: 1.5;
    overflow-x: hidden;
    -webkit-font-smoothing: antialiased;
}

/* ============ 页面 ============ */
.page { display: none; min-height: 100vh; padding-bottom: 70px; }
.page.active { display: block; animation: fadeIn .2s ease; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

/* ============ 通用组件 ============ */
.btn {
    display: inline-block; width: 100%; padding: 13px 16px; border: none; border-radius: 10px;
    font-size: 16px; font-weight: 500; cursor: pointer; transition: opacity .15s;
    font-family: inherit;
}
.btn:active { opacity: .75; }
.btn-primary { background: var(--primary); color: #fff; }
.btn-secondary { background: #fff; color: var(--text); border: 1px solid var(--line); }
.btn-success { background: var(--primary); color: #fff; }
.btn-block { display: block; width: 100%; }
.btn-big { padding: 16px; font-size: 17px; font-weight: 600; }
.btn-half { flex: 1; }
.btn-copy {
    padding: 4px 12px; font-size: 13px; border: 1px solid var(--primary);
    color: var(--primary); background: #fff; border-radius: 6px; cursor: pointer;
}
.btn-mini {
    padding: 3px 8px; font-size: 12px; border: 1px solid var(--line);
    background: #fff; border-radius: 6px; color: var(--text-2); cursor: pointer; margin-left: 6px;
}
.btn-mini-danger { color: var(--danger); border-color: #f5c6c5; }

.form-group { margin-bottom: 18px; }
.form-group label { display: block; font-size: 14px; color: var(--text-2); margin-bottom: 8px; }
.form-group input {
    width: 100%; padding: 13px 14px; border: 1px solid var(--line); border-radius: 10px;
    font-size: 16px; background: #fff; font-family: inherit; color: var(--text);
}
.form-group input:focus { outline: none; border-color: var(--primary); }

/* 头像选择 */
.avatar-options { display: flex; flex-wrap: wrap; gap: 10px; }
.avatar-option {
    width: 46px; height: 46px; border-radius: 50%; background: #F2F3F5;
    display: flex; align-items: center; justify-content: center; font-size: 24px;
    cursor: pointer; border: 2px solid transparent;
}
.avatar-option.selected { border-color: var(--primary); background: #E8F8EF; }

.avatar-mini { font-size: 18px; line-height: 1; }

/* 分数颜色：赢红、输绿、零灰 */
.score-win { color: var(--win); }
.score-loss { color: var(--loss); }
.score-zero { color: var(--text-3); }

/* 顶部栏 */
.header {
    display: flex; align-items: center; gap: 10px; height: 50px; padding: 0 14px;
    background: #fff; border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 10;
}
.header-title { flex: 1; font-size: 17px; font-weight: 600; text-align: center; }
.btn-back {
    width: 34px; height: 34px; border: none; background: transparent; font-size: 22px;
    color: var(--text); cursor: pointer; line-height: 1;
}
.btn-head-right {
    border: none; background: transparent; color: var(--primary); font-size: 15px; cursor: pointer;
}

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

/* 底部导航 */
.bottom-nav {
    position: fixed; left: 0; right: 0; bottom: 0; height: 56px; background: #fff;
    border-top: 1px solid var(--line); display: flex; z-index: 50;
}
.nav-item {
    flex: 1; border: none; background: transparent; display: flex; flex-direction: column;
    align-items: center; justify-content: center; gap: 2px; cursor: pointer; color: var(--text-3);
}
.nav-item.active { color: var(--primary); }
.nav-icon { font-size: 20px; line-height: 1; }
.nav-text { font-size: 11px; }

/* Toast */
.toast {
    position: fixed; left: 50%; bottom: 90px; transform: translateX(-50%) translateY(20px);
    background: rgba(0,0,0,.8); color: #fff; padding: 10px 18px; border-radius: 20px;
    font-size: 14px; opacity: 0; pointer-events: none; transition: all .25s; z-index: 999;
    max-width: 80vw; text-align: center;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
.toast.success { background: rgba(7,193,96,.95); }
.toast.warning { background: rgba(250,173,20,.95); }
.toast.error { background: rgba(230,67,64,.95); }

/* 弹窗 */
.modal {
    position: fixed; inset: 0; background: rgba(0,0,0,.45); z-index: 200;
    display: flex; align-items: center; justify-content: center; padding: 20px;
}
.modal-content {
    background: #fff; border-radius: 14px; padding: 22px 18px; width: 100%; max-width: 380px;
    max-height: 88vh; overflow-y: auto;
}
.modal-content h3 { font-size: 17px; text-align: center; margin-bottom: 16px; }
.modal-sub { font-size: 13px; color: var(--text-3); text-align: center; margin: -8px 0 16px; }
.modal-actions { display: flex; gap: 12px; margin-top: 20px; }
.modal-actions .btn { flex: 1; }

/* 动作面板（加人） */
.action-sheet { padding: 8px; }
.sheet-item {
    display: block; width: 100%; padding: 16px; border: none; background: #fff;
    font-size: 16px; color: var(--text); cursor: pointer; border-bottom: 1px solid var(--line);
    font-family: inherit;
}
.sheet-item:last-child { border-bottom: none; }
.sheet-cancel { color: var(--text-3); margin-top: 6px; border-top: 6px solid var(--bg); }

/* ============ 登录页 ============ */
.login-container { padding: 60px 26px 40px; }
.logo { text-align: center; margin-bottom: 36px; }
.logo-icon { font-size: 60px; display: block; margin-bottom: 10px; }
.logo h1 { font-size: 24px; font-weight: 700; }
.logo-sub { font-size: 13px; color: var(--text-3); margin-top: 8px; }
.login-form { background: #fff; border-radius: 14px; padding: 22px 18px; }
.login-form .btn { margin-top: 6px; }

/* ============ 首页 ============ */
.home-header {
    display: flex; align-items: center; justify-content: space-between;
    padding: 18px 16px; background: #fff;
}
.user-info { display: flex; align-items: center; gap: 10px; }
.user-info .avatar {
    width: 44px; height: 44px; border-radius: 50%; background: #F2F3F5;
    display: flex; align-items: center; justify-content: center; font-size: 24px;
}
.user-info span { font-size: 17px; font-weight: 600; }
.history-link a { font-size: 14px; color: var(--text-2); text-decoration: none; }

.home-content { padding: 16px; }

.continue-card {
    background: #fff; border-radius: 14px; padding: 16px; margin-bottom: 16px;
    border-left: 4px solid var(--primary);
}
.continue-label { font-size: 12px; color: var(--primary); margin-bottom: 6px; }
.continue-code { font-size: 15px; color: var(--text-2); margin-bottom: 12px; }
.continue-code strong { font-size: 18px; color: var(--text); letter-spacing: 2px; }
.continue-players { margin-bottom: 14px; }
.continue-player {
    display: flex; align-items: center; gap: 6px; font-size: 14px; padding: 4px 0;
}
.continue-player b { margin-left: auto; font-weight: 600; }

.home-actions { display: flex; flex-direction: column; gap: 12px; }
.home-tip { margin-top: 22px; text-align: center; font-size: 13px; color: var(--text-3); line-height: 1.7; }

/* ============ 台板（房间）页 ============ */
.players-strip-wrap { background: #fff; padding: 14px 0 10px; border-bottom: 1px solid var(--line); }
.players-strip {
    display: flex; gap: 16px; overflow-x: auto; padding: 0 14px 6px; -webkit-overflow-scrolling: touch;
}
.players-strip::-webkit-scrollbar { display: none; }
.strip-player { flex: 0 0 auto; text-align: center; min-width: 54px; }
.strip-avatar {
    width: 46px; height: 46px; border-radius: 50%; background: #F2F3F5; margin: 0 auto 4px;
    display: flex; align-items: center; justify-content: center; font-size: 24px;
}
.strip-player.me .strip-avatar { border: 2px solid var(--primary); }
.strip-name {
    font-size: 12px; color: var(--text-2); max-width: 58px; overflow: hidden;
    text-overflow: ellipsis; white-space: nowrap;
}
.strip-score { font-size: 15px; font-weight: 600; }
.players-strip-actions {
    display: flex; align-items: center; justify-content: space-between; padding: 8px 14px 0;
}
.btn-add-player {
    padding: 6px 14px; border: 1px dashed var(--primary); background: #fff; color: var(--primary);
    border-radius: 8px; font-size: 14px; cursor: pointer;
}
.limit-tip { font-size: 12px; color: var(--text-3); }

/* 二维码区 */
.qr-panel { background: #fff; padding: 18px; text-align: center; border-bottom: 1px solid var(--line); }
.qr-box { display: inline-block; padding: 10px; background: #fff; }
.qr-box img, .qr-box canvas { display: block; }
.qr-tip { font-size: 13px; color: var(--text-2); margin-top: 10px; }
.room-code-row {
    display: flex; align-items: center; justify-content: center; gap: 10px;
    margin-top: 12px; font-size: 14px; color: var(--text-2);
}
.room-code-row strong { font-size: 18px; letter-spacing: 2px; color: var(--text); }
.qr-fallback { font-size: 14px; color: var(--text-2); padding: 30px 10px; }

/* 台板 */
.board-panel { background: #fff; margin-top: 10px; }
.board-head {
    display: flex; align-items: center; gap: 10px; padding: 12px 14px;
    border-bottom: 1px solid var(--line); flex-wrap: wrap;
}
.board-title { font-size: 15px; font-weight: 600; }
.board-multiplier { font-size: 13px; color: var(--text-2); margin-left: auto; }
.board-multiplier strong { color: var(--primary); font-size: 15px; }
.board-table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.board-table { border-collapse: collapse; width: 100%; font-size: 14px; }
.board-table th, .board-table td {
    padding: 10px 8px; text-align: center; white-space: nowrap; border-bottom: 1px solid #F2F3F5;
}
.board-table th { font-size: 12px; color: var(--text-3); font-weight: 500; background: #FAFAFA; }
.board-table .th-round, .board-table .td-round {
    position: sticky; left: 0; background: #fff; text-align: left; padding-left: 14px; z-index: 1;
}
.board-table th.th-round { background: #FAFAFA; }
.td-round { font-size: 13px; color: var(--text-2); }
.td-time { display: block; font-size: 11px; color: var(--text-3); }
.td-empty { color: var(--text-3); }
.board-empty { padding: 40px 20px; text-align: center; color: var(--text-3); font-size: 14px; }

.room-bottom-bar {
    position: fixed; left: 0; right: 0; bottom: 0; display: flex; gap: 12px;
    padding: 10px 14px; background: #fff; border-top: 1px solid var(--line); z-index: 50;
}

/* ============ 计分弹窗 ============ */
.score-modal { max-width: 420px; }
.score-head, .score-row {
    display: flex; align-items: center; gap: 8px; padding: 8px 0;
}
.score-head { font-size: 12px; color: var(--text-3); border-bottom: 1px solid var(--line); }
.score-row { border-bottom: 1px solid #F7F7F7; }
.col-name { flex: 1; display: flex; align-items: center; gap: 6px; font-size: 15px; min-width: 0; }
.col-name .avatar-mini { flex: 0 0 auto; }
.col-result { display: flex; gap: 4px; flex: 0 0 auto; }
.col-score { flex: 0 0 74px; }
.score-input {
    width: 100%; padding: 9px 8px; border: 1px solid var(--line); border-radius: 8px;
    font-size: 16px; text-align: center; font-family: inherit;
}
.score-input:focus { outline: none; border-color: var(--primary); }
.win-btn {
    padding: 7px 12px; border: 1px solid var(--line); background: #fff; border-radius: 8px;
    font-size: 14px; color: var(--text-2); cursor: pointer; font-family: inherit;
}
.win-btn.active { background: var(--danger); border-color: var(--danger); color: #fff; }
.win-btn[data-win="0"].active { background: var(--primary); border-color: var(--primary); }
.score-multiplier-row {
    display: flex; align-items: center; justify-content: space-between;
    margin-top: 14px; font-size: 14px; color: var(--text-2);
}
.score-multiplier-row input {
    width: 90px; padding: 9px; border: 1px solid var(--line); border-radius: 8px;
    font-size: 16px; text-align: center; font-family: inherit;
}

/* 开桌人数选择 */
.limit-options { display: flex; flex-wrap: wrap; gap: 10px; justify-content: center; }
.limit-option {
    padding: 10px 16px; border: 1px solid var(--line); background: #fff; border-radius: 10px;
    font-size: 15px; color: var(--text-2); cursor: pointer; font-family: inherit;
}
.limit-option.selected { border-color: var(--primary); background: #E8F8EF; color: var(--primary); font-weight: 600; }

/* ============ 排行榜 ============ */
.lb-tabs { display: flex; background: #fff; border-bottom: 1px solid var(--line); }
.lb-tab, .rec-tab {
    flex: 1; padding: 13px 0; border: none; background: transparent; font-size: 15px;
    color: var(--text-2); cursor: pointer; position: relative; font-family: inherit;
}
.lb-tab.active, .rec-tab.active { color: var(--primary); font-weight: 600; }
.lb-tab.active::after, .rec-tab.active::after {
    content: ''; position: absolute; left: 50%; bottom: 0; transform: translateX(-50%);
    width: 40px; height: 3px; background: var(--primary); border-radius: 2px;
}
.lb-list { padding: 12px 14px; }
.lb-row {
    display: flex; align-items: center; gap: 10px; background: #fff; border-radius: 12px;
    padding: 14px; margin-bottom: 10px;
}
.lb-row.top { border: 1px solid var(--primary); }
.lb-rank {
    width: 24px; height: 24px; border-radius: 50%; background: #F2F3F5; color: var(--text-2);
    display: flex; align-items: center; justify-content: center; font-size: 13px; font-weight: 600;
}
.lb-row.top .lb-rank { background: var(--primary); color: #fff; }
.lb-name { flex: 1; font-size: 16px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lb-multiplier { font-size: 13px; color: var(--text-3); }
.lb-score { font-size: 18px; font-weight: 700; min-width: 60px; text-align: right; }
.lb-footer { padding: 4px 14px 20px; }

/* ============ 记录页 ============ */
.rec-tabs { display: flex; background: #fff; border-bottom: 1px solid var(--line); }
.rec-filter { padding: 12px 14px; }
.rec-filter select {
    width: 100%; padding: 11px 12px; border: 1px solid var(--line); border-radius: 10px;
    font-size: 15px; background: #fff; font-family: inherit; color: var(--text);
}
.records-content { padding: 0 14px 20px; }
.record-item {
    position: relative; background: #fff; border-radius: 12px; padding: 14px; margin-bottom: 12px;
    cursor: pointer;
}
.record-delete {
    position: absolute; right: 10px; top: 10px; border: none; background: transparent;
    font-size: 16px; cursor: pointer; opacity: .45; padding: 4px;
}
.record-players { display: flex; flex-wrap: wrap; gap: 10px 18px; padding-right: 26px; }
.record-player { display: flex; align-items: center; gap: 5px; font-size: 14px; }
.record-name { color: var(--text-2); max-width: 60px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.record-score { font-weight: 600; }
.record-footer {
    display: flex; justify-content: space-between; margin-top: 12px;
    font-size: 12px; color: var(--text-3);
}
.record-status { color: var(--primary); }

/* ============ 我的 ============ */
.profile-content { padding: 16px; }
.profile-card { background: #fff; border-radius: 14px; padding: 26px; text-align: center; }
.avatar-large {
    width: 74px; height: 74px; border-radius: 50%; background: #F2F3F5; margin: 0 auto 12px;
    display: flex; align-items: center; justify-content: center; font-size: 40px;
}
.profile-card h3 { font-size: 19px; margin-bottom: 6px; }
.player-id { font-size: 13px; color: var(--text-3); }
.menu-section { background: #fff; border-radius: 14px; margin-top: 16px; overflow: hidden; }
.menu-item {
    display: flex; align-items: center; gap: 12px; padding: 16px; cursor: pointer;
    border-bottom: 1px solid var(--line);
}
.menu-item:last-child { border-bottom: none; }
.menu-icon { font-size: 18px; width: 22px; text-align: center; }
.menu-text { flex: 1; font-size: 16px; }
.menu-arrow { color: var(--text-3); font-size: 20px; }

/* ============ 邀请二维码弹窗 ============ */
.qrcode-modal { text-align: center; }
.qrcode-display { padding: 6px 0 4px; }
.qrcode-canvas { display: inline-block; padding: 12px; background: #fff; border: 1px solid var(--line); border-radius: 10px; }
.qrcode-canvas img, .qrcode-canvas canvas { display: block; }
.qrcode-hint { font-size: 14px; color: var(--text-2); margin-top: 14px; }
.room-code-hint { font-size: 14px; color: var(--text-2); margin-top: 8px; }
.room-code-hint strong { font-size: 17px; letter-spacing: 2px; color: var(--text); }

/* ============ 我的数据 ============ */
.stats-grid {
    display: grid; grid-template-columns: repeat(3, 1fr); background: #fff;
    margin: 0 0 12px;
}
.stat-cell { padding: 18px 6px; text-align: center; border-right: 1px solid #F2F3F5; border-bottom: 1px solid #F2F3F5; }
.stat-cell:nth-child(3n) { border-right: none; }
.stat-num { display: block; font-size: 20px; font-weight: 600; margin-bottom: 4px; }
.stat-num.win { color: var(--win); }
.stat-num.loss { color: var(--loss); }
.stat-label { font-size: 12px; color: var(--text-3); }
.luck-box { display: flex; gap: 12px; padding: 0 14px 20px; }
.luck-item {
    flex: 1; background: #fff; border-radius: 12px; padding: 18px; text-align: center;
    opacity: .45; border: 2px solid transparent;
}
.luck-item.active { opacity: 1; border-color: var(--primary); }
.luck-icon { display: block; font-size: 24px; margin-bottom: 6px; }
.luck-text { font-size: 14px; color: var(--text-2); }

/* ============ 头像（默认不重样 + 相册上传） ============ */
.avatar-mini, .strip-avatar, .avatar-large, .avatar-preview, .avatar-option {
    background-size: cover; background-position: center; overflow: hidden;
}
.avatar-mini img, .strip-avatar img, .avatar-large img,
.avatar-preview img, .avatar-option img {
    width: 100%; height: 100%; object-fit: cover; display: block; border-radius: inherit;
}
.avatar-mini { display: inline-flex; align-items: center; justify-content: center; width: 26px; height: 26px; border-radius: 50%; flex: 0 0 auto; }
.strip-avatar { font-size: 24px; }
.avatar-preview {
    width: 64px; height: 64px; border-radius: 50%; display: flex; align-items: center;
    justify-content: center; font-size: 32px; flex: 0 0 auto;
}
.avatar-edit-row { display: flex; align-items: center; gap: 14px; }
.avatar-edit-btns { display: flex; flex-direction: column; gap: 8px; flex: 1; }
.btn-small { padding: 9px 12px; font-size: 14px; }
.avatar-hint { font-size: 12px; color: var(--text-3); margin: 12px 0 8px; }
.avatar-options-many { max-height: 170px; overflow-y: auto; gap: 8px; }
.avatar-options-many .avatar-option { width: 40px; height: 40px; font-size: 21px; }
.avatar-option { background-size: cover; }

/* 登录页的头像说明 */
.login-avatar-tip {
    display: flex; align-items: center; gap: 10px; background: #F2F8F4;
    border-radius: 10px; padding: 12px 14px; margin-bottom: 18px;
    font-size: 13px; color: var(--text-2); line-height: 1.6;
}
.login-avatar-tip .tip-icon { font-size: 22px; }

/* ============ 进门 / 找回 / 成员管理 ============ */
.entry-tip { font-size: 14px; color: var(--text-2); text-align: center; margin-bottom: 16px; line-height: 1.7; }
.recover-status { font-size: 14px; color: var(--text-2); text-align: center; padding: 10px; background: #F7F8FA; border-radius: 8px; line-height: 1.6; }
.pending-box { margin: 14px; background: #FFF8E6; border: 1px solid #FFE1A8; border-radius: 12px; padding: 14px; }
.pending-title { font-size: 14px; font-weight: 600; color: #8a6d00; margin-bottom: 10px; }
.pending-item { display: flex; align-items: center; gap: 10px; padding: 8px 0; border-top: 1px solid #FFEFC7; }
.pending-item:first-child { border-top: none; }
.pending-name { flex: 1; font-size: 15px; }
.pending-time { font-size: 12px; color: var(--text-3); }
.pending-actions { display: flex; gap: 8px; }
.btn-tiny { padding: 6px 12px; font-size: 13px; border-radius: 8px; border: none; cursor: pointer; font-family: inherit; }
.btn-approve { background: var(--primary); color: #fff; }
.btn-reject { background: #fff; color: var(--text-2); border: 1px solid var(--line); }
.members-section { padding: 14px; }
.members-title { font-size: 14px; color: var(--text-2); margin-bottom: 10px; }
.members-list { background: #fff; border-radius: 12px; overflow: hidden; }
.member-row { display: flex; align-items: center; gap: 10px; padding: 12px 14px; border-bottom: 1px solid #F2F3F5; }
.member-row:last-child { border-bottom: none; }
.member-name { flex: 1; font-size: 15px; }
.member-sub { font-size: 12px; color: var(--text-3); margin-top: 2px; }
.member-kick { border: none; background: transparent; color: var(--danger); font-size: 13px; cursor: pointer; padding: 6px; }
.members-note { font-size: 12px; color: var(--text-3); text-align: center; padding: 0 20px 20px; line-height: 1.7; }
