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

:root {
    --bg-start: #ecfdf5;
    --bg-end: #d1fae5;
    --bg-card: rgba(255, 255, 255, 0.85);
    --bg-card-hover: rgba(255, 255, 255, 0.95);
    --primary: #10b981;
    --primary-light: #34d399;
    --primary-dark: #059669;
    --accent-blue: #3b82f6;
    --accent-cyan: #06b6d4;
    --accent-pink: #ec4899;
    --accent-orange: #f97316;
    --accent-green: #84cc16;
    --accent-purple: #8b5cf6;
    --gold: #f59e0b;
    --gold-dark: #d97706;
    --weiao-orange: #F9A826;
    --leperfel-pink: #F472B6;
    --text-primary: #1f2937;
    --text-secondary: #4b5563;
    --text-muted: #9ca3af;
    --border-color: rgba(255, 255, 255, 0.6);
    --shadow-sm: 0 2px 12px rgba(16, 185, 129, 0.08);
    --shadow-md: 0 4px 20px rgba(16, 185, 129, 0.12);
    --shadow-lg: 0 8px 32px rgba(16, 185, 129, 0.16);
    --success: #10b981;
    --error: #ef4444;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background: linear-gradient(180deg, var(--bg-start), var(--bg-end));
    color: var(--text-primary);
    min-height: 100vh;
    overflow-x: hidden;
    -webkit-tap-highlight-color: transparent;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    -webkit-overflow-scrolling: touch;
    touch-action: manipulation;
    user-select: none;
    font-weight: 400;
}

#app {
    min-height: 100vh;
    background: linear-gradient(180deg, var(--bg-start), var(--bg-end));
    position: relative;
    overflow: hidden;
}

#app::before {
    content: '';
    position: absolute;
    top: -100px;
    right: -50px;
    width: 350px;
    height: 350px;
    background: radial-gradient(circle, rgba(16, 185, 129, 0.18) 0%, transparent 60%);
    border-radius: 50%;
    pointer-events: none;
}

#app::after {
    content: '';
    position: absolute;
    top: 100px;
    left: -100px;
    width: 400px;
    height: 400px;
    background: radial-gradient(circle, rgba(56, 189, 248, 0.1) 0%, transparent 60%);
    border-radius: 50%;
    pointer-events: none;
}

.screen {
    min-height: 100vh;
    position: relative;
}

#login-screen {
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(180deg, #ecfdf5 0%, #d1fae5 50%, #a7f3d0 100%);
    padding: 20px;
}

.login-container {
    width: 100%;
    max-width: 400px;
    text-align: center;
    padding: 40px 20px;
}

.login-logo {
    width: 100px;
    height: 100px;
    background: rgba(255, 255, 255, 0.6);
    backdrop-filter: blur(10px);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 24px;
    box-shadow: 0 8px 32px rgba(16, 185, 129, 0.15);
    border: 1px solid rgba(255, 255, 255, 0.8);
}

.login-logo i {
    font-size: 48px;
    color: var(--primary);
}

.login-title {
    font-size: 32px;
    font-weight: 700;
    color: var(--primary);
    margin-bottom: 8px;
}

.login-subtitle {
    font-size: 14px;
    color: var(--text-secondary);
    margin-bottom: 32px;
}

.login-form {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.login-form input {
    padding: 16px 20px;
    border: none;
    border-radius: 16px;
    font-size: 16px;
    background: rgba(255, 255, 255, 0.95);
    color: var(--text-primary);
    outline: none;
    transition: transform 0.2s, box-shadow 0.2s;
    backdrop-filter: blur(10px);
}

.login-form input:focus {
    transform: scale(1.02);
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
}

.login-form input::placeholder {
    color: var(--text-muted);
}

.login-form .btn-primary {
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    color: white;
    border: none;
    font-weight: 600;
    box-shadow: 0 4px 20px rgba(16, 185, 129, 0.35);
}

.btn-primary {
    padding: 16px 24px;
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    color: white;
    border: none;
    border-radius: 16px;
    font-size: 16px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    box-shadow: 0 4px 16px rgba(16, 185, 129, 0.3);
}

.btn-primary:active {
    transform: scale(0.98);
    box-shadow: 0 2px 8px rgba(16, 185, 129, 0.2);
}

.btn-primary.large {
    width: 100%;
    padding: 18px 24px;
    font-size: 17px;
}

#main-app {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    position: relative;
}

