* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body, html {
    width: 100%;
    height: 100%;
    overflow-x: hidden;
    overflow-y: hidden;
    font-family: "Microsoft YaHei", "PingFang SC", sans-serif;
    color: #e8eaed;
    user-select: none;
    touch-action: manipulation;
    background: radial-gradient(circle at 10% 0, #243b55 0, #141e30 40%, #060b16 100%);
    background-attachment: fixed;
}

.app {
    min-height: 100%;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    padding: 12px;
    background: transparent;
}

.app-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    max-width: 100%;
    padding: 16px 20px 18px;
    border-radius: 20px;
    background: radial-gradient(circle at top, rgba(88, 111, 185, 0.35), rgba(7, 12, 26, 0.92));
    box-shadow:
        0 20px 40px rgba(0, 0, 0, 0.75),
        0 0 24px rgba(80, 140, 255, 0.3);
    border: 1px solid rgba(255, 255, 255, 0.08);
    backdrop-filter: blur(18px);
    -webkit-backdrop-filter: blur(18px);
    animation: floatIn 0.9s cubic-bezier(0.19, 1, 0.22, 1);
}

.header {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    align-items: center;
    gap: 8px;
    width: 100%;
    max-width: 640px;
}

.score-counter-container,
.best-score {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0;
}

.score-label,
.best-label,
.timer-label {
    display: block;
    font-size: 12px;
    color: rgba(255,255,255,0.65);
}

.score-counter,
.best-value {
    font-size: 24px;
    font-weight: 700;
    color: #7eb8ff;
    margin-top: 4px;
}

.timer-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0;
    min-width: 0;
}

.timer-value {
    font-size: 22px;
    font-weight: 700;
    color: #f39c12;
    margin-top: 4px;
}

.timer-bar-wrap {
    width: 100%;
    max-width: 720px;
    height: 10px;
    background: linear-gradient(90deg, rgba(255,255,255,0.16), rgba(46,204,250,0.08));
    border-radius: 999px;
    overflow: hidden;
    box-shadow:
        0 0 12px rgba(0, 0, 0, 0.7),
        0 0 10px rgba(46, 204, 250, 0.35);
}

.timer-bar-fill {
    height: 100%;
    width: 100%;
    background: linear-gradient(90deg, #ff8a00, #fbc531, #00e1ff);
    border-radius: 999px;
    box-shadow:
        0 0 15px rgba(255, 170, 70, 0.8),
        0 0 24px rgba(0, 225, 255, 0.55);
    transition: width 0.5s linear;
    animation: timerGlow 3s ease-in-out infinite;
}

.button-hint {
    padding: 10px 16px;
    font-size: 16px;
}

.button-overlay {
    margin-top: 12px;
    font-size: 20px;
    padding: 14px 32px;
}

.button {
    padding: 10px 20px;
    font-size: 18px;
    font-weight: 600;
    color: #d7e9ff;
    background: radial-gradient(circle at 10% 0, rgba(46, 204, 250, 0.18), rgba(15, 32, 72, 0.9));
    border: 1px solid rgba(126,184,255,0.85);
    border-radius: 999px;
    cursor: pointer;
    letter-spacing: 0.04em;
    box-shadow:
        0 0 14px rgba(126,184,255,0.45),
        0 6px 16px rgba(0,0,0,0.7);
    transition: transform 0.16s ease-out,
                box-shadow 0.18s ease-out,
                background 0.18s ease-out,
                color 0.18s ease-out,
                border-color 0.18s ease-out;
}

.button:hover {
    transform: translateY(-1px) scale(1.03);
    background: radial-gradient(circle at 10% 0, rgba(126,184,255,0.36), rgba(10,25,54,1));
    color: #ffffff;
    box-shadow:
        0 0 22px rgba(126,184,255,0.75),
        0 10px 22px rgba(0,0,0,0.9);
    border-color: rgba(183, 222, 255, 0.95);
}

.button:active {
    transform: translateY(1px) scale(0.97);
    box-shadow:
        0 0 10px rgba(126,184,255,0.45),
        0 2px 8px rgba(0,0,0,0.9);
}

.game-field {
    position: relative;
    border: 2px solid rgba(255,255,255,0.16);
    border-radius: 18px;
    overflow: hidden;
    background: radial-gradient(circle at top, rgba(255,255,255,0.1), rgba(0,0,0,0.9));
    box-shadow:
        0 20px 40px rgba(0,0,0,0.85),
        0 0 26px rgba(46,204,250,0.35);
}

#viewport {
    display: block;
    width: 720px;
    height: 720px;
    max-width: 100%;
}

.game-field-overlay {
    display: none;
    position: absolute;
    inset: 0;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    background: radial-gradient(circle at 10% 0, rgba(0, 0, 0, 0.7), rgba(4, 12, 30, 0.92));
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    z-index: 10;
}

.overlay-message {
    color: #fff;
    font-size: 24px;
    font-weight: 700;
    text-align: center;
    padding: 22px;
    letter-spacing: 0.08em;
    text-shadow:
        0 0 8px rgba(0,0,0,0.7),
        0 0 12px rgba(126,184,255,0.9);
}

.footer {
    display: flex;
    justify-content: center;
    gap: 20px;
    margin-top: 8px;
    width: 100%;
    max-width: 720px;
}

@keyframes floatIn {
    from {
        opacity: 0;
        transform: translateY(24px) scale(0.97);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

@keyframes timerGlow {
    0% {
        box-shadow:
            0 0 12px rgba(255, 170, 70, 0.6),
            0 0 18px rgba(0, 225, 255, 0.35);
    }
    50% {
        box-shadow:
            0 0 18px rgba(255, 210, 120, 0.95),
            0 0 26px rgba(0, 225, 255, 0.7);
    }
    100% {
        box-shadow:
            0 0 12px rgba(255, 170, 70, 0.6),
            0 0 18px rgba(0, 225, 255, 0.35);
    }
}
