/* 游戏整体样式 */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Arial', sans-serif;
    background: linear-gradient(135deg, #ff9a9e 0%, #fecfef 50%, #fecfef 100%);
    min-height: 100vh;
    overflow-x: hidden;
}

.game-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* 游戏标题栏 */
.game-header {
    background: rgba(255, 255, 255, 0.95);
    border-radius: 15px;
    padding: 20px;
    margin-bottom: 20px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
    backdrop-filter: blur(10px);
    text-align: center;
}

.game-header h1 {
    color: #e91e63;
    font-size: 2.5rem;
    margin-bottom: 15px;
    text-shadow: 2px 2px 4px rgba(233, 30, 99, 0.3);
    font-weight: bold;
}

/* 桌面端显示完整标题 */
.mobile-title {
    display: none;
}

/* 移动端显示简化标题 */
@media (max-width: 768px) {
    .desktop-title {
        display: none;
    }
    
    .mobile-title {
        display: block;
    }
}

.score-board {
    display: flex;
    justify-content: space-around;
    font-size: 1.2rem;
    font-weight: bold;
    color: #2d3748;
}

.score-board span {
    background: linear-gradient(45deg, #e91e63, #f06292);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

/* 游戏主界面 */
.game-main {
    flex: 1;
    position: relative;
}

.screen {
    display: none;
    width: 100%;
    height: 100%;
    min-height: 500px;
}

.screen.active {
    display: block;
}

/* 开始界面 */
.start-content {
    background: rgba(255, 255, 255, 0.95);
    border-radius: 20px;
    padding: 40px;
    text-align: center;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.1);
    backdrop-filter: blur(10px);
}

.start-content h2 {
    color: #4a5568;
    font-size: 2rem;
    margin-bottom: 20px;
}

.start-content p {
    color: #718096;
    font-size: 1.2rem;
    margin-bottom: 30px;
}

.character-selection {
    margin: 30px 0;
}

.character-selection h3 {
    color: #4a5568;
    margin-bottom: 20px;
    font-size: 1.5rem;
}

.characters {
    display: flex;
    justify-content: center;
    gap: 30px;
    margin-bottom: 30px;
}

.character-btn {
    background: linear-gradient(45deg, #ff9a9e, #fecfef);
    border: none;
    border-radius: 20px;
    padding: 20px;
    cursor: pointer;
    transition: all 0.3s ease;
    color: #e91e63;
    font-size: 1rem;
    font-weight: bold;
    box-shadow: 0 8px 16px rgba(233, 30, 99, 0.2);
    border: 2px solid #f8bbd9;
    min-width: 44px;
    min-height: 44px;
    touch-action: manipulation;
}

.character-btn:hover {
    transform: translateY(-5px);
    box-shadow: 0 12px 24px rgba(0, 0, 0, 0.3);
}

.character-btn.selected {
    background: linear-gradient(45deg, #e91e63, #f06292);
    color: white;
    transform: scale(1.1);
    box-shadow: 0 12px 24px rgba(233, 30, 99, 0.4);
}

.character-icon {
    font-size: 3rem;
    margin-bottom: 10px;
}

/* 按钮样式 */
.btn-primary {
    background: linear-gradient(45deg, #e91e63, #f06292);
    border: none;
    border-radius: 25px;
    padding: 15px 30px;
    font-size: 1.2rem;
    font-weight: bold;
    color: white;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 8px 16px rgba(233, 30, 99, 0.3);
    border: 2px solid #f8bbd9;
    min-width: 44px;
    min-height: 44px;
    touch-action: manipulation;
}

.btn-primary:hover {
    transform: translateY(-3px);
    box-shadow: 0 12px 24px rgba(0, 0, 0, 0.3);
}

/* 游戏世界 */
.game-world {
    background: linear-gradient(180deg, #ffc1cc 0%, #ffb3d1 50%, #ff9ec7 100%);
    border-radius: 25px;
    height: 400px;
    position: relative;
    overflow: hidden;
    margin-bottom: 20px;
    box-shadow: 0 10px 30px rgba(233, 30, 99, 0.2);
    border: 3px solid #f8bbd9;
    transition: all 0.5s ease;
}

/* 背景样式 */
.game-world.cute-bg {
    background: linear-gradient(180deg, #87CEEB 0%, #98FB98 50%, #90EE90 100%);
}

.game-world.minecraft-bg {
    background: linear-gradient(180deg, #87CEEB 0%, #90EE90 30%, #8FBC8F 60%, #556B2F 100%);
    border: 3px solid #8B4513;
    position: relative;
}

.game-world.minecraft-bg::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-image: 
        repeating-linear-gradient(90deg, transparent, transparent 8px, rgba(0,0,0,0.1) 8px, rgba(0,0,0,0.1) 9px),
        repeating-linear-gradient(0deg, transparent, transparent 8px, rgba(0,0,0,0.1) 8px, rgba(0,0,0,0.1) 9px);
    pointer-events: none;
}

.background {
    position: absolute;
    width: 100%;
    height: 100%;
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
    padding: 20px;
}

.house, .tank, .trees {
    font-size: 3rem;
    animation: float 3s ease-in-out infinite;
}

.trees {
    display: flex;
    gap: 10px;
}

/* 背景元素样式 */
.bg-element {
    position: absolute;
    font-size: 2rem;
    animation: float 4s ease-in-out infinite;
    pointer-events: none;
}

.bg-element.sun {
    top: 20px;
    right: 30px;
    font-size: 3rem;
    animation: sunRotate 10s linear infinite;
}

.bg-element.cloud {
    top: 30px;
    font-size: 2.5rem;
    animation: cloudMove 8s ease-in-out infinite;
}

.bg-element.flower {
    bottom: 20px;
    font-size: 1.5rem;
    animation: flowerSway 3s ease-in-out infinite;
}

.bg-element.grass {
    bottom: 10px;
    font-size: 1.2rem;
    animation: grassWave 2s ease-in-out infinite;
}

.bg-element.tree {
    bottom: 20px;
    font-size: 2.5rem;
    animation: treeSway 4s ease-in-out infinite;
}

.bg-element.butterfly {
    top: 50%;
    font-size: 1.5rem;
    animation: butterflyFly 6s ease-in-out infinite;
}

.bg-element.bird {
    top: 40%;
    font-size: 1.8rem;
    animation: birdFly 5s ease-in-out infinite;
}

/* 我的世界风格元素 */
.bg-element.block {
    font-size: 1.5rem;
    animation: blockBounce 2s ease-in-out infinite;
    border: 2px solid #8B4513;
    border-radius: 4px;
    background: rgba(255, 255, 255, 0.1);
    box-shadow: inset 0 0 5px rgba(0, 0, 0, 0.3);
}

.bg-element.diamond {
    font-size: 2rem;
    animation: diamondSparkle 3s ease-in-out infinite;
    border: 2px solid #4A90E2;
    border-radius: 4px;
    background: rgba(74, 144, 226, 0.2);
    box-shadow: 0 0 10px rgba(74, 144, 226, 0.5);
}

.bg-element.ore {
    font-size: 1.3rem;
    animation: oreGlow 2s ease-in-out infinite;
    border: 2px solid #666;
    border-radius: 4px;
    background: rgba(0, 0, 0, 0.3);
    box-shadow: inset 0 0 5px rgba(0, 0, 0, 0.5);
}

.bg-element.bedrock {
    font-size: 1.5rem;
    animation: none;
    border: 2px solid #333;
    border-radius: 4px;
    background: rgba(0, 0, 0, 0.8);
    box-shadow: inset 0 0 5px rgba(0, 0, 0, 0.9);
}

.bg-element.leaves {
    font-size: 1.4rem;
    animation: leavesRustle 3s ease-in-out infinite;
    border: 2px solid #228B22;
    border-radius: 4px;
    background: rgba(34, 139, 34, 0.3);
    box-shadow: inset 0 0 5px rgba(34, 139, 34, 0.5);
}

/* 背景切换按钮 */
.background-controls {
    display: flex;
    justify-content: center;
    gap: 10px;
    margin: 15px 0 0 0;
    flex-wrap: wrap;
}

.btn-bg {
    background: rgba(255, 255, 255, 0.9);
    border: 2px solid #f8bbd9;
    border-radius: 15px;
    padding: 8px 16px;
    font-size: 0.9rem;
    font-weight: bold;
    color: #e91e63;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 12px rgba(233, 30, 99, 0.2);
    min-width: 44px;
    min-height: 44px;
    touch-action: manipulation;
}

.btn-bg:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(233, 30, 99, 0.3);
    background: rgba(255, 255, 255, 1);
}

.btn-bg.active {
    background: linear-gradient(45deg, #e91e63, #f06292);
    color: white;
    border-color: #e91e63;
    box-shadow: 0 6px 16px rgba(233, 30, 99, 0.4);
}

@keyframes float {
    0%, 100% { transform: translateY(0px); }
    50% { transform: translateY(-10px); }
}

@keyframes sunRotate {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

@keyframes cloudMove {
    0%, 100% { transform: translateX(0px); }
    50% { transform: translateX(20px); }
}

@keyframes flowerSway {
    0%, 100% { transform: rotate(0deg); }
    25% { transform: rotate(5deg); }
    75% { transform: rotate(-5deg); }
}

@keyframes grassWave {
    0%, 100% { transform: scaleY(1); }
    50% { transform: scaleY(1.1); }
}

@keyframes treeSway {
    0%, 100% { transform: rotate(0deg); }
    25% { transform: rotate(2deg); }
    75% { transform: rotate(-2deg); }
}

@keyframes butterflyFly {
    0%, 100% { transform: translateX(0px) translateY(0px); }
    25% { transform: translateX(30px) translateY(-10px); }
    50% { transform: translateX(60px) translateY(0px); }
    75% { transform: translateX(30px) translateY(10px); }
}

@keyframes birdFly {
    0%, 100% { transform: translateX(0px) translateY(0px); }
    50% { transform: translateX(40px) translateY(-15px); }
}

@keyframes blockBounce {
    0%, 100% { transform: translateY(0px); }
    50% { transform: translateY(-5px); }
}

@keyframes diamondSparkle {
    0%, 100% { transform: scale(1) rotate(0deg); }
    50% { transform: scale(1.2) rotate(180deg); }
}

@keyframes oreGlow {
    0%, 100% { box-shadow: inset 0 0 5px rgba(0, 0, 0, 0.5), 0 0 5px rgba(255, 255, 255, 0.3); }
    50% { box-shadow: inset 0 0 5px rgba(0, 0, 0, 0.5), 0 0 15px rgba(255, 255, 255, 0.8); }
}

@keyframes leavesRustle {
    0%, 100% { transform: rotate(0deg) scale(1); }
    25% { transform: rotate(2deg) scale(1.05); }
    75% { transform: rotate(-2deg) scale(0.95); }
}

/* 童话解析弹窗样式 */
.modal {
    display: none;
    position: fixed;
    z-index: 2000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(5px);
}

.modal-content {
    background: linear-gradient(135deg, #ff9a9e 0%, #fecfef 100%);
    margin: 5% auto;
    padding: 0;
    border: 3px solid #f8bbd9;
    border-radius: 20px;
    width: 90%;
    max-width: 600px;
    box-shadow: 0 20px 40px rgba(233, 30, 99, 0.3);
    animation: modalSlideIn 0.3s ease-out;
}

@keyframes modalSlideIn {
    from {
        transform: translateY(-50px);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

.modal-header {
    background: linear-gradient(45deg, #e91e63, #f06292);
    color: white;
    padding: 20px;
    border-radius: 17px 17px 0 0;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-header h3 {
    margin: 0;
    font-size: 1.5rem;
    font-weight: bold;
}

.close-btn {
    background: none;
    border: none;
    color: white;
    font-size: 2rem;
    cursor: pointer;
    padding: 0;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: all 0.3s ease;
}

.close-btn:hover {
    background: rgba(255, 255, 255, 0.2);
    transform: scale(1.1);
}

.modal-body {
    padding: 30px;
    display: flex;
    gap: 20px;
    align-items: center;
}

.fairy-tale-story {
    flex: 2;
}

.fairy-tale-story p {
    font-size: 1.2rem;
    line-height: 1.8;
    color: #4a5568;
    margin: 0;
    text-align: justify;
}

.fairy-tale-illustration {
    flex: 1;
    text-align: center;
}

.fairy-tale-illustration div {
    font-size: 4rem;
    animation: fairyFloat 3s ease-in-out infinite;
}

@keyframes fairyFloat {
    0%, 100% { transform: translateY(0px) rotate(0deg); }
    50% { transform: translateY(-10px) rotate(5deg); }
}

.modal-footer {
    padding: 20px 30px;
    text-align: center;
    background: rgba(255, 255, 255, 0.5);
    border-radius: 0 0 17px 17px;
}

/* 用户名输入框样式 */
.username-selection {
    margin: 20px 0;
    text-align: center;
}

.username-selection h3 {
    color: #e91e63;
    margin-bottom: 10px;
    font-size: 1.2rem;
}

#username-input {
    width: 200px;
    height: 40px;
    padding: 0 15px;
    border: 2px solid #f8bbd9;
    border-radius: 20px;
    font-size: 1.1rem;
    text-align: center;
    background: rgba(255, 255, 255, 0.9);
    color: #e91e63;
    font-weight: bold;
    outline: none;
    transition: all 0.3s ease;
}

#username-input:focus {
    border-color: #e91e63;
    box-shadow: 0 0 10px rgba(233, 30, 99, 0.3);
    transform: scale(1.05);
}

#username-input::placeholder {
    color: #f8bbd9;
    font-weight: normal;
}

/* 头像上传样式 */
.avatar-upload {
    margin: 20px 0;
    text-align: center;
}

.avatar-upload h3 {
    color: #e91e63;
    margin-bottom: 15px;
    font-size: 1.2rem;
}

.avatar-preview {
    position: relative;
    width: 120px;
    height: 120px;
    margin: 0 auto 15px;
    border-radius: 50%;
    overflow: hidden;
    border: 3px solid #f8bbd9;
    background: rgba(255, 255, 255, 0.9);
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(233, 30, 99, 0.2);
}

.avatar-preview:hover {
    border-color: #e91e63;
    transform: scale(1.05);
    box-shadow: 0 6px 20px rgba(233, 30, 99, 0.3);
}

.avatar-preview img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 50%;
}

.avatar-placeholder {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100%;
    color: #e91e63;
    font-size: 2rem;
}

.avatar-placeholder p {
    margin: 5px 0 0 0;
    font-size: 0.9rem;
    color: #e91e63;
}

.avatar-buttons {
    display: flex;
    gap: 10px;
    justify-content: center;
    flex-wrap: wrap;
}

.btn-secondary {
    background: rgba(255, 255, 255, 0.9);
    color: #e91e63;
    border: 2px solid #f8bbd9;
    padding: 8px 16px;
    border-radius: 20px;
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: 0.9rem;
    font-weight: bold;
}

.btn-secondary:hover {
    background: #f8bbd9;
    border-color: #e91e63;
    transform: translateY(-2px);
    box-shadow: 0 4px 10px rgba(233, 30, 99, 0.2);
}

.btn-secondary:active {
    transform: translateY(0);
}

/* 下一题按钮样式 */
.next-btn {
    width: 120px;
    height: 50px;
    font-size: 1.1rem;
    font-weight: bold;
    animation: buttonPulse 2s ease-in-out infinite;
    margin: 0;
    order: 3; /* 确保按钮在答案按钮之后显示 */
}

.next-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 16px rgba(233, 30, 99, 0.3);
}

@keyframes buttonPulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.05); }
}

@keyframes fadeInOut {
    0% { 
        opacity: 0; 
        transform: translate(-50%, -50%) scale(0.8); 
    }
    20% { 
        opacity: 1; 
        transform: translate(-50%, -50%) scale(1); 
    }
    80% { 
        opacity: 1; 
        transform: translate(-50%, -50%) scale(1); 
    }
    100% { 
        opacity: 0; 
        transform: translate(-50%, -50%) scale(0.8); 
    }
}

.characters-container {
    position: absolute;
    width: 100%;
    height: 100%;
    top: 0;
    left: 0;
}

.player {
    position: absolute;
    bottom: 20px;
    left: 50px;
    font-size: 4rem;
    animation: bounce 2s infinite;
    z-index: 10;
}

.monster {
    position: absolute;
    bottom: 20px;
    right: 50px;
    font-size: 4rem;
    animation: shake 1s infinite;
    z-index: 10;
}

.weapon {
    position: absolute;
    bottom: 40px;
    left: 100px;
    font-size: 2rem;
    opacity: 0;
    transition: all 0.3s ease;
    z-index: 5;
}

.weapon.active {
    opacity: 1;
    animation: shoot 0.5s ease-out;
}

@keyframes bounce {
    0%, 100% { transform: translateY(0px); }
    50% { transform: translateY(-20px); }
}

@keyframes shake {
    0%, 100% { transform: translateX(0px); }
    25% { transform: translateX(-5px); }
    75% { transform: translateX(5px); }
}

@keyframes shoot {
    0% { transform: translateX(0px) scale(1); }
    50% { transform: translateX(200px) scale(1.2); }
    100% { transform: translateX(400px) scale(0.8); }
}

/* 数学题区域 */
.math-question {
    background: rgba(255, 255, 255, 0.95);
    border-radius: 15px;
    padding: 30px;
    text-align: center;
    margin-bottom: 20px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
    backdrop-filter: blur(10px);
}

.math-question h3 {
    color: #4a5568;
    font-size: 1.5rem;
    margin-bottom: 20px;
}

.question-container {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 15px;
    margin-bottom: 20px;
    font-size: 2rem;
    font-weight: bold;
    color: #2d3748;
}

.question-container span {
    background: linear-gradient(45deg, #667eea, #764ba2);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

/* 答案选项样式 */
.answer-options {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 20px;
    margin: 20px 0;
    flex-wrap: wrap;
}

.answer-btn {
    width: 100px;
    height: 70px;
    min-width: 44px;
    min-height: 44px;
    font-size: 1.8rem;
    font-weight: bold;
    background: linear-gradient(45deg, #ff6b6b, #ff8e8e);
    color: white;
    border: 3px solid #ff4757;
    border-radius: 15px;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 8px 16px rgba(255, 107, 107, 0.3);
    position: relative;
    overflow: hidden;
    touch-action: manipulation;
}

.answer-btn::before {
    content: '🎯';
    position: absolute;
    top: 5px;
    right: 5px;
    font-size: 1rem;
    opacity: 0.7;
}

.answer-btn::after {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.4), transparent);
    transition: left 0.5s ease;
}

.answer-btn:hover::after {
    left: 100%;
}

.answer-btn:hover {
    transform: translateY(-3px);
    box-shadow: 0 12px 24px rgba(0, 0, 0, 0.3);
}

.answer-btn:active {
    transform: scale(0.95);
}

.answer-btn.correct {
    background: linear-gradient(45deg, #4caf50, #8bc34a);
    color: white;
    animation: correctAnswer 0.5s ease;
    box-shadow: 0 8px 16px rgba(76, 175, 80, 0.4);
}

.answer-btn.wrong {
    background: linear-gradient(45deg, #f44336, #e57373);
    color: white;
    animation: wrongAnswer 0.5s ease;
    box-shadow: 0 8px 16px rgba(244, 67, 54, 0.4);
}

.question-info {
    margin-top: 15px;
    text-align: center;
}

.question-info p {
    color: #4a5568;
    font-size: 1.1rem;
    font-weight: bold;
}

#animal-name {
    color: #667eea;
    font-size: 1.2rem;
}

/* 动物小屋样式 */
.animal-cage {
    background: rgba(255, 255, 255, 0.95);
    border-radius: 15px;
    padding: 20px;
    margin-bottom: 20px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
    backdrop-filter: blur(10px);
}

.animal-cage h3 {
    color: #4a5568;
    text-align: center;
    margin-bottom: 20px;
    font-size: 1.5rem;
}

.cage-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(80px, 1fr));
    gap: 15px;
    min-height: 100px;
}

.cage-slot {
    background: linear-gradient(45deg, #e2e8f0, #cbd5e0);
    border: 3px dashed #a0aec0;
    border-radius: 10px;
    height: 80px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2rem;
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}

.cage-slot::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(45deg, transparent, rgba(255, 255, 255, 0.3), transparent);
    transform: translateX(-100%);
    transition: transform 0.6s ease;
}

.cage-slot.captured::before {
    transform: translateX(100%);
}

.cage-slot:hover {
    transform: scale(1.05);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

.cage-empty {
    background: linear-gradient(45deg, #f7fafc, #edf2f7);
    border: 2px dashed #cbd5e0;
    border-radius: 10px;
    height: 80px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #a0aec0;
    font-size: 1rem;
    font-weight: bold;
}

.animal-captured {
    animation: animalCapture 1s ease-out;
}

@keyframes animalCapture {
    0% {
        transform: scale(0) rotate(0deg);
        opacity: 0;
    }
    50% {
        transform: scale(1.2) rotate(180deg);
        opacity: 1;
    }
    100% {
        transform: scale(1) rotate(360deg);
        opacity: 1;
    }
}

/* 奖励收集样式 */
.rewards-collection {
    background: rgba(255, 255, 255, 0.95);
    border-radius: 15px;
    padding: 20px;
    margin-bottom: 20px;
    box-shadow: 0 8px 32px rgba(233, 30, 99, 0.1);
    backdrop-filter: blur(10px);
    border: 2px solid #f8bbd9;
}

.rewards-collection h3 {
    color: #e91e63;
    text-align: center;
    margin-bottom: 20px;
    font-size: 1.5rem;
}

.rewards-container {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
}

.reward-section h4 {
    color: #e91e63;
    text-align: center;
    margin-bottom: 15px;
    font-size: 1.2rem;
}

.reward-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(50px, 1fr));
    gap: 10px;
    min-height: 60px;
}

.reward-item {
    background: linear-gradient(45deg, #ff9a9e, #fecfef);
    border: 2px solid #f8bbd9;
    border-radius: 10px;
    height: 50px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}

.reward-item::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(45deg, transparent, rgba(255, 255, 255, 0.5), transparent);
    transform: translateX(-100%);
    transition: transform 0.6s ease;
}

.reward-item.new::before {
    transform: translateX(100%);
}

.reward-item:hover {
    transform: scale(1.1);
    box-shadow: 0 4px 12px rgba(233, 30, 99, 0.3);
}

.reward-empty {
    background: linear-gradient(45deg, #f7f7f7, #e8e8e8);
    border: 2px dashed #d0d0d0;
    border-radius: 10px;
    height: 50px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #a0a0a0;
    font-size: 0.9rem;
    font-weight: bold;
}

.reward-animation {
    animation: rewardPop 0.8s ease-out;
}

@keyframes rewardPop {
    0% {
        transform: scale(0) rotate(0deg);
        opacity: 0;
    }
    50% {
        transform: scale(1.3) rotate(180deg);
        opacity: 1;
    }
    100% {
        transform: scale(1) rotate(360deg);
        opacity: 1;
    }
}

/* 游戏状态 */
.game-status {
    background: rgba(255, 255, 255, 0.95);
    border-radius: 15px;
    padding: 20px;
    text-align: center;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
    backdrop-filter: blur(10px);
}

.progress-bar {
    width: 100%;
    height: 20px;
    background: #e2e8f0;
    border-radius: 10px;
    overflow: hidden;
    margin-bottom: 15px;
}

.progress {
    height: 100%;
    background: linear-gradient(45deg, #ff6b6b, #4ecdc4);
    width: 0%;
    transition: width 0.5s ease;
    border-radius: 10px;
}

#status-message {
    color: #4a5568;
    font-size: 1.1rem;
    font-weight: bold;
}

/* 游戏结束界面 */
.end-content {
    background: rgba(255, 255, 255, 0.95);
    border-radius: 20px;
    padding: 40px;
    text-align: center;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.1);
    backdrop-filter: blur(10px);
}

.end-content h2 {
    color: #4a5568;
    font-size: 2.5rem;
    margin-bottom: 20px;
}

.end-content p {
    color: #718096;
    font-size: 1.2rem;
    margin-bottom: 30px;
}

.final-stats {
    background: linear-gradient(45deg, #667eea, #764ba2);
    color: white;
    padding: 20px;
    border-radius: 15px;
    margin-bottom: 30px;
}

.final-stats p {
    color: white;
    font-size: 1.3rem;
    margin-bottom: 10px;
}

/* 音效控制 */
.audio-controls {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 1000;
    display: flex;
    flex-direction: column;
    gap: 10px;
    align-items: flex-end;
}

.btn-audio {
    background: rgba(255, 255, 255, 0.9);
    border: none;
    border-radius: 50%;
    width: 50px;
    height: 50px;
    font-size: 1.5rem;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
    display: flex;
    align-items: center;
    justify-content: center;
}

.btn-audio:hover {
    transform: scale(1.1);
    background: rgba(255, 255, 255, 1);
}

/* 协议状态显示 */
.protocol-status {
    background: rgba(0, 0, 0, 0.8);
    color: white;
    padding: 8px 12px;
    border-radius: 20px;
    font-size: 0.8rem;
    font-weight: bold;
    text-align: center;
    min-width: 120px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.3);
    transition: all 0.3s ease;
}

.protocol-status.secure {
    background: rgba(76, 175, 80, 0.9);
    border: 2px solid rgba(76, 175, 80, 0.5);
}

.protocol-status.insecure {
    background: rgba(255, 152, 0, 0.9);
    border: 2px solid rgba(255, 152, 0, 0.5);
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0% { transform: scale(1); }
    50% { transform: scale(1.05); }
    100% { transform: scale(1); }
}

/* 触屏优化 */
* {
    -webkit-tap-highlight-color: transparent;
    -webkit-touch-callout: none;
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
    user-select: none;
}

input, textarea {
    -webkit-user-select: text;
    -moz-user-select: text;
    -ms-user-select: text;
    user-select: text;
}

/* 触屏反馈 */
.answer-btn:active, .btn-primary:active, .character-btn:active, .btn-bg:active {
    transform: scale(0.95);
    transition: transform 0.1s ease;
}

/* 防止双击缩放 */
button, .answer-btn, .btn-primary, .character-btn, .btn-bg {
    touch-action: manipulation;
    -webkit-touch-callout: none;
    -webkit-user-select: none;
    -khtml-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
    user-select: none;
}

/* 响应式设计 */
@media (max-width: 768px) {
    .game-container {
        padding: 8px;
        min-height: 100vh;
        min-height: 100dvh; /* 动态视口高度 */
    }
    
    .game-header {
        padding: 10px 15px;
        margin-bottom: 10px;
    }
    
    .game-header h1 {
        font-size: 1.5rem;
        margin-bottom: 8px;
        line-height: 1.2;
    }
    
    .mobile-title {
        font-size: 1.5rem;
        margin-bottom: 8px;
        line-height: 1.2;
    }
    
    .score-board {
        font-size: 0.9rem;
        flex-direction: row;
        justify-content: space-around;
        gap: 5px;
        flex-wrap: wrap;
    }
    
    .score-board span {
        padding: 2px 6px;
        background: rgba(233, 30, 99, 0.1);
        border-radius: 10px;
        white-space: nowrap;
    }
}

/* 超小屏幕优化 */
@media (max-width: 480px) {
    .game-header {
        padding: 8px 10px;
        margin-bottom: 8px;
    }
    
    .game-header h1 {
        font-size: 1.3rem;
        margin-bottom: 6px;
    }
    
    .mobile-title {
        font-size: 1.3rem;
        margin-bottom: 6px;
    }
    
    .score-board {
        font-size: 0.8rem;
        gap: 3px;
    }
    
    .score-board span {
        padding: 1px 4px;
        font-size: 0.75rem;
    }
    
    .characters {
        flex-direction: column;
        align-items: center;
    }
    
    .answer-options {
        flex-direction: row;
        align-items: center;
        justify-content: center;
        gap: 10px;
        flex-wrap: wrap;
    }
    
    .answer-btn {
        width: 70px;
        height: 50px;
        min-width: 44px;
        min-height: 44px;
        font-size: 1.3rem;
        touch-action: manipulation;
    }
    
    .question-container {
        font-size: 1.5rem;
        flex-wrap: wrap;
        padding: 10px;
    }
    
    .player, .monster {
        font-size: 3rem;
    }
    
    .house, .tank, .trees {
        font-size: 2rem;
    }
    
    .game-world {
        min-height: 200px;
        padding: 15px;
    }
    
    .question-info {
        font-size: 0.9rem;
        margin: 10px 0;
    }
    
    .answer-options {
        flex-direction: row;
        align-items: center;
        justify-content: center;
        gap: 15px;
        flex-wrap: wrap;
    }
    
    .answer-btn {
        width: 80px;
        height: 60px;
        min-width: 44px;
        min-height: 44px;
        font-size: 1.5rem;
        touch-action: manipulation;
    }
    
    .next-btn {
        width: 100px;
        height: 45px;
        font-size: 1rem;
        order: 3;
        min-width: 44px;
        min-height: 44px;
        touch-action: manipulation;
    }
    
    /* 动物小屋和奖励区域优化 */
    .animal-cage, .rewards-collection {
        margin: 10px 0;
        padding: 10px;
    }
    
    .cage-grid, .reward-grid {
        gap: 8px;
    }
    
    .cage-slot, .reward-item {
        width: 40px;
        height: 40px;
        font-size: 1.2rem;
    }
    
    /* 背景控制按钮优化 */
    .background-controls {
        margin: 10px 0 0 0;
        gap: 8px;
    }
    
    .btn-bg {
        padding: 6px 12px;
        font-size: 0.8rem;
        min-width: 44px;
        min-height: 44px;
        touch-action: manipulation;
    }
    
    /* 移动端头像上传优化 */
    .avatar-upload {
        margin: 15px 0;
    }
    
    .avatar-preview {
        width: 100px;
        height: 100px;
        margin: 0 auto 10px;
    }
    
    .avatar-buttons {
        flex-direction: column;
        gap: 8px;
    }
    
    .btn-secondary {
        padding: 10px 20px;
        font-size: 0.9rem;
        min-width: 44px;
        min-height: 44px;
        touch-action: manipulation;
    }
}

/* 动画效果 */
@keyframes correctAnswer {
    0% { transform: scale(1); }
    50% { transform: scale(1.2); }
    100% { transform: scale(1); }
}

@keyframes wrongAnswer {
    0% { transform: translateX(0px); }
    25% { transform: translateX(-10px); }
    75% { transform: translateX(10px); }
    100% { transform: translateX(0px); }
}

.correct {
    animation: correctAnswer 0.5s ease;
}

.wrong {
    animation: wrongAnswer 0.5s ease;
}

/* 粒子效果 */
.particle {
    position: absolute;
    width: 10px;
    height: 10px;
    background: #ff6b6b;
    border-radius: 50%;
    pointer-events: none;
    animation: particle 1s ease-out forwards;
}

@keyframes particle {
    0% {
        opacity: 1;
        transform: scale(1);
    }
    100% {
        opacity: 0;
        transform: scale(0) translateY(-100px);
    }
}
