/* ================= AI Monitor Panel ================= */
.ai-monitor {
    position: absolute;
    top: 60px;
    left: 10px;
    flex-direction: column;
    gap: 10px;
    z-index: 10000;
}

.ai-agent-card {
    background: rgba(10, 15, 30, 0.85);
    border: 1px solid #4fc3f7;
    border-radius: 8px;
    padding: 10px;
    width: 220px;
    color: #e0f7fa;
    box-shadow: 0 4px 10px rgba(0,0,0,0.5);
    backdrop-filter: blur(4px);
}

.ai-agent-card h4 {
    margin: 0 0 8px 0;
    color: #81d4fa;
    font-size: 14px;
    border-bottom: 1px solid #29b6f6;
    padding-bottom: 4px;
}

.ai-stat {
    font-size: 12px;
    margin-bottom: 4px;
}

.ai-val {
    font-family: monospace;
    color: #b2ebf2;
}

.ai-val.intent { color: #ffca28; font-weight: bold; }
.ai-val.conf { color: #69f0ae; }

.ai-inspect-btn {
    margin-top: 8px;
    width: 100%;
    padding: 4px;
    background: #0288d1;
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 11px;
}

.ai-inspect-btn:hover { background: #03a9f4; }
.hidden { display: none !important; }

/* Q-Value Badges */
.q-badge {
    background: #263238;
    border: 1px solid #00bcd4;
    padding: 2px 6px;
    border-radius: 12px;
    color: #e0f7fa;
}

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

body {
    background: radial-gradient(circle at center, #1f2b45 0%, #0a0e17 100%);
    color: #e0e0e0;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    display: flex;
    flex-direction: column;
    align-items: center;
    min-height: 100vh;
    overflow-x: hidden;
    overflow-y: auto;
    padding: 10px 0;
}

.site-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    margin-top: 10px;
    width: 100%;
    position: relative;
    padding: 0 20px;
    box-sizing: border-box;
}

.header-left {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
}



.twitter-link {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    margin-top: 10px;
    padding: 6px 15px;
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 20px;
    color: #fff;
    text-decoration: none;
    font-family: sans-serif;
    font-size: 14px;
    transition: all 0.3s ease;
}

.twitter-link:hover {
    background: rgba(255, 255, 255, 0.2);
    box-shadow: 0 0 10px rgba(255, 255, 255, 0.3);
    transform: translateY(-2px);
}

.site-header h1 {
    font-size: 2.5rem;
    color: #00e5ff;
    text-shadow: 0 0 20px rgba(0, 229, 255, 0.8), 2px 2px 5px #000;
    margin: 0;
    letter-spacing: 6px;
    font-weight: 900;
    font-family: 'KaiTi', 'STKaiti', serif;
}

.site-header p {
    font-size: 1rem;
    color: #ffd700;
    letter-spacing: 3px;
    margin-top: 5px;
    text-shadow: 0 0 10px rgba(255, 215, 0, 0.5);
}

.game-container {
    display: flex;
    flex-direction: column;
    gap: 20px;
    width: 95%;
    max-width: 1800px;
    min-height: calc(100vh - 120px);
    background: rgba(20, 20, 20, 0.85);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 16px;
    padding: 20px;
    box-shadow: 0 10px 50px rgba(0, 0, 0, 0.9), 0 0 0 1px rgba(255,255,255,0.05) inset;
    box-sizing: border-box;
}

.game-top-row {
    display: flex;
    flex: 1 1 auto;
    gap: 20px;
    min-height: 600px;
    height: 65vh;
}

.ai-panel {
    flex: 0 0 250px;
    display: flex;
    flex-direction: column;
    background: rgba(0, 0, 0, 0.6);
    border: 1px solid rgba(255, 255, 255, 0.05);
    border-radius: 12px;
    overflow: hidden;
    height: 100%;
    box-shadow: 0 8px 32px rgba(0,0,0,0.4);
    transition: all 0.3s ease;
}

.ai-panel:hover {
    transform: translateY(-2px);
    box-shadow: 0 12px 40px rgba(0,0,0,0.6);
}

.panel-header {
    background: linear-gradient(to bottom, #2a2a2a, #111);
    padding: 12px;
    text-align: center;
    font-weight: 800;
    font-size: 1em;
    letter-spacing: 2px;
    border-bottom: 2px solid rgba(255, 255, 255, 0.1);
    flex-shrink: 0;
    text-transform: uppercase;
    color: #FFFFFF;
    text-shadow: 0 0 8px rgba(255, 255, 255, 0.6);
    position: relative;
}

#panel-binance .panel-header {
    color: #F3BA2F;
    text-shadow: 0 0 8px rgba(243, 186, 47, 0.6);
    border-top: 2px solid #F3BA2F;
}

#panel-okx .panel-header {
    color: #FFFFFF;
    text-shadow: 0 0 8px rgba(255, 255, 255, 0.6);
    border-top: 2px solid #FFFFFF;
}

.terminal {
    flex: 1 1 0;
    padding: 12px;
    font-family: 'Consolas', 'Courier New', monospace;
    font-size: 0.8em;
    line-height: 1.4;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.skill-list {
    flex: 1;
    padding: 8px;
    background: #000;
    color: #fff;
    overflow-y: hidden;
    border-top: 1px solid rgba(255, 255, 255, 0.05);
    display: flex;
    flex-direction: column;
    justify-content: space-evenly;
    gap: 4px;
}

.skill-item {
    display: flex;
    justify-content: center;
    align-items: center;
    background: rgba(255, 255, 255, 0.05);
    padding: 6px 10px;
    border-radius: 6px;
    border-left: 3px solid #555;
    transition: all 0.2s ease;
    flex: 1;
}

.skill-item.active {
    background: rgba(243, 186, 47, 0.2);
    border-left: 4px solid #F3BA2F;
    box-shadow: 0 0 15px rgba(243, 186, 47, 0.4) inset;
    transform: scale(1.02);
}

.skill-key {
    background: #F3BA2F;
    color: #000;
    padding: 2px 8px;
    border-radius: 4px;
    font-weight: bold;
    font-size: 0.9em;
    min-width: 30px;
    text-align: center;
}

.skill-name {
    flex: 1;
    font-size: 0.9em;
    text-align: center;
    font-weight: bold;
    letter-spacing: 1px;
}

.controls-hint {
    padding: 8px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 6px;
    margin-bottom: 5px;
    font-size: 0.8em;
    color: #ccc;
    text-align: center;
    line-height: 1.4;
}

.term-line {
    opacity: 0;
    animation: fadeIn 0.4s ease-out forwards;
    word-break: break-word;
    white-space: pre-wrap;
    background: rgba(255, 255, 255, 0.02);
    padding: 6px 8px;
    border-radius: 4px;
    border-left: 2px solid transparent;
    margin-bottom: 4px;
}

#term-okx .term-line {
    color: #FFFFFF;
    border-left-color: #e0e0e0;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateX(-5px); }
    to { opacity: 1; transform: translateX(0); }
}

.arena-container {
    flex: 1;
    position: relative;
    background: #000;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 0 30px rgba(0,0,0,0.8) inset, 0 0 15px rgba(0, 229, 255, 0.1);
    height: 100%; 
    display: flex;
    flex-direction: column;
}

.hud {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px 30px;
    background: linear-gradient(to bottom, rgba(34, 34, 34, 0.9), rgba(17, 17, 17, 0.9));
    backdrop-filter: blur(5px);
    border-bottom: 1px solid rgba(255,255,255,0.1);
    z-index: 5;
    position: absolute;
    top: 0; left: 0; right: 0;
}

.player-info {
    flex: 1;
    min-width: 0; /* allows text truncation if needed */
}

.name {
    font-size: 1.4em;
    font-weight: 900;
    margin-bottom: 8px;
    text-transform: uppercase;
    letter-spacing: 1px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.crypto-price {
    font-size: 0.8em;
    font-family: monospace;
    color: #00ffaa;
    text-shadow: 0 0 5px #00ffaa;
    transition: color 0.3s;
}

.crypto-price.up { color: #4CAF50; text-shadow: 0 0 8px #4CAF50; }
.crypto-price.down { color: #f44336; text-shadow: 0 0 8px #f44336; }

.p1-info .name {
    color: #F3BA2F;
    text-shadow: 0 0 10px rgba(243, 186, 47, 0.8);
}

.p2-info .name {
    color: #FFFFFF;
    text-shadow: 0 0 10px rgba(255, 255, 255, 0.8);
    text-align: right;
    flex-direction: row-reverse;
}

.health-bar-bg {
    width: 100%;
    height: 28px;
    background: rgba(0,0,0,0.6);
    border: 2px solid rgba(255,255,255,0.2);
    border-radius: 6px;
    position: relative;
    overflow: hidden;
    box-shadow: 0 0 10px rgba(0,0,0,0.5) inset;
}

.health-bar {
    height: 100%;
    transition: width 0.15s ease-out, background-color 0.3s;
    box-shadow: 0 0 10px rgba(255,255,255,0.2) inset;
}

.hp-text {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-size: 0.9em;
    font-weight: bold;
    text-shadow: 1px 1px 2px #000, -1px -1px 2px #000, 1px -1px 2px #000, -1px 1px 2px #000;
    z-index: 2;
    pointer-events: none;
}

#hp-binance {
    background: linear-gradient(90deg, #F3BA2F, #ffca4f);
    width: 100%;
    float: right;
    transform-origin: left;
}
.p1-info .health-bar-bg {
    display: flex;
    justify-content: flex-start;
}

#hp-okx {
    background: linear-gradient(90deg, #e0e0e0, #ffffff);
    width: 100%;
    float: left;
}
.p2-info .health-bar-bg {
    display: flex;
    justify-content: flex-end;
}

.vs {
    font-size: 2.5em;
    font-weight: 900;
    color: #ff3366;
    text-shadow: 0 0 15px rgba(255, 51, 102, 0.8), 2px 2px 0px #000;
    font-style: italic;
    letter-spacing: 2px;
    display: flex;
    flex-direction: column;
    align-items: center;
    flex-shrink: 0;
    padding: 0 20px;
}
.vs-text { margin-bottom: 5px; }
.score-board {
    font-size: 28px;
    font-family: monospace;
    background: rgba(0,0,0,0.5);
    padding: 2px 15px;
    border-radius: 10px;
    border: 1px solid #444;
    white-space: nowrap;
}
#score-binance { color: #F3BA2F; text-shadow: 0 0 5px #F3BA2F; }
#score-okx { color: #FFFFFF; text-shadow: 0 0 5px #FFFFFF; }

canvas, #webgl-container canvas {
    width: 100%;
    height: 100%;
    /* 设置一个最小高度保证画面不会被压缩得太小 */
    min-height: 400px;
    object-fit: contain; 
    object-position: bottom; /* 强制将画面对齐到底部，把多余空白留给天空 */
    flex: 1;
}

#gameCanvas {
    width: 100%;
    height: 100%;
    object-fit: contain;
    /* 移除 pixelated，让浏览器默认进行平滑缩放以避免锯齿 */
    display: block;
    background: #1a1a1a;
}

.canvas-wrapper {
    flex: 1;
    position: relative;
    width: 100%;
    min-height: 0;
    overflow: hidden;
    background: transparent;
    display: flex;
    justify-content: center;
    align-items: center;
}

/* 胜负结算遮罩 */
.overlay {
    position: absolute;
    top: 0; left: 0; width: 100%; height: 100%;
    background: rgba(0,0,0,0.8);
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    z-index: 10;
    border-radius: 10px;
}

.hidden {
    display: none !important;
}

/* 加载遮罩样式 */
.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(10, 14, 23, 0.95);
    z-index: 9999;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    backdrop-filter: blur(5px);
}
.loading-spinner {
    width: 50px;
    height: 50px;
    border: 5px solid rgba(0, 229, 255, 0.3);
    border-top-color: #00e5ff;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-bottom: 20px;
}

.loading-text {
    color: #00e5ff;
    font-size: 1.2rem;
    font-family: 'Courier New', Courier, monospace;
    font-weight: bold;
    text-shadow: 0 0 10px rgba(0, 229, 255, 0.5);
    animation: pulse 1.5s ease-in-out infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

@keyframes pulse {
    0%, 100% { opacity: 0.6; }
    50% { opacity: 1; }
}

#result-text {
    font-size: 60px;
    font-style: italic;
    text-transform: uppercase;
    text-shadow: 0 0 20px rgba(255,255,255,0.5);
    margin-bottom: 30px;
    animation: zoomIn 0.5s ease-out;
}

/* 场景切换 UI */
.scene-tabs-header {
    display: flex;
    gap: 5px;
    background: rgba(0, 0, 0, 0.5);
    padding: 3px;
    border-radius: 6px;
    border: 1px solid rgba(255, 255, 255, 0.2);
    margin-right: 10px;
}

.scene-tab {
    padding: 5px 10px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.85em;
    font-weight: bold;
    color: #888;
    transition: all 0.3s;
}

.scene-tab:hover {
    color: #fff;
    background: rgba(255, 255, 255, 0.1);
}

.scene-tab.active {
    color: #fff;
    background: rgba(0, 229, 255, 0.3);
    box-shadow: 0 0 10px rgba(0, 229, 255, 0.5);
}

/* 观众互动投票区 */
.interactive-panel {
    width: 100%;
    background: linear-gradient(135deg, rgba(15, 20, 35, 0.9), rgba(5, 10, 20, 0.9));
    border: 1px solid #00e5ff;
    border-radius: 8px;
    padding: 15px;
    margin-top: 10px; /* 减小上边距 */
    box-shadow: 0 0 20px rgba(0, 229, 255, 0.15);
    display: flex;
    flex-direction: column;
    gap: 12px;
    z-index: 10;
    position: relative; /* 确保层级生效 */
}

.poll-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-family: 'Courier New', Courier, monospace;
    font-weight: bold;
    color: #fff;
    font-size: 1.1rem;
}

.live-badge {
    color: #ff0055;
    text-shadow: 0 0 8px #ff0055;
    animation: blink 1.5s infinite;
}

.poll-timer {
    color: #00e5ff;
    font-size: 1.2rem;
}

.poll-options {
    display: flex;
    gap: 15px;
}

.poll-btn {
    flex: 1;
    position: relative;
    background: #1a1a2e;
    border: 1px solid #333;
    color: #fff;
    padding: 12px;
    cursor: pointer;
    overflow: hidden;
    border-radius: 6px;
    transition: all 0.3s;
    font-weight: bold;
    text-align: center;
}

.poll-btn:hover {
    border-color: #00e5ff;
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(0, 229, 255, 0.2);
}

.poll-btn.voted {
    border-color: #ffeb3b;
    box-shadow: 0 0 15px rgba(255, 235, 59, 0.4);
}

.poll-progress {
    position: absolute;
    left: 0; top: 0; bottom: 0;
    background: linear-gradient(90deg, rgba(0, 229, 255, 0.4), rgba(0, 229, 255, 0.1));
    width: 0%;
    z-index: 1;
    transition: width 0.3s ease-out;
}

.poll-text {
    position: relative;
    z-index: 2;
    display: flex;
    justify-content: space-between;
    pointer-events: none;
}

@keyframes blink {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

.countdown-text {
    font-size: 24px;
    color: #aaa;
    font-family: monospace;
    letter-spacing: 2px;
}

@keyframes zoomIn {
    from { transform: scale(0.5); opacity: 0; }
    to { transform: scale(1); opacity: 1; }
}

/* 弹窗及按钮样式 */
.header-right {
    display: flex;
    gap: 10px;
    z-index: 100;
    align-items: center;
    flex-wrap: wrap;
    justify-content: flex-end;
}

.header-btn {
    background: rgba(0, 229, 255, 0.2);
    border: 1px solid #00e5ff;
    color: #00e5ff;
    padding: 8px 15px;
    border-radius: 5px;
    cursor: pointer;
    font-family: 'Courier New', Courier, monospace;
    font-weight: bold;
    transition: all 0.3s ease;
}

.header-btn:hover {
    background: rgba(0, 229, 255, 0.4);
    box-shadow: 0 0 10px #00e5ff;
}

.skill-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    z-index: 10001;
    display: flex;
    justify-content: center;
    align-items: center;
    backdrop-filter: blur(5px);
}

.skill-modal.hidden {
    display: none;
}

.skill-modal-content {
    background: rgba(20, 20, 30, 0.95);
    border: 2px solid #333;
    border-radius: 10px;
    width: 80%;
    max-width: 800px;
    max-height: 80vh;
    padding: 30px;
    position: relative;
    overflow-y: auto;
    box-shadow: 0 0 30px rgba(0, 0, 0, 0.5);
    color: #e0e0e0;
}

.close-btn {
    position: absolute;
    top: 10px;
    right: 20px;
    font-size: 28px;
    font-weight: bold;
    color: #888;
    cursor: pointer;
    transition: color 0.2s;
}

.close-btn:hover {
    color: #fff;
}

.skill-modal-content h2 {
    text-align: center;
    color: #fff;
    margin-bottom: 20px;
    border-bottom: 1px solid #444;
    padding-bottom: 10px;
}

.skill-desc-container {
    display: flex;
    gap: 30px;
}

.skill-column {
    flex: 1;
    background: rgba(0, 0, 0, 0.3);
    padding: 20px;
    border-radius: 8px;
}

.binance-skills {
    border-top: 3px solid #F3BA2F;
}

.okx-skills {
    border-top: 3px solid #fff;
}

.skill-column h3 {
    text-align: center;
    margin-bottom: 15px;
}

.binance-skills h3 { color: #F3BA2F; }
.okx-skills h3 { color: #fff; }

.skill-column ul {
    list-style-type: none;
    padding: 0;
}

.skill-column li {
    margin-bottom: 15px;
    line-height: 1.5;
    font-size: 0.95em;
}

.skill-column li strong {
    color: #00e5ff;
}

/* 隐藏滚动条 */
.terminal::-webkit-scrollbar {
    width: 8px;
}
.terminal::-webkit-scrollbar-track {
    background: #111;
}
.terminal::-webkit-scrollbar-thumb {
    background: #333;
    border-radius: 4px;
}
.terminal::-webkit-scrollbar-thumb:hover {
    background: #555;
}

/* 版本更新日志样式 */
.changelog-container {
    display: flex;
    flex-direction: column;
    gap: 20px;
    padding: 10px;
}

.changelog-item {
    background: rgba(0, 0, 0, 0.4);
    padding: 15px 20px;
    border-left: 4px solid #00e5ff;
    border-radius: 6px;
}

.changelog-item h3 {
    color: #F3BA2F;
    margin-bottom: 5px;
    text-align: left;
    border: none;
    padding: 0;
}

.changelog-item .date {
    font-size: 0.8em;
    color: #888;
    margin-bottom: 10px;
}

.changelog-item ul {
    list-style-type: disc;
    padding-left: 20px;
}

.changelog-item li {
    margin-bottom: 5px;
    color: #ccc;
    line-height: 1.4;
    font-size: 0.95em;
}

/* 响应式适配 */
@media (max-width: 1200px) {
    .game-container {
        height: auto;
        flex-direction: column;
        flex-wrap: nowrap;
        overflow-y: auto;
    }
    
    .game-top-row {
        flex-direction: column;
        height: auto;
        min-height: auto;
    }
    
    .ai-panel {
        flex: none;
        height: 200px;
        width: 100%;
    }
    
    .arena-container {
        flex: none;
        height: 50vh;
        min-height: 400px;
        width: 100%;
    }
}

@media (max-width: 800px) {
    .poll-options { flex-direction: column; gap: 8px; }
    .poll-header { font-size: 0.9rem; }
    .header-right {
        position: static;
        justify-content: center;
        margin-top: 15px;
        transform: none;
        flex-wrap: wrap; /* 允许在手机端换行 */
    }
    .site-header h1 {
        font-size: 1.8rem;
    }
    .site-header p {
        font-size: 0.8rem;
    }
    .skill-desc-container {
        flex-direction: column;
        gap: 15px;
    }
    .skill-modal-content {
        width: 95%;
        padding: 20px 15px;
    }
    .game-top-row {
        flex-direction: column;
        height: auto;
        min-height: auto;
    }
    .arena-container {
        flex: none;
        height: 50vh;
        min-height: 300px;
        width: 100%;
    }
    .hud {
        padding: 5px 10px;
    }
    .name {
        font-size: 1em;
        flex-direction: column;
        align-items: flex-start;
    }
    .p2-info .name {
        align-items: flex-end;
    }
    .vs {
        font-size: 1.5em;
        padding: 0 10px;
    }
    .score-board {
        font-size: 16px;
        padding: 2px 8px;
        white-space: nowrap;
    }
    .health-bar-bg {
        height: 20px;
    }
    .hp-text {
        font-size: 0.7em;
    }
}
#term-binance .term-line {
    color: #F3BA2F;
    border-left-color: #ffca4f;
}
