/* 基础样式 */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: linear-gradient(135deg, #1a1a2e 0%, #16213e 100%);
    min-height: 100vh;
    color: #fff;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
}

h1 {
    text-align: center;
    font-size: 2.5em;
    margin-bottom: 20px;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.5);
}

/* 状态栏 */
.status-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px 30px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 15px;
    margin-bottom: 20px;
    backdrop-filter: blur(10px);
}

.status-item {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 1.2em;
}

.status-item.red span:last-child {
    color: #e74c3c;
    font-weight: bold;
}

.status-item.blue span:last-child {
    color: #3498db;
    font-weight: bold;
}

#game-status {
    font-size: 1.5em;
    font-weight: bold;
    padding: 10px 20px;
    border-radius: 25px;
}

.status-waiting {
    background: #f39c12;
    color: #fff;
}

.status-racing {
    background: #27ae60;
    color: #fff;
    animation: pulse 0.5s infinite alternate;
}

.status-finished {
    background: #9b59b6;
    color: #fff;
}

@keyframes pulse {
    from { transform: scale(1); }
    to { transform: scale(1.05); }
}

/* 赛道 */
.race-track {
    position: relative;
    background: linear-gradient(180deg, #2d5016 0%, #1e3a0f 100%);
    border-radius: 20px;
    padding: 30px 0;
    margin-bottom: 20px;
    overflow: hidden;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
}

.lane {
    position: relative;
    height: 120px;
    margin: 10px 0;
    border-bottom: 2px dashed rgba(255, 255, 255, 0.3);
}

.lane:last-child {
    border-bottom: none;
}

.lane-label {
    position: absolute;
    left: 10px;
    top: 50%;
    transform: translateY(-50%);
    font-size: 1.5em;
    font-weight: bold;
    z-index: 10;
}

.horse {
    position: absolute;
    left: 0;
    top: 50%;
    transform: translateY(-50%);
    font-size: 3em;
    transition: left 0.3s ease-out;
    z-index: 5;
}

.horse-emoji {
    display: block;
    animation: gallop 0.3s infinite alternate;
}

@keyframes gallop {
    from { transform: translateY(0); }
    to { transform: translateY(-5px); }
}

/* 终点线 */
.finish-line {
    position: absolute;
    right: 50px;
    top: 0;
    bottom: 0;
    width: 10px;
    background: repeating-linear-gradient(
        0deg,
        #fff 0px,
        #fff 20px,
        #000 20px,
        #000 40px
    );
    z-index: 1;
}

/* 能量条 */
.energy-bar {
    position: absolute;
    bottom: 10px;
    left: 100px;
    right: 80px;
    height: 8px;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 4px;
    overflow: hidden;
}

.energy-fill {
    height: 100%;
    width: 0;
    transition: width 0.3s ease-out;
    border-radius: 4px;
}

.energy-fill.red {
    background: linear-gradient(90deg, #e74c3c, #c0392b);
}

.energy-fill.blue {
    background: linear-gradient(90deg, #3498db, #2980b9);
}

/* 统计信息 */
.stats {
    display: flex;
    justify-content: space-around;
    margin-bottom: 20px;
}

.stat {
    text-align: center;
    padding: 15px 30px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 10px;
}

.stat.red span:first-child {
    color: #e74c3c;
}

.stat.blue span:first-child {
    color: #3498db;
}

.stat span:last-child {
    display: block;
    font-size: 2em;
    font-weight: bold;
    margin-top: 5px;
}

/* 按钮 */
.controls {
    display: flex;
    justify-content: center;
    gap: 20px;
    margin-bottom: 30px;
}

.btn {
    padding: 15px 40px;
    font-size: 1.2em;
    border: none;
    border-radius: 30px;
    cursor: pointer;
    transition: all 0.3s ease;
    font-weight: bold;
    text-transform: uppercase;
}

.btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.btn-start {
    background: linear-gradient(135deg, #27ae60, #2ecc71);
    color: #fff;
}

.btn-start:hover:not(:disabled) {
    transform: translateY(-3px);
    box-shadow: 0 5px 20px rgba(39, 174, 96, 0.4);
}

.btn-reset {
    background: linear-gradient(135deg, #e74c3c, #c0392b);
    color: #fff;
}

.btn-reset:hover {
    transform: translateY(-3px);
    box-shadow: 0 5px 20px rgba(231, 76, 60, 0.4);
}

/* 二维码区域 */
.qr-section {
    display: flex;
    justify-content: center;
    gap: 40px;
    margin-top: 20px;
}

.qr-card {
    text-align: center;
    padding: 20px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 15px;
    backdrop-filter: blur(10px);
}

.qr-card h3 {
    margin-bottom: 15px;
}

.qr-card p {
    margin-top: 10px;
    color: #aaa;
}

.red-qr {
    border: 2px solid #e74c3c;
}

.blue-qr {
    border: 2px solid #3498db;
}

#red-qrcode, #blue-qrcode {
    background: #fff;
    padding: 10px;
    border-radius: 10px;
    display: inline-block;
}

/* 弹窗 */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    justify-content: center;
    align-items: center;
    z-index: 1000;
}

.modal-content {
    background: linear-gradient(135deg, #2c3e50, #1a252f);
    padding: 40px;
    border-radius: 20px;
    text-align: center;
    animation: popIn 0.3s ease;
}

.modal-content h2 {
    font-size: 2.5em;
    margin-bottom: 20px;
}

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

/* ========== 手机端样式 ========== */
.mobile-body {
    background: linear-gradient(135deg, #2c3e50 0%, #1a1a2e 100%);
}

.mobile-page {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.mobile-page.hidden {
    display: none;
}

.mobile-page h1 {
    font-size: 2em;
    margin-bottom: 40px;
}

.team-buttons {
    display: flex;
    flex-direction: column;
    gap: 20px;
    width: 100%;
    max-width: 300px;
}

.btn-red, .btn-blue {
    padding: 25px;
    font-size: 1.5em;
    border-radius: 20px;
    color: #fff;
    border: none;
    cursor: pointer;
    transition: all 0.3s ease;
}

.btn-red {
    background: linear-gradient(135deg, #e74c3c, #c0392b);
}

.btn-blue {
    background: linear-gradient(135deg, #3498db, #2980b9);
}

.btn-red:hover, .btn-blue:hover {
    transform: scale(1.05);
}

/* 加油页面 */
.team-header {
    text-align: center;
    margin-bottom: 40px;
}

.team-header h2 {
    font-size: 1.5em;
    margin-top: 10px;
}

.team-header.red-team {
    color: #e74c3c;
}

.team-header.blue-team {
    color: #3498db;
}

.shake-indicator {
    text-align: center;
    margin-bottom: 40px;
}

.shake-icon {
    font-size: 5em;
    margin-bottom: 20px;
    transition: transform 0.1s ease;
}

#shake-hint {
    font-size: 1.2em;
    color: #aaa;
}

.shake-counter {
    display: flex;
    gap: 30px;
    margin-bottom: 40px;
}

.counter {
    text-align: center;
    padding: 20px 30px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 15px;
}

.counter-label {
    display: block;
    font-size: 0.9em;
    color: #aaa;
    margin-bottom: 10px;
}

.counter-value {
    font-size: 2.5em;
    font-weight: bold;
}

.cheer-effects {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    overflow: hidden;
}

.cheer-particle {
    position: absolute;
    font-size: 2em;
    animation: floatUp 1s ease-out forwards;
}

@keyframes floatUp {
    0% {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
    100% {
        opacity: 0;
        transform: translateY(-100px) scale(0.5);
    }
}

/* 比赛结束页面 */
#game-over {
    text-align: center;
}

#game-over h1 {
    font-size: 2.5em;
    margin-bottom: 30px;
}

#game-over-result {
    margin-bottom: 30px;
}

.winner-icon {
    font-size: 5em;
    margin-bottom: 20px;
}

#game-over-result p {
    font-size: 1.3em;
    margin: 10px 0;
}

/* 不支持页面 */
#no-support {
    text-align: center;
}

#no-support p {
    margin: 10px 0;
    color: #aaa;
}

/* 响应式设计 */
@media (max-width: 768px) {
    h1 {
        font-size: 1.8em;
    }

    .status-bar {
        flex-direction: column;
        gap: 10px;
    }

    .stats {
        flex-direction: column;
        gap: 10px;
    }

    .qr-section {
        flex-direction: column;
        align-items: center;
    }

    .controls {
        flex-direction: column;
        align-items: center;
    }

    .btn {
        width: 100%;
        max-width: 300px;
    }

    .horse {
        font-size: 2em;
    }

    .lane {
        height: 80px;
    }
}
