/* 样式表配置：NEON TETRIS 赛博朋克霓虹主题 */

:root {
    --bg-color: #05050c;
    --card-bg: rgba(14, 12, 30, 0.6);
    --border-glow: rgba(0, 243, 255, 0.25);
    
    /* 霓虹主色调 */
    --neon-cyan: #00f3ff;
    --neon-pink: #ff007f;
    --neon-purple: #b50ff5;
    --neon-green: #39ff14;
    --neon-yellow: #ffe600;
    --neon-orange: #ff6c00;
    --neon-blue: #004cff;
    --neon-red: #ff073a;
    --neon-gray: #4a4a5a;
    
    /* 字体 */
    --font-display: 'Orbitron', sans-serif;
    --font-sans: 'Rajdhani', sans-serif;
}

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

html, body {
    width: 100%;
    height: 100%;
    overflow-x: hidden;
    background-color: var(--bg-color);
    font-family: var(--font-sans);
    color: #e2e8f0;
}

/* 页面背景图层 */
.stars-bg {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: 
        radial-gradient(ellipse at 50% 50%, rgba(20, 10, 45, 0.6) 0%, rgba(5, 5, 12, 1) 80%),
        radial-gradient(circle at 20% 30%, rgba(0, 243, 255, 0.08) 0%, transparent 40%),
        radial-gradient(circle at 80% 70%, rgba(255, 0, 127, 0.08) 0%, transparent 40%);
    z-index: -2;
}

.cyber-grid-bg {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-image: 
        linear-gradient(to right, rgba(0, 243, 255, 0.03) 1px, transparent 1px),
        linear-gradient(to bottom, rgba(0, 243, 255, 0.03) 1px, transparent 1px);
    background-size: 40px 40px;
    z-index: -1;
    mask-image: radial-gradient(circle at center, black 30%, transparent 95%);
    -webkit-mask-image: radial-gradient(circle at center, black 30%, transparent 95%);
}

/* 应用容器 */
.app-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-start;
    min-height: 100vh;
    padding: 20px 10px;
    max-width: 1200px;
    margin: 0 auto;
}

/* 头部样式 */
.game-header {
    text-align: center;
    margin-bottom: 25px;
    position: relative;
}

.neon-title {
    font-family: var(--font-display);
    font-size: 2.8rem;
    font-weight: 900;
    letter-spacing: 4px;
    color: #fff;
    text-transform: uppercase;
    position: relative;
    text-shadow: 
        0 0 5px rgba(255, 255, 255, 0.8),
        0 0 10px var(--neon-cyan),
        0 0 20px var(--neon-cyan),
        0 0 40px rgba(0, 243, 255, 0.5);
    animation: neon-pulse 2s infinite alternate;
}

.neon-title::before {
    content: attr(data-text);
    position: absolute;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    z-index: -1;
    opacity: 0.7;
    filter: blur(2px);
    color: var(--neon-pink);
    animation: glitch 4s infinite linear alternate-reverse;
}

.neon-subtitle {
    font-family: var(--font-sans);
    font-size: 1.1rem;
    font-weight: 600;
    letter-spacing: 6px;
    color: var(--neon-pink);
    text-transform: uppercase;
    margin-top: 5px;
    text-shadow: 0 0 8px rgba(255, 0, 127, 0.6);
}

/* 游戏主体布局 */
.game-layout {
    display: flex;
    flex-direction: row;
    align-items: flex-start;
    justify-content: center;
    gap: 25px;
    width: 100%;
    margin-bottom: 25px;
}

.side-panel {
    display: flex;
    flex-direction: column;
    gap: 20px;
    width: 220px;
}

/* 磨砂玻璃卡片 */
.glass-card {
    background: var(--card-bg);
    border: 1px solid var(--border-glow);
    border-radius: 12px;
    padding: 15px;
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    box-shadow: 
        0 8px 32px 0 rgba(0, 0, 0, 0.4),
        inset 0 0 15px rgba(0, 243, 255, 0.05);
    transition: all 0.3s ease;
}

.glass-card:hover {
    border-color: rgba(0, 243, 255, 0.5);
    box-shadow: 
        0 12px 40px 0 rgba(0, 243, 255, 0.15),
        inset 0 0 20px rgba(0, 243, 255, 0.08);
}

.panel-card {
    display: flex;
    flex-direction: column;
    align-items: center;
}

.card-title {
    font-family: var(--font-display);
    font-size: 0.95rem;
    font-weight: 700;
    letter-spacing: 2px;
    color: #94a3b8;
    margin-bottom: 12px;
    text-transform: uppercase;
    border-bottom: 2px solid rgba(255, 255, 255, 0.05);
    padding-bottom: 6px;
    width: 100%;
    text-align: center;
}

