/* 食堂推荐系统完整样式 */
/* Reset and Base Styles */
* { 
    margin: 0; 
    padding: 0; 
    box-sizing: border-box; 
    -webkit-touch-callout: none;
    -webkit-user-select: none;
    -khtml-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
    user-select: none;
}

/* 允许文本选择的特定元素 */
.recommended-result-title,
.recommendation-subtitle,
.stat-value,
.share-text {
    -webkit-user-select: text;
    -moz-user-select: text;
    -ms-user-select: text;
    user-select: text;
}

body { 
    font-family: 'Microsoft YaHei', 'PingFang SC', sans-serif; 
    background: #0a0a16; 
    color: #ffffff; 
    overflow-x: hidden; 
    /* 移除固定高度，允许移动端滚动 */
    min-height: 100vh;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch; /* iOS流畅滚动 */
}

/* Grid Background - Simplified */
.grid-background {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-image:
        linear-gradient(rgba(0, 255, 255, 0.03) 1px, transparent 1px),
        linear-gradient(90deg, rgba(0, 255, 255, 0.03) 1px, transparent 1px);
    background-size: 100px 100px;
    z-index: -1;
    /* 减少重绘 */
    will-change: auto;
}

/* Cyberpunk Colors */
:root { 
    --neon-blue: #00ffff; 
    --neon-pink: #ff00ff; 
    --neon-purple: #9d00ff; 
    --neon-yellow: #ffff00; 
    --dark-bg: #0a0a16; 
    --dark-panel: #12122b; 
    --text-primary: #ffffff; 
    --text-secondary: #cccccc; 
}

/* Modal Styles */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(10, 10, 22, 0.95);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    /* 移除 backdrop-filter 以提升性能 */
    /* backdrop-filter: blur(10px); */
}

.modal-content {
    background: linear-gradient(135deg, var(--dark-panel), rgba(18, 18, 43, 0.8));
    border: 2px solid var(--neon-blue);
    border-radius: 20px;
    padding: 60px;
    text-align: center;
    box-shadow: 0 0 15px var(--neon-blue); /* 减少模糊半径 */
    max-width: 600px;
    width: 90%;
    /* 优化渲染 */
    transform: translateZ(0);
}

.modal-title { 
    font-family: 'Courier New', 'Monaco', monospace; 
    font-size: 1.8rem; 
    font-weight: 900; 
    margin-bottom: 40px; 
    text-transform: uppercase; 
    letter-spacing: 2px; 
    color: var(--neon-blue); 
    text-shadow: 0 0 20px var(--neon-blue); 
    position: relative; 
}

.modal-title::before { 
    content: '> '; 
    color: var(--neon-yellow); 
    font-size: 2rem; 
    margin-right: 10px; 
    animation: blink 1.5s infinite; 
}

.modal-title::after { 
    content: ' _'; 
    color: var(--neon-pink); 
    animation: blink 1s infinite; 
}

@keyframes blink { 
    0%, 50% { opacity: 1; } 
    51%, 100% { opacity: 0; } 
}

/* Glitch Effect - Simplified */
.glitch { 
    color: var(--text-primary); 
    font-size: 2.5rem; 
    font-weight: 900; 
    text-transform: uppercase; 
    letter-spacing: 3px; 
}

/* Selection Container */
.selection-container { 
    display: flex; 
    gap: 30px; 
    margin-bottom: 40px; 
    justify-content: center; 
    flex-wrap: wrap;
}

.select-group { 
    display: flex; 
    flex-direction: column; 
    gap: 10px; 
}

.select-group label { 
    font-family: 'Arial', 'Microsoft YaHei', sans-serif; 
    font-size: 1.2rem; 
    font-weight: 600; 
    color: var(--neon-blue); 
    text-transform: uppercase; 
    letter-spacing: 1px; 
}

.cyber-select {
    background: rgba(18, 18, 43, 0.8);
    border: 2px solid var(--neon-purple);
    border-radius: 10px;
    padding: 15px 20px;
    color: var(--text-primary);
    font-size: 1.1rem;
    font-family: 'Arial', 'Microsoft YaHei', sans-serif;
    font-weight: 500;
    box-shadow: 0 0 10px rgba(157, 0, 255, 0.2); /* 减少模糊半径 */
    transition: all 0.3s ease;
    cursor: pointer;
    min-width: 200px;
}

.cyber-select:focus {
    outline: none;
    border-color: var(--neon-pink);
    box-shadow: 0 0 15px rgba(255, 0, 255, 0.4); /* 减少模糊半径 */
}

.cyber-select option { 
    background: var(--dark-panel); 
    color: var(--text-primary); 
    padding: 10px; 
}

