/* ============================================================
   喵星推理 - 猫抓老鼠 游戏样式
   ============================================================ */

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent;
}

body.mx-game-page {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'PingFang SC', 'Hiragino Sans GB', 'Microsoft YaHei', sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: flex-start;
    padding: 10px;
}

.mx-game-container {
    width: 100%;
    max-width: 420px;
    background: #fff;
    border-radius: 20px;
    padding: 16px;
    box-shadow: 0 10px 40px rgba(0,0,0,0.2);
    position: relative;
}

/* ===== 顶部状态栏 ===== */
.mx-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 10px;
}

.mx-back-btn {
    width: 36px;
    height: 36px;
    border: none;
    background: #f0f0f0;
    border-radius: 50%;
    font-size: 18px;
    cursor: pointer;
    color: #333;
    display: flex;
    align-items: center;
    justify-content: center;
}

.mx-back-btn:active {
    background: #e0e0e0;
}

.mx-share-btn {
    width: 36px;
    height: 36px;
    border: none;
    background: #f0f0f0;
    border-radius: 50%;
    font-size: 16px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.mx-share-btn:active {
    background: #e0e0e0;
    transform: scale(0.95);
}

.mx-level-info {
    text-align: center;
    flex: 1;
}

.mx-level-name {
    font-size: 16px;
    font-weight: bold;
    color: #333;
    margin-right: 6px;
}

.mx-guanqia {
    font-size: 14px;
    color: #888;
}

.mx-lives {
    display: flex;
    gap: 2px;
    flex-wrap: wrap;
    justify-content: flex-end;
    max-width: 100px;
}

.mx-life {
    font-size: 14px;
    transition: all 0.3s;
}

.mx-life.inactive {
    opacity: 0.3;
    filter: grayscale(1);
}

/* ===== 金币栏 ===== */
.mx-gold-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: linear-gradient(135deg, #fff9e6 0%, #fff3cd 100%);
    border-radius: 12px;
    padding: 8px 14px;
    margin-bottom: 10px;
}

.mx-gold {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 16px;
    font-weight: bold;
    color: #f5a623;
}

.mx-gold-icon {
    font-size: 18px;
}

.mx-timer {
    font-size: 14px;
    color: #888;
    font-weight: 500;
}

/* ===== 规则提示 ===== */
.mx-rules {
    display: flex;
    justify-content: space-around;
    margin-bottom: 12px;
    gap: 6px;
}

.mx-rule-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    flex: 1;
}

.mx-rule-icon {
    font-size: 20px;
    background: #f5f5f5;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.mx-rule-text {
    font-size: 10px;
    color: #888;
    text-align: center;
    line-height: 1.3;
}

/* ===== 进度条 ===== */
.mx-progress-bar {
    margin-bottom: 14px;
}

.mx-progress-label {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    font-size: 14px;
    font-weight: bold;
    color: #333;
    margin-bottom: 6px;
}

.mx-mouse-icon {
    font-size: 18px;
}

.mx-progress-track {
    height: 10px;
    background: #f0f0f0;
    border-radius: 5px;
    overflow: hidden;
}