/* 暂存卡片 */
.canvas-container {
    display: flex;
    justify-content: center;
    align-items: center;
    background: rgba(5, 5, 10, 0.7);
    border-radius: 8px;
    border: 1px solid rgba(255, 255, 255, 0.05);
    padding: 10px;
    width: 100%;
}

#hold-canvas {
    display: block;
}

/* 数据卡片 */
.stats-card {
    align-items: stretch;
}

.stat-item {
    display: flex;
    flex-direction: column;
    margin-bottom: 12px;
}

.stat-item:last-child {
    margin-bottom: 0;
}

.stat-label {
    font-size: 0.8rem;
    font-weight: 600;
    letter-spacing: 1px;
    color: #64748b;
    margin-bottom: 2px;
}

.stat-val {
    font-family: var(--font-display);
    font-size: 1.6rem;
    font-weight: 800;
    letter-spacing: 1px;
    color: #fff;
    text-shadow: 0 0 5px currentColor;
}

/* 霓虹发光颜色 */
.neon-green { color: var(--neon-green); text-shadow: 0 0 8px rgba(57, 255, 20, 0.4); }
.neon-cyan { color: var(--neon-cyan); text-shadow: 0 0 8px rgba(0, 243, 255, 0.4); }
.neon-pink { color: var(--neon-pink); text-shadow: 0 0 8px rgba(255, 0, 127, 0.4); }

/* 下一个预览区 */
.queue-container {
    flex-direction: column;
    gap: 12px;
    padding: 15px;
}

.sub-next {
    opacity: 0.55;
    transform: scale(0.9);
    border-top: 1px solid rgba(255, 255, 255, 0.03);
    padding-top: 8px;
}

/* 操作说明卡片 */
.controls-info-card {
    align-items: stretch;
}

.info-grid {
    display: flex;
    flex-direction: column;
    gap: 8px;
    font-size: 0.85rem;
}

.info-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.key {
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: 4px;
    padding: 2px 6px;
    font-family: var(--font-display);
    font-size: 0.75rem;
    color: var(--neon-cyan);
    min-width: 48px;
    text-align: center;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
}

.desc {
    color: #94a3b8;
}

/* 核心游戏面板 */
.main-panel {
    display: flex;
    justify-content: center;
}

.board-wrapper {
    position: relative;
    border-radius: 16px;
    padding: 8px;
    background: rgba(10, 5, 20, 0.85);
    border: 2px solid var(--neon-cyan);
    box-shadow: 
        0 0 20px rgba(0, 243, 255, 0.3),
        inset 0 0 20px rgba(0, 243, 255, 0.1);
    overflow: hidden;
}

/* 游戏机框体扫描线特效 */
.scanlines {
    position: absolute;
    top: 8px;
    left: 8px;
    right: 8px;
    bottom: 8px;
    background: linear-gradient(
        rgba(18, 16, 16, 0) 50%, 
        rgba(0, 0, 0, 0.25) 50%
    );
    background-size: 100% 4px;
    z-index: 5;
    pointer-events: none;
    border-radius: 8px;
}

.scanlines::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: radial-gradient(
        circle,
        transparent 70%,
        rgba(0, 0, 0, 0.4) 100%
    );
}

#game-board {
    display: block;
    background: #020205;
    border-radius: 8px;
    box-shadow: inset 0 0 25px rgba(0, 0, 0, 0.95);
    z-index: 1;
}

/* 覆盖图层（开始/暂停/结束） */
.game-overlay {
    position: absolute;
    top: 8px;
    left: 8px;
    right: 8px;
    bottom: 8px;
    background: rgba(5, 3, 10, 0.85);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 10;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
    border-radius: 8px;
}

.game-overlay.show {
    opacity: 1;
    pointer-events: auto;
}

.overlay-content {
    text-align: center;
    padding: 20px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 15px;
}

.neon-glow-text {
    font-family: var(--font-display);
    font-size: 2.2rem;
    font-weight: 800;
    color: #fff;
    text-shadow: 
        0 0 10px var(--neon-pink),
        0 0 20px var(--neon-pink);
    margin-bottom: 5px;
    text-transform: uppercase;
}

.overlay-content p {
    font-size: 1rem;
    color: #94a3b8;
    max-width: 200px;
    line-height: 1.4;
    margin-bottom: 10px;
}

