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

/* 基础样式 */
body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    color: #fff;
    overflow-x: hidden;
    min-height: 100vh;
    line-height: 1.6;
}

button:active, a:active{
    background-color: transparent;
    border: none;
    box-shadow: none;
}

/* 深空背景 */
.space-background {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, #1a1a2e 0%, #16213e 50%, #0f3460 100%);
    z-index: -2;
}

.stars {
    position: absolute;
    width: 100%;
    height: 100%;
    background: radial-gradient(2px 2px at 20px 30px, #fff, rgba(0,0,0,0)),
                radial-gradient(2px 2px at 40px 70px, #fff, rgba(0,0,0,0)),
                radial-gradient(2px 2px at 50px 160px, #fff, rgba(0,0,0,0)),
                radial-gradient(2px 2px at 90px 40px, #fff, rgba(0,0,0,0)),
                radial-gradient(2px 2px at 130px 80px, #fff, rgba(0,0,0,0)),
                radial-gradient(2px 2px at 160px 120px, #fff, rgba(0,0,0,0));
    background-repeat: repeat;
    background-size: 200px 200px;
    animation: moveStars 100s linear infinite;
}

.twinkling {
    position: absolute;
    width: 100%;
    height: 100%;
    background: transparent;
    animation: twinkle 4s ease-in-out infinite;
}

/* 主容器 */
.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 2rem;
    position: relative;
    z-index: 1;
    margin-top: 4rem;
    min-height: 100vh;
}

.main-title {
    text-align: center;
    font-size: 2.5rem;
    margin-bottom: 3rem;
    color: #fff;
    text-shadow: 0 0 10px rgba(255, 255, 255, 0.5);
}

/* 星座卡片网格 */
.zodiac-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 2rem;
    padding: 1rem;
}

/* 星座卡片 */
.zodiac-card {
    perspective: 1000px;
    height: 300px;
    cursor: pointer;
    transition: all 0.3s ease;
    position: relative;
    transform: translateY(0);
}

/* 添加卡片悬停动画 */
.zodiac-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 15px 30px rgba(0, 0, 0, 0.3);
}

.zodiac-card:hover .card-front {
    background: rgba(255, 255, 255, 0.15);
    box-shadow: 0 0 20px rgba(255, 255, 255, 0.2);
}

.zodiac-card:hover .zodiac-icon {
    transform: scale(1.1);
    filter: drop-shadow(0 0 15px rgba(255, 255, 255, 0.8));
}

.zodiac-card:hover h2 {
    text-shadow: 0 0 10px rgba(255, 255, 255, 0.8);
}

/* 添加光晕效果 */
.zodiac-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    border-radius: 15px;
    background: radial-gradient(circle at center, rgba(255, 255, 255, 0.1) 0%, transparent 70%);
    opacity: 0;
    transition: opacity 0.3s ease;
    pointer-events: none;
}

.zodiac-card:hover::before {
    opacity: 1;
}

/* 添加卡片内容动画 */
.card-front {
    transition: all 0.3s ease;
}

.card-inner {
    position: relative;
    width: 100%;
    height: 100%;
    transition: transform 0.6s cubic-bezier(0.4, 0, 0.2, 1);
    transform-style: preserve-3d;
    will-change: transform;
}

.zodiac-card.flipped .card-inner {
    transform: rotateY(180deg);
}

.card-front, .card-back {
    position: absolute;
    width: 100%;
    height: 100%;
    backface-visibility: hidden;
    -webkit-backface-visibility: hidden;
    border-radius: 15px;
    padding: 1.5rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.2);
    box-shadow: 0 8px 32px 0 rgba(31, 38, 135, 0.37);
    transform: translateZ(0);
    -webkit-transform: translateZ(0);
}

.card-back {
    transform: rotateY(180deg);
    overflow-y: auto;
    padding: 1.5rem;
    display: flex;
    flex-direction: column;
}

.zodiac-icon {
    width: 80px;
    height: 80px;
    margin-bottom: 1rem;
    filter: drop-shadow(0 0 10px rgba(255, 255, 255, 0.5));
    transition: all 0.3s ease;
}

.zodiac-card h2 {
    transition: all 0.3s ease;
}

/* 运势内容 */
.fortune-content {
    height: auto;
    padding: 0.5rem;
}

.fortune-section {
    margin-bottom: 1rem;
    background: rgba(255, 255, 255, 0.05);
    padding: 1rem;
    border-radius: 10px;
}

.fortune-section h4 {
    color: #fff;
    margin-bottom: 0.8rem;
    font-size: 1.2rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.2);
    padding-bottom: 0.5rem;
}

