/* === 方案C: 主题系统 === */

/* CSS 变量体系 */
:root {
    --color-primary: #4CAF50;
    --color-primary-dark: #2E7D32;
    --color-primary-light: #e8f5e9;
    --color-bg: #f5f5f5;
    --color-surface: #ffffff;
    --color-text: #333333;
    --color-text-secondary: #666666;
    --color-text-muted: #999999;
    --color-border: #eeeeee;
    --color-header-bg: #2b2b2b;
    --color-header-text: #cccccc;
    --color-footer-bg: #2b2b2b;
    --color-footer-text: #aaaaaa;
    --color-code-bg: #e8f5e9;
    --color-code-text: #2E7D32;
    --color-tag-bg: #e8f5e9;
    --color-tag-text: #2E7D32;
    --shadow-card: 0 1px 3px rgba(0,0,0,.08);
    --shadow-card-hover: 0 4px 20px rgba(76,175,80,.15);
    --shadow-ci-hover: 0 6px 24px rgba(76,175,80,.2);
    --radius-sm: 4px;
    --radius-md: 6px;
    --radius-lg: 12px;
    --font-stack: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Noto Sans SC", "Microsoft YaHei", sans-serif;
    --space-xs: 4px;
    --space-sm: 8px;
    --space-md: 16px;
    --space-lg: 24px;
    --space-xl: 40px;
}

/* 暗色模式 */
[data-theme="dark"] {
    --color-bg: #1a1a2e;
    --color-surface: #16213e;
    --color-text: #e0e0e0;
    --color-text-secondary: #aaaaaa;
    --color-text-muted: #777777;
    --color-border: #2a2a4a;
    --color-header-bg: #0f3460;
    --color-header-text: #cccccc;
    --color-footer-bg: #0f3460;
    --color-footer-text: #888888;
    --color-code-bg: #1a3a2a;
    --color-code-text: #81c784;
    --color-tag-bg: #1a3a2a;
    --color-tag-text: #81c784;
    --color-primary-light: #1a3a2a;
    --shadow-card: 0 1px 3px rgba(0,0,0,.3);
    --shadow-card-hover: 0 4px 20px rgba(76,175,80,.25);
    --shadow-ci-hover: 0 6px 24px rgba(76,175,80,.3);
}

/* 全局基础 */
* { margin: 0; padding: 0; box-sizing: border-box; }
body {
    font-family: var(--font-stack);
    color: var(--color-text);
    background: var(--color-bg);
    line-height: 1.6;
    transition: background .3s, color .3s;
}
a { text-decoration: none; color: inherit; transition: color .2s; }
a:hover { color: var(--color-primary); }

/* 组件: .btn */
.btn {
    display: inline-block;
    padding: 10px 28px;
    border-radius: var(--radius-sm);
    font-weight: 600;
    font-size: 15px;
    cursor: pointer;
    border: none;
    transition: all .3s ease;
}
.btn-primary {
    background: var(--color-surface);
    color: var(--color-primary-dark);
}
.btn-primary:hover {
    background: var(--color-primary-light);
    color: var(--color-primary-dark);
    transform: translateY(-2px);
    box-shadow: 0 4px 16px rgba(46,125,50,.3);
}

/* 组件: .card */
.card {
    background: var(--color-surface);
    border-radius: var(--radius-md);
    padding: var(--space-lg);
    margin-bottom: 20px;
    box-shadow: var(--shadow-card);
    transition: box-shadow .3s ease, transform .3s ease, background .3s;
}
.card:hover {
    box-shadow: var(--shadow-card-hover);
    transform: translateY(-2px);
}
.card h2 {
    font-size: 1.3em;
    margin-bottom: 14px;
    padding-bottom: 10px;
    border-bottom: 2px solid var(--color-primary);
    display: flex;
    align-items: center;
    gap: 10px;
}

/* 组件: .tag */
.tag {
    display: inline-block;
    background: var(--color-tag-bg);
    color: var(--color-tag-text);
    font-size: 12px;
    padding: 3px 12px;
    border-radius: var(--radius-lg);
    margin-bottom: 8px;
    font-weight: 500;
    transition: background .2s, color .2s;
}

