/* ================================================================
   对称方块（symmetry-block.html）页面私有样式
   公共组件复用 common.css，本文件只写本页棋盘/计分/记录相关样式
   ================================================================ */

.main {
    grid-template-columns: minmax(0, 1fr) 400px;
}

.main .extra-panel {
    grid-column: 1 / -1;
    margin-top: 0;
}

/* ================= 难度 / 开关选择 ================= */
.diff-options {
    flex-wrap: wrap;
    gap: 8px;
}

.diff-options .radio-card {
    flex: 1 1 auto;
    min-width: 96px;
    justify-content: center;
    font-size: 13px;
    padding: 9px 10px;
}

.diff-options .radio-card input {
    accent-color: #667eea;
}

/* ================= 按钮行 ================= */
/* 首行「开始游戏」独占整行，其余三个按钮同一排均分 */
.btn-row {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 8px;
    padding: 10px 15px 15px;
    background: #ffffff;
}

.btn-row .btn {
    width: 100%;
    min-width: 0;
    justify-content: center;
    padding: 10px 8px;
    font-size: 14px;
    white-space: nowrap;
}

.btn-row .calc-btn {
    grid-column: 1 / -1;
    padding: 12px;
    font-size: 16px;
    font-weight: 600;
}

.btn-warn {
    border: 1px solid #f0c36d;
    background: #fffbeb;
    color: #b45309;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: background 0.15s, transform 0.15s, box-shadow 0.15s;
}

.btn-warn:hover {
    background: #fef3c7;
    transform: translateY(-1px);
    box-shadow: 0 2px 6px rgba(245, 158, 11, 0.2);
}

/* ================= 顶部信息条 ================= */
.game-top {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 8px;
    font-size: 13px;
    color: #6b7280;
}

.game-top b {
    color: #374151;
    font-variant-numeric: tabular-nums;
}

.chip {
    background: #eef2ff;
    color: #4338ca;
    padding: 2px 9px;
    border-radius: 20px;
    font-weight: 600;
}

.score-chip {
    font-size: 13px;
    color: #6b7280;
    background: #eef2ff;
    border-radius: 20px;
    padding: 3px 11px;
}

.score-chip b {
    color: #4338ca;
    font-size: 15px;
    font-weight: 700;
    font-variant-numeric: tabular-nums;
}

.timer {
    font-size: 15px;
    font-weight: 700;
    color: #667eea;
    font-variant-numeric: tabular-nums;
}

/* ================= 进度条 ================= */
.progress {
    height: 8px;
    background: #eef0f4;
    border-radius: 999px;
    overflow: hidden;
}

.progress-bar {
    height: 100%;
    width: 0;
    border-radius: 999px;
    background: linear-gradient(90deg, #667eea 0%, #764ba2 100%);
    transition: width 0.3s ease;
}

/* ================= 左右区域标题 ================= */
.side-caption {
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    align-items: center;
    gap: 10px;
    font-size: 12px;
    color: #6b7280;
}

.side-caption .cap {
    text-align: center;
    background: #f9fafb;
    border: 1px solid #eef0f4;
    border-radius: 999px;
    padding: 4px 8px;
    white-space: nowrap;
}

.side-caption .cap.axis {
    color: #4338ca;
    background: #eef2ff;
    border-color: #c7d2fe;
    font-weight: 600;
}

/* ================= 棋盘 ================= */
.board-wrap {
    position: relative;
    width: 100%;
    max-width: 560px;
    margin: 0 auto;
}

.sym-board {
    --cols: 3;
    --gap: 8px;
    display: grid;
    grid-template-columns: minmax(0, 1fr) 6px minmax(0, 1fr);
    gap: var(--gap);
    align-items: stretch;
    width: 100%;
    padding: 12px 10px;
    background: #f9fafb;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
}

.sym-half {
    container-type: inline-size;
    display: grid;
    grid-template-columns: repeat(var(--cols), minmax(0, 1fr));
    gap: var(--gap);
    align-content: start;
}

.sym-axis {
    position: relative;
    border-radius: 999px;
    background: linear-gradient(180deg, #c7d2fe 0%, #667eea 50%, #c7d2fe 100%);
}

/* ---- 方格 ---- */
.cell {
    position: relative;
    width: 100%;
    aspect-ratio: 1 / 1;
    padding: 0;
    border-radius: 8px;
    border: 1px solid #e5e7eb;
    background: #ffffff;
    box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.04);
    cursor: default;
    font-size: 16px;
    transition: background 0.15s, border-color 0.15s, box-shadow 0.15s, transform 0.08s;
}

/* 左侧原图 */
#leftGrid .cell {
    background: #f1f5f9;
    border-color: #e2e8f0;
    box-shadow: none;
}

#leftGrid .cell.on {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-color: #5b53c9;
    box-shadow: 0 2px 6px rgba(102, 126, 234, 0.35);
}

#leftGrid .cell.mirror-hl {
    outline: 2px solid #f59e0b;
    outline-offset: 2px;
    transform: scale(1.04);
}

/* 右侧玩家区 */
#rightGrid .cell {
    cursor: pointer;
    background: #ffffff;
}

#rightGrid .cell:hover {
    border-color: #667eea;
    transform: translateY(-1px);
    box-shadow: 0 3px 8px rgba(102, 126, 234, 0.25);
}

