/**
 * style.css - 毒鸡汤全局样式（优化版）
 * 优化：性能、可访问性、响应式设计
 */

/* ==================== CSS变量（便于主题切换）==================== */
:root {
    --bg-color: #1e3c72;
    --vh: 1vh;
    --card-bg: rgba(255, 255, 255, 0.1);
    --card-border: rgba(255, 255, 255, 0.2);
    --text-color: #ffffff;
    --text-secondary: rgba(255, 255, 255, 0.7);
    --text-muted: rgba(255, 255, 255, 0.45);
    --button-bg: rgba(255, 255, 255, 0.2);
    --button-hover: rgba(255, 255, 255, 0.3);
    --shadow: 0 15px 35px rgba(0, 0, 0, 0.2);
    --transition: all 0.3s ease;
}

/* ==================== 全局重置 ==================== */
*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

/* ==================== 主体样式 ==================== */
body {
    margin: 0;
    padding: 0;
    height: 100vh;
    height: calc(var(--vh) * 100);
    height: 100dvh; /* 支持动态视口高度 */
    
    display: flex;
    justify-content: center;
    align-items: center;
    
    background: linear-gradient(135deg, var(--bg-color) 0%, #2a5298 100%);
    font-family: 'PingFang SC', 'Microsoft YaHei', 'Noto Sans SC', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    
    transition: background 1s ease;
    overflow: hidden;
    position: relative;
    
    /* 防止滚动（移动端） */
    overscroll-behavior: none;
}

/* ==================== 跳过导航链接（可访问性）==================== */
.skip-link {
    position: absolute;
    top: -40px;
    left: 0;
    background: #fff;
    color: #1e3c72;
    padding: 8px 16px;
    text-decoration: none;
    border-radius: 0 0 4px 0;
    z-index: 1000;
    transition: top 0.3s;
}

.skip-link:focus {
    top: 0;
}

/* ==================== 玻璃态卡片 ==================== */
.glass-card {
    background: var(--card-bg);
    backdrop-filter: blur(15px);
    -webkit-backdrop-filter: blur(15px);
    
    border: 1px solid var(--card-border);
    border-radius: 30px;
    
    padding: 50px 30px 40px 30px;
    width: 85%;
    max-width: 500px;
    
    text-align: center;
    box-shadow: var(--shadow);
    
    cursor: default;
    position: relative;
    z-index: 2;
    
    /* 允许文字选择 */
    user-select: none;
    -webkit-user-select: none;
    
    /* 硬件加速 */
    transform: translateZ(0);
    will-change: transform;
}

/* ==================== 站点标题 ==================== */
.site-title {
    font-size: 0.85rem;
    font-weight: normal;
    color: var(--text-muted);
    
    margin: 0 0 10px 0;
    letter-spacing: 3px;
    
    /* 防止选择 */
    user-select: none;
    -webkit-user-select: none;
}

/* ==================== 毒鸡汤文本 ==================== */
#soup-text {
    color: var(--text-color);
    font-size: 1.8rem;
    font-weight: bold;
    line-height: 1.6;
    
    min-height: 120px;
    max-height: 50vh;
    overflow-y: auto;
    
    display: flex;
    align-items: center;
    justify-content: center;
    
    margin: 0;
    word-break: break-word;
    word-wrap: break-word;
    
    /* 滚动条美化 */
    scrollbar-width: none; /* Firefox */
    -ms-overflow-style: none; /* IE/Edge */
    
    /* 允许文字选择（方便复制） */
    cursor: text;
    user-select: text;
    -webkit-user-select: text;
}

#soup-text::-webkit-scrollbar {
    display: none; /* Chrome/Safari/Opera */
}

/* ==================== 底部信息 ==================== */
.footer {
    margin-top: 40px;
    color: var(--text-secondary);
    font-size: 0.85rem;
    letter-spacing: 1px;
}

/* ==================== 按钮组 ==================== */
.btn-group {
    margin-top: 25px;
    display: flex;
    justify-content: center;
    gap: 12px;
    flex-wrap: wrap; /* 小屏幕换行 */
}

button {
    background: var(--button-bg);
    border: none;
    color: var(--text-color);
    
    padding: 12px 20px;
    min-width: 44px; /* 可访问性：最小触摸目标 */
    min-height: 44px;
    
    border-radius: 24px;
    font-size: 0.95rem;
    
    cursor: pointer;
    transition: var(--transition);
    outline: none;
    
    /* 防止文字选择 */
    user-select: none;
    -webkit-user-select: none;
    
    /* 硬件加速 */
    transform: translateZ(0);
}

button:hover:not(:disabled) {
    background: var(--button-hover);
}

button:active:not(:disabled) {
    transform: scale(0.96);
}

button:focus-visible {
    outline: 2px solid rgba(255, 255, 255, 0.8);
    outline-offset: 2px;
}

button:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

/* ==================== 底部备案信息 ==================== */
.page-beian {
    position: absolute;
    bottom: 15px;
    left: 0;
    width: 100%;
    
    display: flex;
    flex-direction: row;
    justify-content: center;
    align-items: center;
    gap: 20px;
    
    font-size: 0.75rem;
    z-index: 10;
    pointer-events: auto;
}

.page-beian a {
    color: var(--text-secondary);
    text-decoration: none;
    transition: color 0.3s ease;
    
    display: flex;
    align-items: center;
    gap: 4px;
}

.page-beian a:hover {
    color: rgba(255, 255, 255, 0.95);
}

.page-beian img {
    width: 14px;
    height: 14px;
    object-fit: contain;
    opacity: 0.6;
}

/* ==================== 分享遮罩 ==================== */
#share-mask {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(5px);
    -webkit-backdrop-filter: blur(5px);
    
    z-index: 999;
    
    flex-direction: column;
    align-items: center;
    justify-content: center;
    
    /* 防止滚动 */
    overscroll-behavior: contain;
}

