/* common.css */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    background-color: #f9f5f0;
    color: #2e2a26;
    line-height: 1.5;
    padding-bottom: 70px; /* 为底部导航留出空间 */
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* 主容器 */
.page-container {
    max-width: 500px;
    margin: 0 auto;
    width: 100%;
    padding: 16px 16px 20px;
    flex: 1;
}

/* 卡片样式 */
.card {
    background: #ffffff;
    border-radius: 24px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.03);
    padding: 20px;
    margin-bottom: 16px;
}

.card-title {
    font-size: 1.3rem;
    font-weight: 500;
    color: #3e2c1b;
    border-left: 6px solid #b58b5b;
    padding-left: 14px;
    margin-bottom: 16px;
}

/* 表单元素 */
label {
    display: block;
    font-size: 0.95rem;
    font-weight: 500;
    color: #4a3a2a;
    margin-bottom: 6px;
}

input, select {
    border: 1px solid #e0d6cc;
    border-radius: 40px;
    padding: 12px 16px;
    font-size: 1rem;
    background-color: #fffcf9;
    width: 100%;
    outline: none;
    transition: border 0.2s, box-shadow 0.2s;
}

input:focus, select:focus {
    border-color: #b58b5b;
    box-shadow: 0 0 0 3px rgba(181, 139, 91, 0.2);
}

.checkbox-wrapper {
    display: flex;
    align-items: center;
    gap: 8px;
    background: #f0e8df;
    padding: 8px 16px;
    border-radius: 40px;
    width: fit-content;
    margin-bottom: 12px;
}

.checkbox-wrapper input[type="checkbox"] {
    width: 20px;
    height: 20px;
    accent-color: #b58b5b;
}

.gender-group {
    display: flex;
    gap: 20px;
    background: #f0e8df;
    padding: 6px 16px;
    border-radius: 40px;
    width: fit-content;
}

.gender-group label {
    display: flex;
    align-items: center;
    gap: 6px;
    font-weight: normal;
    margin: 0;
    cursor: pointer;
}

.gender-group input[type="radio"] {
    width: 18px;
    height: 18px;
    accent-color: #b58b5b;
}

/* 按钮 */
.btn {
    background-color: #b58b5b;
    border: none;
    border-radius: 60px;
    padding: 14px 24px;
    font-size: 1.1rem;
    font-weight: 600;
    color: white;
    width: 100%;
    cursor: pointer;
    box-shadow: 0 6px 12px rgba(181, 139, 91, 0.2);
    transition: background 0.2s, transform 0.1s;
    text-align: center;
    display: inline-block;
}

.btn:active {
    background-color: #9e764b;
    transform: scale(0.98);
}

.btn:disabled {
    background-color: #d9cfc2;
    box-shadow: none;
    pointer-events: none;
    opacity: 0.7;
}

.btn-outline {
    background: transparent;
    border: 2px solid #b58b5b;
    color: #b58b5b;
    box-shadow: none;
}

.btn-outline:active {
    background: rgba(181,139,91,0.1);
    transform: scale(0.98);
}

/* 底部导航栏 */
.bottom-nav {
    position: fixed;
    bottom: 0;
    left: 0;
    width: 100%;
    background: #ffffff;
    box-shadow: 0 -2px 10px rgba(0,0,0,0.03);
    display: flex;
    justify-content: space-around;
    align-items: center;
    padding: 8px 12px 12px;
    z-index: 100;
    border-top: 1px solid #f0e8df;
}

.nav-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-decoration: none;
    color: #ab9e91;
    font-size: 0.7rem;
    transition: color 0.2s;
    flex: 1;
}

.nav-item.active {
    color: #b58b5b;
}

.nav-item i {
    font-size: 1.6rem;
    margin-bottom: 2px;
}

/* 工具类 */
.hidden {
    display: none !important;
}

.error-message {
    background-color: #ffe8e6;
    color: #b13e3e;
    border-radius: 30px;
    padding: 12px 18px;
    margin-top: 16px;
    text-align: center;
    font-size: 0.9rem;
    border: 1px solid #ffb3aa;
}

.loader {
    display: inline-block;
    width: 18px;
    height: 18px;
    border: 3px solid #f3e9de;
    border-top: 3px solid #b58b5b;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-right: 6px;
    vertical-align: middle;
}

@keyframes spin { 0% { transform: rotate(0deg); } 100% { transform: rotate(360deg); } }

/* Markdown 渲染样式 */
.markdown-body {
    word-wrap: break-word;
    line-height: 1.7;
}

.markdown-body h1, .markdown-body h2, .markdown-body h3 {
    color: #3e2c1b;
    margin-top: 1.2em;
    margin-bottom: 0.6em;
}

.markdown-body p {
    margin-bottom: 1em;
}

.markdown-body strong {
    color: #b0584b;
}

.markdown-body ul, .markdown-body ol {
    padding-left: 1.5em;
    margin-bottom: 1em;
}

/* 表格样式 */
.markdown-body table {
    border-collapse: collapse;
    width: 100%;
    margin: 1em 0;
    display: block;
    overflow-x: auto;
    white-space: nowrap;
}

.markdown-body th,
.markdown-body td {
    border: 1px solid #e0d6cc;
    padding: 8px 12px;
    text-align: left;
}

.markdown-body th {
    background-color: #f0e8df;
    font-weight: 600;
}

/* 历史记录卡片 */
.history-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 0;
    border-bottom: 1px solid #eee3d7;
}

.history-item:last-child {
    border-bottom: none;
}

.history-info h4 {
    font-size: 1.1rem;
    margin-bottom: 4px;
    color: #3e2c1b;
}

.history-info p {
    font-size: 0.85rem;
    color: #7e6b55;
}

.history-score {
    font-size: 1.3rem;
    font-weight: 600;
    color: #b58b5b;
}

.history-score small {
    font-size: 0.8rem;
    font-weight: normal;
    color: #ab9e91;
}