/* css/style.css - Retro Arcade Theme & Mobile Adaptive Controls */
:root {
    --bg-color: #0f172a;
    --arcade-border: #334155;
    --neon-gold: #f1c40f;
    --neon-green: #2ecc71;
    --neon-red: #e74c3c;
    --neon-blue: #3498db;
    --btn-active: #475569;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    user-select: none;
    -webkit-user-select: none;
    -webkit-tap-highlight-color: transparent;
}

body {
    background-color: var(--bg-color);
    color: #ffffff;
    font-family: 'Courier New', "PingFang SC", "Microsoft YaHei", monospace, sans-serif;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    overflow-x: hidden;
    padding: 10px;
    touch-action: manipulation;
}

.game-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    max-width: 520px;
    width: 100%;
    background: #1e293b;
    border-radius: 16px;
    padding: 16px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.6), 0 0 20px rgba(46, 204, 113, 0.15);
    border: 2px solid var(--arcade-border);
}

/* 顶部标题与HUD */
.arcade-header {
    width: 100%;
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
    border-bottom: 2px solid #334155;
    padding-bottom: 8px;
}

.title-badge {
    display: flex;
    align-items: center;
    gap: 8px;
}

.tank-icon-badge {
    background: #c0392b;
    color: #fff;
    width: 26px;
    height: 26px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    font-size: 14px;
    box-shadow: 0 0 8px rgba(231, 76, 60, 0.6);
}

.game-title {
    font-size: 1.1rem;
    font-weight: bold;
    color: var(--neon-gold);
    letter-spacing: 1px;
}

/* 数据统计栏 HUD */
.hud-bar {
    width: 100%;
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 6px;
    background: #0f172a;
    padding: 8px 10px;
    border-radius: 8px;
    margin-bottom: 12px;
    font-size: 0.82rem;
    border: 1px solid #334155;
}

.hud-item {
    display: flex;
    flex-direction: column;
    align-items: center;
}

.hud-label {
    color: #94a3b8;
    font-size: 0.72rem;
    text-transform: uppercase;
}

.hud-value {
    color: #ffffff;
    font-weight: bold;
    font-size: 1rem;
}

.hud-value.highlight {
    color: var(--neon-gold);
}

.hud-value.red {
    color: var(--neon-red);
}

.hud-value.green {
    color: var(--neon-green);
}

/* 画布视窗容器 */
.canvas-wrapper {
    position: relative;
    width: 100%;
    aspect-ratio: 1 / 1;
    max-width: 440px;
    background: #000000;
    border: 3px solid #475569;
    border-radius: 8px;
    box-shadow: inset 0 0 15px rgba(0, 0, 0, 0.9);
    display: flex;
    justify-content: center;
    align-items: center;
    overflow: hidden;
}

#gameCanvas {
    width: 100%;
    height: 100%;
    image-rendering: -moz-crisp-edges;
    image-rendering: pixelated;
    display: block;
}

/* 游戏结束覆盖层 */
.game-over-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(15, 23, 42, 0.88);
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    gap: 16px;
    z-index: 10;
    backdrop-filter: blur(2px);
    transition: opacity 0.3s;
}

.game-over-overlay.hidden {
    display: none;
}

.game-over-title {
    font-size: 2.2rem;
    font-weight: 900;
    color: var(--neon-red);
    text-shadow: 0 0 10px rgba(231, 76, 60, 0.8);
    letter-spacing: 2px;
}

.game-over-reason {
    font-size: 1.05rem;
    color: #cbd5e1;
}

.btn-restart-overlay {
    padding: 12px 28px;
    background: linear-gradient(135deg, #e74c3c, #c0392b);
    color: #fff;
    border: none;
    border-radius: 30px;
    font-size: 1rem;
    font-weight: bold;
    cursor: pointer;
    box-shadow: 0 4px 15px rgba(231, 76, 60, 0.5);
    transition: transform 0.1s, box-shadow 0.2s;
}

.btn-restart-overlay:active {
    transform: scale(0.96);
}

/* 控制条按钮 */
.action-controls {
    width: 100%;
    display: flex;
    gap: 10px;
    margin-top: 12px;
}

.btn-action {
    flex: 1;
    padding: 10px 0;
    background: #334155;
    color: #f8fafc;
    border: 1px solid #475569;
    border-radius: 8px;
    font-weight: bold;
    font-size: 0.9rem;
    cursor: pointer;
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 6px;
    transition: background-color 0.15s, transform 0.1s;
}

.btn-action:active {
    background: var(--btn-active);
    transform: scale(0.98);
}

.btn-primary {
    background: linear-gradient(135deg, #27ae60, #2ecc71);
    color: #ffffff;
    border: none;
    box-shadow: 0 3px 10px rgba(46, 204, 113, 0.3);
}

.btn-primary:active {
    background: linear-gradient(135deg, #219653, #27ae60);
}

/* 触屏移动端虚拟控制器 (D-Pad + 射击键) */
.touch-controller {
    width: 100%;
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 14px;
    padding: 0 10px;
    touch-action: none;
}

/* 十字方向键容器 */
.d-pad {
    position: relative;
    width: 130px;
    height: 130px;
}

.d-btn {
    position: absolute;
    background: #1e293b;
    border: 2px solid #475569;
    color: #cbd5e1;
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 20px;
    user-select: none;
    cursor: pointer;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.4);
    border-radius: 8px;
    touch-action: none;
}

.d-btn.active, .d-btn:active {
    background: #3b82f6;
    color: #fff;
    border-color: #60a5fa;
    box-shadow: 0 0 12px rgba(59, 130, 246, 0.8);
}

.d-up {
    top: 0;
    left: 42px;
    width: 46px;
    height: 44px;
}

.d-down {
    bottom: 0;
    left: 42px;
    width: 46px;
    height: 44px;
}

.d-left {
    top: 42px;
    left: 0;
    width: 44px;
    height: 46px;
}

.d-right {
    top: 42px;
    right: 0;
    width: 44px;
    height: 46px;
}

.d-center {
    top: 44px;
    left: 44px;
    width: 42px;
    height: 42px;
    background: #0f172a;
    border-radius: 4px;
    pointer-events: none;
    position: absolute;
}

/* 开火主按钮 */
.fire-section {
    display: flex;
    justify-content: center;
    align-items: center;
    padding-right: 12px;
}

.btn-fire-touch {
    width: 84px;
    height: 84px;
    border-radius: 50%;
    background: radial-gradient(circle at 30% 30%, #ff6b6b, #c0392b);
    border: 3px solid #ff7675;
    color: #ffffff;
    font-weight: 900;
    font-size: 1.15rem;
    box-shadow: 0 6px 16px rgba(231, 76, 60, 0.5), inset 0 -4px 8px rgba(0, 0, 0, 0.4);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 2px;
    cursor: pointer;
    touch-action: none;
    transition: transform 0.08s, box-shadow 0.08s;
}

.btn-fire-touch.active, .btn-fire-touch:active {
    transform: scale(0.92);
    background: radial-gradient(circle at 30% 30%, #e74c3c, #962d22);
    box-shadow: 0 2px 6px rgba(231, 76, 60, 0.8);
}

.btn-fire-touch span {
    font-size: 0.75rem;
    opacity: 0.85;
}

/* 底部操作说明 */
.footer-tips {
    margin-top: 14px;
    font-size: 0.75rem;
    color: #64748b;
    text-align: center;
    line-height: 1.4;
}

.key-tip {
    display: inline-block;
    padding: 1px 6px;
    background: #334155;
    color: #f8fafc;
    border-radius: 4px;
    margin: 0 2px;
    border: 1px solid #475569;
}