#share-img {
    width: 80%;
    max-width: 400px;
    border-radius: 15px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
    pointer-events: auto;
    
    /* 防止拖拽 */
    -webkit-user-drag: none;
    user-drag: none;
}

.share-tip {
    color: white;
    margin-top: 20px;
    font-size: 0.9rem;
    letter-spacing: 1px;
    pointer-events: none;
}

.close-btn {
    margin-top: 20px;
    background: #ffffff;
    color: #333;
    font-weight: bold;
    pointer-events: auto;
}

.close-btn:hover {
    background: #f0f0f0;
}

/* ==================== 动画 ==================== */
.animate__animated {
    animation-duration: 0.4s;
    animation-fill-mode: both;
    will-change: transform, opacity; /* 硬件加速 */
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}
.animate__fadeIn {
    animation-name: fadeIn;
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translate3d(0, 15px, 0);
    }
    to {
        opacity: 1;
        transform: translate3d(0, 0, 0);
    }
}
.animate__fadeInUp {
    animation-name: fadeInUp;
}

@keyframes fadeOutDown {
    from {
        opacity: 1;
    }
    to {
        opacity: 0;
        transform: translate3d(0, 15px, 0);
    }
}
.animate__fadeOutDown {
    animation-name: fadeOutDown;
}

/* ==================== Toast 通知 ==================== */
#toast-container {
    position: fixed;
    top: 25px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 9999;
    
    display: flex;
    flex-direction: column;
    gap: 10px;
    pointer-events: none;
    
    /* 限制宽度 */
    max-width: 90vw;
}

.vanilla-toast {
    background: rgba(30, 30, 30, 0.9);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    
    color: #fff;
    padding: 12px 24px;
    border-radius: 50px;
    
    font-size: 0.95rem;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
    
    animation: toastIn 0.3s ease forwards;
    
    display: flex;
    align-items: center;
    gap: 8px;
    letter-spacing: 0.5px;
    
    /* 防止文字换行 */
    white-space: nowrap;
}

.vanilla-toast.toast-fade-out {
    animation: toastOut 0.3s ease forwards;
}

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

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

/* ==================== 响应式断点 ==================== */

/* 平板 (601px - 1024px) */
@media (min-width: 601px) and (max-width: 1024px) {
    .glass-card {
        max-width: 550px;
        padding: 55px 35px 45px 35px;
    }
    
    #soup-text {
        font-size: 2rem;
    }
}

/* 超大屏 (>= 1440px) */
@media (min-width: 1440px) {
    .glass-card {
        max-width: 600px;
        padding: 60px 40px 50px 40px;
    }
    
    #soup-text {
        font-size: 2.2rem;
    }
}

/* 横屏手机 */
@media (max-height: 500px) and (orientation: landscape) {
    .glass-card {
        padding: 20px 25px;
    }
    
    #soup-text {
        min-height: 60px;
        font-size: 1.4rem;
    }
    
    .btn-group {
        margin-top: 15px;
    }
    
    .footer {
        margin-top: 15px;
    }
    
    .page-beian {
        bottom: 5px;
    }
}

/* 小屏手机 */
@media (max-width: 375px) {
    .glass-card {
        padding: 40px 20px 30px 20px;
        width: 90%;
    }
    
    #soup-text {
        font-size: 1.5rem;
        min-height: 100px;
    }
    
    button {
        padding: 10px 16px;
        font-size: 0.85rem;
    }
}

/* 窄屏移动端备案文字 */
@media (max-width: 600px) {
    .page-beian {
        flex-direction: column;
        gap: 6px;
        bottom: 12px;
        font-size: 0.7rem;
    }
}

/* ==================== 深色模式 ==================== */
@media (prefers-color-scheme: dark) {
    :root {
        --bg-color: #0f1c3a;
        --card-bg: rgba(0, 0, 0, 0.4);
        --card-border: rgba(255, 255, 255, 0.05);
        --shadow: 0 15px 35px rgba(0, 0, 0, 0.6);
        --button-bg: rgba(255, 255, 255, 0.1);
        --button-hover: rgba(255, 255, 255, 0.2);
    }
    
    body {
        background: linear-gradient(135deg, #0f1c3a 0%, #15294a 100%);
    }
    
    #share-mask {
        background: rgba(0, 0, 0, 0.85);
    }
    
    .close-btn {
        background: #333;
        color: #ddd;
    }
    
    .close-btn:hover {
        background: #444;
    }
}

/* ==================== 减少动画（可访问性）==================== */
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
    
    body {
        transition: none !important;
    }
}

/* ==================== 打印样式 ==================== */
@media print {
    body {
        background: #fff;
        color: #333;
    }
    
    .glass-card {
        background: #fff;
        box-shadow: none;
        border: 1px solid #ddd;
    }
    
    #soup-text {
        color: #333;
    }
    
    .btn-group,
    .page-beian,
    #share-mask {
        display: none !important;
    }
}

/* ==================== 高对比度模式 ==================== */
@media (prefers-contrast: high) {
    :root {
        --card-bg: rgba(255, 255, 255, 0.2);
        --card-border: rgba(255, 255, 255, 0.5);
        --text-color: #ffffff;
        --button-bg: rgba(255, 255, 255, 0.3);
    }
}

/* ==================== 横屏适配（iPad等）==================== */
@media (orientation: landscape) and (min-width: 768px) {
    .glass-card {
        max-width: 600px;
        padding: 40px 50px;
    }
}

/* ==================== 鼠标悬停优化（桌面端）==================== */
@media (hover: hover) {
    .glass-card:hover {
        box-shadow: 0 20px 40px rgba(0, 0, 0, 0.3);
    }
}