.fortune-section p {
    color: rgba(255, 255, 255, 0.9);
    line-height: 1.6;
    font-size: 1rem;
    margin: 0;
    white-space: pre-line;
    overflow-y: scroll;
    overflow-x: hidden;
}
.fortune-section p::-webkit-scrollbar {
    display: none;
}

/* 加载遮罩 */
.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    display: none;
    justify-content: center;
    align-items: center;
    z-index: 1000;
    backdrop-filter: blur(5px);
}

.loading-spinner {
    width: 50px;
    height: 50px;
    border: 3px solid rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    border-top-color: #fff;
    animation: spin 1s ease-in-out infinite;
}

/* 翻转卡片样式 */
.zodiac-card.flipped {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 90%;
    max-width: 600px;
    height: auto;
    min-height: auto!important;
    max-height: calc(100vh - 40px);
    z-index: 1000;
    background: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.2);
    box-shadow: 0 8px 32px 0 rgba(31, 38, 135, 0.37);
    border-radius: 15px;
}

.zodiac-card.flipped .card-inner {
    height: 100%;
}

.zodiac-card.flipped .card-back {
    position: relative;
    /* overflow-y: auto; */
    padding: 1.5rem;
    min-height: 300px;
    max-height: calc(70vh - 40px);
}

.card-container {
    position: relative;
    width: 100%;
    height: 300px;
}

/* 占位元素 */
.card-placeholder {
    display: none;
    height: 300px;
    width: 100%;
    margin: 0;
    padding: 0;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.3s ease;
}

/* 显示占位元素 */
.zodiac-card.flipped + .card-placeholder {
    display: block;
    opacity: 1;
}

/* 卡片标题 */
.card-title {
    font-size: 1.8rem;
    color: #fff;
    text-align: center;
    margin-bottom: 2rem;
    width: 100%;
    text-shadow: 0 0 10px rgba(255, 255, 255, 0.3);
    position: relative;
}

/* 关闭按钮 */
.close-button {
    position: absolute;
    top: 10px;
    right: 10px;
    width: 30px;
    height: 30px;
    border: none;
    background: rgba(255, 255, 255, 0.2);
    color: white;
    border-radius: 50%;
    font-size: 20px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background-color 0.3s ease;
    z-index: 10;
}

.close-button:hover {
    background: rgba(255, 255, 255, 0.3);
}

.close-button:focus {
    outline: none;
    box-shadow: 0 0 0 2px rgba(255, 255, 255, 0.5);
}

/* 响应式设计 */
@media (max-width: 768px) {
    .container {
        padding: 1rem;
    }
    
    .zodiac-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 1rem;
    }
    
    .zodiac-card {
        height: 250px;
    }
    
    .main-title {
        font-size: 2rem;
        margin-bottom: 2rem;
    }

    .card-container {
        height: 250px;
    }

    .card-placeholder {
        height: 250px;
    }

    .zodiac-card.flipped {
        position: fixed;
        top: 50%;
        left: 50%;
        transform: translate(-50%, -50%);
        width: 95%;
        height: auto!important;
        min-height: 300px;
        max-height: calc(100vh - 20px);
    }
    
    .zodiac-card.flipped .card-back {
        padding: 1rem;
        min-height: 300px;
        max-height: calc(100vh - 20px);
    }
    
    .fortune-content {
        padding: 0.3rem;
    }
    
    .fortune-section {
        padding: 0.8rem;
        margin-bottom: 0.8rem;
    }
    
    .fortune-section h4 {
        font-size: 1.1rem;
        margin-bottom: 0.6rem;
    }
    
    .fortune-section p {
        font-size: 0.95rem;
        line-height: 1.5;
    }

    .card-title {
        font-size: 1.5rem;
        margin-bottom: 1.5rem;
        padding-right: 35px;
    }
    
    .close-button {
        width: 28px;
        height: 28px;
        top: 1.2rem;
        right: 1.2rem;
    }
    
    .close-button::before,
    .close-button::after {
        width: 14px;
    }

    /* 禁用移动端hover效果 */
    .zodiac-card:not(.flipped):hover {
        transform: none;
    }

    .zodiac-card:not(.flipped):hover .zodiac-icon {
        transform: none;
    }

    .zodiac-card:not(.flipped):hover .card-front {
        background: rgba(255, 255, 255, 0.1);
    }

    .zodiac-card:not(.flipped):hover::before {
        opacity: 0;
    }
}