.header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px;
    padding-top: calc(16px + env(safe-area-inset-top));
    background: transparent;
    position: sticky;
    top: 0;
    z-index: 100;
}

.header-left, .header-right {
    width: 100px;
    flex-shrink: 0;
}

.header-left {
    text-align: left;
}

.header-right {
    text-align: right;
}

.header-center {
    flex: 1;
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
}

.brand-badge-container {
    display: flex;
    gap: 6px;
}

.user-info {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 4px;
}

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

.vip-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 2px;
    background: linear-gradient(135deg, var(--gold), var(--gold-dark));
    padding: 3px 4px;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(251, 191, 36, 0.4);
    transition: all 0.3s ease;
    animation: vipGlow 2s ease-in-out infinite;
    font-size: 12px;
    font-weight: 600;
}

@keyframes vipGlow {
    0%, 100% { box-shadow: 0 4px 12px rgba(251, 191, 36, 0.4); }
    50% { box-shadow: 0 4px 20px rgba(251, 191, 36, 0.6); }
}

.vip-badge.lv2 {
    background: linear-gradient(135deg, var(--accent-blue), #0ea5e9);
    box-shadow: 0 4px 12px rgba(56, 189, 248, 0.4);
    animation: vipGlowBlue 2s ease-in-out infinite;
}

@keyframes vipGlowBlue {
    0%, 100% { box-shadow: 0 4px 12px rgba(56, 189, 248, 0.4); }
    50% { box-shadow: 0 4px 20px rgba(56, 189, 248, 0.6); }
}

.vip-badge.lv3 {
    background: linear-gradient(135deg, var(--accent-purple), #6d28d9);
    box-shadow: 0 4px 12px rgba(139, 92, 246, 0.4);
    animation: vipGlowPurple 2s ease-in-out infinite;
}

@keyframes vipGlowPurple {
    0%, 100% { box-shadow: 0 4px 12px rgba(139, 92, 246, 0.4); }
    50% { box-shadow: 0 4px 20px rgba(139, 92, 246, 0.6); }
}

.vip-badge.lv4 {
    background: linear-gradient(135deg, var(--accent-cyan), #0891b2);
    box-shadow: 0 4px 12px rgba(34, 211, 238, 0.4);
    animation: vipGlowCyan 2s ease-in-out infinite;
}

@keyframes vipGlowCyan {
    0%, 100% { box-shadow: 0 4px 12px rgba(34, 211, 238, 0.4); }
    50% { box-shadow: 0 4px 20px rgba(34, 211, 238, 0.6); }
}

.vip-badge.lv5 {
    background: linear-gradient(135deg, var(--primary), #059669);
    box-shadow: 0 4px 12px rgba(16, 185, 129, 0.4);
    animation: vipGlowGreen 2s ease-in-out infinite;
}

@keyframes vipGlowGreen {
    0%, 100% { box-shadow: 0 4px 12px rgba(16, 185, 129, 0.4); }
    50% { box-shadow: 0 4px 20px rgba(16, 185, 129, 0.6); }
}

.vip-icon {
    font-size: 14px;
}

.vip-level {
    font-size: 13px;
    font-weight: 700;
    color: #78350f;
}

.vip-badge.lv2 .vip-level,
.vip-badge.lv3 .vip-level,
.vip-badge.lv4 .vip-level,
.vip-badge.lv5 .vip-level {
    color: white;
}

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

.brand-badge {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
    margin-top: 2px;
}

.brand-weiao {
    font-size: 10px;
    font-weight: 700;
    color: var(--weiao-orange);
    background: rgba(249, 168, 38, 0.12);
    padding: 2px 8px;
    border-radius: 6px;
}

.brand-leperfel {
    font-size: 10px;
    font-weight: 700;
    color: var(--leperfel-pink);
    background: rgba(244, 114, 182, 0.12);
    padding: 2px 8px;
    border-radius: 6px;
}

.brand-divider {
    font-size: 10px;
    font-weight: 600;
    color: var(--text-muted);
}

.streak {
    font-size: 12px;
    font-weight: 600;
    color: var(--accent-orange);
}

.main-content {
    flex: 1;
    padding: 16px;
    padding-bottom: calc(70px + env(safe-area-inset-bottom));
    overflow-y: auto;
    position: relative;
    z-index: 1;
}

.page {
    display: none;
    animation: fadeIn 0.3s ease;
}

.page.active {
    display: block;
}

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

.stats-cards {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 12px;
    margin-bottom: 20px;
}

.stat-card {
    background: var(--bg-card);
    backdrop-filter: blur(10px);
    border-radius: 18px;
    padding: 14px 8px;
    display: flex;
    flex-direction: column;
    align-items: center;
    box-shadow: var(--shadow-sm);
    border: 1px solid rgba(255, 255, 255, 0.6);
    transition: all 0.2s ease;
}

.stat-card:active {
    transform: scale(0.98);
    background: var(--bg-card-hover);
}

.stat-icon {
    width: 40px;
    height: 40px;
    background: linear-gradient(135deg, rgba(16, 185, 129, 0.1), rgba(167, 139, 250, 0.1));
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 8px;
}

.stat-icon i {
    color: var(--primary);
    font-size: 16px;
}

.stat-value {
    font-size: 18px;
    font-weight: 600;
    color: var(--text-primary);
}

.stat-label {
    font-size: 11px;
    color: var(--text-muted);
    margin-top: 2px;
}

.section-title {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-muted);
    margin-bottom: 10px;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.mode-cards {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-bottom: 16px;
}

.mode-card {
    background: var(--bg-card);
    backdrop-filter: blur(10px);
    border-radius: 18px;
    padding: 18px;
    display: flex;
    align-items: center;
    gap: 16px;
    cursor: pointer;
    transition: all 0.2s ease;
    box-shadow: var(--shadow-sm);
    border: 1px solid rgba(255, 255, 255, 0.6);
}

.mode-card:active {
    transform: scale(0.98);
    background: var(--bg-card-hover);
    box-shadow: var(--shadow-md);
}

.mode-icon {
    width: 48px;
    height: 48px;
    border-radius: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.mode-icon i {
    font-size: 20px;
}

.bg-orange .mode-icon i { color: var(--accent-orange); }
.bg-pink .mode-icon i { color: var(--accent-pink); }
.bg-blue .mode-icon i { color: var(--primary); }
.bg-green .mode-icon i { color: var(--accent-green); }

.bg-orange {
    background: rgba(251, 146, 60, 0.12);
}

.bg-pink {
    background: rgba(244, 114, 182, 0.12);
}

.bg-blue {
    background: rgba(16, 185, 129, 0.12);
}

.bg-green {
    background: rgba(74, 222, 128, 0.12);
}

.mode-title {
    font-size: 15px;
    font-weight: 500;
    color: var(--text-primary);
}

.mode-desc {
    font-size: 12px;
    color: var(--text-muted);
    margin-top: 2px;
}

.cycle-buttons {
    display: flex;
    gap: 8px;
    margin-bottom: 16px;
}

.cycle-btn {
    flex: 1;
    padding: 12px 8px;
    background: var(--bg-card);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.5);
    border-radius: 12px;
    font-size: 13px;
    font-weight: 500;
    color: var(--text-muted);
    cursor: pointer;
    transition: all 0.2s;
}

.cycle-btn.active {
    border-color: var(--primary);
    color: var(--primary);
    background: rgba(16, 185, 129, 0.08);
}

.cycle-btn:active {
    transform: scale(0.98);
}

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

.back-btn {
    width: 44px;
    height: 44px;
    background: var(--bg-card);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.5);
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s;
    box-shadow: var(--shadow-sm);
}

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

.back-btn i {
    font-size: 18px;
    color: var(--text-primary);
}

.learn-header-center {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
}

.learn-phase {
    font-size: 12px;
    font-weight: 600;
    color: var(--primary);
    background: rgba(16, 185, 129, 0.1);
    padding: 2px 10px;
    border-radius: 10px;
}

.learn-progress {
    font-size: 14px;
    font-weight: 500;
    color: var(--text-muted);
}

.learn-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 20px;
}

.question-image {
    background: var(--bg-card);
    backdrop-filter: blur(10px);
    border-radius: 20px;
    padding: 16px;
    width: 280px;
    height: 280px;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    box-shadow: var(--shadow-md);
    border: 1px solid rgba(255, 255, 255, 0.6);
}

.question-image img {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
}

.question-code {
    background: var(--bg-card);
    backdrop-filter: blur(10px);
    border-radius: 20px;
    padding: 24px;
    text-align: center;
    box-shadow: var(--shadow-md);
    border: 1px solid rgba(255, 255, 255, 0.6);
}

#codeText {
    font-size: 32px;
    font-weight: 800;
}

.code-weiao {
    color: var(--weiao-orange);
}

.code-leperfel {
    color: var(--leperfel-pink);
}

.options {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
}

.option-btn {
    padding: 18px 12px;
    background: var(--bg-card);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.5);
    border-radius: 16px;
    font-size: 15px;
    font-weight: 400;
    color: var(--text-primary);
    cursor: pointer;
    transition: all 0.2s ease;
    text-align: center;
    box-shadow: var(--shadow-sm);
}

