/* ==========================================================================
   Pictionary单词生成器 - 样式表
   SEO优化、响应式设计、无障碍访问
   ========================================================================== */

/* CSS自定义属性 (变量) */
:root {
    /* 颜色系统 */
    --primary-color: #6C63FF;
    --primary-dark: #554FD8;
    --primary-light: #8A85FF;
    --secondary-color: #FF6584;
    --secondary-dark: #E04A6D;
    --accent-color: #36D1DC;
    --accent-dark: #1FB5C0;

    /* 中性色 */
    --white: #FFFFFF;
    --light-gray: #F8F9FA;
    --medium-gray: #E9ECEF;
    --gray: #ADB5BD;
    --dark-gray: #495057;
    --black: #212529;

    /* 难度颜色 */
    --easy-color: #4CAF50;
    --easy-light: #81C784;
    --medium-color: #FF9800;
    --medium-light: #FFB74D;
    --hard-color: #F44336;
    --hard-light: #EF5350;

    /* 状态颜色 */
    --success-color: #28A745;
    --warning-color: #FFC107;
    --danger-color: #DC3545;
    --info-color: #17A2B8;

    /* 设计系统 */
    --border-radius: 12px;
    --border-radius-sm: 8px;
    --border-radius-lg: 16px;
    --box-shadow: 0 8px 24px rgba(0, 0, 0, 0.1);
    --box-shadow-lg: 0 16px 48px rgba(0, 0, 0, 0.15);
    --box-shadow-sm: 0 4px 12px rgba(0, 0, 0, 0.08);
    --transition: all 0.3s ease;
    --transition-fast: all 0.15s ease;

    /* 排版 */
    --font-family-primary: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    --font-family-secondary: 'Poppins', var(--font-family-primary);
    --line-height: 1.6;
    --line-height-tight: 1.4;
}

/* ==========================================================================
   重置和基础样式
   ========================================================================== */
*,
*::before,
*::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    font-size: 16px;
    scroll-behavior: smooth;
}

body {
    font-family: var(--font-family-primary);
    line-height: var(--line-height);
    color: var(--black);
    background-color: var(--light-gray);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    overflow-x: hidden;
}

.container {
    width: 100%;
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
}

/* ==========================================================================
   无障碍访问工具类
   ========================================================================== */
.visually-hidden {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

.skip-to-content {
    position: absolute;
    top: -40px;
    left: 0;
    background: var(--primary-color);
    color: var(--white);
    padding: 8px 16px;
    text-decoration: none;
    border-radius: var(--border-radius-sm);
    z-index: 9999;
    transition: var(--transition);
}

.skip-to-content:focus {
    top: 10px;
    outline: 3px solid var(--primary-color);
    outline-offset: 2px;
}

/* ==========================================================================
   头部样式
   ========================================================================== */
.header {
    background: linear-gradient(90deg, var(--primary-color) 0%, var(--accent-color) 100%);
    color: var(--white);
    padding: 1.5rem 0;
    box-shadow: var(--box-shadow);
    position: sticky;
    top: 0;
    z-index: 1000;
}

.header-content {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 1.5rem;
}

.logo-section {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.logo {
    font-family: var(--font-family-secondary);
    font-size: 1.8rem;
    font-weight: 700;
    margin: 0;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.logo-icon {
    font-size: 2rem;
}

.tagline {
    font-size: 1rem;
    opacity: 0.9;
    font-weight: 300;
}

/* 导航菜单 */
.nav-menu {
    display: flex;
    list-style: none;
    gap: 1.5rem;
    flex-wrap: wrap;
}

.nav-menu a {
    color: var(--white);
    text-decoration: none;
    font-weight: 500;
    padding: 0.5rem 1rem;
    border-radius: var(--border-radius-sm);
    transition: var(--transition);
    position: relative;
}

.nav-menu a:hover,
.nav-menu a:focus {
    background: rgba(255, 255, 255, 0.15);
    outline: none;
}

.nav-menu a[aria-current="page"] {
    background: rgba(255, 255, 255, 0.2);
    font-weight: 600;
}

/* ==========================================================================
   主要内容区域
   ========================================================================== */
.main {
    padding: 3rem 0;
    min-height: 60vh;
}

/* ==========================================================================
   单词生成器区域
   ========================================================================== */
.generator-section {
    background: var(--white);
    border-radius: var(--border-radius-lg);
    padding: 2.5rem;
    margin-bottom: 3rem;
    box-shadow: var(--box-shadow);
}

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

.generator-header h3 {
    font-family: var(--font-family-secondary);
    font-size: 1.8rem;
    color: var(--black);
    margin-bottom: 1rem;
}

.generator-header p {
    font-size: 1.1rem;
    color: var(--dark-gray);
    max-width: 600px;
    margin: 0 auto;
}

/* 单词显示区域 */
.word-display {
    background: linear-gradient(135deg, var(--primary-light) 0%, var(--accent-color) 100%);
    border-radius: var(--border-radius);
    padding: 3rem 2rem;
    margin: 0 auto 2.5rem;
    text-align: center;
    color: var(--white);
    min-height: 220px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition);
    max-width: 800px;
}

.word-display:hover {
    transform: translateY(-5px);
    box-shadow: var(--box-shadow-lg);
}

.word-placeholder {
    font-size: 1.3rem;
    opacity: 0.9;
}

.placeholder-icon {
    font-size: 3.5rem;
    margin-bottom: 1rem;
    opacity: 0.8;
}

.word-display.active {
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--accent-dark) 100%);
}

