/* 成语填词消消乐 - 样式文件 */

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

body {
    font-family: 'Arial', sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 20px;
    /* iPad适配：允许滚动以显示弹窗 */
    overflow: auto;
    position: relative;
    width: 100%;
    -webkit-overflow-scrolling: touch;
}

.main-container {
    display: flex;
    gap: 30px;
    align-items: flex-start;
    max-width: 1200px;
}

.left-panel {
    display: flex;
    flex-direction: column;
    gap: 20px;
    min-width: 200px;
}

.header {
    color: white;
    text-align: center;
    background: rgba(255,255,255,0.1);
    padding: 20px;
    border-radius: 15px;
    backdrop-filter: blur(10px);
}

.header h1 {
    font-size: 28px;
    margin-bottom: 0;
    text-shadow: 2px 2px 4px rgba(0,0,0,0.3);
}

.score-board {
    display: flex;
    flex-direction: column;
    gap: 15px;
    color: white;
}

.score-item {
    background: rgba(255,255,255,0.2);
    padding: 15px 20px;
    border-radius: 10px;
    backdrop-filter: blur(10px);
    text-align: center;
    font-size: 18px;
}

.score-item .label {
    display: block;
    font-size: 14px;
    opacity: 0.9;
    margin-bottom: 5px;
}

.score-item .value {
    display: block;
    font-size: 32px;
    font-weight: bold;
}

.game-container {
    background: rgba(255,255,255,0.95);
    border-radius: 20px;
    padding: 30px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.3);
    max-width: 650px;
    width: fit-content;
    min-height: 600px;
    display: flex;
    flex-direction: column;
    margin: 0 auto;
}

.grid {
    display: grid;
    grid-template-columns: repeat(6, 81px);
    grid-template-rows: repeat(5, 81px);
    gap: 9px;
    margin-bottom: 30px;
}

