/* 基础样式重置 */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent;
}

body {
    overflow: hidden;
    touch-action: manipulation;
    font-size: 16px;
    line-height: 1.5;
}

/* 游戏主容器 */
#game-container {
    display: flex;
    flex-direction: column;
    height: 100vh;
    background-color: #f8f4e9;
}

/* 顶部人物区域 */
#character-panel {
    flex: 0 0 30%;
    background: linear-gradient(to bottom, #f5f5dc, #e8e8cc);
    border-bottom: 3px solid #8b4513;
    display: flex;
    padding: 15px;
    position: relative;
    overflow: hidden;
}

#character-svg {
    flex: 0 0 100px;
    height: 100px;
    background-color: #f0e6cc;
    border-radius: 50%;
    margin-right: 15px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 40px;
    border: 3px solid #8b4513;
    box-shadow: 0 4px 8px rgba(0,0,0,0.1);
    position: relative;
    z-index: 2;
}

#stats-display {
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: space-around;
    position: relative;
    z-index: 2;
}

.stat-bar {
    margin-bottom: 12px;
}

.stat-label {
    font-weight: bold;
    margin-right: 10px;
    color: #5a3a1a;
    font-size: 0.9rem;
}

.progress-container {
    width: 100%;
    height: 22px;
    background-color: #e0d0b0;
    border-radius: 11px;
    overflow: hidden;
    position: relative;
    margin-top: 6px;
    box-shadow: inset 0 1px 3px rgba(0,0,0,0.2);
}

.progress-bar {
    height: 100%;
    background: linear-gradient(to right, #6e45e2, #89d4cf);
    transition: width 0.5s ease;
    position: relative;
}

.progress-text {
    position: absolute;
    right: 8px;
    top: 50%;
    transform: translateY(-50%);
    font-size: 0.75rem;
    color: white;
    text-shadow: 1px 1px 1px rgba(0,0,0,0.5);
    font-family: 'Ma Shan Zheng', cursive;
}

/* 人物背景装饰 */
.character-bg {
    position: absolute;
    opacity: 0.1;
    z-index: 1;
}

/* 中间日志区域 */
#log-panel {
    flex: 1;
    overflow-y: auto;
    padding: 12px 15px;
    background-color: #fffaf0;
    border-bottom: 1px solid #d2b48c;
    scroll-behavior: smooth;
}

#log-content {
    min-height: 100%;
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
}

.log-entry {
    margin-bottom: 10px;
    padding: 10px;
    background-color: rgba(255,255,255,0.8);
    border-radius: 8px;
    border-left: 4px solid #8b4513;
    box-shadow: 0 2px 4px rgba(0,0,0,0.05);
    animation: fadeIn 0.5s;
    font-size: 0.9rem;
    line-height: 1.4;
}

.log-entry.system {
    background-color: rgba(210, 180, 140, 0.2);
    border-left-color: #6e45e2;
}

.log-entry.important {
    background-color: rgba(255, 154, 158, 0.2);
    border-left-color: #ff9a9e;
    font-weight: bold;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

/* 底部按钮区域 */
#action-panel {
    display: flex;
    justify-content: space-around;
    padding: 12px 5px;
    background: linear-gradient(to top, #f0e68c, #f8e8a0);
    border-top: 3px solid #8b4513;
    box-shadow: 0 -2px 5px rgba(0,0,0,0.1);
}

.action-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 8px 5px;
    border: none;
    border-radius: 12px;
    background: linear-gradient(to bottom, #8b4513, #a0522d);
    color: white;
    font-size: 0.85rem;
    cursor: pointer;
    width: 22%;
    transition: all 0.2s;
    box-shadow: 0 3px 6px rgba(0,0,0,0.16);
    font-family: 'Ma Shan Zheng', cursive;
}

.action-btn:active {
    transform: scale(0.95);
    box-shadow: 0 1px 3px rgba(0,0,0,0.12);
}

.action-btn.disabled {
    opacity: 0.6;
    filter: grayscale(0.5);
    pointer-events: none;
}

.btn-icon {
    width: 26px;
    height: 26px;
    fill: currentColor;
    margin-bottom: 5px;
}

/* 模态框样式 */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0,0,0,0.7);
    z-index: 100;
    align-items: center;
    justify-content: center;
    backdrop-filter: blur(3px);
}

