/* ==========================================================================
   炸弹猫 Detonating Cats · 全站统一霓虹风（重写版，无图片依赖）
   - 背景: 深色渐变 + 霓虹光斑（与全站其他游戏一致）
   - 主色: 霓虹青 #7ef2ff / 金 #ffd700 / 粉 #ff9ad5 / 蓝 #2196f3
   - 卡牌: 纯 CSS + emoji，无猫图
   ========================================================================== */

:root {
    --neon-cyan: #7ef2ff;
    --neon-gold: #ffd700;
    --neon-pink: #ff9ad5;
    --neon-blue: #2196f3;
    --neon-orange: #ffb300;
    --glass-bg: rgba(255, 255, 255, .07);
    --glass-border: rgba(255, 255, 255, .13);
    --text-main: #eef2ff;
    --text-dim: rgba(238, 242, 255, .62);
    --text-faint: rgba(238, 242, 255, .38);
    --radius-lg: 16px;
    --radius-md: 12px;
    --shadow-card: 0 12px 40px rgba(0, 0, 0, .35), inset 0 1px 0 rgba(255, 255, 255, .06);
}

* { margin: 0; padding: 0; box-sizing: border-box; }

html {
    min-height: 100%;
    background: linear-gradient(180deg, #1a0a3a 0%, #0a0a1a 60%, #001a2a 100%) fixed;
}

body {
    min-height: 100vh;
    font-family: -apple-system, "PingFang SC", "HarmonyOS Sans SC", "Microsoft YaHei", "Noto Sans SC", sans-serif;
    background: transparent;
    color: var(--text-main);
    -webkit-font-smoothing: antialiased;
}

/* 霓虹光斑背景 */
body::before {
    content: "";
    position: fixed;
    z-index: -1;
    pointer-events: none;
    width: 62vmax;
    height: 62vmax;
    top: -24vmax;
    left: -18vmax;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(33, 150, 243, .4), rgba(126, 242, 255, .12) 45%, transparent 65%);
    filter: blur(70px);
    opacity: .5;
}
body::after {
    content: "";
    position: fixed;
    z-index: -1;
    pointer-events: none;
    width: 56vmax;
    height: 56vmax;
    bottom: -22vmax;
    right: -16vmax;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(255, 154, 213, .3), rgba(255, 215, 0, .1) 45%, transparent 65%);
    filter: blur(80px);
    opacity: .45;
}

/* ---------- 加载屏 ---------- */
#loading {
    max-width: 420px;
    margin: 18vh auto;
    padding: 34px 30px;
    text-align: center;
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-lg);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    box-shadow: var(--shadow-card);
    letter-spacing: 1px;
    line-height: 1.9;
    font-size: 14px;
    color: var(--text-dim);
}
#loading p:first-child { font-size: 16px; font-weight: 700; color: var(--text-main); }

/* ---------- 欢迎屏 ---------- */
#welcome.reveal {
    max-width: 560px;
    margin: 6vh auto 8vh;
    padding: 8px 6px;
    text-align: center;
}
#welcome.reveal .kt-logo-title {
    font-size: 36px;
    font-weight: 800;
    letter-spacing: 3px;
    background: linear-gradient(90deg, #7ef2ff, #ffd700, #ff9ad5);
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
    margin-bottom: 8px;
}
#welcome.reveal .kt-logo-sub {
    font-size: 13px;
    color: rgba(255, 255, 255, .55);
    letter-spacing: 2px;
    margin-bottom: 24px;
}
#welcome.reveal .kt-card {
    background: rgba(255, 255, 255, .07);
    border: 1px solid rgba(255, 255, 255, .13);
    border-radius: 16px;
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    box-shadow: 0 12px 40px rgba(0, 0, 0, .4), inset 0 1px 0 rgba(255, 255, 255, .06);
    padding: 24px 22px;
    margin-bottom: 16px;
}
#welcome.reveal .kt-section-title {
    font-size: 15px;
    font-weight: 700;
    color: #7ef2ff;
    letter-spacing: 2px;
    margin-bottom: 14px;
}
#welcome.reveal .kt-input-group { margin: 12px 0; }
#welcome.reveal .kt-input-group input {
    width: 100%;
    background: rgba(255, 255, 255, .07);
    border: 1px solid rgba(255, 255, 255, .16);
    border-radius: 10px;
    color: #fff;
    padding: 12px 14px;
    font-size: 15px;
    outline: none;
    text-align: center;
    transition: border-color .2s, box-shadow .2s;
}
#welcome.reveal .kt-input-group input:focus {
    border-color: #7ef2ff;
    box-shadow: 0 0 14px rgba(126, 242, 255, .25);
}
#welcome.reveal .kt-btn-row { margin: 18px 0 4px; }
#welcome.reveal .kt-btn-main {
    width: 100%;
    padding: 13px 20px;
    border: none;
    border-radius: 12px;
    font-size: 16px;
    font-weight: 700;
    cursor: pointer;
    letter-spacing: 2px;
    color: #fff;
    background: linear-gradient(90deg, #2196f3, #ffb300);
    box-shadow: 0 4px 18px rgba(33, 150, 243, .4);
    transition: transform .15s, box-shadow .25s, filter .2s;
}
#welcome.reveal .kt-btn-main:hover {
    transform: translateY(-2px);
    filter: brightness(1.1);
    box-shadow: 0 6px 24px rgba(33, 150, 243, .55);
}
#welcome.reveal .kt-btn-main:active { transform: scale(.96); }
#welcome.reveal .kt-msg { min-height: 18px; font-size: 12px; color: #ff9c9c; margin-top: 6px; }
#welcome.reveal .kt-rules { text-align: left; }
#welcome.reveal .kt-rules .kt-section-title { text-align: center; }
#welcome.reveal .kt-rules ol {
    padding-left: 20px;
    font-size: 13px;
    line-height: 2;
    color: rgba(255, 255, 255, .75);
    margin: 0;
}
#welcome.reveal .kt-rules b { color: #ffd700; }

