/* ============================================
   盲盒翻牌 - AI赋能教学（支持亮色/暗色主题）
   ============================================ */

/* CSS变量 - 暗色主题（默认） */
:root {
    /* 品牌色（双主题通用） */
    --primary: #6C5CE7;
    --primary-light: #A29BFE;
    --primary-dark: #5A4BD1;
    --secondary: #00CEC9;
    --accent: #FD79A8;
    --success: #00B894;
    --warning: #FDCB6E;
    --danger: #FF7675;

    /* 语义化颜色（主题相关） */
    --bg-body: #0F0A1F;
    --bg-surface: #1A1135;
    --bg-elevated: #2D1B69;
    --text-primary: #FFFFFF;
    --text-secondary: #B8B5CC;
    --text-muted: #7B7896;

    /* 背景渐变 */
    --bg-splash: linear-gradient(135deg, #0F0A1F 0%, #1A1135 30%, #2D1B69 60%, #1A1135 100%);
    --bg-app: linear-gradient(135deg, #0F0A1F 0%, #1A1135 50%, #0F0A1F 100%);
    --bg-modal: linear-gradient(135deg, #1A1135 0%, #2D1B69 100%);
    --bg-panel: linear-gradient(135deg, #1A1135, #2D1B69);
    --bg-card-hidden: linear-gradient(135deg, var(--primary-dark), #3D2B79);
    --bg-card-revealed: linear-gradient(135deg, #1E1245, #2A1B60);
    --bg-detail: linear-gradient(135deg, rgba(108, 92, 231, 0.1), rgba(0, 206, 201, 0.1));
    --bg-nav: rgba(26, 17, 53, 0.95);
    --bg-overlay: rgba(0, 0, 0, 0.7);
    --bg-input: rgba(0, 0, 0, 0.3);
    --bg-hover: rgba(255, 255, 255, 0.05);
    --bg-item: rgba(0, 0, 0, 0.2);
    --bg-decor: rgba(0, 0, 0, 0.15);
    --bg-btn-outline-hover: rgba(255, 255, 255, 0.05);
    --mini-card-bg: linear-gradient(135deg, var(--primary-dark), #3D2B79);

    /* 边框 */
    --border-subtle: rgba(255, 255, 255, 0.1);
    --border-medium: rgba(255, 255, 255, 0.15);
    --border-primary: rgba(108, 92, 231, 0.3);
    --border-accent: rgba(108, 92, 231, 0.2);
    --border-card-hidden: rgba(108, 92, 231, 0.5);
    --border-card-revealed: rgba(0, 206, 201, 0.4);

    /* 阴影 */
    --shadow-glow: 0 0 20px rgba(108, 92, 231, 0.3);
    --shadow-card: 0 8px 32px rgba(0, 0, 0, 0.3);
    --shadow-panel: -10px 0 30px rgba(0, 0, 0, 0.5);
    --shadow-toast: 0 4px 20px rgba(0, 0, 0, 0.4);

    /* 卡片文字 */
    --card-title-color: var(--primary-light);
    --card-content-color: var(--text-secondary);
    --text-faint: rgba(255, 255, 255, 0.3);
    --text-fainter: rgba(255, 255, 255, 0.2);

    /* 启动画面装饰 */
    --splash-decor-1: rgba(108, 92, 231, 0.15);
    --splash-decor-2: rgba(253, 121, 168, 0.1);

    /* 导航边框 */
    --nav-border: rgba(108, 92, 231, 0.2);

    /* 关闭按钮 */
    --close-bg: rgba(255, 255, 255, 0.05);

    /* 按钮轮廓悬浮 */
    --btn-outline-hover-color: white;

    /* select option */
    --option-bg: #1A1135;

    /* 不变的变量 */
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 20px;
    --radius-xl: 28px;
    --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* ===== 亮色主题 ===== */
[data-theme="light"] {
    --bg-body: #F0EBF8;
    --bg-surface: #FFFFFF;
    --bg-elevated: #F8F5FF;
    --text-primary: #1A1135;
    --text-secondary: #5A5777;
    --text-muted: #9B97B0;

    --bg-splash: linear-gradient(135deg, #F0EBF8 0%, #E3DAF2 30%, #D8CCEB 60%, #E3DAF2 100%);
    --bg-app: linear-gradient(135deg, #F0EBF8 0%, #E8E0F5 50%, #F0EBF8 100%);
    --bg-modal: linear-gradient(135deg, #FFFFFF 0%, #F8F5FF 100%);
    --bg-panel: linear-gradient(135deg, #FFFFFF, #F8F5FF);
    --bg-card-hidden: linear-gradient(135deg, #6C5CE7, #8B7FF0);
    --bg-card-revealed: linear-gradient(135deg, #FFFFFF, #F8F5FF);
    --bg-detail: linear-gradient(135deg, rgba(108, 92, 231, 0.06), rgba(0, 206, 201, 0.04));
    --bg-nav: rgba(255, 255, 255, 0.92);
    --bg-overlay: rgba(80, 70, 110, 0.3);
    --bg-input: rgba(108, 92, 231, 0.05);
    --bg-hover: rgba(108, 92, 231, 0.08);
    --bg-item: rgba(108, 92, 231, 0.05);
    --bg-decor: rgba(108, 92, 231, 0.03);
    --bg-btn-outline-hover: rgba(108, 92, 231, 0.08);
    --mini-card-bg: linear-gradient(135deg, #6C5CE7, #8B7FF0);

    --border-subtle: rgba(108, 92, 231, 0.08);
    --border-medium: rgba(108, 92, 231, 0.15);
    --border-primary: rgba(108, 92, 231, 0.2);
    --border-accent: rgba(108, 92, 231, 0.1);
    --border-card-hidden: rgba(108, 92, 231, 0.5);
    --border-card-revealed: rgba(0, 206, 201, 0.25);

    --shadow-glow: 0 0 20px rgba(108, 92, 231, 0.1);
    --shadow-card: 0 8px 32px rgba(108, 92, 231, 0.08);
    --shadow-panel: -5px 0 20px rgba(108, 92, 231, 0.1);
    --shadow-toast: 0 4px 20px rgba(108, 92, 231, 0.12);

    --card-title-color: var(--primary);
    --card-content-color: #5A5777;
    --text-faint: rgba(26, 17, 53, 0.3);
    --text-fainter: rgba(26, 17, 53, 0.18);

    --splash-decor-1: rgba(108, 92, 231, 0.08);
    --splash-decor-2: rgba(253, 121, 168, 0.05);

    --nav-border: rgba(108, 92, 231, 0.1);

    --close-bg: rgba(108, 92, 231, 0.06);

    --btn-outline-hover-color: var(--primary);

    --option-bg: #FFFFFF;
}

/* 基础重置 */
*, *::before, *::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html, body {
    height: 100%;
    overflow: hidden;
}

body {
    font-family: 'Microsoft YaHei', 'PingFang SC', -apple-system, BlinkMacSystemFont, sans-serif;
    background: var(--bg-body);
    color: var(--text-primary);
    line-height: 1.6;
    transition: background-color 0.4s ease, color 0.4s ease;
}

/* 无障碍焦点样式 */
:focus-visible {
    outline: 3px solid var(--primary-light);
    outline-offset: 2px;
}

/* 减少动画模式 */
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

/* JS控制的减少动画模式 */
body.reduced-motion *,
body.reduced-motion *::before,
body.reduced-motion *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.1ms !important;
}

/* 滚动条 */
::-webkit-scrollbar {
    width: 6px;
}
::-webkit-scrollbar-track {
    background: var(--bg-body);
}
::-webkit-scrollbar-thumb {
    background: var(--primary);
    border-radius: 3px;
}

/* 选中文本样式 */
::selection {
    background: rgba(108, 92, 231, 0.3);
    color: white;
}

[data-theme="light"] ::selection {
    background: rgba(108, 92, 231, 0.25);
    color: #1A1135;
}

/* ============================================
   启动画面
   ============================================ */
.splash-screen {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg-splash);
    z-index: 1000;
    overflow: hidden;
}

.splash-screen::before {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: radial-gradient(circle at 30% 50%, var(--splash-decor-1) 0%, transparent 50%),
                radial-gradient(circle at 70% 50%, var(--splash-decor-2) 0%, transparent 50%);
    animation: bgFloat 20s ease-in-out infinite;
}

@keyframes bgFloat {
    0%, 100% { transform: translate(0, 0) rotate(0deg); }
    33% { transform: translate(2%, -2%) rotate(1deg); }
    66% { transform: translate(-1%, 1%) rotate(-1deg); }
}

.splash-content {
    position: relative;
    text-align: center;
    z-index: 1;
    animation: fadeInUp 0.8s ease-out;
    max-width: 480px;
    padding: 20px;
}

.splash-icon {
    font-size: 80px;
    margin-bottom: 16px;
    animation: bounce 2s ease-in-out infinite;
    filter: drop-shadow(0 0 30px rgba(108, 92, 231, 0.6));
}

@keyframes bounce {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-15px); }
}

@keyframes fadeInUp {
    from { opacity: 0; transform: translateY(30px); }
    to { opacity: 1; transform: translateY(0); }
}

.splash-content h1 {
    font-size: 48px;
    font-weight: 800;
    background: linear-gradient(135deg, var(--primary-light), var(--accent));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin-bottom: 8px;
    text-shadow: none;
}

.splash-content > p {
    color: var(--text-secondary);
    font-size: 16px;
    margin-bottom: 32px;
    letter-spacing: 2px;
}

.splash-buttons {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
}

.splash-tips {
    margin-top: 24px;
    animation: fadeInUp 0.8s ease-out 0.3s both;
}

.tip-text {
    color: var(--text-muted);
    font-size: 13px;
}

/* ============================================
   按钮系统
   ============================================ */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 10px 20px;
    border: none;
    border-radius: var(--radius-sm);
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
    font-family: inherit;
    white-space: nowrap;
    user-select: none;
}

.btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
}

.btn:active {
    transform: translateY(0);
    box-shadow: none;
}

.btn-primary {
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    color: white;
}

.btn-primary:hover {
    background: linear-gradient(135deg, var(--primary-light), var(--primary));
    box-shadow: 0 4px 20px rgba(108, 92, 231, 0.4);
}

.btn-outline {
    background: transparent;
    color: var(--text-secondary);
    border: 1px solid var(--border-medium);
}

.btn-outline:hover {
    background: var(--bg-btn-outline-hover);
    color: var(--btn-outline-hover-color);
    border-color: var(--border-primary);
}

.btn-success {
    background: linear-gradient(135deg, var(--success), #00A884);
    color: white;
}

.btn-success:hover {
    box-shadow: 0 4px 20px rgba(0, 184, 148, 0.4);
}

.btn-warning {
    background: linear-gradient(135deg, var(--warning), #F0B843);
    color: #333;
}

.btn-warning:hover {
    box-shadow: 0 4px 20px rgba(253, 203, 110, 0.4);
}

.btn-sm {
    padding: 6px 14px;
    font-size: 13px;
}

.btn-lg {
    padding: 14px 32px;
    font-size: 16px;
    min-width: 200px;
}

/* ============================================
   弹窗系统
   ============================================ */
.modal {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: var(--bg-overlay);
    backdrop-filter: blur(8px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 900;
    animation: fadeIn 0.2s ease-out;
    padding: 20px;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.modal-content {
    background: var(--bg-modal);
    border-radius: var(--radius-lg);
    border: 1px solid var(--border-primary);
    width: 100%;
    max-width: 560px;
    max-height: 85vh;
    display: flex;
    flex-direction: column;
    box-shadow: var(--shadow-glow);
    animation: modalSlideIn 0.3s ease-out;
    transition: background 0.4s ease, border-color 0.4s ease;
}

.modal-lg {
    max-width: 700px;
}

.modal-detail {
    max-width: 500px;
}

@keyframes modalSlideIn {
    from { opacity: 0; transform: translateY(-20px) scale(0.95); }
    to { opacity: 1; transform: translateY(0) scale(1); }
}

.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 20px 24px;
    border-bottom: 1px solid var(--border-subtle);
}

.modal-header h2 {
    font-size: 20px;
    font-weight: 700;
}

.modal-close {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    border: none;
    background: var(--close-bg);
    color: var(--text-secondary);
    font-size: 20px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition);
    flex-shrink: 0;
}

.modal-close:hover {
    background: rgba(255, 76, 76, 0.2);
    color: #FF4444;
}

.modal-body {
    padding: 24px;
    overflow-y: auto;
    flex: 1;
}

.modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 12px;
    padding: 16px 24px;
    border-top: 1px solid var(--border-subtle);
}

/* ============================================
   设置面板
   ============================================ */
.setup-section {
    margin-bottom: 28px;
}

.setup-section h3 {
    font-size: 16px;
    margin-bottom: 6px;
    color: var(--text-primary);
}

.text-muted {
    color: var(--text-muted);
    font-size: 13px;
    margin-bottom: 12px;
}


/* 模式选择 */
.mode-selector {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 12px;
}

.mode-option {
    cursor: pointer;
}

.mode-option input {
    display: none;
}

.mode-card {
    padding: 16px 12px;
    border: 2px solid var(--border-subtle);
    border-radius: var(--radius-md);
    text-align: center;
    transition: var(--transition);
    background: var(--bg-item);
}

.mode-option input:checked + .mode-card {
    border-color: var(--primary);
    background: rgba(108, 92, 231, 0.15);
    box-shadow: 0 0 15px rgba(108, 92, 231, 0.3);
}

.mode-card:hover {
    border-color: rgba(108, 92, 231, 0.5);
}

.mode-icon {
    font-size: 28px;
    margin-bottom: 8px;
}

.mode-card h4 {
    font-size: 14px;
    margin-bottom: 4px;
}

.mode-card p {
    font-size: 11px;
    color: var(--text-muted);
}

/* 内容输入区 */
.content-input-area textarea {
    width: 100%;
    padding: 14px;
    border: 1px solid var(--border-primary);
    border-radius: var(--radius-md);
    background: var(--bg-input);
    color: var(--text-primary);
    font-size: 14px;
    font-family: inherit;
    line-height: 1.6;
    resize: vertical;
    outline: none;
    transition: var(--transition);
}

.content-input-area textarea:focus {
    border-color: var(--primary);
    box-shadow: 0 0 15px rgba(108, 92, 231, 0.2);
}

.content-actions {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-top: 10px;
    flex-wrap: wrap;
}

.card-count-display {
    margin-left: auto;
    font-size: 13px;
    color: var(--text-secondary);
}

/* 导入区域 */
.import-area {
    border: 2px dashed var(--border-primary);
    border-radius: var(--radius-md);
    padding: 30px 20px;
    text-align: center;
    transition: var(--transition);
    background: var(--bg-decor);
}

.import-area.dragover {
    border-color: var(--primary);
    background: rgba(108, 92, 231, 0.1);
    transform: scale(1.02);
}

.import-icon {
    font-size: 40px;
    margin-bottom: 10px;
}

.import-area p {
    color: var(--text-muted);
    margin-bottom: 12px;
    font-size: 14px;
}

.import-status {
    margin-top: 12px;
    padding: 10px;
    border-radius: var(--radius-sm);
    font-size: 13px;
}

.import-status.success {
    background: rgba(0, 184, 148, 0.15);
    color: var(--success);
    border: 1px solid rgba(0, 184, 148, 0.3);
}

.import-status.error {
    background: rgba(255, 118, 117, 0.15);
    color: var(--danger);
    border: 1px solid rgba(255, 118, 117, 0.3);
}

/* 格式说明 */
.format-help {
    margin-top: 12px;
}

.format-help summary {
    cursor: pointer;
    color: var(--primary-light);
    font-size: 13px;
    padding: 8px 0;
}

.format-help summary:hover {
    color: var(--text-primary);
}

.format-example {
    margin-top: 10px;
    padding: 16px;
    background: var(--bg-input);
    border-radius: var(--radius-md);
    border: 1px solid var(--border-primary);
}

.format-example h4 {
    font-size: 13px;
    color: var(--primary-light);
    margin-bottom: 8px;
}

.format-example pre {
    font-size: 12px;
    color: var(--text-secondary);
    line-height: 1.8;
    white-space: pre-wrap;
    font-family: 'Consolas', 'Microsoft YaHei', monospace;
}

.divider-text {
    text-align: center;
    color: var(--text-muted);
    margin: 16px 0;
    font-size: 13px;
    position: relative;
}

.divider-text::before,
.divider-text::after {
    content: '';
    position: absolute;
    top: 50%;
    width: calc(50% - 40px);
    height: 1px;
    background: var(--border-subtle);
}

.divider-text::before { left: 0; }
.divider-text::after { right: 0; }

#import-text {
    width: 100%;
    padding: 14px;
    border: 1px solid var(--border-primary);
    border-radius: var(--radius-md);
    background: var(--bg-input);
    color: var(--text-primary);
    font-size: 14px;
    font-family: inherit;
    line-height: 1.6;
    resize: vertical;
    outline: none;
}

#import-text:focus {
    border-color: var(--primary);
}

.import-options {
    margin-top: 12px;
}

.checkbox-label {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    font-size: 13px;
    color: var(--text-secondary);
}

.checkbox-label input[type="checkbox"] {
    accent-color: var(--primary);
    width: 16px;
    height: 16px;
}

/* ============================================
   主应用界面
   ============================================ */
.app-container {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    display: flex;
    flex-direction: column;
    background: var(--bg-app);
    transition: background 0.4s ease;
}

/* 顶部导航 */
.top-nav {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 24px;
    background: var(--bg-nav);
    backdrop-filter: blur(10px);
    border-bottom: 1px solid var(--nav-border);
    z-index: 100;
    flex-shrink: 0;
    transition: background 0.4s ease, border-color 0.4s ease;
}

.nav-left {
    flex-shrink: 0;
}

.nav-title {
    font-size: 18px;
    font-weight: 700;
    background: linear-gradient(135deg, var(--primary-light), var(--accent));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.nav-center {
    flex: 1;
    display: flex;
    justify-content: center;
}

.game-info {
    display: flex;
    gap: 16px;
}

.info-badge {
    font-size: 13px;
    color: var(--text-secondary);
    padding: 4px 12px;
    background: rgba(108, 92, 231, 0.1);
    border-radius: 20px;
    border: 1px solid var(--border-accent);
    transition: var(--transition);
}

.info-badge strong {
    color: var(--primary-light);
}

.nav-right {
    display: flex;
    gap: 8px;
    flex-shrink: 0;
    align-items: center;
}

/* ============================================
   卡片桌面
   ============================================ */
.card-table {
    flex: 1;
    display: flex;
    align-items: flex-start;
    justify-content: center;
    padding: 20px;
    overflow: auto;
    position: relative;
}

/* 背景装饰 */
.card-table::before {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0; bottom: 0;
    background:
        radial-gradient(circle at 20% 30%, rgba(108, 92, 231, 0.08) 0%, transparent 50%),
        radial-gradient(circle at 80% 70%, rgba(253, 121, 168, 0.06) 0%, transparent 50%),
        radial-gradient(circle at 50% 50%, rgba(0, 206, 201, 0.04) 0%, transparent 50%);
    pointer-events: none;
}

.cards-grid {
    display: grid;
    gap: 16px;
    justify-content: center;
    align-content: center;
    z-index: 1;
    max-width: 1200px;
    width: 100%;
    margin: auto 0;
}

/* 不同数量的网格布局 */
.cards-grid.grid-2 { grid-template-columns: repeat(2, 1fr); max-width: 380px; }
.cards-grid.grid-3 { grid-template-columns: repeat(3, 1fr); max-width: 540px; }
.cards-grid.grid-4 { grid-template-columns: repeat(4, 1fr); max-width: 700px; }
.cards-grid.grid-6 { grid-template-columns: repeat(3, 1fr); max-width: 600px; }
.cards-grid.grid-8 { grid-template-columns: repeat(4, 1fr); max-width: 750px; }
.cards-grid.grid-9 { grid-template-columns: repeat(3, 1fr); max-width: 600px; }
.cards-grid.grid-12 { grid-template-columns: repeat(4, 1fr); max-width: 750px; }
.cards-grid.grid-16 { grid-template-columns: repeat(4, 1fr); max-width: 800px; }
.cards-grid.grid-20 { grid-template-columns: repeat(5, 1fr); max-width: 900px; }
.cards-grid.grid-custom { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); }

/* ============================================
   卡牌样式
   ============================================ */
.flip-card {
    perspective: 1000px;
    cursor: pointer;
    aspect-ratio: 3 / 4;
    min-height: 150px;
    position: relative;
    outline: none;
}

.flip-card-inner {
    position: relative;
    width: 100%;
    height: 100%;
    transition: transform 0.8s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    transform-style: preserve-3d;
}

.flip-card.flipped .flip-card-inner {
    transform: rotateY(180deg);
}

.flip-card-front, .flip-card-back {
    position: absolute;
    width: 100%;
    height: 100%;
    backface-visibility: hidden;
    -webkit-backface-visibility: hidden;
    border-radius: var(--radius-lg);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

/* 卡牌背面（初始可见 - 神秘面） */
.flip-card-front {
    background: var(--bg-card-hidden);
    border: 2px solid var(--border-card-hidden);
    box-shadow: var(--shadow-card), inset 0 1px 0 rgba(255,255,255,0.1);
    z-index: 2;
    transition: background 0.4s ease, border-color 0.4s ease;
}

.flip-card-front::before {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0; bottom: 0;
    background: linear-gradient(135deg, transparent 30%, rgba(255,255,255,0.05) 50%, transparent 70%);
    animation: shimmer 3s ease-in-out infinite;
}

@keyframes shimmer {
    0%, 100% { opacity: 0.5; transform: translateX(-100%); }
    50% { opacity: 1; transform: translateX(100%); }
}

/* 背面装饰图案 */
.card-back-pattern {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 80px;
    opacity: 0.06;
    pointer-events: none;
    user-select: none;
}

/* 统一的问号卡片背面样式 */
.card-back-icon {
    font-size: 64px;
    margin-bottom: 10px;
    transition: transform 0.3s ease;
    filter: drop-shadow(0 0 20px rgba(108, 92, 231, 0.8));
    animation: questionPulse 2.5s ease-in-out infinite;
}

@keyframes questionPulse {
    0%, 100% { transform: scale(1); filter: drop-shadow(0 0 20px rgba(108, 92, 231, 0.8)); }
    50% { transform: scale(1.08); filter: drop-shadow(0 0 30px rgba(108, 92, 231, 1)); }
}

.flip-card:hover .card-back-icon {
    transform: scale(1.15);
}

.card-back-label {
    font-size: 14px;
    font-weight: 600;
    letter-spacing: 2px;
    opacity: 0.8;
    color: rgba(255, 255, 255, 0.85);
}

.card-back-number {
    position: absolute;
    top: 10px;
    right: 12px;
    font-size: 12px;
    color: var(--text-faint);
    font-weight: 700;
}

/* 卡牌正面（翻转后可见 - 内容面） */
.flip-card-back {
    background: var(--bg-card-revealed);
    border: 2px solid var(--border-card-revealed);
    transform: rotateY(180deg);
    box-shadow: var(--shadow-card), 0 0 30px rgba(0, 206, 201, 0.2);
    padding: 16px;
    text-align: center;
    transition: background 0.4s ease, border-color 0.4s ease;
}

.card-front-icon {
    font-size: 36px;
    margin-bottom: 8px;
    animation: popIn 0.5s ease-out;
}

@keyframes popIn {
    0% { transform: scale(0); }
    70% { transform: scale(1.2); }
    100% { transform: scale(1); }
}

.card-front-title {
    font-size: 16px;
    font-weight: 700;
    color: var(--card-title-color);
    margin-bottom: 6px;
    word-break: break-word;
    line-height: 1.4;
}

.card-front-content {
    font-size: 13px;
    color: var(--card-content-color);
    word-break: break-word;
    line-height: 1.5;
    max-height: 80px;
    overflow-y: auto;
}

.card-front-number {
    position: absolute;
    bottom: 8px;
    right: 12px;
    font-size: 11px;
    color: var(--text-fainter);
}

/* 卡牌悬浮效果 */
.flip-card:not(.flipped):hover {
    z-index: 10;
}

.flip-card:not(.flipped):hover .flip-card-inner {
    transform: scale(1.05);
}

.flip-card:not(.flipped):active .flip-card-inner {
    transform: scale(0.98);
}

/* 键盘聚焦效果 */
.flip-card:focus-visible .flip-card-inner {
    outline: 3px solid var(--primary-light);
    outline-offset: 4px;
    border-radius: var(--radius-lg);
}

/* 翻转动画增强 */
.flip-card.flipping .flip-card-inner {
    animation: flipBounce 0.8s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

@keyframes flipBounce {
    0% { transform: rotateY(0deg) scale(1); }
    40% { transform: rotateY(90deg) scale(1.1); }
    70% { transform: rotateY(180deg) scale(1.05); }
    100% { transform: rotateY(180deg) scale(1); }
}

/* 卡片入场动画 */
.flip-card.entering {
    animation: cardEnter 0.5s ease-out forwards;
    opacity: 0;
}

@keyframes cardEnter {
    from {
        opacity: 0;
        transform: translateY(30px) scale(0.8) rotateZ(-5deg);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1) rotateZ(0);
    }
}

/* 卡片洗牌动画 - 旧版保留 */
.flip-card.shuffling {
    animation: shuffle 0.6s ease-in-out;
}

@keyframes shuffle {
    0% { transform: translateX(0) rotate(0deg); }
    25% { transform: translateX(-20px) rotate(-5deg); }
    50% { transform: translateX(20px) rotate(5deg); }
    75% { transform: translateX(-10px) rotate(-2deg); }
    100% { transform: translateX(0) rotate(0deg); }
}

/* 洗牌时隐藏卡片（不可见但保持布局） */
.flip-card.shuffle-hidden {
    visibility: hidden;
    pointer-events: none;
}

/* ===== 洗牌收集动画：卡片飞向中心 ===== */
.flip-card.shuffle-gather {
    animation: shuffleGather 0.45s cubic-bezier(0.5, 0, 0.8, 0.3) forwards;
    pointer-events: none;
}

@keyframes shuffleGather {
    0% {
        transform: translate(0, 0) scale(1) rotate(0deg);
        opacity: 1;
    }
    60% {
        opacity: 0.9;
    }
    100% {
        transform: translate(var(--gather-dx), var(--gather-dy)) scale(0.12) rotate(var(--gather-rotate, 0deg));
        opacity: 0;
    }
}

/* ===== 洗牌发牌动画：卡片从中心飞出 ===== */
.flip-card.shuffle-deal {
    animation: shuffleDealOut 0.55s cubic-bezier(0.175, 0.885, 0.32, 1.275) both;
    pointer-events: none;
}

@keyframes shuffleDealOut {
    0% {
        transform: translate(var(--deal-dx), var(--deal-dy)) scale(0.12) rotate(var(--deal-rotate, 0deg));
        opacity: 0;
    }
    40% {
        opacity: 1;
    }
    75% {
        transform: translate(0, 0) scale(1.06) rotate(0deg);
        opacity: 1;
    }
    100% {
        transform: translate(0, 0) scale(1) rotate(0deg);
        opacity: 1;
    }
}

/* ===== 洗牌中心视觉效果 ===== */
.shuffle-center-effect {
    position: fixed;
    z-index: 500;
    pointer-events: none;
    transform: translate(-50%, -50%);
    animation: shuffleCenterAppear 0.4s ease-out;
}

@keyframes shuffleCenterAppear {
    from { opacity: 0; transform: translate(-50%, -50%) scale(0.5); }
    to { opacity: 1; transform: translate(-50%, -50%) scale(1); }
}

.shuffle-center-glow {
    width: 140px;
    height: 140px;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(108, 92, 231, 0.7) 0%, rgba(108, 92, 231, 0.3) 40%, transparent 70%);
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    animation: shuffleGlowPulse 0.35s ease-in-out infinite alternate;
}

@keyframes shuffleGlowPulse {
    0% { transform: translate(-50%, -50%) scale(1); opacity: 0.7; }
    100% { transform: translate(-50%, -50%) scale(1.4); opacity: 1; }
}

.shuffle-mini-card {
    position: absolute;
    width: 52px;
    height: 68px;
    background: var(--mini-card-bg);
    border: 2px solid rgba(108, 92, 231, 0.6);
    border-radius: var(--radius-sm);
    top: 50%;
    left: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 22px;
    color: rgba(255, 255, 255, 0.6);
    font-weight: 800;
    box-shadow: 0 0 15px rgba(108, 92, 231, 0.4);
}

.shuffle-mini-card:nth-child(1) {
    animation: shuffleMini1 0.3s ease-in-out infinite alternate;
}
.shuffle-mini-card:nth-child(2) {
    animation: shuffleMini2 0.3s ease-in-out infinite alternate;
    animation-delay: 0.05s;
}
.shuffle-mini-card:nth-child(3) {
    animation: shuffleMini3 0.3s ease-in-out infinite alternate;
    animation-delay: 0.1s;
}
.shuffle-mini-card:nth-child(4) {
    animation: shuffleMini4 0.3s ease-in-out infinite alternate;
    animation-delay: 0.15s;
}

@keyframes shuffleMini1 {
    0% { transform: translate(-50%, -50%) rotate(-25deg) translateX(-8px); }
    100% { transform: translate(-50%, -50%) rotate(-15deg) translateX(-12px); }
}
@keyframes shuffleMini2 {
    0% { transform: translate(-50%, -50%) rotate(15deg) translateX(8px); }
    100% { transform: translate(-50%, -50%) rotate(25deg) translateX(12px); }
}
@keyframes shuffleMini3 {
    0% { transform: translate(-50%, -50%) rotate(-10deg) translateY(6px); }
    100% { transform: translate(-50%, -50%) rotate(10deg) translateY(10px); }
}
@keyframes shuffleMini4 {
    0% { transform: translate(-50%, -50%) rotate(5deg) translateY(-8px); }
    100% { transform: translate(-50%, -50%) rotate(-5deg) translateY(-12px); }
}

/* 洗牌中心发光粒子 */
.shuffle-sparkle {
    position: absolute;
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--primary-light);
    top: 50%;
    left: 50%;
    animation: shuffleSparkle 0.6s ease-out infinite;
}

@keyframes shuffleSparkle {
    0% { transform: translate(-50%, -50%) scale(0); opacity: 1; }
    50% { opacity: 1; }
    100% { transform: translate(calc(-50% + var(--sx)), calc(-50% + var(--sy))) scale(1); opacity: 0; }
}

/* 已翻开卡片的发光效果 */
.flip-card.flipped .flip-card-back {
    animation: glowPulse 2s ease-in-out infinite;
}

@keyframes glowPulse {
    0%, 100% { box-shadow: var(--shadow-card), 0 0 15px rgba(0, 206, 201, 0.2); }
    50% { box-shadow: var(--shadow-card), 0 0 25px rgba(0, 206, 201, 0.4); }
}

/* 随机翻牌的高亮效果 */
.flip-card.highlight:not(.flipped) .flip-card-front {
    animation: highlightPulse 0.5s ease-in-out 3;
    border-color: var(--warning);
}

@keyframes highlightPulse {
    0%, 100% { box-shadow: var(--shadow-card); }
    50% { box-shadow: var(--shadow-card), 0 0 30px rgba(253, 203, 110, 0.6); }
}

/* ============================================
   底部操作栏
   ============================================ */
.bottom-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 24px;
    background: var(--bg-nav);
    backdrop-filter: blur(10px);
    border-top: 1px solid var(--nav-border);
    flex-shrink: 0;
    transition: background 0.4s ease, border-color 0.4s ease;
}

.bottom-left, .bottom-right {
    display: flex;
    gap: 8px;
}

.bottom-center {
    flex: 1;
    display: flex;
    justify-content: center;
    max-width: 300px;
}

.progress-indicator {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
}

.progress-bar-container {
    flex: 1;
    height: 6px;
    background: var(--border-subtle);
    border-radius: 3px;
    overflow: hidden;
}

.progress-bar {
    height: 100%;
    background: linear-gradient(90deg, var(--primary), var(--secondary));
    border-radius: 3px;
    transition: width 0.5s ease;
}

#progress-text {
    font-size: 12px;
    color: var(--text-muted);
    min-width: 35px;
}

/* ============================================
   卡片详情弹窗
   ============================================ */
.detail-card-display {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 200px;
    background: var(--bg-detail);
    border-radius: var(--radius-lg);
    border: 1px solid var(--border-accent);
    padding: 30px;
    transition: background 0.4s ease, border-color 0.4s ease;
}

.detail-card-content {
    font-size: 22px;
    font-weight: 700;
    text-align: center;
    line-height: 1.6;
    word-break: break-word;
}

.detail-card-content .detail-sub {
    font-size: 16px;
    color: var(--text-secondary);
    margin-top: 10px;
    font-weight: 400;
    line-height: 1.6;
}

/* 详情弹窗底部按钮提示 */
.detail-nav-hint {
    font-size: 12px;
    color: var(--text-muted);
    margin-top: 4px;
    text-align: center;
}

/* ============================================
   卡片列表面板
   ============================================ */
.panel {
    position: fixed;
    top: 0; right: 0;
    width: 360px;
    height: 100%;
    background: var(--bg-panel);
    border-left: 1px solid var(--border-primary);
    z-index: 800;
    display: flex;
    flex-direction: column;
    animation: slideInRight 0.3s ease-out;
    box-shadow: var(--shadow-panel);
    transition: background 0.4s ease, border-color 0.4s ease;
}

@keyframes slideInRight {
    from { transform: translateX(100%); }
    to { transform: translateX(0); }
}

.panel-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 20px;
    border-bottom: 1px solid var(--border-subtle);
}

.panel-header h3 {
    font-size: 16px;
}

.panel-close {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    border: none;
    background: var(--close-bg);
    color: var(--text-secondary);
    font-size: 18px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition);
}

.panel-close:hover {
    background: rgba(255, 76, 76, 0.2);
    color: #FF4444;
}

.panel-body {
    flex: 1;
    overflow-y: auto;
    padding: 16px;
}

.card-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.card-list-stats {
    text-align: center;
    font-size: 13px;
    color: var(--text-muted);
    padding: 8px;
    margin-bottom: 8px;
    background: rgba(108, 92, 231, 0.08);
    border-radius: var(--radius-sm);
}

.card-list-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px;
    background: var(--bg-item);
    border-radius: var(--radius-sm);
    border: 1px solid var(--border-subtle);
    transition: var(--transition);
}

.card-list-item:hover {
    background: rgba(108, 92, 231, 0.1);
    border-color: var(--border-primary);
}

.card-list-item.flipped-item {
    border-left: 3px solid var(--secondary);
}

.card-list-num {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: rgba(108, 92, 231, 0.2);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    font-weight: 700;
    color: var(--primary-light);
    flex-shrink: 0;
}

.card-list-item.flipped-item .card-list-num {
    background: rgba(0, 206, 201, 0.2);
    color: var(--secondary);
}

.card-list-text {
    flex: 1;
    font-size: 13px;
    color: var(--text-secondary);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.card-list-status {
    font-size: 16px;
    flex-shrink: 0;
}

/* ============================================
   Toast通知
   ============================================ */
.toast-container {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 9999;
    display: flex;
    flex-direction: column;
    gap: 8px;
    pointer-events: none;
}

.toast {
    padding: 12px 20px;
    border-radius: var(--radius-sm);
    font-size: 14px;
    font-weight: 500;
    animation: toastIn 0.3s ease-out;
    display: flex;
    align-items: center;
    gap: 8px;
    min-width: 200px;
    max-width: 400px;
    box-shadow: var(--shadow-toast);
    pointer-events: auto;
}

.toast.success {
    background: rgba(0, 184, 148, 0.95);
    color: white;
}

.toast.error {
    background: rgba(255, 118, 117, 0.95);
    color: white;
}

.toast.info {
    background: rgba(108, 92, 231, 0.95);
    color: white;
}

.toast.warning {
    background: rgba(253, 203, 110, 0.95);
    color: #333;
}

.toast-exit {
    animation: toastOut 0.3s ease-in forwards;
}

@keyframes toastIn {
    from { opacity: 0; transform: translateX(50px); }
    to { opacity: 1; transform: translateX(0); }
}

@keyframes toastOut {
    from { opacity: 1; transform: translateX(0); }
    to { opacity: 0; transform: translateX(50px); }
}

/* ============================================
   粒子特效
   ============================================ */
.particles-container {
    position: fixed;
    top: 0; left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 9998;
    overflow: hidden;
}

.particle {
    position: absolute;
    pointer-events: none;
    animation: particleFly 1s ease-out forwards;
}

@keyframes particleFly {
    0% {
        opacity: 1;
        transform: translate(0, 0) scale(1);
    }
    100% {
        opacity: 0;
        transform: translate(var(--tx), var(--ty)) scale(0);
    }
}

/* ============================================
   庆祝撒花 Canvas
   ============================================ */
.confetti-canvas {
    position: fixed;
    top: 0; left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 9997;
}

/* ============================================
   空状态
   ============================================ */
.empty-state {
    text-align: center;
    padding: 60px 20px;
    color: var(--text-muted);
}

.empty-state span {
    font-size: 60px;
    display: block;
    margin-bottom: 16px;
}

.empty-state p {
    font-size: 16px;
}

/* ============================================
   快捷键提示条
   ============================================ */
.shortcuts-hint {
    position: fixed;
    bottom: 60px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    gap: 16px;
    padding: 8px 16px;
    background: var(--bg-nav);
    backdrop-filter: blur(10px);
    border-radius: 20px;
    border: 1px solid var(--nav-border);
    z-index: 50;
    font-size: 11px;
    color: var(--text-muted);
    white-space: nowrap;
    opacity: 0;
    transition: opacity 0.3s ease;
    pointer-events: none;
}

.app-container:hover .shortcuts-hint {
    opacity: 1;
}

.shortcuts-hint kbd {
    display: inline-block;
    padding: 1px 6px;
    background: var(--bg-hover);
    border: 1px solid var(--border-medium);
    border-radius: 4px;
    font-family: inherit;
    font-size: 11px;
    color: var(--primary-light);
    margin: 0 2px;
}

/* ============================================
   主题切换按钮
   ============================================ */
.theme-toggle {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    border: 1px solid var(--border-medium);
    background: var(--bg-hover);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    transition: var(--transition);
    color: var(--text-secondary);
    padding: 0;
    line-height: 1;
}

.theme-toggle:hover {
    transform: rotate(30deg) scale(1.1);
    background: var(--bg-item);
    border-color: var(--border-primary);
}

.theme-toggle:active {
    transform: rotate(30deg) scale(0.95);
}

/* 启动画面主题切换 - 右上角固定 */
.splash-theme-toggle {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 1001;
    width: 44px;
    height: 44px;
    font-size: 22px;
    border: 1px solid rgba(255, 255, 255, 0.2);
    background: rgba(255, 255, 255, 0.08);
    color: rgba(255, 255, 255, 0.7);
}

/* 启动画面声音按钮 - 在主题按钮左侧 */
.sound-toggle.splash-theme-toggle {
    right: 74px;
}

.splash-theme-toggle:hover {
    background: rgba(255, 255, 255, 0.15);
    color: rgba(255, 255, 255, 0.9);
    border-color: rgba(255, 255, 255, 0.35);
}

[data-theme="light"] .splash-theme-toggle {
    border-color: rgba(108, 92, 231, 0.2);
    background: rgba(108, 92, 231, 0.08);
    color: var(--text-secondary);
}

[data-theme="light"] .splash-theme-toggle:hover {
    background: rgba(108, 92, 231, 0.15);
    border-color: rgba(108, 92, 231, 0.3);
}

/* ============================================
   响应式
   ============================================ */
@media (max-width: 1024px) {
    .cards-grid.grid-16 { grid-template-columns: repeat(4, 1fr); }
    .cards-grid.grid-20 { grid-template-columns: repeat(4, 1fr); }
}

@media (max-width: 768px) {
    .top-nav {
        flex-wrap: wrap;
        gap: 8px;
        padding: 10px 16px;
    }

    .nav-center {
        order: 3;
        width: 100%;
    }

    .game-info {
        width: 100%;
        justify-content: center;
    }

    .info-badge {
        font-size: 12px;
        padding: 3px 8px;
    }

    .cards-grid {
        gap: 10px;
    }

    .cards-grid.grid-4,
    .cards-grid.grid-6,
    .cards-grid.grid-8,
    .cards-grid.grid-9,
    .cards-grid.grid-12,
    .cards-grid.grid-16,
    .cards-grid.grid-20 {
        grid-template-columns: repeat(3, 1fr);
    }

    .flip-card {
        min-height: 120px;
    }

    .card-back-icon {
        font-size: 36px;
    }

    .card-back-label {
        font-size: 12px;
    }

    .card-back-pattern {
        font-size: 50px;
    }

    .card-front-title {
        font-size: 14px;
    }

    .card-front-content {
        font-size: 12px;
    }

    .bottom-bar {
        flex-wrap: wrap;
        gap: 8px;
        padding: 10px 16px;
    }

    .bottom-center {
        order: 3;
        width: 100%;
        max-width: none;
    }

    .bottom-left, .bottom-right {
        flex: 1;
    }

    .bottom-left {
        justify-content: flex-start;
    }

    .bottom-right {
        justify-content: flex-end;
    }

    .mode-selector {
        grid-template-columns: 1fr;
    }

    .panel {
        width: 100%;
    }

    .splash-content h1 {
        font-size: 36px;
    }

    .splash-icon {
        font-size: 60px;
    }

    .shortcuts-hint {
        display: none;
    }
}

@media (max-width: 480px) {
    .cards-grid.grid-4,
    .cards-grid.grid-6,
    .cards-grid.grid-8,
    .cards-grid.grid-9,
    .cards-grid.grid-12,
    .cards-grid.grid-16,
    .cards-grid.grid-20 {
        grid-template-columns: repeat(2, 1fr);
    }

    .flip-card {
        min-height: 100px;
    }

    .card-back-icon {
        font-size: 30px;
    }

    .card-back-pattern {
        font-size: 40px;
    }

    .card-front-icon {
        font-size: 28px;
    }

    .card-front-title {
        font-size: 13px;
    }

    .card-front-content {
        font-size: 11px;
        max-height: 50px;
    }

    .nav-right .btn span {
        display: none;
    }

    .bottom-left .btn,
    .bottom-right .btn {
        font-size: 12px;
        padding: 6px 10px;
    }

    .modal-content {
        border-radius: var(--radius-md);
    }

    .splash-content h1 {
        font-size: 28px;
    }
}

/* ============================================
   大屏幕优化（投影仪/大屏幕）
   ============================================ */
@media (min-width: 1400px) {
    .cards-grid.grid-4 { max-width: 800px; }
    .cards-grid.grid-6 { max-width: 750px; }
    .cards-grid.grid-8 { max-width: 900px; }
    .cards-grid.grid-9 { max-width: 800px; }
    .cards-grid.grid-12 { max-width: 950px; }
    .cards-grid.grid-16 { max-width: 1000px; }
    .cards-grid.grid-20 { max-width: 1100px; }

    .flip-card {
        min-height: 180px;
    }

    .card-back-icon {
        font-size: 54px;
    }

    .card-back-label {
        font-size: 16px;
    }

    .card-back-pattern {
        font-size: 100px;
    }

    .card-front-icon {
        font-size: 40px;
    }

    .card-front-title {
        font-size: 18px;
    }

    .card-front-content {
        font-size: 15px;
        max-height: 100px;
    }
}

/* ============================================
   选择器适配
   ============================================ */
select {
    padding: 8px 12px;
    border: 1px solid var(--border-primary);
    border-radius: var(--radius-sm);
    background: var(--bg-input);
    color: var(--text-primary);
    font-size: 14px;
    font-family: inherit;
    outline: none;
    cursor: pointer;
}

select option {
    background: var(--option-bg);
    color: var(--text-primary);
}

input[type="text"],
input[type="number"] {
    padding: 8px 12px;
    border: 1px solid var(--border-primary);
    border-radius: var(--radius-sm);
    background: var(--bg-input);
    color: var(--text-primary);
    font-size: 14px;
    font-family: inherit;
    outline: none;
}

input:focus, textarea:focus {
    border-color: var(--primary);
}
