/* ============= GLOBAL STYLES ============= */

@import url('https://fonts.googleapis.com/css2?family=Fredoka:wght@300;400;500;600;700&family=Nunito:wght@400;600;700&display=swap');

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Fredoka', 'Nunito', 'Microsoft YaHei', sans-serif;
    background: transparent;
    min-height: 100vh;
    position: relative;
    overflow-x: hidden;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
}

/* Background container for floating characters */
body::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: transparent;
    z-index: -1;
}

/* Floating Chinese Characters - in background with tooltips */
.floating-char {
    position: fixed;
    font-size: 80px;
    color: rgba(255, 107, 107, 0.3);
    pointer-events: auto;
    cursor: pointer;
    z-index: 1;
    font-weight: bold;
    transition: all 0.3s ease;
    user-select: none;
}

.floating-char:hover {
    color: rgba(255, 107, 107, 0.8);
    transform: scale(1.3);
    z-index: 1000;
}

/* Tooltip showing pinyin and meaning */
.char-tooltip {
    position: absolute;
    top: -65px;
    left: 50%;
    transform: translateX(-50%);
    background: linear-gradient(135deg, #ff6b6b 0%, #c44569 100%);
    color: white;
    padding: 10px 20px;
    border-radius: 15px;
    font-size: 16px;
    white-space: nowrap;
    pointer-events: none;
    box-shadow: 0 8px 25px rgba(255, 107, 107, 0.6);
    z-index: 10000 !important;
    font-family: 'Fredoka', sans-serif;
    font-weight: 600;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
}

.floating-char:hover .char-tooltip {
    opacity: 1 !important;
    visibility: visible !important;
}

/* Gentle floating animation for characters */
@keyframes float {
    0%, 100% { transform: translateY(0px) translateX(0px); }
    25% { transform: translateY(-20px) translateX(10px); }
    50% { transform: translateY(-40px) translateX(-10px); }
    75% { transform: translateY(-20px) translateX(5px); }
}

/* ============= AUTH PAGES ============= */

.page-wrapper {
    flex: 1;
    display: flex;
    flex-direction: column;
}

.auth-container {
    flex: 1;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 40px 20px;
    position: relative;
    z-index: 10;
}

.auth-box {
    background: white;
    border-radius: 30px;
    box-shadow: 0 30px 60px rgba(0,0,0,0.3);
    padding: 50px 40px;
    max-width: 450px;
    width: 100%;
    animation: slideIn 0.5s ease;
    position: relative;
    z-index: 10;
    overflow: hidden;
}

@keyframes slideIn {
    from { 
        opacity: 0; 
        transform: translateY(30px) scale(0.9);
    }
    to { 
        opacity: 1; 
        transform: translateY(0) scale(1);
    }
}

.auth-box h1 {
    text-align: center;
    font-size: 36px;
    margin-bottom: 10px;
    color: #ff6b6b;
    text-shadow: 2px 2px 4px rgba(255, 107, 107, 0.3);
}

.auth-box h2 {
    text-align: center;
    color: #555;
    margin-bottom: 30px;
    font-weight: 400;
    font-size: 24px;
}

.form-group {
    margin-bottom: 25px;
    animation: fadeInUp 0.5s ease;
    animation-fill-mode: both;
}

.form-group:nth-child(1) { animation-delay: 0.1s; }
.form-group:nth-child(2) { animation-delay: 0.2s; }
.form-group:nth-child(3) { animation-delay: 0.3s; }
.form-group:nth-child(4) { animation-delay: 0.4s; }

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

.form-group label {
    display: block;
    margin-bottom: 8px;
    color: #555;
    font-weight: 500;
    font-size: 14px;
}

.form-group input {
    width: 100%;
    padding: 14px 18px;
    border: 2px solid #e9ecef;
    border-radius: 15px;
    font-family: 'Fredoka', 'Nunito', sans-serif;
    font-size: 16px;
    transition: all 0.3s ease;
    background: #f8f9fa;
}

.form-group input:focus {
    outline: none;
    border-color: #ff6b6b;
    background: white;
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(255, 107, 107, 0.3);
}

.btn-primary {
    width: 100%;
    padding: 16px;
    background: linear-gradient(135deg, #ff6b6b 0%, #ee5a6f 50%, #c44569 100%);
    color: white;
    border: none;
    border-radius: 15px;
    font-family: 'Fredoka', 'Nunito', sans-serif;
    font-size: 18px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    margin-top: 10px;
    box-shadow: 0 5px 15px rgba(255, 107, 107, 0.4);
}

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

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

.auth-link {
    text-align: center;
    margin-top: 25px;
    color: #666;
    font-size: 14px;
}

.auth-link a {
    color: #ff6b6b;
    text-decoration: none;
    font-weight: 600;
    transition: color 0.3s ease;
}

.auth-link a:hover {
    color: #c44569;
    text-decoration: underline;
}

.error-message {
    background: #ffe6e6;
    color: #d63031;
    padding: 12px;
    border-radius: 10px;
    margin-bottom: 15px;
    font-size: 14px;
    border: 2px solid #fab1a0;
    animation: shake 0.5s ease;
}

@keyframes shake {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-10px); }
    75% { transform: translateX(10px); }
}

/* ============= DASHBOARD ============= */