.option-btn:active:not(:disabled) {
    transform: scale(0.96);
}

.option-btn.correct {
    border-color: var(--success);
    background: rgba(74, 222, 128, 0.08);
}

.option-btn.wrong {
    border-color: var(--error);
    background: rgba(248, 113, 113, 0.08);
}

.option-btn.correct.brand-weiao {
    color: var(--weiao-orange);
}

.option-btn.correct.brand-leperfel {
    color: var(--leperfel-pink);
}

.result-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.4);
    align-items: center;
    justify-content: center;
    z-index: 200;
    padding: 20px;
    animation: fadeIn 0.2s ease;
    backdrop-filter: blur(4px);
}

.result-overlay.show {
    display: flex;
}

.result-card {
    background: var(--bg-card);
    backdrop-filter: blur(20px);
    border-radius: 28px;
    padding: 40px 30px;
    text-align: center;
    width: 90%;
    max-width: 320px;
    animation: slideUp 0.3s ease;
    box-shadow: var(--shadow-lg);
    border: 1px solid rgba(255, 255, 255, 0.6);
}

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

.result-icon {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 20px;
}

.result-icon.correct {
    background: rgba(74, 222, 128, 0.1);
}

.result-icon.wrong {
    background: rgba(248, 113, 113, 0.1);
}