.word-content {
    animation: fadeInUp 0.5s ease;
}

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

.word-text {
    font-size: 3.5rem;
    font-weight: 700;
    font-family: var(--font-family-secondary);
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.2);
    margin-bottom: 1rem;
}

.word-difficulty {
    display: inline-block;
    padding: 0.5rem 1.5rem;
    border-radius: 50px;
    font-weight: 600;
    font-size: 0.9rem;
    background: rgba(255, 255, 255, 0.2);
}

.word-difficulty.easy {
    color: var(--easy-light);
}

.word-difficulty.medium {
    color: var(--medium-light);
}

.word-difficulty.hard {
    color: var(--hard-light);
}

/* 控制面板 */
.controls-panel {
    display: flex;
    flex-direction: column;
    gap: 2.5rem;
    max-width: 800px;
    margin: 0 auto;
}

/* 按钮样式 */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 1rem 2rem;
    border: none;
    border-radius: 50px;
    font-family: var(--font-family-secondary);
    font-size: 1.1rem;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
    text-decoration: none;
    position: relative;
}

.btn:focus {
    outline: 3px solid var(--primary-color);
    outline-offset: 2px;
}

.btn-primary {
    background: linear-gradient(90deg, var(--primary-color) 0%, var(--primary-dark) 100%);
    color: var(--white);
    box-shadow: 0 4px 15px rgba(108, 99, 255, 0.3);
}

.btn-primary:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 20px rgba(108, 99, 255, 0.4);
}

.btn-primary:active {
    transform: translateY(-1px);
}

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

.btn-secondary:hover {
    background: var(--primary-color);
    color: var(--white);
}

.btn-generate {
    align-self: center;
    min-width: 250px;
}

.btn-shortcut {
    font-size: 0.9rem;
    opacity: 0.7;
    margin-left: 0.5rem;
}

/* 难度选择 */
.difficulty-section {
    text-align: center;
}

.difficulty-section h4 {
    font-size: 1.2rem;
    margin-bottom: 1rem;
    color: var(--black);
}

.difficulty-options {
    display: flex;
    justify-content: center;
    gap: 1rem;
    flex-wrap: wrap;
}

.difficulty-btn {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.8rem 1.8rem;
    border: 2px solid var(--medium-gray);
    background: var(--white);
    border-radius: 50px;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
    min-width: 100px;
    justify-content: center;
}

.difficulty-btn[aria-checked="true"],
.difficulty-btn.active {
    color: var(--white);
    border-color: transparent;
}

.difficulty-btn[data-difficulty="all"][aria-checked="true"],
.difficulty-btn[data-difficulty="all"].active {
    background: linear-gradient(90deg, var(--primary-color) 0%, var(--accent-color) 100%);
}

.difficulty-btn[data-difficulty="easy"][aria-checked="true"],
.difficulty-btn[data-difficulty="easy"].active {
    background-color: var(--easy-color);
}

.difficulty-btn[data-difficulty="medium"][aria-checked="true"],
.difficulty-btn[data-difficulty="medium"].active {
    background-color: var(--medium-color);
}

.difficulty-btn[data-difficulty="hard"][aria-checked="true"],
.difficulty-btn[data-difficulty="hard"].active {
    background-color: var(--hard-color);
}

.difficulty-btn:hover:not([aria-checked="true"]):not(.active) {
    border-color: var(--primary-color);
    color: var(--primary-color);
}

/* 计时器 */
.timer-section {
    background: var(--light-gray);
    border-radius: var(--border-radius);
    padding: 1.8rem;
    text-align: center;
}

.timer-section h4 {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    font-size: 1.2rem;
    margin-bottom: 1.5rem;
    color: var(--black);
}

.timer-display {
    display: flex;
    align-items: baseline;
    justify-content: center;
    gap: 0.5rem;
    margin-bottom: 1.5rem;
}

.timer {
    font-size: 4rem;
    font-weight: 700;
    font-family: var(--font-family-secondary);
    color: var(--primary-color);
    transition: var(--transition);
}

