:root {
    --bg-page: #f5f0e1;
    --bg-card: #ffffff;
    --bg-board: #deb887;
    --line-board: #8b7355;
    --color-player: #c0392b;
    --color-ai: #2c3e50;
    --color-camp: rgba(201, 169, 110, 0.6);
    --color-rail: #6b5b4f;
    --color-btn: #8b5e3c;
    --text-primary: #3e2723;
    --text-secondary: #8d6e63;
    --color-highlight: #e6b422;
    --color-hint: #8fbc8f;
    --color-info: #4a90e2;
    --shadow-card: 0 2px 8px rgba(0, 0, 0, 0.08);
    --font-zh: "PingFang SC", "Microsoft YaHei", sans-serif;
    --font-en: Georgia, serif;
    --font-piece: "KaiTi", "STKaiti", "LiSu", serif;
}

html,
body {
    height: 100%;
}

body {
    background-color: var(--bg-page);
    color: var(--text-primary);
    font-family: var(--font-zh);
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    -webkit-font-smoothing: antialiased;
}

button,
input {
    font: inherit;
}

.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

.top-nav {
    height: 56px;
    background: var(--bg-card);
    border-bottom: 1px solid rgba(0, 0, 0, 0.05);
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0 24px;
    box-shadow: var(--shadow-card);
    position: relative;
    z-index: 20;
}

.nav-left {
    display: flex;
    align-items: center;
    gap: 8px;
}

.nav-left img {
    width: 28px;
    height: 28px;
}

.brand-title {
    font-size: 18px;
    margin: 0;
    color: var(--text-primary);
    font-weight: bold;
}

.nav-right a {
    margin-left: 20px;
    color: var(--text-secondary);
    text-decoration: none;
    font-size: 14px;
    transition: color 0.2s;
}

.nav-right a:hover {
    color: var(--text-primary);
}

.page-body {
    flex: 1;
    min-height: 0;
    display: flex;
    flex-direction: column;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
}

.top-status-wrap {
    max-width: 1440px;
    width: calc(100% - 48px);
    margin: 18px auto 0;
}

.top-status-bar {
    max-width: 916px;
}

.above-fold {
    min-height: 100%;
    display: flex;
    flex-direction: column;
    flex-shrink: 0;
}

.game-screen {
    flex: 1 0 auto;
    display: flex;
    max-width: 1440px;
    margin: 0 auto;
    width: 100%;
    padding: 32px 24px;
    box-sizing: border-box;
    gap: 40px;
}

.board-area {
    flex: 65;
    min-height: 0;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    gap: 16px;
}

.mobile-status {
    display: none;
    width: 100%;
}

.board-container {
    width: 100%;
    max-width: 100%;
    aspect-ratio: 9 / 12.8;
    background-color: var(--bg-board);
    border-radius: 8px;
    box-shadow: inset 0 0 20px rgba(0, 0, 0, 0.05), 0 8px 24px rgba(0, 0, 0, 0.12);
    padding: 2%;
    box-sizing: border-box;
}

.board-inner {
    position: relative;
    width: 100%;
    height: 100%;
}

.junqi-canvas {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    display: block;
    touch-action: manipulation;
    image-rendering: auto;
}

.normal-line {
    stroke: var(--line-board);
    stroke-width: 2;
    fill: none;
}

.rail-line {
    stroke-width: 6;
    stroke: var(--color-rail);
    stroke-linecap: round;
    stroke-linejoin: round;
    fill: none;
}

.board-grid {
    --node-w: 22.2222%;
    --node-h: 7.8125%;
    pointer-events: auto;
}

.node {
    display: flex;
    align-items: center;
    justify-content: center;
    position: absolute;
    width: var(--node-w);
    height: var(--node-h);
    transform: translate(-50%, -50%);
    outline: none;
}

.node::before {
    content: "";
    position: absolute;
    z-index: 1;
}

.node.is-station::before {
    width: 45%;
    height: 25%;
    background: var(--bg-board);
    border: 2px solid var(--line-board);
    border-radius: 4px;
}

.node.is-camp::before {
    width: 65%;
    height: 65%;
    background: var(--color-camp);
    border: 2px solid var(--line-board);
    border-radius: 50%;
}

.node.is-hq::before {
    width: 55%;
    height: 40%;
    background: var(--bg-board);
    border: 2px solid var(--line-board);
    border-radius: 8px 8px 0 0;
    border-bottom: 4px solid var(--line-board);
}

