/* ============================================================
   化了个学 · 全局样式 (hlgx_style.css)
   ============================================================ */
* { margin: 0; padding: 0; box-sizing: border-box; }

body {
    font-family: "Microsoft YaHei", "PingFang SC", "Segoe UI", sans-serif;
    background: linear-gradient(160deg, #eef2ff 0%, #e0f2fe 100%);
    color: #1e293b;
    min-height: 100vh;
}

/* ---------------- 大厅页 ---------------- */
.hub-page { padding: 2.5rem 1.5rem; }

.hlgx-header { text-align: center; margin-bottom: 2.5rem; }
.hlgx-header h1 { font-size: 2.6rem; color: #1d4ed8; }
.hlgx-header .subtitle { color: #64748b; margin-top: .5rem; font-size: 1.05rem; }

.hub-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
    gap: 1.5rem;
    max-width: 1000px;
    margin: 0 auto;
}

.hlgx-card {
    display: flex;
    flex-direction: column;
    gap: .75rem;
    background: #fff;
    border-radius: 16px;
    padding: 1.75rem;
    text-decoration: none;
    color: inherit;
    box-shadow: 0 6px 24px rgba(29, 78, 216, .10);
    border: 1px solid #e2e8f0;
    transition: transform .18s ease, box-shadow .18s ease;
}
.hlgx-card.playable:hover { transform: translateY(-4px); box-shadow: 0 12px 32px rgba(29, 78, 216, .20); }
.hlgx-card .card-icon { font-size: 2.6rem; }
.hlgx-card h2 { color: #1e293b; font-size: 1.35rem; }
.hlgx-card p { color: #64748b; font-size: .95rem; line-height: 1.6; flex: 1; }

.card-status {
    align-self: flex-start;
    padding: .25rem .8rem;
    border-radius: 999px;
    font-size: .85rem;
    font-weight: 600;
}
.card-status.ready { background: #dcfce7; color: #15803d; }
.card-status.soon  { background: #f1f5f9; color: #64748b; }

.hlgx-card.coming { background: #f8fafc; border-style: dashed; }
.hlgx-card.coming h2 { color: #94a3b8; }

.hlgx-footer { text-align: center; color: #94a3b8; margin-top: 3rem; font-size: .9rem; }

/* ---------------- 游戏页 ---------------- */
.game-page { padding: 1.2rem 1rem 2.5rem; }

.game-top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    max-width: 640px;
    margin: 0 auto 1rem;
    gap: .6rem;
}
.game-top .back { color: #1d4ed8; text-decoration: none; font-weight: 600; }
.game-top .back:hover { text-decoration: underline; }
.game-top .title { font-size: 1.25rem; font-weight: 700; color: #1e293b; }
.game-top .remain { color: #475569; font-size: .95rem; }
.game-top .remain b { color: #dc2626; }

/* 难度选择 + 音效按钮 */
.hlgx-controls {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 1rem;
    max-width: 640px;
    margin: 0 auto .9rem;
    flex-wrap: wrap;
}
.hlgx-diff { display: flex; align-items: center; gap: .4rem; }
.hlgx-diff .diff-label { color: #64748b; font-size: .9rem; }
.hlgx-diff button,
.mute-btn {
    background: #fff;
    border: 1px solid #cbd5e1;
    border-radius: 8px;
    padding: .35rem .9rem;
    font-size: .9rem;
    cursor: pointer;
    color: #334155;
    transition: background .15s ease;
}
.hlgx-diff button:hover,
.mute-btn:hover { background: #eef2ff; }
.hlgx-diff button.active {
    background: #1d4ed8;
    border-color: #1d4ed8;
    color: #fff;
    font-weight: 600;
}

#hlgx-board-wrap {
    display: flex;
    justify-content: center;
    overflow-x: auto;
    padding: .5rem 0;
}
#hlgx-board { position: relative; margin: 0 auto; }

/* 物质方块 */
.hlgx-tile {
    position: absolute;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 1px;
    border-radius: 9px;
    color: #fff;
    cursor: pointer;
    box-shadow: 0 3px 6px rgba(0,0,0,.22), inset 0 1px 0 rgba(255,255,255,.25);
    user-select: none;
    transition: transform .16s ease, opacity .16s ease, filter .16s ease;
    text-shadow: 0 1px 2px rgba(0,0,0,.35);
}
.hlgx-tile .f { font-weight: 800; line-height: 1.1; }
.hlgx-tile .n { font-size: 9px; opacity: .92; letter-spacing: .3px; }
.hlgx-tile:hover { transform: scale(1.06); filter: brightness(1.08); }
.hlgx-tile.blocked { filter: brightness(.6) saturate(.45); }
.hlgx-tile.blocked::after {
    content: "";
    position: absolute;
    inset: 0;
    border-radius: 9px;
    background: rgba(0, 0, 0, .35);
    pointer-events: none;
}
.hlgx-tile.removed { transform: scale(0); opacity: 0; pointer-events: none; }
.hlgx-tile.matched { animation: hlgxPop .35s ease forwards; }
.hlgx-tile.shake { animation: hlgxShake .3s ease; }

@keyframes hlgxPop {
    0%   { transform: scale(.2); opacity: 1; }
    60%  { transform: scale(1.18); opacity: 1; }
    100% { transform: scale(0); opacity: 0; }
}
@keyframes hlgxShake {
    0%,100% { transform: translateX(0); }
    25% { transform: translateX(-5px); }
    75% { transform: translateX(5px); }
}

/* 物质分类配色 */
.cat-metal    { background: linear-gradient(145deg, #6b8cae, #4d6e90); }
.cat-nonmetal { background: linear-gradient(145deg, #3bb3a3, #1f8a7c); }
.cat-oxide    { background: linear-gradient(145deg, #f59e0b, #d97706); }
.cat-acid     { background: linear-gradient(145deg, #ef4444, #b91c1c); }
.cat-base     { background: linear-gradient(145deg, #8b5cf6, #6d28d9); }
.cat-salt     { background: linear-gradient(145deg, #22c55e, #15803d); }
.cat-organic  { background: linear-gradient(145deg, #b45309, #92400e); }

/* 卡牌位置配色(8色,同层相邻块不同色,与物质类别无关) */
.hlgx-color-0 { background: linear-gradient(145deg, #f43f5e, #be123c); }
.hlgx-color-1 { background: linear-gradient(145deg, #fb923c, #c2410c); }
.hlgx-color-2 { background: linear-gradient(145deg, #eab308, #a16207); }
.hlgx-color-3 { background: linear-gradient(145deg, #4ade80, #15803d); }
.hlgx-color-4 { background: linear-gradient(145deg, #22d3ee, #0e7490); }
.hlgx-color-5 { background: linear-gradient(145deg, #60a5fa, #1d4ed8); }
.hlgx-color-6 { background: linear-gradient(145deg, #a78bfa, #6d28d9); }
.hlgx-color-7 { background: linear-gradient(145deg, #f472b6, #be185d); }

/* 工具按钮 */
.hlgx-tools {
    display: flex;
    justify-content: center;
    gap: .8rem;
    margin: 1.2rem auto 1rem;
    max-width: 480px;
    flex-wrap: wrap;
}
.hlgx-tools button {
    background: #fff;
    border: 1px solid #cbd5e1;
    border-radius: 10px;
    padding: .55rem 1.1rem;
    font-size: .95rem;
    cursor: pointer;
    font-weight: 600;
    color: #334155;
    transition: background .15s ease, transform .1s ease;
}
.hlgx-tools button:hover { background: #eef2ff; transform: translateY(-1px); }
.hlgx-tools button:active { transform: scale(.96); }
.hlgx-tools button:disabled,
.hlgx-tools button:disabled:hover { opacity: .4; cursor: not-allowed; transform: none; background: #fff; }

/* 消除槽 */
.tray-area { text-align: center; margin-top: .5rem; }
.tray-label { color: #64748b; font-size: .85rem; margin-bottom: .5rem; }
#hlgx-tray {
    display: flex;
    justify-content: center;
    gap: 5px;
    background: rgba(255,255,255,.6);
    border: 2px dashed #cbd5e1;
    border-radius: 12px;
    padding: 8px;
    min-height: 62px;
    max-width: 570px;
    margin: 0 auto;
    flex-wrap: wrap;
}
.hlgx-tray-cell {
    width: 50px;
    height: 50px;
    border-radius: 8px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 1px;
    color: #fff;
    box-shadow: 0 2px 5px rgba(0,0,0,.2);
    text-shadow: 0 1px 2px rgba(0,0,0,.3);
    cursor: pointer;
    transition: transform .12s ease, box-shadow .12s ease;
}
.hlgx-tray-cell:hover { transform: scale(1.07); }
.hlgx-tray-cell.sel {
    outline: 3px solid #facc15;
    transform: scale(1.1);
    box-shadow: 0 0 14px rgba(250, 204, 21, .8);
}
.hlgx-tray-cell .f { font-weight: 800; line-height: 1.1; }
.hlgx-tray-cell .n { font-size: 8px; opacity: .9; }

/* 手动消除按钮 + 提示条 */
.tray-clear-row {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: .9rem;
    max-width: 480px;
    margin: 0 auto .6rem;
    flex-wrap: wrap;
}
.clear-btn {
    background: #1d4ed8;
    color: #fff;
    border: none;
    border-radius: 10px;
    padding: .5rem 1.2rem;
    font-size: .95rem;
    font-weight: 600;
    cursor: pointer;
    transition: background .15s ease;
}
.clear-btn:hover { background: #1e40af; }
.clear-btn:disabled { opacity: .4; cursor: not-allowed; }
.hlgx-flash {
    color: #dc2626;
    font-size: .85rem;
    font-weight: 600;
    min-height: 1.2em;
    opacity: 0;
    transition: opacity .15s ease;
}
.hlgx-flash.show { opacity: 1; }
.hlgx-rule {
    color: #94a3b8;
    font-size: .82rem;
    margin-top: .7rem;
}

/* 图鉴 */
.hlgx-catalog {
    max-width: 640px;
    margin: 1.5rem auto 0;
    background: #fff;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    padding: .9rem 1.1rem;
}
.hlgx-catalog summary { cursor: pointer; font-weight: 600; color: #1e293b; }
.hlgx-catalog section { margin-top: .9rem; }
.hlgx-catalog h3 { font-size: .95rem; margin-bottom: .5rem; }
.cat-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip {
    padding: .2rem .6rem;
    border-radius: 999px;
    font-size: .82rem;
    color: #fff;
    opacity: .92;
}

/* 结束遮罩 */
#hlgx-overlay {
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, .55);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 999;
}
#hlgx-overlay.hidden { display: none; }
.overlay-box {
    background: #fff;
    border-radius: 16px;
    padding: 2.2rem 2.6rem;
    text-align: center;
    box-shadow: 0 20px 60px rgba(0,0,0,.3);
    max-width: 380px;
}
.overlay-box h2 { color: #1d4ed8; margin-bottom: .6rem; }
.overlay-box p { color: #475569; line-height: 1.7; margin-bottom: 1.4rem; }
.overlay-box button {
    background: #1d4ed8;
    color: #fff;
    border: none;
    border-radius: 10px;
    padding: .65rem 1.8rem;
    font-size: 1rem;
    cursor: pointer;
    font-weight: 600;
}
.overlay-box button:hover { background: #1e40af; }

/* 弹窗(昵称输入) */
.modal {
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, .55);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 998;
}
.modal.hidden { display: none; }
.modal-box {
    background: #fff;
    border-radius: 16px;
    padding: 2rem 2.4rem;
    text-align: center;
    box-shadow: 0 20px 60px rgba(0, 0, 0, .3);
    max-width: 360px;
    width: 90%;
    box-sizing: border-box;
}
.modal-box h2 { color: #1d4ed8; margin-bottom: 1rem; }
.modal-box input[type="text"] {
    width: 100%;
    padding: .6rem .8rem;
    border: 1px solid #cbd5e1;
    border-radius: 8px;
    font-size: 1rem;
    margin-bottom: .8rem;
    box-sizing: border-box;
    text-align: center;
}
.skip-label { display: block; color: #64748b; font-size: .9rem; margin-bottom: .8rem; cursor: pointer; }
.primary-btn {
    background: #1d4ed8;
    color: #fff;
    border: none;
    border-radius: 10px;
    padding: .65rem 1.8rem;
    font-size: 1rem;
    cursor: pointer;
    font-weight: 600;
}
.primary-btn:hover { background: #1e40af; }

/* 结算信息 */
.settle-info {
    background: #f1f5f9;
    border-radius: 10px;
    padding: .7rem 1rem;
    margin: .9rem 0;
    color: #334155;
    font-size: .95rem;
    line-height: 1.8;
}

/* 血量 / 计时器 */
#hlgx-hp { font-weight: 700; color: #dc2626; }
#hlgx-hp.zero { color: #94a3b8; }
#hlgx-timer { font-variant-numeric: tabular-nums; font-weight: 600; }

/* 大厅布局: 侧边栏 + 主区 */
.hub-layout { display: flex; gap: 1.5rem; max-width: 1180px; margin: 0 auto; align-items: flex-start; }
.hub-sidebar {
    flex: 0 0 170px;
    background: #fff;
    border: 1px solid #e2e8f0;
    border-radius: 14px;
    padding: 1.2rem 1rem;
    position: sticky;
    top: 1rem;
    box-shadow: 0 4px 16px rgba(29, 78, 216, .06);
}
.hub-sidebar h3 { color: #64748b; font-size: .9rem; margin-bottom: .8rem; }
.side-item {
    display: block;
    padding: .6rem .8rem;
    border-radius: 8px;
    background: #eef2ff;
    color: #1d4ed8;
    font-weight: 600;
    text-decoration: none;
    margin-bottom: .8rem;
}
.side-item:hover { background: #dbe4ff; }
.side-hint { color: #94a3b8; font-size: .78rem; line-height: 1.5; }
.hub-main { flex: 1; min-width: 0; }

/* 排行榜页 */
.rank-tabs {
    display: flex;
    gap: .6rem;
    justify-content: center;
    flex-wrap: wrap;
    margin-bottom: 1.2rem;
}
.rank-tabs button {
    background: #fff;
    border: 1px solid #cbd5e1;
    border-radius: 8px;
    padding: .45rem 1.2rem;
    font-size: .95rem;
    cursor: pointer;
    color: #334155;
}
.rank-tabs button.active { background: #1d4ed8; border-color: #1d4ed8; color: #fff; font-weight: 600; }
.rank-tabs .rank-clear { background: #fef2f2; color: #b91c1c; border-color: #fecaca; }
.rank-table-wrap {
    max-width: 760px;
    margin: 0 auto;
    background: #fff;
    border-radius: 14px;
    padding: .5rem;
    box-shadow: 0 4px 16px rgba(0, 0, 0, .06);
}
.rank-table { width: 100%; border-collapse: collapse; }
.rank-table th, .rank-table td { padding: .55rem .7rem; border-bottom: 1px solid #eef2f7; text-align: center; font-size: .92rem; }
.rank-table th { color: #64748b; font-weight: 600; }
.rank-table tr:last-child td { border-bottom: none; }
.rank-empty { text-align: center; color: #94a3b8; padding: 1.5rem; }
.rank-tabs .back { display: block; margin-bottom: .5rem; }
