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

:root {
    --bg: #fafaf7;
    --board-bg: #ffffff;
    --line: #e0e0e0;
    --line-bold: #2c3e50;
    --text: #333333;
    --text-sub: #888888;
    --text-hint: #aaaaaa;
    --primary: #2d7a4f;
    --primary-light: #e5f0e9;
    --primary-dark: #1f5a38;
    --accent: #e8843c;
    --accent-light: #fdf0e3;
    --highlight: #f0f7f2;
    --same-num: #d8e8de;
    --selected: #c5ddd0;
    --error: #d2691e;
    --error-bg: #fff5e8;
    --success: #2d7a4f;
    --btn-bg: #ffffff;
    --btn-border: #e8e8e8;
    --btn-active: #f0f7f2;
    --shadow: 0 2px 12px rgba(0,0,0,0.06);
    --shadow-md: 0 4px 16px rgba(0,0,0,0.08);
    --radius: 8px;
    --radius-lg: 12px;
    --font-scale: 1;
    --num-completed: #c0c0c0;
}

[data-theme="eye"] {
    --bg: #f2f5e9;
    --board-bg: #fafdf2;
    --line: #c8d4b8;
    --line-bold: #5a6b47;
    --text: #3a4a2a;
    --text-sub: #6b7a58;
    --text-hint: #8a9a78;
    --primary: #6b8e23;
    --primary-light: #e8f0d8;
    --primary-dark: #5a7a1a;
    --highlight: #edf5df;
    --same-num: #d8e8bc;
    --selected: #c5d8a0;
    --error: #c07020;
    --error-bg: #fff5e8;
    --btn-bg: #fafdf2;
    --btn-border: #c8d4b8;
    --btn-active: #edf5df;
    --shadow: 0 2px 12px rgba(90,107,71,0.08);
    --shadow-md: 0 4px 16px rgba(90,107,71,0.1);
    --num-completed: #b8c8a8;
}

[data-theme="dark"] {
    --bg: #1a1a2e;
    --board-bg: #16213e;
    --line: #2a2a4a;
    --line-bold: #5a5a8a;
    --text: #e0e0e0;
    --text-sub: #8888aa;
    --text-hint: #6666aa;
    --primary: #6a93ff;
    --primary-light: #1a2a5a;
    --primary-dark: #5a83ee;
    --highlight: #1e2548;
    --same-num: #2a3a66;
    --selected: #3a4a88;
    --error: #f39c12;
    --error-bg: #2a2008;
    --btn-bg: #1e2a4a;
    --btn-border: #2a2a4a;
    --btn-active: #1e2548;
    --shadow: 0 2px 12px rgba(0,0,0,0.3);
    --shadow-md: 0 4px 16px rgba(0,0,0,0.4);
    --num-completed: #3a3a5a;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", sans-serif;
    background: var(--bg);
    color: var(--text);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 8px;
    transition: background 0.3s, color 0.3s;
}

.app-container {
    width: 100%;
    max-width: 520px;
    display: flex;
    flex-direction: column;
    align-items: center;
}

/* 顶部栏 */
.top-bar {
    width: 100%;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 4px 0 8px;
}
.top-title {
    font-size: calc(20px * var(--font-scale));
    font-weight: 600;
    color: var(--text);
}
.top-actions {
    display: flex;
    gap: 8px;
    align-items: center;
}
.icon-btn {
    background: var(--btn-bg);
    border: 1px solid var(--btn-border);
    border-radius: var(--radius);
    padding: 8px;
    color: var(--text);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: var(--shadow);
    transition: background 0.15s;
}
.icon-btn:active { background: var(--btn-active); }
.icon-btn.active {
    background: var(--primary-light);
    color: var(--primary);
    border-color: var(--primary);
}
.elder-mode-btn svg { transition: transform 0.3s; }
.elder-mode-btn.active svg { transform: rotate(45deg); }

/* 顶部导航快捷按钮 */
.home-nav-btn {
    margin-left: 4px;
}
.rank-nav-btn,
.rules-nav-btn {
    text-decoration: none;
    gap: 4px;
    padding: 6px 10px;
}
.nav-btn-text {
    font-size: calc(12px * var(--font-scale));
    font-weight: 500;
}

/* 顶部登录注册按钮 */
.top-auth-btns {
    display: flex;
    align-items: center;
    gap: 6px;
}
.top-btn {
    padding: 6px 14px;
    border: none;
    border-radius: 20px;
    font-size: calc(13px * var(--font-scale));
    font-weight: 600;
    cursor: pointer;
    transition: all 0.15s;
}
.top-btn-login {
    background: transparent;
    color: var(--text-sub);
    border: 1px solid var(--btn-border);
}
.top-btn-login:hover {
    color: var(--primary);
    border-color: var(--primary);
}
.top-btn-register {
    background: var(--primary);
    color: white;
}
.top-btn-register:hover {
    opacity: 0.9;
}

/* 顶部用户信息 */
.top-user {
    position: relative;
}
.top-user-info {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 4px 8px 4px 4px;
    background: var(--btn-bg);
    border: 1px solid var(--btn-border);
    border-radius: 24px;
    cursor: pointer;
    transition: all 0.15s;
}
.top-user-info:hover {
    border-color: var(--primary);
}
.top-user-avatar {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: var(--primary);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 13px;
    font-weight: 600;
}
.top-user-name {
    font-size: calc(13px * var(--font-scale));
    font-weight: 600;
    color: var(--text);
    max-width: 80px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.top-user-arrow {
    color: var(--text-hint);
    transition: transform 0.2s;
}
.top-user:hover .top-user-arrow {
    transform: rotate(180deg);
}

/* 用户下拉菜单 */
.top-user-dropdown {
    position: absolute;
    top: calc(100% + 6px);
    right: 0;
    width: 200px;
    background: var(--board-bg);
    border: 1px solid var(--btn-border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow);
    padding: 14px;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-4px);
    transition: all 0.2s;
    z-index: 200;
}
.top-user:hover .top-user-dropdown {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}
.top-user-dropdown-title {
    font-size: calc(14px * var(--font-scale));
    font-weight: 700;
    color: var(--text);
    margin-bottom: 4px;
}
.top-user-dropdown-desc {
    font-size: calc(11px * var(--font-scale));
    color: var(--text-sub);
    margin-bottom: 10px;
    line-height: 1.4;
}
.top-user-dropdown-points {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 8px 10px;
    background: var(--primary-light);
    border-radius: var(--radius);
    margin-bottom: 10px;
}
.top-user-points-icon {
    font-size: 16px;
}
.top-user-dropdown-points span:nth-child(2) {
    font-size: calc(16px * var(--font-scale));
    font-weight: 700;
    color: var(--primary);
}
.top-user-points-label {
    font-size: calc(11px * var(--font-scale));
    color: var(--text-sub);
    margin-left: auto;
}
.top-user-dropdown-actions {
    display: flex;
    gap: 6px;
}
.top-dropdown-btn {
    flex: 1;
    padding: 8px;
    border: 1px solid var(--btn-border);
    background: var(--btn-bg);
    color: var(--text);
    border-radius: var(--radius);
    font-size: calc(12px * var(--font-scale));
    font-weight: 500;
    cursor: pointer;
    transition: all 0.15s;
}
.top-dropdown-btn:hover {
    border-color: var(--primary);
    color: var(--primary);
}

/* 用户信息卡片 */
.user-card {
    width: 100%;
    margin-bottom: 10px;
}
.user-card-stats {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 6px;
}
.user-stat-item {
    text-align: center;
    padding: 10px 4px;
    background: var(--btn-bg);
    border: 1px solid var(--btn-border);
    border-radius: var(--radius);
    cursor: pointer;
    transition: all 0.15s;
}
.user-stat-item:hover {
    border-color: var(--primary);
    transform: translateY(-2px);
    box-shadow: var(--shadow-sm);
}
.user-stat-icon {
    font-size: 20px;
    margin-bottom: 2px;
}
.user-stat-num {
    font-size: calc(17px * var(--font-scale));
    font-weight: 700;
    color: var(--text);
    font-variant-numeric: tabular-nums;
    line-height: 1.2;
}
.user-stat-total {
    font-size: calc(10px * var(--font-scale));
    font-weight: 400;
    color: var(--text-hint);
}
.user-stat-label {
    font-size: calc(11px * var(--font-scale));
    color: var(--text-sub);
    margin-top: 2px;
}