#rightGrid .cell.on {
    background: linear-gradient(135deg, #fbbf24 0%, #f59e0b 100%);
    border-color: #d97706;
    box-shadow: 0 2px 6px rgba(245, 158, 11, 0.35);
}

#rightGrid .cell.hit {
    background: linear-gradient(135deg, #4ade80 0%, #16a34a 100%);
    border-color: #15803d;
    box-shadow: 0 2px 6px rgba(22, 163, 74, 0.35);
    cursor: default;
}

#rightGrid .cell.hit::after {
    content: '✓';
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 7cqw;
    font-weight: 700;
    color: #ffffff;
    line-height: 1;
    pointer-events: none;
}

#rightGrid .cell.hit:hover {
    transform: none;
    box-shadow: 0 2px 6px rgba(22, 163, 74, 0.35);
}

#rightGrid .cell.bad {
    background: linear-gradient(135deg, #f87171 0%, #ef4444 100%);
    border-color: #dc2626;
    animation: badflash 0.62s ease;
}

#rightGrid .cell.pop {
    animation: hitpop 0.38s ease;
}

#rightGrid .cell.hint {
    outline: 3px solid #f59e0b;
    outline-offset: 2px;
    animation: hintpulse 0.6s ease-in-out infinite;
}

#rightGrid .cell.preview {
    background: #dcfce7;
    border-color: #22c55e;
    box-shadow: none;
    animation: hintpulse 0.6s ease-in-out infinite;
}

#rightGrid .cell.preview::after {
    content: '';
}

@keyframes badflash {
    0% { transform: scale(1); }
    25% { transform: scale(0.86); }
    100% { transform: scale(1); }
}

@keyframes hitpop {
    0% { transform: scale(1); }
    45% { transform: scale(1.12); }
    100% { transform: scale(1); }
}

@keyframes hintpulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.45; }
}

/* ---- 覆盖层 ---- */
.board-mask {
    position: absolute;
    inset: 0;
    background: rgba(255, 255, 255, 0.78);
    border-radius: 8px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 10px;
    z-index: 5;
    text-align: center;
    padding: 20px;
}

.board-mask .big {
    font-size: 40px;
}

.board-mask .txt {
    font-size: 15px;
    color: #374151;
    font-weight: 600;
}

.board-mask .sub {
    font-size: 12px;
    color: #9ca3af;
}

.board-mask.hidden {
    display: none;
}

/* ================= 统计 ================= */
.stat-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 8px;
}

.stat {
    background: #f9fafb;
    border: 1px solid #eef0f4;
    border-radius: 8px;
    padding: 10px 6px;
    text-align: center;
}

.stat b {
    display: block;
    font-size: 17px;
    color: #4338ca;
    font-variant-numeric: tabular-nums;
}

.stat span {
    font-size: 11px;
    color: #6b7280;
}

.level-bar {
    display: flex;
    justify-content: space-between;
    gap: 8px;
    font-size: 12px;
    color: #6b7280;
    background: #f9fafb;
    border: 1px solid #eef0f4;
    border-radius: 8px;
    padding: 8px 10px;
}

.level-bar b {
    color: #374151;
    font-variant-numeric: tabular-nums;
}

/* ================= 历史成绩 ================= */
.record-title {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 13px;
    font-weight: 600;
    color: #374151;
}

.record-title .link-btn {
    background: none;
    border: none;
    font-size: 12px;
    color: #9ca3af;
    cursor: pointer;
    padding: 0;
}

.record-title .link-btn:hover {
    color: #ef4444;
}

.record-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 8px;
    padding: 8px 0;
    border-bottom: 1px dashed #f3f4f6;
    font-size: 13px;
    color: #4b5563;
    font-variant-numeric: tabular-nums;
}

.record-item:last-child {
    border-bottom: none;
}

.record-item .rec-time {
    font-weight: 600;
    color: #374151;
}

.record-item .rec-date {
    font-size: 12px;
    color: #9ca3af;
}

.record-item.best .rec-time {
    color: #4338ca;
}

/* ================= 说明文案 ================= */
.seo-article ol {
    list-style: decimal;
    padding-left: 22px;
    margin: 0;
}

.seo-article ol li {
    margin-bottom: 8px;
}

.seo-article ul li {
    margin-bottom: 6px;
}

/* ================= 响应式 ================= */
@media (max-width: 900px) {
    .main {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 600px) {
    .sym-board {
        --gap: 6px;
        grid-template-columns: minmax(0, 1fr) 4px minmax(0, 1fr);
        padding: 10px 8px;
    }

    .cell {
        border-radius: 6px;
    }

    .side-caption {
        font-size: 11px;
        gap: 6px;
    }

    .side-caption .cap {
        padding: 3px 5px;
    }

    .btn-row {
        padding: 10px 12px 12px;
        gap: 6px;
    }

    /* 三个次要按钮同排：缩小字号与内边距，避免文字换行撑高 */
    .btn-row .btn {
        padding: 9px 4px;
        font-size: 12px;
    }

    .btn-row .calc-btn {
        padding: 12px;
        font-size: 16px;
    }

    .stat-grid {
        gap: 6px;
    }

    .stat b {
        font-size: 15px;
    }

    .stat span {
        font-size: 10px;
    }
}

@media (max-width: 400px) {
    .sym-board {
        --gap: 4px;
        padding: 8px 6px;
    }

    .side-caption .cap {
        font-size: 10px;
    }

    .btn-row .btn {
        padding: 9px 2px;
        font-size: 11px;
    }
}
