/* Serendip 古风样式表 */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --paper: #f5f0e8;
    --paper-light: #faf7f2;
    --ink: #2c2c2c;
    --ink-light: #6b6358;
    --ink-faint: #a89f91;
    --vermillion: #8b4513;
    --vermillion-hover: #a0522d;
    --border: #d4c9b8;
    --border-light: #e5ded3;
}

body {
    font-family: 'PingFang SC', 'Hiragino Sans GB', 'Microsoft YaHei', sans-serif;
    line-height: 1.8;
    color: var(--ink);
    background-color: var(--paper);
    background-image:
        radial-gradient(ellipse at 25% 0%, rgba(222, 211, 195, 0.5) 0%, transparent 70%),
        radial-gradient(ellipse at 75% 100%, rgba(222, 211, 195, 0.3) 0%, transparent 70%);
    min-height: 100vh;
}

.container {
    max-width: 560px;
    margin: 0 auto;
    padding: 40px 20px;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

main {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* 按钮（纯文字） */
.btn-primary,
.btn-secondary {
    background: none;
    color: var(--ink-faint);
    border: none;
    padding: 4px 0;
    font-size: 0.75em;
    cursor: pointer;
    letter-spacing: 0.08em;
    transition: color 0.2s;
}

.btn-primary:hover,
.btn-secondary:hover {
    color: var(--ink-light);
}

/* 推荐卡片 */
.recommendation-card {
    width: 100%;
    max-width: 500px;
    padding: 20px 0;
    animation: fadeIn 0.8s ease-out;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

.poem-content {
    margin-bottom: 32px;
}

.poem-text {
    font-family: 'Noto Serif SC', 'Songti SC', 'SimSun', serif;
    font-size: 1.6em;
    line-height: 2.2;
    color: var(--ink);
    text-align: center;
    padding: 20px 10px;
    white-space: pre-line;
}

.poem-info {
    text-align: center;
    margin-bottom: 24px;
    font-size: 0.9em;
    color: var(--ink-light);
}


/* 情境标签 */
.tags {
    text-align: center;
    margin-bottom: 24px;
    font-size: 0.7em;
    color: var(--ink-faint);
    letter-spacing: 0.1em;
}

/* 操作按钮 */
.poem-actions {
    display: flex;
    gap: 16px;
    justify-content: center;
}

/* 完整诗篇 */
.full-poem {
    width: 100%;
    max-width: 500px;
    padding: 20px 0;
    animation: fadeIn 0.8s ease-out;
}

.full-poem-content h3 {
    font-family: 'Noto Serif SC', serif;
    text-align: center;
    margin-bottom: 8px;
    color: var(--ink);
    font-size: 1.3em;
    font-weight: 400;
}

.full-poem-author {
    text-align: center;
    margin-bottom: 16px;
    color: var(--ink-light);
    font-size: 0.9em;
}

.full-poem-text {
    font-family: 'Noto Serif SC', 'Songti SC', 'SimSun', serif;
    font-size: 1.2em;
    line-height: 2.2;
    color: var(--ink);
    text-align: center;
    margin-bottom: 16px;
    padding: 20px 10px;
    white-space: pre-line;
}

.full-poem-actions {
    text-align: center;
}

/* 加载状态 */
.loading {
    text-align: center;
    color: var(--ink-light);
}

.loading p {
    letter-spacing: 0.1em;
    font-size: 0.95em;
}

.spinner {
    border: 1.5px solid var(--border);
    border-top: 1.5px solid var(--ink-faint);
    border-radius: 50%;
    width: 24px;
    height: 24px;
    animation: spin 1.2s linear infinite;
    margin: 0 auto 12px;
}

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

/* 错误状态 */
.error {
    text-align: center;
    max-width: 400px;
    padding: 40px 30px;
}

.error p {
    color: var(--vermillion);
    margin-bottom: 20px;
    font-size: 0.95em;
}

.hidden {
    display: none !important;
}

/* 页脚 */
footer {
    text-align: center;
    margin-top: 40px;
    padding-top: 20px;
}

footer a {
    color: var(--ink-faint);
    text-decoration: none;
    font-size: 0.8em;
    letter-spacing: 0.05em;
    transition: color 0.2s;
}

footer a:hover {
    color: var(--ink-light);
}

.footer-sep {
    color: var(--border);
    margin: 0 6px;
    font-size: 0.8em;
}

.brand {
    font-size: 0.8em;
    color: var(--ink-faint);
    letter-spacing: 0.05em;
}

/* 历史记录模态框 */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(44, 44, 44, 0.4);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

.modal-content {
    background: var(--paper-light);
    padding: 25px;
    border-radius: 4px;
    border: 1px solid var(--border);
    max-width: 480px;
    width: 90%;
    max-height: 70vh;
    overflow-y: auto;
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    padding-bottom: 15px;
    border-bottom: 1px solid var(--border-light);
}

.modal-header h3 {
    font-family: 'Noto Serif SC', serif;
    font-weight: 400;
    font-size: 1.1em;
    letter-spacing: 0.1em;
}

.close-btn {
    background: none;
    border: none;
    font-size: 20px;
    cursor: pointer;
    color: var(--ink-faint);
    transition: color 0.2s;
}

.close-btn:hover {
    color: var(--ink);
}

.history-list {
    max-height: 400px;
    overflow-y: auto;
}

.history-item {
    padding: 15px 10px;
    border-bottom: 1px solid var(--border-light);
    cursor: pointer;
    transition: background-color 0.2s;
}

.history-item:hover {
    background: var(--paper);
}

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

.history-content {
    font-family: 'Noto Serif SC', serif;
    font-size: 1em;
    color: var(--ink);
    margin-bottom: 6px;
    line-height: 1.8;
}

.history-info {
    font-size: 0.8em;
    color: var(--ink-faint);
    letter-spacing: 0.05em;
}

.history-empty {
    text-align: center;
    color: var(--ink-faint);
    padding: 20px;
}

/* 响应式 */
@media (max-width: 640px) {
    .container {
        padding: 25px 15px;
    }

    .poem-content {
        text-align: center;
        margin-bottom: 40px;
    }

    .poem-text {
        writing-mode: vertical-rl;
        display: inline-block;
        font-size: 1.8em;
        line-height: 2.4;
        text-align: left;
        padding: 24px 32px;
    }

    .poem-actions {
        gap: 12px;
    }
}
