/* ========================================================
   影子协议 (Shadow Protocol) - Futuristic Cyberpunk CSS v2.3
   ======================================================== */

:root {
    --bg-dark: #060913;
    --bg-surface: #0a1122;
    --bg-panel: rgba(10, 17, 34, 0.88);
    --bg-card: #0d172e;
    --border-color: #1e3355;
    --border-subtle: rgba(0, 240, 255, 0.15);
    --border-glow: rgba(0, 240, 255, 0.35);
    
    --neon-cyan: #00f0ff;
    --neon-blue: #38bdf8;
    --neon-amber: #f59e0b;
    --neon-magenta: #ec4899;
    --neon-purple: #a855f7;
    --neon-green: #10b981;
    --neon-red: #ef4444;
    
    --text-primary: #f8fafc;
    --text-secondary: #cbd5e1;
    --text-muted: #64748b;
    --text-dim: #475569;
    
    --font-sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
    --font-mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Monaco, Consolas, "Liberation Mono", monospace;
    
    --glow-cyan: 0 0 14px rgba(0, 240, 255, 0.5);
    --glow-green: 0 0 14px rgba(16, 185, 129, 0.5);
    --glow-amber: 0 0 14px rgba(245, 158, 11, 0.5);
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    user-select: none;
    -webkit-user-select: none;
    touch-action: manipulation;
    scrollbar-width: thin;
    scrollbar-color: #1e355b rgba(6, 11, 22, 0.6);
}

body {
    background-color: var(--bg-dark);
    color: var(--text-primary);
    font-family: var(--font-sans);
    overflow: hidden;
    width: 100vw;
    height: 100vh;
    height: 100dvh;
    display: flex;
    justify-content: center;
    align-items: center;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

#game-container {
    position: relative;
    width: 100vw;
    height: 100vh;
    height: 100dvh;
    max-width: 1600px;
    max-height: 960px;
    display: flex;
    flex-direction: column;
    background: radial-gradient(ellipse at 50% 30%, #0c1833 0%, #060913 85%);
    box-shadow: 0 0 50px rgba(0, 240, 255, 0.12);
    padding-left: env(safe-area-inset-left, 0px);
    padding-right: env(safe-area-inset-right, 0px);
}

/* ================= 全局滚动条样式 ================= */
::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}
::-webkit-scrollbar-track {
    background: rgba(6, 11, 22, 0.6);
    border-radius: 3px;
}
::-webkit-scrollbar-thumb {
    background: #1e355b;
    border-radius: 3px;
    border: 1px solid rgba(0, 240, 255, 0.15);
}
::-webkit-scrollbar-thumb:hover {
    background: var(--neon-cyan);
    box-shadow: var(--glow-cyan);
}

/* ================= 顶部 HUD ================= */
#hud-top {
    height: 64px;
    background: var(--bg-panel);
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 20px;
    z-index: 20;
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    flex-shrink: 0;
}

.logo-area {
    display: flex;
    flex-direction: column;
    justify-content: center;
    min-width: 180px;
}

.game-logo {
    font-family: var(--font-mono);
    font-size: 1.15rem;
    font-weight: 900;
    letter-spacing: 2.5px;
    color: var(--neon-cyan);
    text-shadow: 0 0 12px rgba(0, 240, 255, 0.7);
    line-height: 1.2;
}

.game-logo-sub {
    font-family: var(--font-sans);
    font-size: 0.68rem;
    color: var(--text-muted);
    letter-spacing: 1.2px;
    margin-top: 2px;
    font-weight: 500;
}