/* 组件: .ci (content item card) */
.ci {
    background: var(--color-bg);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    padding: 18px;
    transition: transform .25s ease, box-shadow .25s ease, border-color .25s ease, background .3s;
    cursor: pointer;
}
.ci:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-ci-hover);
    border-color: var(--color-primary);
}
.ci:hover .tag { background: var(--color-primary); color: #fff; }
.ci h3 { font-size: 1.05em; margin-bottom: 6px; color: var(--color-text); }
.ci p { font-size: .88em; color: var(--color-text-secondary); }

/* 暗色模式切换按钮 */
.theme-toggle {
    background: none;
    border: 1px solid var(--color-header-text);
    color: var(--color-header-text);
    border-radius: var(--radius-sm);
    padding: 4px 10px;
    font-size: 14px;
    cursor: pointer;
    transition: all .2s;
    margin-left: 12px;
}
.theme-toggle:hover { background: rgba(255,255,255,.1); }

/* 响应式断点规范化 */
@media (max-width: 768px) {
    :root { --space-lg: 16px; --space-xl: 24px; }
}

/* 暗色模式 Hero 适配 */
[data-theme="dark"] .hero {
    background: linear-gradient(135deg, #0f3460 0%, #1a1a2e 50%, #16213e 100%);
}
[data-theme="dark"] .hero::before {
    background: radial-gradient(circle at 30% 40%, rgba(76,175,80,.08) 0%, transparent 60%),
                radial-gradient(circle at 70% 80%, rgba(100,181,246,.06) 0%, transparent 50%);
}
[data-theme="dark"] .hero { color: #ffffff; }
[data-theme="dark"] .hero h1 { color: #ffffff; text-shadow: 0 2px 16px rgba(0,0,0,.6), 0 0 40px rgba(76,175,80,.2); }
[data-theme="dark"] .hero p { color: rgba(255,255,255,.9); text-shadow: 0 1px 8px rgba(0,0,0,.5); opacity: 1; }
[data-theme="dark"] .btn-primary { background: #4CAF50; color: #fff; border: none; }
[data-theme="dark"] .btn-primary:hover { background: #66BB6A; color: #fff; box-shadow: 0 4px 20px rgba(76,175,80,.4); }

/* === 鼠标交互优化 === */

/* 全局可点击元素统一手型光标 */
a, button, .ci, .tag, [onclick], [role="button"], summary, label[for] {
    cursor: pointer;
}

/* 文本区域保持文字光标 */
input, textarea, [contenteditable] {
    cursor: text;
}

/* 禁用状态 */
:disabled, [aria-disabled="true"] {
    cursor: not-allowed; opacity: .5;
}

/* 拖拽提示 */
[draggable="true"] {
    cursor: grab;
}
[draggable="true"]:active {
    cursor: grabbing;
}

/* 链接悬停缩放微反馈 */
.ll a, .footer-nav a, a.back {
    transition: color .2s, transform .15s ease;
    display: inline-block;
}
.ll a:hover, .footer-nav a:hover, a.back:hover {
    transform: translateX(3px);
}

/* 内容卡片鼠标按下反馈 */
a.ci:active {
    transform: translateY(-1px) scale(.985);
    box-shadow: var(--shadow-card);
    transition-duration: .08s;
}

/* 按钮按下反馈 */
.btn:active, .theme-toggle:active, .theme-toggle-content:active, #quiz-btn:active {
    transform: scale(.96);
    transition-duration: .08s;
}

/* 代码复制按钮按下 */
.copy-btn:active {
    transform: scale(.92);
}

/* 选中文本高亮色（与主题一致） */
::selection {
    background: rgba(76, 175, 80, .25);
    color: inherit;
}
[data-theme="dark"] ::selection {
    background: rgba(76, 175, 80, .35);
    color: #fff;
}

/* 焦点可见性（键盘导航友好） */
:focus-visible {
    outline: 2px solid var(--color-primary);
    outline-offset: 2px;
    border-radius: var(--radius-sm);
}
a:focus:not(:focus-visible), button:focus:not(:focus-visible) {
    outline: none;
}

/* 滚动条美化（Webkit） */
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb {
    background: rgba(76, 175, 80, .3);
    border-radius: 4px;
}
::-webkit-scrollbar-thumb:hover {
    background: rgba(76, 175, 80, .5);
}
[data-theme="dark"] ::-webkit-scrollbar-thumb {
    background: rgba(76, 175, 80, .25);
}
[data-theme="dark"] ::-webkit-scrollbar-thumb:hover {
    background: rgba(76, 175, 80, .45);
}

/* === 进阶鼠标视觉增强 === */

/* 光标跟随光晕 */
.cursor-glow {
    position: fixed;
    width: 320px;
    height: 320px;
    border-radius: 50%;
    pointer-events: none;
    z-index: 9999;
    transform: translate(-50%, -50%);
    background: radial-gradient(circle, rgba(76,175,80,.07) 0%, transparent 70%);
    transition: opacity .3s;
    mix-blend-mode: multiply;
}
[data-theme="dark"] .cursor-glow {
    background: radial-gradient(circle, rgba(76,175,80,.06) 0%, rgba(100,181,246,.03) 40%, transparent 70%);
    mix-blend-mode: screen;
}
.cursor-glow.hidden { opacity: 0; }

/* 卡片 3D 倾斜容器 */
.ci-tilt {
    transform-style: preserve-3d;
    perspective: 800px;
}
.ci-tilt-inner {
    transition: transform .15s ease-out;
    transform: rotateX(0) rotateY(0);
}

/* 点击涟漪 */
.ripple {
    position: absolute;
    border-radius: 50%;
    background: rgba(76,175,80,.3);
    transform: scale(0);
    animation: rippleAnim .5s ease-out forwards;
    pointer-events: none;
    z-index: 1;
}
[data-theme="dark"] .ripple {
    background: rgba(76,175,80,.2);
}
@keyframes rippleAnim {
    to { transform: scale(4); opacity: 0; }
}

/* 移动端禁用所有鼠标特效 */
@media (hover: none) and (pointer: coarse) {
    .cursor-glow { display: none !important; }
    .ripple { display: none !important; }
}