.mx-progress-fill {
    height: 100%;
    background: linear-gradient(90deg, #4caf50, #8bc34a);
    border-radius: 5px;
    transition: width 0.5s ease;
}

/* ===== 棋盘 ===== */
.mx-board-wrapper {
    position: relative;
    display: flex;
    justify-content: center;
    margin-bottom: 16px;
    min-height: 200px;
}

.mx-board {
    display: grid;
    gap: 3px;
    background: #ddd;
    padding: 6px;
    border-radius: 12px;
    box-shadow: inset 0 2px 8px rgba(0,0,0,0.1);
}

.mx-cell {
    width: 100%;
    aspect-ratio: 1;
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.15s;
    position: relative;
    min-width: 28px;
    min-height: 28px;
}

.mx-cell:active {
    transform: scale(0.92);
}

.mx-cell.cat-cell {
    background: #ffd54f !important;
    box-shadow: 0 0 8px rgba(255,193,7,0.5);
}

.mx-cell.bomb-cell {
    background: #ef5350 !important;
    box-shadow: 0 0 8px rgba(239,83,80,0.4);
}

.mx-cell.mark-cell {
    position: relative;
}

.mx-cell-cat {
    font-size: 22px;
    animation: catPop 0.3s ease;
}

.mx-cell-bomb {
    font-size: 22px;
    animation: bombShake 0.4s ease;
}

.mx-cell-mark {
    font-size: 24px;
    font-weight: bold;
    color: #fff;
    text-shadow: 0 1px 3px rgba(0,0,0,0.3);
}

@keyframes catPop {
    0% { transform: scale(0); }
    60% { transform: scale(1.3); }
    100% { transform: scale(1); }
}

@keyframes bombShake {
    0%, 100% { transform: translateX(0); }
    20% { transform: translateX(-3px) rotate(-5deg); }
    40% { transform: translateX(3px) rotate(5deg); }
    60% { transform: translateX(-2px) rotate(-3deg); }
    80% { transform: translateX(2px) rotate(3deg); }
}

/* 猫在棋盘外等待 */
.mx-cat-waiting {
    position: absolute;
    right: -10px;
    top: 50%;
    transform: translateY(-50%);
    display: flex;
    flex-direction: column;
    align-items: center;
    animation: catBounce 2s ease-in-out infinite;
}

.mx-cat-emoji {
    font-size: 32px;
}

.mx-cat-bubble {
    background: #fff;
    padding: 4px 10px;
    border-radius: 12px;
    font-size: 11px;
    color: #666;
    white-space: nowrap;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    margin-top: 4px;
    position: relative;
}

.mx-cat-bubble::before {
    content: '';
    position: absolute;
    top: -6px;
    left: 50%;
    transform: translateX(-50%);
    border: 6px solid transparent;
    border-bottom-color: #fff;
}

@keyframes catBounce {
    0%, 100% { transform: translateY(-50%); }
    50% { transform: translateY(calc(-50% - 6px)); }
}

/* ===== 底部操作栏 ===== */
.mx-bottom-bar {
    display: flex;
    gap: 10px;
    justify-content: center;
}

.mx-action-btn {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    padding: 10px 6px;
    border: 2px solid #e0e0e0;
    background: #fff;
    border-radius: 14px;
    cursor: pointer;
    transition: all 0.2s;
    position: relative;
}

.mx-action-btn:active {
    transform: scale(0.95);
}

.mx-action-btn.active {
    border-color: #ff9800;
    background: #fff3e0;
}

.mx-action-icon {
    font-size: 22px;
}

.mx-action-btn span:last-child {
    font-size: 12px;
    color: #666;
    font-weight: 500;
}

.mx-action-btn.active span:last-child {
    color: #ff9800;
}

.mx-tool-badge {
    position: absolute;
    top: 2px;
    right: 4px;
    background: #4caf50;
    color: #fff;
    font-size: 9px;
    padding: 1px 5px;
    border-radius: 8px;
}

/* ===== Toast提示 ===== */
.mx-toast {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%) scale(0.8);
    background: rgba(0,0,0,0.8);
    color: #fff;
    padding: 12px 24px;
    border-radius: 12px;
    font-size: 14px;
    z-index: 1000;
    opacity: 0;
    transition: all 0.3s;
    pointer-events: none;
    max-width: 80%;
    text-align: center;
}

.mx-toast.show {
    opacity: 1;
    transform: translate(-50%, -50%) scale(1);
}

/* ===== 弹窗 ===== */
.mx-modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0,0,0,0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 999;
    padding: 20px;
}

.mx-modal-content {
    background: #fff;
    border-radius: 20px;
    padding: 24px;
    width: 100%;
    max-width: 340px;
    text-align: center;
    animation: modalPop 0.3s ease;
}

@keyframes modalPop {
    0% { transform: scale(0.7); opacity: 0; }
    100% { transform: scale(1); opacity: 1; }
}

.mx-win-emoji, .mx-lose-emoji {
    font-size: 48px;
    margin-bottom: 12px;
}

.mx-win-title {
    font-size: 20px;
    color: #333;
    margin-bottom: 12px;
}

.mx-lose-title {
    font-size: 20px;
    color: #e53935;
    margin-bottom: 8px;
}

.mx-lose-desc {
    font-size: 14px;
    color: #888;
    margin-bottom: 20px;
}

.mx-win-stars {
    font-size: 32px;
    margin-bottom: 16px;
    letter-spacing: 4px;
}

.mx-star {
    color: #ddd;
}

.mx-star.active {
    color: #ffc107;
    text-shadow: 0 0 8px rgba(255,193,7,0.5);
}

.mx-win-info {
    background: #f9f9f9;
    border-radius: 12px;
    padding: 14px;
    margin-bottom: 20px;
    font-size: 14px;
    color: #666;
    line-height: 2;
}