/* 10秒时间记忆轮盘与进度条 */
.timeline-container {
    flex: 1;
    max-width: 440px;
    margin: 0 24px;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.timeline-header {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    font-size: 0.75rem;
    font-weight: 700;
    letter-spacing: 0.8px;
}

.timeline-label {
    color: var(--neon-cyan);
    font-size: 0.75rem;
    font-weight: 600;
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

.time-counter {
    font-family: var(--font-mono);
    font-size: 0.95rem;
    font-weight: 800;
    color: #ffffff;
    font-variant-numeric: tabular-nums;
    text-shadow: 0 0 8px rgba(0, 240, 255, 0.6);
}

.timeline-bar-bg {
    position: relative;
    height: 8px;
    background: #081122;
    border: 1px solid #1a3255;
    border-radius: 4px;
    overflow: hidden;
    box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.6);
}

.timeline-bar-fill {
    height: 100%;
    width: 0%;
    background: linear-gradient(90deg, #0284c7, var(--neon-cyan));
    box-shadow: 0 0 10px rgba(0, 240, 255, 0.7);
    transition: width 0.05s linear;
}

.timeline-bar-fill.warning {
    background: linear-gradient(90deg, var(--neon-amber), var(--neon-red));
    box-shadow: 0 0 10px rgba(239, 68, 68, 0.8);
}

.timeline-markers {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
}

.timeline-markers .marker {
    position: absolute;
    top: 0;
    width: 1px;
    height: 100%;
    background: rgba(255, 255, 255, 0.18);
}

/* 分身状态监控 Pill */
.shadow-status {
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 16px;
}

#clone-status-badge {
    min-width: 210px;
    height: 32px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0 14px;
    font-size: 0.75rem;
    font-weight: 700;
    border-radius: 6px;
    letter-spacing: 0.5px;
    font-family: var(--font-mono);
    border: 1px solid #1e355b;
    background: rgba(13, 23, 44, 0.7);
    color: var(--text-muted);
    transition: all 0.25s ease;
    white-space: nowrap;
}

#clone-status-badge.active {
    border-color: var(--neon-amber);
    color: #ffffff;
    background: rgba(245, 158, 11, 0.22);
    box-shadow: 0 0 14px rgba(245, 158, 11, 0.5);
    animation: clonePulse 1.2s infinite alternate;
}

@keyframes clonePulse {
    from { box-shadow: 0 0 8px rgba(245, 158, 11, 0.35); }
    to { box-shadow: 0 0 18px rgba(245, 158, 11, 0.85); }
}

/* 顶部按钮 */
.hud-controls {
    display: flex;
    align-items: center;
    gap: 8px;
}

.btn-hud {
    background: rgba(16, 29, 54, 0.75);
    border: 1px solid #224372;
    color: var(--text-secondary);
    padding: 6px 12px;
    font-size: 0.75rem;
    font-weight: 600;
    border-radius: 5px;
    cursor: pointer;
    transition: all 0.2s ease;
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

.btn-hud:hover {
    background: rgba(0, 240, 255, 0.18);
    border-color: var(--neon-cyan);
    color: #ffffff;
    box-shadow: 0 0 10px rgba(0, 240, 255, 0.4);
    transform: translateY(-1px);
}

.btn-hud:active {
    transform: translateY(0);
}

.btn-editor-accent {
    border-color: rgba(0, 240, 255, 0.45);
    background: linear-gradient(135deg, rgba(0, 240, 255, 0.15), rgba(56, 189, 248, 0.1));
    color: var(--neon-cyan);
}

.btn-editor-accent:hover {
    background: linear-gradient(135deg, rgba(0, 240, 255, 0.3), rgba(56, 189, 248, 0.25));
    border-color: var(--neon-cyan);
    box-shadow: 0 0 12px rgba(0, 240, 255, 0.6);
}

/* ================= 关卡编辑器工具栏 ================= */
#editor-toolbar {
    position: relative;
    width: 100%;
    background: rgba(7, 13, 26, 0.98);
    border-bottom: 2px solid var(--neon-cyan);
    padding: 10px 20px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.75);
    z-index: 25;
    flex-shrink: 0;
}

#editor-toolbar.hidden {
    display: none !important;
}

.editor-row {
    display: flex;
    align-items: center;
    gap: 12px;
}

.editor-tools-row {
    justify-content: flex-start;
}

.editor-tools-group {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-wrap: wrap;
}

.editor-config-row {
    border-top: 1px solid rgba(30, 58, 99, 0.6);
    padding-top: 8px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    flex-wrap: wrap;
}

.editor-config-left {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
}

.editor-config-item {
    display: flex;
    align-items: center;
    gap: 6px;
}

.editor-label {
    font-size: 0.72rem;
    font-weight: 700;
    color: var(--neon-cyan);
    white-space: nowrap;
    letter-spacing: 0.5px;
    text-transform: uppercase;
}

.editor-select {
    background: #0d1a33;
    border: 1px solid #234575;
    color: #e2e8f0;
    padding: 5px 10px;
    font-size: 0.75rem;
    font-weight: 600;
    border-radius: 5px;
    outline: none;
    cursor: pointer;
    transition: all 0.2s ease;
    min-height: 28px;
}

.editor-select:focus, .editor-select:hover {
    border-color: var(--neon-cyan);
    box-shadow: 0 0 8px rgba(0, 240, 255, 0.4);
    background: #112242;
}

