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

html, body {
    width: 100%;
    height: 100%;
    overflow: hidden;
    -webkit-overflow-scrolling: touch;
}

body {
    font-family: 'Microsoft YaHei', 'PingFang SC', -apple-system, BlinkMacSystemFont, Arial, sans-serif;
    font-size: 16px;
    line-height: 1.5;
    color: #333;
    background-color: #1a4d32;
}

#game-container {
    width: 100vw;
    height: 100vh;
    position: relative;
    overflow: hidden;
    touch-action: manipulation;
}

.screen {
    width: 100%;
    height: 100%;
    position: absolute;
    top: 0;
    left: 0;
}

#start-screen {
    display: none;
    justify-content: center;
    align-items: center;
    background: linear-gradient(135deg, #0d2818 0%, #1a4d32 50%, #0d2818 100%);
    background-attachment: fixed;
    overflow: hidden;
}

.start-content {
    text-align: center;
    padding: 40px 30px;
    max-width: 450px;
    width: 90%;
    max-height: calc(100vh - 40px);
    overflow-y: auto;
    background: rgba(0, 0, 0, 0.6);
    border-radius: 25px;
    border: 3px solid rgba(40, 167, 69, 0.6);
    backdrop-filter: blur(5px);
    -webkit-backdrop-filter: blur(5px);
}

.game-title {
    font-size: clamp(28px, 8vw, 42px);
    color: #28a745;
    margin-bottom: 25px;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.5);
    font-weight: bold;
}

.game-subtitle {
    font-size: clamp(14px, 3vw, 18px);
    color: #a7f3d0;
    margin-bottom: 35px;
    line-height: 1.6;
}

.btn-start {
    width: 100%;
    padding: 18px 30px;
    font-size: clamp(18px, 4vw, 24px);
    font-weight: bold;
    color: #fff;
    background: linear-gradient(135deg, #28a745 0%, #20c997 100%);
    border: none;
    border-radius: 35px;
    cursor: pointer;
    margin-bottom: 35px;
    box-shadow: 0 4px 15px rgba(40, 167, 69, 0.4);
    transition: transform 0.2s, box-shadow 0.2s;
    -webkit-tap-highlight-color: transparent;
}

.btn-start:hover {
    transform: translateY(-3px);
    box-shadow: 0 6px 20px rgba(40, 167, 69, 0.6);
}

.btn-start:active {
    transform: translateY(-1px);
}

.game-rules {
    background: rgba(0, 0, 0, 0.5);
    border-radius: 15px;
    padding: 22px;
    text-align: left;
    border: 2px solid rgba(40, 167, 69, 0.4);
}

.game-rules h3 {
    color: #28a745;
    margin-bottom: 18px;
    font-size: clamp(15px, 3vw, 18px);
    text-align: center;
}

.game-rules ul {
    list-style: none;
    color: #a7f3d0;
    font-size: clamp(13px, 2.5vw, 15px);
    line-height: 2;
}

.game-rules li {
    padding: 8px 0;
    padding-left: 25px;
    position: relative;
}

.game-rules li::before {
    content: '🐸';
    position: absolute;
    left: 0;
    font-size: clamp(12px, 2.5vw, 14px);
}

#game-screen {
    display: none;
    width: 100vw;
    height: 100vh;
    background-size: cover;
    background-position: center center;
    background-repeat: no-repeat;
    background-attachment: fixed;
}

#game-header {
    display: flex;
    justify-content: center;
    gap: clamp(20px, 5vw, 35px);
    padding: clamp(10px, 2.5vw, 14px);
    background: rgba(0, 0, 0, 0.5);
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    z-index: 10;
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
}

.header-item {
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: clamp(6px, 2vw, 10px);
    padding: clamp(8px, 2vw, 12px) clamp(15px, 3.5vw, 25px);
    background: rgba(0, 0, 0, 0.6);
    border-radius: 12px;
    border: 1px solid rgba(40, 167, 69, 0.4);
}

.header-item .label {
    font-size: clamp(12px, 2.5vw, 16px);
    color: #a7f3d0;
    font-weight: bold;
    white-space: nowrap;
}

.header-item .value {
    font-size: clamp(18px, 4vw, 26px);
    font-weight: bold;
    color: #28a745;
    min-width: clamp(35px, 8vw, 50px);
    text-align: center;
}