/* 难度选择栏 */
.difficulty-bar {
    width: 100%;
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    margin-bottom: 10px;
    padding: 4px 0;
    justify-content: center;
}
.diff-btn {
    padding: 7px 13px;
    border-radius: 18px;
    border: 1px solid var(--btn-border);
    background: var(--btn-bg);
    color: var(--text-sub);
    font-size: calc(15px * var(--font-scale));
    cursor: pointer;
    transition: all 0.15s;
    white-space: nowrap;
    font-weight: 500;
    flex: 0 1 auto;
    min-width: 0;
}
.diff-btn:hover { color: var(--text); }
.diff-btn.active {
    background: var(--primary);
    color: #fff;
    border-color: var(--primary);
}

/* 状态栏 */
.status-bar {
    width: 100%;
    display: flex;
    justify-content: space-around;
    font-size: calc(15px * var(--font-scale));
    color: var(--text-sub);
    margin-bottom: 10px;
    background: var(--btn-bg);
    border-radius: var(--radius);
    padding: 10px 6px;
    box-shadow: var(--shadow);
}
.status-group {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 3px;
}
.status-label { font-size: calc(13px * var(--font-scale)); color: var(--text-hint); }
.status-value { font-size: calc(20px * var(--font-scale)); font-weight: 700; color: var(--text); }
.error-text { color: var(--error); }
.timer-value { font-variant-numeric: tabular-nums; }
.timer-group .status-value { color: var(--primary); }

