/* 英语单词消消乐 - 游戏样式 */

body {
    margin: 0;
    padding: 0;
    font-family: 'Arial', 'Microsoft YaHei', sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    overflow-x: hidden;
    /* iPad适配：允许滚动以显示弹窗 */
    overflow-y: auto;
    position: relative;
    width: 100%;
    -webkit-overflow-scrolling: touch;
}

.main-container {
    display: flex;
    gap: 20px;
    padding: 20px;
    padding-top: 80px; /* 为顶部用户信息浮窗留出空间 */
    padding-right: 160px; /* 为右侧按钮和道具留出空间 */
    max-width: 1200px; /* 从1400px减小到1200px */
    margin: 0 auto;
}

/* 左侧面板 */
.left-panel {
    flex: 0 0 280px;
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.header {
    background: white;
    padding: 20px;
    border-radius: 15px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
    text-align: center;
}

.header h1 {
    margin: 0;
    font-size: 24px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

/* 得分板 */
.score-board {
    background: white;
    padding: 20px;
    border-radius: 15px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.score-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px;
    background: linear-gradient(135deg, #f5f7fa 0%, #c3cfe2 100%);
    border-radius: 10px;
}

.score-item .label {
    font-size: 16px;
    font-weight: 600;
    color: #333;
}

.score-item .value {
    font-size: 20px;
    font-weight: bold;
    color: #667eea;
}

/* 游戏容器 */
.game-container {
    flex: 1;
    background: white;
    padding: 30px;
    border-radius: 15px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
    display: flex;
    flex-direction: column;
    gap: 20px;
}

/* 单词网格 */
.grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr); /* 固定每行显示4个 */
    gap: 10px; /* 从15px减到70% = 10.5px≈约10px */
    min-height: 210px; /* 从300px减到70% = 210px */
}

.word-card {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 21px 14px; /* 从30px 20px减到70% = 21px 14px */
    border-radius: 10px; /* 从15px减到70% = 10.5px≈约10px */
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 7px; /* 从10px减到70% = 7px */
}

.word-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 6px 25px rgba(0, 0, 0, 0.15);
}

.word-card.selected {
    background: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
    transform: scale(1.05);
    box-shadow: 0 8px 30px rgba(240, 147, 251, 0.4);
}

