/* 全局样式 */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --primary-color: #c84a4a;
    --secondary-color: #8b4513;
    --accent-color: #d4af37;
    --bg-gradient-start: #fef5e7;
    --bg-gradient-end: #fce8d6;
    --text-primary: #2c3e50;
    --text-secondary: #7f8c8d;
    --card-bg: #ffffff;
    --shadow-light: rgba(200, 74, 74, 0.1);
    --shadow-medium: rgba(200, 74, 74, 0.2);
    --shadow-dark: rgba(0, 0, 0, 0.15);
}

body {
    font-family: 'Microsoft YaHei', 'SimSun', serif;
    background: linear-gradient(135deg, var(--bg-gradient-start) 0%, var(--bg-gradient-end) 100%);
    min-height: 100vh;
    color: var(--text-primary);
    overflow-x: hidden;
}

/* 容器 */
.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 2rem;
    position: relative;
    z-index: 1;
}

/* 背景装饰 */
.background-decoration {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    overflow: hidden;
    z-index: 0;
    pointer-events: none;
}

.circle {
    position: absolute;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(200, 74, 74, 0.1) 0%, transparent 70%);
    animation: float 20s infinite ease-in-out;
}

.circle-1 {
    width: 400px;
    height: 400px;
    top: -100px;
    right: -100px;
    animation-delay: 0s;
}

.circle-2 {
    width: 300px;
    height: 300px;
    bottom: -50px;
    left: -50px;
    animation-delay: 7s;
}

.circle-3 {
    width: 250px;
    height: 250px;
    top: 50%;
    left: 50%;
    animation-delay: 14s;
}

@keyframes float {
    0%, 100% {
        transform: translate(0, 0) scale(1);
    }
    33% {
        transform: translate(30px, -30px) scale(1.1);
    }
    66% {
        transform: translate(-20px, 20px) scale(0.9);
    }
}

/* 页头 */
.header {
    text-align: center;
    margin-bottom: 3rem;
    animation: fadeInDown 0.8s ease-out;
}

.main-title {
    font-size: 3rem;
    color: var(--primary-color);
    margin-bottom: 1rem;
    font-weight: 700;
    letter-spacing: 0.1em;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 1rem;
}

.title-icon {
    font-size: 2.5rem;
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0%, 100% {
        transform: scale(1);
    }
    50% {
        transform: scale(1.1);
    }
}

.subtitle {
    font-size: 1.1rem;
    color: var(--text-secondary);
    font-weight: 300;
}

/* 主内容区 */
.main-content {
    animation: fadeInUp 0.8s ease-out;
}

/* 输入区域 */
.input-section {
    background: var(--card-bg);
    border-radius: 20px;
    padding: 2.5rem;
    box-shadow: 0 10px 40px var(--shadow-light);
    margin-bottom: 2rem;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.input-section:hover {
    transform: translateY(-5px);
    box-shadow: 0 15px 50px var(--shadow-medium);
}

.input-container {
    margin-bottom: 1.5rem;
}

.input-label {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 1.1rem;
    color: var(--text-primary);
    margin-bottom: 1rem;
    font-weight: 600;
}

.label-icon {
    font-size: 1.3rem;
}

.input-wrapper {
    display: flex;
    gap: 1rem;
}

.poem-input {
    flex: 1;
    padding: 1rem 1.5rem;
    font-size: 1.1rem;
    border: 2px solid #e0e0e0;
    border-radius: 12px;
    transition: all 0.3s ease;
    font-family: inherit;
}

.poem-input:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 4px rgba(200, 74, 74, 0.1);
}

.generate-btn {
    padding: 1rem 2.5rem;
    font-size: 1.1rem;
    font-weight: 600;
    background: linear-gradient(135deg, var(--primary-color) 0%, #a83232 100%);
    color: white;
    border: none;
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-family: inherit;
    box-shadow: 0 4px 15px rgba(200, 74, 74, 0.3);
}

.generate-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(200, 74, 74, 0.4);
}

.generate-btn:active {
    transform: translateY(0);
}

.generate-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}

.btn-icon {
    font-size: 1.3rem;
    transition: transform 0.3s ease;
}

.generate-btn:hover .btn-icon {
    transform: translateX(5px);
}

.char-count {
    text-align: right;
    color: var(--text-secondary);
    font-size: 0.9rem;
    margin-top: 0.5rem;
}