.editor-input {
    background: #0d1a33;
    border: 1px solid #234575;
    color: #ffffff;
    padding: 5px 10px;
    font-size: 0.75rem;
    border-radius: 5px;
    width: 140px;
    outline: none;
    transition: all 0.2s ease;
    min-height: 28px;
}

.editor-input:focus, .editor-input:hover {
    border-color: var(--neon-cyan);
    box-shadow: 0 0 8px rgba(0, 240, 255, 0.4);
    background: #112242;
}

.tool-btn {
    background: #0f1c34;
    border: 1px solid #213d6a;
    color: var(--text-secondary);
    padding: 5px 10px;
    font-size: 0.73rem;
    font-weight: 600;
    border-radius: 5px;
    cursor: pointer;
    white-space: nowrap;
    transition: all 0.15s ease;
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

.tool-btn:hover {
    background: #193259;
    border-color: var(--neon-cyan);
    color: #ffffff;
    transform: translateY(-1px);
}

.tool-btn.active {
    background: rgba(0, 240, 255, 0.22);
    border-color: var(--neon-cyan);
    color: #ffffff;
    box-shadow: 0 0 12px rgba(0, 240, 255, 0.55);
}

/* 零件色彩标识 */
.tool-cyan.active { border-color: var(--neon-cyan); }
.tool-green.active { border-color: var(--neon-green); box-shadow: var(--glow-green); }
.tool-red.active { border-color: var(--neon-red); box-shadow: 0 0 12px rgba(239, 68, 68, 0.55); }
.tool-blue.active { border-color: var(--neon-blue); box-shadow: 0 0 12px rgba(56, 189, 248, 0.55); }
.tool-purple.active { border-color: var(--neon-purple); box-shadow: 0 0 12px rgba(168, 85, 247, 0.55); }
.tool-amber.active { border-color: var(--neon-amber); box-shadow: var(--glow-amber); }
.tool-key.active { border-color: var(--neon-cyan); box-shadow: var(--glow-cyan); }

.editor-actions-group {
    display: flex;
    gap: 6px;
    align-items: center;
    flex-wrap: wrap;
}

.action-btn-sm {
    background: #12213d;
    border: 1px solid #234374;
    color: var(--text-secondary);
    padding: 5px 11px;
    font-size: 0.73rem;
    font-weight: 700;
    border-radius: 5px;
    cursor: pointer;
    white-space: nowrap;
    transition: all 0.15s ease;
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

.action-btn-sm:hover {
    color: #ffffff;
    transform: translateY(-1px);
}

.action-btn-sm:active {
    transform: translateY(0);
}

.btn-action-play {
    background: linear-gradient(135deg, rgba(16, 185, 129, 0.25), rgba(0, 240, 255, 0.25));
    border-color: var(--neon-green);
    color: #a7f3d0;
}
.btn-action-play:hover {
    background: linear-gradient(135deg, rgba(16, 185, 129, 0.45), rgba(0, 240, 255, 0.45));
    color: #ffffff;
    box-shadow: 0 0 12px rgba(16, 185, 129, 0.6);
}

.btn-action-save {
    border-color: #2563eb;
    color: #93c5fd;
}
.btn-action-save:hover {
    background: rgba(37, 99, 235, 0.25);
    border-color: #60a5fa;
    box-shadow: 0 0 10px rgba(96, 165, 250, 0.4);
}

.btn-action-export {
    border-color: #059669;
    color: #6ee7b7;
}
.btn-action-export:hover {
    background: rgba(5, 150, 105, 0.25);
    border-color: #34d399;
    box-shadow: 0 0 10px rgba(52, 211, 153, 0.4);
}

.btn-action-import {
    border-color: #0284c7;
    color: #7dd3fc;
}
.btn-action-import:hover {
    background: rgba(2, 132, 199, 0.25);
    border-color: #38bdf8;
    box-shadow: 0 0 10px rgba(56, 189, 248, 0.4);
}

.btn-action-clear {
    border-color: #991b1b;
    color: #fca5a5;
}
.btn-action-clear:hover {
    background: rgba(153, 27, 27, 0.25);
    border-color: #f87171;
    box-shadow: 0 0 10px rgba(248, 113, 113, 0.4);
}

.btn-action-exit {
    border-color: #475569;
    color: #94a3b8;
}
.btn-action-exit:hover {
    background: rgba(71, 85, 105, 0.3);
    border-color: #cbd5e1;
    color: #ffffff;
}

/* ================= 游戏画布区域 ================= */
#canvas-wrapper {
    position: relative;
    flex: 1;
    width: 100%;
    height: 100%;
    display: flex;
    justify-content: center;
    align-items: center;
    overflow: hidden;
    background: #050811;
}

#gameCanvas {
    width: 100%;
    height: 100%;
    object-fit: contain;
    image-rendering: -moz-crisp-edges;
    image-rendering: -webkit-crisp-edges;
    image-rendering: pixelated;
    image-rendering: crisp-edges;
    display: block;
    touch-action: none;
    -webkit-touch-callout: none;
}

