/* Google Fonts - 中文手写字体 */
@import url('https://fonts.googleapis.cn/css2?family=Ma+Shan+Zheng&family=Zhi+Mang+Xing&display=swap');

/* 梦境页面通用样式 */
body {
    font-family: 'Noto Sans SC', sans-serif;
    background: linear-gradient(180deg, #e8f0e8 0%, #d4e4d4 50%, #c0d8c0 100%);
    min-height: 100vh;
}

.ghibli-bg {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 0;
    overflow: hidden;
}

/* 云朵动画 */
.cloud {
    position: absolute;
    background: rgba(255, 255, 255, 0.7);
    border-radius: 50px;
    animation: float-cloud 20s linear infinite;
}

.cloud::before,
.cloud::after {
    content: '';
    position: absolute;
    background: inherit;
    border-radius: 50%;
}

.cloud-1 {
    width: 100px;
    height: 40px;
    top: 10%;
    left: -100px;
    animation-delay: 0s;
}

.cloud-1::before {
    width: 50px;
    height: 50px;
    top: -25px;
    left: 15px;
}

.cloud-1::after {
    width: 35px;
    height: 35px;
    top: -15px;
    left: 50px;
}

.cloud-2 {
    width: 120px;
    height: 45px;
    top: 25%;
    left: -120px;
    animation-delay: -7s;
    animation-duration: 25s;
}

.cloud-2::before {
    width: 60px;
    height: 60px;
    top: -30px;
    left: 20px;
}

.cloud-2::after {
    width: 40px;
    height: 40px;
    top: -18px;
    left: 60px;
}

.cloud-3 {
    width: 80px;
    height: 35px;
    top: 15%;
    left: -80px;
    animation-delay: -14s;
    animation-duration: 18s;
}

.cloud-3::before {
    width: 40px;
    height: 40px;
    top: -20px;
    left: 10px;
}

.cloud-3::after {
    width: 30px;
    height: 30px;
    top: -12px;
    left: 40px;
}

@keyframes float-cloud {
    0% {
        transform: translateX(0);
    }

    100% {
        transform: translateX(calc(100vw + 200px));
    }
}

/* 草地背景 */
.grass {
    position: fixed;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 120px;
    z-index: 0;
    pointer-events: none;
}

.grass svg {
    width: 100%;
    height: 100%;
}

.container {
    position: relative;
    z-index: 1;
}

/* 卡片样式 */
.dream-card {
    background: rgba(255, 255, 255, 0.85);
    backdrop-filter: blur(10px);
    border-radius: 24px;
    box-shadow: 0 10px 40px rgba(139, 109, 86, 0.15), 0 2px 10px rgba(139, 109, 86, 0.1);
    border: 2px solid rgba(255, 248, 240, 0.8);
    transition: all 0.3s ease;
}

.dream-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 15px 50px rgba(139, 109, 86, 0.2), 0 4px 15px rgba(139, 109, 86, 0.15);
}

/* 标题装饰 */
.title-decoration {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
}

.title-icon {
    font-size: 2rem;
    animation: gentle-sway 3s ease-in-out infinite;
}

@keyframes gentle-sway {

    0%,
    100% {
        transform: rotate(-5deg);
    }

    50% {
        transform: rotate(5deg);
    }
}