/* 动画 */
@keyframes moveStars {
    from { background-position: 0 0; }
    to { background-position: -10000px 5000px; }
}

@keyframes twinkle {
    0%, 100% { opacity: 0.2; }
    50% { opacity: 1; }
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* 滚动条样式 */
.card-back::-webkit-scrollbar {
    width: 8px;
}

.card-back::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 4px;
}

.card-back::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.3);
    border-radius: 4px;
    transition: all 0.3s ease;
}

.card-back::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.5);
}

/* 添加内容过渡动画 */
.fortune-section {
    animation: fadeInUp 0.5s ease-out;
}

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

/* 吸顶导航头部 */
.sticky-header {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    background: rgba(0, 0, 0, 0.4);
    backdrop-filter: blur(12px);
    z-index: 1000;
    padding: 1rem 2rem;
    box-shadow: 0 0 30px rgba(0, 0, 0, 0.3);
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    transition: all 0.3s ease;
}

.sticky-header.scrolled {
    background: rgba(0, 0, 0, 0.6);
    box-shadow: 0 0 40px rgba(0, 0, 0, 0.5);
}

.header-content {
    max-width: 1200px;
    margin: 0 auto;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.logo {
    display: flex;
    align-items: center;
    gap: 1rem;
    text-decoration: none;
    color: #fff;
    transition: all 0.3s ease;
}

.logo:hover {
    transform: scale(1.05);
    text-shadow: 0 0 10px rgba(255, 255, 255, 0.5);
}

.logo img {
    height: 40px;
    width: auto;
    filter: drop-shadow(0 0 8px rgba(255, 255, 255, 0.6));
}

.site-name {
    font-size: 1.5rem;
    font-weight: bold;
    color: #fff;
    text-shadow: 0 0 15px rgba(255, 255, 255, 0.6);
    letter-spacing: 2px;
}

/* 底部footer */
.site-footer {
    background: rgba(0, 0, 0, 0.3);
    backdrop-filter: blur(15px);
    color: #fff;
    padding: 3rem 2rem;
    margin-top: 4rem;
    border-top: 1px solid rgba(255, 255, 255, 0.05);
    position: relative;
    overflow: hidden;
}

.site-footer::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 1px;
    background: linear-gradient(90deg, 
        transparent, 
        rgba(255, 255, 255, 0.1), 
        rgba(255, 255, 255, 0.2), 
        rgba(255, 255, 255, 0.1), 
        transparent);
}

.footer-content {
    max-width: 1200px;
    margin: 0 auto;
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 4rem;
    position: relative;
    z-index: 1;
}

.disclaimer {
    color: rgba(255, 255, 255, 0.8);
    line-height: 1.8;
    padding-right: 2rem;
    border-right: 1px solid rgba(255, 255, 255, 0.1);
}

.disclaimer p {
    margin: 0.5rem 0;
    text-shadow: 0 0 10px rgba(255, 255, 255, 0.2);
    font-size: 0.95rem;
}

.author-info {
    text-align: left;
    color: rgba(255, 255, 255, 0.8);
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.author-info p {
    margin: 0;
    text-shadow: 0 0 10px rgba(255, 255, 255, 0.2);
    font-size: 0.95rem;
    line-height: 1.6;
}

.author-info p:first-child {
    font-weight: bold;
    color: #fff;
    font-size: 1.1rem;
    margin-bottom: 0.5rem;
}

.author-info p:nth-child(2) {
    color: rgba(255, 255, 255, 0.7);
    margin-bottom: 0.5rem;
}

/* 响应式设计 */
@media (max-width: 768px) {
    .footer-content {
        grid-template-columns: 1fr;
        gap: 2rem;
    }
    
    .disclaimer {
        padding-right: 0;
        border-right: none;
        border-bottom: 1px solid rgba(255, 255, 255, 0.1);
        padding-bottom: 2rem;
    }
    
    .author-info {
        text-align: left;
    }
}

.error-message {
    position: fixed;
    top: 20px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(0, 0, 0, 0.8);
    color: white;
    padding: 15px 25px;
    border-radius: 8px;
    z-index: 1000;
    text-align: center;
    line-height: 1.5;
    max-width: 80%;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    animation: slideIn 0.3s ease-out;
    opacity: 1;
    transition: opacity 0.5s ease;
}

.error-message.fade-out {
    opacity: 0;
}

@keyframes slideIn {
    from {
        transform: translate(-50%, -100%);
        opacity: 0;
    }
    to {
        transform: translate(-50%, 0);
        opacity: 1;
    }
}

.action-buttons {
    display: flex;
    gap: 10px;
    margin-top: 20px;
    justify-content: center;
}

.copy-button,
.poster-button {
    padding: 8px 16px;
    border: none;
    border-radius: 20px;
    background: rgba(255, 255, 255, 0.2);
    color: white;
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: 14px;
    backdrop-filter: blur(5px);
}

.copy-button:hover,
.poster-button:hover {
    background: rgba(255, 255, 255, 0.3);
    transform: translateY(-2px);
}

.message-toast {
    position: fixed;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(0, 0, 0, 0.8);
    color: white;
    padding: 12px 24px;
    border-radius: 20px;
    z-index: 1000;
    animation: fadeIn 0.3s ease;
}

.message-toast.fade-out {
    animation: fadeOut 0.3s ease forwards;
}

.fortune-poster {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.85);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
    padding: 20px;
    box-sizing: border-box;
}