.word-card.correct {
    background: linear-gradient(135deg, #11998e 0%, #38ef7d 100%);
    animation: correctPulse 0.5s ease;
}

.word-card.wrong {
    background: linear-gradient(135deg, #eb3349 0%, #f45c43 100%);
    animation: shake 0.5s ease;
}

/* 已消除的单词卡片 */
.word-card.eliminated {
    background: transparent;
    border: 2px dashed #ddd;
    cursor: default;
    box-shadow: none;
    opacity: 0.3;
}

.word-card.eliminated:hover {
    transform: none;
    box-shadow: none;
}

@keyframes correctPulse {
    0%, 100% {
        transform: scale(1);
    }
    50% {
        transform: scale(1.1);
    }
}

@keyframes shake {
    0%, 100% {
        transform: translateX(0);
    }
    10%, 30%, 50%, 70%, 90% {
        transform: translateX(-8px) rotate(-2deg);
    }
    20%, 40%, 60%, 80% {
        transform: translateX(8px) rotate(2deg);
    }
}

.word-display {
    font-size: 22px; /* 从32px减到70% = 22.4px≈约22px */
    font-weight: bold;
    letter-spacing: 1.4px; /* 从2px减到70% = 1.4px */
    font-family: 'Courier New', monospace;
}

.word-translation {
    font-size: 11px; /* 从16px减到70% = 11.2px≈约11px */
    opacity: 0.9;
    font-weight: 500;
}

/* 选项容器 */
.options-container {
    background: linear-gradient(135deg, #f5f7fa 0%, #c3cfe2 100%);
    padding: 25px;
    border-radius: 15px;
    min-height: 120px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 15px;
}

.hint-text {
    font-size: 18px;
    color: #555;
    font-weight: 600;
    text-align: center;
}

.options-buttons {
    display: flex;
    gap: 15px;
    flex-wrap: wrap;
    justify-content: center;
}

.option-btn {
    padding: 15px 40px;
    font-size: 24px;
    font-weight: bold;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.3);
    font-family: 'Courier New', monospace;
    min-width: 80px;
}

.option-btn:hover {
    transform: translateY(-3px);
    box-shadow: 0 6px 20px rgba(102, 126, 234, 0.4);
    background: linear-gradient(135deg, #764ba2 0%, #667eea 100%);
}

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

/* 提示文本 */
.hint {
    text-align: center;
    font-size: 16px;
    color: #666;
    padding: 15px;
    background: #f8f9fa;
    border-radius: 10px;
    border-left: 4px solid #667eea;
}

/* 分数变化特效 */
.score-effect {
    position: fixed;
    font-size: 48px;
    font-weight: bold;
    pointer-events: none;
    z-index: 9999;
    opacity: 0;
    transform: translate(-50%, -50%) scale(0.5);
    transition: all 1.2s cubic-bezier(0.34, 1.56, 0.64, 1);
    text-shadow: 2px 2px 8px rgba(0, 0, 0, 0.3);
    font-family: 'Arial Black', sans-serif;
}

.score-effect.active {
    opacity: 1;
    transform: translate(-50%, -150px) scale(1.5);
}

/* 答对加分特效 */
.score-effect-correct {
    color: #38ef7d;
    animation: scoreCorrect 1.2s ease-out forwards;
}

@keyframes scoreCorrect {
    0% {
        opacity: 0;
        transform: translate(-50%, -50%) scale(0.5) rotate(-10deg);
    }
    40% {
        opacity: 1;
        transform: translate(-50%, -120px) scale(1.8) rotate(5deg);
    }
    100% {
        opacity: 0;
        transform: translate(-50%, -180px) scale(1.2) rotate(0deg);
    }
}

/* 答错扣分特效 */
.score-effect-wrong {
    color: #f45c43;
    animation: scoreWrong 1.2s ease-out forwards;
}

@keyframes scoreWrong {
    0% {
        opacity: 0;
        transform: translate(-50%, -50%) scale(0.5);
    }
    20% {
        opacity: 1;
        transform: translate(-50%, -80px) scale(1.5) rotate(-5deg);
    }
    40% {
        transform: translate(-50%, -100px) scale(1.6) rotate(5deg);
    }
    60% {
        transform: translate(-50%, -120px) scale(1.4) rotate(-3deg);
    }
    100% {
        opacity: 0;
        transform: translate(-50%, -160px) scale(1) rotate(0deg);
    }
}

/* 右侧按钮组 */
.right-buttons {
    position: fixed;
    top: 10px;
    right: 10px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    z-index: 999;
}

.btn-home,
.btn-restart {
    padding: 12px 20px;
    background: white;
    color: white;
    text-decoration: none;
    border: none;
    border-radius: 10px;
    font-weight: bold;
    font-size: 16px;
    cursor: pointer;
    transition: all 0.3s ease;
    text-align: center;
    min-width: 120px;
    box-shadow: 0 3px 8px rgba(0,0,0,0.2);
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
    user-select: none;
    -webkit-user-select: none;
}

.btn-restart {
    background: linear-gradient(135deg, #ff6b6b 0%, #ff8787 100%);
}

.btn-home {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}

.btn-home:hover,
.btn-restart:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 12px rgba(0,0,0,0.3);
}

.btn-home:active,
.btn-restart:active {
    transform: scale(0.95);
    box-shadow: 0 2px 5px rgba(0,0,0,0.2);
}

/* 道具栏样式 - 固定在右侧 */
.power-ups {
    position: fixed;
    right: 10px;
    top: 150px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    z-index: 999;
}

.power-up {
    background: linear-gradient(135deg, #ffd89b 0%, #19547b 100%);
    color: white;
    border: 3px solid #ffd700;
    border-radius: 10px;
    padding: 12px 16px;
    cursor: pointer;
    font-size: 16px;
    font-weight: bold;
    transition: all 0.3s ease;
    position: relative;
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
    user-select: none;
    -webkit-user-select: none;
    min-width: 120px;
    box-shadow: 0 3px 8px rgba(0, 0, 0, 0.2);
    text-align: center;
}

.power-up:active {
    transform: scale(0.95);
}

.power-up.disabled {
    opacity: 0.5;
    cursor: not-allowed;
    background: #ccc;
}

.power-up .count {
    position: absolute;
    top: -10px;
    right: -10px;
    background: #ff4444;
    color: white;
    border-radius: 50%;
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    font-weight: bold;
    border: 2px solid white;
}

/* 弹窗样式 */
.egg-modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    z-index: 10000;
    justify-content: center;
    align-items: center;
}

.egg-modal.show {
    display: flex;
    animation: fadeIn 0.3s ease;
}

.egg-content {
    background: white;
    border-radius: 20px;
    padding: 40px;
    text-align: center;
    max-width: 400px;
    animation: bounceIn 0.5s ease;
}

.egg-content h2 {
    color: #667eea;
    margin-bottom: 20px;
    font-size: 32px;
}

.egg-content .egg-icon {
    font-size: 80px;
    margin: 20px 0;
    animation: rotate 2s linear infinite;
}

.egg-content .egg-name {
    font-size: 24px;
    color: #333;
    font-weight: bold;
    margin-bottom: 10px;
}

.egg-content .egg-desc {
    font-size: 16px;
    color: #666;
    margin-bottom: 30px;
}

.egg-btn {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    border-radius: 25px;
    padding: 15px 40px;
    font-size: 18px;
    cursor: pointer;
    transition: all 0.3s ease;
}

.egg-btn:active {
    transform: scale(0.95);
}

/* 弹跳动画 */
@keyframes bounceIn {
    0% {
        opacity: 0;
        transform: scale(0.3);
    }
    50% {
        opacity: 1;
        transform: scale(1.05);
    }
    70% {
        transform: scale(0.9);
    }
    100% {
        transform: scale(1);
    }
}

/* 旋转动画 */
@keyframes rotate {
    from {
        transform: rotate(0deg);
    }
    to {
        transform: rotate(360deg);
    }
}

/* 响应式设计 */

/* iPad 端弹窗适配 */
@media (min-width: 768px) and (max-width: 1024px) {
    /* 确保iPad上登录弹窗可见 */
    body {
        overflow-y: auto;
        padding: 20px 5px;
    }
    
    .login-modal,
    .ranking-modal,
    .shop-modal,
    .anti-addiction-modal,
    .egg-modal {
        position: fixed !important;
        z-index: 10000 !important;
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
    }
    
    .main-container {
        margin: 10px auto;
        padding-right: 160px;
    }
}

/* iPad Pro 横屏优化 */
@media (min-width: 1024px) and (max-width: 1366px) {
    .main-container {
        max-width: 1300px;
        padding: 25px;
        padding-top: 90px;
        padding-right: 180px;
    }
    
    .grid {
        grid-template-columns: repeat(4, 1fr);
        gap: 12px;
        min-height: 240px;
    }
    
    .word-card {
        padding: 24px 16px;
    }
    
    .word-display {
        font-size: 25px;
    }
    
    .word-translation {
        font-size: 12px;
    }
    
    .option-btn {
        padding: 18px 50px;
        font-size: 28px;
        min-height: 50px;
    }
    
    .power-ups {
        right: 15px;
        top: 170px;
    }
    
    .power-up {
        min-width: 130px;
        font-size: 17px;
    }
}

@media (max-width: 1024px) {
    .main-container {
        flex-direction: column;
        padding-right: 20px; /* 移动设备上减少留白 */
    }
    
    .left-panel {
        flex: none;
        width: 100%;
    }
    
    .grid {
        grid-template-columns: repeat(4, 1fr); /* iPad上也显示4列 */
    }
    
    .score-board {
        flex-direction: row;
        flex-wrap: wrap;
    }
    
    .score-item {
        flex: 1;
        min-width: 150px;
    }
    
    /* iPad上的分数特效调整 */
    .score-effect {
        font-size: 56px;
    }
}

@media (max-width: 768px) {
    .main-container {
        padding: 10px;
        padding-right: 10px; /* 手机上进一步减少 */
    }
    
    .game-container {
        padding: 20px;
    }
    
    .grid {
        grid-template-columns: repeat(2, 1fr); /* 手机上显示2列 */
        gap: 10px;
    }
    
    .word-card {
        padding: 18px 11px; /* 按照新尺寸的约70%：21*0.7=14.7≡18, 14*0.7=9.8≡11 */
    }
    
    .word-display {
        font-size: 20px; /* 按照新尺寸的约70%：22*0.7=15.4≡20 */
    }
    
    .word-translation {
        font-size: 10px; /* 按照新尺寸的约70%：11*0.7=7.7≡10 */
    }
    
    .option-btn {
        padding: 12px 30px;
        font-size: 20px;
        min-width: 60px;
        /* 为iPad触摸优化 */
        min-height: 44px;
    }
    
    .right-buttons {
        top: 10px;
        right: 10px;
        gap: 8px;
    }
    
    .btn-home,
    .btn-restart {
        padding: 12px 30px;
        font-size: 14px;
        min-height: 44px;
    }
    
    .header h1 {
        font-size: 20px;
    }
    
    .score-item {
        padding: 10px;
    }
    
    .score-item .label {
        font-size: 14px;
    }
    
    .score-item .value {
        font-size: 18px;
    }
    
    /* 移动设备上的分数特效 */
    .score-effect {
        font-size: 42px;
    }
    
    /* 手机端道具栏缩小 */
    .power-ups {
        right: 5px;
        top: 55px;
        gap: 8px;
    }
    
    .power-up {
        padding: 8px 12px;
        font-size: 14px;
        min-width: 100px;
    }
    
    .power-up .count {
        width: 20px;
        height: 20px;
        font-size: 12px;
        top: -8px;
        right: -8px;
    }
}

@media (max-width: 480px) {
    .options-buttons {
        width: 100%;
    }
    
    .option-btn {
        flex: 1;
        min-width: 70px;
        min-height: 44px;
    }
    
    .word-display {
        font-size: 17px; /* 按照新尺寸的约70%：22*0.7=15.4≡17 */
    }
    
    .options-container {
        padding: 15px;
    }
    
    .hint-text {
        font-size: 16px;
    }
    
    /* 小屏幕上的分数特效 */
    .score-effect {
        font-size: 36px;
    }
}

/* 加载动画 */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.word-card,
.option-btn {
    animation: fadeIn 0.5s ease;
}