/* 扫描线效果 */
#crt-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    background: linear-gradient(rgba(18, 16, 16, 0) 50%, rgba(0, 0, 0, 0.2) 50%);
    background-size: 100% 4px;
    z-index: 5;
    opacity: 0.45;
}

/* Toast 提示 */
#toast-message {
    position: absolute;
    top: 24px;
    left: 50%;
    transform: translate(-50%, 0);
    background: rgba(10, 19, 38, 0.92);
    border: 1px solid var(--neon-cyan);
    color: #ffffff;
    padding: 8px 20px;
    border-radius: 6px;
    font-size: 0.85rem;
    font-weight: 600;
    letter-spacing: 0.6px;
    box-shadow: 0 4px 20px rgba(0, 240, 255, 0.35);
    z-index: 40;
    transition: opacity 0.25s ease, transform 0.25s ease;
    pointer-events: none;
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.toast-hidden {
    opacity: 0;
    transform: translate(-50%, -14px) !important;
}

/* ================= 底部操作栏 ================= */
#hud-bottom {
    min-height: 60px;
    background: var(--bg-panel);
    border-top: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 8px 20px;
    z-index: 20;
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    position: relative;
    flex-shrink: 0;
}

.action-buttons-group {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
    justify-content: center;
    align-items: center;
}

.action-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background: #0f1c34;
    border: 1px solid #234374;
    color: var(--text-primary);
    padding: 8px 16px;
    font-size: 0.85rem;
    font-weight: 600;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.15s ease-in-out;
}

.action-btn:hover {
    background: #19335d;
    border-color: var(--neon-cyan);
    color: #ffffff;
    box-shadow: 0 0 12px rgba(0, 240, 255, 0.35);
    transform: translateY(-1px);
}

.action-btn:active {
    transform: translateY(1px);
}

.action-btn.btn-highlight {
    background: linear-gradient(135deg, rgba(0, 240, 255, 0.22), rgba(2, 132, 199, 0.22));
    border-color: var(--neon-cyan);
    color: #ffffff;
    box-shadow: 0 0 14px rgba(0, 240, 255, 0.4);
}

.action-btn.btn-highlight:hover {
    background: linear-gradient(135deg, rgba(0, 240, 255, 0.38), rgba(2, 132, 199, 0.38));
    box-shadow: 0 0 20px rgba(0, 240, 255, 0.7);
}

.btn-icon {
    font-size: 0.95rem;
    display: inline-flex;
    align-items: center;
}

.btn-text {
    font-size: 0.85rem;
    font-weight: 600;
}

.btn-kbd {
    background: rgba(0, 0, 0, 0.45);
    border: 1px solid rgba(0, 240, 255, 0.3);
    border-radius: 3px;
    padding: 1px 6px;
    font-family: var(--font-mono);
    font-size: 0.68rem;
    color: #93c5fd;
    box-shadow: 0 1px 0 rgba(0, 0, 0, 0.5);
    line-height: 1.3;
}

/* 触屏虚拟摇杆 (移动端) */
#touch-joystick-zone {
    display: none;
    position: absolute;
    left: 20px;
    bottom: 80px;
    width: 120px;
    height: 120px;
    z-index: 30;
    touch-action: none;
    -webkit-touch-callout: none;
}

#joystick-base {
    position: relative;
    width: 100%;
    height: 100%;
    background: rgba(14, 25, 45, 0.65);
    border: 2px solid var(--neon-cyan);
    border-radius: 50%;
    box-shadow: 0 0 15px rgba(0, 240, 255, 0.35);
    touch-action: none;
    -webkit-touch-callout: none;
}

#joystick-thumb {
    position: absolute;
    width: 44px;
    height: 44px;
    top: 38px;
    left: 38px;
    background: var(--neon-cyan);
    border-radius: 50%;
    box-shadow: 0 0 12px var(--neon-cyan);
    pointer-events: none;
    touch-action: none;
}