.poster-container {
    position: relative;
    background: #1a1a2e;
    border-radius: 15px;
    padding: 20px;
    width: 90%;
    max-width: 360px; /* 限制最大宽度 */
    max-height: 90vh;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.5);
}

.poster-close {
    position: absolute;
    top: 10px;
    right: 10px;
    background: none;
    border: none;
    color: #fff;
    font-size: 24px;
    cursor: pointer;
    padding: 5px;
    line-height: 1;
    opacity: 0.7;
    transition: opacity 0.3s;
}

.poster-close:hover {
    opacity: 1;
}

.poster-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 15px;
    margin-bottom: 15px;
    height: 100%;
}

.poster-image {
    width: 100%;
    height: auto;
    max-height: 60%; /* 限制图片最大高度 */
    object-fit: contain; /* 保持图片比例 */
    border-radius: 10px;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.3);
}

.poster-text {
    text-align: center;
    color: #fff;
    padding: 15px;
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    justify-content: center;
    min-height: 40%; /* 确保文本区域有最小高度 */
}

.poster-text h2 {
    font-size: 1.5em;
    margin-bottom: 8px;
    color: #ffd700;
}

.poster-date {
    font-size: 1em;
    color: #888;
    margin-bottom: 10px;
}

.poster-fortune {
    font-size: 0.9em;
    line-height: 1.5;
    margin: 0 auto;
}

.poster-actions {
    display: flex;
    justify-content: center;
    gap: 10px;
    margin-top: 15px;
}

.poster-tip {
    font-size: 0.8em;
    color: #888;
    margin-bottom: 10px;
    text-align: center;
}

.poster-button {
    padding: 8px 20px;
    border: none;
    border-radius: 20px;
    font-size: 0.9em;
    cursor: pointer;
    transition: all 0.3s;
    font-weight: 500;
}

.download-button {
    background: #4CAF50;
    color: white;
}

.download-button:hover {
    background: #45a049;
}

.download-button:disabled {
    background: #ccc;
    cursor: not-allowed;
}

.close-button {
    color: white;
}

.close-button:hover {
    background: #da190b;
}

/* 响应式调整 */
@media (max-width: 768px) {
    .poster-container {
        padding: 15px;
        max-width: 320px;
    }
    
    .poster-text h2 {
        font-size: 1.3em;
    }
    
    .poster-date {
        font-size: 0.9em;
    }
    
    .poster-fortune {
        font-size: 0.85em;
    }
    
    .poster-button {
        padding: 7px 15px;
        font-size: 0.85em;
    }
}

@media (max-width: 480px) {
    .poster-container {
        padding: 12px;
        max-width: 280px;
    }
    
    .poster-text {
        padding: 12px 8px;
    }
    
    .poster-text h2 {
        font-size: 1.2em;
    }
    
    .poster-actions {
        flex-direction: column;
        gap: 8px;
    }
    
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translate(-50%, 20px);
    }
    to {
        opacity: 1;
        transform: translate(-50%, 0);
    }
}

@keyframes fadeOut {
    from {
        opacity: 1;
        transform: translate(-50%, 0);
    }
    to {
        opacity: 0;
        transform: translate(-50%, 20px);
    }
}