/* Enter Button */
.enter-btn { 
    position: relative; 
    background: linear-gradient(45deg, var(--neon-blue), var(--neon-pink)); 
    border: none; 
    border-radius: 15px; 
    padding: 20px 60px; 
    font-family: 'Courier New', 'Monaco', monospace; 
    font-size: 1.3rem; 
    font-weight: 700; 
    color: var(--dark-bg); 
    text-transform: uppercase; 
    letter-spacing: 2px; 
    cursor: pointer; 
    transition: all 0.3s ease; 
    overflow: hidden; 
}

.enter-btn:disabled { 
    background: #333; 
    color: #666; 
    cursor: not-allowed; 
    box-shadow: none; 
}

.enter-btn:not(:disabled) { 
    box-shadow: 0 0 40px rgba(0, 255, 255, 0.6); 
}

.enter-btn:not(:disabled):hover { 
    transform: translateY(-2px); 
    box-shadow: 0 5px 50px rgba(255, 0, 255, 0.8); 
}

.btn-glow { 
    position: absolute; 
    top: 0; 
    left: -100%; 
    width: 100%; 
    height: 100%; 
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.3), transparent); 
    transition: left 0.5s ease; 
}

.enter-btn:not(:disabled):hover .btn-glow { 
    left: 100%; 
}

/* Main Content */
.main-content { 
    padding: 15px 20px; 
    max-width: 1400px; 
    margin: 0 auto; 
    /* 移除固定高度，允许内容滚动 */
    min-height: 100vh;
    display: flex; 
    flex-direction: column; 
    box-sizing: border-box;
    overflow-y: visible; /* 允许滚动 */
}

.hidden { display: none; }

.header { 
    text-align: center; 
    margin-bottom: 20px; 
    flex-shrink: 0; 
}

.main-title { 
    font-family: 'Courier New', 'Monaco', monospace; 
    font-size: 2.5rem; 
    font-weight: 900; 
    color: var(--text-primary); 
    text-shadow: 0 0 20px var(--neon-blue); 
    margin: 0; 
}

.title-bracket { 
    color: var(--neon-yellow); 
    font-size: 3rem; 
}

.content-layout { 
    display: flex; 
    gap: 20px; 
    flex: 1; 
    overflow: hidden;
    align-items: flex-start; /* 改为顶部对齐确保一致性 */
}

.gacha-content { 
    flex: 0 0 70%; 
    height: 100%;
    display: flex;
    flex-direction: column;
}

.sidebar { 
    flex: 0 0 28%; 
    height: 100%;
    display: flex;
    flex-direction: column;
}

/* Gacha Machine */
.gacha-machine {
    background: linear-gradient(135deg, rgba(18, 18, 43, 0.9), rgba(10, 10, 22, 0.8));
    border: 2px solid var(--neon-blue);
    border-radius: 25px;
    padding: 30px;
    box-shadow: 0 0 15px rgba(0, 255, 255, 0.2); /* 减少模糊半径 */
    position: relative;
    height: fit-content;
    margin-top: 0; /* 确保与推荐结果框顶部对齐 */
    margin-bottom: 20px;
    /* 优化渲染 */
    transform: translateZ(0);
}

.machine-shake { animation: machineShake 0.8s ease-in-out; }
@keyframes machineShake { 
    0%, 100% { transform: translateX(0); } 
    10%, 30%, 50%, 70%, 90% { transform: translateX(-8px); } 
    20%, 40%, 60%, 80% { transform: translateX(8px); } 
}

.machine-header { text-align: center; margin-bottom: 25px; }

.machine-title { 
    font-family: 'Courier New', 'Monaco', monospace; 
    font-size: 2rem; 
    font-weight: 900; 
    color: var(--neon-blue); 
    text-transform: uppercase; 
    letter-spacing: 3px; 
    margin-bottom: 8px; 
    text-shadow: 0 0 30px var(--neon-blue); 
}

.machine-subtitle { 
    font-family: 'Arial', 'Microsoft YaHei', sans-serif; 
    font-size: 1rem; 
    color: var(--text-secondary); 
    text-transform: uppercase; 
    letter-spacing: 1px; 
}

.machine-body { 
    display: flex; 
    flex-direction: column; 
    align-items: center; 
    gap: 25px; 
}

.capsule-display { 
    width: 150px; 
    height: 150px; 
    display: flex; 
    align-items: center; 
    justify-content: center; 
    position: relative; 
}

.capsule {
    width: 120px;
    height: 120px;
    background: linear-gradient(45deg, var(--neon-purple), var(--neon-pink));
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 0 10px rgba(255, 0, 255, 0.3); /* 减少模糊半径 */
    transition: transform 0.3s ease; /* 只保留必要的过渡 */
}

