* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: "Microsoft YaHei", sans-serif;
}

body {
    background: #0a0a1a;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    padding: 20px;
}

.game-container {
    position: relative;
    border-radius: 16px;
    box-shadow: 0 8px 40px rgba(0, 216, 255, 0.15);
    overflow: visible;
    max-width: 100%;
    border: 2px solid rgba(0, 216, 255, 0.2);
}

@media (max-width: 520px) {
    .game-container {
        transform: scale(0.85);
        transform-origin: top center;
    }
    .score-box, .high-score-box { font-size: 16px; top: 15px; }
    .high-score-box { top: 50px; }
}

@media (max-width: 460px) {
    .game-container { transform: scale(0.75); }
    .score-box, .high-score-box { font-size: 14px; top: 12px; }
    .high-score-box { top: 45px; }
}

@media (max-width: 400px) {
    .game-container { transform: scale(0.65); }
    .score-box, .high-score-box { font-size: 12px; top: 10px; left: 10px; }
    .high-score-box { top: 40px; }
}

@media (max-width: 350px) {
    .game-container { transform: scale(0.55); }
    .score-box, .high-score-box { font-size: 11px; }
}

#gameCanvas {
    background: #1a3a1a;
    display: block;
    cursor: pointer;
    position: relative;
    z-index: 1;
}

.score-box {
    position: absolute;
    top: 20px;
    left: 20px;
    font-size: 22px;
    font-weight: bold;
    color: #fff;
    text-shadow: 0 2px 8px rgba(0,0,0,0.5);
    z-index: 10;
}

.high-score-box {
    position: absolute;
    top: 60px;
    left: 20px;
    font-size: 16px;
    font-weight: bold;
    color: #ffd700;
    text-shadow: 0 2px 8px rgba(0,0,0,0.5);
    z-index: 10;
}

.version-badge {
    position: absolute;
    top: 20px;
    left: 50%;
    transform: translateX(-50%);
    padding: 4px 12px;
    background: linear-gradient(135deg, #8b3a3a, #ff4444);
    color: #fff;
    font-size: 12px;
    font-weight: bold;
    border-radius: 12px;
    z-index: 10;
    letter-spacing: 1px;
}

.home-btn {
    position: absolute;
    top: 20px;
    right: 20px;
    z-index: 30;
    padding: 12px 28px;
    font-size: 16px;
    border: none;
    border-radius: 8px;
    background: #00d8ff;
    color: #000;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.2s ease;
    pointer-events: auto;
    min-width: 80px;
    min-height: 44px;
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
}

.home-btn:hover {
    background: #00b3cc;
    transform: translateY(-2px);
}

.home-btn:disabled {
    background: #888;
    cursor: not-allowed;
    transform: none;
}

.start-box {
    position: absolute;
    top: 0; left: 0;
    width: 100%; height: 100%;
    background: rgba(0, 0, 0, 0.8);
    z-index: 20;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    color: #fff;
    pointer-events: auto;
}

.start-box h2 {
    font-size: 36px;
    margin-bottom: 8px;
    color: #00d8ff;
}

.version-tag {
    font-size: 14px;
    color: #ff8800;
    margin-bottom: 15px;
    font-weight: bold;
    letter-spacing: 2px;
}

.start-box p {
    font-size: 16px;
    color: #ccc;
    margin-bottom: 30px;
    line-height: 1.8;
    text-align: center;
}

.btn-group {
    display: flex;
    gap: 15px;
}

.btn {
    padding: 14px 40px;
    font-size: 18px;
    border: none;
    border-radius: 8px;
    background: #00d8ff;
    color: #000;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.2s ease;
    pointer-events: auto;
    min-width: 120px;
    min-height: 48px;
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
}

.btn-secondary {
    background: #fff;
    color: #000;
}

.btn:hover {
    background: #00b3cc;
    transform: translateY(-2px);
}

.btn-secondary:hover {
    background: #e0e0e0;
}

@media (hover: none) and (pointer: coarse) {
    .btn:hover { transform: none; }
    .btn:active { background: #00b3cc; transform: scale(0.95); }
    .btn-secondary:active { background: #e0e0e0; transform: scale(0.95); }
    .home-btn:hover { transform: none; }
    .home-btn:active { background: #00b3cc; transform: scale(0.95); }
}

.over-box {
    position: absolute;
    top: 0; left: 0;
    width: 100%; height: 100%;
    background: rgba(0, 0, 0, 0.85);
    z-index: 20;
    display: none;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    color: #fff;
    pointer-events: auto;
}

.over-box h2 {
    font-size: 32px;
    color: #ff4444;
    margin-bottom: 15px;
}

.over-box p {
    font-size: 20px;
    margin-bottom: 30px;
}

.ranking-box {
    position: absolute;
    top: 0; left: 0;
    width: 100%; height: 100%;
    background: rgba(0, 0, 0, 0.9);
    z-index: 25;
    display: none;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    color: #fff;
    pointer-events: auto;
}

.ranking-content {
    width: 80%;
    max-height: 80%;
    overflow-y: auto;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 8px;
    padding: 20px;
    margin-bottom: 20px;
}

.ranking-table {
    width: 100%;
    border-collapse: collapse;
}

.ranking-table th, .ranking-table td {
    padding: 10px;
    text-align: left;
    border-bottom: 1px solid rgba(255,255,255,0.2);
}

.ranking-table th {
    color: #00d8ff;
}

.pagination {
    display: flex;
    gap: 10px;
    align-items: center;
}

.page-btn {
    padding: 5px 15px;
    background: #00d8ff;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    color: #000;
    font-weight: bold;
}

.page-btn:disabled {
    background: #555;
    cursor: not-allowed;
}

.tip-text {
    margin-top: 20px;
    color: #888;
    font-size: 14px;
}

@keyframes fadeInOut {
    0% { opacity: 0; transform: translateX(-50%) translateY(-20px); }
    10% { opacity: 1; transform: translateX(-50%) translateY(0); }
    90% { opacity: 1; transform: translateX(-50%) translateY(0); }
    100% { opacity: 0; transform: translateX(-50%) translateY(-20px); }
}

@keyframes shake {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-5px); }
    75% { transform: translateX(5px); }
}

.pause-box {
    position: absolute;
    top: 0; left: 0;
    width: 100%; height: 100%;
    background: rgba(0, 0, 0, 0.8);
    z-index: 22;
    display: none;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    color: #fff;
    pointer-events: auto;
}

.pause-box h2 {
    font-size: 32px;
    color: #00d8ff;
    margin-bottom: 15px;
}

.pause-box p {
    font-size: 16px;
    color: #ccc;
}