/* 主游戏区：桌面版左右布局 */
.game-main {
    width: 100%;
    display: flex;
    gap: 24px;
    align-items: flex-start;
    justify-content: center;
}
.game-left {
    flex-shrink: 0;
}
.game-right {
    width: 280px;
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

/* 状态栏 - 右侧版 */
.game-right .status-bar {
    margin-bottom: 0;
    flex-wrap: wrap;
    gap: 6px;
    padding: 10px 8px;
}
.game-right .status-group {
    flex: 1 1 40%;
    min-width: 45%;
}

/* 功能按钮栏 - 右侧版（桌面5个按钮横向） */
.game-right .func-bar {
    grid-template-columns: repeat(5, 1fr);
    margin-bottom: 0;
    gap: 4px;
}
.game-right .func-btn {
    padding: 8px 2px;
    font-size: calc(12px * var(--font-scale));
    gap: 3px;
}
.game-right .func-btn svg {
    width: 22px;
    height: 22px;
}

/* 数字键盘 - 3x3 网格 */
.numpad-grid {
    display: grid !important;
    grid-template-columns: repeat(3, 1fr) !important;
    grid-template-rows: repeat(3, 1fr) !important;
    gap: 8px;
    width: 100%;
    margin-bottom: 0;
}
.numpad-grid .num-btn {
    flex-direction: column;
    min-height: 70px;
    font-size: calc(32px * var(--font-scale));
    border-radius: 12px;
    gap: 2px;
    aspect-ratio: 1;
    padding: 0;
}
.numpad-grid .num-btn .num-count {
    font-size: calc(13px * var(--font-scale));
}

/* 大新游戏按钮 */
/* 候选数+新游戏 并排布局 */
.action-row {
    display: flex;
    gap: 10px;
    width: 100%;
    margin-bottom: 10px;
}
.action-row .candidate-btn {
    flex: 1;
    margin-bottom: 0;
}
.action-row .big-newgame-btn {
    flex: 2;
}

/* 候选数按钮 */
.candidate-btn {
    padding: 12px 10px;
    background: var(--btn-bg);
    border: 2px solid var(--btn-border);
    border-radius: 10px;
    color: var(--text);
    font-size: calc(14px * var(--font-scale));
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    transition: all 0.2s ease;
    white-space: nowrap;
    line-height: 1.2;
}
.candidate-btn:hover {
    border-color: var(--primary);
    color: var(--primary);
}
.candidate-btn.active {
    background: var(--primary-light);
    border-color: var(--primary);
    color: var(--primary);
}
.candidate-btn .candidate-label {
    text-align: center;
    white-space: nowrap;
}
.candidate-btn .candidate-status {
    font-size: calc(11px * var(--font-scale));
    font-weight: 500;
    padding: 2px 6px;
    border-radius: 10px;
    background: var(--btn-bg);
    color: var(--text-sub);
    white-space: nowrap;
    flex-shrink: 0;
}
.candidate-btn.active .candidate-status {
    background: var(--primary);
    color: white;
}

.big-newgame-btn {
    padding: 16px 20px;
    background: linear-gradient(135deg, #2d7a4f 0%, #3d9a63 100%);
    border: none;
    border-radius: 12px;
    color: white;
    font-size: calc(18px * var(--font-scale));
    font-weight: 700;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    box-shadow: 0 4px 14px rgba(45, 122, 79, 0.35);
    transition: all 0.2s ease;
    white-space: nowrap;
}
.big-newgame-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(45, 122, 79, 0.45);
}
.big-newgame-btn:active {
    transform: translateY(0);
    background: linear-gradient(135deg, #1f5a38 0%, #2d7a4f 100%);
}

/* 数独棋盘 - 桌面版更大 */
.board-wrap {
    position: relative;
    background: var(--board-bg);
    border-radius: var(--radius-lg);
    padding: 8px;
    box-shadow: var(--shadow-md);
    margin-bottom: 0;
}
.board {
    display: grid;
    grid-template-columns: repeat(9, 1fr);
    grid-template-rows: repeat(9, 1fr);
    width: 560px;
    aspect-ratio: 1;
    border: 3px solid var(--line-bold);
    border-radius: 8px;
    overflow: hidden;
}
.cell {
    border-right: 1px solid var(--line);
    border-bottom: 1px solid var(--line);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: calc(36px * var(--font-scale));
    font-weight: 700;
    cursor: pointer;
    position: relative;
    user-select: none;
    transition: background 0.1s;
    aspect-ratio: 1;
    height: 100%;
}
.cell:nth-child(3n) { border-right: 2px solid var(--line-bold); }
.cell:nth-child(9n) { border-right: none; }
.cell.row-3, .cell.row-6 { border-bottom: 2px solid var(--line-bold); }
.cell.row-8 { border-bottom: none; }

.cell.highlight { background: var(--highlight); }
.cell.same-num { background: var(--same-num); font-weight: 600; }
.cell.selected { background: var(--selected); }
.cell.given { color: var(--text); font-weight: 600; }
.cell.user { color: var(--primary); }
.cell.error { color: var(--error); background: var(--error-bg); }
.cell.error.selected { background: var(--selected); }
.cell.num-highlight { background: var(--same-num); }

.cell .notes {
    position: absolute;
    inset: 3px;
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    grid-template-rows: repeat(3, 1fr);
    font-size: calc(12px * var(--font-scale));
    color: var(--text-sub);
    line-height: 1;
}
.cell .notes span {
    display: flex;
    align-items: center;
    justify-content: center;
}
.cell .notes span.note-highlight { color: var(--primary); font-weight: 600; }

/* 暂停遮罩 */
.pause-overlay {
    display: none;
    position: absolute;
    inset: 0;
    background: rgba(255,255,255,0.92);
    backdrop-filter: blur(8px);
    border-radius: var(--radius-lg);
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 16px;
    z-index: 5;
}
[data-theme="dark"] .pause-overlay { background: rgba(22,33,62,0.92); }
.pause-overlay.show { display: flex; }
.pause-icon { color: var(--primary); }
.pause-text { font-size: 18px; font-weight: 600; color: var(--text); }
.resume-btn { width: auto; padding: 10px 32px; }

/* 数字键盘 */
.numpad {
    width: 100%;
    max-width: 480px;
    display: grid;
    grid-template-columns: repeat(9, 1fr);
    gap: 6px;
    margin-bottom: 10px;
}
.num-btn {
    aspect-ratio: 1;
    background: var(--primary-light);
    border: 1px solid rgba(45, 122, 79, 0.2);
    border-radius: 12px;
    font-size: calc(28px * var(--font-scale));
    font-weight: 700;
    color: var(--primary);
    cursor: pointer;
    box-shadow: 0 2px 6px rgba(45, 122, 79, 0.08);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    position: relative;
    transition: all 0.12s ease;
}
.num-btn:hover {
    background: var(--primary);
    color: white;
    transform: translateY(-2px);
    box-shadow: 0 4px 10px rgba(45, 122, 79, 0.2);
}
.num-btn:active {
    transform: translateY(0);
    background: #1f5a38;
}
.num-btn.done {
    opacity: 0.3;
    pointer-events: none;
}
.num-btn .num-count {
    font-size: calc(11px * var(--font-scale));
    font-weight: 500;
    color: var(--text-hint);
    margin-top: -2px;
}
.num-btn:hover .num-count {
    color: rgba(255,255,255,0.7);
}
.num-btn.active {
    background: var(--primary);
    border-color: var(--primary);
    color: white;
    box-shadow: 0 4px 10px rgba(45, 122, 79, 0.25);
}
.num-btn.completed {
    color: var(--num-completed);
    pointer-events: none;
}
.num-btn .num-count {
    font-size: calc(12px * var(--font-scale));
    font-weight: 400;
    color: var(--text-hint);
    margin-top: -2px;
}
.num-btn.completed .num-count { color: var(--num-completed); }

/* 功能按钮栏 */
.func-bar {
    width: 100%;
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 6px;
    margin-bottom: 10px;
}
.func-btn {
    padding: 10px 3px;
    background: var(--btn-bg);
    border: 1px solid var(--btn-border);
    border-radius: var(--radius);
    font-size: calc(15px * var(--font-scale));
    color: var(--text-sub);
    cursor: pointer;
    box-shadow: var(--shadow);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    position: relative;
    transition: background 0.15s;
    font-weight: 500;
}
.func-btn svg {
    width: 24px;
    height: 24px;
}

/* 难度选择弹窗 */
.modal-diff-list {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    justify-content: center;
    margin: 12px 0;
}
.modal-diff-btn {
    padding: 10px 18px;
    border-radius: 20px;
    border: 1px solid var(--btn-border);
    background: var(--btn-bg);
    color: var(--text-sub);
    font-size: calc(16px * var(--font-scale));
    cursor: pointer;
    font-weight: 500;
    transition: all 0.15s;
}
.modal-diff-btn:hover {
    background: var(--primary);
    color: #fff;
    border-color: var(--primary);
}

/* 存档管理 */
.save-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 12px;
    border-radius: var(--radius);
    background: var(--btn-bg);
    border: 1px solid var(--btn-border);
    margin-bottom: 8px;
    gap: 8px;
}
.save-item-info {
    flex: 1;
    min-width: 0;
}
.save-item-diff {
    font-size: calc(15px * var(--font-scale));
    font-weight: 600;
    color: var(--text);
    margin-bottom: 3px;
}
.save-item-stats {
    display: flex;
    gap: 10px;
    font-size: calc(12px * var(--font-scale));
    color: var(--text-sub);
}
.save-item-date {
    font-size: calc(11px * var(--font-scale));
    color: var(--text-hint);
    margin-top: 2px;
}
.save-item-actions {
    display: flex;
    flex-direction: column;
    gap: 4px;
    flex-shrink: 0;
}
.save-item-btn {
    padding: 5px 14px;
    border-radius: 16px;
    border: 1px solid var(--btn-border);
    background: var(--btn-bg);
    color: var(--text);
    font-size: calc(12px * var(--font-scale));
    cursor: pointer;
    white-space: nowrap;
    transition: all 0.15s;
}
.save-item-btn.resume {
    background: var(--primary);
    color: #fff;
    border-color: var(--primary);
}
.save-item-btn.resume:hover {
    background: var(--primary-dark);
}
.save-item-btn.delete {
    color: var(--error);
    border-color: var(--error);
}
.save-item-btn.delete:hover {
    background: var(--error-bg);
}
.func-btn:active { background: var(--btn-active); }
.func-btn.active { background: var(--primary-light); border-color: var(--primary); color: var(--primary); }

/* 新游戏按钮 - 突出样式 */
.func-btn-newgame {
    background: linear-gradient(135deg, #2d7a4f 0%, #3d9a63 100%) !important;
    border-color: #2d7a4f !important;
    color: white !important;
    box-shadow: 0 4px 12px rgba(45, 122, 79, 0.3) !important;
    font-weight: 700 !important;
    border-radius: 12px !important;
    transition: all 0.2s ease !important;
}
.func-btn-newgame:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(45, 122, 79, 0.4) !important;
}
.func-btn-newgame:active {
    transform: translateY(0);
    background: linear-gradient(135deg, #1f5a38 0%, #2d7a4f 100%) !important;
}
.func-btn-newgame svg {
    width: 26px;
    height: 26px;
    filter: drop-shadow(0 1px 2px rgba(0,0,0,0.1));
}
.note-badge, .hint-badge {
    position: absolute;
    top: 2px;
    right: 4px;
    font-size: 12px;
    background: var(--primary);
    color: #fff;
    border-radius: 10px;
    padding: 1px 6px;
    line-height: 1.3;
    font-weight: 700;
}
.note-badge { display: none; }
.note-func-btn.active .note-badge { display: block; }
.hint-badge { background: var(--error); }

/* 底部导航栏 */
.bottom-bar {
    width: 100%;
    max-width: 600px;
    display: flex;
    justify-content: center;
    gap: 4px;
    padding: 8px 8px 4px;
    border-top: 1px solid var(--btn-border);
    background: var(--btn-bg);
    border-radius: var(--radius) var(--radius) 0 0;
    box-shadow: 0 -2px 12px rgba(0,0,0,0.04);
}
.bottom-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    font-size: calc(13px * var(--font-scale));
    color: var(--text-sub);
    cursor: pointer;
    padding: 6px 10px;
    border-radius: var(--radius);
    transition: color 0.15s;
    font-weight: 500;
    white-space: nowrap;
    flex: 1;
    min-width: 0;
}
.bottom-item svg {
    width: 26px;
    height: 26px;
}
.bottom-item:active { color: var(--primary); }
.bottom-link-item {
    text-decoration: none;
    color: var(--text-sub);
}

/* 社交传播工具栏 */
.social-bar {
    width: 100%;
    max-width: 600px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    padding: 10px 16px;
    background: var(--btn-bg);
    border-top: 1px solid var(--btn-border);
    border-radius: 0 0 var(--radius) var(--radius);
    box-shadow: 0 2px 8px rgba(0,0,0,0.04);
}
.social-bar-label {
    font-size: calc(12px * var(--font-scale));
    color: var(--text-sub);
    font-weight: 500;
    flex-shrink: 0;
}
.social-icons {
    display: flex;
    align-items: center;
    gap: 6px;
    flex: 1;
    justify-content: center;
    flex-wrap: wrap;
}
.social-icon {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
    padding: 6px 8px;
    border-radius: var(--radius);
    cursor: pointer;
    color: var(--text-sub);
    transition: all 0.15s;
    min-width: 44px;
}
.social-icon:hover {
    color: var(--primary);
    background: var(--primary-light);
}
.social-icon svg {
    width: 20px;
    height: 20px;
}
.social-icon span {
    font-size: calc(10px * var(--font-scale));
    font-weight: 500;
    white-space: nowrap;
}

/* 弹窗 */
.modal-mask {
    position: fixed; inset: 0;
    background: rgba(0,0,0,0.45);
    backdrop-filter: blur(2px);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 100;
    padding: 20px;
}
.modal-mask.show { display: flex; }
.modal {
    background: var(--board-bg);
    border-radius: var(--radius-lg);
    width: 100%;
    max-width: 400px;
    max-height: 85vh;
    overflow-y: auto;
    padding: 20px;
    box-shadow: 0 10px 40px rgba(0,0,0,0.2);
    animation: modalIn 0.2s ease-out;
}
@keyframes modalIn {
    from { opacity: 0; transform: scale(0.95) translateY(10px); }
    to { opacity: 1; transform: scale(1) translateY(0); }
}
.modal-title { font-size: calc(18px * var(--font-scale)); font-weight: 600; margin-bottom: 16px; color: var(--text); }
.modal-item {
    padding: 12px 4px;
    border-bottom: 1px solid var(--line);
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: calc(14px * var(--font-scale));
    color: var(--text);
}
.modal-item:last-child { border-bottom: none; }
.modal-divider {
    height: 1px;
    background: var(--line);
    margin: 8px 0;
}
.modal-item-value { color: var(--text-sub); font-size: calc(13px * var(--font-scale)); }
.modal-btn {
    width: 100%;
    padding: 12px;
    border-radius: var(--radius);
    border: none;
    background: var(--primary);
    color: white;
    font-size: calc(15px * var(--font-scale));
    font-weight: 500;
    cursor: pointer;
    margin-top: 8px;
    transition: background 0.15s;
}
.modal-btn:active { background: var(--primary-dark); }
.modal-btn.secondary { background: var(--btn-bg); color: var(--text); border: 1px solid var(--btn-border); }
.modal-tip { font-size: calc(13px * var(--font-scale)); color: var(--text-sub); margin: 8px 0; line-height: 1.5; }

/* 分段选择按钮 */
.seg-row { display: flex; gap: 4px; }
.seg-row button {
    flex: 1;
    padding: 7px 4px;
    border: 1px solid var(--btn-border);
    background: var(--btn-bg);
    border-radius: 6px;
    cursor: pointer;
    color: var(--text-sub);
    font-size: calc(12px * var(--font-scale));
    transition: all 0.15s;
}
.seg-row button.active { border-color: var(--primary); color: var(--primary); background: var(--primary-light); }

/* 开关按钮 */
.toggle-switch {
    width: 44px;
    height: 24px;
    background: #ccc;
    border-radius: 12px;
    position: relative;
    cursor: pointer;
    transition: background 0.2s;
}
.toggle-switch.active { background: var(--primary); }
.toggle-switch::after {
    content: '';
    position: absolute;
    width: 20px;
    height: 20px;
    background: white;
    border-radius: 50%;
    top: 2px;
    left: 2px;
    transition: left 0.2s;
}
.toggle-switch.active::after { left: 22px; }

/* 打印选项 */
.print-option { margin: 12px 0; }
.print-option label { display: block; margin-bottom: 6px; font-size: calc(14px * var(--font-scale)); color: var(--text); }
.point-info { text-align: center; padding: 8px; color: var(--text-sub); font-size: calc(13px * var(--font-scale)); }

/* 排行榜 */
.rank-tabs { display: flex; gap: 4px; margin-bottom: 12px; flex-wrap: wrap; }
.rank-tab {
    padding: 6px 12px;
    border-radius: 16px;
    font-size: calc(12px * var(--font-scale));
    background: var(--btn-bg);
    border: 1px solid var(--btn-border);
    cursor: pointer;
    color: var(--text-sub);
    transition: all 0.15s;
}
.rank-tab.active { background: var(--primary); color: white; border-color: var(--primary); }
.rank-list { font-size: calc(14px * var(--font-scale)); }
.rank-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 4px;
    border-bottom: 1px solid var(--line);
}
.rank-item.me { color: var(--primary); font-weight: 600; }
.rank-num { width: 28px; font-weight: 600; }
.rank-num.top-3 { color: var(--primary); }

