* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    user-select: none;
    -webkit-tap-highlight-color: transparent;
}

html, body {
    width: 100%;
    height: 100%;
    overflow: hidden;
    position: fixed;
    top: 0;
    left: 0;
    background: #1a1e2c;
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: 'Segoe UI', 'PingFang SC', Roboto, system-ui, sans-serif;
}

.game-container {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    width: 100%;
    max-width: 380px;
    padding: 16px 0 20px;
    background: #0f1219;
    border-radius: 32px;
    box-shadow: 0 20px 40px rgba(0,0,0,0.6);
}

.game-title {
    width: 100%;
    text-align: center;
    margin-bottom: 12px;
    padding: 0 8px;
}

.game-title h1 {
    font-size: 24px;
    font-weight: 900;
    color: #fad275;
    text-shadow: 0 4px 0 #8b6914, 0 8px 12px black;
    letter-spacing: 2px;
    background: linear-gradient(135deg, #ffe6a6, #ffc857);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-stroke: 1.5px #9e7a2c;
    transform: perspective(400px) rotateX(2deg);
    white-space: nowrap;
    line-height: 1.3;
}

.game-title h1 span {
    display: inline-block;
    animation: letterBounce 2.4s infinite ease-in-out;
    transform-origin: center;
}

@keyframes letterBounce {
    0%, 100% { transform: translateY(0); }
    30% { transform: translateY(-5px) scale(1.03); }
    60% { transform: translateY(2px); }
}

.canvas-wrapper {
    position: relative;
    width: 300px;
    height: 400px;
    margin: 0 auto;
}

canvas {
    display: block;
    width: 100%;
    height: 100%;
    border-radius: 20px;
    box-shadow: 0 0 0 3px #2e3a5c, 0 12px 25px rgba(0,0,0,0.7);
    background: #10131f;
    touch-action: none;
}

.simulator-btn {
    margin-top: 12px;
    background: linear-gradient(145deg, #6d5ac9, #3f2e8e);
    color: #f0e9ff;
    border: none;
    border-bottom: 4px solid #1f1552;
    border-radius: 40px;
    padding: 6px 16px;
    font-size: 16px;
    font-weight: bold;
    letter-spacing: 1px;
    text-shadow: 0 1px 2px #1e1530;
    box-shadow: 0 4px 0 #1e163b, 0 6px 12px black;
    cursor: pointer;
    text-decoration: none;
    transition: all 0.05s;
    touch-action: manipulation;
    white-space: nowrap;
    backdrop-filter: blur(2px);
    border: 1px solid #a28de0;
}

.simulator-btn:active {
    transform: translateY(3px);
    box-shadow: 0 1px 0 #1e163b, 0 6px 12px black;
    border-bottom-width: 2px;
}

.score-area {
    width: 100%;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0 20px;
    margin: 10px 0 6px;
    gap: 10px;
}

.score-item {
    flex: 1;
    text-align: center;
    background: #2e3a5c;
    color: #f7e05e;
    font-size: 18px;
    font-weight: bold;
    padding: 6px 10px;
    border-radius: 60px;
    letter-spacing: 1px;
    box-shadow: inset 0 -3px 0 #1b2336, 0 6px 0 #0b0f16;
    border: 1px solid #5f7aaf;
    text-shadow: 0 2px 0 #1a1f2c;
    white-space: nowrap;
}

#score {
    font-size: 22px;
    color: #f7e05e;
}

#highScore {
    font-size: 22px;
    color: #f39c12;
}

.btn-group {
    display: flex;
    gap: 12px;
    margin-top: 14px;
}

.btn-start, .btn-pause {
    padding: 16px 10px;
    border-radius: 60px;
    font-size: 18px;
    font-weight: 900;
    letter-spacing: 2px;
    cursor: pointer;
    touch-action: manipulation;
    outline: none;
    border: none;
    border-bottom: 6px solid;
    transition: all 0.05s ease;
}

.btn-start {
    width: 120px;
    background: linear-gradient(145deg, #f3c74d, #e0a81c);
    color: #1e232f;
    border-bottom-color: #9e7012;
    box-shadow: 0 8px 0 #6b4b0c, 0 10px 20px rgba(0,0,0,0.3);
    text-shadow: 0 1px 2px #ffe28c;
}

.btn-pause {
    width: 120px;
    background: linear-gradient(145deg, #5499ff, #2b78e4);
    color: #fff;
    border-bottom-color: #19499e;
    box-shadow: 0 8px 0 #143b78, 0 10px 20px rgba(0,0,0,0.3);
}

.btn-start:active, .btn-pause:active {
    transform: translateY(6px);
    box-shadow: 0 2px 0, 0 8px 15px rgba(0,0,0,0.3);
    border-bottom-width: 3px;
}

.btn-start:disabled, .btn-pause:disabled {
    opacity: 0.7;
    transform: translateY(4px);
    pointer-events: none;
}

.flyText {
    position: absolute;
    color: #ffd700;
    font-size: 22px;
    font-weight: bold;
    pointer-events: none;
    animation: fly 1s forwards;
    z-index: 99;
    text-shadow: 0 2px 4px #000;
}

@keyframes fly {
    to {
        transform: translateY(-50px);
        opacity: 0;
    }
}

.levelTip {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 32px;
    font-weight: 900;
    color: #ff3d00;
    text-shadow: 0 0 10px #fff, 0 0 20px #ff3d00;
    z-index: 99;
    animation: levelTip 1.2s forwards;
    pointer-events: none;
    white-space: nowrap;
}

@keyframes levelTip {
    0% { transform: translate(-50%, -50%) scale(0.5); opacity: 0; }
    50% { transform: translate(-50%, -50%) scale(1.2); opacity: 1; }
    100% { transform: translate(-50%, -50%) scale(1); opacity: 0; }
}

#gameOverModal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.85);
    display: none;
    justify-content: center;
    align-items: center;
    z-index: 999;
}

.modal-box {
    background: linear-gradient(145deg, #1a1e2c, #0f1219);
    padding: 40px 30px;
    border-radius: 24px;
    text-align: center;
    border: 3px solid #fad275;
    box-shadow: 0 0 30px rgba(250, 210, 117, 0.3);
    max-width: 320px;
    width: 90%;
}

.modal-box h2 {
    font-size: 32px;
    font-weight: 900;
    color: #e74c3c;
    margin-bottom: 20px;
    text-shadow: 0 4px 0 #7b241c, 0 0 10px rgba(231, 76, 60, 0.5);
}

.modal-score {
    font-size: 24px;
    color: #f7e05e;
    font-weight: bold;
    margin: 10px 0;
}

.modal-high {
    font-size: 20px;
    color: #f39c12;
    font-weight: bold;
    margin: 10px 0 25px;
}

.modal-btn {
    width: 100%;
    padding: 14px 10px;
    background: linear-gradient(145deg, #f3c74d, #e0a81c);
    border: none;
    border-bottom: 6px solid #9e7012;
    border-radius: 60px;
    color: #1e232f;
    font-size: 20px;
    font-weight: 900;
    letter-spacing: 4px;
    cursor: pointer;
    transition: all 0.05s;
}

.modal-btn:active {
    transform: translateY(6px);
    border-bottom-width: 3px;
}