.mx-win-actions {
    display: flex;
    gap: 10px;
}

.mx-win-btn {
    flex: 1;
    padding: 12px;
    border: none;
    background: linear-gradient(135deg, #667eea, #764ba2);
    color: #fff;
    border-radius: 12px;
    font-size: 15px;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.2s;
}

.mx-win-btn:active {
    transform: scale(0.95);
}

.mx-win-btn.secondary {
    background: #f0f0f0;
    color: #666;
}

/* ===== 工具面板 ===== */
.mx-tool-panel {
    max-width: 360px;
    text-align: left;
    padding: 0;
    overflow: hidden;
}

.mx-modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 20px;
    border-bottom: 1px solid #f0f0f0;
}

.mx-modal-header h3 {
    font-size: 17px;
    color: #333;
}

.mx-close-btn {
    width: 30px;
    height: 30px;
    border: none;
    background: #f5f5f5;
    border-radius: 50%;
    font-size: 14px;
    cursor: pointer;
    color: #888;
    display: flex;
    align-items: center;
    justify-content: center;
}

.mx-tool-list {
    max-height: 400px;
    overflow-y: auto;
    padding: 12px;
}

.mx-tool-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px;
    background: #fafafa;
    border-radius: 12px;
    margin-bottom: 10px;
}

.mx-tool-icon {
    font-size: 32px;
    width: 48px;
    height: 48px;
    background: #fff;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.mx-tool-info {
    flex: 1;
    min-width: 0;
}

.mx-tool-name {
    font-size: 15px;
    font-weight: bold;
    color: #333;
    margin-bottom: 2px;
    display: flex;
    align-items: center;
    gap: 6px;
}

.mx-tool-tag {
    font-size: 10px;
    padding: 1px 6px;
    border-radius: 6px;
    font-weight: normal;
}

.mx-tool-tag:first-of-type {
    background: #e8f0fe;
    color: #4f6ef2;
}

.mx-tool-tag:last-of-type {
    background: #fff4e5;
    color: #f5a623;
}

.mx-tool-desc {
    font-size: 11px;
    color: #999;
    line-height: 1.4;
    margin-bottom: 2px;
}

.mx-tool-owned {
    font-size: 11px;
    color: #4caf50;
    font-weight: 500;
}

.mx-tool-actions {
    display: flex;
    flex-direction: column;
    gap: 6px;
    flex-shrink: 0;
}