.main-title {
    font-family: 'Ma Shan Zheng', 'Zhi Mang Xing', cursive;
    font-size: 2.25rem;
    font-weight: 400;
    background: linear-gradient(135deg, #5a8a64 0%, #7cb582 50%, #6a9e72 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    text-shadow: 3px 3px 6px rgba(90, 138, 100, 0.3);
    letter-spacing: 4px;
}

.subtitle {
    color: #a08060;
    font-size: 1.1rem;
    margin-top: 0.5rem;
}

/* 历史链接 */
.history-link {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    color: #6a9e72;
    text-decoration: none;
    font-size: 0.95rem;
    margin-bottom: 1.5rem;
    padding: 0.5rem 1rem;
    background: rgba(255, 255, 255, 0.7);
    border-radius: 50px;
    transition: all 0.3s ease;
    border: 2px solid rgba(106, 158, 114, 0.2);
}

.history-link:hover {
    background: rgba(106, 158, 114, 0.1);
    border-color: rgba(106, 158, 114, 0.4);
    transform: translateY(-2px);
}

/* 登录提示 */
.login-prompt {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    color: #8b7d6b;
    font-size: 0.9rem;
    margin-bottom: 1.5rem;
    padding: 0.6rem 1.2rem;
    background: rgba(255, 255, 255, 0.7);
    border-radius: 50px;
    border: 2px dashed rgba(139, 125, 107, 0.3);
}

.login-prompt-icon {
    font-size: 1.1rem;
}

.login-prompt a {
    color: #6a9e72;
    text-decoration: none;
    font-weight: 600;
    transition: all 0.3s ease;
}

.login-prompt a:hover {
    color: #5a8a64;
    text-decoration: underline;
}

/* 梦境解析页面特定样式 */
.dream-textarea {
    width: 100%;
    min-height: 200px;
    padding: 20px;
    border: 3px solid #f0e6d8;
    border-radius: 20px;
    font-size: 1rem;
    line-height: 1.8;
    background: linear-gradient(145deg, #fffefb 0%, #fff9f0 100%);
    color: #5a4a3a;
    resize: vertical;
    transition: all 0.3s ease;
    font-family: 'Noto Sans SC', sans-serif;
}

.dream-textarea:focus {
    outline: none;
    border-color: #e8a87c;
    box-shadow: 0 0 20px rgba(232, 168, 124, 0.3);
}

.dream-textarea::placeholder {
    color: #c4b0a0;
}

.btn-group {
    display: flex;
    gap: 15px;
    flex-wrap: nowrap;
    min-width: 0;
}

.btn-ghibli {
    padding: 14px 28px;
    border-radius: 50px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    border: none;
    display: flex;
    align-items: center;
    gap: 8px;
    font-family: 'Noto Sans SC', sans-serif;
    white-space: nowrap;
}

@media (max-width: 640px) {
    .btn-group {
        flex-direction: column;
        gap: 10px;
        width: 100%;
    }

    .btn-ghibli {
        width: 100%;
        justify-content: center;
        padding: 12px 16px;
        font-size: 0.9rem;
    }
}

.btn-analyze {
    background: linear-gradient(135deg, #7cb582 0%, #6a9e72 50%, #5a8a64 100%);
    color: white;
    box-shadow: 0 4px 15px rgba(106, 158, 114, 0.4);
}

.btn-analyze:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 25px rgba(106, 158, 114, 0.5);
}

.btn-analyze:active {
    transform: translateY(-1px);
}

.btn-reset {
    background: linear-gradient(135deg, #f5d0a9 0%, #e8b88a 50%, #d4a574 100%);
    color: #5a4a3a;
    box-shadow: 0 4px 15px rgba(212, 165, 116, 0.3);
}

.btn-reset:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 25px rgba(212, 165, 116, 0.4);
}

.btn-reset:active {
    transform: translateY(-1px);
}

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

.char-count {
    color: #b0a090;
    font-size: 0.9rem;
}

.dream-actions {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 1rem;
    gap: 1rem;
}

@media (max-width: 640px) {
    .dream-actions {
        flex-direction: column;
        gap: 12px;
    }

    .dream-actions .btn-group {
        width: 100%;
    }

    .dream-actions .char-count {
        width: 100%;
        text-align: center;
    }

    .ghibli-toast {
        width: 90% !important;
        max-width: none !important;
        padding: 14px 20px !important;
        font-size: 0.95rem !important;
        white-space: normal !important;
        text-align: center !important;
        line-height: 1.5 !important;
        border-radius: 20px !important;
    }
}

.char-count.warning {
    color: #e07474;
}

/* 加载动画 */
.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(254, 249, 243, 0.9);
    backdrop-filter: blur(5px);
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    visibility: hidden;
    transition: all 0.5s ease;
}

.loading-overlay.active {
    opacity: 1;
    visibility: visible;
}

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

.loading-spinner {
    width: 80px;
    height: 80px;
    margin: 0 auto 20px;
    position: relative;
}

.loading-spinner::before {
    content: '🌙';
    font-size: 60px;
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    animation: moon-glow 2s ease-in-out infinite;
}

.spinner-ring {
    width: 100%;
    height: 100%;
    border: 4px solid #f0e6d8;
    border-top: 4px solid #e8a87c;
    border-radius: 50%;
    animation: spin 1.5s linear infinite;
}

@keyframes moon-glow {

    0%,
    100% {
        opacity: 0.7;
        transform: translate(-50%, -50%) scale(1);
    }

    50% {
        opacity: 1;
        transform: translate(-50%, -50%) scale(1.1);
    }
}

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

    100% {
        transform: rotate(360deg);
    }
}

.loading-text {
    font-size: 1.3rem;
    color: #8b7d6b;
    margin-bottom: 10px;
    font-weight: 500;
}

.loading-subtext {
    font-size: 0.95rem;
    color: #b0a090;
}

.loading-stars {
    display: flex;
    justify-content: center;
    gap: 8px;
    margin-top: 15px;
}

.loading-star {
    font-size: 1.2rem;
    animation: twinkle 1.5s ease-in-out infinite;
}

.loading-star:nth-child(1) {
    animation-delay: 0s;
}