.result-icon i {
    font-size: 40px;
}

.result-icon.correct i {
    color: var(--success);
}

.result-icon.wrong i {
    color: var(--error);
}

.result-text {
    font-size: 18px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 24px;
}

.page-header h2 {
    font-size: 20px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 16px;
}

.ranking-tabs {
    display: flex;
    background: var(--bg-card);
    backdrop-filter: blur(10px);
    border-radius: 14px;
    padding: 4px;
    margin-bottom: 16px;
    box-shadow: var(--shadow-sm);
    border: 1px solid rgba(255, 255, 255, 0.5);
}

.ranking-tab {
    flex: 1;
    padding: 10px 8px;
    background: transparent;
    border: none;
    border-radius: 10px;
    font-size: 13px;
    font-weight: 500;
    color: var(--text-muted);
    cursor: pointer;
    transition: all 0.2s;
}

.ranking-tab.active {
    background: rgba(16, 185, 129, 0.1);
    color: var(--primary);
    font-weight: 600;
}

.ranking-content {
    position: relative;
    min-height: 300px;
}

.online-panel {
    display: none;
    background: var(--bg-card);
    backdrop-filter: blur(10px);
    border-radius: 18px;
    padding: 20px;
    box-shadow: var(--shadow-sm);
    border: 1px solid rgba(255, 255, 255, 0.6);
}

.online-panel.active {
    display: block;
}

.ranking-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
    max-height: 420px;
    overflow-y: auto;
    margin-bottom: 16px;
    padding-right: 4px;
}

.ranking-list::-webkit-scrollbar {
    width: 4px;
}

.ranking-list::-webkit-scrollbar-track {
    background: transparent;
}

.ranking-list::-webkit-scrollbar-thumb {
    background: rgba(16, 185, 129, 0.2);
    border-radius: 2px;
}

.ranking-item {
    display: flex;
    align-items: center;
    gap: 14px;
    background: var(--bg-card);
    backdrop-filter: blur(10px);
    border-radius: 16px;
    padding: 16px;
    transition: all 0.2s ease;
    border: 1px solid rgba(255, 255, 255, 0.5);
    box-shadow: var(--shadow-sm);
}

.ranking-item:active {
    transform: scale(0.99);
}

.ranking-item.my-rank {
    border: 2px solid var(--primary);
    background: rgba(16, 185, 129, 0.05);
}