.capsule-inner { 
    width: 80%; 
    height: 80%; 
    background: rgba(10, 10, 22, 0.8); 
    border-radius: 50%; 
    display: flex; 
    align-items: center; 
    justify-content: center; 
    border: 2px solid var(--neon-blue); 
}

.question-mark { 
    font-family: 'Courier New', 'Monaco', monospace; 
    font-size: 2.5rem; 
    font-weight: 900; 
    color: var(--neon-yellow); 
}

.gacha-btn {
    position: relative;
    background: linear-gradient(45deg, var(--neon-yellow), var(--neon-pink));
    border: none;
    border-radius: 20px;
    padding: 25px 50px;
    font-family: 'Courier New', 'Monaco', monospace;
    font-size: 1.4rem;
    font-weight: 700;
    color: var(--dark-bg);
    text-transform: uppercase;
    letter-spacing: 2px;
    cursor: pointer;
    transition: transform 0.3s ease; /* 只保留必要的过渡 */
    overflow: hidden;
    box-shadow: 0 0 20px rgba(255, 255, 0, 0.4); /* 减少模糊半径 */
    /* 优化渲染 */
    will-change: transform;
}

.gacha-btn:hover {
    transform: translateY(-3px);
    /* 移除 hover 时的 box-shadow 变化以提升性能 */
}

.gacha-btn:active { transform: scale(0.95); }

.btn-icon { margin-right: 15px; font-size: 1.6rem; }

.energy-ring { 
    position: absolute; 
    top: 50%; 
    left: 50%; 
    width: 100px; 
    height: 100px; 
    border: 3px solid transparent; 
    border-top: 3px solid var(--neon-blue); 
    border-radius: 50%; 
    transform: translate(-50%, -50%); 
    opacity: 0; 
    animation: ringRotate 1s linear infinite; 
}

@keyframes ringRotate { 
    0% { transform: translate(-50%, -50%) rotate(0deg); } 
    100% { transform: translate(-50%, -50%) rotate(360deg); } 
}

.gacha-btn.loading .energy-ring { opacity: 1; }
.gacha-btn.loading { pointer-events: none; opacity: 0.7; }

/* Result */
.recommendation-result {
    background: linear-gradient(135deg, rgba(18, 18, 43, 0.9), rgba(10, 10, 22, 0.8));
    border: 2px solid var(--neon-blue);
    border-radius: 25px;
    padding: 30px;
    box-shadow: 0 0 15px rgba(0, 255, 255, 0.2); /* 减少模糊半径 */
    text-align: center;
    height: fit-content;
    margin-bottom: 20px;
    margin-top: 0; /* 确保顶部对齐 */
    position: relative; /* 为二维码定位提供参照 */
    /* 优化渲染 */
    transform: translateZ(0);
}

/* 固定在右上角的二维码容器 */
.qr-code-container-fixed {
    position: absolute;
    top: 15px;
    right: 15px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 5px;
    z-index: 10;
}

.result-header { 
    margin-bottom: 40px; 
    text-align: center; /* 确保居中 */
}

/* 新增：结果标题头部弹性布局 */
.result-header-flex {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 15px;
}

.result-title { 
    font-family: 'Microsoft YaHei', 'PingFang SC', sans-serif; /* 更换为微软雅黑 */
    font-size: 2rem; 
    font-weight: 900; /* 加粗 */
    color: var(--neon-blue); 
    text-transform: uppercase; 
    letter-spacing: 2px; 
    text-shadow: 0 0 30px var(--neon-blue); 
    margin: 0; 
}

.recommended-floor { 
    margin-bottom: 40px; 
    padding: 20px 0; 
}

.floor-recommendation { text-align: center; }

.recommended-result-title { 
    font-family: 'Arial', 'Microsoft YaHei', sans-serif; 
    font-size: 2.5rem; 
    font-weight: 900; 
    color: var(--neon-pink); 
    margin-bottom: 20px; 
    text-transform: uppercase; 
    text-shadow: 0 0 30px var(--neon-pink); 
    line-height: 1.2; 
}

.recommendation-subtitle { 
    font-family: 'Arial', 'Microsoft YaHei', sans-serif; 
    font-size: 1.1rem; 
    color: var(--text-secondary); 
    text-transform: uppercase; 
    letter-spacing: 1px; 
    margin-bottom: 20px; 
}