.cell {
    background: linear-gradient(145deg, #f0f0f0, #ffffff);
    border: 2px solid #ddd;
    border-radius: 9px;
    display: grid;
    grid-template-columns: 1fr 1fr;
    grid-template-rows: 1fr 1fr;
    gap: 3px;
    padding: 4.5px;
    font-size: 18px;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.2s ease;
    box-shadow: 2px 2px 5px rgba(0,0,0,0.1);
    width: 81px;
    height: 81px;
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
}

.cell:hover {
    background: linear-gradient(145deg, #e8e8e8, #f8f8f8);
}

.cell:active {
    transform: scale(0.95);
    box-shadow: 1px 1px 3px rgba(0,0,0,0.1);
}

.cell.selected {
    background: linear-gradient(145deg, #ffd700, #ffed4e);
    border-color: #ff6b6b;
}

.cell.correct {
    animation: correctAnim 0.5s ease;
    background: linear-gradient(145deg, #51cf66, #8ce99a);
}

.cell.wrong {
    animation: wrongAnim 0.5s ease;
}

.cell.eliminating {
    animation: eliminate 0.6s ease forwards;
}

.char {
    font-size: 20px;
    color: #333;
    display: flex;
    align-items: center;
    justify-content: center;
    user-select: none;
    -webkit-user-select: none;
}

.blank {
    border: 2px dashed #999;
    border-radius: 4.5px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    color: #ff6b6b;
    background: rgba(255, 107, 107, 0.1);
    user-select: none;
    -webkit-user-select: none;
}

.options-container {
    display: flex;
    justify-content: center;
    gap: 20px;
    margin-top: 20px;
    min-height: 90px;
    align-items: center;
}

.option {
    background: linear-gradient(145deg, #4c6ef5, #748ffc);
    color: white;
    border: none;
    border-radius: 15px;
    padding: 18px 40px;
    font-size: 28px;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.2s ease;
    box-shadow: 0 4px 10px rgba(0,0,0,0.2);
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
    user-select: none;
    -webkit-user-select: none;
    min-width: 80px;
    min-height: 70px;
}

.option:hover {
    transform: translateY(-3px);
    box-shadow: 0 6px 15px rgba(0,0,0,0.3);
    background: linear-gradient(145deg, #5c7cfa, #91a7ff);
}

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

.hint {
    text-align: center;
    color: #666;
    font-size: 16px;
    margin-top: 15px;
    height: 24px;
    line-height: 24px;
}

@keyframes correctAnim {
    0%, 100% { 
        background: linear-gradient(145deg, #51cf66, #8ce99a);
    }
    50% { 
        background: linear-gradient(145deg, #69db7c, #a3e9b4);
    }
}

@keyframes wrongAnim {
    0%, 100% { 
        border-color: #ddd;
    }
    25%, 75% { 
        border-color: #ff6b6b;
    }
}

@keyframes eliminate {
    0% { 
        transform: scale(1) rotate(0deg);
        opacity: 1;
    }
    50% {
        transform: scale(1.3) rotate(180deg);
        opacity: 0.5;
    }
    100% { 
        transform: scale(0) rotate(360deg);
        opacity: 0;
    }
}

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

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

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

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

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

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

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

.button-group {
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0;
}

/* 道具栏样式 - 固定在右侧 */
.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;
}

/* iPad 端弹窗适配 */
@media (min-width: 768px) and (max-width: 1024px) {
    /* 确保iPad上登录弹窗可见 */
    body {
        display: block !important; /* 移除flex布局，确保弹窗可见 */
        overflow-y: auto;
        position: relative;
        min-height: 100vh;
        padding: 20px 5px; /* 上下增加内边距 */
    }
    
    .login-modal,
    .ranking-modal,
    .shop-modal,
    .anti-addiction-modal {
        position: fixed !important;
        z-index: 10000 !important;
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
    }
    
    .main-container {
        margin: 10px auto;
        flex-direction: column;
        align-items: center;
    }
}

/* iPad Pro 横屏和大屏幕平板优化 */
@media (min-width: 1024px) and (max-width: 1366px) {
    .game-container {
        max-width: 700px;
        padding: 35px;
        min-height: 650px;
    }
    
    .grid {
        grid-template-columns: repeat(6, 90px);
        grid-template-rows: repeat(5, 90px);
        gap: 10.8px;
    }
    
    .cell {
        width: 90px;
        height: 90px;
        padding: 5.4px;
    }
    
    .char {
        font-size: 23.4px;
    }
    
    .blank {
        font-size: 21.6px;
    }
    
    .option {
        padding: 22px 50px;
        font-size: 32px;
        min-width: 90px;
        min-height: 80px;
    }
    
    .options-container {
        min-height: 100px;
    }
}

/* iPad 竖屏和中等屏幕优化 */
@media (min-width: 768px) and (max-width: 1023px) {
    .main-container {
        flex-direction: column;
        align-items: center;
    }

    .left-panel {
        width: 100%;
        max-width: 600px;
    }

    .score-board {
        flex-direction: row;
    }

    .header h1 {
        font-size: 28px;
    }
    
    .game-container {
        width: 100%;
        max-width: 600px;
        padding: 25px;
        min-height: 550px;
    }
    
    .grid {
        width: 100%;
        grid-template-columns: repeat(6, 1fr);
        grid-template-rows: repeat(5, 1fr);
        gap: 7.2px;
    }
    
    .cell {
        width: 100%;
        height: 100%;
        aspect-ratio: 1;
        padding: 3.6px;
    }
    
    .char {
        font-size: 18px;
    }
    
    .blank {
        font-size: 16.2px;
    }
    
    .option {
        padding: 20px 45px;
        font-size: 30px;
        min-width: 85px;
        min-height: 75px;
    }
    
    .options-container {
        gap: 25px;
        margin-top: 25px;
        min-height: 95px;
    }
}

/* 手机和小屏幕设备 */
@media (max-width: 767px) {
    .main-container {
        flex-direction: column;
        align-items: center;
    }

    .left-panel {
        width: 100%;
        max-width: 400px;
    }

    .score-board {
        flex-direction: row;
    }

    .header h1 {
        font-size: 22px;
    }
    
    .game-container {
        width: 100%;
        max-width: 500px;
        padding: 20px;
        min-height: 500px;
    }
    
    .grid {
        width: 100%;
        grid-template-columns: repeat(6, 1fr);
        grid-template-rows: repeat(5, 1fr);
        gap: 5.4px;
    }
    
    .cell {
        width: 100%;
        height: 100%;
        aspect-ratio: 1;
        padding: 2.7px;
    }
    
    .char {
        font-size: 14.4px;
    }
    
    .blank {
        font-size: 13.5px;
    }
    
    .option {
        padding: 16px 35px;
        font-size: 24px;
        min-width: 70px;
        min-height: 65px;
    }
    
    .options-container {
        gap: 15px;
        min-height: 85px;
    }
    
    /* 手机端道具栏缩小 */
    .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;
    }
}