.rank-number {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: rgba(229, 231, 235, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    font-weight: 600;
    color: var(--text-muted);
}

.rank-number.top3 {
    background: rgba(251, 191, 36, 0.15);
    color: var(--gold-dark);
}

.rank-info {
    flex: 1;
}

.rank-name {
    font-size: 15px;
    font-weight: 500;
    color: var(--text-primary);
}

.rank-desc {
    font-size: 12px;
    color: var(--text-muted);
    margin-top: 2px;
}

.rank-score {
    font-size: 18px;
    font-weight: 500;
    color: var(--primary);
}

.online-users {
    display: none;
}

.online-users-full {
    background: var(--bg-card);
    backdrop-filter: blur(10px);
    border-radius: 18px;
    padding: 20px;
    min-height: 300px;
    box-shadow: var(--shadow-sm);
    border: 1px solid rgba(255, 255, 255, 0.6);
}

.online-count {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 20px;
    padding-bottom: 16px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.5);
}

.online-count-icon {
    font-size: 20px;
}

.online-count-text {
    font-size: 15px;
    font-weight: 600;
    color: var(--text-primary);
}

.online-count-text span {
    color: var(--success);
    font-size: 18px;
}

.online-list-full {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    justify-content: center;
}

.online-user {
    padding: 10px 16px;
    background: rgba(74, 222, 128, 0.1);
    border-radius: 20px;
    font-size: 14px;
    font-weight: 500;
    color: var(--success);
    transition: transform 0.2s;
}

.online-user:active {
    transform: scale(0.95);
}

.online-user.me {
    background: rgba(16, 185, 129, 0.1);
    color: var(--primary);
    font-weight: 600;
}

.no-online {
    font-size: 14px;
    color: var(--text-muted);
    text-align: center;
    padding: 40px 0;
}

.profile-header {
    display: flex;
    align-items: center;
    gap: 16px;
    margin-bottom: 32px;
}

.profile-avatar-wrapper {
    position: relative;
}

.profile-avatar {
    width: 80px;
    height: 80px;
    background: linear-gradient(135deg, var(--primary), var(--accent-purple));
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 8px 28px rgba(16, 185, 129, 0.3);
    cursor: pointer;
    position: relative;
    overflow: hidden;
    transition: transform 0.2s, box-shadow 0.2s;
}

.profile-avatar:active {
    transform: scale(0.96);
}

.profile-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: none;
}

.profile-avatar img.has-avatar {
    display: block;
}

.profile-avatar i {
    font-size: 36px;
    color: white;
}

.profile-avatar img.has-avatar + i {
    display: none;
}

.profile-avatar-edit {
    position: absolute;
    bottom: 0;
    right: 0;
    width: 26px;
    height: 26px;
    background: var(--primary);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: 0 2px 10px rgba(16, 185, 129, 0.4);
    transition: transform 0.2s;
}

.profile-avatar-edit:active {
    transform: scale(0.9);
}

.profile-avatar-edit i {
    font-size: 12px;
    color: white;
}

.history-dates {
    display: flex;
    gap: 6px;
    overflow-x: auto;
    padding-bottom: 10px;
    margin-bottom: 12px;
    white-space: nowrap;
    scrollbar-width: none;
}

.history-dates::-webkit-scrollbar {
    display: none;
}

.history-date-btn {
    padding: 6px 14px;
    background: var(--bg-card);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.5);
    border-radius: 18px;
    font-size: 12px;
    font-weight: 500;
    color: var(--text-muted);
    cursor: pointer;
    flex-shrink: 0;
    transition: all 0.2s;
}

.history-date-btn.active {
    background: rgba(16, 185, 129, 0.1);
    color: var(--primary);
    border-color: var(--primary);
}

.history-table-container {
    background: var(--bg-card);
    backdrop-filter: blur(10px);
    border-radius: 18px;
    overflow: hidden;
    box-shadow: var(--shadow-sm);
    border: 1px solid rgba(255, 255, 255, 0.6);
}

.history-table-scroll {
    max-height: 450px;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    will-change: scroll-position;
}

.history-table-header {
    display: grid;
    grid-template-columns: 35% 25% 20% 20%;
    padding: 14px 16px;
    background: rgba(16, 185, 129, 0.08);
    position: sticky;
    top: 0;
    z-index: 30;
    backdrop-filter: blur(10px);
}