.try-again-btn { 
    background: linear-gradient(45deg, var(--neon-purple), var(--neon-blue)); 
    border: 2px solid var(--neon-blue); 
    border-radius: 12px; 
    padding: 15px 30px; 
    color: white; 
    font-family: 'Courier New', 'Monaco', monospace; 
    font-size: 1rem; 
    font-weight: 600; 
    cursor: pointer; 
    transition: all 0.3s ease; 
    text-transform: uppercase; 
    letter-spacing: 1px; 
    margin: 0 auto 20px auto; 
    position: relative; 
    overflow: hidden; 
    display: flex; 
    flex-direction: column; 
    align-items: center; 
    gap: 3px; 
    box-shadow: 0 0 20px rgba(0, 255, 255, 0.3); 
    width: fit-content; 
}

.try-again-btn::before { 
    content: ''; 
    position: absolute; 
    top: 0; 
    left: -100%; 
    width: 100%; 
    height: 100%; 
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.2), transparent); 
    transition: left 0.5s ease; 
}

.try-again-btn:hover::before { left: 100%; }

.try-again-btn .btn-icon { 
    font-size: 1.4rem; 
    filter: drop-shadow(0 0 5px var(--neon-yellow)); 
}

.try-again-btn .btn-text { 
    font-size: 1.3rem; 
    font-weight: 700; 
    letter-spacing: 2px; 
}

.try-again-btn .btn-subtext { 
    font-size: 0.8rem; 
    opacity: 0.8; 
    font-family: 'Arial', 'Microsoft YaHei', sans-serif; 
    letter-spacing: 1px; 
}

.recommended-restaurant { 
    background: rgba(255, 0, 255, 0.1); 
    border: 1px solid var(--neon-pink); 
    border-radius: 8px; 
    padding: 12px; 
    color: var(--text-primary); 
    font-weight: 500; 
    transition: all 0.3s ease; 
    animation: restaurantGlow 0.5s ease-out; 
}

@keyframes restaurantGlow { 
    0% { opacity: 0; transform: scale(0.8); } 
    50% { opacity: 1; transform: scale(1.1); } 
    100% { opacity: 1; transform: scale(1); } 
}

.try-again-btn:hover { 
    transform: translateY(-2px); 
    box-shadow: 0 5px 25px rgba(157, 0, 255, 0.5); 
}

/* Machine Stats */
.machine-stats { 
    display: flex; 
    justify-content: space-between; 
    margin-top: 20px; 
    gap: 20px; 
}

.stat-item { 
    background: rgba(18, 18, 43, 0.8); 
    border: 1px solid var(--neon-blue); 
    border-radius: 12px; 
    padding: 20px; 
    text-align: center; 
    flex: 1; 
    transition: all 0.3s ease; 
}

.stat-item:hover { 
    border-color: var(--neon-yellow); 
    box-shadow: 0 0 20px rgba(255, 255, 0, 0.3); 
}

.stat-label { 
    display: block; 
    font-family: 'Arial', 'Microsoft YaHei', sans-serif; 
    font-size: 0.9rem; 
    font-weight: 500; 
    color: var(--text-secondary); 
    text-transform: uppercase; 
    letter-spacing: 1px; 
    margin-bottom: 5px; 
}

.stat-value { 
    font-family: 'Courier New', 'Monaco', monospace; 
    font-size: 1.5rem; 
    font-weight: 700; 
    color: var(--neon-blue); 
}

.stat-value.online { color: var(--neon-yellow); }

.share-item { 
    cursor: pointer; 
    transition: all 0.3s ease; 
    background: rgba(255, 0, 255, 0.1); 
    border: 2px solid var(--neon-pink) !important; 
    position: relative; 
    overflow: hidden; 
}

.share-item::before { 
    content: ''; 
    position: absolute; 
    top: 0; 
    left: -100%; 
    width: 100%; 
    height: 100%; 
    background: linear-gradient(90deg, transparent, rgba(255, 0, 255, 0.2), transparent); 
    transition: left 0.5s ease; 
}

.share-item:hover::before { left: 100%; }

.share-item:hover { 
    border-color: var(--neon-yellow) !important; 
    box-shadow: 0 0 30px rgba(255, 255, 0, 0.5); 
    transform: scale(1.05); 
}

.share-icon { 
    font-size: 1.2rem; 
    margin-right: 8px; 
    display: inline-block; 
    animation: shareIconPulse 2s ease-in-out infinite; 
}

@keyframes shareIconPulse { 
    0%, 100% { transform: scale(1); } 
    50% { transform: scale(1.2); } 
}

.share-text { position: relative; z-index: 1; }

.share-status { 
    color: var(--neon-pink); 
    font-size: 1rem; 
    display: flex; 
    align-items: center; 
    justify-content: center; 
    flex-wrap: wrap; 
    text-align: center; 
}

