/* ========================================
   二次元风格主题样式
   ======================================== */

/* 浮动星星背景 */
.stars {
    position: absolute;
    width: 100%;
    height: 100%;
    background-image: 
        radial-gradient(2px 2px at 20% 30%, white, transparent),
        radial-gradient(2px 2px at 60% 70%, white, transparent),
        radial-gradient(1px 1px at 50% 50%, white, transparent),
        radial-gradient(1px 1px at 80% 10%, white, transparent),
        radial-gradient(2px 2px at 90% 60%, white, transparent),
        radial-gradient(1px 1px at 33% 80%, white, transparent),
        radial-gradient(2px 2px at 70% 40%, white, transparent);
    background-size: 200% 200%;
    animation: twinkle 20s linear infinite;
    opacity: 0.3;
}

[data-theme="dark"] .stars {
    opacity: 0.6;
}

@keyframes twinkle {
    0% { background-position: 0 0, 0 0, 0 0, 0 0, 0 0, 0 0, 0 0; }
    100% { background-position: 100% 100%, -100% -100%, 100% -100%, -100% 100%, 100% 50%, -100% -50%, 50% 100%; }
}

/* 樱花飘落效果 */
.sakura {
    position: absolute;
    width: 100%;
    height: 100%;
}

.sakura::before,
.sakura::after {
    content: '🌸';
    position: absolute;
    font-size: 20px;
    opacity: 0.6;
    animation: fall 15s linear infinite;
}

.sakura::before {
    left: 10%;
    animation-delay: 0s;
}

.sakura::after {
    left: 80%;
    animation-delay: 7s;
}

@keyframes fall {
    0% {
        top: -10%;
        transform: translateX(0) rotate(0deg);
    }
    100% {
        top: 110%;
        transform: translateX(100px) rotate(360deg);
    }
}

/* 平滑滚动 */
html {
    scroll-behavior: smooth;
}

/* 深色模式渐变背景 */
[data-theme="dark"] body {
    background-image: 
        radial-gradient(ellipse at top, rgba(59, 130, 246, 0.1), transparent),
        radial-gradient(ellipse at bottom, rgba(236, 72, 153, 0.1), transparent);
}

/* 链接样式 */
a {
    transition: color 0.2s;
}

/* 选中文本样式 */
::selection {
    background: linear-gradient(to right, #EC4899, #8B5CF6);
    color: white;
}

/* 代码块美化 */
code {
    padding: 0.2rem 0.4rem;
    background: linear-gradient(to right, rgba(236, 72, 153, 0.1), rgba(139, 92, 246, 0.1));
    border-radius: 0.375rem;
    font-size: 0.875em;
    font-weight: 600;
}

pre code {
    padding: 0;
    background: none;
}

pre {
    padding: 1.5rem;
    background: linear-gradient(135deg, rgba(236, 72, 153, 0.05), rgba(59, 130, 246, 0.05)) !important;
    border-radius: 1.5rem;
    border: 1px solid rgba(236, 72, 153, 0.2);
    overflow-x: auto;
}

[data-theme="dark"] pre {
    background: linear-gradient(135deg, rgba(236, 72, 153, 0.1), rgba(59, 130, 246, 0.1)) !important;
    border-color: rgba(236, 72, 153, 0.3);
}

/* 滚动条美化 */
::-webkit-scrollbar {
    width: 10px;
    height: 10px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: linear-gradient(to bottom, #EC4899, #8B5CF6);
    border-radius: 5px;
}

::-webkit-scrollbar-thumb:hover {
    background: linear-gradient(to bottom, #DB2777, #7C3AED);
}

/* 图片加载动画 */
img {
    transition: transform 0.3s, opacity 0.3s;
}

img:not([src]) {
    opacity: 0;
}

/* 表格样式 */
table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    border-radius: 1rem;
    overflow: hidden;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
}

th {
    background: linear-gradient(to right, #EC4899, #8B5CF6);
    color: white;
    padding: 1rem;
    font-weight: 700;
    text-align: left;
}

td {
    padding: 1rem;
    border-bottom: 1px solid rgba(236, 72, 153, 0.1);
}

tr:hover td {
    background: rgba(236, 72, 153, 0.05);
}

/* 引用块样式 */
blockquote {
    padding: 1.5rem;
    margin: 1.5rem 0;
    background: linear-gradient(to right, rgba(236, 72, 153, 0.1), rgba(59, 130, 246, 0.1));
    border-left: 4px solid #EC4899;
    border-radius: 0 1rem 1rem 0;
}

blockquote p {
    margin: 0;
}

/* 按钮基础样式 */
button {
    cursor: pointer;
    user-select: none;
}

button:active {
    transform: scale(0.95);
}

/* 响应式调整 */
@media (max-width: 768px) {
    .sakura::before,
    .sakura::after {
        font-size: 15px;
    }
}

/* 加载动画 */
@keyframes pulse-slow {
    0%, 100% {
        opacity: 1;
    }
    50% {
        opacity: 0.5;
    }
}

.animate-pulse-slow {
    animation: pulse-slow 3s cubic-bezier(0.4, 0, 0.6, 1) infinite;
}

/* 打字机效果（可选） */
@keyframes typing {
    from { width: 0; }
    to { width: 100%; }
}

.typing-effect {
    overflow: hidden;
    white-space: nowrap;
    animation: typing 3s steps(40, end);
}