#game-canvas {
    display: block;
    position: absolute;
    top: 0;
    left: 0;
    touch-action: none;
}

.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.9);
    justify-content: center;
    align-items: center;
    z-index: 100;
    padding: clamp(15px, 5vw, 20px);
    overflow: auto;
}

.modal-content {
    background: linear-gradient(135deg, #0d2818 0%, #1a4d32 100%);
    border-radius: 25px;
    padding: clamp(18px, 5vw, 25px);
    max-width: 400px;
    width: 100%;
    border: 3px solid #28a745;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.5);
}

.question-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: clamp(12px, 3vw, 15px);
    padding-bottom: clamp(10px, 2.5vw, 12px);
    border-bottom: 2px solid #28a745;
}

.lily-type {
    font-size: clamp(16px, 3.5vw, 20px);
    color: #28a745;
    font-weight: bold;
}

.points {
    font-size: clamp(12px, 2.5vw, 15px);
    color: #34d399;
}

.question-text {
    font-size: clamp(20px, 5vw, 30px);
    font-weight: bold;
    color: #fff;
    text-align: center;
    margin-bottom: clamp(18px, 4vw, 25px);
    min-height: 50px;
    line-height: 1.7;
}

.options-container {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
    gap: clamp(8px, 2vw, 12px);
    margin-bottom: clamp(10px, 2.5vw, 15px);
}