/* Sidebar 广告面板 - 完整版 */
.ad-panel {
    background: linear-gradient(135deg, rgba(18, 18, 43, 0.9), rgba(10, 10, 22, 0.8));
    border: 2px solid var(--neon-pink);
    border-radius: 15px;
    padding: 20px;
    margin-bottom: 0; /* 移除底部边距确保对齐 */
    margin-top: 0; /* 确保顶部对齐 */
    box-shadow: 0 0 20px rgba(255, 0, 255, 0.3);
    position: relative;
    overflow: visible;
}

.featured-ad { 
    border: 3px solid var(--neon-pink); 
    box-shadow: 0 0 40px rgba(255, 0, 255, 0.4); 
    margin-bottom: 0; /* 移除底部边距确保对齐 */ 
    background: linear-gradient(135deg, rgba(255, 0, 255, 0.1), rgba(18, 18, 43, 0.9));
}

.ad-header {
    font-family: 'Microsoft YaHei', 'PingFang SC', sans-serif; /* 更换为微软雅黑 */
    font-size: 1.2rem;
    font-weight: 900; /* 加粗 */
    color: var(--neon-pink);
    text-align: center; /* 居中 */
    margin-bottom: 15px;
    text-transform: uppercase;
    letter-spacing: 2px;
    text-shadow: 0 0 15px var(--neon-pink);
}

.ad-content {
    text-align: center;
    display: flex;
    flex-direction: column;
    gap: 12px;
    align-items: center;
}

.ad-image {
    width: 100%;
    max-width: 350px;
    height: auto;
    border-radius: 10px;
    border: 1px solid var(--neon-blue);
    box-shadow: 0 0 15px rgba(0, 255, 255, 0.3);
    transition: all 0.3s ease;
    object-fit: cover;
    max-height: 250px;
    min-height: 200px;
}

.ad-image:hover {
    transform: scale(1.05);
    box-shadow: 0 0 25px rgba(0, 255, 255, 0.6);
}

.ad-btn {
    background: linear-gradient(45deg, var(--neon-purple), var(--neon-pink));
    border: none;
    border-radius: 10px;
    padding: 12px 24px;
    color: white;
    font-family: 'Courier New', 'Monaco', monospace;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    text-transform: uppercase;
    letter-spacing: 1px;
    box-shadow: 0 0 20px rgba(255, 0, 255, 0.4);
    position: relative;
    overflow: hidden;
}

.ad-btn::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.3), transparent);
    transition: left 0.5s ease;
}

.ad-btn:hover::before {
    left: 100%;
}

.ad-btn.premium {
    background: linear-gradient(45deg, var(--neon-pink), var(--neon-yellow));
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1px;
    box-shadow: 0 0 30px rgba(255, 0, 255, 0.6);
}

.ad-btn.special {
    background: linear-gradient(45deg, var(--neon-purple), var(--neon-blue));
}

.ad-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 25px rgba(255, 0, 255, 0.6);
}

/* Limit Modal */
.limit-modal { 
    position: fixed; 
    top: 0; 
    left: 0; 
    width: 100%; 
    height: 100%; 
    background: rgba(10, 10, 22, 0.85); 
    display: flex; 
    align-items: center; 
    justify-content: center; 
    z-index: 2000; 
}

.limit-modal.hidden { display: none !important; }

.limit-modal-content { 
    background: linear-gradient(135deg, rgba(18,18,43,0.95), rgba(10,10,22,0.9)); 
    border: 2px solid var(--neon-blue); 
    box-shadow: 0 0 30px rgba(0,255,255,0.4); 
    border-radius: 16px; 
    padding: 24px; 
    width: min(520px, 92vw); 
    text-align: center; 
}

.limit-title { 
    font-family: 'Courier New', 'Monaco', monospace; 
    font-size: 1.6rem; 
    color: var(--neon-blue); 
    margin-bottom: 12px; 
}

.limit-desc { 
    color: var(--text-secondary); 
    margin-bottom: 18px; 
}

.limit-desc .highlight { 
    color: var(--neon-yellow); 
    font-weight: 700; 
}

.limit-actions { 
    display: flex; 
    gap: 12px; 
    justify-content: center; 
}

/* Responsive Design - 手机端优化 */
@media (max-width: 1200px) { 
    .content-layout { 
        flex-direction: column; 
        gap: 0; /* 移除间隙确保对齐 */
        align-items: flex-start; /* 改为顶部对齐 */
    } 
    .sidebar { 
        width: 100%; 
        order: 1; /* 移动端广告板块置底，不影响首屏 */
        margin-top: 0; /* 移除顶部边距 */
        align-self: stretch; /* 拉伸到全宽 */
    } 
    .gacha-content { 
        flex: none; 
        width: 100%; 
        order: 0; /* 推荐引擎优先显示 */
        margin-bottom: 0; /* 确保无底部边距 */
        align-self: stretch; /* 拉伸到全宽 */
    }
    
    /* 确保机器统计区域没有额外边距 */
    .machine-stats {
        margin-bottom: 0;
    }
}