.timer.running {
    color: var(--secondary-color);
    animation: pulse 1s infinite;
}

@keyframes pulse {
    0% { transform: scale(1); }
    50% { transform: scale(1.05); }
    100% { transform: scale(1); }
}

.timer-unit {
    font-size: 1.5rem;
    color: var(--dark-gray);
    font-weight: 500;
}

.timer-controls {
    display: flex;
    gap: 1rem;
    justify-content: center;
}

.btn-timer {
    min-width: 140px;
}

/* ==========================================================================
   游戏规则区域
   ========================================================================== */
.instructions-section {
    background: var(--white);
    border-radius: var(--border-radius-lg);
    padding: 2.5rem;
    margin-bottom: 3rem;
    box-shadow: var(--box-shadow);
}

.instructions-section h2 {
    font-family: var(--font-family-secondary);
    font-size: 1.8rem;
    margin-bottom: 2.5rem;
    color: var(--black);
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.instructions-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 2rem;
}

.instruction-card {
    display: flex;
    gap: 1.5rem;
    align-items: flex-start;
    padding: 1.5rem;
    background: var(--light-gray);
    border-radius: var(--border-radius);
    transition: var(--transition);
}

.instruction-card:hover {
    transform: translateY(-5px);
    box-shadow: var(--box-shadow-sm);
}

.instruction-number {
    background: var(--primary-color);
    color: var(--white);
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 1.2rem;
    flex-shrink: 0;
}

.instruction-content h3 {
    font-size: 1.3rem;
    margin-bottom: 0.5rem;
    color: var(--black);
}

.instruction-content p {
    color: var(--dark-gray);
}

/* ==========================================================================
   功能特点区域
   ========================================================================== */
.features-section {
    background: var(--white);
    border-radius: var(--border-radius-lg);
    padding: 2.5rem;
    margin-bottom: 3rem;
    box-shadow: var(--box-shadow);
}

.features-section h2 {
    font-family: var(--font-family-secondary);
    font-size: 1.8rem;
    margin-bottom: 2.5rem;
    color: var(--black);
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

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

.feature-card {
    background: var(--light-gray);
    border-radius: var(--border-radius);
    padding: 2rem;
    text-align: center;
    transition: var(--transition);
}

.feature-card:hover {
    transform: translateY(-10px);
    box-shadow: var(--box-shadow);
}

.feature-icon {
    width: 70px;
    height: 70px;
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--accent-color) 100%);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 1.5rem;
    font-size: 1.8rem;
    color: var(--white);
}

.feature-content h3 {
    font-size: 1.3rem;
    margin-bottom: 0.8rem;
    color: var(--black);
}

.feature-content p {
    color: var(--dark-gray);
}

/* ==========================================================================
   关于区域
   ========================================================================== */
.about-section {
    background: var(--white);
    border-radius: var(--border-radius-lg);
    padding: 2.5rem;
    margin-bottom: 3rem;
    box-shadow: var(--box-shadow);
}