#hud-bottom.editor-active {
    display: none !important;
}

/* ================= 弹窗与遮罩 ================= */
.modal-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(3, 7, 16, 0.82);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 100;
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    transition: opacity 0.25s ease;
}

.modal-overlay.hidden {
    display: none !important;
    opacity: 0;
}

.modal-card {
    background: #0b152b;
    border: 1px solid var(--neon-cyan);
    border-radius: 10px;
    padding: 24px;
    max-width: 560px;
    width: 92%;
    max-height: 88vh;
    max-height: 88dvh;
    overflow-y: auto;
    overscroll-behavior: contain;
    -webkit-overflow-scrolling: touch;
    box-shadow: 0 0 35px rgba(0, 240, 255, 0.3);
    color: var(--text-primary);
    animation: modalPop 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes modalPop {
    from {
        opacity: 0;
        transform: scale(0.95) translateY(-8px);
    }
    to {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
}

.modal-header {
    margin-bottom: 18px;
    text-align: center;
}

.modal-card h2 {
    color: var(--neon-cyan);
    font-size: 1.35rem;
    font-weight: 800;
    text-shadow: 0 0 10px rgba(0, 240, 255, 0.5);
    letter-spacing: 1px;
}

.modal-subtitle {
    display: block;
    font-size: 0.72rem;
    color: var(--text-muted);
    letter-spacing: 1.2px;
    margin-top: 4px;
    font-family: var(--font-mono);
}

/* 操作指南卡片 */
.help-card {
    max-width: 440px;
}

.keys-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin: 16px 0;
}

.key-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: rgba(16, 29, 56, 0.5);
    border: 1px solid #1a355f;
    border-radius: 6px;
    padding: 8px 12px;
    transition: background 0.15s ease;
}

.key-row:hover {
    background: rgba(16, 29, 56, 0.85);
    border-color: rgba(0, 240, 255, 0.3);
}

.key-badge-group {
    display: flex;
    gap: 4px;
    align-items: center;
}

.key-badge-group kbd {
    background: #192a48;
    border: 1px solid #33598e;
    border-radius: 4px;
    padding: 3px 8px;
    font-family: var(--font-mono);
    font-size: 0.78rem;
    font-weight: 700;
    color: #ffffff;
    box-shadow: 0 2px 0 #0d1727;
}

.key-desc {
    font-size: 0.82rem;
    color: #e2e8f0;
    font-weight: 500;
    text-align: right;
}

.help-tip {
    background: rgba(245, 158, 11, 0.1);
    border: 1px solid rgba(245, 158, 11, 0.3);
    border-radius: 6px;
    padding: 10px 12px;
    margin-bottom: 18px;
    font-size: 0.76rem;
    line-height: 1.5;
    color: #fde68a;
    display: flex;
    align-items: flex-start;
    gap: 8px;
}

.tip-icon {
    font-size: 0.9rem;
    flex-shrink: 0;
}

/* 按钮规范 */
.btn-action {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    padding: 11px 18px;
    background: var(--neon-cyan);
    color: #030814;
    border: none;
    border-radius: 6px;
    font-size: 0.92rem;
    font-weight: 800;
    letter-spacing: 0.8px;
    cursor: pointer;
    box-shadow: 0 0 16px rgba(0, 240, 255, 0.5);
    transition: all 0.2s ease;
}

.btn-action:hover {
    background: #ffffff;
    box-shadow: 0 0 25px rgba(0, 240, 255, 0.8);
    transform: translateY(-1px);
}

.btn-action:active {
    transform: translateY(0);
}

.btn-secondary {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 11px 18px;
    background: #14223d;
    color: #94a3b8;
    border: 1px solid #254474;
    border-radius: 6px;
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
}

.btn-secondary:hover {
    background: #1e355e;
    color: #ffffff;
    border-color: #3b82f6;
}

.btn-secondary:active {
    transform: translateY(0);
}

/* 关卡选择列表 */
.levels-card {
    max-width: 580px;
}

.level-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
    max-height: 52vh;
    overflow-y: auto;
    padding-right: 6px;
    margin-bottom: 16px;
}

.level-item {
    display: flex;
    align-items: center;
    background: #0f1c34;
    border: 1px solid #1f3c66;
    padding: 10px 14px;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s ease;
    color: #ffffff;
    text-align: left;
    width: 100%;
}

.level-item:hover {
    border-color: var(--neon-cyan);
    background: rgba(0, 240, 255, 0.08);
    box-shadow: 0 0 10px rgba(0, 240, 255, 0.25);
    transform: translateX(2px);
}