/* 语言选择 */
.lang-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px; }
.lang-item {
    padding: 12px;
    border: 1px solid var(--btn-border);
    border-radius: var(--radius);
    text-align: center;
    cursor: pointer;
    background: var(--btn-bg);
    font-size: calc(14px * var(--font-scale));
    color: var(--text);
    transition: all 0.15s;
}
.lang-item.active { border-color: var(--primary); color: var(--primary); background: var(--primary-light); }

/* 每日挑战 */
.daily-info { text-align: center; margin-bottom: 16px; }
.daily-date { font-size: calc(16px * var(--font-scale)); font-weight: 600; margin-bottom: 8px; color: var(--text); }
.daily-streak { font-size: calc(14px * var(--font-scale)); color: var(--text-sub); margin-bottom: 12px; }
.daily-calendar {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 4px;
    max-width: 280px;
    margin: 0 auto;
}
.cal-day {
    aspect-ratio: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    font-size: 12px;
    color: var(--text-sub);
}
.cal-day.completed { background: var(--primary); color: white; }
.cal-day.today { border: 2px solid var(--primary); font-weight: 600; color: var(--primary); }

/* 统计 */
.stats-overview {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
    margin-bottom: 16px;
}
.stat-card {
    background: var(--highlight);
    border-radius: var(--radius);
    padding: 16px;
    text-align: center;
}
.stat-num { font-size: 24px; font-weight: 700; color: var(--primary); }
.stat-label { font-size: calc(12px * var(--font-scale)); color: var(--text-sub); margin-top: 4px; }
.stats-best { margin-top: 8px; }
.stats-best-title { font-size: calc(14px * var(--font-scale)); font-weight: 600; margin-bottom: 8px; color: var(--text); }
.best-item {
    display: flex;
    justify-content: space-between;
    padding: 8px 4px;
    border-bottom: 1px solid var(--line);
    font-size: calc(13px * var(--font-scale));
}
.best-item-diff { color: var(--text-sub); }
.best-item-time { color: var(--text); font-weight: 600; font-variant-numeric: tabular-nums; }

/* 老年模式强化 */
[data-mode="elder"] { --font-scale: 1.5; }
[data-mode="elder"] .func-btn { padding: 20px 6px; min-height: 80px; }
[data-mode="elder"] .num-btn { min-height: 64px; }
[data-mode="elder"] .diff-btn { padding: 14px 28px; }
[data-mode="elder"] .bottom-item { padding: 12px 22px; }
[data-mode="elder"] .modal-item { padding: 18px 4px; }
[data-mode="elder"] .modal-btn { padding: 18px; }
[data-mode="elder"] .cell { cursor: pointer; }
[data-mode="elder"] .top-title { font-size: calc(26px * var(--font-scale)); }
[data-mode="elder"] .func-btn svg { width: 30px; height: 30px; }
[data-mode="elder"] .bottom-item svg { width: 32px; height: 32px; }
[data-mode="elder"] .icon-btn { padding: 12px; }
[data-mode="elder"] .icon-btn svg { width: 24px; height: 24px; }

/* 表单样式 */
.form-group { margin-bottom: 14px; }
.form-group label { display: block; margin-bottom: 6px; font-size: calc(14px * var(--font-scale)); color: var(--text); font-weight: 500; }
.form-input {
    width: 100%;
    padding: 12px;
    border: 1px solid var(--btn-border);
    border-radius: var(--radius);
    font-size: calc(14px * var(--font-scale));
    background: var(--btn-bg);
    color: var(--text);
    outline: none;
    transition: border-color 0.15s;
    box-sizing: border-box;
}
.form-input:focus { border-color: var(--primary); }
.form-error { color: var(--error); font-size: calc(12px * var(--font-scale)); margin-bottom: 8px; min-height: 18px; }

/* 用户资料 */
.user-profile {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 0;
    margin-bottom: 12px;
    border-bottom: 1px solid var(--line);
}
.user-avatar {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background: var(--primary);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    font-weight: 600;
}
.user-info { flex: 1; }
.user-name { font-size: calc(16px * var(--font-scale)); font-weight: 600; color: var(--text); }
.user-email { font-size: calc(12px * var(--font-scale)); color: var(--text-sub); margin-top: 2px; }

/* 成就系统 */
.achievement-tabs { display: flex; gap: 4px; margin-bottom: 12px; }
.achievement-list { max-height: 400px; overflow-y: auto; }
.achievement-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 4px;
    border-bottom: 1px solid var(--line);
}
.achievement-item.locked { opacity: 0.5; }
.achievement-icon {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 22px;
    background: var(--primary-light);
    color: var(--primary);
    flex-shrink: 0;
}
.achievement-item.locked .achievement-icon { background: var(--line); color: var(--text-hint); }
.achievement-info { flex: 1; }
.achievement-name { font-size: calc(14px * var(--font-scale)); font-weight: 600; color: var(--text); }
.achievement-desc { font-size: calc(12px * var(--font-scale)); color: var(--text-sub); margin-top: 2px; }
.achievement-reward { font-size: calc(13px * var(--font-scale)); color: var(--primary); font-weight: 600; }

/* 签到 */
.checkin-calendar { margin-bottom: 16px; }
.checkin-week {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 6px;
    margin-bottom: 8px;
}
.checkin-day {
    aspect-ratio: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    border-radius: var(--radius);
    background: var(--btn-bg);
    border: 1px solid var(--btn-border);
    font-size: calc(11px * var(--font-scale));
    color: var(--text-sub);
    gap: 2px;
}
.checkin-day.checked {
    background: var(--primary-light);
    border-color: var(--primary);
    color: var(--primary);
}
.checkin-day.today {
    border: 2px solid var(--primary);
    font-weight: 600;
}
.checkin-day .day-label { font-size: calc(9px * var(--font-scale)); }
.checkin-day .day-points { font-size: calc(10px * var(--font-scale)); font-weight: 600; }
.checkin-bonus {
    text-align: center;
    margin-bottom: 12px;
    color: var(--text-sub);
    font-size: calc(13px * var(--font-scale));
}
.bonus-stages {
    display: flex;
    justify-content: space-between;
    margin-top: 10px;
    gap: 4px;
}
.bonus-stage {
    flex: 1;
    padding: 8px 4px;
    background: var(--highlight);
    border-radius: var(--radius);
    text-align: center;
}
.bonus-day { font-size: calc(13px * var(--font-scale)); font-weight: 600; color: var(--text); }
.bonus-points { font-size: calc(11px * var(--font-scale)); color: var(--primary); font-weight: 600; margin-top: 2px; }

