/* FC复古像素风格 - 主样式文件 */

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    image-rendering: pixelated;
    image-rendering: -moz-crisp-edges;
    image-rendering: crisp-edges;
}

body {
    font-family: 'Press Start 2P', monospace;
    background: #000084;
    color: #FCFCFC;
    overflow: hidden;
    width: 100vw;
    height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* 屏幕管理 */
.screen {
    display: none;
    width: 100%;
    height: 100%;
    position: absolute;
    top: 0;
    left: 0;
    align-items: center;
    justify-content: center;
    flex-direction: column;
    padding: 20px;
}

.screen.active {
    display: flex;
}

/* 开场动画 */
.opening-animation {
    text-align: center;
}

.company-logo {
    font-size: 16px;
    color: #FCFCFC;
    margin-bottom: 60px;
    text-shadow: 3px 3px 0 #000;
}

.game-logo {
    display: flex;
    gap: 40px;
    align-items: center;
    justify-content: center;
    font-size: 80px;
}

.pixel-heart, .pixel-ring {
    filter: drop-shadow(4px 4px 0 #000);
}

/* 点击开始提示 */
/* 加载画面 */
.loading-container {
    margin-top: 40px;
    text-align: center;
}

.loading-text {
    font-size: 14px;
    color: #FCFC00;
    text-shadow: 2px 2px 0 #000;
    margin-bottom: 15px;
}

.loading-bar {
    width: 300px;
    height: 20px;
    background: #333;
    border: 3px solid #FCFCFC;
    margin: 0 auto;
    box-shadow: 4px 4px 0 #000;
}

.loading-bar-fill {
    height: 100%;
    width: 0%;
    background: linear-gradient(90deg, #FC0000, #FCFC00, #00FC00);
    transition: width 0.2s ease;
}

.click-hint {
    margin-top: 60px;
    font-size: 14px;
    color: #FCFC00;
    text-shadow: 2px 2px 0 #000;
    cursor: pointer;
}

/* 标题画面 */
.title-container {
    max-width: 700px;
    width: 90%;
    padding: 40px;
    text-align: center;
    background: linear-gradient(180deg, #000084 0%, #000050 100%);
}

.pixel-title {
    font-size: 24px;
    color: #FC0000;
    text-shadow: 3px 3px 0 #000;
    margin-bottom: 30px;
    letter-spacing: 2px;
}

.pixel-characters {
    display: flex;
    justify-content: space-around;
    margin: 40px 0;
    font-size: 60px;
}

.pixel-char {
    animation: float 2s ease-in-out infinite;
}

.pixel-char.left {
    animation-delay: 0s;
}

.pixel-char.right {
    animation-delay: 1s;
}

.game-description {
    margin: 20px 0;
    font-size: 12px;
    color: #FCFC00;
    line-height: 24px;
}

.start-button {
    font-size: 16px;
    color: #FCFC00;
    margin: 30px 0;
    cursor: pointer;
    text-shadow: 2px 2px 0 #000;
    transition: transform 0.1s;
}

.start-button:hover {
    transform: scale(1.1);
}

.title-footer {
    display: flex;
    justify-content: space-between;
    font-size: 10px;
    color: #FCFCFC;
    margin-top: 40px;
}

/* 游戏主界面 */
#game-screen {
    padding: 10px;
    gap: 10px;
}

.status-bar {
    width: 100%;
    max-width: 900px;
    padding: 15px 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: #000000;
    font-size: 14px;
}

.lives {
    color: #FC74B4;
    font-size: 16px;
}

.game-title {
    color: #FCFC00;
    font-size: 16px;
    text-shadow: 2px 2px 0 #000;
}

.score {
    color: #FCFCFC;
    font-size: 14px;
}

#score-display {
    color: #00FCFC;
    margin-left: 5px;
}

/* 游戏区域 */
.game-area {
    width: 100%;
    max-width: 900px;
    display: flex;
    gap: 20px;
    align-items: center;
    justify-content: center;
    flex: 1;
    flex-wrap: wrap;
}

/* 消消乐网格 */
.match-grid {
    position: relative;
    background: #000000;
    border: 6px solid #FCFCFC;
    box-shadow: 
        inset 0 0 0 3px #000,
        0 0 0 3px #000,
        12px 12px 0 rgba(0, 0, 0, 0.5);
    padding: 12px;
    display: grid;
    gap: 6px;
}

.match-grid.size-6 {
    grid-template-columns: repeat(6, 1fr);
    width: 540px;
    height: 540px;
}

.match-grid.size-7 {
    grid-template-columns: repeat(7, 1fr);
    width: 630px;
    height: 630px;
}

.match-grid.size-8 {
    grid-template-columns: repeat(8, 1fr);
    width: 720px;
    height: 720px;
}

/* 消消乐单元格 */
.match-cell {
    background: linear-gradient(135deg, #1a1a3e 0%, #0a0a1f 100%);
    border: 2px solid #333366;
    border-radius: 4px;
    cursor: pointer;
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.1s, border-color 0.2s, box-shadow 0.2s;
    aspect-ratio: 1;
}

.match-cell:hover {
    border-color: #FCFC00;
    box-shadow: 0 0 10px rgba(252, 252, 0, 0.5);
    transform: scale(1.05);
    z-index: 10;
}

.match-cell.selected {
    border-color: #00FC00;
    box-shadow: 0 0 15px rgba(0, 252, 0, 0.7);
    animation: pulse 0.5s infinite;
}

.match-cell.hint {
    animation: hintPulse 0.3s ease-in-out infinite;
    border-color: #FF69B4;
    box-shadow: 0 0 20px rgba(255, 105, 180, 0.8);
}

.match-cell.removing {
    animation: removeCell 0.3s ease-out forwards;
}

.match-cell.dropping {
    animation: dropCell 0.3s ease-out;
}

.cell-content {
    font-size: 42px;
    filter: drop-shadow(3px 3px 0 #000);
    pointer-events: none;
    transition: transform 0.1s;
}

.match-grid.size-7 .cell-content {
    font-size: 36px;
}

.match-grid.size-8 .cell-content {
    font-size: 30px;
}

/* 游戏控制 */
.game-controls {
    display: flex;
    flex-direction: column;
    gap: 20px;
    align-items: center;
}

.target-info {
    background: #000;
    border: 3px solid #FCFCFC;
    padding: 15px 20px;
    text-align: center;
}

.target-label {
    font-size: 10px;
    color: #FCFC00;
    margin-bottom: 8px;
}

.target-score {
    font-size: 20px;
    color: #00FCFC;
    text-shadow: 2px 2px 0 #000;
}

/* 底部信息栏 */
.info-bar {
    width: 100%;
    max-width: 900px;
    padding: 15px 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: #000000;
    font-size: 12px;
}

.stage-info, .time-info {
    color: #FCFCFC;
}

.progress-bar {
    position: relative;
    width: 200px;
    height: 20px;
    background: #333;
    border: 2px solid #FCFCFC;
}

.progress-fill {
    height: 100%;
    background: repeating-linear-gradient(
        90deg,
        #00FC00,
        #00FC00 10px,
        #00CC00 10px,
        #00CC00 20px
    );
    width: 0%;
    transition: width 0.3s;
}

.progress-text {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 10px;
    color: #FCFCFC;
    text-shadow: 1px 1px 0 #000;
    pointer-events: none;
}

/* COMBO显示 */
.combo-display {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 32px;
    color: #FCFC00;
    text-shadow: 3px 3px 0 #FC0000;
    pointer-events: none;
    opacity: 0;
    z-index: 1000;
    white-space: pre-line;
    text-align: center;
}

.combo-display.show {
    animation: comboShow 1s;
}

/* 过关结算 */
.clear-container {
    max-width: 600px;
    width: 90%;
    padding: 40px;
    background: #000050;
    text-align: center;
}

.score-breakdown {
    margin: 30px 0;
    font-size: 12px;
    text-align: left;
}

.score-item {
    display: flex;
    justify-content: space-between;
    margin: 10px 0;
    color: #FCFCFC;
}

.score-item.total {
    color: #FCFC00;
    font-size: 14px;
    margin-top: 15px;
}

.dots {
    flex: 1;
    margin: 0 10px;
    color: #666;
}

.score-divider {
    margin: 10px 0;
    color: #FCFCFC;
}

.continue-prompt {
    margin-top: 30px;
    font-size: 12px;
    color: #00FCFC;
    cursor: pointer;
}

/* 照片奖励 */
.photo-reward {
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100vh;
    padding: 20px;
    box-sizing: border-box;
}

.reward-title {
    color: #FCFC00;
    margin-bottom: 20px;
    animation: pulse 1s infinite;
    flex-shrink: 0;
    font-size: 24px;
}

.reward-content {
    display: flex;
    flex-direction: row;
    align-items: center;
    justify-content: center;
    width: 100%;
    max-width: 900px;
    gap: 50px;
}

.photo-frame.reward-frame {
    max-width: none !important;
    width: 420px !important;
    height: 500px;
    animation: rewardAppear 0.8s ease-out;
    flex-shrink: 0;
    padding: 15px !important;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    box-shadow: none !important;
    position: relative;
}

.photo-frame.reward-frame img {
    max-width: calc(100% - 10px) !important;
    max-height: calc(100% - 10px) !important;
    width: auto !important;
    height: auto !important;
    object-fit: contain;
    margin: 0 !important;
    display: block;
}

.fc-dialog-box.reward-dialog {
    max-width: none !important;
    width: 350px !important;
    height: 500px !important;
    min-height: 500px !important;
    max-height: 500px !important;
    padding: 20px !important;
    display: flex;
    flex-direction: column;
    flex-shrink: 0;
    align-self: flex-start;
    box-sizing: border-box;
}

.fc-dialog-box.reward-dialog .dialog-avatar {
    margin-bottom: 15px;
    flex-shrink: 0;
}

.fc-dialog-box.reward-dialog .pixel-avatar {
    font-size: 36px;
}

.fc-dialog-box.reward-dialog .dialog-content {
    min-height: 0;
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
    font-size: 14px;
    line-height: 26px;
    margin-bottom: 15px;
    word-wrap: break-word;
}

.fc-dialog-box.reward-dialog .dialog-prompt {
    flex-shrink: 0;
    font-size: 14px;
}

/* 对话框 */
.fc-dialog-box {
    max-width: 700px;
    width: 90%;
    background: #000000;
    border: 4px solid #FCFCFC;
    box-shadow: 
        inset 0 0 0 2px #000,
        0 0 0 2px #000,
        8px 8px 0 rgba(0, 0, 0, 0.5);
    padding: 30px;
}

.dialog-avatar {
    text-align: center;
    margin-bottom: 20px;
}

.pixel-avatar {
    font-size: 48px;
    display: inline-block;
    animation: float 2s ease-in-out infinite;
}

.dialog-content {
    min-height: 150px;
    font-size: 14px;
    line-height: 28px;
    color: #FCFCFC;
    margin-bottom: 20px;
    white-space: pre-wrap;
}

.dialog-prompt {
    text-align: right;
    font-size: 12px;
    color: #FCFC00;
    cursor: pointer;
}

/* 最终通关 */
.final-container {
    max-width: 700px;
    width: 90%;
    padding: 40px;
    background: linear-gradient(180deg, #000084 0%, #000050 100%);
    text-align: center;
}

.final-text {
    font-size: 16px;
    margin: 10px 0;
    color: #FCFCFC;
}

.fireworks {
    margin: 30px 0;
    height: 100px;
    font-size: 40px;
    display: flex;
    justify-content: space-around;
    align-items: center;
}

.love-title {
    color: #FC74B4;
    margin: 20px 0;
}

.name-title {
    color: #FCFC00;
    font-size: 32px;
    margin: 20px 0;
}

.final-score {
    margin: 30px 0;
    font-size: 14px;
}

.final-score div {
    margin: 10px 0;
}

.rank-sss {
    color: #FCFC00;
    animation: rainbow 2s linear infinite;
}

/* 排行榜 */
.ranking-container {
    max-width: 500px;
    width: 90%;
    padding: 40px;
    background: #000050;
    text-align: center;
}

.ranking-list {
    margin: 30px 0;
}

.ranking-item {
    display: flex;
    justify-content: space-between;
    padding: 15px;
    margin: 10px 0;
    border: 2px solid #FCFCFC;
    font-size: 14px;
}

.ranking-item.gold {
    background: linear-gradient(90deg, #FFD700 0%, #FFA500 100%);
    color: #000;
    border-color: #FFD700;
}

.ranking-item.silver {
    background: linear-gradient(90deg, #C0C0C0 0%, #808080 100%);
    color: #000;
    border-color: #C0C0C0;
}

.ranking-item.bronze {
    background: linear-gradient(90deg, #CD7F32 0%, #8B4513 100%);
    color: #000;
    border-color: #CD7F32;
}

.rank {
    font-weight: bold;
}

/* 照片墙 */
.photo-wall {
    text-align: center;
}

.photo-frame {
    max-width: 600px;
    width: 90%;
    border: 6px solid #FCFCFC;
    background: #000;
    padding: 20px;
    box-shadow: 8px 8px 0 rgba(0, 0, 0, 0.5);
}

.photo-frame img {
    width: 100%;
    height: auto;
    display: block;
    margin-bottom: 15px;
}

.photo-caption {
    font-size: 12px;
    color: #FCFC00;
    margin-top: 10px;
}

/* 祝福信 */
.letter-box {
    max-height: 80vh;
    overflow-y: auto;
}

/* 隐藏任务 */
.secret-container {
    max-width: 600px;
    width: 90%;
    padding: 40px;
    background: #000050;
    text-align: center;
}

.secret-text {
    font-size: 14px;
    margin: 20px 0;
    color: #FCFCFC;
}

.treasure-map {
    font-size: 80px;
    margin: 30px 0;
    animation: bounce 1s infinite;
}

.secret-clue {
    font-size: 12px;
    color: #FCFC00;
    margin: 20px 0;
}

/* 成就弹窗 */
.achievement-popup {
    position: fixed;
    top: 20px;
    right: 20px;
    background: #000;
    border: 3px solid #FCFC00;
    padding: 15px 20px;
    display: none;
    align-items: center;
    gap: 10px;
    font-size: 12px;
    z-index: 9999;
    animation: slideIn 0.5s;
}

.achievement-popup.show {
    display: flex;
}

.achievement-icon {
    font-size: 24px;
}

/* 音量控制 */
.volume-control {
    position: fixed;
    top: 20px;
    left: 20px;
    z-index: 9999;
}

/* 响应式设计 */
@media (max-width: 768px) {
    .pixel-title {
        font-size: 18px;
    }
    
    .match-grid.size-6 {
        width: 450px;
        height: 450px;
    }
    
    .match-grid.size-7 {
        width: 480px;
        height: 480px;
    }
    
    .match-grid.size-8 {
        width: 525px;
        height: 525px;
    }
    
    .cell-content {
        font-size: 33px;
    }
    
    .match-grid.size-7 .cell-content {
        font-size: 27px;
    }
    
    .match-grid.size-8 .cell-content {
        font-size: 24px;
    }
    
    .dialog-content {
        font-size: 12px;
        line-height: 24px;
    }
    
    .game-area {
        flex-direction: column;
    }
    
    .target-info {
        padding: 10px 15px;
    }
    
    .target-score {
        font-size: 16px;
    }
}

@media (max-width: 480px) {
    .match-grid.size-6 {
        width: 390px;
        height: 390px;
    }
    
    .match-grid.size-7 {
        width: 420px;
        height: 420px;
    }
    
    .match-grid.size-8 {
        width: 450px;
        height: 450px;
    }
    
    .cell-content {
        font-size: 27px;
    }
    
    .match-grid.size-7 .cell-content {
        font-size: 24px;
    }
    
    .match-grid.size-8 .cell-content {
        font-size: 21px;
    }
}