.mx-tool-buy-btn {
    background: linear-gradient(135deg, #ffd54f, #ffb300);
    border: none;
    color: #5d4037;
    padding: 6px 10px;
    border-radius: 8px;
    font-size: 11px;
    font-weight: bold;
    cursor: pointer;
    line-height: 1.3;
    min-width: 56px;
}

.mx-tool-buy-btn:active {
    transform: scale(0.95);
}

.mx-tool-use-btn {
    background: linear-gradient(135deg, #81c784, #4caf50);
    border: none;
    color: #fff;
    padding: 6px 10px;
    border-radius: 8px;
    font-size: 11px;
    font-weight: bold;
    cursor: pointer;
    min-width: 56px;
}

.mx-tool-use-btn:active {
    transform: scale(0.95);
}

.mx-tool-owned-badge {
    background: #e8f5e9;
    color: #4caf50;
    padding: 6px 10px;
    border-radius: 8px;
    font-size: 11px;
    font-weight: bold;
    text-align: center;
}

.mx-tool-tip {
    padding: 10px 16px;
    background: #f5f5f5;
    font-size: 11px;
    color: #999;
    text-align: center;
    border-top: 1px solid #f0f0f0;
}

/* ===== 响应式 ===== */
@media (max-width: 360px) {
    .mx-game-container {
        padding: 12px;
    }
    .mx-rule-text {
        font-size: 9px;
    }
    .mx-cell-cat, .mx-cell-bomb {
        font-size: 18px;
    }
    .mx-cell-mark {
        font-size: 20px;
    }
}

/* ============================================================
   首页样式（mx-home）
   与游戏页保持同一视觉风格：紫色渐变背景 + 白色圆角卡片
   ============================================================ */

body.mx-home {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'PingFang SC', 'Hiragino Sans GB', 'Microsoft YaHei', sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: flex-start;
    padding: 24px 12px 40px;
}

body.mx-home .mx-container {
    width: 100%;
    max-width: 420px;
}

/* ---- 顶部标题 ---- */
body.mx-home .mx-header {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    margin-bottom: 18px;
    text-align: center;
}

body.mx-home .mx-logo {
    width: 64px;
    height: 64px;
    background: rgba(255,255,255,0.18);
    border: 1px solid rgba(255,255,255,0.3);
    border-radius: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 36px;
    margin-bottom: 4px;
    box-shadow: 0 8px 24px rgba(0,0,0,0.15);
}

body.mx-home .mx-title {
    font-size: 26px;
    font-weight: 800;
    color: #fff;
    letter-spacing: 2px;
    text-shadow: 0 2px 12px rgba(0,0,0,0.15);
}

body.mx-home .mx-subtitle {
    font-size: 13px;
    color: rgba(255,255,255,0.8);
    letter-spacing: 0.5px;
}

/* ---- 统计卡片 ---- */
body.mx-home .mx-stats {
    display: flex;
    gap: 10px;
    margin-bottom: 20px;
}

body.mx-home .mx-stat-item {
    flex: 1;
    background: rgba(255,255,255,0.16);
    border: 1px solid rgba(255,255,255,0.25);
    border-radius: 16px;
    padding: 14px 6px;
    text-align: center;
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
}

body.mx-home .mx-stat-num {
    font-size: 22px;
    font-weight: 800;
    color: #fff;
    margin-bottom: 4px;
}

body.mx-home .mx-stat-label {
    font-size: 11px;
    color: rgba(255,255,255,0.75);
}

/* ---- 区块标题 ---- */
body.mx-home .mx-section-title {
    font-size: 16px;
    font-weight: 700;
    color: #333;
    margin-bottom: 12px;
}

/* ---- 白色内容卡片 ---- */
body.mx-home .mx-levels,
body.mx-home .mx-guanqia-panel,
body.mx-home .mx-rules {
    background: #fff;
    border-radius: 20px;
    padding: 18px 16px;
    margin-bottom: 14px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.12);
}

/* ---- 难度选择网格 ---- */
body.mx-home .mx-level-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
}

body.mx-home .mx-level-card {
    border: 2px solid #e0e0e0;
    border-radius: 14px;
    padding: 14px 10px;
    text-align: center;
    cursor: pointer;
    transition: all 0.2s;
    position: relative;
    background: #fafafa;
}

body.mx-home .mx-level-card:active {
    transform: scale(0.96);
}

body.mx-home .mx-level-card.locked {
    border-color: #d0d0d0 !important;
    background: #f2f2f2;
    cursor: not-allowed;
}

body.mx-home .mx-level-badge {
    width: 34px;
    height: 34px;
    border-radius: 50%;
    color: #fff;
    font-size: 16px;
    font-weight: 800;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 8px;
    box-shadow: 0 4px 10px rgba(0,0,0,0.2);
}

body.mx-home .mx-level-card.locked .mx-level-badge {
    background: #bdbdbd !important;
    box-shadow: none;
}

body.mx-home .mx-level-name {
    font-size: 15px;
    font-weight: 700;
    color: #333;
    margin-bottom: 3px;
    margin-right: 0;
    text-align: center;
}

body.mx-home .mx-level-card.locked .mx-level-name {
    color: #999;
}

body.mx-home .mx-level-info {
    font-size: 11px;
    color: #999;
    margin-bottom: 6px;
}

body.mx-home .mx-level-progress {
    font-size: 11px;
    color: #666;
    margin-bottom: 8px;
}

body.mx-home .mx-level-play {
    font-size: 12px;
    font-weight: 700;
    color: #667eea;
}

body.mx-home .mx-level-lock {
    font-size: 12px;
    color: #aaa;
}

/* ---- 关卡选择 ---- */
body.mx-home .mx-guanqia-header {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 14px;
}

body.mx-home .mx-guanqia-title {
    font-size: 16px;
    font-weight: 700;
    color: #333;
    flex: 1;
}

body.mx-home .mx-guanqia-grid {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 8px;
}

body.mx-home .mx-guanqia-item {
    background: #f5f5f5;
    border-radius: 10px;
    padding: 8px 2px;
    text-align: center;
    cursor: pointer;
    transition: all 0.2s;
    border: 1px solid transparent;
}

body.mx-home .mx-guanqia-item:active {
    transform: scale(0.92);
}

body.mx-home .mx-guanqia-item.completed {
    background: #e8f5e9;
    border-color: #a5d6a7;
}

