/* 基础样式重置 */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Courier New', monospace;
    background-color: #16213e;
    color: #ffffff;
    overflow: hidden;
    width: 100vw;
    height: 100vh;
    position: relative;
}

/* 视图容器 */
.view {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: none;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.view.active {
    display: block;
    opacity: 1;
}

/* 主场景样式 */
.background-container {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 1;
}

.bg-image {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* 状态栏 */
.status-bar {
    position: absolute;
    top: 20px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    gap: 30px;
    z-index: 10;
    background: rgba(22, 33, 62, 0.8);
    padding: 10px 20px;
    border-radius: 20px;
    border: 2px solid #00ffcc;
}

.status-item {
    display: flex;
    flex-direction: column;
    align-items: center;
}

.status-label {
    font-size: 12px;
    color: #00ffcc;
    text-shadow: 0 0 5px #00ffcc;
}

.status-value {
    font-size: 16px;
    font-weight: bold;
    color: #ffffff;
}

/* 主角羊驼 */
.character-container {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    z-index: 5;
    text-align: center;
}

.character {
    width: 200px;
    height: 200px;
    object-fit: contain;
    border: 3px solid #ffffff;
    box-shadow: 0 0 20px rgba(255, 255, 255, 0.5);
    /* 纸片感效果 */
    filter: drop-shadow(0 4px 6px rgba(0, 0, 0, 0.3));
    transition: transform 0.3s ease;
    
    /* 呼吸动画 */
    animation: breathing 3s ease-in-out infinite;
}

@keyframes breathing {
    0%, 100% { transform: scaleY(1); }
    50% { transform: scaleY(1.05); }
}

/* 故障效果 */
.character.glitch {
    animation: glitch 0.3s ease-in-out;
}

@keyframes glitch {
    0%, 100% { transform: translateX(0); }
    20% { transform: translateX(-2px); }
    40% { transform: translateX(2px); }
    60% { transform: translateX(-1px); }
    80% { transform: translateX(1px); }
}

/* 对话气泡 */
.dialogue-bubble {
    position: absolute;
    top: -60px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(255, 255, 255, 0.9);
    color: #16213e;
    padding: 10px 15px;
    border-radius: 15px;
    font-size: 14px;
    max-width: 200px;
    opacity: 0;
    transition: opacity 0.3s ease;
    border: 2px solid #00ffcc;
    z-index: 15;
}

.dialogue-bubble.show {
    opacity: 1;
}

.dialogue-bubble::after {
    content: '';
    position: absolute;
    bottom: -10px;
    left: 50%;
    transform: translateX(-50%);
    width: 0;
    height: 0;
    border-left: 10px solid transparent;
    border-right: 10px solid transparent;
    border-top: 10px solid rgba(255, 255, 255, 0.9);
}

/* 导航物体 */
.nav-objects {
    position: absolute;
    bottom: 60px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    gap: 40px;
    z-index: 10;
}

.nav-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    cursor: pointer;
    transition: transform 0.2s ease;
}

.nav-item:hover {
    transform: scale(1.1);
}

.nav-icon {
    width: 60px;
    height: 60px;
    background: rgba(0, 255, 204, 0.2);
    border: 2px solid #00ffcc;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    margin-bottom: 5px;
    box-shadow: 0 0 15px rgba(0, 255, 204, 0.5);
}

.nav-label {
    font-size: 12px;
    color: #00ffcc;
    text-shadow: 0 0 5px #00ffcc;
}

/* 模态框样式 */
.modal-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(22, 33, 62, 0.9);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 20;
}

/* 故障标题效果 */
.glitch-title {
    font-size: 28px;
    font-weight: bold;
    text-align: center;
    margin-bottom: 20px;
    color: #00ffcc;
    text-shadow: 
        2px 2px 0 #ff0099,
        -2px -2px 0 #00ffcc,
        2px -2px 0 #ff0099,
        -2px 2px 0 #00ffcc;
    animation: glitch-text 2s infinite;
}

@keyframes glitch-text {
    0%, 100% {
        text-shadow: 
            2px 2px 0 #ff0099,
            -2px -2px 0 #00ffcc,
            2px -2px 0 #ff0099,
            -2px 2px 0 #00ffcc;
    }
    25% {
        text-shadow: 
            -2px 2px 0 #ff0099,
            2px -2px 0 #00ffcc,
            -2px -2px 0 #ff0099,
            2px 2px 0 #00ffcc;
    }
    50% {
        text-shadow: 
            2px -2px 0 #ff0099,
            -2px 2px 0 #00ffcc,
            2px 2px 0 #ff0099,
            -2px -2px 0 #00ffcc;
    }
    75% {
        text-shadow: 
            -2px -2px 0 #ff0099,
            2px 2px 0 #00ffcc,
            -2px 2px 0 #ff0099,
            2px -2px 0 #00ffcc;
    }
}