/* 平板端适配 - 增强点击区域 */
@media (max-width: 768px) { 
    .selection-container { 
        flex-direction: column; 
        align-items: center;
        gap: 25px;
    } 
    
    .select-group {
        width: 100%;
        max-width: 300px;
    }
    
    .cyber-select {
        width: 100%;
        padding: 15px;
        font-size: 1.1rem;
        min-height: 50px;
    }
    
    .modal-content { 
        padding: 35px 25px;
        margin: 20px;
    } 
    .main-title { 
        font-size: 1.8rem;
    }
    
    .main-content {
        padding: 15px;
        height: auto;
        min-height: 100vh;
        overflow-y: visible;
    }
    
    .gacha-machine {
        padding: 25px;
        margin-bottom: 20px;
    }
    
    .machine-title {
        font-size: 1.7rem;
    }
    
    .gacha-btn {
        padding: 20px 40px;
        font-size: 1.3rem;
        min-height: 60px;
    }
    
    .recommended-result-title {
        font-size: 2.2rem;
        line-height: 1.3;
    }
    
    .ad-content {
        gap: 15px;
    }
    
    .ad-image {
        max-width: 100%;
        max-height: 220px;
        min-height: 180px;
    }
    
    .sidebar {
        flex: none;
        height: auto;
        margin-top: 25px;
        order: 1;
    }
}

/* 手机端优化 - 全面提升用户体验 */
@media (max-width: 480px) { 
    .main-content { 
        padding: 12px;
        height: auto;
        min-height: 100vh;
        overflow-y: visible;
    }
    
    .modal-content {
        padding: 25px 18px;
        margin: 12px;
        max-width: 95vw;
    }
    
    .modal-title {
        font-size: 1.4rem;
        margin-bottom: 25px;
        line-height: 1.4;
    }
    
    /* 强化选择框的点击体验 */
    .cyber-select {
        min-width: 100%;
        padding: 16px 20px;
        font-size: 1.1rem;
        min-height: 54px;
        border: 3px solid var(--neon-purple);
        border-radius: 12px;
    }
    
    .cyber-select:focus {
        border: 3px solid var(--neon-pink);
        outline: none;
        box-shadow: 0 0 25px rgba(255,0,255,0.4);
    }
    
    /* 增强ENTER按钮 */
    .enter-btn { 
        padding: 18px 35px;
        font-size: 1.15rem;
        width: 100%;
        max-width: 320px;
        min-height: 56px;
        margin-top: 20px;
    }
    
    .main-title {
        font-size: 1.5rem;
        line-height: 1.3;
        margin-bottom: 15px;
    }
    
    .gacha-machine {
        padding: 18px;
        margin-bottom: 20px;
        border-radius: 20px;
    }
    
    .machine-title {
        font-size: 1.45rem;
        letter-spacing: 1px;
        margin-bottom: 10px;
    }
    
    .machine-subtitle {
        font-size: 0.95rem;
        margin-bottom: 20px;
    }
    
    .capsule {
        width: 110px;
        height: 110px;
    }
    
    .capsule-inner {
        width: 80%;
        height: 80%;
    }
    
    .question-mark {
        font-size: 2.2rem;
    }
    
    .gacha-btn {
        padding: 18px 30px;
        font-size: 1.1rem;
        letter-spacing: 1px;
        min-height: 56px;
        border-radius: 16px;
    }
    
    .recommendation-result {
        padding: 20px 16px;
        margin-bottom: 20px;
        border-radius: 20px;
    }
    
    .result-title {
        font-size: 1.5rem;
        margin-bottom: 15px;
    }
    
    .recommended-result-title {
        font-size: 1.8rem;
        margin-bottom: 15px;
        line-height: 1.3;
    }
    
    .recommendation-subtitle {
        font-size: 1rem;
        margin-bottom: 15px;
    }
    
    .try-again-btn {
        padding: 14px 25px;
        min-height: 50px;
        border-radius: 12px;
    }
    
    .try-again-btn .btn-text {
        font-size: 1.15rem;
    }
    
    /* 统计面板优化 */
    .machine-stats {
        flex-direction: row;
        gap: 16px;
        margin-top: 20px;
        align-items: stretch;
    }
    
    .stat-item {
        padding: 16px;
        border-radius: 12px;
        min-height: 60px;
        display: flex;
        flex-direction: column;
        justify-content: center;
        flex: 1;
    }
    
    .stat-label {
        font-size: 0.85rem;
        margin-bottom: 5px;
    }
    
    .stat-value {
        font-size: 1.4rem;
    }
    
    /* 广告面板手机端优化 */
    .ad-header {
        font-size: 1.05rem;
        margin-bottom: 12px;
    }
    
    .ad-btn {
        padding: 12px 24px;
        font-size: 0.95rem;
        min-height: 48px;
    }
    
    .ad-image {
        max-width: 100%;
        max-height: 200px;
        min-height: 160px;
        border-radius: 10px;
    }
    
    .content-layout {
        gap: 18px;
    }
    
    /* 确保内容流畅滚动 */
    .content-layout {
        overflow-y: visible;
    }
    
    .gacha-content {
        order: 0;
    }
    
    .sidebar {
        order: 1;
        margin-top: 25px;
    }
}