.history-table-header span {
    font-size: 12px;
    font-weight: 500;
    color: var(--text-muted);
}

.ht-col-1 { text-align: left; }
.ht-col-2 { text-align: center; }
.ht-col-3 { text-align: center; }
.ht-col-4 { text-align: right; }

.history-table::-webkit-scrollbar {
    width: 4px;
}

.history-table::-webkit-scrollbar-track {
    background: transparent;
}

.history-table::-webkit-scrollbar-thumb {
    background: rgba(16, 185, 129, 0.2);
    border-radius: 2px;
}

.history-date-section {
    padding: 12px 16px;
    background: rgba(255, 255, 255, 0.9);
    border-bottom: 1px solid rgba(255, 255, 255, 0.5);
    position: sticky;
    top: 48px;
    z-index: 20;
    backdrop-filter: blur(10px);
}

.history-date-section-title {
    font-size: 12px;
    font-weight: 600;
    color: var(--text-muted);
    display: flex;
    align-items: center;
    gap: 6px;
}

.history-date-section-title i {
    font-size: 10px;
}

.history-row {
    display: grid;
    grid-template-columns: 35% 25% 20% 20%;
    padding: 14px 16px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.5);
    font-size: 13px;
    transition: background 0.15s;
}

.history-row:active {
    background: rgba(16, 185, 129, 0.03);
}

.history-row:last-child {
    border-bottom: none;
}

.history-code {
    font-weight: 600;
    color: var(--text-primary);
}

.history-code.weiao {
    color: var(--weiao-orange);
}

.history-code.leperfel {
    color: var(--leperfel-pink);
}

.history-brand {
    text-align: center;
    font-size: 11px;
    padding: 2px 8px;
    border-radius: 4px;
    display: inline-block;
    justify-self: center;
}

.history-brand.weiao {
    background: rgba(16, 185, 129, 0.1);
    color: var(--primary);
}

.history-brand.leperfel {
    background: rgba(167, 139, 250, 0.1);
    color: var(--accent-purple);
}

.history-status {
    text-align: center;
    font-size: 12px;
    font-weight: 500;
}

.history-status.mastered {
    color: var(--success);
}

.history-status.learning {
    color: var(--primary);
}

.history-count {
    text-align: right;
    color: var(--text-muted);
    font-size: 12px;
}

.history-empty {
    padding: 40px 20px;
    text-align: center;
    color: var(--text-muted);
    font-size: 14px;
}

.profile-name {
    font-size: 20px;
    font-weight: 500;
    color: var(--text-primary);
}

.profile-date {
    font-size: 13px;
    color: var(--text-muted);
    margin-top: 4px;
}

.profile-stats {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
    margin-bottom: 32px;
}

.profile-stat {
    background: var(--bg-card);
    backdrop-filter: blur(10px);
    border-radius: 18px;
    padding: 20px 12px;
    text-align: center;
    box-shadow: var(--shadow-sm);
    border: 1px solid rgba(255, 255, 255, 0.6);
}

.ps-value {
    font-size: 24px;
    font-weight: 500;
    color: var(--text-primary);
}

.ps-label {
    font-size: 12px;
    color: var(--text-muted);
    margin-top: 4px;
}

.profile-menu {
    background: var(--bg-card);
    backdrop-filter: blur(10px);
    border-radius: 18px;
    overflow: hidden;
    box-shadow: var(--shadow-sm);
    border: 1px solid rgba(255, 255, 255, 0.6);
}

.menu-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 18px 20px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.5);
    cursor: pointer;
    transition: background 0.2s;
}

.menu-item:last-child {
    border-bottom: none;
}

.menu-item:active {
    background: rgba(16, 185, 129, 0.03);
}

.menu-item i {
    font-size: 18px;
    color: var(--text-muted);
}

.menu-item span {
    font-size: 15px;
    font-weight: 400;
    color: var(--text-primary);
}

.bottom-nav {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: var(--bg-card);
    backdrop-filter: blur(20px);
    border-top: 1px solid rgba(255, 255, 255, 0.5);
    display: flex;
    padding-bottom: env(safe-area-inset-bottom);
    z-index: 100;
    box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.05);
}

.nav-item {
    flex: 1;
    padding: 12px 8px;
    min-height: 60px;
    background: none;
    border: none;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 4px;
    cursor: pointer;
    transition: all 0.2s;
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
}