/* 赛博朋克按钮 */
.cyber-button {
    background: transparent;
    border: 1px solid var(--neon-cyan);
    color: var(--neon-cyan);
    font-family: var(--font-display);
    font-size: 1.1rem;
    font-weight: 700;
    padding: 12px 30px;
    border-radius: 4px;
    cursor: pointer;
    text-transform: uppercase;
    letter-spacing: 2px;
    position: relative;
    overflow: hidden;
    transition: all 0.2s ease;
    box-shadow: 0 0 10px rgba(0, 243, 255, 0.2);
}

.cyber-button:hover {
    background: var(--neon-cyan);
    color: #000;
    box-shadow: 0 0 25px rgba(0, 243, 255, 0.6);
    text-shadow: none;
}

.cyber-button:active {
    transform: scale(0.95);
}

/* 设置栏样式 */
.game-settings {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 30px;
    margin-bottom: 25px;
    padding: 10px 25px;
}

.setting-item {
    display: flex;
    align-items: center;
    gap: 12px;
}

.setting-label {
    font-size: 0.9rem;
    font-weight: 600;
    color: #94a3b8;
}

.icon-btn {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: #e2e8f0;
    border-radius: 6px;
    padding: 6px 12px;
    font-family: var(--font-display);
    font-size: 0.8rem;
    font-weight: 700;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 6px;
    transition: all 0.2s ease;
}

.icon-btn:hover {
    background: rgba(255, 255, 255, 0.1);
    border-color: rgba(255, 255, 255, 0.2);
}

.icon-btn.muted {
    color: #64748b;
    border-color: rgba(100, 116, 139, 0.2);
}

#music-toggle:not(.muted) {
    color: var(--neon-cyan);
    border-color: var(--neon-cyan);
    box-shadow: 0 0 10px rgba(0, 243, 255, 0.25);
}

#sound-toggle:not(.muted) {
    color: var(--neon-pink);
    border-color: var(--neon-pink);
    box-shadow: 0 0 10px rgba(255, 0, 127, 0.25);
}

/* 页脚 */
.game-footer {
    text-align: center;
    font-size: 0.8rem;
    color: #475569;
    margin-top: 10px;
    padding-bottom: 20px;
}

/* 手机端虚拟摇杆 - 默认隐藏，在移动端显示 */
.mobile-controls {
    display: none;
    flex-direction: column;
    gap: 15px;
    width: 100%;
    max-width: 380px;
    margin: 10px auto 25px;
    padding: 0 15px;
}

.control-row {
    display: flex;
    justify-content: space-between;
    width: 100%;
}

.circle-btn {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    font-family: var(--font-display);
    font-size: 0.85rem;
    font-weight: 800;
    display: flex;
    justify-content: center;
    align-items: center;
    cursor: pointer;
    border: 2px solid;
    background: rgba(15, 10, 30, 0.8);
    transition: all 0.1s ease;
    touch-action: manipulation;
}

.circle-btn:active {
    transform: scale(0.9);
}