.node.is-last-move::after {
    content: "";
    position: absolute;
    inset: 8%;
    border: 3.5px solid rgba(74, 144, 226, 0.95);
    border-radius: 8px;
    z-index: 2;
    box-shadow: 0 0 8px rgba(74, 144, 226, 0.55), inset 0 0 6px rgba(74, 144, 226, 0.12);
}

.river-text {
    position: absolute;
    width: 500%;
    left: -200%;
    text-align: center;
    font-size: clamp(20px, 5vw, 32px);
    font-family: var(--font-piece);
    color: var(--line-board);
    letter-spacing: 2em;
    pointer-events: none;
    opacity: 0.8;
    font-weight: bold;
}

.piece {
    width: 82%;
    height: 82%;
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: var(--font-piece);
    font-size: clamp(14px, 4vw, 32px);
    font-weight: bold;
    color: white;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.3), inset 0 1px 0 rgba(255, 255, 255, 0.2);
    cursor: pointer;
    transition: transform 0.2s, box-shadow 0.2s, opacity 0.2s;
    user-select: none;
    z-index: 10;
    border: 0;
    padding: 0;
}

.piece:hover {
    transform: scale(1.05);
}

.piece.player {
    background-color: var(--color-player);
}

.piece.ai {
    background-color: var(--color-ai);
}

.piece.hidden {
    background-color: #5c4033;
    color: var(--color-highlight);
    font-family: var(--font-en);
    background-image: repeating-linear-gradient(
        45deg,
        rgba(0, 0, 0, 0.1) 0,
        rgba(0, 0, 0, 0.1) 2px,
        transparent 2px,
        transparent 6px
    );
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.4), inset 0 1px 0 rgba(255, 255, 255, 0.1);
}

.piece.selected {
    box-shadow: 0 0 0 3px var(--color-highlight), 0 6px 16px rgba(0, 0, 0, 0.4);
    transform: translateY(-4px) scale(1.05);
}

.piece.disabled {
    cursor: not-allowed;
    opacity: 0.75;
}

.piece-label-small {
    font-size: 0.72em;
}

.control-panel {
    flex: 35;
    max-width: 380px;
    width: 100%;
}

.panel-card {
    background: var(--bg-card);
    border-radius: 12px;
    padding: 24px;
    box-shadow: var(--shadow-card);
    display: flex;
    flex-direction: column;
    gap: 20px;
    min-height: 0;
    overflow: hidden;
}

.difficulty-selector {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    border-radius: 6px;
    overflow: hidden;
    border: 1px solid var(--color-btn);
    flex-shrink: 0;
}

.diff-btn {
    padding: 10px 0;
    border: none;
    background: transparent;
    color: var(--color-btn);
    cursor: pointer;
    font-weight: bold;
    font-size: 14px;
    transition: all 0.2s;
    width: 100%;
    white-space: nowrap;
}

.diff-btn:not(:last-child) {
    border-right: 1px solid var(--color-btn);
}

.diff-btn.active {
    background: var(--color-btn);
    color: white;
}

.mode-selector {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    border-radius: 6px;
    overflow: hidden;
    border: 1px solid var(--color-btn);
    flex-shrink: 0;
    margin-bottom: 10px;
}

.mode-btn {
    padding: 10px 0;
    border: none;
    background: transparent;
    color: var(--color-btn);
    cursor: pointer;
    font-weight: bold;
    font-size: 14px;
    transition: all 0.2s;
    width: 100%;
    white-space: nowrap;
}

.mode-btn:not(:last-child) {
    border-right: 1px solid var(--color-btn);
}

.mode-btn.active {
    background: var(--color-btn);
    color: white;
}

.status-bar {
    font-size: 16px;
    font-weight: bold;
    text-align: center;
    color: var(--color-player);
    padding: 10px;
    background: rgba(192, 57, 43, 0.08);
    border-radius: 8px;
    letter-spacing: 1px;
    /* min-height: 74px; */
    box-sizing: border-box;
}

.status-bar.ai-turn {
    color: var(--color-ai);
    background: rgba(44, 62, 80, 0.08);
}

.status-bar.win-turn {
    color: #2e7d32;
    background: rgba(143, 188, 143, 0.16);
}

.status-bar.lose-turn {
    color: var(--color-player);
    background: rgba(192, 57, 43, 0.14);
}

