* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Microsoft YaHei', '微软雅黑', Arial, sans-serif;
    background: #f5f5f5;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    padding: 20px;
}

.container {
    background: white;
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    padding: 40px;
    max-width: 600px;
    width: 100%;
    margin-bottom: 20px;
}

h1 {
    text-align: center;
    color: #333;
    margin-bottom: 30px;
    font-size: 28px;
    font-weight: 600;
}

.input-group {
    margin-bottom: 25px;
}

label {
    display: block;
    margin-bottom: 10px;
    color: #333;
    font-weight: 500;
    font-size: 15px;
}

input[type="text"] {
    width: 100%;
    padding: 12px 15px;
    border: 1px solid #ddd;
    border-radius: 6px;
    font-size: 15px;
    transition: all 0.3s;
}

input[type="text"]:focus {
    outline: none;
    border-color: #999;
    box-shadow: 0 0 0 3px rgba(0, 0, 0, 0.05);
}

.button-group {
    display: flex;
    gap: 15px;
    margin-bottom: 30px;
}

button {
    flex: 1;
    padding: 14px;
    border: 1px solid #ddd;
    border-radius: 6px;
    font-size: 15px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    background: white;
    color: #333;
}

.btn-generate {
    background: #333;
    color: white;
    border: 1px solid #333;
}

.btn-generate:hover {
    background: #555;
    border-color: #555;
}

.btn-generate:active {
    background: #222;
}

.btn-generate:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    background: #999;
    border-color: #999;
}

/* 结果区域容器 - 关键修改 */
.result-container {
    position: relative;
    min-height: 150px; /* 固定最小高度，防止跳动 */
}

.loading {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    text-align: center;
    color: #666;
    font-size: 15px;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
}

.loading.show {
    opacity: 1;
    visibility: visible;
}

.loading::after {
    content: '...';
    animation: dots 1.5s steps(4, end) infinite;
}

@keyframes dots {
    0%, 20% { content: '.'; }
    40% { content: '..'; }
    60%, 100% { content: '...'; }
}

.result {
    background: #fafafa;
    border: 1px solid #eee;
    border-radius: 8px;
    padding: 30px;
    text-align: center;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
}

.result.show {
    opacity: 1;
    visibility: visible;
}

/* 结果显示的三行 */
.result-line {
    margin-bottom: 18px;
    line-height: 1.6;
}

.result-line:last-child {
    margin-bottom: 0;
}

/* 第一行：昵称(等级) */
.result-name {
    font-size: 22px;
    font-weight: 600;
    color: #333;
    letter-spacing: 2px;
}

/* 第二行：结局描述 */
.result-ending {
    font-size: 18px;
    font-weight: 500;
    color: #555;
}

/* 第三行：数值 */
.result-stats {
    font-size: 16px;
    font-weight: 400;
    color: #888;
    font-family: 'Consolas', 'Monaco', monospace;
    letter-spacing: 1px;
}

.error-message {
    background: #fee;
    color: #c33;
    border: 1px solid #fcc;
    padding: 15px;
    border-radius: 6px;
    margin-bottom: 20px;
    text-align: center;
    display: none;
    font-size: 14px;
}

/* 底部备案号样式 */
.footer {
    text-align: center;
    padding: 20px;
    color: #999;
    font-size: 13px;
}

.footer a {
    color: #999;
    text-decoration: none;
    transition: color 0.3s;
}

.footer a:hover {
    color: #666;
}

/* 响应式设计 */
@media (max-width: 768px) {
    .container {
        padding: 25px 20px;
    }
    
    h1 {
        font-size: 22px;
    }
    
    .result {
        padding: 25px 20px;
    }
    
    .result-name {
        font-size: 20px;
    }
    
    .result-ending {
        font-size: 16px;
    }
    
    .result-stats {
        font-size: 14px;
    }
    
    .footer {
        font-size: 12px;
    }
}
