/* 表情你猜我猜 - 主样式文件 */

/* ===== CSS变量定义 ===== */
:root {
    --primary-color: #667eea;
    --secondary-color: #764ba2;
    --success-color: #10b981;
    --error-color: #ef4444;
    --warning-color: #f59e0b;
    --info-color: #3b82f6;

    --text-primary: #1f2937;
    --text-secondary: #6b7280;
    --text-light: #9ca3af;
    
    --bg-primary: #ffffff;
    --bg-secondary: #f9fafb;
    --bg-tertiary: #f3f4f6;
    
    --border-color: #e5e7eb;
    --border-radius: 12px;
    --border-radius-lg: 16px;
    --border-radius-xl: 20px;
    
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
    --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
    
    --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    --transition-fast: all 0.15s ease-in-out;
}

/* ===== 基础样式重置 ===== */
* {
    box-sizing: border-box;
}

/* 紧急修复 - 确保所有文字都可见 */
* {
    color: #1f2937 !important;
}

.action-btn.primary,
.action-btn.primary * {
    color: white !important;
}

.action-btn.secondary,
.action-btn.secondary * {
    color: #667eea !important;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    line-height: 1.6;
    color: var(--text-primary) !important;
    background-color: var(--bg-secondary);
    margin: 0;
    padding: 0;
}

/* 确保所有文字都能正常显示 */
h1, h2, h3, h4, h5, h6, p, span, div, a, button {
    color: inherit;
}

/* 强制设置主要文字颜色 */
.game-title,
.game-description,
.feature-text h3,
.feature-text p,
.btn-text,
.modal-header h3,
.form-group label {
    color: var(--text-primary) !important;
}

/* 调试样式 - 确保文字可见 */
.feature-item * {
    color: #1f2937 !important;
}

.action-btn * {
    color: inherit !important;
}

.modal * {
    color: #1f2937 !important;
}

.action-btn.primary {
    color: white !important;
}

.action-btn.primary * {
    color: white !important;
}

/* ===== 容器布局 ===== */
.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
}

/* ===== 游戏介绍区域 ===== */
.game-intro {
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--secondary-color) 100%);
    color: white;
    padding: clamp(30px, 5vw, 50px) clamp(20px, 4vw, 40px);
    border-radius: var(--border-radius-xl);
    margin-bottom: clamp(20px, 4vw, 30px);
    text-align: center;
    position: relative;
    overflow: hidden;
    box-shadow: var(--shadow-xl);
}

.game-intro::before {
    content: '';
    position: absolute;
    top: -50%;
    right: -50%;
    width: 200%;
    height: 200%;
    background: radial-gradient(circle, rgba(255,255,255,0.1) 0%, transparent 70%);
    animation: float 6s ease-in-out infinite;
}

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

.game-title {
    font-size: clamp(28px, 6vw, 42px);
    margin-bottom: 15px;
    font-weight: 700;
    text-shadow: 0 2px 4px rgba(0,0,0,0.1);
    letter-spacing: -0.02em;
    position: relative;
    z-index: 1;
}

.game-description {
    font-size: clamp(16px, 3vw, 20px);
    opacity: 0.95;
    margin: 0 auto;
    line-height: 1.6;
    max-width: 600px;
    position: relative;
    z-index: 1;
}

/* ===== 操作按钮 ===== */
.action-buttons {
    display: flex;
    gap: clamp(15px, 3vw, 25px);
    justify-content: center;
    margin: clamp(30px, 5vw, 40px) 0;
    position: relative;
    z-index: 1;
    flex-wrap: wrap;
}

.action-btn {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: clamp(14px, 3vw, 18px) clamp(25px, 5vw, 35px);
    border: none;
    border-radius: var(--border-radius-lg);
    font-size: clamp(14px, 3vw, 16px);
    font-weight: 600;
    text-decoration: none;
    cursor: pointer;
    transition: var(--transition);
    min-width: clamp(140px, 30vw, 180px);
    justify-content: center;
    position: relative;
    overflow: hidden;
    box-shadow: var(--shadow-md);
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
}

.action-btn.primary {
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--secondary-color) 100%);
    color: white;
}

.action-btn.primary:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-xl);
    filter: brightness(1.05);
}

.action-btn.primary:active {
    transform: translateY(0);
    box-shadow: var(--shadow-md);
}

.action-btn.secondary {
    background: var(--bg-primary);
    color: var(--primary-color);
    border: 2px solid var(--primary-color);
}

.action-btn.secondary:hover {
    background: var(--primary-color);
    color: white;
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
}

.action-btn.secondary:active {
    transform: translateY(0);
}

.btn-icon {
    font-size: 1.2em;
}

.btn-text {
    font-weight: 600;
    color: inherit;
}

/* ===== 游戏特性展示 ===== */
.game-features {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: clamp(20px, 4vw, 30px);
    margin: clamp(40px, 6vw, 60px) 0;
}