.level-item.active {
    border-color: var(--neon-cyan);
    background: rgba(0, 240, 255, 0.16);
    box-shadow: 0 0 14px rgba(0, 240, 255, 0.4);
}

.lvl-num {
    font-family: var(--font-mono);
    font-size: 1.15rem;
    font-weight: 900;
    color: var(--neon-cyan);
    min-width: 38px;
    flex-shrink: 0;
}

.lvl-info {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.lvl-title {
    font-size: 0.9rem;
    font-weight: 700;
    color: #f1f5f9;
}

.lvl-sub {
    font-size: 0.7rem;
    color: var(--text-muted);
}

.lvl-tag {
    font-size: 0.7rem;
    font-weight: 600;
    padding: 3px 8px;
    border-radius: 4px;
    background: #162846;
    color: var(--text-secondary);
    border: 1px solid rgba(255, 255, 255, 0.08);
    white-space: nowrap;
    margin-left: 8px;
}

.tag-cyan { color: var(--neon-cyan); border-color: rgba(0, 240, 255, 0.3); }
.tag-blue { color: var(--neon-blue); border-color: rgba(56, 189, 248, 0.3); }
.tag-purple { color: var(--neon-purple); border-color: rgba(168, 85, 247, 0.3); }
.tag-amber { color: var(--neon-amber); border-color: rgba(245, 158, 11, 0.3); }

.custom-levels-header {
    display: flex;
    align-items: center;
    text-align: center;
    font-size: 0.72rem;
    font-weight: 700;
    color: var(--neon-amber);
    margin: 14px 0 8px 0;
    letter-spacing: 1.5px;
    text-transform: uppercase;
}

.custom-levels-header::before,
.custom-levels-header::after {
    content: "";
    flex: 1;
    height: 1px;
    background: linear-gradient(90deg, transparent, rgba(245, 158, 11, 0.4), transparent);
}

.custom-levels-header span {
    padding: 0 10px;
}

.custom-slot-btn {
    border-color: #3b3a20 !important;
    background: rgba(20, 22, 12, 0.6) !important;
}

.custom-slot-btn .lvl-num {
    color: var(--neon-amber) !important;
}

.custom-slot-btn:hover {
    border-color: var(--neon-amber) !important;
    background: rgba(245, 158, 11, 0.12) !important;
    box-shadow: 0 0 12px rgba(245, 158, 11, 0.3) !important;
}

.custom-slot-btn.active {
    border-color: var(--neon-amber) !important;
    background: rgba(245, 158, 11, 0.22) !important;
    box-shadow: 0 0 16px rgba(245, 158, 11, 0.5) !important;
}

.modal-file-actions {
    display: flex;
    gap: 10px;
    margin-top: 14px;
}

.modal-file-actions button:first-child {
    flex: 1;
}

.modal-file-actions button:last-child {
    flex: 0 0 90px;
}

/* 结算胜利卡片 */
.victory-card {
    text-align: center;
    border-color: var(--neon-green);
    box-shadow: 0 0 40px rgba(16, 185, 129, 0.35);
    max-width: 440px;
}

.victory-header {
    margin-bottom: 20px;
}

.victory-badge {
    display: inline-block;
    padding: 3px 10px;
    font-size: 0.68rem;
    font-weight: 800;
    font-family: var(--font-mono);
    color: var(--neon-green);
    background: rgba(16, 185, 129, 0.15);
    border: 1px solid rgba(16, 185, 129, 0.4);
    border-radius: 4px;
    letter-spacing: 1.5px;
    margin-bottom: 8px;
}

.victory-card h2 {
    color: #ffffff;
    font-size: 1.5rem;
    text-shadow: 0 0 16px rgba(16, 185, 129, 0.7);
}

.stats-row {
    display: flex;
    justify-content: space-around;
    gap: 12px;
    margin: 20px 0;
}

.stat-box {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 14px 10px;
    background: rgba(8, 16, 32, 0.6);
    border-radius: 8px;
    border: 1px solid #1c385e;
}

.stat-label {
    font-size: 0.72rem;
    color: var(--text-muted);
    margin-bottom: 6px;
    font-weight: 600;
    letter-spacing: 0.5px;
}

.stat-val {
    font-size: 1.4rem;
    font-weight: 900;
    color: var(--neon-green);
    font-family: var(--font-mono);
    font-variant-numeric: tabular-nums;
    text-shadow: 0 0 10px rgba(16, 185, 129, 0.6);
}

.modal-buttons {
    display: flex;
    gap: 10px;
    margin-top: 14px;
}

.modal-buttons .btn-action {
    flex: 1;
}

.modal-buttons .btn-secondary {
    flex: 1;
}

.pulse {
    animation: pulseGlow 1.4s infinite alternate;
}

@keyframes pulseGlow {
    from { box-shadow: 0 0 10px rgba(16, 185, 129, 0.4); }
    to { box-shadow: 0 0 24px rgba(16, 185, 129, 0.9); }
}

/* 导入成功弹窗 */
.import-card {
    max-width: 420px;
    text-align: center;
}

.import-desc {
    font-size: 0.85rem;
    color: var(--text-secondary);
    line-height: 1.6;
    margin: 12px 0 18px 0;
}

/* ========================================================
   多平台适配与响应式排版 (手机、平板、电脑)
   ======================================================== */

/* 1. 触屏/粗指针设备交互优化 */
@media (hover: none) and (pointer: coarse) {
    .btn-kbd {
        display: none !important;
    }
    .action-btn {
        min-height: 44px;
        touch-action: manipulation;
    }
    .btn-hud {
        min-height: 34px;
    }
}

/* 2. 平板与中等屏幕 (max-width: 1024px) */
@media (max-width: 1024px) {
    #hud-top {
        padding: 0 max(16px, env(safe-area-inset-right, 16px)) 0 max(16px, env(safe-area-inset-left, 16px));
    }
    .timeline-container {
        max-width: 280px;
        margin: 0 14px;
    }
    #clone-status-badge {
        min-width: 180px;
    }
    .modal-card {
        max-width: 520px;
    }
}