/* 超小屏幕适配 */
@media (max-width: 360px) {
    .main-content {
        padding: 8px;
    }
    
    .modal-content {
        padding: 20px 12px;
        margin: 10px;
    }
    
    .modal-title {
        font-size: 1.2rem;
    }
    
    .gacha-machine {
        padding: 12px;
    }
    
    .machine-title {
        font-size: 1.2rem;
    }
    
    .gacha-btn {
        padding: 12px 20px;
        font-size: 0.9rem;
    }
    
    .recommended-result-title {
        font-size: 1.4rem;
    }
    
    .ad-image {
        max-height: 180px;
        min-height: 140px;
    }
}

/* 触摸设备优化 - 重点修复红米手机点击问题 */
@media (hover: none) and (pointer: coarse) {
    /* 移动设备专用样式 - 增加触摸目标尺寸 */
    .gacha-btn,
    .try-again-btn,
    .ad-btn,
    .enter-btn,
    .cyber-select {
        min-height: 48px; /* 增加到48px以确保红米手机可点击 */
        min-width: 48px;
        -webkit-tap-highlight-color: rgba(0,255,255,0.3);
        -webkit-touch-callout: none;
        -webkit-user-select: none;
        touch-action: manipulation; /* 防止双击缩放干扰点击 */
    }
    
    /* 增强按钮点击反馈 */
    .enter-btn {
        padding: 18px 40px;
        font-size: 1.2rem;
    }
    
    .gacha-btn:active,
    .try-again-btn:active,
    .ad-btn:active,
    .enter-btn:active {
        transform: scale(0.95);
        transition: transform 0.1s ease;
        background-color: rgba(0,255,255,0.1);
    }
    
    /* 完全禁用悬停效果 */
    .gacha-btn:hover,
    .try-again-btn:hover,
    .ad-btn:hover,
    .enter-btn:hover {
        transform: none;
        box-shadow: inherit;
    }
    
    /* 修复选择框在红米手机上的点击问题 */
    .cyber-select {
        padding: 15px 20px;
        font-size: 1.1rem;
        border: 3px solid var(--neon-purple);
        background: rgba(18, 18, 43, 0.9);
    }
    
    .cyber-select:focus,
    .cyber-select:active {
        outline: 3px solid var(--neon-pink);
        border-color: var(--neon-pink);
    }
}

/* 手机端特殊布局调整 - 修复红米手机滚动问题 */
@media (max-width: 480px) and (orientation: portrait) {
    html, body {
        height: auto;
        min-height: 100vh;
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
        scroll-behavior: smooth;
    }
    
    .main-content {
        height: auto;
        min-height: 100vh;
        overflow-y: visible;
        -webkit-overflow-scrolling: touch;
        padding: 15px;
        position: relative;
    }
    
    /* 优化扭蛋机在小屏幕上的显示 */
    .machine-body {
        gap: 15px;
    }
    
    .capsule-display {
        width: 120px;
        height: 120px;
    }
    
    /* 统计面板移动端优化 */
    .machine-stats {
        margin-top: 15px;
        margin-bottom: 0; /* 确保无底部边距 */
    }
    
    /* 广告面板移动端优化 - 移动到推荐引擎下方 */
    .sidebar {
        order: 1; /* 确保在推荐引擎后显示 */
        margin-top: 0; /* 完全移除顶部边距 */
    }
    
    .ad-panel {
        padding: 15px;
        margin-bottom: 0; /* 移除底部边距确保对齐 */
        border: 2px solid var(--neon-blue);
        box-shadow: 0 0 15px rgba(0,255,255,0.2);
    }
    
    .featured-ad {
        margin-bottom: 0 !important; /* 强制移除底部边距 */
    }
    
    .ad-header {
        font-size: 1.1rem;
        margin-bottom: 12px;
    }
    
    /* 移动端二维码和标题布局适配 */
    .qr-code-container-fixed {
        top: 10px;
        right: 10px;
    }
    
    .qr-code-container-fixed .qr-code {
        width: 40px;
        height: 40px;
    }
    
    .qr-code-container-fixed .qr-text {
        font-size: 0.7rem;
        max-width: 60px;
    }
    
    .result-title {
        font-size: 1.5rem;
        margin-bottom: 10px;
    }
    
    /* 确保左右两个区域底部完全对齐 */
    .gacha-content,
    .sidebar {
        align-self: stretch;
        display: flex;
        flex-direction: column;
        justify-content: flex-end; /* 内容从底部开始排列 */
    }
    
    /* 强制设定相同的最小高度 */
    .machine-stats,
    .ad-panel {
        min-height: 120px; /* 设定相同最小高度 */
        display: flex;
        flex-direction: column;
        justify-content: flex-end; /* 内容贴底对齐 */
    }
}

