* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Arial', sans-serif;
    background-color: #f0f0f0;
    color: #333;
    display: flex;
    justify-content: center;
    align-items: stretch;
    height: 100vh;
    margin: 0;
    padding: 0;
    overflow: hidden;
}

.game-container {
    background-color: white;
    border-radius: 10px;
    box-shadow: 0 0 20px rgba(0, 0, 0, 0.1);
    padding: 15px;
    width: 100%;
    height: 100%;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

header {
    text-align: center;
    margin-bottom: 15px;
    border-bottom: 2px solid #eee;
    padding-bottom: 15px;
}

header h1 {
    color: #2c3e50;
    margin-bottom: 10px;
    font-size: 2em;
}

.score-board {
    display: flex;
    justify-content: center;
    gap: 50px;
    font-size: 1.2em;
    font-weight: bold;
}

.current-score span:last-child {
    color: #e74c3c;
}

.high-score span:last-child {
    color: #27ae60;
}

main {
    display: flex;
    gap: 20px;
    margin-bottom: 15px;
    flex: 1;
    overflow: hidden;
    align-items: stretch;
    justify-content: flex-start;
    flex-wrap: wrap;
}

.game-area {
    flex: 1 1 auto;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    padding: 10px;
    min-width: 300px;
}

.right-panel {
    display: flex;
    flex-direction: row;
    gap: 15px;
    align-items: stretch;
    justify-content: flex-start;
    flex-shrink: 0;
    min-width: 520px;
    max-width: 520px;
    align-self: stretch;
    height: 100%;
}

#gameCanvas {
    border: 3px solid #34495e;
    border-radius: 5px;
    background-color: #ecf0f1;
    box-shadow: 0 0 10px rgba(0, 0, 0, 0.1);
    width: 650px;
    height: 650px;
}

.controls {
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
    align-items: center;
    padding: 15px;
    background-color: #f8f9fa;
    border-radius: 8px;
    box-shadow: 0 0 10px rgba(0, 0, 0, 0.1);
    width: 250px;
    box-sizing: border-box;
    flex-shrink: 0;
    align-self: flex-start;
}

.controls h3 {
    margin-bottom: 8px;
    color: #2c3e50;
    font-size: 1.1em;
    text-align: center;
}

.controls p {
    margin-bottom: 10px;
    color: #7f8c8d;
    font-size: 0.9em;
    text-align: center;
    line-height: 1.3;
}

.mouse-controls {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    margin-top: 5px;
}

.middle-row {
    display: flex;
    gap: 10px;
}

.control-btn {
    width: 60px;
    height: 60px;
    font-size: 1.5em;
    font-weight: bold;
    background-color: #3498db;
    color: white;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    transition: all 0.2s ease;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.2);
}

.control-btn:hover {
    background-color: #2980b9;
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.3);
}

.control-btn:active {
    transform: translateY(0);
    box-shadow: 0 2px 3px rgba(0, 0, 0, 0.2);
}

.leaderboard {
    width: 260px;
    background-color: #f8f9fa;
    border-radius: 8px;
    padding: 15px;
    box-shadow: 0 0 10px rgba(0, 0, 0, 0.1);
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
    height: 100%;
    max-height: none;
    overflow: hidden;
    box-sizing: border-box;
}

.leaderboard h3 {
    text-align: center;
    margin: 0 0 5px 0;
    color: #2c3e50;
    font-size: 1.2em;
    flex-shrink: 0;
}

.leaderboard-list {
    flex: 1;
    overflow-y: auto;
    margin-top: 10px;
    min-height: 0;
}

#leaderboard-table {
    width: 100%;
    border-collapse: collapse;
    text-align: center;
}

#leaderboard-table th {
    background-color: #3498db;
    color: white;
    padding: 10px;
    font-weight: bold;
}

#leaderboard-table td {
    padding: 10px;
    border-bottom: 1px solid #ddd;
}

#leaderboard-table tr:nth-child(even) {
    background-color: #e9ecef;
}

#leaderboard-table tr:hover {
    background-color: #dee2e6;
}