.neon-blue-btn { color: var(--neon-cyan); border-color: var(--neon-cyan); box-shadow: 0 0 10px rgba(0, 243, 255, 0.2); }
.neon-blue-btn:active { background: var(--neon-cyan); color: #000; box-shadow: 0 0 20px var(--neon-cyan); }

.neon-purple-btn { color: var(--neon-purple); border-color: var(--neon-purple); box-shadow: 0 0 10px rgba(181, 15, 245, 0.2); }
.neon-purple-btn:active { background: var(--neon-purple); color: #000; box-shadow: 0 0 20px var(--neon-purple); }

.neon-gray-btn { color: #fff; border-color: var(--neon-gray); box-shadow: 0 0 5px rgba(255, 255, 255, 0.1); }
.neon-gray-btn:active { background: var(--neon-gray); color: #000; }

.control-layout-dpad {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    width: 100%;
}

.dpad-left-right {
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100%;
    gap: 15px;
}

.arrow-btn {
    flex: 1;
    height: 55px;
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.15);
    color: #e2e8f0;
    font-size: 1.6rem;
    display: flex;
    justify-content: center;
    align-items: center;
    cursor: pointer;
    touch-action: manipulation;
    transition: all 0.1s ease;
}

.arrow-btn:active {
    background: rgba(255, 255, 255, 0.15);
    border-color: rgba(255, 255, 255, 0.3);
    transform: scale(0.96);
}

.action-btn {
    flex: 1.5;
    height: 55px;
    border-radius: 8px;
    background: rgba(15, 10, 30, 0.85);
    border: 2px solid;
    font-family: var(--font-display);
    font-weight: 800;
    font-size: 1rem;
    letter-spacing: 1px;
    display: flex;
    justify-content: center;
    align-items: center;
    cursor: pointer;
    touch-action: manipulation;
    transition: all 0.1s ease;
}

.neon-orange-btn { color: var(--neon-orange); border-color: var(--neon-orange); box-shadow: 0 0 10px rgba(255, 108, 0, 0.2); }
.neon-orange-btn:active { background: var(--neon-orange); color: #000; box-shadow: 0 0 20px var(--neon-orange); transform: scale(0.96); }

.dpad-down {
    width: 100%;
}

.dpad-down .arrow-btn {
    width: 100%;
}

/* 动效关键帧 */
@keyframes neon-pulse {
    0% {
        text-shadow: 
            0 0 5px rgba(255, 255, 255, 0.8),
            0 0 10px var(--neon-cyan),
            0 0 15px var(--neon-cyan),
            0 0 30px rgba(0, 243, 255, 0.4);
    }
    100% {
        text-shadow: 
            0 0 7px rgba(255, 255, 255, 0.9),
            0 0 15px var(--neon-cyan),
            0 0 25px var(--neon-cyan),
            0 0 50px rgba(0, 243, 255, 0.6);
    }
}

@keyframes glitch {
    0% { clip-path: inset(40% 0 61% 0); transform: skew(0.3deg); }
    20% { clip-path: inset(92% 0 1% 0); transform: skew(-0.5deg); }
    40% { clip-path: inset(15% 0 80% 0); transform: skew(0.5deg); }
    60% { clip-path: inset(80% 0 5% 0); transform: skew(-0.3deg); }
    80% { clip-path: inset(5% 0 92% 0); transform: skew(0.8deg); }
    100% { clip-path: inset(40% 0 43% 0); transform: skew(-0.2deg); }
}

/* 响应式适配 */

@media (max-width: 1024px) {
    .game-layout {
        gap: 15px;
    }
    
    .side-panel {
        width: 180px;
    }
    
    .neon-title {
        font-size: 2.2rem;
    }
}

/* 在平板和移动端，主面板居中，左右面板重新布局 */
@media (max-width: 820px) {
    .game-layout {
        flex-direction: column;
        align-items: center;
        gap: 20px;
    }
    
    .side-panel {
        flex-direction: row;
        width: 100%;
        max-width: 320px;
        justify-content: space-between;
    }
    
    .panel-card {
        flex: 1;
        height: auto;
    }
    
    .hold-card, .next-card {
        max-width: 150px;
    }
    
    .stats-card {
        max-width: 155px;
    }
    
    .controls-info-card {
        display: none; /* 移动端隐藏物理按键说明 */
    }
    
    /* 启用手机虚拟按钮 */
    .mobile-controls {
        display: flex;
    }
}

@media (max-width: 480px) {
    .app-container {
        padding: 10px 5px;
    }
    
    .game-header {
        margin-bottom: 15px;
    }
    
    .neon-title {
        font-size: 1.8rem;
    }
    
    .neon-subtitle {
        font-size: 0.9rem;
        letter-spacing: 4px;
    }
    
    .side-panel {
        max-width: 316px;
        gap: 10px;
        margin-bottom: 0px;
    }
    
    .panel-card {
        padding: 8px;
    }
    
    .card-title {
        font-size: 0.8rem;
        margin-bottom: 8px;
    }
    
    .canvas-container {
        padding: 5px;
    }
    
    #hold-canvas {
        width: 60px;
        height: 60px;
    }
    
    #next-canvas-1 {
        width: 60px;
        height: 60px;
    }
    
    .sub-next {
        display: none; /* 极小屏只显示一个下一个预览 */
    }
    
    .stat-item {
        margin-bottom: 6px;
    }
    
    .stat-val {
        font-size: 1.2rem;
    }
    
    .board-wrapper {
        border-radius: 12px;
        padding: 4px;
    }
    
    .scanlines {
        top: 4px;
        left: 4px;
        right: 4px;
        bottom: 4px;
    }
    
    #game-board {
        width: 240px;
        height: 480px; /* 缩放画布 */
    }
    
    .game-settings {
        gap: 15px;
        padding: 6px 15px;
        margin-bottom: 15px;
    }
    
    .setting-label {
        font-size: 0.8rem;
    }
}

@media (max-height: 700px) and (max-width: 480px) {
    /* 针对低高度手机屏幕做紧急压缩，避免需要滚动 */
    .game-header {
        display: none; /* 隐藏标题腾出空间 */
    }
    #game-board {
        width: 200px;
        height: 400px;
    }
    .mobile-controls {
        gap: 8px;
    }
    .arrow-btn, .action-btn {
        height: 42px;
        font-size: 1.2rem;
    }
    .circle-btn {
        width: 45px;
        height: 45px;
        font-size: 0.75rem;
    }
}