.piece-count {
    display: flex;
    justify-content: space-around;
    font-weight: bold;
    color: var(--text-secondary);
    font-size: 15px;
    background: var(--bg-page);
    padding: 12px;
    border-radius: 8px;
    flex-shrink: 0;
}

.piece-count span:first-child {
    color: var(--color-player);
}

.piece-count span:last-child {
    color: var(--color-ai);
}

.action-buttons {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
    flex-shrink: 0;
}

.btn {
    background: var(--color-btn);
    color: white;
    border: none;
    padding: 12px;
    border-radius: 6px;
    font-size: 15px;
    cursor: pointer;
    transition: opacity 0.2s, transform 0.2s;
    font-weight: bold;
}

.btn:hover {
    opacity: 0.92;
}

.btn:active {
    transform: translateY(1px);
}

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

.btn-outline:hover {
    background: rgba(139, 94, 60, 0.1);
}

.history {
    margin-top: 8px;
    display: flex;
    flex-direction: column;
    flex: 1 1 auto;
    min-height: 0;
    overflow: hidden;
}

.history-tabs {
    display: flex;
    border-bottom: 2px solid rgba(0, 0, 0, 0.05);
    margin-bottom: 12px;
    gap: 10px;
    flex-shrink: 0;
}

.history-tab {
    flex: 1;
    text-align: center;
    font-size: 15px;
    font-weight: bold;
    color: var(--text-secondary);
    padding: 0 0 8px;
    cursor: pointer;
    position: relative;
    transition: color 0.2s;
    border: none;
    background: transparent;
}

.history-tab.active {
    color: var(--text-primary);
}

.history-tab.active::after {
    content: "";
    position: absolute;
    bottom: -2px;
    left: 20%;
    width: 60%;
    height: 2px;
    background-color: var(--color-btn);
    border-radius: 2px;
}

.history-content {
    display: none;
    flex: 1 1 auto;
    min-height: 0;
    overflow: hidden;
}

.history-content.active {
    display: flex;
    flex-direction: column;
}

.history-list {
    list-style: none;
    padding: 0;
    margin: 0;
    font-size: 14px;
    color: var(--text-secondary);
    line-height: 1.7;
    flex: 1 1 auto;
    min-height: 0;
    overflow-y: auto;
}

.history-list li {
    border-bottom: 1px dashed rgba(0, 0, 0, 0.05);
    padding: 6px 0;
}

.history-list-empty {
    color: var(--text-secondary);
    text-align: center;
    padding: 24px 12px;
}

.history-list-static {
    display: flex;
    flex-direction: column;
    gap: 12px;
    padding-right: 4px;
}

.games-list li {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
}

.game-result {
    font-weight: bold;
    font-size: 13px;
    padding: 2px 6px;
    border-radius: 4px;
    flex-shrink: 0;
}

.game-result.win {
    background: rgba(143, 188, 143, 0.2);
    color: #2e7d32;
}

.game-result.lose {
    background: rgba(192, 57, 43, 0.1);
    color: var(--color-player);
}

.game-info {
    font-size: 13px;
    color: var(--text-secondary);
    text-align: right;
}

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

.sound-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 14px;
    color: var(--text-primary);
}

.sound-item input[type="checkbox"] {
    accent-color: var(--color-btn);
    width: 16px;
    height: 16px;
    cursor: pointer;
}

.sound-style-title {
    font-size: 13px;
    color: var(--text-secondary);
    font-weight: bold;
}

.sound-style-selector {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    background: var(--bg-page);
    padding: 4px;
    border-radius: 6px;
    gap: 4px;
    flex-shrink: 0;
}

.style-btn {
    border: none;
    background: transparent;
    padding: 6px 0;
    font-size: 13px;
    color: var(--text-secondary);
    cursor: pointer;
    border-radius: 4px;
    transition: all 0.2s;
    width: 100%;
    white-space: nowrap;
}

.style-btn.active {
    background: var(--color-btn);
    color: white;
    font-weight: bold;
}

.ad-slot {
    max-width: 1440px;
    margin: 0 auto 32px;
    width: calc(100% - 48px);
    min-height: 0;
    border-radius: 8px;
    box-sizing: border-box;
    flex-shrink: 0;
}

#adSlot:empty {
    display: none;
}

#adSlot:not(:empty) {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 60px;
    border: 1px dashed #ccc;
    
    color: #999;
    font-size: 14px;
    overflow: visible;
}