/* 奖励弹窗 */
.reward-modal-mask { background: rgba(0,0,0,0.6); }
.reward-modal { text-align: center; background: var(--board-bg); }
.reward-icon { color: #f1c40f; margin-bottom: 12px; animation: rewardPop 0.5s ease-out; }
@keyframes rewardPop {
    0% { transform: scale(0); opacity: 0; }
    60% { transform: scale(1.2); }
    100% { transform: scale(1); opacity: 1; }
}
.reward-title { font-size: 22px; font-weight: 600; color: var(--text); margin-bottom: 4px; }
.reward-desc { font-size: 14px; color: var(--text-sub); margin-bottom: 12px; }
.reward-amount {
    font-size: 40px;
    font-weight: 700;
    color: var(--primary);
    animation: countUp 0.8s ease-out;
}
@keyframes countUp {
    0% { transform: translateY(20px); opacity: 0; }
    100% { transform: translateY(0); opacity: 1; }
}
.reward-sub { font-size: 14px; color: var(--text-sub); margin-bottom: 16px; }

/* 智能提示弹窗 */
.hint-modal { max-width: 420px; }

/* 提示选项弹窗 */
.hint-options-modal { max-width: 420px; }
.hint-options-title {
    font-size: 18px;
    font-weight: 600;
    color: var(--text);
    text-align: center;
    margin-bottom: 6px;
}
.hint-options-desc {
    font-size: 13px;
    color: var(--text-sub);
    text-align: center;
    margin-bottom: 18px;
}
.hint-options-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
    margin-bottom: 16px;
}
.hint-option-card {
    background: var(--btn-bg);
    border: 2px solid var(--btn-border);
    border-radius: var(--radius);
    padding: 18px 12px;
    text-align: center;
    cursor: pointer;
    transition: all 0.2s ease;
}
.hint-option-card:hover {
    border-color: var(--primary);
    background: var(--primary-light);
    transform: translateY(-2px);
}
.hint-option-icon {
    font-size: 32px;
    margin-bottom: 10px;
}
.hint-option-name {
    font-size: 15px;
    font-weight: 600;
    color: var(--text);
    margin-bottom: 6px;
}
.hint-option-desc {
    font-size: 12px;
    color: var(--text-sub);
    line-height: 1.5;
}
.hint-options-cancel {
    width: 100%;
    margin-top: 0;
}

/* 提示教程面板 - 电脑端：位于右侧栏功能栏下方、数字键盘上方 */
.hint-tutorial-overlay {
    width: 100%;
    z-index: 100;
    display: none;
    margin: 10px 0;
    position: relative;
}
.hint-tutorial-panel {
    background: #ffffff;
    border-radius: 12px;
    border: 2px solid var(--primary);
    box-shadow: 0 6px 24px rgba(45, 122, 79, 0.18), 0 2px 8px rgba(0,0,0,0.08);
    width: 100%;
    overflow: hidden;
    animation: hintSlideDown 0.3s ease-out;
}
@keyframes hintSlideDown {
    from { transform: translateY(-10px); opacity: 0; }
    to { transform: translateY(0); opacity: 1; }
}
.hint-tutorial-header {
    background: linear-gradient(135deg, var(--primary) 0%, #3a8f5f 100%);
    color: #fff;
    padding: 12px 16px;
    display: flex;
    align-items: center;
    gap: 10px;
    font-weight: 600;
}
.hint-tutorial-icon { font-size: 20px; }
.hint-tutorial-title { flex: 1; font-size: 16px; }
.hint-tutorial-close {
    background: rgba(255,255,255,0.2);
    border: none;
    color: #fff;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    cursor: pointer;
    font-size: 18px;
    line-height: 1;
    display: flex;
    align-items: center;
    justify-content: center;
}
.hint-tutorial-close:hover { background: rgba(255,255,255,0.3); }
.hint-tutorial-body {
    padding: 16px;
    min-height: 80px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #f8faf9;
}
.hint-tutorial-step {
    font-size: 15px;
    color: var(--text);
    line-height: 1.6;
    text-align: center;
}
.hint-tutorial-step strong {
    color: var(--primary);
    font-size: 18px;
}
.hint-tutorial-footer {
    padding: 10px 16px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    border-top: 1px solid #e8ecea;
    background: #fff;
}
.hint-tutorial-nav {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    border: 1px solid var(--btn-border);
    background: var(--btn-bg);
    color: var(--text);
    cursor: pointer;
    font-size: 18px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}
.hint-tutorial-nav:hover {
    border-color: var(--primary);
    color: var(--primary);
}
.hint-tutorial-dots {
    display: flex;
    gap: 6px;
    flex: 1;
    justify-content: center;
}
.hint-tutorial-dots .dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #ccc;
    transition: all 0.3s;
}
.hint-tutorial-dots .dot.active {
    background: var(--primary);
    width: 20px;
    border-radius: 4px;
}
.hint-tutorial-confirm {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    border: none;
    background: var(--success);
    color: #fff;
    cursor: pointer;
    font-size: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}
.hint-tutorial-actions {
    padding: 12px 16px;
    display: flex;
    gap: 10px;
    border-top: 1px solid #e8ecea;
    background: #fff;
}
.hint-tutorial-actions .modal-btn {
    flex: 1;
    margin: 0;
}
/* 答案展示区（最后一步） */
.hint-answer-reveal {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    padding: 8px 0;
}
.hint-answer-number {
    font-size: 48px;
    font-weight: 700;
    color: var(--success);
    line-height: 1;
    animation: answerPop 0.5s cubic-bezier(0.34, 1.56, 0.64, 1);
}
@keyframes answerPop {
    0% { transform: scale(0); opacity: 0; }
    60% { transform: scale(1.2); }
    100% { transform: scale(1); opacity: 1; }
}
.hint-answer-label {
    font-size: 14px;
    color: var(--text-sub);
}
/* 提示高亮类 - 动态教学效果 */
.cell.hint-target {
    box-shadow: inset 0 0 0 3px var(--success);
    animation: hintPulse 1.2s ease-in-out infinite;
    position: relative;
}
@keyframes hintPulse {
    0%, 100% { 
        box-shadow: inset 0 0 0 3px var(--success), 0 0 0 0 rgba(39,174,96,0.4); 
        background: rgba(39,174,96,0.08);
    }
    50% { 
        box-shadow: inset 0 0 0 4px var(--success), 0 0 12px rgba(39,174,96,0.5); 
        background: rgba(39,174,96,0.15);
    }
}
.cell.hint-area {
    background: rgba(74, 125, 255, 0.10);
    animation: hintAreaFade 1.5s ease-in-out infinite;
}
@keyframes hintAreaFade {
    0%, 100% { background: rgba(74, 125, 255, 0.08); }
    50% { background: rgba(74, 125, 255, 0.15); }
}
.cell.hint-source {
    background: rgba(46, 204, 113, 0.15);
    font-weight: 600;
    animation: hintSourceGlow 1.5s ease-in-out infinite;
}
.cell.hint-final {
    animation: hintFinalPulse 0.8s ease-in-out infinite !important;
}
@keyframes hintFinalPulse {
    0%, 100% {
        box-shadow: inset 0 0 0 3px var(--success), 0 0 0 0 rgba(39,174,96,0.5);
        background: rgba(39,174,96,0.12);
        transform: scale(1);
    }
    50% {
        box-shadow: inset 0 0 0 5px var(--success), 0 0 20px rgba(39,174,96,0.6);
        background: rgba(39,174,96,0.20);
        transform: scale(1.05);
    }
}
@keyframes hintSourceGlow {
    0%, 100% { background: rgba(46, 204, 113, 0.12); }
    50% { background: rgba(46, 204, 113, 0.22); }
}
.cell.hint-source-pop .cell-num {
    animation: sourceNumPop 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
}
@keyframes sourceNumPop {
    0% { transform: scale(0.5); opacity: 0; }
    60% { transform: scale(1.3); }
    100% { transform: scale(1); opacity: 1; }
}
.cell.hint-target-pop {
    animation: targetCellPop 0.5s cubic-bezier(0.34, 1.56, 0.64, 1);
}
@keyframes targetCellPop {
    0% { transform: scale(0.3); opacity: 0; }
    60% { transform: scale(1.15); }
    100% { transform: scale(1); opacity: 1; }
}