/* 3. 移动端与小型平板 (max-width: 768px) */
@media (max-width: 768px) {
    #hud-top {
        height: 54px;
        padding: 0 max(12px, env(safe-area-inset-right, 12px)) 0 max(12px, env(safe-area-inset-left, 12px));
    }
    .logo-area {
        min-width: unset;
    }
    .game-logo {
        font-size: 0.95rem;
        letter-spacing: 1.5px;
    }
    .game-logo-sub {
        display: none;
    }
    .timeline-container {
        margin: 0 8px;
        max-width: 200px;
    }
    #clone-status-badge {
        min-width: 140px;
        font-size: 0.7rem;
        padding: 0 8px;
    }
    .hud-controls {
        gap: 6px;
    }
    .btn-hud {
        padding: 5px 9px;
        font-size: 0.72rem;
    }
    
    #editor-toolbar {
        padding: 8px 12px;
        gap: 8px;
        max-height: 40vh;
        overflow-y: auto;
    }
    .editor-tools-group {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        flex-wrap: nowrap;
        scrollbar-width: none;
        max-width: 100%;
        padding-bottom: 2px;
    }
    .editor-tools-group::-webkit-scrollbar {
        display: none;
    }
    .tool-btn {
        padding: 4px 8px;
        font-size: 0.7rem;
        flex-shrink: 0;
    }
    .editor-config-row {
        gap: 10px;
    }
    .editor-config-left {
        gap: 8px;
    }
    .editor-input {
        width: 110px;
    }
    .editor-select {
        font-size: 0.7rem;
        padding: 4px 8px;
    }
    .action-btn-sm {
        padding: 4px 8px;
        font-size: 0.7rem;
    }
    
    #hud-bottom {
        padding: 6px max(10px, env(safe-area-inset-right, 10px)) max(8px, env(safe-area-inset-bottom, 8px)) max(10px, env(safe-area-inset-left, 10px));
        min-height: 52px;
    }
    .action-buttons-group {
        gap: 8px;
    }
    .action-btn {
        padding: 6px 12px;
        font-size: 0.78rem;
        min-height: 40px;
        gap: 6px;
    }
    .btn-kbd {
        display: none;
    }

    .modal-card {
        padding: 20px 16px;
        width: 94%;
        max-height: 85vh;
        max-height: 85dvh;
    }
}