/* ---------- 对局界面 ---------- */
#game-view {
    display: none;
    padding: 0 14px 20px;
    max-width: 900px;
    margin: 0 auto;
}

#board {
    position: relative;
    padding: 16px;
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-lg);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    box-shadow: var(--shadow-card);
}

#top-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 4px 12px;
    font-size: 14px;
    letter-spacing: 1px;
    border-bottom: 1px solid rgba(255, 255, 255, .08);
    margin-bottom: 14px;
}
.rule-link {
    color: var(--neon-cyan);
    text-decoration: none;
    margin-left: 6px;
    font-size: 12px;
    opacity: .8;
}
#player-name { color: var(--neon-gold); font-weight: 700; }
#lobby-name { color: var(--neon-cyan); font-weight: 700; }

/* 牌桌中央 */
#table-area {
    text-align: center;
    padding: 12px 0 6px;
}
#discard-pile, #draw-pile {
    display: inline-block;
    margin: 8px 20px;
    vertical-align: middle;
}
#draw-pile-animation {
    position: absolute;
    z-index: 60;
    pointer-events: none;
}
#draw-pile-counter {
    display: block;
    margin: 6px 0 4px;
    font-size: 13px;
    letter-spacing: 1px;
    color: var(--text-dim);
}
#remaining-card-count {
    color: var(--neon-cyan);
    font-weight: 700;
    text-shadow: 0 0 10px rgba(126, 242, 255, .45);
}

/* 抽牌堆（可点击） */
.draw-stack {
    display: flex;
    flex-direction: column;
    align-items: center;
    cursor: pointer;
    gap: 8px;
    padding: 8px;
    border-radius: 12px;
    transition: transform .15s, box-shadow .25s;
}
.draw-stack:hover {
    transform: translateY(-2px);
    box-shadow: 0 0 22px rgba(126, 242, 255, .3);
}
.draw-hint {
    font-size: 12px;
    color: var(--text-dim);
    letter-spacing: 1px;
}

/* 消息条 */
#message-container {
    min-height: 44px;
    padding: 10px 14px;
    margin: 10px 0;
    background: rgba(255, 255, 255, .05);
    border: 1px solid rgba(255, 255, 255, .09);
    border-radius: var(--radius-md);
    text-align: center;
    font-size: 15px;
    font-weight: 700;
    letter-spacing: 1px;
    color: var(--neon-gold);
    text-shadow: 0 0 14px rgba(255, 215, 0, .35);
}

/* 我的手牌区 */
#my-hand {
    margin-top: 12px;
    padding: 12px;
    background: rgba(255, 255, 255, .04);
    border: 1px solid rgba(255, 255, 255, .08);
    border-radius: var(--radius-md);
}
.hand-label {
    font-size: 13px;
    color: var(--text-dim);
    letter-spacing: 2px;
    margin-bottom: 8px;
    text-align: left;
}
#card-deck {
    display: flex;
    flex-wrap: wrap;
    justify-content: flex-start;
    gap: 5px;
    min-height: 20px;
    overflow-x: auto;
}
#card-hud, #card-hud-3-wrapper {
    margin-top: 10px;
    text-align: center;
    transition: opacity .5s;
}
#card-hud-3 {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 10px;
}