.content-section {
    max-width: 1440px;
    margin: 0 auto 40px;
    padding: 0 24px;
    width: 100%;
    box-sizing: border-box;
    flex-shrink: 0;
}

.ad-slot + .content-section {
    margin-top: 32px;
}

.content-tabs {
    display: flex;
    gap: 2px;
    margin-bottom: 0;
}

.content-tab {
    padding: 12px 24px;
    background: rgba(255, 255, 255, 0.5);
    border-radius: 8px 8px 0 0;
    cursor: pointer;
    font-weight: bold;
    color: var(--text-secondary);
    transition: all 0.2s;
    border: none;
}

.content-tab.active {
    background: var(--bg-card);
    color: var(--text-primary);
}

.content-card {
    background: var(--bg-card);
    padding: 32px;
    border-radius: 0 8px 8px 8px;
    box-shadow: var(--shadow-card);
}

.content-card h2 {
    color: var(--text-primary);
    margin-top: 0;
    font-size: 20px;
}

.content-card p,
.content-card li {
    color: var(--text-secondary);
    line-height: 1.8;
    font-size: 15px;
    margin-bottom: 16px;
}

.content-panel {
    display: block;
}

.js .content-panel {
    display: none;
}

.js .content-panel.active {
    display: block;
}

.qa-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-top: 8px;
}

.qa-item {
    background: var(--bg-page);
    border-radius: 10px;
    padding: 12px 14px;
    border: 1px solid rgba(0, 0, 0, 0.05);
}

.qa-item summary {
    cursor: pointer;
    font-weight: bold;
    color: var(--text-primary);
}

.qa-item p {
    margin: 10px 0 0;
}

.content-card h3 {
    color: var(--text-primary);
    font-size: 17px;
    margin: 26px 0 12px;
}

.content-card h4 {
    color: var(--text-primary);
    font-size: 15px;
    margin: 0 0 6px;
}

.rank-table-wrap {
    overflow-x: auto;
    margin: 0 0 18px;
    -webkit-overflow-scrolling: touch;
}

.rank-table {
    border-collapse: collapse;
    width: 100%;
    min-width: 480px;
    font-size: 14px;
}

.rank-table caption {
    caption-side: top;
    text-align: left;
    color: var(--text-secondary);
    font-size: 13px;
    margin-bottom: 8px;
}

.rank-table th,
.rank-table td {
    border: 1px solid rgba(0, 0, 0, 0.08);
    padding: 9px 12px;
    text-align: left;
    color: var(--text-secondary);
    line-height: 1.6;
    vertical-align: top;
}

.rank-table th {
    background: var(--bg-page);
    color: var(--text-primary);
    font-weight: bold;
    white-space: nowrap;
}

.rank-table tbody tr:nth-child(even) td {
    background: rgba(0, 0, 0, 0.018);
}

.info-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 14px;
    margin: 8px 0 18px;
}

.info-cell {
    background: var(--bg-page);
    border: 1px solid rgba(0, 0, 0, 0.05);
    border-radius: 10px;
    padding: 14px 16px;
}

.info-cell p {
    margin: 0;
    font-size: 14px;
}

.dialog-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.45);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    padding: 20px;
    box-sizing: border-box;
    animation: dialog-fade-in 0.18s ease;
}

.dialog-backdrop[hidden] {
    display: none;
}

@keyframes dialog-fade-in {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes dialog-slide-in {
    from { opacity: 0; transform: translateY(-16px) scale(0.97); }
    to { opacity: 1; transform: translateY(0) scale(1); }
}

.dialog-box {
    background: var(--bg-card);
    border-radius: 16px;
    padding: 32px 28px 24px;
    max-width: 320px;
    width: 100%;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.25);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
    animation: dialog-slide-in 0.22s ease;
}

.dialog-icon {
    font-size: 42px;
    line-height: 1;
    margin-bottom: 4px;
}

.dialog-title {
    font-size: 19px;
    font-weight: bold;
    color: var(--text-primary);
    text-align: center;
}

.dialog-body {
    font-size: 15px;
    color: var(--text-secondary);
    text-align: center;
    line-height: 1.7;
}

.dialog-actions {
    margin-top: 8px;
    width: 100%;
}

.dialog-confirm-btn {
    width: 100%;
    padding: 13px;
    font-size: 16px;
    border-radius: 8px;
}

.settings-backdrop {
    align-items: flex-end;
    justify-content: center;
    padding: 0;
}

