/* ===== 梦想岛 - 主样式表 ===== */

/* --- 基础重置与变量 --- */
*, *::before, *::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --primary: #6c5ce7;
    --primary-light: #a29bfe;
    --secondary: #00cec9;
    --accent: #fd79a8;
    --bg: #0a0a1a;
    --bg-surface: #12122a;
    --bg-card: #1a1a3e;
    --text: #ffffff;
    --text-secondary: #b8b8d0;
    --text-muted: #8888aa;
    --success: #00b894;
    --warning: #fdcb6e;
    --danger: #e17055;
    --radius: 16px;
    --radius-sm: 8px;
    --shadow: 0 8px 32px rgba(0,0,0,0.3);
    --glow: 0 0 20px rgba(108,92,231,0.3);
    --transition: 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* ===== 白天主题 ===== */
body.light-theme {
    --bg: #f0f4fa;
    --bg-surface: #f8f9fc;
    --bg-card: #ffffff;
    --text: #000000;
    --text-secondary: #2d2d2d;
    --text-muted: #555555;
    --shadow: 0 8px 32px rgba(0,0,0,0.08);
    --glow: 0 0 20px rgba(108,92,231,0.15);
}

body.light-theme {
    background: var(--bg);
    color: var(--text);
}

body.light-theme .navbar {
    background: rgba(255, 255, 255, 0.9);
    border-bottom: 1px solid rgba(0, 0, 0, 0.08);
}

body.light-theme .nav-link {
    color: var(--text-secondary);
}

body.light-theme .nav-link:hover,
body.light-theme .nav-link.active {
    color: var(--text);
    background: rgba(108, 92, 231, 0.12);
}

body.light-theme .nav-link.active {
    color: var(--primary);
    background: rgba(108, 92, 231, 0.15);
}

body.light-theme .mobile-menu {
    background: rgba(255, 255, 255, 0.98);
    border-bottom: 1px solid rgba(0, 0, 0, 0.08);
}

body.light-theme .mobile-link {
    color: var(--text);
}

body.light-theme .mobile-link:hover {
    background: rgba(108, 92, 231, 0.1);
}

body.light-theme .mobile-menu-btn {
    color: var(--text);
}

body.light-theme .feature-card,
body.light-theme .tool-card,
body.light-theme .game-container,
body.light-theme .joke-card,
body.light-theme .gallery-item {
    background: var(--bg-card);
    border-color: rgba(0, 0, 0, 0.08);
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.06);
}

body.light-theme .feature-card:hover,
body.light-theme .joke-card:hover,
body.light-theme .gallery-item:hover {
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.1);
    border-color: rgba(108, 92, 231, 0.3);
}

body.light-theme .stats-bar {
    background: var(--bg-card);
    border-color: rgba(0, 0, 0, 0.08);
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.06);
}

body.light-theme .hero-subtitle,
body.light-theme .title-line,
body.light-theme .section-header p,
body.light-theme .tool-desc,
body.light-theme .stat-label,
body.light-theme .footer-text,
body.light-theme .control-hint,
body.light-theme .art-label p,
body.light-theme .color-name,
body.light-theme .countdown-unit .label {
    color: var(--text-muted);
}

body.light-theme .feature-card h3,
body.light-theme .feature-card p,
body.light-theme .tool-card h3,
body.light-theme .joke-text,
body.light-theme .art-label h4,
body.light-theme .game-info,
body.light-theme .countdown-display {
    color: var(--text);
}

body.light-theme .footer-brand {
    color: var(--text);
}

body.light-theme .game-tab {
    background: var(--bg-surface);
    color: var(--text-secondary);
    border-color: rgba(0, 0, 0, 0.1);
}

body.light-theme .game-tab:hover {
    background: rgba(108, 92, 231, 0.1);
    color: var(--text);
}

body.light-theme .game-tab.active {
    background: linear-gradient(135deg, var(--primary), var(--primary-light));
    color: #ffffff;
}

body.light-theme .game-controls {
    background: var(--bg-surface);
    border-color: rgba(0, 0, 0, 0.06);
}

body.light-theme .d-btn {
    background: var(--bg-surface);
    border-color: rgba(0, 0, 0, 0.1);
    color: var(--text);
}

body.light-theme .d-btn:hover {
    background: rgba(108, 92, 231, 0.15);
}

body.light-theme .typing-input,
body.light-theme .countdown-input {
    background: var(--bg-surface);
    border-color: rgba(0, 0, 0, 0.12);
    color: var(--text);
}

body.light-theme .typing-input::placeholder,
body.light-theme .countdown-input::placeholder {
    color: var(--text-muted);
}

body.light-theme .fortune-result,
body.light-theme .name-result,
body.light-theme .color-result,
body.light-theme .countdown-display {
    background: var(--bg-surface);
    color: var(--text);
}

body.light-theme .mood-btn {
    background: var(--bg-surface);
    border-color: rgba(0, 0, 0, 0.1);
    color: var(--text);
}

body.light-theme .mood-btn:hover,
body.light-theme .mood-btn.active {
    background: rgba(108, 92, 231, 0.12);
    border-color: var(--primary);
    color: var(--text);
}

body.light-theme .joke-cat {
    background: var(--bg-surface);
    border-color: rgba(0, 0, 0, 0.1);
    color: var(--text-secondary);
}