.dashboard {
    min-height: 100vh;
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
    position: relative;
    z-index: 10;
    background: linear-gradient(135deg, #d44060 0%, #aa2850 100%);
}

.dashboard .footer {
    margin-top: auto;
    flex-shrink: 0;
}

.header-bar {
    background: white;
    padding: 20px 40px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: 0 4px 20px rgba(0,0,0,0.1);
    animation: slideDown 0.5s ease;
}

@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-50px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.header-bar h1 {
    font-size: 28px;
    color: #ff6b6b;
    text-shadow: 2px 2px 4px rgba(255, 107, 107, 0.3);
}

.user-info {
    display: flex;
    align-items: center;
    gap: 20px;
}

.user-info span {
    color: #555;
    font-weight: 500;
    font-size: 16px;
}

.user-info span::before {
    content: '👋 ';
    font-size: 20px;
}

.btn-logout {
    padding: 10px 20px;
    background: #ff6b6b;
    color: white;
    text-decoration: none;
    border-radius: 12px;
    font-family: 'Fredoka', 'Nunito', sans-serif;
    font-weight: 600;
    transition: all 0.3s ease;
    box-shadow: 0 4px 10px rgba(255, 107, 107, 0.3);
}

.btn-logout:hover {
    background: #ee5a52;
    transform: translateY(-2px);
    box-shadow: 0 6px 15px rgba(255, 107, 107, 0.4);
}

.main-content {
    flex: 1;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 40px 20px;
}

.chat-section {
    background: white;
    border-radius: 30px;
    box-shadow: 0 30px 60px rgba(0,0,0,0.3);
    max-width: 700px;
    width: 100%;
    overflow: hidden;
    animation: bounceIn 0.6s ease;
}

@keyframes bounceIn {
    0% {
        opacity: 0;
        transform: scale(0.3);
    }
    50% {
        opacity: 1;
        transform: scale(1.05);
    }
    70% {
        transform: scale(0.9);
    }
    100% {
        transform: scale(1);
    }
}

.chat-container {
    height: 500px;
    overflow-y: auto;
    padding: 30px;
    background: linear-gradient(to bottom, #f8f9fa 0%, #fff 100%);
}

.chat-container::-webkit-scrollbar {
    width: 10px;
}

.chat-container::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 10px;
}

.chat-container::-webkit-scrollbar-thumb {
    background: linear-gradient(135deg, #ff6b6b 0%, #c44569 100%);
    border-radius: 10px;
}

.chat-container::-webkit-scrollbar-thumb:hover {
    background: linear-gradient(135deg, #c44569 0%, #ff6b6b 100%);
}

.message {
    margin-bottom: 20px;
    display: flex;
    align-items: flex-start;
    animation: messageSlide 0.4s ease;
}

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

.message.user {
    flex-direction: row-reverse;
}

.message-content {
    max-width: 70%;
    padding: 15px 20px;
    border-radius: 20px;
    word-wrap: break-word;
    position: relative;
    box-shadow: 0 3px 10px rgba(0,0,0,0.1);
    transition: transform 0.2s ease;
}

.message-content:hover {
    transform: scale(1.02);
}

.message.user .message-content {
    background: linear-gradient(135deg, #ff6b6b 0%, #c44569 100%);
    color: white;
    border-bottom-right-radius: 5px;
}

.message.bot .message-content {
    background: white;
    color: #333;
    border-bottom-left-radius: 5px;
    border: 2px solid #e9ecef;
}

.message.correction .message-content {
    background: linear-gradient(135deg, #fff3cd 0%, #ffe8a1 100%);
    color: #856404;
    border: 2px solid #ffc107;
    font-size: 14px;
}

.avatar {
    width: 45px;
    height: 45px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 22px;
    margin: 0 12px;
    flex-shrink: 0;
    box-shadow: 0 4px 10px rgba(0,0,0,0.1);
    animation: avatarPop 0.5s ease;
}

@keyframes avatarPop {
    0% {
        transform: scale(0);
        opacity: 0;
    }
    50% {
        transform: scale(1.2);
    }
    100% {
        transform: scale(1);
        opacity: 1;
    }
}

.user .avatar {
    background: linear-gradient(135deg, #ff6b6b 0%, #c44569 100%);
}

.bot .avatar {
    background: linear-gradient(135deg, #ffafbd 0%, #ffc3a0 100%);
}

.correction .avatar {
    background: linear-gradient(135deg, #FFD89B 0%, #19547B 100%);
}

.controls {
    padding: 30px;
    background: white;
    border-top: 2px solid #f0f0f0;
}

.mic-button {
    width: 90px;
    height: 90px;
    border-radius: 50%;
    border: none;
    background: linear-gradient(135deg, #ff6b6b 0%, #c44569 100%);
    color: white;
    font-family: 'Fredoka', 'Nunito', sans-serif;
    font-size: 40px;
    cursor: pointer;
    display: block;
    margin: 0 auto 20px;
    transition: all 0.3s ease;
    box-shadow: 0 8px 20px rgba(255, 107, 107, 0.4);
    position: relative;
}

.mic-button::after {
    content: '';
    position: absolute;
    inset: -5px;
    border-radius: 50%;
    border: 3px solid #ff6b6b;
    opacity: 0;
    animation: ripple 2s infinite;
}

@keyframes ripple {
    0% {
        opacity: 0.5;
        transform: scale(1);
    }
    100% {
        opacity: 0;
        transform: scale(1.3);
    }
}

.mic-button:hover {
    transform: scale(1.1) rotate(5deg);
    box-shadow: 0 12px 30px rgba(255, 107, 107, 0.6);
}

.mic-button:active {
    transform: scale(0.95);
}

.mic-button.listening {
    animation: wiggle 0.3s ease-in-out infinite, pulse 1.5s ease-in-out infinite;
    background: linear-gradient(135deg, #ee5a52 0%, #a83250 100%);
}

@keyframes wiggle {
    0%, 100% { transform: rotate(-3deg); }
    25% { transform: rotate(3deg); }
    50% { transform: rotate(-3deg); }
    75% { transform: rotate(3deg); }
}

@keyframes pulse {
    0%, 100% {
        box-shadow: 0 8px 20px rgba(238, 90, 82, 0.4);
    }
    50% {
        box-shadow: 0 12px 35px rgba(238, 90, 82, 0.8);
    }
}

.status {
    text-align: center;
    color: #666;
    font-size: 16px;
    min-height: 25px;
    font-weight: 500;
}

.status.active {
    color: #ff6b6b;
    font-weight: 600;
    animation: statusBlink 1s infinite;
}

@keyframes statusBlink {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.6; }
}

.end-button {
    display: block;
    margin: 20px auto 0;
    padding: 12px 30px;
    background: linear-gradient(135deg, #6c757d 0%, #495057 100%);
    color: white;
    border: none;
    border-radius: 20px;
    cursor: pointer;
    font-family: 'Fredoka', 'Nunito', sans-serif;
    font-size: 15px;
    font-weight: 600;
    transition: all 0.3s ease;
    box-shadow: 0 4px 10px rgba(108, 117, 125, 0.3);
}

.end-button:hover {
    background: linear-gradient(135deg, #5a6268 0%, #343a40 100%);
    transform: translateY(-2px);
    box-shadow: 0 6px 15px rgba(108, 117, 125, 0.4);
}

.report {
    background: linear-gradient(135deg, #d4edda 0%, #c3e6cb 100%);
    border: 2px solid #28a745;
    border-radius: 20px;
    padding: 25px;
    margin: 20px 0;
    box-shadow: 0 5px 15px rgba(40, 167, 69, 0.2);
    animation: reportSlideIn 0.5s ease;
}

@keyframes reportSlideIn {
    from {
        opacity: 0;
        transform: translateY(30px) scale(0.9);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

.report h3 {
    color: #155724;
    margin-bottom: 15px;
    font-size: 22px;
    text-align: center;
}

.report h3::before {
    content: '🎓 ';
    font-size: 24px;
}

.report-item {
    background: white;
    padding: 15px;
    border-radius: 12px;
    margin-bottom: 12px;
    font-size: 14px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    transition: transform 0.2s ease;
}

.report-item:hover {
    transform: translateX(5px);
}

.report-item .original {
    color: #dc3545;
    margin-bottom: 6px;
    font-weight: 600;
}

.report-item .original::before {
    content: '❌ ';
}

.report-item .corrected {
    color: #28a745;
    margin-bottom: 6px;
    font-weight: 600;
}

.report-item .corrected::before {
    content: '✅ ';
}

.report-item .explanation {
    color: #666;
    font-size: 13px;
    font-style: italic;
}

.report-item .explanation::before {
    content: '💡 ';
}

/* ============= FOOTER ============= */

.footer {
    background: rgba(255, 255, 255, 0.95);
    border-top: 2px solid rgba(255, 204, 204, 0.5);
    padding: 50px 20px 30px;
    position: relative;
    z-index: 10;
    margin-top: auto;
    backdrop-filter: blur(10px);
}

.footer-content {
    max-width: 1200px;
    margin: 0 auto;
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 40px;
}

.footer-section {
    animation: fadeInUp 0.6s ease;
}

.footer-section h3 {
    color: #ff6b6b;
    font-size: 18px;
    margin-bottom: 15px;
    font-weight: 600;
}

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

.footer-section ul li {
    margin-bottom: 10px;
}

.footer-section a {
    color: #666;
    text-decoration: none;
    font-size: 14px;
    transition: all 0.3s ease;
    display: inline-block;
}

.footer-section a:hover {
    color: #ff6b6b;
    transform: translateX(5px);
}

.footer-section p {
    color: #666;
    font-size: 14px;
    line-height: 1.6;
    margin-bottom: 10px;
}

.footer-bottom {
    max-width: 1200px;
    margin: 30px auto 0;
    padding-top: 20px;
    border-top: 1px solid rgba(255, 204, 204, 0.3);
    text-align: center;
    color: #999;
    font-size: 13px;
}

.footer-logo {
    font-size: 18px;
    color: #ff6b6b !important;
    font-weight: 600;
    margin-bottom: 15px;
    text-decoration: none;
    display: inline-block;
    cursor: pointer;
}

.footer-logo:hover {
    color: #ff6b6b;
    text-decoration: none;
}

/* ============= LOADING DOTS ============= */

.loading-dots {
    display: flex;
    gap: 6px;
    align-items: center;
    padding: 5px 0;
}

.loading-dots span {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: linear-gradient(135deg, #ff6b6b 0%, #c44569 100%);
    animation: bounce 1.4s infinite;
}

.loading-dots span:nth-child(2) {
    animation-delay: 0.2s;
}

.loading-dots span:nth-child(3) {
    animation-delay: 0.4s;
}

@keyframes bounce {
    0%, 80%, 100% {
        opacity: 0.5;
        transform: scale(0.8);
    }
    40% {
        opacity: 1;
        transform: scale(1);
    }
}

/* ============= CHENGYU PAGE ============= */

.chengyu-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 25px;
    margin: 30px 0;
}

.chengyu-card {
    background: linear-gradient(135deg, #fff5f5 0%, #ffe5e5 100%);
    border: 2px solid transparent;
    border-radius: 20px;
    overflow: hidden;
    transition: all 0.3s ease;
    position: relative;
}

.chengyu-card-image {
    position: relative;
    width: 100%;
    height: 160px;
    overflow: hidden;
    background: #f0e0e0;
}

.chengyu-card-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.3s ease;
}

.chengyu-card:hover .chengyu-card-image img {
    transform: scale(1.05);
}

.chengyu-card-image-overlay {
    position: absolute;
    inset: 0;
    background: linear-gradient(to bottom, rgba(0,0,0,0.1) 0%, rgba(0,0,0,0.5) 100%);
    display: flex;
    align-items: flex-end;
    padding: 12px 16px;
}

.chengyu-card-chinese-overlay {
    font-size: 26px;
    font-weight: 800;
    color: white;
    text-shadow: 0 2px 8px rgba(0,0,0,0.6);
    letter-spacing: 4px;
}

.chengyu-card-body {
    padding: 20px;
}

.chengyu-card:hover {
    transform: translateY(-5px);
    border-color: #ff6b6b;
    box-shadow: 0 10px 25px rgba(255, 107, 107, 0.2);
}

.chengyu-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
}

.chengyu-chinese {
    font-size: 28px;
    color: #ff6b6b;
    margin: 0;
    font-family: 'Fredoka', 'Microsoft YaHei', sans-serif;
}

.chengyu-pinyin {
    font-size: 16px;
    color: #666;
    margin-bottom: 15px;
    font-style: italic;
}

.chengyu-meaning {
    font-size: 16px;
    color: #333;
    margin-bottom: 10px;
    font-weight: 500;
}

.chengyu-literal {
    font-size: 14px;
    color: #888;
    margin-bottom: 15px;
}

.chengyu-example {
    background: white;
    padding: 15px;
    border-radius: 12px;
    margin-top: 15px;
    font-size: 14px;
    line-height: 1.6;
}

.audio-btn {
    background: linear-gradient(135deg, #ff6b6b 0%, #c44569 100%);
    border: none;
    border-radius: 50%;
    width: 40px;
    height: 40px;
    font-size: 20px;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 10px rgba(255, 107, 107, 0.3);
}

.audio-btn:hover {
    transform: scale(1.1);
    box-shadow: 0 6px 15px rgba(255, 107, 107, 0.4);
}

.audio-btn:active {
    transform: scale(0.95);
}

.difficulty-badge {
    display: inline-block;
    padding: 5px 12px;
    border-radius: 15px;
    font-size: 12px;
    font-weight: 600;
    margin-top: 10px;
}

.difficulty-beginner {
    background: #d4edda;
    color: #155724;
}

.difficulty-intermediate {
    background: #fff3cd;
    color: #856404;
}

.difficulty-advanced {
    background: #f8d7da;
    color: #721c24;
}

/* ============= STORIES PAGE ============= */

.story-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 30px;
    margin: 30px 0;
}

.story-card {
    background: white;
    border: 2px solid #e9ecef;
    border-radius: 20px;
    overflow: hidden;
    transition: all 0.3s ease;
}

.story-card:hover {
    transform: translateY(-5px);
    border-color: #ff6b6b;
    box-shadow: 0 10px 30px rgba(255, 107, 107, 0.15);
}

.story-image-container {
    width: 100%;
    height: 200px;
    overflow: hidden;
    background: #f8f9fa;
}

.story-image {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.3s ease;
}

.story-card:hover .story-image {
    transform: scale(1.05);
}

.story-content {
    padding: 30px;
}

.poem-card-image {
    position: relative;
    width: 100%;
    height: 180px;
    overflow: hidden;
    background: #e8d8d8;
}

.poem-card-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.3s ease;
}

.story-card:hover .poem-card-image img {
    transform: scale(1.05);
}

.poem-card-dynasty-badge {
    position: absolute;
    top: 12px;
    right: 12px;
    background: rgba(0,0,0,0.55);
    color: white;
    font-size: 11px;
    font-weight: 700;
    padding: 3px 10px;
    border-radius: 20px;
    letter-spacing: 0.5px;
}

/* ── Pinyin character tooltips (speaking bot) ── */
.zh-char {
    display: inline-block;
    position: relative;
    cursor: help;
    border-bottom: 1.5px dotted rgba(180, 60, 80, 0.45);
    transition: color 0.15s;
}

.zh-char:hover {
    color: #d44060;
}

.zh-char .zh-tooltip {
    position: absolute;
    bottom: calc(100% + 6px);
    left: 50%;
    transform: translateX(-50%);
    background: #2d3748;
    color: white;
    border-radius: 8px;
    padding: 5px 9px;
    font-size: 12px;
    line-height: 1.4;
    white-space: nowrap;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.15s;
    z-index: 100;
    text-align: center;
}

.zh-char .zh-tooltip::after {
    content: '';
    position: absolute;
    top: 100%;
    left: 50%;
    transform: translateX(-50%);
    border: 5px solid transparent;
    border-top-color: #2d3748;
}

.zh-char:hover .zh-tooltip {
    opacity: 1;
}

.story-card h3 {
    color: #ff6b6b;
    font-size: 24px;
    margin-bottom: 10px;
}

.story-pinyin {
    color: #666;
    font-size: 14px;
    font-style: italic;
    margin-bottom: 10px;
}

.story-chinese-preview {
    font-size: 15px;
    color: #2d3748;
    line-height: 1.65;
    margin-bottom: 14px;
    font-family: 'Microsoft YaHei', 'Noto Sans SC', sans-serif;
}

.story-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin: 20px 0;
    align-items: center;
}

.story-stats {
    font-size: 14px;
    color: #666;
    background: #f8f9fa;
    padding: 5px 10px;
    border-radius: 10px;
}

.btn-primary {
    display: inline-block;
    padding: 12px 24px;
    background: linear-gradient(135deg, #ff6b6b 0%, #c44569 100%);
    color: white;
    text-decoration: none;
    border-radius: 12px;
    font-weight: 600;
    transition: all 0.3s ease;
    margin-top: 15px;
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 15px rgba(255, 107, 107, 0.3);
}

/* ============= STORY DETAIL PAGE ============= */

.story-header {
    text-align: center;
    margin-bottom: 40px;
    padding-bottom: 30px;
    border-bottom: 2px solid #ffe5e5;
}

.story-title-pinyin {
    font-size: 18px;
    color: #666;
    font-style: italic;
    margin-bottom: 20px;
}

.story-controls {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 20px;
    margin-top: 20px;
}

.audio-btn-large {
    padding: 15px 30px;
    background: linear-gradient(135deg, #ff6b6b 0%, #c44569 100%);
    color: white;
    border: none;
    border-radius: 15px;
    font-size: 18px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 5px 15px rgba(255, 107, 107, 0.3);
    font-family: 'Fredoka', sans-serif;
}

.audio-btn-large:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 20px rgba(255, 107, 107, 0.4);
}

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

.story-content {
    margin: 40px 0;
}

.chinese-text {
    font-size: 24px;
    line-height: 2.2;
    color: #333;
    font-family: 'Microsoft YaHei', 'SimHei', sans-serif;
    margin-bottom: 40px;
    padding: 30px;
    background: linear-gradient(135deg, #fff5f5 0%, #ffe5e5 100%);
    border-radius: 20px;
}

.hoverable-char {
    position: relative;
    cursor: pointer;
    padding: 2px;
    transition: all 0.2s ease;
    display: inline-block;
}

.hoverable-char:hover {
    color: #ff6b6b;
    transform: scale(1.15);
    z-index: 100;
}

.non-chinese {
    display: inline;
}

.pinyin-tooltip {
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%);
    background: linear-gradient(135deg, #ff6b6b 0%, #c44569 100%);
    color: white;
    padding: 8px 15px;
    border-radius: 12px;
    font-size: 14px;
    white-space: nowrap;
    pointer-events: none;
    box-shadow: 0 8px 20px rgba(255, 107, 107, 0.4);
    z-index: 10000;
    font-family: 'Fredoka', sans-serif;
    font-weight: 600;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
    margin-bottom: 8px;
}

.pinyin-tooltip::after {
    content: '';
    position: absolute;
    top: 100%;
    left: 50%;
    transform: translateX(-50%);
    border: 6px solid transparent;
    border-top-color: #c44569;
}

.translation-section {
    background: white;
    padding: 30px;
    border-radius: 20px;
    border: 2px solid #e9ecef;
}

.translation-section h3 {
    color: #ff6b6b;
    margin-top: 0;
    margin-bottom: 20px;
}

.translation-section p {
    line-height: 1.8;
    color: #555;
}

/* ============= HOME PAGE ============= */

.home-page {
    flex: 1;
    overflow-y: auto;
    padding: 60px 40px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}

.home-container {
    max-width: 1200px;
    margin: 0 auto;
}

.home-welcome {
    text-align: center;
    margin-bottom: 60px;
    color: white;
}

.home-welcome h1 {
    font-size: 48px;
    font-weight: 700;
    margin-bottom: 15px;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.1);
}

.home-subtitle {
    font-size: 20px;
    opacity: 0.95;
    font-weight: 300;
}

.learning-options {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
    gap: 30px;
    margin-top: 40px;
}

.learning-card {
    background: white;
    border-radius: 25px;
    padding: 40px 30px;
    text-align: center;
    text-decoration: none;
    color: inherit;
    transition: all 0.3s ease;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
    position: relative;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.learning-card:hover {
    transform: translateY(-10px);
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.2);
}

.learning-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 5px;
    background: linear-gradient(90deg, #ff6b6b, #ffa502);
    transform: scaleX(0);
    transform-origin: left;
    transition: transform 0.3s ease;
}

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

.card-icon {
    font-size: 64px;
    margin-bottom: 20px;
    filter: drop-shadow(0 4px 8px rgba(0, 0, 0, 0.1));
}

.learning-card h2 {
    font-size: 28px;
    font-weight: 700;
    margin-bottom: 15px;
    color: #2d3748;
}

.learning-card p {
    font-size: 16px;
    line-height: 1.6;
    color: #666;
    margin-bottom: 25px;
    flex: 1;
}

.card-badge {
    display: inline-block;
    padding: 8px 20px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border-radius: 20px;
    font-size: 14px;
    font-weight: 600;
    margin-top: auto;
}

/* ============= COUNTRIES PAGE ============= */

.country-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 25px;
    margin: 30px 0;
}

.country-card {
    background: white;
    border: 2px solid #e9ecef;
    border-radius: 20px;
    overflow: hidden;
    transition: all 0.3s ease;
}

.country-flag-img {
    width: 72px;
    height: auto;
    border-radius: 6px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.14);
    margin-bottom: 10px;
    display: block;
}

.country-card:hover {
    transform: translateY(-5px);
    border-color: #ff6b6b;
    box-shadow: 0 10px 30px rgba(255, 107, 107, 0.15);
}

.country-image {
    width: 100%;
    height: 180px;
    object-fit: cover;
}

.country-content {
    padding: 20px;
}

.country-name-english {
    font-size: 22px;
    font-weight: 700;
    color: #2d3748;
    margin-bottom: 5px;
}

.country-name-chinese {
    font-size: 24px;
    color: #ff6b6b;
    font-family: 'Microsoft YaHei', sans-serif;
    margin-bottom: 3px;
}

.country-pinyin {
    font-size: 14px;
    color: #666;
    font-style: italic;
    margin-bottom: 10px;
}

.country-literal-meaning {
    font-size: 13px;
    color: #888;
    margin-bottom: 12px;
    font-style: italic;
}

.country-capital {
    font-size: 14px;
    color: #555;
    margin-bottom: 15px;
}

.country-card-actions {
    display: flex;
    gap: 10px;
    align-items: center;
    margin-top: 15px;
}

.region-badge {
    display: inline-block;
    padding: 5px 12px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border-radius: 15px;
    font-size: 12px;
    font-weight: 600;
    margin-right: 5px;
}

/* ============= FOOD PAGE ============= */

.food-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 30px;
    margin: 30px 0;
}

.food-card {
    background: white;
    border: 2px solid #e9ecef;
    border-radius: 20px;
    overflow: hidden;
    transition: all 0.3s ease;
}

.food-card:hover {
    transform: translateY(-5px);
    border-color: #ff6b6b;
    box-shadow: 0 10px 30px rgba(255, 107, 107, 0.15);
}

.food-image {
    width: 100%;
    height: 220px;
    object-fit: cover;
    transition: transform 0.3s ease;
}

.food-card:hover .food-image {
    transform: scale(1.05);
}

.food-content {
    padding: 20px;
}

.food-name-english {
    font-size: 20px;
    font-weight: 700;
    color: #2d3748;
    margin-bottom: 5px;
}

.food-name-chinese {
    font-size: 22px;
    color: #ff6b6b;
    font-family: 'Microsoft YaHei', sans-serif;
    margin-bottom: 3px;
}

.food-pinyin {
    font-size: 14px;
    color: #666;
    font-style: italic;
    margin-bottom: 10px;
}

.food-origin {
    font-size: 14px;
    color: #555;
    margin-top: 10px;
}

.category-badge {
    display: inline-block;
    padding: 5px 12px;
    background: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
    color: white;
    border-radius: 15px;
    font-size: 12px;
    font-weight: 600;
    margin-right: 5px;
}

.taste-tag {
    display: inline-block;
    padding: 4px 10px;
    background: #fff3cd;
    color: #856404;
    border: 1px solid #ffeaa7;
    border-radius: 12px;
    font-size: 11px;
    margin: 5px 5px 0 0;
    font-weight: 500;
}

.food-card-actions {
    display: flex;
    gap: 10px;
    align-items: center;
    margin-top: 15px;
}

/* ============= RESPONSIVE ============= */

@media (max-width: 768px) {
    .auth-box {
        padding: 40px 30px;
    }
    
    .header-bar {
        padding: 15px 20px;
        flex-direction: column;
        gap: 15px;
    }
    
    .header-bar h1 {
        font-size: 24px;
    }
    
    .chat-section {
        border-radius: 20px;
    }
    
    .chat-container {
        height: 400px;
        padding: 20px;
    }
    
    .message-content {
        max-width: 85%;
    }
    
    .mic-button {
        width: 75px;
        height: 75px;
        font-size: 32px;
    }

    .home-page {
        padding: 40px 20px;
    }

    .home-welcome h1 {
        font-size: 32px;
    }

    .home-subtitle {
        font-size: 16px;
    }

    .learning-options {
        grid-template-columns: 1fr;
        gap: 20px;
    }

    .learning-card {
        padding: 30px 20px;
    }

    .card-icon {
        font-size: 48px;
    }

    .learning-card h2 {
        font-size: 24px;
    }
}

/* ============= CUTE ADDITIONS ============= */

/* Confetti effect */
@keyframes confetti {
    0% {
        transform: translateY(0) rotate(0);
        opacity: 1;
    }
    100% {
        transform: translateY(100vh) rotate(720deg);
        opacity: 0;
    }
}

/* Loading animation */
.loading {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 3px solid rgba(255,255,255,.3);
    border-radius: 50%;
    border-top-color: #fff;
    animation: spin 1s ease-in-out infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* ============= STATIC PAGES ============= */

.static-page {
    flex: 1;
    display: flex;
    justify-content: center;
    align-items: flex-start;
    padding: 60px 20px;
    position: relative;
    z-index: 10;
}

.static-container {
    background: white;
    border-radius: 20px;
    box-shadow: 0 20px 40px rgba(0,0,0,0.1);
    padding: 50px;
    max-width: 900px;
    width: 100%;
    animation: slideIn 0.5s ease;
}

.static-container h1 {
    color: #ff6b6b;
    font-size: 42px;
    margin-bottom: 30px;
    font-family: 'Fredoka', sans-serif;
}

.static-container h2 {
    color: #333;
    font-size: 28px;
    margin-top: 40px;
    margin-bottom: 20px;
    font-family: 'Fredoka', sans-serif;
}

.static-container h3 {
    color: #555;
    font-size: 22px;
    margin-top: 25px;
    margin-bottom: 15px;
    font-family: 'Fredoka', sans-serif;
}

.static-container h4 {
    color: #666;
    font-size: 18px;
    margin-top: 20px;
    margin-bottom: 10px;
    font-family: 'Fredoka', sans-serif;
}

.static-container p {
    color: #555;
    line-height: 1.8;
    margin-bottom: 15px;
    font-size: 16px;
}

.static-container ul {
    margin: 15px 0;
    padding-left: 30px;
}

.static-container li {
    color: #555;
    line-height: 1.8;
    margin-bottom: 10px;
}

.content-section {
    margin-bottom: 40px;
}

.btn-back {
    display: inline-block;
    margin-top: 40px;
    padding: 12px 24px;
    background: linear-gradient(135deg, #ff6b6b 0%, #c44569 100%);
    color: white;
    text-decoration: none;
    border-radius: 12px;
    font-family: 'Fredoka', sans-serif;
    font-weight: 600;
    transition: all 0.3s ease;
    box-shadow: 0 4px 10px rgba(255, 107, 107, 0.3);
}

.btn-back:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 15px rgba(255, 107, 107, 0.4);
}

/* Feature Cards */
.feature-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 30px;
    margin: 30px 0;
}

.feature-card {
    background: linear-gradient(135deg, #fff5f5 0%, #ffe5e5 100%);
    padding: 30px;
    border-radius: 15px;
    text-align: center;
    transition: all 0.3s ease;
    border: 2px solid transparent;
}

.feature-card:hover {
    transform: translateY(-5px);
    border-color: #ff6b6b;
    box-shadow: 0 10px 25px rgba(255, 107, 107, 0.2);
}

.feature-icon {
    font-size: 48px;
    margin-bottom: 20px;
}

.feature-card h3 {
    color: #ff6b6b;
    margin-top: 0;
    margin-bottom: 15px;
}

/* Pricing Cards */
.pricing-intro {
    text-align: center;
    font-size: 18px;
    color: #666;
    margin-bottom: 50px;
}

.pricing-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 30px;
    margin: 40px 0;
}

.pricing-card {
    background: white;
    border: 3px solid #e9ecef;
    border-radius: 20px;
    padding: 40px 30px;
    text-align: center;
    transition: all 0.3s ease;
    position: relative;
}

.pricing-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 30px rgba(0,0,0,0.1);
}

.pricing-card.featured {
    border-color: #ff6b6b;
    box-shadow: 0 10px 30px rgba(255, 107, 107, 0.2);
}

.popular-badge {
    position: absolute;
    top: -15px;
    right: 20px;
    background: linear-gradient(135deg, #ff6b6b 0%, #c44569 100%);
    color: white;
    padding: 5px 15px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
    font-family: 'Fredoka', sans-serif;
}

.pricing-card h3 {
    color: #333;
    font-size: 24px;
    margin: 0 0 20px 0;
}

.price {
    font-size: 48px;
    color: #ff6b6b;
    font-weight: 700;
    margin-bottom: 30px;
    font-family: 'Fredoka', sans-serif;
}

.price span {
    font-size: 18px;
    color: #999;
    font-weight: 400;
}

.pricing-features {
    list-style: none;
    padding: 0;
    margin: 30px 0;
    text-align: left;
}

.pricing-features li {
    padding: 10px 0;
    color: #555;
    border-bottom: 1px solid #f0f0f0;
}

.btn-pricing {
    display: inline-block;
    margin-top: 20px;
    padding: 14px 30px;
    background: linear-gradient(135deg, #ff6b6b 0%, #c44569 100%);
    color: white;
    text-decoration: none;
    border-radius: 12px;
    font-family: 'Fredoka', sans-serif;
    font-weight: 600;
    transition: all 0.3s ease;
}

.btn-pricing:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 15px rgba(255, 107, 107, 0.4);
}

.pricing-faq {
    margin-top: 60px;
}

/* FAQ Sections */
.faq-section {
    margin-bottom: 50px;
}

.faq-item {
    background: #f8f9fa;
    padding: 25px;
    border-radius: 12px;
    margin-bottom: 20px;
    border-left: 4px solid #ff6b6b;
}

.faq-item h4 {
    color: #ff6b6b;
    margin-top: 0;
    margin-bottom: 10px;
}

.faq-item p {
    margin-bottom: 0;
}

/* Tutorial Sections */
.tutorial-section {
    margin-bottom: 50px;
}

.tutorial-step {
    background: linear-gradient(135deg, #fff5f5 0%, #ffe5e5 100%);
    padding: 30px;
    border-radius: 15px;
    margin-bottom: 25px;
    border-left: 5px solid #ff6b6b;
}

.tutorial-step h3 {
    color: #ff6b6b;
    margin-top: 0;
}

.tip-card {
    background: white;
    border: 2px solid #ff6b6b;
    padding: 20px;
    border-radius: 12px;
    margin-bottom: 20px;
}

.tip-card h4 {
    margin-top: 0;
    color: #ff6b6b;
}

/* Support Pages */
.support-options {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 30px;
    margin: 40px 0;
}

.support-card {
    background: linear-gradient(135deg, #fff5f5 0%, #ffe5e5 100%);
    padding: 30px;
    border-radius: 15px;
    text-align: center;
}

.support-icon {
    font-size: 48px;
    margin-bottom: 20px;
}

.support-card h3 {
    color: #ff6b6b;
    margin-bottom: 15px;
}

.btn-link {
    display: inline-block;
    margin-top: 15px;
    color: #ff6b6b;
    text-decoration: none;
    font-weight: 600;
    font-family: 'Fredoka', sans-serif;
}

.btn-link:hover {
    text-decoration: underline;
}

.issue-list {
    margin-top: 20px;
}

.issue-item {
    background: #f8f9fa;
    padding: 20px;
    border-radius: 12px;
    margin-bottom: 15px;
}

.issue-item h4 {
    color: #ff6b6b;
    margin-top: 0;
}

/* Legal Pages */
.legal-section {
    margin-bottom: 40px;
}

.last-updated {
    color: #999;
    font-size: 14px;
    font-style: italic;
    margin-bottom: 30px;
}

/* Responsive */
@media (max-width: 768px) {
    .static-container {
        padding: 30px 25px;
    }

    .static-container h1 {
        font-size: 32px;
    }

    .static-container h2 {
        font-size: 24px;
    }

    .feature-grid,
    .pricing-grid,
    .support-options {
        grid-template-columns: 1fr;
    }
}

/* ============= MATCH GAME ============= */

.match-page {
    min-height: 100vh;
    flex-shrink: 0;
    background: linear-gradient(135deg, #d44060 0%, #aa2850 100%);
    display: flex;
    flex-direction: column;
    font-family: 'Fredoka', 'Nunito', 'Microsoft YaHei', sans-serif;
    position: relative;
    z-index: 1;
}

.match-header {
    padding: 18px 32px;
    display: flex;
    align-items: center;
    gap: 16px;
    color: white;
    position: relative;
}

.match-back {
    color: rgba(255,255,255,0.9);
    text-decoration: none;
    font-size: 15px;
    font-weight: 500;
    padding: 8px 14px;
    background: rgba(255,255,255,0.15);
    border-radius: 10px;
    transition: background 0.2s;
    white-space: nowrap;
}

.match-back:hover {
    background: rgba(255,255,255,0.25);
}

.match-progress-track {
    flex: 1;
    height: 6px;
    background: rgba(255,255,255,0.2);
    border-radius: 3px;
    overflow: hidden;
}

.match-progress-fill {
    height: 100%;
    background: rgba(255,255,255,0.85);
    border-radius: 3px;
    transition: width 0.5s ease;
    width: 0%;
}

.match-score-display {
    font-size: 16px;
    font-weight: 700;
    color: white;
    white-space: nowrap;
}

/* Setup screen */
.match-setup {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 40px 20px;
    text-align: center;
    color: white;
    gap: 24px;
}

.match-setup h1 {
    font-size: 48px;
    font-weight: 800;
    margin: 0;
    text-shadow: 0 2px 8px rgba(0,0,0,0.15);
}

.match-setup p {
    font-size: 18px;
    opacity: 0.9;
    margin: 0;
    max-width: 420px;
}

.match-cat-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    justify-content: center;
    max-width: 480px;
}

.match-cat-option {
    display: flex;
    align-items: center;
    gap: 8px;
    background: rgba(255,255,255,0.15);
    border: 2px solid rgba(255,255,255,0.3);
    border-radius: 14px;
    padding: 12px 20px;
    cursor: pointer;
    font-size: 15px;
    font-weight: 600;
    color: white;
    transition: all 0.2s;
    user-select: none;
}

.match-cat-option:hover {
    background: rgba(255,255,255,0.25);
    border-color: rgba(255,255,255,0.6);
}

.match-cat-option input[type="checkbox"] {
    width: 18px;
    height: 18px;
    accent-color: white;
    cursor: pointer;
}

.match-start-btn {
    padding: 16px 48px;
    background: white;
    color: #667eea;
    border: none;
    border-radius: 16px;
    font-size: 18px;
    font-weight: 800;
    font-family: 'Fredoka', 'Nunito', sans-serif;
    cursor: pointer;
    transition: all 0.2s;
    box-shadow: 0 8px 24px rgba(0,0,0,0.15);
}

.match-start-btn:hover {
    transform: translateY(-3px);
    box-shadow: 0 14px 32px rgba(0,0,0,0.2);
}

/* Game area */
.match-game {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 24px 20px 40px;
    gap: 24px;
    position: relative;
    z-index: 1;
}

.match-round-bar {
    display: flex;
    align-items: center;
    gap: 12px;
}

.match-round-num {
    color: rgba(255,255,255,0.85);
    font-size: 15px;
    font-weight: 600;
}

.match-cat-badge {
    background: rgba(255,255,255,0.2);
    color: white;
    padding: 4px 14px;
    border-radius: 20px;
    font-size: 13px;
    font-weight: 700;
    letter-spacing: 0.3px;
}

/* Prompt card */
.match-prompt-card {
    background: white;
    border-radius: 20px;
    padding: 28px 36px;
    text-align: center;
    max-width: 560px;
    width: 100%;
    box-shadow: 0 12px 32px rgba(0,0,0,0.25);
    position: relative;
    z-index: 2;
}

.match-prompt-text {
    font-size: 22px;
    font-weight: 700;
    color: #2d3748;
    line-height: 1.4;
}

.match-instruction {
    font-size: 14px;
    font-weight: 600;
    color: #667eea;
    margin-bottom: 12px;
    text-align: center;
    font-family: 'Fredoka', 'Nunito', sans-serif;
    background: #f0f4ff;
    border-radius: 10px;
    padding: 8px 14px;
    display: block;
}

.match-visual {
    display: flex;
    justify-content: center;
    margin-bottom: 12px;
}

.match-flag-img {
    width: 120px;
    height: auto;
    border-radius: 8px;
    box-shadow: 0 4px 14px rgba(0,0,0,0.18);
    display: block;
}

.match-item-img {
    width: 110px;
    height: 78px;
    object-fit: cover;
    border-radius: 10px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.12);
}

.match-extra {
    margin-top: 10px;
    font-size: 14px;
    color: #555;
    line-height: 1.55;
    text-align: center;
    font-style: italic;
    font-family: 'Fredoka', 'Nunito', sans-serif;
}

.match-example {
    margin-top: 6px;
    font-size: 13px;
    color: #888;
    text-align: center;
    font-family: 'Fredoka', 'Nunito', sans-serif;
}

.match-hint-toggle {
    margin-top: 12px;
    background: none;
    border: none;
    color: #667eea;
    font-size: 13px;
    cursor: pointer;
    font-weight: 600;
    padding: 4px 10px;
    border-radius: 8px;
    transition: background 0.15s;
    font-family: 'Fredoka', 'Nunito', sans-serif;
}

.match-hint-toggle:hover {
    background: #f0f4ff;
}

.match-hint-text {
    margin-top: 8px;
    font-size: 16px;
    color: #764ba2;
    font-weight: 600;
    font-family: 'Fredoka', 'Nunito', sans-serif;
}

/* Answer area */
.match-answer-section {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
}

.match-section-label {
    color: rgba(255,255,255,0.75);
    font-size: 13px;
    font-weight: 600;
    letter-spacing: 0.5px;
    text-transform: uppercase;
}

.match-slots {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
    justify-content: center;
}

.answer-slot {
    width: 68px;
    height: 68px;
    border: 3px dashed rgba(255,255,255,0.55);
    border-radius: 16px;
    background: rgba(255,255,255,0.1);
    font-size: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    cursor: pointer;
    transition: all 0.2s;
    font-family: 'Microsoft YaHei', 'SimHei', 'Noto Sans SC', sans-serif;
    position: relative; 
}

.answer-slot.filled {
    border-style: solid;
    border-color: rgba(255,255,255,0.9);
    background: rgba(255,255,255,0.92);
    color: #2d3748;
    box-shadow: 0 4px 14px rgba(0,0,0,0.15);
    font-weight: 700;
}

.answer-slot.drag-over {
    border-color: white;
    background: rgba(255,255,255,0.3);
    transform: scale(1.1);
    box-shadow: 0 0 0 4px rgba(255,255,255,0.3);
}

.answer-slot.correct {
    border-color: #68d391;
    background: #c6f6d5;
    color: #276749;
}

.answer-slot.wrong {
    border-color: #fc8181;
    background: #fff5f5;
    color: #c53030;
}

/* Character pool */
.match-pool-section {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 14px;
}

.match-char-pool {
    display: flex;
    flex-wrap: wrap;
    gap: 17px;
    justify-content: center;
    max-width: 520px;
}

.char-tile {
    width: 68px;
    height: 68px;
    background: white;
    border-radius: 16px;
    font-size: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: grab;
    box-shadow: 0 6px 16px rgba(0,0,0,0.14);
    transition: transform 0.2s, box-shadow 0.2s, opacity 0.2s, background 0.15s;
    user-select: none;
    animation: charFloat var(--float-duration, 3s) var(--float-delay, 0s) infinite ease-in-out;
    font-family: 'Microsoft YaHei', 'SimHei', 'Noto Sans SC', sans-serif;
    color: #2d3748;
    font-weight: 700;
    position: relative;
}

@keyframes charFloat {
    0%, 100% { transform: translateY(0) rotate(0deg); }
    35%  { transform: translateY(-9px) rotate(2deg); }
    70%  { transform: translateY(5px) rotate(-1.5deg); }
}

@keyframes shakeWrong {
    0%, 100% { transform: translateX(0); }
    15%  { transform: translateX(-10px); }
    30%  { transform: translateX(10px); }
    45%  { transform: translateX(-8px); }
    60%  { transform: translateX(8px); }
    75%  { transform: translateX(-5px); }
    90%  { transform: translateX(5px); }
}

.answer-slot.shake {
    animation: shakeWrong 0.65s ease-in-out !important;
}

.char-tile:hover {
    transform: translateY(-7px) scale(1.08) !important;
    box-shadow: 0 14px 28px rgba(0,0,0,0.22);
    animation-play-state: paused;
}

.char-tile.selected {
    background: #667eea;
    color: white;
    transform: translateY(-5px) scale(1.12) !important;
    box-shadow: 0 10px 24px rgba(102,126,234,0.55);
    animation: none;
}

.char-tile.used {
    opacity: 0.22;
    pointer-events: none;
    animation: none;
    transform: none !important;
    cursor: default;
    box-shadow: none;
}

.char-tile.dragging {
    opacity: 0.45;
    cursor: grabbing;
}

/* Controls */
.match-controls {
    display: flex;
    gap: 14px;
}

.match-btn {
    padding: 13px 30px;
    border-radius: 14px;
    font-size: 15px;
    font-weight: 700;
    cursor: pointer;
    border: none;
    transition: all 0.2s;
    font-family: 'Fredoka', 'Nunito', sans-serif;
}

.match-btn-check {
    background: white;
    color: #667eea;
    box-shadow: 0 6px 16px rgba(0,0,0,0.12);
}

.match-btn-check:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 10px 22px rgba(0,0,0,0.18);
}

.match-btn-check:disabled {
    opacity: 0.5;
    cursor: default;
}

.match-btn-skip {
    background: rgba(255,255,255,0.15);
    color: white;
    border: 2px solid rgba(255,255,255,0.35);
}

.match-btn-skip:hover {
    background: rgba(255,255,255,0.25);
}

/* Feedback */
.match-feedback {
    padding: 14px 24px;
    border-radius: 14px;
    font-size: 16px;
    font-weight: 600;
    text-align: center;
    max-width: 520px;
    width: 100%;
    box-shadow: 0 4px 14px rgba(0,0,0,0.1);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    flex-wrap: wrap;
}

.feedback-correct {
    background: #c6f6d5;
    color: #276749;
}

.feedback-wrong {
    background: #fff5f5;
    color: #c53030;
}

.feedback-info {
    background: rgba(255,255,255,0.9);
    color: #666;
}

.match-feedback .next-btn {
    padding: 7px 18px;
    background: #667eea;
    color: white;
    border: none;
    border-radius: 10px;
    font-size: 14px;
    font-weight: 700;
    font-family: 'Fredoka', 'Nunito', sans-serif;
    cursor: pointer;
    transition: background 0.2s;
}

.match-feedback .next-btn:hover {
    background: #5a6fd6;
}

/* End screen */
.match-end {
    flex: 1;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 40px 20px;
    text-align: center;
    color: white;
    gap: 20px;
}

.match-end-icon {
    font-size: 80px;
}

.match-end h2 {
    font-size: 42px;
    font-weight: 800;
    margin: 0;
}

.match-final-score .score-number {
    font-size: 64px;
    font-weight: 800;
    line-height: 1.1;
}

.match-final-score .score-pct {
    font-size: 22px;
    opacity: 0.85;
    font-weight: 500;
}

.match-end-actions {
    display: flex;
    gap: 14px;
    margin-top: 8px;
}

.match-end-actions button,
.match-end-actions a {
    padding: 14px 36px;
    border-radius: 14px;
    font-size: 16px;
    font-weight: 700;
    cursor: pointer;
    text-decoration: none;
    font-family: 'Fredoka', 'Nunito', sans-serif;
    transition: all 0.2s;
    border: none;
}

.match-end-actions button {
    background: white;
    color: #667eea;
    box-shadow: 0 6px 18px rgba(0,0,0,0.15);
}

.match-end-actions button:hover {
    transform: translateY(-2px);
    box-shadow: 0 12px 28px rgba(0,0,0,0.2);
}

.match-end-actions a {
    background: rgba(255,255,255,0.18);
    color: white;
    border: 2px solid rgba(255,255,255,0.4);
}

.match-end-actions a:hover {
    background: rgba(255,255,255,0.28);
}

@media (max-width: 600px) {
    .match-header {
        padding: 14px 16px;
    }

    .match-game {
        padding: 16px 12px 30px;
        gap: 16px;
    }

    .match-prompt-card {
        padding: 20px 20px;
    }

    .match-prompt-text {
        font-size: 18px;
    }

    .answer-slot,
    .char-tile {
        width: 56px;
        height: 56px;
        font-size: 24px;
    }
}

/* ============= BEGINNER PAGE ============= */

.filter-banner {
    display: inline-block;
    background: #f0f4ff;
    color: #4a5568;
    border: 1px solid #d6e0ff;
    border-radius: 30px;
    padding: 10px 20px;
    margin-bottom: 25px;
    font-size: 14px;
}

.filter-banner a {
    color: #667eea;
    font-weight: 600;
    text-decoration: none;
}

.filter-banner a:hover {
    text-decoration: underline;
}

.history-compare-table {
    width: 100%;
    border-collapse: collapse;
    margin: 20px 0 30px;
    font-size: 16px;
}

.history-compare-table th,
.history-compare-table td {
    border: 1px solid #e9ecef;
    padding: 12px 16px;
    text-align: center;
}

.history-compare-table th {
    background: #f8f9fa;
    color: #2d3748;
    font-family: 'Fredoka', sans-serif;
}

.history-compare-table td {
    color: #555;
    font-size: 20px;
}

.tone-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 16px;
    margin-top: 25px;
}

.tone-card {
    background: #f8f9fa;
    border: 2px solid #e9ecef;
    border-radius: 16px;
    padding: 20px;
    text-align: center;
    transition: all 0.2s ease;
}

.tone-card:hover {
    border-color: #667eea;
    transform: translateY(-2px);
}

.tone-number {
    font-size: 13px;
    font-weight: 700;
    color: #aaa;
    letter-spacing: 0.5px;
    text-transform: uppercase;
    margin-bottom: 8px;
}

.tone-mark {
    font-size: 36px;
    font-weight: 700;
    color: #ff6b6b;
    font-family: 'Fredoka', sans-serif;
}

.tone-arrow {
    font-size: 24px;
    color: #764ba2;
    margin: 6px 0;
}

.tone-desc {
    font-size: 13px;
    color: #666;
    line-height: 1.5;
    min-height: 60px;
}

.tone-example {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    margin-top: 14px;
    padding-top: 14px;
    border-top: 1px solid #e9ecef;
}

.tone-example-char {
    font-size: 28px;
    font-weight: 700;
    color: #2d3748;
    font-family: 'Microsoft YaHei', 'Noto Sans SC', sans-serif;
}

.tone-example-meaning {
    font-size: 13px;
    color: #888;
    font-style: italic;
}

.bopomofo-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(110px, 1fr));
    gap: 14px;
    margin-top: 20px;
    margin-bottom: 30px;
}

.bopomofo-card {
    background: #f8f9fa;
    border: 2px solid #e9ecef;
    border-radius: 14px;
    padding: 16px 10px;
    text-align: center;
    transition: all 0.2s ease;
}

.bopomofo-card:hover {
    border-color: #667eea;
    background: #f0f4ff;
    transform: translateY(-2px);
}

.bopomofo-symbol {
    font-size: 32px;
    font-weight: 700;
    color: #764ba2;
    font-family: 'Microsoft YaHei', 'Noto Sans SC', sans-serif;
}

.bopomofo-pinyin {
    font-size: 14px;
    font-weight: 600;
    color: #2d3748;
    margin: 6px 0 4px;
}

.bopomofo-example {
    font-size: 12px;
    color: #888;
    margin-bottom: 10px;
}

@media (max-width: 768px) {
    .tone-grid {
        grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    }

    .bopomofo-grid {
        grid-template-columns: repeat(auto-fill, minmax(80px, 1fr));
    }

    .history-compare-table {
        font-size: 14px;
    }
}

/* ============= STORYLINE HERO CARD ============= */

.storyline-hero-card {
    grid-column: 1 / -1;
    flex-direction: row;
    text-align: left;
    align-items: center;
    gap: 30px;
    padding: 40px 50px;
}

.storyline-hero-card .card-icon {
    font-size: 80px;
    margin-bottom: 0;
}

.storyline-hero-card h2 {
    font-size: 36px;
}

.storyline-hero-card .card-badge {
    margin-top: 0;
}

@media (max-width: 768px) {
    .storyline-hero-card {
        grid-column: auto;
        flex-direction: column;
        text-align: center;
        padding: 30px 20px;
    }

    .storyline-hero-card .card-icon {
        font-size: 48px;
    }

    .storyline-hero-card h2 {
        font-size: 24px;
    }
}

/* ============= STORYLINE MAP ============= */

.storyline-page {
    flex: 1;
    background: linear-gradient(135deg, #ff6b6b 0%, #ee5253 100%);
    font-family: 'Fredoka', 'Nunito', 'Microsoft YaHei', sans-serif;
}

.storyline-header {
    padding: 18px 32px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    color: white;
    flex-wrap: wrap;
}

.storyline-progress-text {
    font-size: 15px;
    font-weight: 600;
    background: rgba(255,255,255,0.15);
    padding: 8px 16px;
    border-radius: 12px;
}

.storyline-map {
    max-width: 700px;
    margin: 0 auto;
    padding: 10px 20px 60px;
    background-image: url("data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 100 304' preserveAspectRatio='none'><path d='M50,0 C50,38 84,40 84,76 C84,112 50,114 50,152 C50,190 16,192 16,228 C16,264 50,266 50,304' fill='none' stroke='rgba(255,250,230,0.6)' stroke-width='7' stroke-dasharray='3 13' stroke-linecap='round'/></svg>");
    background-repeat: repeat-y;
    background-position: top center;
    background-size: 100% 304px;
}

.storyline-world {
    position: relative;
    border-radius: 28px;
    padding: 50px 16px 36px;
    margin-bottom: 28px;
    overflow: hidden;
    box-shadow: 0 10px 30px rgba(0,0,0,0.18), inset 0 0 0 2px rgba(255,255,255,0.25);
}

.storyline-world::before,
.storyline-world::after {
    position: absolute;
    font-size: 70px;
    opacity: 0.22;
    pointer-events: none;
    z-index: 0;
    line-height: 1;
}

.storyline-world::before { top: -14px; left: -14px; }
.storyline-world::after  { bottom: -14px; right: -14px; }

.world-1 {
    background: linear-gradient(180deg, rgba(116,185,255,0.88), rgba(223,230,233,0.88));
}
.world-1::before { content: '❄️'; }
.world-1::after  { content: '🏔️'; }

.world-2 {
    background: linear-gradient(180deg, rgba(168,224,99,0.88), rgba(86,171,47,0.88));
}
.world-2::before { content: '🌳'; }
.world-2::after  { content: '🌼'; }

.world-3 {
    background: linear-gradient(180deg, rgba(246,211,101,0.88), rgba(253,160,133,0.88));
}
.world-3::before { content: '🍂'; }
.world-3::after  { content: '🍄'; }

.world-4 {
    background: linear-gradient(180deg, rgba(90,90,90,0.9), rgba(40,40,40,0.9));
}
.world-4::before { content: '⚡'; }
.world-4::after  { content: '🏆'; }

.storyline-world-banner {
    position: relative;
    z-index: 1;
    text-align: center;
    color: white;
    font-weight: 700;
    font-size: 18px;
    margin: 0 0 24px;
    padding: 10px 16px;
    background: rgba(0,0,0,0.28);
    border-radius: 14px;
    font-family: 'Fredoka', sans-serif;
}

.level-row {
    position: relative;
    z-index: 1;
    display: flex;
    margin: 8px 0;
}

.level-row.offset-0,
.level-row.offset-2 {
    justify-content: center;
}

.level-row.offset-1 {
    justify-content: flex-end;
    padding-right: 18%;
}

.level-row.offset-3 {
    justify-content: flex-start;
    padding-left: 18%;
}

.level-node {
    width: 70px;
    height: 70px;
    border-radius: 50%;
    border: 4px solid rgba(255,255,255,0.85);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-decoration: none;
    color: white;
    font-family: 'Fredoka', sans-serif;
    box-shadow: 0 6px 16px rgba(0,0,0,0.25);
    transition: transform 0.2s;
    position: relative;
}

.level-node .level-num {
    font-size: 12px;
    font-weight: 700;
    opacity: 0.85;
}

.level-node .level-icon {
    font-size: 22px;
}

.level-node.locked {
    background: rgba(255,255,255,0.3);
    border-color: rgba(255,255,255,0.4);
    color: rgba(255,255,255,0.7);
    cursor: not-allowed;
    box-shadow: none;
    pointer-events: none;
}

.level-node.completed {
    background: linear-gradient(135deg, #48bb78, #38a169);
}

.level-node.completed:hover {
    transform: translateY(-3px) scale(1.05);
}

.level-node.current {
    background: linear-gradient(135deg, #ff6b6b, #ffa502);
    animation: storylinePulse 1.8s ease-in-out infinite;
}

.level-node.current:hover {
    transform: scale(1.08);
}

.level-node.completed::after,
.level-node.current::after {
    content: '⭐';
    position: absolute;
    top: -12px;
    right: -8px;
    font-size: 22px;
    filter: drop-shadow(0 2px 2px rgba(0,0,0,0.35));
}

.level-node.current::after {
    animation: storylineStarBounce 1.2s ease-in-out infinite;
}

@keyframes storylinePulse {
    0%, 100% { box-shadow: 0 6px 16px rgba(255,107,107,0.4); transform: scale(1); }
    50% { box-shadow: 0 6px 28px rgba(255,107,107,0.7); transform: scale(1.06); }
}

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

@media (max-width: 600px) {
    .level-row.offset-0,
    .level-row.offset-1,
    .level-row.offset-2,
    .level-row.offset-3 {
        justify-content: center;
        padding: 0;
    }

    .level-node {
        width: 58px;
        height: 58px;
        border-width: 3px;
    }

    .storyline-world {
        padding: 44px 8px 28px;
        border-radius: 20px;
    }

    .storyline-world::before,
    .storyline-world::after {
        font-size: 46px;
    }

    .storyline-header {
        padding: 14px 16px;
    }
}

/* ============= STORYLINE LESSON LEVEL ============= */

.storyline-level-meta {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 14px;
    margin-bottom: 50px;
}

.storyline-level-meta .pricing-intro {
    margin-bottom: 0;
}

.storyline-completed-badge {
    display: inline-flex;
    align-items: center;
    padding: 6px 16px;
    background: linear-gradient(135deg, #48bb78, #38a169);
    color: white;
    border-radius: 20px;
    font-size: 14px;
    font-weight: 700;
    white-space: nowrap;
}

.storyline-level-actions {
    display: flex;
    gap: 16px;
    margin-top: 30px;
    flex-wrap: wrap;
    align-items: center;
}

button.btn-back {
    border: none;
    font-family: 'Fredoka', sans-serif;
    font-size: 16px;
    cursor: pointer;
}

/* ============= MATCH DIFFICULTY SELECTOR ============= */

.match-diff-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    justify-content: center;
    max-width: 480px;
}

.match-diff-option {
    display: flex;
    align-items: center;
    gap: 8px;
    background: rgba(255,255,255,0.15);
    border: 2px solid rgba(255,255,255,0.3);
    border-radius: 14px;
    padding: 12px 20px;
    cursor: pointer;
    font-size: 15px;
    font-weight: 600;
    color: white;
    transition: all 0.2s;
    user-select: none;
}

.match-diff-option:hover {
    background: rgba(255,255,255,0.25);
    border-color: rgba(255,255,255,0.6);
}

.match-diff-option input[type="radio"] {
    width: 18px;
    height: 18px;
    accent-color: white;
    cursor: pointer;
}

.match-diff-option:has(input:checked) {
    background: rgba(255,255,255,0.35);
    border-color: white;
}

/* Back to Storyline button on the match end screen */
.match-end-actions a#backToStorylineLink {
    background: linear-gradient(135deg, #ff6b6b, #ffa502);
    border-color: transparent;
    color: white;
}

.match-end-actions a#backToStorylineLink:hover {
    background: linear-gradient(135deg, #ff8585, #ffb733);
}