/* 诗歌类型选择 */
.poem-options {
    display: flex;
    gap: 1.5rem;
    margin-top: 1.5rem;
    padding: 1.5rem;
    background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
    border-radius: 12px;
    border: 1px solid rgba(0, 0, 0, 0.05);
}

.option-group {
    flex: 1;
}

.option-label {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 0.75rem;
    font-size: 0.95rem;
}

.option-icon {
    font-size: 1.2rem;
}

.option-buttons {
    display: flex;
    gap: 0.75rem;
}

.option-btn {
    flex: 1;
    padding: 0.75rem 1rem;
    background: white;
    border: 2px solid #dee2e6;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text-secondary);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.25rem;
}

.option-btn:hover {
    border-color: var(--primary-color);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(200, 74, 74, 0.2);
}

.option-btn.active {
    background: linear-gradient(135deg, var(--primary-color) 0%, #a83232 100%);
    border-color: var(--primary-color);
    color: white;
    box-shadow: 0 4px 12px rgba(200, 74, 74, 0.3);
}

.option-desc {
    font-size: 0.75rem;
    opacity: 0.8;
    font-weight: 400;
}

/* 快速示例 */
.quick-examples {
    display: flex;
    align-items: center;
    gap: 1rem;
    flex-wrap: wrap;
    margin-top: 1.5rem;
    padding: 1rem;
    background: linear-gradient(135deg, #fff5f5 0%, #ffe8e8 100%);
    border-radius: 12px;
    border: 1px solid rgba(200, 74, 74, 0.1);
}

.examples-label {
    color: var(--text-secondary);
    font-size: 0.95rem;
}

.examples-list {
    display: flex;
    gap: 0.75rem;
    flex-wrap: wrap;
}

.example-btn {
    padding: 0.5rem 1.2rem;
    background: linear-gradient(135deg, #fff 0%, #f8f8f8 100%);
    border: 1px solid #e0e0e0;
    border-radius: 20px;
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: 0.95rem;
    color: var(--text-primary);
    font-family: inherit;
}

.example-btn:hover {
    background: linear-gradient(135deg, var(--primary-color) 0%, #a83232 100%);
    color: white;
    border-color: var(--primary-color);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(200, 74, 74, 0.3);
}

/* 诗歌展示区域 */
.poem-section {
    position: relative;
    margin-bottom: 2rem;
}

.poem-card {
    background: var(--card-bg);
    border-radius: 20px;
    padding: 2.5rem;
    box-shadow: 0 10px 40px var(--shadow-light);
    min-height: 400px;
    position: relative;
    overflow: hidden;
}

.poem-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: linear-gradient(90deg, var(--primary-color), var(--accent-color), var(--primary-color));
    background-size: 200% 100%;
    animation: shimmer 3s infinite;
}

@keyframes shimmer {
    0% {
        background-position: -200% 0;
    }
    100% {
        background-position: 200% 0;
    }
}

.poem-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
    padding-bottom: 1rem;
    border-bottom: 2px solid #f0f0f0;
}

.poem-title {
    font-size: 1.5rem;
    color: var(--primary-color);
    font-weight: 600;
}

.poem-actions {
    display: flex;
    gap: 0.75rem;
}

.action-btn {
    width: 40px;
    height: 40px;
    border-radius: 10px;
    border: 1px solid #e0e0e0;
    background: white;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    color: var(--text-secondary);
}

.action-btn:hover {
    background: var(--primary-color);
    color: white;
    border-color: var(--primary-color);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(200, 74, 74, 0.3);
}

.poem-content {
    min-height: 250px;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.empty-state {
    text-align: center;
    color: var(--text-secondary);
}

.empty-icon {
    font-size: 4rem;
    margin-bottom: 1rem;
    opacity: 0.5;
}

.empty-text {
    font-size: 1.1rem;
}

.poem-text {
    font-size: 1.8rem;
    line-height: 2.5;
    color: var(--text-primary);
    font-family: 'KaiTi', 'STKaiti', serif;
    text-align: left;
    padding: 1rem;
    animation: fadeIn 0.8s ease-out;
}

.poem-line {
    opacity: 0;
    animation: fadeInLine 0.6s ease-out forwards;
    margin-bottom: 0.5rem;
    display: flex;
    align-items: flex-start;
}

.poem-line:nth-child(1) {
    animation-delay: 0.1s;
}

.poem-line:nth-child(2) {
    animation-delay: 0.3s;
}

.poem-line:nth-child(3) {
    animation-delay: 0.5s;
}

.poem-line:nth-child(4) {
    animation-delay: 0.7s;
}

.poem-line::before {
    content: '●';
    color: var(--primary-color);
    margin-right: 1rem;
    font-size: 0.8rem;
    margin-top: 0.8rem;
}

@keyframes fadeInLine {
    from {
        opacity: 0;
        transform: translateX(-20px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

.poem-footer {
    margin-top: 2rem;
    padding-top: 1rem;
    border-top: 2px solid #f0f0f0;
    text-align: center;
}

.poem-keyword {
    display: inline-block;
    padding: 0.5rem 1.5rem;
    background: linear-gradient(135deg, rgba(200, 74, 74, 0.1) 0%, rgba(168, 50, 50, 0.1) 100%);
    color: var(--primary-color);
    border-radius: 20px;
    font-weight: 600;
    font-size: 1.1rem;
}

/* 加载动画 */
.loading-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(255, 255, 255, 0.95);
    display: none;
    align-items: center;
    justify-content: center;
    border-radius: 20px;
    z-index: 10;
}

.loading-overlay.active {
    display: flex;
}

.loading-spinner {
    text-align: center;
}

.spinner {
    width: 60px;
    height: 60px;
    border: 4px solid #f0f0f0;
    border-top: 4px solid var(--primary-color);
    border-radius: 50%;
    margin: 0 auto 1rem;
    animation: spin 1s linear infinite;
}

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

.loading-text {
    color: var(--primary-color);
    font-size: 1.1rem;
    font-weight: 600;
}

/* 历史记录 */
.history-section {
    background: var(--card-bg);
    border-radius: 20px;
    padding: 2rem;
    box-shadow: 0 10px 40px var(--shadow-light);
    animation: fadeIn 0.5s ease-out;
}

.history-title {
    font-size: 1.3rem;
    color: var(--primary-color);
    margin-bottom: 1.5rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.history-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 1rem;
}

.history-item {
    padding: 1rem;
    background: linear-gradient(135deg, #fff 0%, #f8f8f8 100%);
    border: 1px solid #e0e0e0;
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.3s ease;
}

.history-item:hover {
    background: linear-gradient(135deg, rgba(200, 74, 74, 0.05) 0%, rgba(168, 50, 50, 0.05) 100%);
    border-color: var(--primary-color);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(200, 74, 74, 0.2);
}

.history-keyword {
    font-weight: 600;
    color: var(--primary-color);
    margin-bottom: 0.5rem;
}

.history-preview {
    font-size: 0.9rem;
    color: var(--text-secondary);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* 页脚 */
.footer {
    text-align: center;
    margin-top: 3rem;
    padding-top: 2rem;
    border-top: 1px solid rgba(0, 0, 0, 0.1);
}

.footer-text {
    color: var(--text-secondary);
    font-size: 0.95rem;
}

.footer-highlight {
    color: var(--primary-color);
    font-weight: 600;
}

/* 动画效果 */
@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

@keyframes fadeInDown {
    from {
        opacity: 0;
        transform: translateY(-30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

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

/* 响应式设计 */
@media (max-width: 768px) {
    .container {
        padding: 1rem;
    }

    .main-title {
        font-size: 2rem;
    }

    .input-section,
    .poem-card {
        padding: 1.5rem;
    }

    .input-wrapper {
        flex-direction: column;
    }

    .generate-btn {
        width: 100%;
        justify-content: center;
    }

    .poem-options {
        flex-direction: column;
        gap: 1rem;
        padding: 1rem;
    }

    .option-buttons {
        gap: 0.5rem;
    }

    .option-btn {
        padding: 0.6rem 0.8rem;
        font-size: 0.85rem;
    }

    .poem-text {
        font-size: 1.3rem;
        line-height: 2;
    }

    .history-list {
        grid-template-columns: 1fr;
    }
}

/* 打印样式 */
@media print {
    body {
        background: white;
    }

    .input-section,
    .history-section,
    .footer,
    .poem-actions,
    .background-decoration {
        display: none;
    }

    .poem-card {
        box-shadow: none;
        border: 2px solid var(--primary-color);
    }
}