.option-btn {
    padding: clamp(14px, 3.5vw, 18px) clamp(12px, 2.5vw, 15px);
    font-size: clamp(15px, 3vw, 18px);
    color: #fff;
    background: linear-gradient(135deg, #0d2818 0%, #1a4d32 100%);
    border: 2px solid #28a745;
    border-radius: 14px;
    cursor: pointer;
    transition: all 0.2s;
    -webkit-tap-highlight-color: transparent;
}

.option-btn:hover {
    background: linear-gradient(135deg, #1a4d32 0%, #28a745 100%);
    transform: translateY(-2px);
}

.option-btn:active {
    transform: translateY(0);
}

.option-btn.correct {
    background: linear-gradient(135deg, #28a745 0%, #20c997 100%);
}

.option-btn.wrong {
    background: linear-gradient(135deg, #dc3545 0%, #e74c3c 100%);
}

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

.feedback {
    text-align: center;
    padding: clamp(10px, 2.5vw, 12px);
    border-radius: 10px;
    font-size: clamp(14px, 2.8vw, 16px);
    font-weight: bold;
    margin-top: clamp(8px, 2vw, 10px);
}

.feedback.correct {
    background: rgba(40, 167, 69, 0.3);
    color: #28a745;
}

.feedback.wrong {
    background: rgba(220, 53, 69, 0.3);
    color: #dc3545;
}

#game-over-screen {
    display: none;
    justify-content: center;
    align-items: center;
    background-size: cover;
    background-position: center center;
    background-repeat: no-repeat;
    background-attachment: fixed;
}

.game-over-content {
    text-align: center;
    padding: clamp(28px, 8vw, 35px);
    max-width: 400px;
    width: 90%;
    max-height: 90vh;
    overflow-y: auto;
    background: rgba(0, 0, 0, 0.7);
    border-radius: 25px;
    border: 3px solid #28a745;
    backdrop-filter: blur(5px);
    -webkit-backdrop-filter: blur(5px);
}

.end-title {
    font-size: clamp(24px, 6vw, 36px);
    color: #28a745;
    margin-bottom: clamp(18px, 4vw, 22px);
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.5);
}

.final-score {
    background: rgba(0, 0, 0, 0.5);
    border-radius: 18px;
    padding: clamp(18px, 4vw, 22px);
    margin-bottom: clamp(18px, 4vw, 22px);
    border: 3px solid #28a745;
}

.score-label {
    display: block;
    font-size: clamp(12px, 2.5vw, 14px);
    color: #a7f3d0;
    margin-bottom: 8px;
}

.score-value {
    display: block;
    font-size: clamp(36px, 10vw, 50px);
    font-weight: bold;
    color: #28a745;
    text-shadow: 0 0 20px rgba(40, 167, 69, 0.5);
}

.stats-row {
    display: flex;
    justify-content: space-between;
    gap: clamp(15px, 5vw, 30px);
    margin-bottom: clamp(18px, 4vw, 22px);
}

.stat-item-left,
.stat-item-right {
    flex: 1;
    background: rgba(0, 0, 0, 0.5);
    border-radius: 12px;
    padding: clamp(12px, 3vw, 15px) clamp(8px, 2vw, 10px);
    border: 1px solid rgba(40, 167, 69, 0.3);
    text-align: center;
}

.stat-label {
    display: block;
    font-size: clamp(9px, 2vw, 11px);
    color: #a7f3d0;
    margin-bottom: 6px;
}

.stat-value {
    display: block;
    font-size: clamp(16px, 4vw, 22px);
    font-weight: bold;
    color: #fff;
}

.result-message {
    font-size: clamp(14px, 3vw, 18px);
    color: #a7f3d0;
    margin-bottom: clamp(18px, 4vw, 22px);
    padding: clamp(12px, 3vw, 15px);
    background: rgba(0, 0, 0, 0.4);
    border-radius: 12px;
    line-height: 1.6;
}

.btn-restart {
    padding: clamp(14px, 3vw, 16px) clamp(35px, 8vw, 45px);
    font-size: clamp(14px, 3vw, 18px);
    font-weight: bold;
    color: #fff;
    background: linear-gradient(135deg, #28a745 0%, #20c997 100%);
    border: none;
    border-radius: 30px;
    cursor: pointer;
    box-shadow: 0 4px 15px rgba(40, 167, 69, 0.4);
    transition: transform 0.2s, box-shadow 0.2s;
    -webkit-tap-highlight-color: transparent;
}

.btn-restart:hover {
    transform: translateY(-3px);
    box-shadow: 0 6px 20px rgba(40, 167, 69, 0.6);
}

.btn-restart:active {
    transform: translateY(-1px);
}

@media (max-width: 480px) {
    .start-content {
        padding: 30px 20px;
    }
    
    .game-title {
        margin-bottom: 20px;
    }
    
    .game-subtitle {
        margin-bottom: 28px;
    }
    
    .btn-start {
        padding: 16px;
        margin-bottom: 28px;
    }
    
    .game-rules {
        padding: 18px;
    }
    
    .game-rules h3 {
        margin-bottom: 14px;
    }
    
    .game-rules li {
        padding-left: 22px;
    }
    
    #game-header {
        gap: 10px;
        padding: 8px;
    }
    
    .header-item {
        min-width: 55px;
        padding: 6px 12px;
    }
    
    .options-container {
        grid-template-columns: 1fr;
    }
    
    .stats-row {
        flex-direction: row;
        gap: 12px;
    }
    
    .modal-content {
        padding: 22px;
        max-width: 90%;
    }
    
    .question-text {
        font-size: 20px;
        line-height: 1.6;
    }
    
    .option-btn {
        padding: 16px 14px;
        font-size: 18px;
    }
    
    .feedback {
        font-size: 18px;
        padding: 12px;
    }
    
    .game-over-content {
        padding: 32px 24px;
    }
    
    .end-title {
        font-size: 32px;
    }
    
    .score-value {
        font-size: 50px;
    }
    
    .stat-label {
        font-size: 13px;
    }
    
    .stat-value {
        font-size: 24px;
    }
}

@media (orientation: landscape) and (max-height: 480px) {
    .start-content {
        padding: 25px 20px;
        max-height: 85vh;
    }
    
    .game-title {
        margin-bottom: 18px;
    }
    
    .game-subtitle {
        margin-bottom: 25px;
    }
    
    .btn-start {
        padding: 14px;
        margin-bottom: 25px;
    }
    
    .game-rules {
        padding: 15px;
    }
    
    .game-rules li {
        padding: 6px 0;
        padding-left: 22px;
    }
    
    .game-over-content {
        padding: 22px 20px;
        max-height: 85vh;
    }
    
    .end-title {
        margin-bottom: 15px;
    }
    
    .final-score {
        padding: 15px;
        margin-bottom: 15px;
    }
    
    .stats {
        margin-bottom: 15px;
    }
    
    .result-message {
        margin-bottom: 15px;
    }
}