.nav-item i {
    font-size: 20px;
    color: var(--text-muted);
}

.nav-item span {
    font-size: 11px;
    color: var(--text-muted);
}

.nav-item.active i {
    color: var(--primary);
}

.nav-item.active span {
    color: var(--primary);
    font-weight: 600;
}

.modal-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.4);
    align-items: center;
    justify-content: center;
    z-index: 300;
    padding: 20px;
    backdrop-filter: blur(4px);
}

.modal-overlay.show {
    display: flex;
}

.modal-content {
    background: var(--bg-card);
    backdrop-filter: blur(20px);
    border-radius: 24px;
    padding: 30px;
    width: 100%;
    max-width: 340px;
    text-align: center;
    box-shadow: var(--shadow-lg);
    border: 1px solid rgba(255, 255, 255, 0.6);
}

.modal-content h3 {
    font-size: 18px;
    font-weight: 500;
    color: var(--text-primary);
    margin-bottom: 8px;
}

.modal-content p {
    font-size: 14px;
    color: var(--text-muted);
    margin-bottom: 20px;
}

.modal-content input {
    width: 100%;
    padding: 16px 20px;
    border: 1px solid rgba(255, 255, 255, 0.5);
    border-radius: 16px;
    font-size: 18px;
    font-weight: 500;
    text-align: center;
    margin-bottom: 20px;
    outline: none;
    background: rgba(255, 255, 255, 0.8);
}

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

.modal-buttons {
    display: flex;
    gap: 12px;
}

.btn-secondary {
    flex: 1;
    padding: 14px 20px;
    background: rgba(255, 255, 255, 0.9);
    color: var(--text-secondary);
    border: 1px solid rgba(229, 231, 235, 0.8);
    border-radius: 14px;
    font-size: 15px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
}

.btn-secondary:active {
    transform: scale(0.98);
    background: rgba(229, 231, 235, 0.9);
}

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

.memorize-image {
    background: var(--bg-card);
    backdrop-filter: blur(10px);
    border-radius: 20px;
    padding: 12px;
    width: 240px;
    height: 240px;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    cursor: pointer;
    box-shadow: var(--shadow-md);
    border: 1px solid rgba(255, 255, 255, 0.6);
}

.memorize-image img {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
}

.memorize-code {
    background: var(--bg-card);
    backdrop-filter: blur(10px);
    border-radius: 16px;
    padding: 16px 24px;
    text-align: center;
    width: 100%;
    box-shadow: var(--shadow-sm);
    border: 1px solid rgba(255, 255, 255, 0.6);
}

.memorize-code-label {
    display: block;
    font-size: 12px;
    color: var(--text-muted);
    margin-bottom: 6px;
}

#memorizeCodeText {
    font-size: 28px;
    font-weight: 800;
}

.memorize-quote {
    background: rgba(16, 185, 129, 0.05);
    border-radius: 12px;
    padding: 8px 12px;
    text-align: center;
    width: 100%;
}

.quote-icon {
    display: none;
}

.quote-content {
    font-size: 12px;
    font-weight: 400;
    color: var(--text-muted);
    line-height: 1.4;
    font-style: italic;
}

.quote-author {
    display: none;
}

.memorize-next-btn {
    margin-top: 12px;
}

.exam-setting {
    margin-bottom: 16px;
}

.exam-setting label {
    display: block;
    font-size: 13px;
    font-weight: 600;
    color: var(--text-muted);
    margin-bottom: 8px;
}

.setting-options {
    display: flex;
    gap: 8px;
}

.setting-option {
    flex: 1;
    padding: 12px 8px;
    background: rgba(229, 231, 235, 0.3);
    border: 1px solid rgba(255, 255, 255, 0.5);
    border-radius: 12px;
    font-size: 13px;
    font-weight: 500;
    color: var(--text-muted);
    cursor: pointer;
    transition: all 0.2s;
}

.setting-option.active {
    border-color: var(--primary);
    color: var(--primary);
    background: rgba(16, 185, 129, 0.08);
}

.result-options {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-top: 16px;
}

.happy-result-icon {
    font-size: 64px;
    margin-bottom: 16px;
}

.happy-result-stats {
    display: flex;
    justify-content: space-around;
    margin: 20px 0;
}

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