.loading-star:nth-child(2) {
    animation-delay: 0.3s;
}

.loading-star:nth-child(3) {
    animation-delay: 0.6s;
}

.loading-star:nth-child(4) {
    animation-delay: 0.9s;
}

.loading-star:nth-child(5) {
    animation-delay: 1.2s;
}

@keyframes twinkle {

    0%,
    100% {
        opacity: 0.3;
        transform: scale(0.8);
    }

    50% {
        opacity: 1;
        transform: scale(1.2);
    }
}

/* 结果卡片 */
.result-card {
    background: rgba(255, 255, 255, 0.9);
    backdrop-filter: blur(10px);
    border-radius: 24px;
    box-shadow: 0 10px 40px rgba(139, 109, 86, 0.15), 0 2px 10px rgba(139, 109, 86, 0.1);
    border: 2px solid rgba(232, 168, 124, 0.3);
    margin-top: 30px;
    overflow: hidden;
}

.result-header {
    background: linear-gradient(135deg, #fdf6e9 0%, #faf0e6 100%);
    padding: 20px 25px;
    border-bottom: 2px dashed #f0e6d8;
    display: flex;
    align-items: center;
    gap: 12px;
}

.result-icon {
    font-size: 1.8rem;
}

.result-title {
    font-size: 1.3rem;
    font-weight: 700;
    color: #8b7d6b;
}

.result-content {
    padding: 25px;
    color: #5a4a3a;
    line-height: 2;
    font-size: 1rem;
    max-height: 600px;
    overflow-y: auto;
}

.result-content::-webkit-scrollbar {
    width: 8px;
}

.result-content::-webkit-scrollbar-track {
    background: #f5f0e8;
    border-radius: 10px;
}

.result-content::-webkit-scrollbar-thumb {
    background: #e8d5c4;
    border-radius: 10px;
}

.result-content::-webkit-scrollbar-thumb:hover {
    background: #d4c4b0;
}

.result-content strong {
    color: #6a9e72;
    font-weight: 700;
    background: linear-gradient(120deg, rgba(106, 158, 114, 0.15) 0%, rgba(106, 158, 114, 0.08) 100%);
    padding: 2px 6px;
    border-radius: 4px;
}

.result-content br {
    content: '';
    display: block;
    margin: 8px 0;
}

/* 装饰花朵 */
.decoration-flowers {
    position: absolute;
    pointer-events: none;
}

.flower {
    position: absolute;
    font-size: 2rem;
    opacity: 0.6;
    animation: float-flower 6s ease-in-out infinite;
}

.flower-1 {
    top: -15px;
    right: 20px;
    animation-delay: 0s;
}

.flower-2 {
    bottom: -10px;
    left: 30px;
    animation-delay: -2s;
}

.flower-3 {
    top: 50%;
    right: -20px;
    animation-delay: -4s;
}

@keyframes float-flower {

    0%,
    100% {
        transform: translateY(0) rotate(0deg);
    }

    50% {
        transform: translateY(-10px) rotate(10deg);
    }
}

.footer {
    text-align: center;
    padding: 30px;
    color: #6a8a6a;
    font-size: 1rem;
}

/* 打字指示器 */
.typing-indicator {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 15px 25px;
    border-top: 1px solid rgba(232, 168, 124, 0.2);
}

.typing-dot {
    width: 8px;
    height: 8px;
    background: linear-gradient(135deg, #e8a87c 0%, #d4a574 100%);
    border-radius: 50%;
    animation: typing-bounce 1.4s ease-in-out infinite;
}

.typing-dot:nth-child(1) {
    animation-delay: 0s;
}

.typing-dot:nth-child(2) {
    animation-delay: 0.2s;
}

.typing-dot:nth-child(3) {
    animation-delay: 0.4s;
}

@keyframes typing-bounce {

    0%,
    60%,
    100% {
        transform: translateY(0);
    }

    30% {
        transform: translateY(-10px);
    }
}

/* 梦境历史页面特定样式 */
.page-header {
    text-align: center;
    margin-bottom: 2rem;
}

.main-title.history-title {
    font-size: 2.5rem;
}

.back-link {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    color: #6a9e72;
    text-decoration: none;
    font-size: 0.95rem;
    margin-bottom: 1rem;
    transition: all 0.3s ease;
}

.back-link:hover {
    color: #5a8a64;
    transform: translateX(-3px);
}

.dream-card.history-card {
    margin-bottom: 1.5rem;
    overflow: hidden;
}

.dream-header {
    background: linear-gradient(135deg, #fdf6e9 0%, #faf0e6 100%);
    padding: 1rem 1.5rem;
    border-bottom: 2px dashed #f0e6d8;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.dream-date {
    display: flex;
    align-items: center;
    gap: 8px;
    color: #8b7d6b;
    font-size: 0.9rem;
}

.dream-date-icon {
    font-size: 1.2rem;
}

.dream-content-preview {
    padding: 1.25rem 1.5rem;
    color: #5a4a3a;
    line-height: 1.8;
    border-bottom: 1px solid #f0e6d8;
}

.dream-content-preview h4 {
    color: #6a9e72;
    font-weight: 600;
    margin-bottom: 0.5rem;
    font-size: 0.95rem;
}

.dream-content-text {
    color: #5a4a3a;
    font-size: 0.95rem;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.dream-actions {
    padding: 1rem 1.5rem;
    display: flex;
    justify-content: flex-end;
}

.btn-view {
    background: linear-gradient(135deg, #7cb582 0%, #6a9e72 50%, #5a8a64 100%);
    color: white;
    border: none;
    padding: 0.6rem 1.25rem;
    border-radius: 50px;
    font-size: 0.9rem;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 6px;
}

.btn-view:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(106, 158, 114, 0.4);
}

/* 分页 */
.pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 0.5rem;
    margin-top: 2rem;
    margin-bottom: 2rem;
    flex-wrap: wrap;
}

.pagination-btn {
    min-width: 40px;
    height: 40px;
    border: 2px solid #e8dcc8;
    background: rgba(255, 255, 255, 0.8);
    color: #5a4a3a;
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: 0.9rem;
    display: flex;
    align-items: center;
    justify-content: center;
}

.pagination-btn:hover:not(:disabled) {
    background: linear-gradient(135deg, #7cb582 0%, #6a9e72 100%);
    color: white;
    border-color: #6a9e72;
}

.pagination-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.pagination-btn.active {
    background: linear-gradient(135deg, #7cb582 0%, #6a9e72 100%);
    color: white;
    border-color: #6a9e72;
}

.pagination-info {
    color: #8b7d6b;
    font-size: 0.9rem;
    margin: 0 1rem;
}

/* 空状态 */
.empty-state {
    text-align: center;
    padding: 4rem 2rem;
    background: rgba(255, 255, 255, 0.85);
    backdrop-filter: blur(10px);
    border-radius: 24px;
    box-shadow: 0 10px 40px rgba(139, 109, 86, 0.15);
    border: 2px solid rgba(255, 248, 240, 0.8);
}

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

.empty-title {
    font-size: 1.3rem;
    color: #5a4a3a;
    margin-bottom: 0.5rem;
}

.empty-desc {
    color: #8b7d6b;
    font-size: 0.95rem;
}

.btn-primary {
    background: linear-gradient(135deg, #7cb582 0%, #6a9e72 50%, #5a8a64 100%);
    color: white;
    border: none;
    padding: 0.875rem 2rem;
    border-radius: 50px;
    font-size: 1rem;
    cursor: pointer;
    transition: all 0.3s ease;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    margin-top: 1.5rem;
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(106, 158, 114, 0.4);
}

.loading-container {
    text-align: center;
    padding: 4rem 2rem;
}

/* Modal Styles */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(5px);
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
}

.modal-overlay.active {
    opacity: 1;
    visibility: visible;
}

.modal-content {
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    border-radius: 24px;
    width: 90%;
    max-width: 800px;
    max-height: 85vh;
    overflow: hidden;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    transform: scale(0.9);
    transition: all 0.3s ease;
}

.modal-overlay.active .modal-content {
    transform: scale(1);
}

.modal-header {
    background: linear-gradient(135deg, #fdf6e9 0%, #faf0e6 100%);
    padding: 1.25rem 1.5rem;
    border-bottom: 2px dashed #f0e6d8;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-title {
    font-size: 1.2rem;
    color: #5a4a3a;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 8px;
}

.modal-close {
    background: none;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    color: #8b7d6b;
    transition: all 0.3s ease;
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
}

.modal-close:hover {
    background: rgba(139, 109, 86, 0.1);
    color: #5a4a3a;
}

.modal-body {
    padding: 1.5rem;
    overflow-y: auto;
    max-height: calc(85vh - 80px);
}

.modal-section {
    margin-bottom: 1.5rem;
}

.modal-section:last-child {
    margin-bottom: 0;
}

.modal-section-title {
    color: #6a9e72;
    font-weight: 600;
    margin-bottom: 0.75rem;
    font-size: 1rem;
    display: flex;
    align-items: center;
    gap: 6px;
}

.modal-section-content {
    color: #5a4a3a;
    line-height: 1.8;
    font-size: 0.95rem;
    background: rgba(253, 246, 233, 0.5);
    padding: 1rem;
    border-radius: 12px;
}

.modal-section-content strong {
    color: #6a9e72;
}