/* 关闭按钮 */
.close-btn {
    position: absolute;
    top: 15px;
    right: 15px;
    background: none;
    border: none;
    color: #ff0099;
    font-size: 24px;
    cursor: pointer;
    z-index: 25;
    transition: transform 0.2s ease;
}

.close-btn:hover {
    transform: scale(1.2);
}

/* 炼金台样式 */
.craft-container {
    background: rgba(22, 33, 62, 0.95);
    border: 3px solid #00ffcc;
    border-radius: 15px;
    padding: 30px;
    width: 90%;
    max-width: 400px;
    position: relative;
}

.craft-options {
    margin: 20px 0;
}

.option-group {
    margin-bottom: 20px;
}

.option-group h3 {
    color: #00ffcc;
    margin-bottom: 10px;
    text-shadow: 0 0 5px #00ffcc;
}

.radio-group {
    display: flex;
    gap: 20px;
}

.radio-group label {
    display: flex;
    align-items: center;
    gap: 5px;
    cursor: pointer;
}

.radio-group input[type="radio"] {
    accent-color: #00ffcc;
}

.craft-btn {
    width: 100%;
    padding: 15px;
    background: linear-gradient(45deg, #00ffcc, #ff0099);
    border: none;
    border-radius: 25px;
    color: #ffffff;
    font-size: 18px;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.3s ease;
    margin-top: 20px;
}

.craft-btn:hover {
    transform: scale(1.05);
    box-shadow: 0 0 20px rgba(0, 255, 204, 0.5);
}

.craft-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
}

.recipe-result {
    margin-top: 20px;
    text-align: center;
    min-height: 100px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

/* 传送门样式 */
.portal-container {
    background: rgba(22, 33, 62, 0.95);
    border: 3px solid #00ffcc;
    border-radius: 15px;
    padding: 30px;
    width: 90%;
    max-width: 400px;
    max-height: 70vh;
    overflow-y: auto;
    position: relative;
}

.shop-list {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.shop-card {
    background: rgba(0, 255, 204, 0.1);
    border: 2px solid #00ffcc;
    border-radius: 10px;
    padding: 15px;
    cursor: pointer;
    transition: all 0.3s ease;
}

.shop-card:hover {
    background: rgba(0, 255, 204, 0.2);
    transform: translateX(5px);
}

.shop-name {
    font-size: 16px;
    font-weight: bold;
    color: #00ffcc;
    margin-bottom: 5px;
}

.shop-info {
    display: flex;
    justify-content: space-between;
    font-size: 14px;
    color: #ffffff;
}

.shop-distance {
    color: #ff0099;
}

/* 线索本样式 */
.story-container {
    background: rgba(22, 33, 62, 0.95);
    border: 3px solid #00ffcc;
    border-radius: 15px;
    padding: 30px;
    width: 90%;
    max-width: 400px;
    position: relative;
}

.story-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 15px;
    margin-bottom: 20px;
}

.story-slot {
    aspect-ratio: 1;
    background: rgba(255, 255, 255, 0.1);
    border: 2px solid #555;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.3s ease;
    position: relative;
}

.story-slot.unlocked {
    background: rgba(0, 255, 204, 0.2);
    border-color: #00ffcc;
    box-shadow: 0 0 15px rgba(0, 255, 204, 0.3);
}

.story-slot.locked {
    cursor: not-allowed;
    opacity: 0.5;
}

.story-slot-icon {
    font-size: 24px;
}

.story-slot.locked .story-slot-icon {
    color: #555;
}

.story-detail {
    background: rgba(0, 255, 204, 0.1);
    border: 2px solid #00ffcc;
    border-radius: 10px;
    padding: 15px;
    min-height: 100px;
    display: none;
}

.story-detail.show {
    display: block;
}

/* 梗图墙样式 */
.meme-container {
    background: rgba(22, 33, 62, 0.95);
    border: 3px solid #00ffcc;
    border-radius: 15px;
    padding: 30px;
    width: 90%;
    max-width: 400px;
    position: relative;
}

.meme-content {
    text-align: center;
    padding: 20px;
}

/* 加载动画 */
.loading {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 3px solid rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    border-top-color: #00ffcc;
    animation: spin 1s ease-in-out infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* 响应式设计 */
@media (max-width: 375px) {
    .status-bar {
        top: 10px;
        padding: 8px 15px;
        gap: 20px;
    }
    
    .character {
        width: 150px;
        height: 150px;
    }
    
    .nav-objects {
        bottom: 40px;
        gap: 30px;
    }
    
    .nav-icon {
        width: 50px;
        height: 50px;
        font-size: 20px;
    }
    
    .glitch-title {
        font-size: 24px;
    }
    
    .craft-container,
    .portal-container,
    .story-container,
    .meme-container {
        width: 95%;
        padding: 20px;
    }
}

/* 图片纸片感 */
img {
    border: 3px solid #ffffff;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.3);
}

/* 滚动条样式 */
::-webkit-scrollbar {
    width: 6px;
}

::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.1);
}

::-webkit-scrollbar-thumb {
    background: #00ffcc;
    border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
    background: #ff0099;
}