.feature-item {
    background: var(--bg-primary);
    padding: clamp(24px, 5vw, 32px);
    border-radius: var(--border-radius-lg);
    text-align: center;
    box-shadow: var(--shadow-md);
    transition: var(--transition);
    border: 1px solid var(--border-color);
}

.feature-item:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-xl);
}

.feature-icon {
    font-size: clamp(36px, 8vw, 48px);
    margin-bottom: 16px;
    display: block;
}

.feature-text {
    text-align: center;
}

.feature-text h3 {
    font-size: clamp(18px, 4vw, 22px);
    font-weight: 700;
    color: var(--text-primary);
    margin: 0 0 12px 0;
}

.feature-text p {
    color: var(--text-secondary);
    font-size: clamp(14px, 3vw, 16px);
    line-height: 1.6;
    margin: 0;
}

.feature-title {
    font-size: clamp(18px, 4vw, 22px);
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 12px;
}

.feature-description {
    color: var(--text-secondary);
    font-size: clamp(14px, 3vw, 16px);
    line-height: 1.6;
}

/* ===== 示例展示 ===== */
.game-example {
    background: var(--bg-primary);
    border-radius: var(--border-radius-lg);
    padding: clamp(30px, 5vw, 40px);
    margin: clamp(40px, 6vw, 60px) 0;
    box-shadow: var(--shadow-md);
    border: 1px solid var(--border-color);
}

.example-header {
    text-align: center;
    margin-bottom: 30px;
}

.example-title {
    font-size: clamp(20px, 4vw, 28px);
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 8px;
}

.example-subtitle {
    color: var(--text-secondary);
    font-size: clamp(14px, 3vw, 16px);
}

.example-content {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 30px;
    align-items: center;
}

.example-puzzle {
    text-align: center;
    padding: 30px 20px;
    background: linear-gradient(135deg, #f0f4ff 0%, #e0e7ff 100%);
    border-radius: var(--border-radius);
    border: 2px solid #c7d2fe;
}

.puzzle-emojis {
    font-size: clamp(32px, 8vw, 48px);
    margin-bottom: 16px;
    letter-spacing: 4px;
}

.puzzle-answer {
    font-size: clamp(16px, 4vw, 20px);
    font-weight: 600;
    color: var(--primary-color);
}

/* ===== 页脚 ===== */
.game-footer {
    background: var(--bg-primary);
    border-top: 1px solid var(--border-color);
    padding: clamp(30px, 5vw, 40px) 0;
    margin-top: clamp(60px, 8vw, 80px);
}

.footer-content {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 30px;
    text-align: center;
}

.footer-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
}

.footer-icon {
    font-size: 32px;
    color: var(--primary-color);
}

.footer-title {
    font-size: 16px;
    font-weight: 600;
    color: var(--text-primary);
}

.footer-text {
    font-size: 14px;
    color: var(--text-secondary);
    line-height: 1.5;
}

/* ===== 响应式设计 ===== */
@media (max-width: 768px) {
    .container {
        padding: 0 15px;
    }
    
    .action-buttons {
        flex-direction: column;
        align-items: stretch;
        gap: 15px;
    }

    .action-btn {
        width: 100%;
        max-width: none;
    }

    .game-features {
        grid-template-columns: 1fr;
        gap: 20px;
    }

    .example-content {
        grid-template-columns: 1fr;
        gap: 20px;
    }

    .footer-content {
        grid-template-columns: 1fr;
        gap: 20px;
    }

    .modal {
        padding: 10px;
        align-items: flex-start;
        padding-top: 20px;
    }

    .modal-content {
        margin: 0;
        max-width: 100%;
        max-height: calc(100vh - 40px);
        border-radius: var(--border-radius);
    }

    .modal-header,
    .modal-body,
    .modal-footer {
        padding: 16px 20px;
    }

    .modal-header h3 {
        font-size: 18px;
    }

    .modal-footer {
        flex-direction: column;
    }

    .action-btn {
        width: 100%;
        justify-content: center;
        min-height: 48px;
        font-size: 16px;
    }

    .form-group {
        margin-bottom: 20px;
    }

    .form-group label {
        font-size: 14px;
        margin-bottom: 8px;
    }

    .form-select,
    input[type="text"],
    input[type="password"] {
        font-size: 16px;
        padding: 12px 16px;
        min-height: 48px;
        border-radius: var(--border-radius);
    }

    .form-hint {
        font-size: 12px;
        margin-top: 6px;
    }

    .close-btn {
        width: 32px;
        height: 32px;
        font-size: 20px;
    }
}

@media (max-width: 480px) {
    .container {
        padding: 0 10px;
    }
    
    .game-intro {
        padding: 25px 20px;
        margin-bottom: 20px;
    }
    
    .feature-item {
        padding: 20px;
    }
    
    .game-example {
        padding: 25px 20px;
    }
    
    .example-puzzle {
        padding: 20px 15px;
    }
}