/* 手机端：教程面板从底部滑出，全屏宽度 */
@media (max-width: 480px) {
    .hint-tutorial-overlay {
        position: fixed;
        bottom: 0;
        left: 0;
        right: 0;
        width: 100%;
        max-width: 100%;
        z-index: 9999;
        margin: 0;
    }
    .hint-tutorial-panel {
        border-radius: 14px 14px 0 0;
        border-bottom: none;
        animation: hintSlideUpMobile 0.3s ease-out;
    }
    @keyframes hintSlideUpMobile {
        from { transform: translateY(100%); }
        to { transform: translateY(0); }
    }
}

/* 打印样式 */
.print-container {
    display: none;
}
.print-container.active {
    display: block;
}

@media print {
    html, body {
        margin: 0 !important;
        padding: 0 !important;
        background: white !important;
        -webkit-print-color-adjust: exact;
        print-color-adjust: exact;
        width: 100% !important;
    }
    body * {
        visibility: hidden !important;
    }
    .print-container, .print-container * {
        visibility: visible !important;
    }
    .app-container, .top-bar, .status-bar, .board-wrap, .toolbar, .numpad, .bottom-bar,
    .user-card, .difficulty-bar, .func-bar, .no-print,
    .modal-mask, .modal, .pause-overlay,
    #printModal, #dailyModal, #winModal, #hintModal, #lifeModal, #settingsModal,
    #accountModal, #rankModal, #emailLoginModal, #emailRegisterModal, #wechatLoginModal,
    #achievementModal, #checkinModal, #rewardModal, #elderConfirmModal, #menuModal,
    #statsModal, #ruleModal, #langModal {
        display: none !important;
    }
    .print-container {
        display: block !important;
        position: fixed !important;
        top: 0 !important;
        left: 0 !important;
        right: 0 !important;
        width: 100% !important;
        height: auto !important;
        padding: 0 !important;
        margin: 0 !important;
        z-index: 99999 !important;
        visibility: visible !important;
    }
    .print-page {
        page-break-after: always;
        padding: 2cm 1.8cm;
        box-sizing: border-box;
        min-height: 297mm;
        width: 210mm;
        margin: 0 auto;
        visibility: visible !important;
    }
    .print-page:last-child {
        page-break-after: auto;
    }
    .print-title {
        text-align: center;
        font-size: 18px;
        font-weight: 600;
        margin-bottom: 8px;
        color: #333;
    }
    .print-meta {
        display: flex;
        justify-content: space-between;
        font-size: 12px;
        color: #666;
        margin-bottom: 16px;
    }
    .print-container .board {
        width: 100% !important;
        max-width: 170mm !important;
        aspect-ratio: 1 !important;
        display: grid !important;
        grid-template-columns: repeat(9, 1fr) !important;
        grid-template-rows: repeat(9, 1fr) !important;
        border: 2px solid #333 !important;
        margin: 0 auto !important;
        height: auto !important;
        visibility: visible !important;
    }
    .print-container .cell {
        border-right: 1px solid #999 !important;
        border-bottom: 1px solid #999 !important;
        font-size: 24px !important;
        font-weight: 500 !important;
        color: #333 !important;
        background: white !important;
        display: flex !important;
        align-items: center !important;
        justify-content: center !important;
        aspect-ratio: 1 !important;
        height: 100% !important;
        width: auto !important;
        visibility: visible !important;
    }
    .print-container .cell.row-3,
    .print-container .cell.row-6 {
        border-bottom: 2px solid #333 !important;
    }
    .print-container .cell:nth-child(3n):not(:nth-child(9n)) {
        border-right: 2px solid #333 !important;
    }
    .print-grid-2 {
        display: grid !important;
        grid-template-columns: 1fr 1fr !important;
        gap: 12mm !important;
        visibility: visible !important;
    }
    .print-grid-2 .board {
        max-width: 80mm !important;
    }
    .print-grid-2 .cell {
        font-size: 18px !important;
    }
    .print-grid-4 {
        display: grid !important;
        grid-template-columns: 1fr 1fr !important;
        grid-template-rows: 1fr 1fr !important;
        gap: 10mm !important;
        visibility: visible !important;
    }
    .print-grid-4 .board {
        max-width: 75mm !important;
    }
    .print-grid-4 .cell {
        font-size: 16px !important;
    }
    .print-grid-6 {
        display: grid !important;
        grid-template-columns: 1fr 1fr 1fr !important;
        grid-template-rows: 1fr 1fr !important;
        gap: 8mm !important;
        visibility: visible !important;
    }
    .print-grid-6 .board {
        max-width: 55mm !important;
    }
    .print-grid-6 .cell {
        font-size: 13px !important;
    }
    .print-grid-9 {
        display: grid !important;
        grid-template-columns: 1fr 1fr 1fr !important;
        grid-template-rows: 1fr 1fr 1fr !important;
        gap: 6mm !important;
        visibility: visible !important;
    }
    .print-grid-9 .board {
        max-width: 50mm !important;
    }
    .print-grid-9 .cell {
        font-size: 11px !important;
    }
}

/* 微信登录二维码 */
.wechat-qr {
    display: flex;
    justify-content: center;
    padding: 20px 0;
    color: var(--primary);
}
.qr-placeholder {
    width: 160px;
    height: 160px;
    border: 1px solid var(--btn-border);
    border-radius: var(--radius);
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--btn-bg);
}

/* 老年模式确认弹窗 */
.elder-modal .modal-title { color: var(--primary); }

/* ===== 胜利弹窗 - 响应式横竖屏布局 ===== */
.win-modal { text-align: center; }
.win-title { font-size: 22px; font-weight: 600; color: var(--success); }
.win-stats-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin: 12px 0; }
.win-stat-item { padding: 12px 8px; background: var(--highlight); border-radius: var(--radius); }
.win-stat-num { font-size: 20px; font-weight: 700; color: var(--text); font-variant-numeric: tabular-nums; }
.win-stat-label { font-size: 11px; color: var(--text-sub); margin-top: 4px; }

/* 弹窗容器 */
.win-modal-pro {
    display: grid;
    grid-template-columns: 1fr; /* 移动端默认单列 */
    max-height: 90vh;
    padding: 0;
    overflow: hidden;
    gap: 0;
}

/* 主信息区（左/上） */
.win-pro-main {
    padding: 20px 20px 12px;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
}
.win-pro-main::-webkit-scrollbar { width: 4px; }
.win-pro-main::-webkit-scrollbar-thumb { background: var(--btn-border); border-radius: 2px; }

/* 侧信息区（右/下） */
.win-pro-side {
    padding: 0 20px 12px;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
}
.win-pro-side::-webkit-scrollbar { width: 4px; }
.win-pro-side::-webkit-scrollbar-thumb { background: var(--btn-border); border-radius: 2px; }

/* 头部 */
.win-pro-header { display: flex; align-items: center; gap: 12px; margin-bottom: 16px; }
.win-pro-trophy { font-size: 40px; }

/* 积分奖励区 */
.win-points-section {
    background: linear-gradient(135deg, rgba(255, 215, 0, 0.08), rgba(255, 165, 0, 0.05));
    border-radius: 12px; padding: 14px 16px; margin: 10px 0;
    border: 1px solid rgba(255, 215, 0, 0.15);
}
.win-points-total { display: flex; align-items: center; justify-content: center; gap: 6px; font-size: 26px; font-weight: 700; color: #f39c12; margin-bottom: 10px; }
.win-points-icon { font-size: 22px; }
.win-points-label { font-size: 13px; font-weight: 500; color: var(--text-sub); }
.win-points-breakdown { border-top: 1px dashed rgba(0,0,0,0.08); padding-top: 8px; }
.win-points-item { display: flex; justify-content: space-between; align-items: center; padding: 3px 0; font-size: 12px; }
.win-points-item-label { color: var(--text-sub); }
.win-points-item-value { color: var(--success); font-weight: 600; }

/* 段位区 */
.win-rank-section { background: var(--btn-bg); border-radius: 12px; padding: 12px 16px; margin: 10px 0; }
.win-rank-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 8px; }
.win-rank-title { font-size: 13px; font-weight: 600; color: var(--text-main); }
.win-rank-change { font-size: 12px; font-weight: 600; color: var(--success); }
.win-rank-info { display: flex; flex-direction: column; gap: 8px; }
.win-rank-current { display: flex; align-items: center; gap: 12px; }
.win-rank-icon { font-size: 28px; }
.win-rank-name { font-size: 15px; font-weight: 700; }
.win-rank-points { font-size: 11px; color: var(--text-hint); margin-top: 2px; }
.win-rank-progress-bar { height: 8px; background: rgba(0,0,0,0.08); border-radius: 4px; overflow: hidden; }
.win-rank-progress-fill { height: 100%; background: var(--primary); border-radius: 4px; transition: width 0.8s ease; }
.win-rank-next { font-size: 10px; color: var(--text-hint); margin-top: 4px; text-align: right; }