@keyframes settings-sheet-up {
    from { transform: translateY(100%); }
    to { transform: translateY(0); }
}

.settings-dialog-box {
    background: var(--bg-card);
    width: 100%;
    max-width: 480px;
    max-height: 86vh;
    border-radius: 18px 18px 0 0;
    box-shadow: 0 -8px 40px rgba(0, 0, 0, 0.25);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    animation: settings-sheet-up 0.24s ease;
}

.settings-dialog-header {
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 18px;
    border-bottom: 1px solid rgba(0, 0, 0, 0.06);
}

.settings-dialog-title {
    font-size: 16px;
    font-weight: bold;
    color: var(--text-primary);
}

.settings-close-btn {
    width: 32px;
    height: 32px;
    border: none;
    background: transparent;
    color: var(--text-secondary);
    font-size: 26px;
    line-height: 1;
    cursor: pointer;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.settings-close-btn:active {
    background: rgba(0, 0, 0, 0.06);
}

.settings-dialog-content {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    padding: 16px;
    padding-bottom: calc(20px + env(safe-area-inset-bottom));
}

.settings-dialog-content .panel-card {
    padding: 0;
    gap: 16px;
    box-shadow: none;
    border-radius: 0;
    height: auto;
    overflow: visible;
}

.settings-dialog-content .action-buttons {
    display: none;
}

.settings-dialog-content .history {
    flex: none;
    overflow: visible;
}

.settings-dialog-content .history-content.active {
    max-height: 220px;
    overflow-y: auto;
}

.footer {
    background: var(--text-primary);
    color: rgba(255, 255, 255, 0.7);
    text-align: center;
    padding: 32px 24px;
    font-size: 14px;
    line-height: 1.8;
    margin-top: auto;
}

.footer a {
    color: white;
    text-decoration: none;
}

.footer a:hover {
    text-decoration: underline;
}

.footer .ft-main {
    font-size: 13px;
    color: rgba(255, 255, 255, 0.85);
    margin-bottom: 6px;
}

.footer .ft-sub {
    font-size: 12px;
    color: rgba(255, 255, 255, 0.6);
}

.mobile-actions,
.mobile-tabbar {
    display: none;
}

/* ===== 专注模式 ===== */
.focus-exit-btn {
    display: none;
}

body.focus-mode {
    overflow: hidden;
}

body.focus-mode .top-nav,
body.focus-mode .ad-slot,
body.focus-mode #adSlot,
body.focus-mode .content-section,
body.focus-mode .footer,
body.focus-mode .mobile-tabbar,
body.focus-mode .mobile-actions,
body.focus-mode .control-panel {
    display: none !important;
}

body.focus-mode .page-body {
    overflow: hidden;
}

body.focus-mode .above-fold {
    flex: 1;
    min-height: 0;
    display: flex;
}

body.focus-mode .game-screen {
    flex: 1;
    min-height: 0;
    width: 100%;
    max-width: none;
    margin: 0;
    padding: 14px 16px 18px;
    gap: 0;
    align-items: center;
    justify-content: center;
}

body.focus-mode .board-area {
    flex: 1;
    min-height: 0;
    width: 100%;
    justify-content: center;
}

body.focus-mode .board-container {
    flex: 0 0 auto;
    width: min(calc(100vw - 32px), calc((100dvh - 96px) * 9 / 12.8));
    height: auto;
    max-width: 100%;
    aspect-ratio: 9 / 12.8;
    margin: 0 auto;
}

body.focus-mode .focus-toggle-btn {
    background: var(--color-btn);
    color: #fff;
    border-color: var(--color-btn);
}

body.focus-mode .focus-exit-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    position: fixed;
    top: 14px;
    right: 14px;
    top: calc(14px + env(safe-area-inset-top));
    z-index: 1500;
    padding: 8px 14px;
    font-size: 14px;
    font-weight: 600;
    color: #fff;
    background: rgba(139, 94, 60, 0.92);
    border: none;
    border-radius: 999px;
    box-shadow: 0 4px 14px rgba(0, 0, 0, 0.22);
    cursor: pointer;
    -webkit-backdrop-filter: blur(4px);
    backdrop-filter: blur(4px);
}

body.focus-mode .focus-exit-btn:hover {
    background: rgba(110, 72, 44, 0.96);
}

body.focus-mode .focus-exit-btn svg {
    width: 16px;
    height: 16px;
    fill: currentColor;
}