/* ---------- CSS 卡牌（无图） ---------- */
.css-card {
    --cc: #adb5bd;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-start;
    width: 88px;
    height: 122px;
    padding: 8px 7px 7px;
    box-sizing: border-box;
    background: linear-gradient(160deg, rgba(255,255,255,.12), rgba(255,255,255,.03));
    border: 2px solid var(--cc);
    border-radius: 10px;
    box-shadow: 0 5px 14px rgba(0,0,0,.4);
    cursor: pointer;
    transition: transform .15s, box-shadow .2s, border-color .2s;
    user-select: none;
}
.css-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 10px 24px rgba(0,0,0,.5), 0 0 16px color-mix(in srgb, var(--cc) 45%, transparent);
    border-color: #fff;
}
.css-card:active { transform: scale(.95); }
.css-card .cc-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 62px;
    font-size: 40px;
    line-height: 1;
    flex-shrink: 0;
    filter: drop-shadow(0 2px 6px rgba(0,0,0,.4));
}
.css-card .cc-name {
    width: 100%;
    height: 30px;
    margin-top: 5px;
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: .5px;
    line-height: 1.1;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    color: #fff;
    flex-shrink: 0;
    text-shadow: 0 1px 3px rgba(0,0,0,.6);
}

/* 小型卡牌（弃牌堆/动画） */
.css-card.small {
    width: 54px;
    height: 76px;
    padding: 4px 3px 3px;
}
.css-card.small .cc-icon { font-size: 24px; height: 38px; }
.css-card.small .cc-name { font-size: 9px; height: 22px; margin-top: 3px; }

/* 牌背（纯 CSS，无猫图） */
.card-back-face {
    width: 54px;
    height: 76px;
    background: linear-gradient(160deg, #2196f3, #7ef2ff);
    border: 2px solid rgba(255,255,255,.8);
    border-radius: 10px;
    box-shadow: 0 6px 16px rgba(0,0,0,.4);
    position: relative;
}
.card-back-face::after {
    content: "💣";
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 26px;
    filter: drop-shadow(0 2px 4px rgba(0,0,0,.4));
}
.mini-card { width: 58px; height: 82px; }

/* ---------- 操作按钮 ---------- */
#buttons-container {
    margin-top: 14px;
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 12px;
}
#buttons-container button {
    min-width: 110px;
    min-height: 42px;
    padding: 10px 18px;
    font-size: 14px;
    font-weight: 700;
    letter-spacing: 1px;
    color: #fff;
    background: var(--glass-bg);
    border: 1px solid rgba(255, 255, 255, .2);
    border-radius: 12px;
    cursor: pointer;
    transition: transform .15s, box-shadow .25s, border-color .2s;
}
#buttons-container button:hover {
    transform: translateY(-2px);
    border-color: rgba(126, 242, 255, .55);
    box-shadow: 0 0 18px rgba(126, 242, 255, .35);
}
#buttons-container button:active { transform: scale(.96); }
#buttons-container button.combo-btn {
    background: linear-gradient(90deg, rgba(33, 150, 243, .4), rgba(255, 179, 0, .4));
}
#buttons-container button.combo-btn.active {
    border-color: #ffd700;
    box-shadow: 0 0 18px rgba(255, 215, 0, .5);
}
/* 参加游戏 / 开始游戏 按钮：醒目强调 */
#buttons-container button.join-start {
    background: linear-gradient(90deg, rgba(0, 200, 140, .45), rgba(0, 160, 200, .45));
    border-color: rgba(0, 220, 180, .6);
    min-width: 132px;
}
#buttons-container button.join-start:hover {
    border-color: rgba(0, 240, 200, .9);
    box-shadow: 0 0 20px rgba(0, 230, 190, .5);
}
#btn-start {
    background: linear-gradient(90deg, rgba(255, 150, 0, .5), rgba(255, 60, 60, .5)) !important;
    border-color: rgba(255, 170, 40, .7) !important;
}
#btn-start:hover {
    border-color: rgba(255, 200, 80, .9) !important;
    box-shadow: 0 0 20px rgba(255, 170, 60, .55) !important;
}