.happy-stat-value {
    font-size: 28px;
    font-weight: 600;
    color: var(--primary);
}

.happy-stat-label {
    font-size: 12px;
    color: var(--text-muted);
    margin-top: 4px;
}

.logout-item span {
    color: var(--error);
}

.logout-item i {
    color: var(--error);
}

.logout-icon {
    font-size: 48px;
    margin-bottom: 16px;
}

.logout-options {
    text-align: left;
    margin: 16px 0;
}

.logout-option {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 0;
    cursor: pointer;
}

.logout-option input[type="radio"] {
    width: 18px;
    height: 18px;
    accent-color: var(--primary);
}

.logout-option label {
    font-size: 14px;
    color: var(--text-primary);
    cursor: pointer;
}

@media (min-width: 768px) {
    #app {
        max-width: 420px;
        margin: 0 auto;
        box-shadow: 0 0 40px rgba(16, 185, 129, 0.1);
        min-height: 100vh;
        border-radius: 20px;
        overflow: hidden;
    }
    
    .header {
        padding-top: 16px;
    }
    
    .main-content {
        padding-bottom: 80px;
    }
    
    .bottom-nav {
        padding-bottom: 0;
    }
}

.vip-upgrade-modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
    backdrop-filter: blur(4px);
}

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

.vip-upgrade-content {
    background: var(--bg-card);
    backdrop-filter: blur(20px);
    border-radius: 28px;
    padding: 40px;
    text-align: center;
    transform: scale(0.8) translateY(20px);
    transition: all 0.3s ease;
    box-shadow: 0 20px 60px rgba(16, 185, 129, 0.2);
    max-width: 320px;
    border: 1px solid rgba(255, 255, 255, 0.6);
}

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

.vip-upgrade-icon {
    font-size: 64px;
    margin-bottom: 16px;
    animation: bounce 0.6s ease infinite alternate;
}

@keyframes bounce {
    from { transform: translateY(0); }
    to { transform: translateY(-10px); }
}

.vip-upgrade-title {
    font-size: 24px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 12px;
}

.vip-upgrade-level {
    font-size: 18px;
    font-weight: 600;
    color: var(--primary);
    margin-bottom: 8px;
}

.vip-upgrade-desc {
    font-size: 14px;
    color: var(--text-muted);
    margin-bottom: 20px;
}

.vip-upgrade-stars {
    font-size: 32px;
    display: flex;
    justify-content: center;
    gap: 4px;
}

.vip-star {
    color: #e2e8f0;
    transition: all 0.3s ease;
}

.vip-star.filled {
    color: var(--gold);
    animation: starPop 0.4s ease forwards;
}

@keyframes starPop {
    0% { transform: scale(0); }
    50% { transform: scale(1.3); }
    100% { transform: scale(1); }
}

.admin-item span {
    color: var(--primary);
}

.admin-item i {
    color: var(--primary);
}

.admin-users-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-bottom: 20px;
    max-height: 400px;
    overflow-y: auto;
}

.admin-user-item {
    background: var(--bg-card);
    backdrop-filter: blur(10px);
    border-radius: 16px;
    padding: 16px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    box-shadow: var(--shadow-sm);
    border: 1px solid rgba(255, 255, 255, 0.6);
}

.admin-user-info {
    flex: 1;
}

.admin-user-name {
    font-size: 15px;
    font-weight: 500;
    color: var(--text-primary);
}

.admin-user-stats {
    font-size: 12px;
    color: var(--text-muted);
    margin-top: 2px;
}

.admin-user-actions {
    display: flex;
    gap: 8px;
}

.admin-action-btn {
    padding: 8px 12px;
    border: none;
    border-radius: 10px;
    font-size: 12px;
    font-weight: 500;
    cursor: pointer;
    transition: transform 0.2s;
}

.admin-action-btn.delete-rank {
    background: rgba(248, 113, 113, 0.1);
    color: var(--error);
}

.admin-action-btn.ban-user {
    background: rgba(245, 158, 11, 0.1);
    color: var(--accent-orange);
}

.admin-action-btn.delete-user {
    background: rgba(168, 85, 247, 0.1);
    color: var(--accent-purple);
}

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

.admin-actions {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.admin-actions .btn-primary {
    background: linear-gradient(135deg, var(--error), #dc2626);
    box-shadow: 0 4px 16px rgba(239, 68, 68, 0.3);
}