@media (min-width: 901px) {
    .game-screen {
        align-items: flex-start;
        justify-content: center;
        padding-top: 40px;
        gap: 30px;
    }

    .board-area {
        flex: 0 0 auto;
    }

    .board-container {
        height: 720px;
        width: 506px;
        flex-shrink: 0;
    }

    .control-panel {
        flex: 0 0 380px;
        max-width: 380px;
        height: 720px;
    }

    .panel-card {
        height: 100%;
        box-sizing: border-box;
        padding: 22px;
        gap: 16px;
    }

    .history {
        margin-top: 4px;
    }

    #adSlot:not(:empty) {
        min-height: 110px;
        margin-top: 8px;
    }
}

@media (max-width: 900px) {
    .game-screen {
        flex-direction: column;
        gap: 24px;
        padding: 16px;
    }

    .control-panel {
        max-width: 100%;
    }
}

@media (max-width: 600px) {
    body {
        overflow: hidden;
        min-height: 0;
        height: 100vh;
        height: var(--mobile-vh, 100vh);
        height: 100svh;
        /* 安全区由 body 自身填充，呈现页面背景色（米白）而非导航栏/标签栏白色 */
        padding-top: env(safe-area-inset-top);
        padding-bottom: env(safe-area-inset-bottom);
        box-sizing: border-box;
    }

    .above-fold {
        flex: 0 0 100%;
        min-height: 100%;
    }

    .top-nav {
        height: 50px;
        justify-content: center;
        flex-shrink: 0;
    }

    .nav-right {
        display: none;
    }

    .brand-title {
        font-size: 20px;
    }

    .game-screen {
        flex: 1;
        min-height: 0;
        padding: 12px;
        gap: 8px;
        display: flex;
        flex-direction: column;
        max-width: 100%;
        margin: 0;
    }

    .board-area {
        flex: 1;
        min-height: 0;
        gap: 10px;
    }

    .board-container {
        flex: 1;
        min-height: 0;
        width: 100%;
        max-width: 100%;
        margin: 0 auto;
    }

    .mobile-status {
        display: block;
    }

    .top-status-wrap {
        display: none;
    }

    .mobile-status .status-bar {
        font-size: 13px;
        font-weight: normal;
        padding: 8px 12px;
    }

    .control-panel {
        display: none;
    }

    .mobile-actions {
        display: flex;
        flex-wrap: nowrap;
        width: 100%;
        gap: 8px;
        flex-shrink: 0;
        margin-bottom: 4px;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        scrollbar-width: none;
        padding-bottom: 2px;
    }

    .mobile-actions::-webkit-scrollbar {
        display: none;
    }

    .mobile-actions .btn {
        flex: 0 0 auto;
        padding: 9px 18px;
        font-size: 13px;
        font-weight: normal;
        border-radius: 8px;
        letter-spacing: 0.02em;
        white-space: nowrap;
    }

    .mobile-actions .btn-outline {
        border-color: rgba(139, 94, 60, 0.45);
        background: rgba(255, 255, 255, 0.55);
    }

    .ad-slot {
        width: calc(100% - 24px);
        margin: 8px auto 0;
        flex-shrink: 0;
    }

    .content-section {
        margin-top: 20px;
        padding: 0 12px;
    }

    .content-card {
        padding: 20px;
    }

    .content-tabs {
        overflow-x: auto;
    }

    .content-tab {
        white-space: nowrap;
    }

    .mobile-tabbar {
        display: flex;
        flex-shrink: 0;
        position: relative;
        height: 56px;
        background: var(--bg-card);
        box-shadow: 0 -2px 10px rgba(0, 0, 0, 0.05);
        justify-content: space-around;
        align-items: center;
    }

    .tab-item {
        display: flex;
        flex-direction: column;
        align-items: center;
        justify-content: center;
        font-size: 11px;
        color: var(--text-secondary);
        cursor: pointer;
        gap: 4px;
        background: transparent;
        border: none;
        padding: 0;
    }

    .tab-item.active {
        color: var(--color-btn);
        font-weight: bold;
    }

    .tab-item svg {
        width: 22px;
        height: 22px;
        fill: currentColor;
    }
}

/* 现代浏览器支持 aspect-ratio 时，恢复移动端棋盘容器的自适应宽度（由高度按 9:12.8 推算） */
@supports (aspect-ratio: 1) {
    @media (max-width: 600px) {
        .board-container {
            width: auto;
        }
    }
}