/* 横屏手机适配 */
@media (max-width: 800px) and (max-height: 480px) and (orientation: landscape) {
    .main-content {
        height: 100vh;
        overflow-y: auto;
        padding: 5px 10px;
    }
    
    .header {
        margin-bottom: 10px;
    }
    
    .main-title {
        font-size: 1.2rem;
    }
    
    .content-layout {
        flex-direction: row;
        gap: 15px;
    }
    
    .gacha-content {
        flex: 1;
    }
    
    .sidebar {
        flex: 0 0 250px;
        order: 1;
    }
    
    .gacha-machine {
        padding: 15px;
    }
    
    .machine-title {
        font-size: 1.3rem;
    }
    
    .capsule {
        width: 80px;
        height: 80px;
    }
    
    .gacha-btn {
        padding: 10px 20px;
        font-size: 0.9rem;
    }
}

/* 二维码相关样式 */
.ad-header-container {
    display: flex;
    align-items: center;
    justify-content: center; /* 改为完全居中 */
    flex-wrap: wrap;
    gap: 10px;
    margin-bottom: 15px;
    overflow: visible;
    position: relative;
}

.qr-code-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 5px;
    overflow: visible;
    position: relative;
    z-index: 1;
}

.qr-code {
    width: 60px;
    height: 60px;
    border: 2px solid var(--neon-blue);
    border-radius: 8px;
    box-shadow: 0 0 10px rgba(0, 255, 255, 0.3);
    transition: all 0.3s ease;
    cursor: pointer;
    object-fit: cover;
    position: relative;
}

.qr-code:hover {
    transform: scale(2.5);
    z-index: 10000;
    border-color: var(--neon-pink);
    box-shadow: 0 0 50px rgba(255, 0, 255, 0.8);
    background: rgba(10, 10, 22, 0.95);
    padding: 8px;
    transform-origin: center;
}

.qr-text {
    font-family: 'Arial', 'Microsoft YaHei', sans-serif;
    font-size: 0.8rem;
    font-weight: 500;
    color: var(--neon-blue);
    text-align: center;
    letter-spacing: 0.5px;
    line-height: 1.2;
    max-width: 80px;
    word-wrap: break-word;
}

.ad-image-link {
    display: block;
    width: 100%;
    text-decoration: none;
}

.ad-image-link:hover .ad-image {
    transform: scale(1.05);
    box-shadow: 0 0 25px rgba(0, 255, 255, 0.6);
}

/* 二维码移动端适配 */
@media (max-width: 768px) {
    .ad-header-container {
        flex-direction: column;
        text-align: center;
        overflow: visible;
    }
    
    .qr-code-container {
        align-items: center;
        overflow: visible;
    }
    
    .qr-code {
        width: 70px;
        height: 70px;
    }
    
    .qr-code:hover {
        transform: scale(2.2);
        z-index: 10000;
    }
    
    .qr-text {
        font-size: 0.85rem;
        max-width: 100px;
    }
}

@media (max-width: 480px) {
    .ad-header-container {
        gap: 8px;
    }
    
    .qr-code {
        width: 55px;
        height: 55px;
    }
    
    .qr-code:hover {
        transform: scale(2.0);
        z-index: 10000;
    }
    
    .qr-text {
        font-size: 0.75rem;
        max-width: 80px;
    }
}

/* 触摸设备二维码优化 */
@media (hover: none) and (pointer: coarse) {
    .qr-code {
        -webkit-tap-highlight-color: rgba(0, 255, 255, 0.3);
        touch-action: manipulation;
    }
    
    .qr-code:active {
        transform: scale(2.5);
        z-index: 10000;
        border-color: var(--neon-pink);
        box-shadow: 0 0 50px rgba(255, 0, 255, 0.8);
        background: rgba(10, 10, 22, 0.95);
        padding: 8px;
        transform-origin: center;
    }
}