/* 排名区 */
.win-ranking-section { background: var(--primary-light); border-radius: 12px; padding: 12px 16px; margin: 10px 0; border: 1px solid rgba(74, 125, 255, 0.15); }
.win-ranking-number { text-align: center; font-size: 28px; font-weight: 700; color: var(--primary); margin-top: 6px; }
.win-ranking-suffix { font-size: 14px; font-weight: 500; color: var(--text-sub); margin-left: 4px; }

/* 连胜徽章 */
.win-streak-section { margin: 8px 0; text-align: center; }
.win-streak-badge { display: inline-flex; align-items: center; gap: 6px; background: linear-gradient(135deg, #ff6b6b, #ee5a5a); color: #fff; padding: 6px 18px; border-radius: 20px; font-size: 13px; font-weight: 600; box-shadow: 0 4px 12px rgba(255, 107, 107, 0.25); }
.win-streak-icon { font-size: 16px; }

/* 哲理语录 */
.win-quote-section { background: rgba(107, 142, 35, 0.06); border-radius: 12px; padding: 14px 16px; margin: 10px 0; position: relative; border-left: 4px solid #6b8e23; }
.win-quote-mark { font-size: 32px; color: rgba(107, 142, 35, 0.18); font-family: Georgia, serif; line-height: 1; margin-bottom: -8px; }
.win-quote-text { font-size: 13px; line-height: 1.7; color: var(--text-main); font-style: italic; margin: 4px 0; }
.win-quote-author { font-size: 11px; color: var(--text-hint); text-align: right; margin-top: 6px; }

/* 按钮区 */
.win-buttons { padding: 12px 20px 16px; display: flex; flex-direction: column; gap: 8px; border-top: 1px solid var(--btn-border); background: var(--bg); }
.win-btn-primary { width: 100%; padding: 12px !important; font-size: 15px !important; font-weight: 600 !important; }
.win-btn-secondary { width: 100%; padding: 10px !important; font-size: 13px !important; }
.win-btn-share { width: 100%; padding: 9px !important; font-size: 12px !important; }

/* 脉冲动画 */
@keyframes pulse {
    0% { opacity: 1; transform: scale(1); }
    50% { opacity: 0.6; transform: scale(1.2); }
    100% { opacity: 1; transform: scale(1); }
}

/* ===== 桌面端横屏布局 ===== */
@media (min-width: 769px) {
    .win-modal-pro {
        grid-template-columns: 1fr 1fr;
        grid-template-rows: 1fr auto;
        max-width: 680px;
        max-height: 80vh;
    }
    .win-pro-main {
        grid-column: 1;
        grid-row: 1;
        padding: 24px 20px 12px;
    }
    .win-pro-side {
        grid-column: 2;
        grid-row: 1;
        padding: 24px 20px 12px;
        border-left: 1px solid var(--btn-border);
    }
    .win-buttons {
        grid-column: 1 / -1;
        grid-row: 2;
        flex-direction: row;
        gap: 10px;
        padding: 12px 24px 20px;
    }
    .win-btn-primary, .win-btn-secondary, .win-btn-share {
        width: auto;
        flex: 1;
    }
    .win-stats-grid { gap: 12px; }
    .win-stat-item { padding: 14px 10px; }
    .win-stat-num { font-size: 22px; }
    .win-title { font-size: 24px; }
    .win-pro-trophy { font-size: 44px; }
}

/* 鼓励弹窗 */
.encourage-mask {
    position: fixed;
    top: 80px;
    left: 50%;
    transform: translateX(-50%) translateY(-20px);
    z-index: 150;
    pointer-events: none;
    opacity: 0;
    transition: all 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
}
.encourage-mask.show {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
}
.encourage-card {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 14px 28px;
    border-radius: 40px;
    font-size: 16px;
    font-weight: 600;
    box-shadow: 0 8px 24px rgba(102, 126, 234, 0.4);
    display: flex;
    align-items: center;
    gap: 8px;
    white-space: nowrap;
}
.encourage-card .enc-emoji {
    font-size: 22px;
}
.encourage-card.enc-big {
    padding: 18px 36px;
    font-size: 18px;
    background: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
    box-shadow: 0 10px 30px rgba(245, 87, 108, 0.4);
}
.encourage-card.enc-huge {
    padding: 20px 40px;
    font-size: 20px;
    background: linear-gradient(135deg, #fa709a 0%, #fee140 100%);
    box-shadow: 0 12px 36px rgba(250, 112, 154, 0.5);
}
.encourage-card.enc-super {
    padding: 22px 44px;
    font-size: 22px;
    background: linear-gradient(135deg, #a8edea 0%, #fed6e3 50%, #ffd3a5 100%);
    color: #d6336c;
    box-shadow: 0 14px 40px rgba(255, 200, 100, 0.5);
    animation: pulse-glow 1s ease-in-out infinite alternate;
}
@keyframes pulse-glow {
    from { box-shadow: 0 14px 40px rgba(255, 200, 100, 0.5); }
    to { box-shadow: 0 14px 50px rgba(255, 150, 50, 0.7); }
}

/* 公众号引导弹窗 */
.official-modal .qr-area {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 16px 0;
}
.official-qr {
    width: 160px;
    height: 160px;
    border: 2px solid var(--btn-border);
    border-radius: var(--radius);
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--btn-bg);
    margin-bottom: 12px;
}
.official-qr svg { width: 140px; height: 140px; }
.official-tip {
    text-align: center;
    font-size: 14px;
    color: var(--text-sub);
    line-height: 1.6;
}
.official-tip strong {
    color: var(--primary);
    font-size: 16px;
}
.official-reward {
    margin-top: 12px;
    padding: 10px 16px;
    background: var(--primary-light);
    border-radius: var(--radius);
    text-align: center;
    font-size: 13px;
    color: var(--primary);
    font-weight: 500;
}

/* 打印容器 */
.print-container { display: none; }
.print-container.active { display: block; }

/* ==================== 移动端适配 ==================== */
/* 手机端：候选数放功能栏，隐藏独立候选数+新游戏行 */
.candidate-func-btn { display: none; }
.mobile-newgame-btn { display: none; }
@media (max-width: 480px) {
    .candidate-func-btn { display: flex; }
    .action-row { display: none; }
    .mobile-newgame-btn {
        width: 100%;
        display: flex;
        margin-bottom: 10px;
    }

    .app-container {
        max-width: 100%;
        padding: 0 8px;
    }

    /* 顶部栏 */
    .top-bar {
        padding: 6px 2px;
        margin-bottom: 2px;
    }
    .top-title {
        font-size: calc(18px * var(--font-scale));
    }
    .icon-btn {
        padding: 6px;
    }

    /* 顶部登录注册按钮 */
    .top-btn {
        padding: 5px 12px;
        font-size: calc(12px * var(--font-scale));
    }
    .top-user-info {
        padding: 3px 6px 3px 3px;
    }
    .top-user-avatar {
        width: 26px;
        height: 26px;
        font-size: 12px;
    }
    .top-user-name {
        font-size: calc(12px * var(--font-scale));
        max-width: 60px;
    }
    .top-user-dropdown {
        width: 180px;
        padding: 12px;
    }

    /* 顶部导航快捷按钮 - 手机端只显示图标 */
    .nav-btn-text {
        display: none;
    }
    .rank-nav-btn,
    .rules-nav-btn {
        padding: 6px;
    }
    .top-actions {
        gap: 4px;
    }

    /* 难度选择栏 - 强制单行 */
    .difficulty-bar {
        margin-bottom: 6px;
        gap: 3px;
        flex-wrap: nowrap !important;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        justify-content: flex-start;
        padding: 2px 0;
    }
    .diff-btn {
        padding: 4px 8px;
        font-size: calc(12px * var(--font-scale));
        flex-shrink: 0;
        white-space: nowrap;
    }

    /* 用户卡片 */
    .user-card {
        margin-bottom: 8px;
    }
    .user-card-stats {
        gap: 4px;
    }
    .user-stat-item {
        padding: 8px 2px;
    }
    .user-stat-icon {
        font-size: 16px;
        margin-bottom: 1px;
    }
    .user-stat-num {
        font-size: calc(15px * var(--font-scale));
    }
    .user-stat-label {
        font-size: calc(10px * var(--font-scale));
    }

    /* 手机端：恢复上下布局 */
    .game-main {
        flex-direction: column;
        gap: 10px;
        align-items: center;
    }
    .game-right {
        width: 100%;
        max-width: 360px;
    }

    /* 状态栏 - 超薄单行 */
    .status-bar {
        flex-direction: row;
        justify-content: space-around;
        align-items: center;
        padding: 3px 6px;
        margin-bottom: 4px;
        gap: 2px;
        flex-wrap: nowrap !important;
    }
    .game-right .status-bar {
        margin-bottom: 4px;
        flex-wrap: nowrap !important;
    }
    .game-right .status-group {
        flex: 1 1 auto !important;
        min-width: 0 !important;
    }
    .status-group {
        flex-direction: row;
        align-items: center;
        gap: 2px;
    }
    .status-label {
        font-size: calc(10px * var(--font-scale));
    }
    .status-value {
        font-size: calc(12px * var(--font-scale));
    }

    /* 棋盘 */
    .board {
        width: min(94vw, 360px);
        border-width: 2px;
        border-radius: 6px;
    }
    .cell {
        font-size: calc(24px * var(--font-scale));
    }
    .cell .notes {
        inset: 2px;
        font-size: calc(10px * var(--font-scale));
    }

    /* 手机端数字键盘：1行9列，加大间距 */
    .numpad-grid {
        display: flex !important;
        grid-template-columns: none !important;
        grid-template-rows: none !important;
        flex-direction: row;
        max-width: 360px;
        gap: 6px;
        margin-bottom: 6px;
        order: 1;
    }
    .numpad-grid .num-btn {
        min-height: auto;
        font-size: calc(20px * var(--font-scale));
        aspect-ratio: auto;
        flex: 1;
        flex-direction: column;
        border-radius: 8px;
        padding: 8px 2px;
    }
    .numpad-grid .num-btn .num-count {
        font-size: calc(9px * var(--font-scale));
    }

    /* 手机端功能按钮 - 6个按钮一行 */
    .game-right .func-bar {
        grid-template-columns: repeat(6, 1fr);
        margin-bottom: 6px;
        gap: 2px;
        order: 2;
    }
    .game-right .func-btn {
        padding: 8px 1px;
        font-size: calc(11px * var(--font-scale));
        gap: 2px;
    }
    .game-right .func-btn svg {
        width: 18px;
        height: 18px;
    }
    .func-btn .badge {
        top: 2px;
        right: 4px;
        font-size: 10px;
        min-width: 14px;
        height: 14px;
        line-height: 14px;
    }

    /* 手机端新游戏按钮 */
    .big-newgame-btn {
        padding: 14px 20px;
        font-size: calc(16px * var(--font-scale));
        order: 3;
    }

    /* 底部导航 */
    .bottom-nav {
        padding: 8px 0 10px;
    }
    .bottom-item {
        font-size: calc(11px * var(--font-scale));
        padding: 4px 6px;
    }
    .bottom-item svg {
        width: 20px;
        height: 20px;
        margin-bottom: 2px;
    }

    /* 弹窗 */
    .modal-mask {
        padding: 12px;
    }
    .modal-body {
        padding: 16px;
    }
    .modal-title {
        font-size: calc(17px * var(--font-scale));
        margin-bottom: 10px;
    }
    .modal-item {
        padding: 12px 4px;
        font-size: calc(14px * var(--font-scale));
    }
    .modal-btn {
        padding: 12px;
        font-size: calc(14px * var(--font-scale));
    }
    .form-input {
        padding: 10px 12px;
        font-size: calc(14px * var(--font-scale));
    }
}

/* 超小屏适配 */
@media (max-width: 360px) {
    .board {
        width: min(94vw, 320px);
    }
    .cell {
        font-size: calc(21px * var(--font-scale));
    }
    .numpad {
        max-width: 320px;
    }
    .num-btn {
        font-size: calc(20px * var(--font-scale));
    }
    .diff-btn {
        padding: 5px 10px;
        font-size: calc(13px * var(--font-scale));
    }
    .top-btn {
        padding: 4px 10px;
        font-size: calc(11px * var(--font-scale));
    }
    .top-user-name {
        display: none;
    }
    .user-stat-label {
        font-size: calc(9px * var(--font-scale));
    }
}

/* ==================== 手机横屏布局 ==================== */
@media (max-height: 500px) and (orientation: landscape) {
    .app-container {
        max-width: 100%;
        padding: 0 6px;
    }
    .top-bar {
        padding: 4px 2px;
        margin-bottom: 2px;
    }
    .top-title {
        font-size: calc(14px * var(--font-scale));
    }
    .top-btn {
        padding: 3px 8px;
        font-size: calc(11px * var(--font-scale));
    }
    .icon-btn {
        padding: 4px;
    }
    .icon-btn svg, .home-nav-btn svg {
        width: 16px;
        height: 16px;
    }

    /* 难度栏：紧凑横排 */
    .difficulty-bar {
        display: flex;
        flex-wrap: nowrap;
        gap: 2px;
        margin-bottom: 4px;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }
    .diff-btn {
        padding: 3px 6px;
        font-size: calc(11px * var(--font-scale));
        flex-shrink: 0;
    }

    .user-card { display: none !important; }

    /* 左右分栏布局 */
    .game-main {
        flex-direction: row !important;
        gap: 10px;
        align-items: flex-start;
    }
    .game-left {
        flex-shrink: 0;
    }
    .board {
        width: min(52vh, 320px) !important;
        border-width: 2px;
    }
    .cell {
        font-size: calc(18px * var(--font-scale));
    }
    .cell .notes {
        font-size: calc(8px * var(--font-scale));
    }
    .board-wrap {
        padding: 4px;
        margin-bottom: 0;
    }
    .pause-overlay {
        font-size: 16px;
    }

    /* 右侧面板 */
    .game-right {
        width: 200px !important;
        flex-shrink: 0;
        gap: 4px;
    }
    .status-bar {
        gap: 6px;
        margin-bottom: 2px;
    }
    .status-group {
        min-width: 40px;
    }
    .status-label {
        font-size: calc(9px * var(--font-scale));
    }
    .status-value {
        font-size: calc(11px * var(--font-scale));
    }

    /* 功能按钮：6个一行 */
    .game-right .func-bar {
        grid-template-columns: repeat(6, 1fr);
        gap: 2px;
        margin-bottom: 2px;
        order: 0;
    }
    .game-right .func-btn {
        padding: 4px 1px;
        font-size: calc(10px * var(--font-scale));
        gap: 1px;
    }
    .game-right .func-btn svg {
        width: 16px;
        height: 16px;
    }
    .candidate-func-btn { display: flex !important; }

    /* 数字键盘3x3网格 */
    .numpad-grid {
        display: grid !important;
        grid-template-columns: repeat(3, 1fr) !important;
        grid-template-rows: repeat(3, 1fr) !important;
        gap: 3px;
        order: 1;
        max-width: 200px;
    }
    .numpad-grid .num-btn {
        min-height: 40px;
        font-size: calc(20px * var(--font-scale));
        aspect-ratio: 1;
    }

    /* 候选数+新游戏并排（同电脑端） */
    .action-row {
        display: flex !important;
        gap: 4px;
        margin-bottom: 0;
        order: 3;
    }
    .action-row .candidate-btn {
        padding: 6px 4px;
        font-size: calc(11px * var(--font-scale));
    }
    .action-row .candidate-status {
        display: none;
    }
    .action-row .big-newgame-btn {
        padding: 8px 10px;
        font-size: calc(13px * var(--font-scale));
    }
    .mobile-newgame-btn { display: none !important; }

    /* 底部工具栏紧凑 */
    .bottom-bar {
        max-width: 100%;
        gap: 2px;
        padding: 4px 4px 2px;
    }
    .bottom-item {
        font-size: calc(10px * var(--font-scale));
        padding: 3px 4px;
        gap: 2px;
    }
    .bottom-item svg {
        width: 16px;
        height: 16px;
    }

    /* 社交工具栏紧凑 */
    .social-bar {
        padding: 4px 8px;
        gap: 6px;
    }
    .social-bar-label {
        font-size: calc(10px * var(--font-scale));
    }
    .social-icon {
        min-width: 28px;
        padding: 3px 4px;
    }
    .social-icon span {
        font-size: calc(9px * var(--font-scale));
    }
    .social-icon svg {
        width: 16px;
        height: 16px;
    }
}