/* 本次新加入记录的高亮样式 */
.leaderboard-highlight {
    background-color: #ffeaa7 !important;
    font-weight: bold;
}

footer {
    text-align: center;
    border-top: 2px solid #eee;
    padding-top: 20px;
}

footer button {
    margin: 0 10px;
    padding: 10px 20px;
    font-size: 1em;
    font-weight: bold;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    transition: all 0.2s ease;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.2);
}

#start-btn {
    background-color: #27ae60;
    color: white;
}

#start-btn:hover {
    background-color: #219653;
    transform: translateY(-2px);
}

#pause-btn {
    background-color: #f39c12;
    color: white;
}

#pause-btn:hover {
    background-color: #e67e22;
    transform: translateY(-2px);
}

#reset-btn {
    background-color: #e74c3c;
    color: white;
}

#reset-btn:hover {
    background-color: #c0392b;
    transform: translateY(-2px);
}

footer button:active {
    transform: translateY(0);
    box-shadow: 0 2px 3px rgba(0, 0, 0, 0.2);
}

footer button:disabled {
    background-color: #bdc3c7;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

@media (max-width: 1200px) {
    .right-panel {
        flex-direction: column;
        min-width: 280px;
        max-width: 300px;
    }
    
    .controls,
    .leaderboard {
        width: 100%;
    }
    
    main {
        justify-content: center;
    }
}

@media (max-width: 1000px) {
    main {
        flex-direction: column;
        align-items: center;
    }
    
    .leaderboard {
        width: 100%;
        max-width: 600px;
    }
}

@media (max-width: 650px) {
    #gameCanvas {
        width: 400px;
        height: 400px;
    }
    
    header h1 {
        font-size: 2em;
    }
    
    .score-board {
        flex-direction: column;
        gap: 10px;
    }
}

/* Turnstile 验证组件样式 */
#turnstile-container {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    z-index: 1000;
    background: transparent;
    border: none;
    border-radius: 0;
    box-shadow: none;
    padding: 25px;
    min-width: 320px;
    max-width: 400px;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease, transform 0.3s ease;
    pointer-events: none;
}

#turnstile-container.turnstile-visible {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
    transform: translate(-50%, -50%) scale(1);
}

#turnstile-container.turnstile-hidden {
    opacity: 0;
    visibility: hidden;
    transform: translate(-50%, -50%) scale(0.95);
}

.turnstile-wrapper {
    text-align: center;
}

.turnstile-header {
    margin-bottom: 20px;
}

.turnstile-header h3 {
    color: #2c3e50;
    font-size: 1.5em;
    margin-bottom: 8px;
    text-shadow: 0 1px 2px rgba(255, 255, 255, 0.8);
}

.turnstile-header p {
    color: #7f8c8d;
    font-size: 0.9em;
    margin: 0;
    text-shadow: 0 1px 2px rgba(255, 255, 255, 0.8);
}

.turnstile-widget {
    display: flex;
    justify-content: center;
    align-items: center;
    margin: 20px 0;
    min-height: 65px;
}

.turnstile-status {
    margin-top: 15px;
    font-size: 0.9em;
    min-height: 20px;
}

.turnstile-status.success {
    color: #27ae60;
    font-weight: bold;
    text-shadow: 0 1px 2px rgba(255, 255, 255, 0.8);
}

.turnstile-status.error {
    color: #e74c3c;
    text-shadow: 0 1px 2px rgba(255, 255, 255, 0.8);
}

.turnstile-status.loading {
    color: #3498db;
    text-shadow: 0 1px 2px rgba(255, 255, 255, 0.8);
}

/* 背景遮罩 */
#turnstile-container::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: -1;
    opacity: 0;
    transition: opacity 0.3s ease;
    pointer-events: none;
}

#turnstile-container.turnstile-visible::before {
    opacity: 1;
    pointer-events: auto;
}

/* 响应式设计 */
@media (max-width: 480px) {
    #turnstile-container {
        min-width: 90%;
        padding: 20px;
    }
    
    .turnstile-header h3 {
        font-size: 1.2em;
    }
}