/* ---------- 聊天框（关键：加入/开始/聊天） ---------- */
#chat-container {
    margin-top: 14px;
    padding: 12px;
    background: rgba(255, 255, 255, .04);
    border: 1px solid rgba(255, 255, 255, .1);
    border-radius: var(--radius-md);
}
#chat-message {
    width: 100%;
    min-height: 42px;
    padding: 10px 14px;
    font-size: 14px;
    color: #fff;
    background: rgba(255, 255, 255, .07);
    border: 1px solid rgba(255, 255, 255, .16);
    border-radius: 10px;
    outline: none;
    transition: border-color .2s, box-shadow .2s;
}
#chat-message::placeholder { color: var(--text-faint); }
#chat-message:focus {
    border-color: var(--neon-cyan);
    box-shadow: 0 0 0 2px rgba(126, 242, 255, .15);
}

/* ---------- 侧栏 ---------- */
#sidebar {
    margin-top: 14px;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
}
.sidebar-box {
    padding: 14px 16px;
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-md);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    box-shadow: var(--shadow-card);
}
#game-log-container { grid-column: 1 / -1; }
.sidebar-box h1 {
    font-size: 14px;
    font-weight: 700;
    letter-spacing: 3px;
    margin-bottom: 10px;
    color: var(--neon-cyan);
    text-shadow: 0 0 12px rgba(126, 242, 255, .35);
}
#player-list {
    list-style: none;
    font-size: 14px;
    line-height: 2;
    color: var(--text-dim);
}
#player-list .spectator { color: var(--text-faint); font-size: 13px; }
.now-playing {
    color: #ffd700;
    font-size: 12px;
    font-weight: 700;
    text-shadow: 0 0 8px rgba(255, 215, 0, .5);
}
#game-log {
    max-height: 160px;
    overflow-y: auto;
    font-size: 13px;
    line-height: 1.8;
    color: var(--text-dim);
    word-break: break-all;
}
#game-log::-webkit-scrollbar { width: 4px; }
#game-log::-webkit-scrollbar-thumb { background: rgba(126, 242, 255, .3); border-radius: 2px; }

/* ---------- 模态框 ---------- */
.modal-hud {
    position: fixed;
    inset: 0;
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(5, 6, 18, .72);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
    transition: opacity .5s;
}
.modal {
    max-width: 92vw;
    padding: 26px 30px;
    background: rgba(15, 16, 40, .94);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-lg);
    color: var(--text-main);
    text-align: center;
    box-shadow: 0 20px 60px rgba(0, 0, 0, .55);
    font-size: 16px;
    line-height: 1.8;
}
.modal-options {
    list-style: none;
    margin-top: 16px;
}
.modal-options li {
    padding: 12px 20px;
    margin: 8px 0;
    background: rgba(255, 255, 255, .07);
    border: 1px solid rgba(255, 255, 255, .16);
    border-radius: 10px;
    cursor: pointer;
    font-weight: 700;
    transition: transform .15s, box-shadow .2s, border-color .2s;
}
.modal-options li:hover {
    transform: translateY(-2px);
    border-color: #7ef2ff;
    box-shadow: 0 0 18px rgba(126, 242, 255, .35);
}

/* ---------- 关于页 ---------- */
.about-page, .changelog-page {
    max-width: 760px;
    margin: 7vh auto;
    padding: 34px 38px;
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-lg);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    box-shadow: var(--shadow-card);
}
.about-page h1, .changelog-page h1 {
    font-size: 30px;
    font-weight: 800;
    letter-spacing: 4px;
    margin-bottom: 22px;
    background: linear-gradient(90deg, #7ef2ff, #ffd700);
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
}
.about-page p {
    font-size: 15px;
    line-height: 1.9;
    margin-bottom: 16px;
    color: var(--text-dim);
    text-align: justify;
}
.about-page a {
    color: var(--neon-cyan);
    text-decoration: none;
    border-bottom: 1px dashed rgba(126, 242, 255, .4);
}
.about-page code {
    padding: 2px 6px;
    font-size: 13px;
    background: rgba(255, 255, 255, .08);
    border: 1px solid rgba(255, 255, 255, .12);
    border-radius: 6px;
    color: var(--neon-gold);
}

/* ---------- 响应式 ---------- */
@media (max-width: 600px) {
    #sidebar { grid-template-columns: 1fr; }
    .css-card { width: 72px; height: 104px; padding: 6px 5px 5px; }
    .css-card .cc-icon { font-size: 30px; height: 54px; }
    .css-card .cc-name { height: 26px; margin-top: 3px; font-size: 10px; }
    #game-view { padding: 0 8px 16px; }
    .about-page, .changelog-page { padding: 24px 20px; margin: 4vh auto; }
}

/* ---------- 减弱动效 ---------- */
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation: none !important;
        transition: none !important;
    }
}

/* ---------- 显示过渡 ---------- */
.reveal { opacity: 1; }
