/* game_match.css 补全 */

/* static/css/game_match.css */

/* 🟢 补全：连连看最外层包裹容器 */
.match-game-wrapper {
    width: 100%;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    background: transparent; /* 保持显示主页的背景色 */
    position: relative;
    z-index: 5;
}

/* 确保游戏说明文字可见 */
.match-game-wrapper div[style*="text-align: center"] {
    position: relative;
    z-index: 11;
    margin-top: 10px;
}

/* 容器：固定 3x4 网格 */
.match-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    grid-template-rows: repeat(4, 1fr);
    gap: 12px;
    width: 100%;
    max-width: 800px;
    margin: 0 auto;
    padding: 15px;
    height: 70vh; /* 占据屏幕大部分高度 */
    box-sizing: border-box;
}

/* 卡片基础样式 */
.match-card {
    display: flex;           /* 🟢 开启弹性布局 */
    align-items: center;     /* 🟢 核心：让内部文字容器在垂直方向“绝对居中” */
    justify-content: center;   /* 🟢 核心：让内部文字容器在水平方向“绝对居中” */
    
    background: #fff;
    border: 2px solid #ebedf0;
    border-radius: 12px;
    height: 100%;            /* 确保填满格子高度 */
    padding: 4px;            /* 留一点点边距，别让文字撞到边框 */
    box-sizing: border-box;

    transition: all 0.2s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    box-shadow: 0 2px 8px rgba(0,0,0,0.04);
}

/* 内容容器：处理长汉字的核心 */
.card-inner-text {
    width: 100%;              /* 撑满外层宽度，以便知道在哪儿该折行 */
    word-break: break-all;     /* 🟢 方案 C 核心：允许在任何字母处强行换行 */
    white-space: normal;       /* 允许正常换行 */
    text-align: center;        /* 文字在容器内横向居中 */

    /* 响应式字号：手机小，大屏大 */
    font-size: clamp(13px, 3.5vw, 18px);
    line-height: 1.3;

    color: #323233;
    font-weight: 500;

    /* 多行截断逻辑：大屏幕由于格子大，自然能显示更多字 */
    display: -webkit-box;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 3; 
    line-clamp: 3;         /* 🟢 新增：这是标准写法，消除报错 */
    overflow: hidden;
    text-overflow: ellipsis;
}

/* 选中状态 */
.match-card.is-selected {
    border-color: #1989fa;
    background-color: #f0f7ff;
    transform: scale(0.95);
}

/* 错误状态：红色+抖动 */
.match-card.is-error {
    border-color: #ee0a24;
    background-color: #fff0f0;
    animation: match-shake 0.4s;
}

/* 消除状态：隐形但占位 */
.match-card.is-matched {
    visibility: hidden;
    pointer-events: none;
}

@keyframes match-shake {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-4px); }
    75% { transform: translateX(4px); }
}

/* 大屏幕适配：显示更多行数 */
@media (min-width: 768px) {
    .match-grid { gap: 20px; height: 60vh; }
    .card-inner-text { -webkit-line-clamp: 5; line-clamp: 5;} 

}


/* static/css/game_match.css */

.leaderboard-link {
    color: #1989fa;          /* Vant 标准蓝色 */
    font-size: 13px;
    cursor: pointer;
    text-decoration: underline; /* 下划线增加链接感 */
    padding: 5px 10px;
    transition: opacity 0.2s;
}

.leaderboard-link:active {
    opacity: 0.7;            /* 点击时的反馈效果 */
}

/* static/css/game_match.css */

.leaderboard-link-wrapper {
    /* 🟢 关键：让宽度正好包裹文字，然后通过 auto 边距水平居中 */
    display: block;
    width: fit-content;
    margin: 30px auto 10px; 
    
    cursor: pointer;
    padding: 8px 20px;
    background: rgba(255, 255, 255, 0.15);
    border-radius: 20px;
    backdrop-filter: blur(5px);
    border: 1px solid rgba(255, 255, 255, 0.2);
    transition: all 0.3s ease;
}

.leaderboard-text {
    color: #ffffff;
    font-size: 14px;
    text-decoration: underline;
}

.leaderboard-link-wrapper:active {
    transform: scale(0.95);
    background: rgba(255, 255, 255, 0.25);
}