/* 4. 智能手机竖屏排版 (max-width: 540px) */
@media (max-width: 540px) {
    #hud-top {
        height: 50px;
        padding: 0 8px;
        gap: 4px;
    }
    .game-logo {
        font-size: 0.85rem;
        letter-spacing: 1px;
    }
    .timeline-container {
        margin: 0 4px;
        max-width: 130px;
    }
    .timeline-label {
        font-size: 0.65rem;
    }
    .time-counter {
        font-size: 0.78rem;
    }
    #clone-status-badge {
        min-width: unset;
        max-width: 120px;
        font-size: 0.65rem;
        padding: 0 6px;
        text-overflow: ellipsis;
        overflow: hidden;
    }
    .hud-controls {
        gap: 4px;
    }
    .btn-hud {
        padding: 4px 6px;
        font-size: 0.68rem;
    }
    
    #hud-bottom {
        padding: 5px 6px max(6px, env(safe-area-inset-bottom, 6px)) 6px;
        min-height: 50px;
    }
    .action-buttons-group {
        gap: 5px;
    }
    .action-btn {
        padding: 6px 8px;
        font-size: 0.72rem;
        min-height: 38px;
        gap: 4px;
    }
    .btn-icon {
        font-size: 0.85rem;
    }
    .btn-text {
        font-size: 0.72rem;
    }

    #touch-joystick-zone {
        left: 12px;
        bottom: 74px;
        width: 110px;
        height: 110px;
    }
    #joystick-thumb {
        width: 40px;
        height: 40px;
        top: 35px;
        left: 35px;
    }

    .modal-card {
        padding: 16px 12px;
        width: 96%;
    }
    .modal-card h2 {
        font-size: 1.15rem;
    }
    .level-list {
        max-height: 45dvh;
    }
    .level-item {
        padding: 8px 10px;
    }
    .lvl-num {
        font-size: 1rem;
        min-width: 32px;
    }
    .lvl-title {
        font-size: 0.82rem;
    }
    .lvl-tag {
        font-size: 0.65rem;
        padding: 2px 5px;
    }
}

/* 5. 超窄屏设备适配 (max-width: 380px) */
@media (max-width: 380px) {
    .timeline-label {
        display: none;
    }
    .timeline-container {
        max-width: 90px;
        margin: 0 2px;
    }
    #clone-status-badge {
        max-width: 90px;
        font-size: 0.6rem;
        padding: 0 4px;
    }
    .action-btn {
        padding: 5px 6px;
        font-size: 0.68rem;
    }
}

/* 6. 移动端横屏专注游戏模式 (max-height: 500px 且横屏) */
@media (max-height: 500px) and (orientation: landscape) {
    #hud-top {
        height: 42px;
        padding: 0 max(16px, env(safe-area-inset-right, 16px)) 0 max(16px, env(safe-area-inset-left, 16px));
    }
    .game-logo {
        font-size: 0.82rem;
        letter-spacing: 1px;
    }
    .game-logo-sub {
        display: none;
    }
    .timeline-container {
        max-width: 180px;
        margin: 0 8px;
    }
    .timeline-bar-bg {
        height: 6px;
    }
    #clone-status-badge {
        height: 26px;
        min-width: unset;
        font-size: 0.65rem;
        padding: 0 8px;
    }
    .btn-hud {
        padding: 3px 8px;
        font-size: 0.68rem;
    }

    #editor-toolbar {
        padding: 4px 12px;
        gap: 4px;
        max-height: 140px;
        overflow-y: auto;
    }
    .tool-btn {
        padding: 3px 6px;
        font-size: 0.65rem;
    }
    .editor-select, .editor-input, .action-btn-sm {
        min-height: 24px;
        padding: 2px 6px;
        font-size: 0.68rem;
    }

    #hud-bottom {
        min-height: 44px;
        padding: 3px max(14px, env(safe-area-inset-right, 14px)) max(4px, env(safe-area-inset-bottom, 4px)) max(14px, env(safe-area-inset-left, 14px));
    }
    .action-btn {
        padding: 4px 10px;
        font-size: 0.72rem;
        min-height: 34px;
    }
    .btn-kbd {
        display: none;
    }

    #touch-joystick-zone {
        left: max(14px, env(safe-area-inset-left, 14px));
        bottom: 52px;
        width: 96px;
        height: 96px;
    }
    #joystick-thumb {
        width: 36px;
        height: 36px;
        top: 30px;
        left: 30px;
    }

    .modal-card {
        padding: 14px 18px;
        max-height: 92dvh;
    }
    .modal-header {
        margin-bottom: 8px;
    }
    .modal-card h2 {
        font-size: 1.1rem;
    }
    .level-list {
        max-height: 42dvh;
    }
    .stats-row {
        margin: 10px 0;
    }
    .stat-box {
        padding: 8px 6px;
    }
    .stat-val {
        font-size: 1.15rem;
    }
}