body.mx-home .mx-guanqia-num {
    font-size: 14px;
    font-weight: 700;
    color: #555;
    margin-bottom: 2px;
}

body.mx-home .mx-guanqia-stars {
    font-size: 9px;
    letter-spacing: 0;
    color: #ddd;
    white-space: nowrap;
}

body.mx-home .mx-guanqia-stars .mx-star.active {
    color: #ffc107;
    text-shadow: none;
}

/* ---- 游戏规则 ---- */
body.mx-home .mx-rule-list {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
}

body.mx-home .mx-rule-item {
    display: flex;
    align-items: center;
    gap: 10px;
    background: #f8f8fc;
    border-radius: 12px;
    padding: 12px 10px;
    font-size: 12px;
    color: #555;
    line-height: 1.5;
}

body.mx-home .mx-rule-item:last-child {
    grid-column: 1 / -1;
    justify-content: center;
}

body.mx-home .mx-rule-item strong {
    color: #667eea;
}

body.mx-home .mx-rule-icon {
    font-size: 18px;
    background: #fff;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    box-shadow: 0 2px 6px rgba(0,0,0,0.08);
}

/* ---- 底部 ---- */
body.mx-home .mx-footer {
    text-align: center;
    font-size: 12px;
    color: rgba(255,255,255,0.7);
    padding: 10px 0;
    line-height: 1.8;
}

body.mx-home .mx-footer a {
    color: #fff;
    text-decoration: none;
    font-weight: 600;
    border-bottom: 1px solid rgba(255,255,255,0.4);
}

@media (max-width: 360px) {
    body.mx-home .mx-guanqia-grid {
        grid-template-columns: repeat(5, 1fr);
        gap: 6px;
    }
    body.mx-home .mx-guanqia-num {
        font-size: 13px;
    }
    body.mx-home .mx-rule-item {
        font-size: 11px;
        padding: 10px 8px;
    }
}

/* ============================================================
   喵星推理 v4：反馈视频浮层 / 金币续命 / 猫飞扑动画
   ============================================================ */

/* ---- 反馈视频浮层 ---- */
.mx-video-overlay {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0, 0, 0, 0.75);
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-direction: column;
    animation: mx-overlay-in 0.2s ease;
}
@keyframes mx-overlay-in {
    from { opacity: 0; }
    to { opacity: 1; }
}
.mx-video-player {
    width: 78vw;
    max-width: 420px;
    aspect-ratio: 1 / 1;
    border-radius: 16px;
    background: #000;
    box-shadow: 0 8px 40px rgba(0,0,0,0.5);
    object-fit: cover;
}
.mx-video-skip {
    margin-top: 14px;
    color: rgba(255,255,255,0.85);
    font-size: 13px;
    background: rgba(255,255,255,0.15);
    padding: 8px 22px;
    border-radius: 20px;
    cursor: pointer;
    user-select: none;
}
.mx-video-skip:active { background: rgba(255,255,255,0.3); }

/* ---- 猫飞扑动画元素 ---- */
.mx-flying-cat {
    position: fixed;
    width: 40px;
    height: 40px;
    font-size: 36px;
    line-height: 40px;
    text-align: center;
    z-index: 9998;
    pointer-events: none;
    filter: drop-shadow(0 4px 8px rgba(0,0,0,0.35));
}

/* ---- 金币续命弹窗 ---- */
.mx-xuming-box {
    background: linear-gradient(135deg, #fff8e1, #ffe0b2);
    border: 2px solid #ffb300;
    border-radius: 14px;
    padding: 14px;
    margin: 12px 0;
    text-align: center;
}
.mx-xuming-info {
    display: flex;
    justify-content: center;
    gap: 16px;
    font-size: 13px;
    font-weight: bold;
    color: #e65100;
    margin-bottom: 8px;
}
.mx-xuming-gold {
    font-size: 13px;
    color: #795548;
    margin-bottom: 10px;
}
.mx-xuming-btn {
    width: 100%;
    padding: 12px;
    background: linear-gradient(135deg, #ff9800, #f57c00);
    color: #fff;
    border: none;
    border-radius: 10px;
    font-size: 15px;
    font-weight: bold;
    cursor: pointer;
    box-shadow: 0 4px 14px rgba(255,152,0,0.35);
    transition: 0.2s;
}
.mx-xuming-btn:hover { transform: translateY(-1px); }
.mx-xuming-btn:disabled { opacity: 0.6; cursor: not-allowed; transform: none; }