body.light-theme .joke-cat:hover,
body.light-theme .joke-cat.active {
    background: rgba(108, 92, 231, 0.12);
    color: var(--text);
    border-color: var(--primary);
}

body.light-theme .joke-tag {
    background: rgba(108, 92, 231, 0.12);
    color: var(--primary);
}

body.light-theme .joke-answer {
    color: var(--secondary);
}

body.light-theme .joke-answer.hidden {
    color: transparent;
    text-shadow: 0 0 8px rgba(108, 92, 231, 0.3);
}

body.light-theme .memory-card-back {
    background: var(--bg-surface);
    border-color: rgba(108, 92, 231, 0.3);
}

body.light-theme .grid-2048 {
    background: var(--bg-surface);
    border-color: rgba(0, 0, 0, 0.08);
}

body.light-theme .tile-2048 {
    background: var(--bg-surface);
    color: var(--text);
    border: 1px solid rgba(0,0,0,0.06);
}

body.light-theme .dice {
    background: var(--bg-surface);
    border-color: rgba(108, 92, 231, 0.2);
}

body.light-theme .footer {
    background: transparent;
    border-top: 1px solid rgba(0, 0, 0, 0.08);
    color: var(--text-muted);
}

body.light-theme .back-to-top {
    background: var(--primary);
    color: #ffffff;
}

body.light-theme .btn-secondary {
    background: rgba(108, 92, 231, 0.1);
    color: var(--primary);
    border-color: rgba(108, 92, 231, 0.25);
}

body.light-theme .btn-secondary:hover {
    background: rgba(108, 92, 231, 0.2);
}

body.light-theme .color-preview {
    border-color: rgba(0, 0, 0, 0.1);
}

body.light-theme #starfield {
    opacity: 0.15;
}

body.light-theme .floating-island {
    opacity: 0.6;
}

body.light-theme .island-base {
    background: linear-gradient(135deg, #b8a9e8, #9b8fd4);
}

/* --- 主题切换按钮 --- */
.nav-right {
    display: flex;
    align-items: center;
    gap: 12px;
}

.theme-toggle {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 8px 14px;
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 20px;
    color: var(--text);
    cursor: pointer;
    font-size: 14px;
    transition: var(--transition);
    white-space: nowrap;
}

.theme-toggle:hover {
    background: rgba(255, 255, 255, 0.2);
    transform: scale(1.05);
}

body.light-theme .theme-toggle {
    background: rgba(108, 92, 231, 0.1);
    border-color: rgba(108, 92, 231, 0.2);
    color: #6c5ce7;
}

body.light-theme .theme-toggle:hover {
    background: rgba(108, 92, 231, 0.2);
}

.theme-icon {
    font-size: 18px;
    transition: transform 0.5s ease;
}

.theme-toggle:active .theme-icon {
    transform: rotate(360deg);
}

html {
    scroll-behavior: smooth;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'PingFang SC', 'Microsoft YaHei', sans-serif;
    background: var(--bg);
    color: var(--text);
    min-height: 100vh;
    overflow-x: hidden;
    line-height: 1.6;
}

/* --- 星空背景 --- */
#starfield {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 0;
    pointer-events: none;
}

/* --- 导航栏 --- */
.navbar {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 2rem;
    height: 64px;
    background: rgba(10, 10, 26, 0.85);
    backdrop-filter: blur(20px);
    border-bottom: 1px solid rgba(108, 92, 231, 0.2);
    transition: var(--transition);
}

.navbar.scrolled {
    box-shadow: 0 4px 20px rgba(0,0,0,0.4);
}

.nav-brand {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 1.4rem;
    font-weight: 700;
    cursor: pointer;
}

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