/* ===== 实用工具类 ===== */
.text-center { text-align: center; }
.text-left { text-align: left; }
.text-right { text-align: right; }

.hidden { display: none !important; }
.visible { display: block !important; }

.fade-in {
    animation: fadeIn 0.5s ease-out;
}

.slide-in {
    animation: slideIn 0.5s ease-out;
}

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

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

/* ===== 模态框样式 ===== */
.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: 1000;
    backdrop-filter: blur(8px);
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
    padding: 20px;
    box-sizing: border-box;
}

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

.modal-content {
    background: var(--bg-primary);
    border-radius: var(--border-radius-lg);
    max-width: min(420px, 100vw - 40px);
    width: 100%;
    max-height: min(85vh, 100vh - 40px);
    overflow-y: auto;
    box-shadow: var(--shadow-xl);
    transform: scale(0.95) translateY(20px);
    transition: all 0.3s ease;
    border: 1px solid var(--border-color);
    position: relative;
    margin: auto;
}

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

.modal-header {
    padding: 20px 24px;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: linear-gradient(135deg, #f8fafc 0%, #f1f5f9 100%);
}

.modal-header h3 {
    margin: 0;
    font-size: 20px;
    font-weight: 700;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: 8px;
}

.close-btn {
    background: none;
    border: none;
    font-size: 24px;
    color: var(--text-light);
    cursor: pointer;
    padding: 4px;
    border-radius: 4px;
    transition: all 0.2s ease;
    line-height: 1;
}

.close-btn:hover {
    background: rgba(0, 0, 0, 0.1);
    color: var(--text-primary);
}

.modal-body {
    padding: 24px;
}

.modal-footer {
    padding: 20px 24px;
    border-top: 1px solid var(--border-color);
    display: flex;
    gap: 12px;
    justify-content: center;
    background: #f8fafc;
}

.modal-footer .action-btn {
    min-width: 140px;
    justify-content: center;
}

.modal-footer .action-btn.ready {
    background: linear-gradient(135deg, var(--success-color) 0%, #059669 100%);
    transform: scale(1.02);
    box-shadow: 0 4px 12px rgba(16, 185, 129, 0.3);
}

.modal-footer .action-btn.ready:hover {
    background: linear-gradient(135deg, #059669 0%, #047857 100%);
    transform: scale(1.02) translateY(-1px);
}

/* ===== 表单样式 ===== */
.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
    color: var(--text-primary);
    font-size: 15px;
}

.form-group input {
    width: 100%;
    padding: 14px 16px;
    border: 2px solid var(--border-color);
    border-radius: var(--border-radius);
    font-size: 18px;
    transition: all 0.2s ease;
    background: white;
    font-family: 'Courier New', monospace;
    text-align: center;
    letter-spacing: 2px;
    text-transform: uppercase;
    font-weight: 600;
}

.form-group input:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.form-group.error input {
    border-color: var(--error-color);
    box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.1);
}

.form-hint {
    font-size: 13px;
    color: var(--text-light);
    margin-top: 6px;
}

.form-error {
    font-size: 13px;
    color: var(--error-color);
    margin-top: 6px;
    display: none;
    font-weight: 500;
}

.form-success {
    font-size: 13px;
    color: var(--success-color);
    margin-top: 6px;
    display: none;
    font-weight: 500;
}

/* ===== 加载状态 ===== */
.loading {
    position: relative;
    pointer-events: none;
}

.loading::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 16px;
    height: 16px;
    margin: -8px 0 0 -8px;
    border: 2px solid transparent;
    border-top: 2px solid currentColor;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* ===== 表单元素样式优化 ===== */
.form-select,
input[type="text"],
input[type="password"] {
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
    background-color: var(--bg-primary);
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    transition: all 0.2s ease;
}

.form-select:focus,
input[type="text"]:focus,
input[type="password"]:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

/* ===== 移动端优化 ===== */
@media (max-width: 768px) {
    /* 防止iOS输入框缩放 */
    .form-select,
    input[type="text"],
    input[type="password"] {
        font-size: 16px !important;
        transform: translateZ(0);
        -webkit-transform: translateZ(0);
    }

    /* 模态框在小屏幕上的优化 */
    .modal {
        padding: 10px;
        align-items: flex-start;
        padding-top: 20px;
    }

    .modal-content {
        max-height: calc(100vh - 40px);
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
    }

    /* 按钮触摸优化 */
    .action-btn,
    .close-btn {
        min-height: 44px;
        min-width: 44px;
    }

    /* 输入框触摸优化 */
    .form-select,
    input[type="text"],
    input[type="password"] {
        min-height: 44px;
        padding: 12px 16px;
    }
}