.about-section h2 {
    font-family: var(--font-family-secondary);
    font-size: 1.8rem;
    margin-bottom: 2rem;
    color: var(--black);
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.about-content {
    line-height: var(--line-height);
}

.about-content p {
    margin-bottom: 2rem;
    color: var(--dark-gray);
    font-size: 1.1rem;
}

.about-details {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 2rem;
    margin-top: 2rem;
}

.about-detail h3 {
    font-size: 1.3rem;
    margin-bottom: 1rem;
    color: var(--black);
}

.about-detail ul {
    list-style: none;
}

.about-detail li {
    margin-bottom: 0.5rem;
    padding-left: 1.5rem;
    position: relative;
    color: var(--dark-gray);
}

.about-detail li::before {
    content: "•";
    position: absolute;
    left: 0;
    color: var(--primary-color);
    font-weight: bold;
}

/* ==========================================================================
   页脚样式
   ========================================================================== */
.footer {
    background: var(--black);
    color: var(--white);
    padding: 3rem 0 2rem;
    margin-top: 4rem;
}

.footer-content {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 3rem;
    margin-bottom: 3rem;
}

.footer-brand {
    margin-bottom: 1.5rem;
}

.footer-logo {
    font-family: var(--font-family-secondary);
    font-size: 1.5rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.footer-tagline {
    font-size: 1rem;
    opacity: 0.8;
}

.footer-description p {
    color: var(--gray);
    line-height: var(--line-height);
}

.footer-links {
    display: flex;
    flex-wrap: wrap;
    gap: 3rem;
}

.footer-nav h4 {
    font-size: 1.1rem;
    margin-bottom: 1.2rem;
    color: var(--white);
}

.footer-nav ul {
    list-style: none;
}

.footer-nav li {
    margin-bottom: 0.8rem;
}

.footer-nav a {
    color: var(--gray);
    text-decoration: none;
    transition: var(--transition);
}

.footer-nav a:hover,
.footer-nav a:focus {
    color: var(--white);
    outline: none;
}

.footer-social h4 {
    font-size: 1.1rem;
    margin-bottom: 1.2rem;
    color: var(--white);
}

.social-links {
    display: flex;
    gap: 1rem;
}

.social-link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 50%;
    color: var(--white);
    text-decoration: none;
    font-size: 1.2rem;
    transition: var(--transition);
}

.social-link:hover,
.social-link:focus {
    background: var(--primary-color);
    transform: translateY(-3px);
    outline: none;
}

.footer-bottom {
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    padding-top: 2rem;
    text-align: center;
}

.copyright {
    color: var(--gray);
    margin-bottom: 1rem;
    font-size: 0.9rem;
}

.copyright a {
    color: var(--gray);
    text-decoration: none;
    transition: var(--transition);
}

.copyright a:hover,
.copyright a:focus {
    color: var(--white);
    outline: none;
}

.footer-separator {
    margin: 0 0.5rem;
    opacity: 0.5;
}

.footer-note {
    color: var(--gray);
    font-size: 0.85rem;
    line-height: var(--line-height-tight);
    max-width: 800px;
    margin: 0 auto;
}

/* ==========================================================================
   响应式设计
   ========================================================================== */

/* 平板设备 (768px以下) */
@media (max-width: 768px) {
    .header-content {
        flex-direction: column;
        text-align: center;
        gap: 1rem;
    }

    .nav-menu {
        justify-content: center;
    }

    .main {
        padding: 2rem 0;
    }

    .generator-section,
    .instructions-section,
    .features-section,
    .about-section {
        padding: 1.5rem;
    }

    .word-display {
        padding: 2rem 1.5rem;
        min-height: 180px;
    }

    .word-text {
        font-size: 2.5rem;
    }

    .timer {
        font-size: 3rem;
    }

    .controls-panel {
        gap: 2rem;
    }

    .timer-controls {
        flex-direction: column;
        align-items: center;
    }

    .btn-timer {
        width: 100%;
        max-width: 250px;
    }

    .btn-generate {
        width: 100%;
        max-width: 300px;
    }
}

/* 手机设备 (480px以下) */
@media (max-width: 480px) {
    .container {
        padding: 0 15px;
    }

    .logo {
        font-size: 1.5rem;
    }

    .tagline {
        font-size: 0.9rem;
    }

    .nav-menu {
        gap: 0.5rem;
    }

    .nav-menu a {
        padding: 0.4rem 0.8rem;
        font-size: 0.9rem;
    }

    .word-display {
        padding: 1.5rem 1rem;
        min-height: 160px;
    }

    .word-text {
        font-size: 2rem;
    }

    .btn {
        padding: 0.8rem 1.5rem;
        font-size: 1rem;
    }

    .difficulty-options {
        gap: 0.5rem;
    }

    .difficulty-btn {
        padding: 0.6rem 1.2rem;
        min-width: 80px;
        font-size: 0.9rem;
    }

    .instructions-grid,
    .features-grid {
        grid-template-columns: 1fr;
    }

    .instruction-card {
        flex-direction: column;
        text-align: center;
        gap: 1rem;
    }

    .instruction-number {
        margin: 0 auto;
    }

    .footer-content {
        grid-template-columns: 1fr;
        gap: 2rem;
    }

    .footer-links {
        flex-direction: column;
        gap: 2rem;
    }
}

/* 大屏幕设备 (1200px以上) */
@media (min-width: 1200px) {
    .container {
        max-width: 1140px;
    }
}

/* 打印样式 */
@media print {
    .header,
    .footer,
    .btn,
    .difficulty-options,
    .timer-controls {
        display: none !important;
    }

    body {
        background: white !important;
        color: black !important;
    }

    .container {
        max-width: 100% !important;
        padding: 0 !important;
    }

    .main {
        padding: 1rem 0 !important;
    }

    .word-display {
        background: white !important;
        color: black !important;
        border: 2px solid black !important;
        min-height: auto !important;
    }

    a {
        color: black !important;
        text-decoration: underline !important;
    }
}

/* 高对比度模式支持 */
@media (prefers-contrast: high) {
    :root {
        --primary-color: #0000FF;
        --secondary-color: #FF0000;
        --black: #000000;
        --white: #FFFFFF;
    }

    .word-display {
        border: 2px solid var(--black);
    }
}

/* 减少动画偏好 */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }

    html {
        scroll-behavior: auto;
    }

    .word-display:hover,
    .feature-card:hover,
    .instruction-card:hover,
    .btn-primary:hover,
    .social-link:hover {
        transform: none !important;
    }

    .timer.running {
        animation: none !important;
    }
}