.brand-text {
    background: linear-gradient(135deg, var(--primary-light), var(--secondary));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.nav-links {
    display: flex;
    list-style: none;
    gap: 0.5rem;
}

.nav-link {
    color: var(--text-muted);
    text-decoration: none;
    padding: 0.5rem 1rem;
    border-radius: var(--radius-sm);
    transition: var(--transition);
    font-size: 0.95rem;
}

.nav-link:hover, .nav-link.active {
    color: var(--text);
    background: rgba(108, 92, 231, 0.2);
}

.nav-link.active {
    background: rgba(108, 92, 231, 0.3);
    color: var(--primary-light);
}

.mobile-menu-btn {
    display: none;
    background: none;
    border: none;
    color: var(--text);
    font-size: 1.5rem;
    cursor: pointer;
}

.mobile-menu {
    display: none;
    position: fixed;
    top: 64px;
    left: 0;
    right: 0;
    background: rgba(10, 10, 26, 0.95);
    backdrop-filter: blur(20px);
    z-index: 999;
    padding: 1rem;
    flex-direction: column;
    gap: 0.5rem;
    border-bottom: 1px solid rgba(108,92,231,0.2);
}

.mobile-menu.show {
    display: flex;
}

.mobile-link {
    color: var(--text);
    text-decoration: none;
    padding: 0.8rem 1rem;
    border-radius: var(--radius-sm);
    transition: var(--transition);
}

.mobile-link:hover {
    background: rgba(108,92,231,0.2);
}

/* --- 区域通用 --- */
.section {
    display: none;
    position: relative;
    z-index: 1;
    min-height: 100vh;
    padding: 80px 2rem 2rem;
    max-width: 1200px;
    margin: 0 auto;
}

.section.active {
    display: block;
    animation: fadeIn 0.5s ease;
}

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

.section-header {
    text-align: center;
    margin-bottom: 2.5rem;
}

.section-header h2 {
    font-size: 2.2rem;
    margin-bottom: 0.5rem;
    background: linear-gradient(135deg, var(--primary-light), var(--secondary));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.section-header p {
    color: var(--text-muted);
    font-size: 1.1rem;
}

/* --- 按钮 --- */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.75rem 1.5rem;
    border: none;
    border-radius: var(--radius-sm);
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
    font-family: inherit;
}

.btn-primary {
    background: linear-gradient(135deg, var(--primary), var(--primary-light));
    color: #fff;
    box-shadow: 0 4px 15px rgba(108,92,231,0.4);
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 25px rgba(108,92,231,0.5);
}

.btn-secondary {
    background: rgba(108,92,231,0.15);
    color: var(--primary-light);
    border: 1px solid rgba(108,92,231,0.3);
}

.btn-secondary:hover {
    background: rgba(108,92,231,0.25);
    transform: translateY(-2px);
}

/* --- 首页 Hero --- */
.hero {
    display: flex;
    align-items: center;
    justify-content: space-between;
    min-height: 70vh;
    padding: 2rem 0;
    gap: 2rem;
}

.hero-content {
    flex: 1;
}

.hero-title {
    margin-bottom: 1.5rem;
}

.title-line {
    display: block;
    font-size: 1.5rem;
    color: var(--text-muted);
    font-weight: 400;
    margin-bottom: 0.3rem;
}

.title-main {
    display: block;
    font-size: 4rem;
    font-weight: 800;
    background: linear-gradient(135deg, #6c5ce7, #a29bfe, #00cec9, #fd79a8);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    background-size: 300% 300%;
    animation: gradientShift 4s ease infinite;
}

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

.hero-subtitle {
    font-size: 1.2rem;
    color: var(--text-muted);
    margin-bottom: 2rem;
    max-width: 500px;
}

.hero-buttons {
    display: flex;
    gap: 1rem;
    flex-wrap: wrap;
}

.hero-decoration {
    flex: 1;
    display: flex;
    justify-content: center;
    align-items: center;
}

.floating-island {
    position: relative;
    width: 280px;
    height: 280px;
    animation: float 4s ease-in-out infinite;
}

@keyframes float {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-20px); }
}