.modal-content {
    background-color: #fffaf0;
    padding: 25px;
    border-radius: 15px;
    width: 90%;
    max-width: 400px;
    text-align: center;
    animation: modalFadeIn 0.3s;
    border: 2px solid #8b4513;
    box-shadow: 0 10px 25px rgba(0,0,0,0.2);
}

@keyframes modalFadeIn {
    from { opacity: 0; transform: translateY(-20px); }
    to { opacity: 1; transform: translateY(0); }
}

.modal h2 {
    margin-bottom: 20px;
    color: #8b4513;
    font-family: 'ZCOOL KuaiLe', cursive;
    font-size: 1.5rem;
}

#spirit-root-result {
    font-size: 2.2rem;
    margin: 20px 0;
    color: #6e45e2;
    font-weight: bold;
    font-family: 'ZCOOL KuaiLe', cursive;
    text-shadow: 2px 2px 4px rgba(0,0,0,0.1);
}

#spirit-root-description {
    margin-bottom: 20px;
    color: #5a3a1a;
    font-size: 0.95rem;
    line-height: 1.5;
}

#start-game-btn {
    padding: 12px 25px;
    background: linear-gradient(to right, #ff9a9e, #fad0c4);
    border: none;
    border-radius: 25px;
    color: white;
    font-size: 1.1rem;
    cursor: pointer;
    margin-top: 15px;
    font-family: 'ZCOOL KuaiLe', cursive;
    box-shadow: 0 4px 8px rgba(0,0,0,0.1);
    transition: all 0.3s;
}

#start-game-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 12px rgba(0,0,0,0.15);
}

/* 灵根测试界面 */
.spirit-root-test {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100vh;
    background: linear-gradient(135deg, #6e45e2 0%, #89d4cf 100%);
    color: white;
    text-align: center;
    padding: 20px;
    font-family: 'ZCOOL KuaiLe', cursive;
    position: relative;
    overflow: hidden;
}

.spirit-root-test::before {
    content: "";
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" width="100" height="100" viewBox="0 0 100 100"><path d="M30,50 Q50,30 70,50 T90,50" stroke="white" stroke-width="0.5" fill="none"/></svg>') repeat;
    opacity: 0.1;
    transform: rotate(15deg);
}

.spirit-root-test h1 {
    font-size: 2.5rem;
    margin-bottom: 30px;
    text-shadow: 3px 3px 6px rgba(0,0,0,0.3);
    position: relative;
    z-index: 2;
}

.spirit-root-test p {
    font-size: 1.2rem;
    margin-bottom: 40px;
    position: relative;
    z-index: 2;
    max-width: 80%;
}

#start-test-btn {
    padding: 15px 30px;
    font-size: 1.2rem;
    background: linear-gradient(to right, #ff9a9e, #fad0c4);
    border: none;
    border-radius: 50px;
    color: white;
    cursor: pointer;
    box-shadow: 0 8px 15px rgba(0,0,0,0.2);
    font-family: 'ZCOOL KuaiLe', cursive;
    transition: all 0.3s;
    position: relative;
    z-index: 2;
    outline: none;
}

#start-test-btn:hover {
    transform: translateY(-3px);
    box-shadow: 0 12px 20px rgba(0,0,0,0.3);
}

#start-test-btn:active {
    transform: translateY(1px);
    box-shadow: 0 4px 8px rgba(0,0,0,0.2);
}

/* 响应式调整 */
@media (max-width: 400px) {
    .action-btn span {
        font-size: 0.75rem;
    }
    
    .btn-icon {
        width: 22px;
        height: 22px;
    }
    
    #character-svg {
        width: 80px;
        height: 80px;
        font-size: 32px;
    }
    
    .log-entry {
        font-size: 0.8rem;
        padding: 8px;
    }
}

@media (min-height: 700px) {
    #character-panel {
        flex: 0 0 25%;
    }
}

.encounter-options {
    animation: fadeIn 0.3s ease-in-out;
}

.encounter-option-btn {
    opacity: 0;
    animation: slideIn 0.3s ease-out forwards;
}

.encounter-option-btn:nth-child(1) { animation-delay: 0.1s; }
.encounter-option-btn:nth-child(2) { animation-delay: 0.2s; }
.encounter-option-btn:nth-child(3) { animation-delay: 0.3s; }

.encounter-option-btn:active {
    transform: scale(0.98);
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateX(-20px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}