.island-base {
    position: absolute;
    bottom: 60px;
    left: 50%;
    transform: translateX(-50%);
    width: 200px;
    height: 80px;
    background: linear-gradient(135deg, #2d1b69, #1a1a3e);
    border-radius: 50%;
    box-shadow: 0 20px 40px rgba(0,0,0,0.4), 0 0 60px rgba(108,92,231,0.2);
}

.island-palm {
    position: absolute;
    bottom: 110px;
    left: 50%;
    transform: translateX(-50%);
    font-size: 5rem;
    filter: drop-shadow(0 4px 8px rgba(0,0,0,0.3));
}

.island-star {
    position: absolute;
    animation: twinkle 2s ease-in-out infinite;
}

.island-star.s1 { top: 20px; left: 40px; font-size: 1.5rem; animation-delay: 0s; }
.island-star.s2 { top: 40px; right: 30px; font-size: 1.2rem; animation-delay: 0.5s; }
.island-star.s3 { top: 10px; right: 80px; font-size: 1rem; animation-delay: 1s; }

.island-cloud {
    position: absolute;
    opacity: 0.6;
    animation: cloudDrift 6s ease-in-out infinite;
}

.island-cloud.c1 { top: 60px; left: -20px; font-size: 2rem; }
.island-cloud.c2 { top: 30px; right: -10px; font-size: 1.5rem; animation-delay: 2s; }

@keyframes twinkle {
    0%, 100% { opacity: 1; transform: scale(1); }
    50% { opacity: 0.4; transform: scale(0.8); }
}

@keyframes cloudDrift {
    0%, 100% { transform: translateX(0); }
    50% { transform: translateX(15px); }
}

/* --- 数据统计 --- */
.stats-bar {
    display: flex;
    justify-content: center;
    gap: 3rem;
    padding: 2rem;
    margin: 2rem 0;
    background: rgba(26,26,62,0.5);
    border-radius: var(--radius);
    border: 1px solid rgba(108,92,231,0.15);
    flex-wrap: wrap;
}

.stat-item {
    text-align: center;
}

.stat-number {
    display: block;
    font-size: 2.5rem;
    font-weight: 800;
    background: linear-gradient(135deg, var(--primary-light), var(--secondary));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.stat-label {
    color: var(--text-muted);
    font-size: 0.9rem;
}

/* --- 功能卡片 --- */
.feature-cards {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 1.5rem;
    padding-bottom: 3rem;
}

.feature-card {
    background: var(--bg-card);
    border: 1px solid rgba(108,92,231,0.15);
    border-radius: var(--radius);
    padding: 2rem;
    text-align: center;
    cursor: pointer;
    transition: var(--transition);
    position: relative;
    overflow: hidden;
}

.feature-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: linear-gradient(90deg, var(--primary), var(--secondary));
    transform: scaleX(0);
    transition: var(--transition);
}

.feature-card:hover {
    transform: translateY(-8px);
    border-color: rgba(108,92,231,0.4);
    box-shadow: var(--glow);
}

.feature-card:hover::before {
    transform: scaleX(1);
}

.card-icon {
    font-size: 3rem;
    margin-bottom: 1rem;
}

.feature-card h3 {
    font-size: 1.2rem;
    margin-bottom: 0.5rem;
    color: var(--text);
}

.feature-card p {
    color: var(--text-muted);
    font-size: 0.9rem;
}

/* --- 游戏区域 --- */
.game-selector {
    margin-bottom: 2rem;
}

.game-tabs {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
    justify-content: center;
}

.game-tab {
    padding: 0.6rem 1.2rem;
    border: 1px solid rgba(108,92,231,0.2);
    background: rgba(26,26,62,0.5);
    color: var(--text-muted);
    border-radius: 999px;
    cursor: pointer;
    transition: var(--transition);
    font-size: 0.95rem;
    font-family: inherit;
}

.game-tab:hover, .game-tab.active {
    background: rgba(108,92,231,0.3);
    color: var(--text);
    border-color: var(--primary);
}

.game-container {
    display: none;
    flex-direction: column;
    align-items: center;
    gap: 1.5rem;
    padding: 2rem;
    background: var(--bg-card);
    border-radius: var(--radius);
    border: 1px solid rgba(108,92,231,0.15);
}

.game-container.active {
    display: flex;
    animation: fadeIn 0.4s ease;
}

.game-info {
    display: flex;
    gap: 2rem;
    font-size: 1rem;
    color: var(--text-muted);
    flex-wrap: wrap;
    justify-content: center;
}

.game-info strong {
    color: var(--secondary);
    font-size: 1.2rem;
}

.game-controls {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1rem;
}

.control-hint {
    color: var(--text-muted);
    font-size: 0.85rem;
}

/* 方向键 */
.d-pad {
    display: grid;
    grid-template-areas:
        ". up ."
        "left . right"
        ". down .";
    gap: 4px;
}

.d-btn {
    width: 48px;
    height: 48px;
    border: 1px solid rgba(108,92,231,0.3);
    background: rgba(26,26,62,0.8);
    color: var(--text);
    border-radius: var(--radius-sm);
    cursor: pointer;
    font-size: 1.2rem;
    transition: var(--transition);
    font-family: inherit;
}

.d-btn:hover {
    background: rgba(108,92,231,0.3);
}

.d-btn:active {
    transform: scale(0.9);
    background: var(--primary);
}

.d-up { grid-area: up; }
.d-down { grid-area: down; }
.d-left { grid-area: left; }
.d-right { grid-area: right; }

canvas {
    border-radius: var(--radius-sm);
    border: 1px solid rgba(108,92,231,0.2);
    max-width: 100%;
}

/* 记忆翻牌 */
.memory-board {
    display: grid;
    grid-template-columns: repeat(4, 80px);
    gap: 10px;
    justify-content: center;
}

.memory-card {
    width: 80px;
    height: 80px;
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: var(--transition);
    perspective: 600px;
    position: relative;
}

.memory-card-inner {
    width: 100%;
    height: 100%;
    position: relative;
    transform-style: preserve-3d;
    transition: transform 0.5s;
    border-radius: var(--radius-sm);
}

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

.memory-card-front, .memory-card-back {
    position: absolute;
    width: 100%;
    height: 100%;
    backface-visibility: hidden;
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2rem;
}

.memory-card-front {
    background: linear-gradient(135deg, var(--primary), var(--primary-light));
    color: #fff;
    font-size: 1.5rem;
}

.memory-card-back {
    background: var(--bg-surface);
    border: 2px solid rgba(108,92,231,0.3);
    transform: rotateY(180deg);
}

.memory-card.matched .memory-card-inner {
    transform: rotateY(180deg);
    box-shadow: 0 0 15px rgba(0,206,201,0.5);
}

.memory-card.matched .memory-card-back {
    border-color: var(--secondary);
}

/* 2048 */
.grid-2048 {
    display: grid;
    grid-template-columns: repeat(4, 80px);
    gap: 8px;
    padding: 12px;
    background: rgba(26,26,62,0.8);
    border-radius: var(--radius-sm);
    border: 1px solid rgba(108,92,231,0.2);
}

.tile-2048 {
    width: 80px;
    height: 80px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    font-weight: 700;
    border-radius: var(--radius-sm);
    background: rgba(10,10,26,0.5);
    color: var(--text);
    transition: var(--transition);
}

.tile-2048[data-value="2"] { background: #2d1b69; }
.tile-2048[data-value="4"] { background: #3d2b79; }
.tile-2048[data-value="8"] { background: #e17055; color: #fff; }
.tile-2048[data-value="16"] { background: #d63031; color: #fff; }
.tile-2048[data-value="32"] { background: #e84393; color: #fff; }
.tile-2048[data-value="64"] { background: #fd79a8; color: #fff; }
.tile-2048[data-value="128"] { background: #00cec9; color: #fff; font-size: 1.3rem; }
.tile-2048[data-value="256"] { background: #00b894; color: #fff; font-size: 1.3rem; }
.tile-2048[data-value="512"] { background: #6c5ce7; color: #fff; font-size: 1.3rem; }
.tile-2048[data-value="1024"] { background: #a29bfe; color: #fff; font-size: 1.1rem; }
.tile-2048[data-value="2048"] { background: #fdcb6e; color: #0a0a1a; font-size: 1.1rem; }

/* 打字挑战 */
.typing-area {
    text-align: center;
    width: 100%;
    max-width: 500px;
}

.typing-word {
    font-size: 2rem;
    font-weight: 700;
    margin-bottom: 1rem;
    min-height: 3rem;
    color: var(--primary-light);
}

.typing-input {
    width: 100%;
    padding: 0.8rem 1.2rem;
    font-size: 1.2rem;
    background: var(--bg-surface);
    border: 2px solid rgba(108,92,231,0.3);
    border-radius: var(--radius-sm);
    color: var(--text);
    text-align: center;
    outline: none;
    font-family: inherit;
}

.typing-input:focus {
    border-color: var(--primary);
}

.typing-progress {
    margin-top: 1rem;
    height: 6px;
    background: rgba(10,10,26,0.5);
    border-radius: 3px;
    overflow: hidden;
}

.typing-progress-bar {
    height: 100%;
    background: linear-gradient(90deg, var(--primary), var(--secondary));
    border-radius: 3px;
    transition: width 0.3s;
    width: 0%;
}

/* --- 趣味工具 --- */
.tools-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 1.5rem;
}

.tool-card {
    background: var(--bg-card);
    border: 1px solid rgba(108,92,231,0.15);
    border-radius: var(--radius);
    padding: 2rem;
    text-align: center;
    transition: var(--transition);
}

.tool-card:hover {
    border-color: rgba(108,92,231,0.3);
}

.tool-icon {
    font-size: 3rem;
    margin-bottom: 0.8rem;
}

.tool-card h3 {
    font-size: 1.2rem;
    margin-bottom: 0.5rem;
}

.tool-desc {
    color: var(--text-muted);
    font-size: 0.9rem;
    margin-bottom: 1rem;
}

.fortune-result {
    min-height: 80px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
    margin-bottom: 1rem;
    background: rgba(10,10,26,0.3);
    border-radius: var(--radius-sm);
    font-size: 0.95rem;
    line-height: 1.6;
}

.fortune-result .fortune-stars {
    color: var(--warning);
    font-size: 1.2rem;
    display: block;
    margin-bottom: 0.3rem;
}

.name-result {
    margin-bottom: 1rem;
    padding: 1rem;
    background: rgba(10,10,26,0.3);
    border-radius: var(--radius-sm);
}

.generated-name {
    font-size: 1.8rem;
    font-weight: 700;
    background: linear-gradient(135deg, var(--primary-light), var(--accent));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.mood-buttons {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
    justify-content: center;
    margin-bottom: 1rem;
}

.mood-btn {
    padding: 0.5rem 0.8rem;
    border: 1px solid rgba(108,92,231,0.2);
    background: rgba(26,26,62,0.5);
    color: var(--text);
    border-radius: 999px;
    cursor: pointer;
    transition: var(--transition);
    font-size: 0.85rem;
    font-family: inherit;
}

.mood-btn:hover, .mood-btn.active {
    background: rgba(108,92,231,0.3);
    border-color: var(--primary);
}

.color-result {
    display: flex;
    align-items: center;
    gap: 1rem;
    justify-content: center;
    padding: 1rem;
    background: rgba(10,10,26,0.3);
    border-radius: var(--radius-sm);
}

.color-preview {
    width: 50px;
    height: 50px;
    border-radius: 50%;
    border: 3px solid rgba(255,255,255,0.1);
    transition: var(--transition);
}

.color-name {
    font-size: 1rem;
    color: var(--text-muted);
}

.dice-container {
    padding: 1.5rem;
}

.dice {
    width: 100px;
    height: 100px;
    margin: 0 auto;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg-surface);
    border: 2px solid rgba(108,92,231,0.3);
    border-radius: var(--radius);
    transition: var(--transition);
}

.dice.rolling {
    animation: diceRoll 0.6s ease;
}

@keyframes diceRoll {
    0% { transform: rotate(0deg) scale(1); }
    25% { transform: rotate(90deg) scale(1.1); }
    50% { transform: rotate(180deg) scale(0.9); }
    75% { transform: rotate(270deg) scale(1.1); }
    100% { transform: rotate(360deg) scale(1); }
}

.dice-face {
    font-size: 3rem;
}

.countdown-input {
    display: block;
    width: 100%;
    padding: 0.6rem 1rem;
    margin-bottom: 0.8rem;
    background: var(--bg-surface);
    border: 1px solid rgba(108,92,231,0.2);
    border-radius: var(--radius-sm);
    color: var(--text);
    font-size: 0.95rem;
    outline: none;
    font-family: inherit;
}

.countdown-input:focus {
    border-color: var(--primary);
}

.countdown-display {
    padding: 1rem;
    margin-bottom: 1rem;
    background: rgba(10,10,26,0.3);
    border-radius: var(--radius-sm);
    min-height: 60px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 1rem;
    flex-wrap: wrap;
}

.countdown-unit {
    text-align: center;
}

.countdown-unit .num {
    display: block;
    font-size: 2rem;
    font-weight: 700;
    color: var(--secondary);
}

.countdown-unit .label {
    font-size: 0.8rem;
    color: var(--text-muted);
}

.wheel-container {
    position: relative;
    width: 260px;
    height: 260px;
    margin: 1rem auto;
}

.wheel-pointer {
    position: absolute;
    top: -15px;
    left: 50%;
    transform: translateX(-50%);
    font-size: 1.5rem;
    color: var(--accent);
    z-index: 10;
}

#wheel-canvas {
    border-radius: 50%;
    border: 3px solid rgba(108,92,231,0.3);
}

/* --- 笑话墙 --- */
.joke-categories {
    display: flex;
    gap: 0.5rem;
    justify-content: center;
    margin-bottom: 2rem;
    flex-wrap: wrap;
}

.joke-cat {
    padding: 0.5rem 1rem;
    border: 1px solid rgba(108,92,231,0.2);
    background: rgba(26,26,62,0.5);
    color: var(--text-muted);
    border-radius: 999px;
    cursor: pointer;
    transition: var(--transition);
    font-size: 0.9rem;
    font-family: inherit;
}

.joke-cat:hover, .joke-cat.active {
    background: rgba(108,92,231,0.3);
    color: var(--text);
    border-color: var(--primary);
}

.jokes-container {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 1.2rem;
}

.joke-card {
    background: var(--bg-card);
    border: 1px solid rgba(108,92,231,0.1);
    border-radius: var(--radius);
    padding: 1.5rem;
    transition: var(--transition);
}

.joke-card:hover {
    border-color: rgba(108,92,231,0.3);
    transform: translateY(-4px);
}

.joke-tag {
    display: inline-block;
    padding: 0.2rem 0.6rem;
    background: rgba(108,92,231,0.2);
    color: var(--primary-light);
    border-radius: 999px;
    font-size: 0.75rem;
    margin-bottom: 0.8rem;
}

.joke-text {
    font-size: 0.95rem;
    line-height: 1.7;
    color: var(--text);
}

.joke-answer {
    margin-top: 0.8rem;
    padding-top: 0.8rem;
    border-top: 1px dashed rgba(108,92,231,0.2);
    color: var(--text);
    cursor: pointer;
    user-select: none;
    font-weight: 600;
    transition: color 0.3s;
}

.joke-answer.hidden {
    color: transparent;
    text-shadow: 0 0 8px rgba(108,92,231,0.5);
    font-weight: 400;
}

body.light-theme .joke-answer:not(.hidden) {
    color: #000000;
}

body.light-theme .joke-answer.hidden {
    color: transparent;
    text-shadow: 0 0 8px rgba(108,92,231,0.3);
}

/* 答案按钮样式 */
.joke-answer-btn {
    display: inline-block;
    margin-top: 12px;
    padding: 8px 16px;
    background: linear-gradient(135deg, var(--primary), var(--primary-light));
    color: #ffffff;
    border: none;
    border-radius: 20px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 2px 8px rgba(108, 92, 231, 0.3);
}

.joke-answer-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(108, 92, 231, 0.4);
}

.joke-answer-btn:active {
    transform: translateY(0);
}

/* 答案弹窗样式 */
.answer-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.6);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10000;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
}

.answer-modal.show {
    opacity: 1;
    visibility: visible;
}

.answer-modal-content {
    background: var(--bg-card);
    border-radius: 16px;
    padding: 0;
    max-width: 500px;
    width: 90%;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
    transform: scale(0.8) translateY(-20px);
    transition: transform 0.3s ease;
    overflow: hidden;
}

.answer-modal.show .answer-modal-content {
    transform: scale(1) translateY(0);
}

.answer-modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 20px 24px;
    background: linear-gradient(135deg, var(--primary), var(--primary-light));
    color: #ffffff;
}

.answer-modal-header h3 {
    margin: 0;
    font-size: 20px;
    font-weight: 600;
}

.answer-modal-close {
    background: rgba(255, 255, 255, 0.2);
    border: none;
    color: #ffffff;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    font-size: 24px;
    line-height: 1;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s ease;
}

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

.answer-modal-body {
    padding: 32px 24px;
    color: var(--text);
    font-size: 16px;
    line-height: 1.8;
    text-align: center;
}

.answer-modal-body p {
    margin: 0;
}

/* 移动端适配 */
@media (max-width: 768px) {
    .answer-modal-content {
        width: 85%;
    }
    
    .answer-modal-header {
        padding: 16px 20px;
    }
    
    .answer-modal-header h3 {
        font-size: 18px;
    }
    
    .answer-modal-body {
        padding: 24px 20px;
        font-size: 15px;
    }
}

.joke-load-more {
    text-align: center;
    margin-top: 2rem;
}

/* --- 梦想画廊 --- */
.gallery-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 1.5rem;
}

.gallery-item {
    background: var(--bg-card);
    border: 1px solid rgba(108,92,231,0.15);
    border-radius: var(--radius);
    overflow: hidden;
    transition: var(--transition);
}

.gallery-item:hover {
    transform: translateY(-5px);
    border-color: rgba(108,92,231,0.4);
    box-shadow: var(--glow);
}

.gallery-item canvas {
    display: block;
    width: 100%;
    height: auto;
    border: none;
    border-radius: 0;
}

.art-label {
    padding: 1rem 1.2rem;
}

.art-label h4 {
    font-size: 1.1rem;
    margin-bottom: 0.2rem;
}

.art-label p {
    color: var(--text-muted);
    font-size: 0.85rem;
}

/* --- 画廊预览卡片（弹窗模式）--- */
.gallery-item {
    cursor: pointer;
}

.art-preview {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    aspect-ratio: 1;
    font-size: 4.5rem;
    user-select: none;
    transition: var(--transition);
}

.gallery-item:hover .art-preview {
    transform: scale(1.05);
}

.gallery-item::after {
    content: '▶ 点击播放';
    position: absolute;
    top: 12px;
    right: 12px;
    background: rgba(10,10,26,0.7);
    color: #fff;
    padding: 4px 10px;
    border-radius: 999px;
    font-size: 0.75rem;
    opacity: 0;
    transition: var(--transition);
    pointer-events: none;
}

.gallery-item {
    position: relative;
}

.gallery-item:hover::after {
    opacity: 1;
}

/* 弹窗内的动画画布 */
.art-modal-canvas {
    display: block;
    width: 100%;
    max-width: 360px;
    margin: 0 auto;
    border-radius: var(--radius-sm);
    border: 1px solid rgba(108,92,231,0.2);
    background: #0a0a1a;
}

.art-modal-desc {
    margin-top: 1rem;
    color: var(--text-muted);
    font-size: 0.9rem;
    text-align: center;
}

/* --- 顶部自定义区域（后台配置）--- */
.custom-header {
    position: relative;
    z-index: 5;
    margin-top: 64px;
}

/* --- 底部自定义代码区域 --- */
.footer-custom-code {
    margin-top: 1rem;
    font-size: 0.85rem;
}

.footer-custom-code:empty {
    display: none;
}

/* --- 页脚 --- */
.footer {
    position: relative;
    z-index: 1;
    text-align: center;
    padding: 2rem;
    border-top: 1px solid rgba(108,92,231,0.1);
    margin-top: 2rem;
}

.footer-content {
    max-width: 1200px;
    margin: 0 auto;
}

.footer-brand {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    font-size: 1.1rem;
    margin-bottom: 0.5rem;
}

.footer-text {
    color: var(--text-muted);
    font-size: 0.85rem;
}

/* --- 返回顶部 --- */
.back-to-top {
    position: fixed;
    bottom: 2rem;
    right: 2rem;
    width: 48px;
    height: 48px;
    background: var(--primary);
    color: #fff;
    border: none;
    border-radius: 50%;
    font-size: 1.2rem;
    cursor: pointer;
    z-index: 100;
    opacity: 0;
    visibility: hidden;
    transition: var(--transition);
    box-shadow: 0 4px 15px rgba(108,92,231,0.4);
    font-family: inherit;
}

.back-to-top.visible {
    opacity: 1;
    visibility: visible;
}

.back-to-top:hover {
    transform: translateY(-3px);
    box-shadow: 0 6px 25px rgba(108,92,231,0.5);
}

/* ===== 响应式 - 平板 ===== */
@media (max-width: 1024px) {
    .hero-decoration { display: none; }
    .hero-content { flex: unset; }
    .feature-cards { grid-template-columns: repeat(2, 1fr); }
    .tools-grid { grid-template-columns: repeat(2, 1fr); }
    .gallery-grid { grid-template-columns: repeat(2, 1fr); }
    .jokes-container { grid-template-columns: repeat(2, 1fr); }
}

/* ===== 响应式 - 手机 ===== */
@media (max-width: 768px) {
    /* 导航 */
    .navbar { padding: 0 1rem; height: 56px; }
    .nav-links { display: none; }
    .mobile-menu-btn { display: block; font-size: 1.6rem; }
    .mobile-menu { top: 56px; }
    .brand-text { font-size: 1.2rem; }
    .theme-label { display: none; }
    .theme-toggle { padding: 6px 10px; }

    /* 区域 */
    .section { padding: 68px 0.8rem 1rem; }
    .section-header { margin-bottom: 1.5rem; }
    .section-header h2 { font-size: 1.6rem; }
    .section-header p { font-size: 0.95rem; }

    /* 顶部自定义区域 */
    .custom-header { margin-top: 56px; }

    /* 首页 */
    .hero {
        flex-direction: column;
        text-align: center;
        min-height: auto;
        padding-top: 0.5rem;
        gap: 1rem;
    }
    .hero-content { flex: unset; }
    .hero-decoration { flex: unset; }
    .title-line { font-size: 1.1rem; }
    .title-main { font-size: 2.6rem; }
    .hero-subtitle { font-size: 0.95rem; margin-bottom: 1.5rem; }
    .hero-buttons { justify-content: center; flex-wrap: wrap; }
    .hero-buttons .btn { padding: 0.65rem 1.2rem; font-size: 0.95rem; }
    .floating-island { width: 200px; height: 200px; }
    .island-base { width: 150px; height: 60px; }
    .island-palm { font-size: 3.5rem; bottom: 85px; }

    .stats-bar {
        gap: 1rem;
        padding: 1.2rem 0.8rem;
        flex-wrap: wrap;
        justify-content: space-around;
    }
    .stat-item { min-width: 70px; text-align: center; }
    .stat-number { font-size: 1.6rem; }
    .stat-label { font-size: 0.8rem; }

    .feature-cards {
        grid-template-columns: 1fr 1fr;
        gap: 0.8rem;
    }
    .feature-card { padding: 1.2rem 0.8rem; }
    .card-icon { font-size: 2.2rem; margin-bottom: 0.6rem; }
    .feature-card h3 { font-size: 1rem; }
    .feature-card p { font-size: 0.8rem; display: none; }

    /* 游戏标签 */
    .game-tabs {
        gap: 0.3rem;
        overflow-x: auto;
        flex-wrap: nowrap;
        padding-bottom: 0.5rem;
        -webkit-overflow-scrolling: touch;
    }
    .game-tab {
        padding: 0.4rem 0.7rem;
        font-size: 0.8rem;
        white-space: nowrap;
        flex-shrink: 0;
    }

    /* 游戏容器 */
    .game-container { padding: 1rem; gap: 1rem; }
    .game-info { gap: 1rem; font-size: 0.85rem; }
    .game-info strong { font-size: 1rem; }

    /* Canvas 自适应 */
    #snake-canvas, #breakout-canvas, #flappy-canvas {
        width: 100% !important;
        height: auto !important;
        max-width: 400px;
    }
    #breakout-canvas { max-width: 480px; }

    /* 贪吃蛇方向键 - 更大更好按 */
    .d-pad { gap: 6px; margin-top: 0.5rem; }
    .d-btn {
        width: 56px;
        height: 56px;
        font-size: 1.4rem;
        border-radius: 12px;
    }

    /* 记忆翻牌 */
    .memory-board {
        grid-template-columns: repeat(4, 1fr);
        gap: 6px;
        max-width: 340px;
        width: 100%;
    }
    .memory-card { width: auto; height: 0; padding-bottom: 100%; }
    .memory-card-inner { position: absolute; inset: 0; }
    .memory-card-front, .memory-card-back { font-size: 1.5rem; }
    .memory-card-front { font-size: 1.2rem; }

    /* 2048 */
    .grid-2048 {
        grid-template-columns: repeat(4, 1fr);
        gap: 6px;
        padding: 8px;
        max-width: 340px;
        width: 100%;
    }
    .tile-2048 {
        width: auto;
        height: 0;
        padding-bottom: 100%;
        position: relative;
        font-size: 1.3rem;
        display: flex;
        align-items: center;
        justify-content: center;
    }
    .tile-2048[data-value="128"],
    .tile-2048[data-value="256"],
    .tile-2048[data-value="512"] { font-size: 1.1rem; }
    .tile-2048[data-value="1024"],
    .tile-2048[data-value="2048"] { font-size: 0.9rem; }

    /* 打字挑战 */
    .typing-word { font-size: 1.5rem; }
    .typing-input { font-size: 1rem; padding: 0.7rem 1rem; }

    /* 趣味工具 */
    .tools-grid {
        grid-template-columns: 1fr;
        gap: 1rem;
    }
    .tool-card { padding: 1.5rem; }
    .tool-icon { font-size: 2.5rem; }
    .tool-card h3 { font-size: 1.1rem; }
    .mood-btn { padding: 0.45rem 0.7rem; font-size: 0.8rem; }
    .wheel-container { width: 220px; height: 220px; }
    #wheel-canvas { width: 220px; height: 220px; }
    .countdown-unit .num { font-size: 1.6rem; }

    /* 笑话墙 */
    .joke-categories {
        gap: 0.4rem;
        overflow-x: auto;
        flex-wrap: nowrap;
        padding-bottom: 0.5rem;
        -webkit-overflow-scrolling: touch;
        justify-content: flex-start;
    }
    .joke-cat {
        white-space: nowrap;
        flex-shrink: 0;
        padding: 0.4rem 0.8rem;
        font-size: 0.85rem;
    }
    .jokes-container { grid-template-columns: 1fr; gap: 0.8rem; }
    .joke-card { padding: 1.2rem; }

    /* 画廊 */
    .gallery-grid {
        grid-template-columns: 1fr 1fr;
        gap: 0.8rem;
    }
    .art-label { padding: 0.8rem; }
    .art-label h4 { font-size: 0.95rem; }
    .art-label p { font-size: 0.75rem; }

    /* 页脚 */
    .footer { padding: 1.5rem 1rem; }
    .footer-brand { font-size: 0.95rem; }
    .footer-text { font-size: 0.8rem; }

    /* 返回顶部 */
    .back-to-top {
        bottom: 1.2rem;
        right: 1.2rem;
        width: 42px;
        height: 42px;
        font-size: 1rem;
    }

    /* 按钮 */
    .btn { padding: 0.6rem 1.2rem; font-size: 0.9rem; }
    .game-controls .btn { width: 100%; justify-content: center; }
}

/* ===== 响应式 - 小屏手机 ===== */
@media (max-width: 380px) {
    .title-main { font-size: 2.2rem; }
    .feature-cards { grid-template-columns: 1fr; }
    .gallery-grid { grid-template-columns: 1fr; }
    .stats-bar { gap: 0.8rem; }
    .stat-number { font-size: 1.3rem; }
    .stat-label { font-size: 0.7rem; }
    .d-btn { width: 50px; height: 50px; }
    .wheel-container { width: 200px; height: 200px; }
    #wheel-canvas { width: 200px; height: 200px; }
}
