:root {
    --bg-color: #0f172a;
    --text-color: #f8fafc;
    --primary-color: #6366f1;
    --secondary-color: #ec4899;
    --accent-color: #8b5cf6;
    --glass-bg: rgba(255, 255, 255, 0.08);
    --glass-border: rgba(255, 255, 255, 0.1);
    --card-back: linear-gradient(135deg, #6366f1, #8b5cf6);
    --font-main: 'Outfit', sans-serif;
}

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

body {
    font-family: var(--font-main);
    background-color: var(--bg-color);
    color: var(--text-color);
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    overflow-x: hidden;
}

/* Background Blobs */
.background-blobs {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: -1;
    overflow: hidden;
}

.blob {
    position: absolute;
    border-radius: 50%;
    filter: blur(80px);
    opacity: 0.6;
    animation: float 20s infinite ease-in-out;
}

.blob-1 {
    width: 400px;
    height: 400px;
    background: var(--primary-color);
    top: -100px;
    left: -100px;
    animation-delay: 0s;
}

.blob-2 {
    width: 500px;
    height: 500px;
    background: var(--secondary-color);
    bottom: -150px;
    right: -150px;
    animation-delay: -5s;
}

.blob-3 {
    width: 300px;
    height: 300px;
    background: var(--accent-color);
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    animation-delay: -10s;
}

@keyframes float {

    0%,
    100% {
        transform: translate(0, 0) scale(1);
    }

    33% {
        transform: translate(30px, -50px) scale(1.1);
    }

    66% {
        transform: translate(-20px, 20px) scale(0.9);
    }
}

/* App Container */
.app-container {
    width: 100%;
    max-width: 1200px;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    padding: 20px;
    position: relative;
}

/* Screens */
.screen {
    display: none;
    width: 100%;
    flex-direction: column;
    align-items: center;
    animation: fadeIn 0.5s ease-out;
}

.screen.active {
    display: flex;
}

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

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Start Screen Layout */
#start-screen {
    gap: 2rem;
    width: 100%;
    max-width: 800px;
}

.hero-section {
    text-align: center;
    margin-bottom: 1rem;
  
}

.game-title {
    font-size: clamp(3rem, 8vw, 5rem);
    font-weight: 800;
    line-height: 1.1;
    background: linear-gradient(to right, #fff, #cbd5e1);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    text-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
    margin-bottom: 0.5rem;
}

.game-subtitle {
    font-size: clamp(1rem, 3vw, 1.5rem);
    color: #94a3b8;
    letter-spacing: 2px;
    text-transform: uppercase;
    margin-bottom: 2rem;
}

.hidden {
    display: none !important;
}

/* Dashboard Grid */
.dashboard-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.5rem;
    width: 100%;
}

@media (max-width: 768px) {
    .dashboard-grid {
        grid-template-columns: 1fr;
    }
}

.dashboard-card {
    background: var(--glass-bg);
    backdrop-filter: blur(16px);
    border: 1px solid var(--glass-border);
    padding: 1.5rem;
    border-radius: 24px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
}

.dashboard-card h3 {
    font-size: 1.2rem;
    margin-bottom: 1rem;
    color: #cbd5e1;
    border-bottom: 1px solid var(--glass-border);
    padding-bottom: 0.5rem;
}

/* Stats Grid */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1rem;
    text-align: center;
}

.stat-item {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.stat-item .stat-label {
    font-size: 0.75rem;
    color: #94a3b8;
}

.stat-item .stat-value {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--primary-color);
}

/* Enhanced Profile Stats Grid */
.profile-stats-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1rem;
    text-align: center;
    margin-bottom: 1.5rem;
}

.profile-stat-item {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
    padding: 0.75rem 0.5rem;
    background: rgba(255, 255, 255, 0.03);
    border-radius: 12px;
    transition: all 0.3s ease;
}

.profile-stat-item:hover {
    background: rgba(255, 255, 255, 0.06);
    transform: translateY(-2px);
}

.profile-stat-item .stat-label {
    font-size: 0.7rem;
    color: #94a3b8;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.profile-stat-item .stat-value {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--primary-color);
}

/* Rank Badge Styling */
.rank-badge {
    padding: 0.25rem 0.75rem;
    border-radius: 12px;
    font-size: 0.95rem !important;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.rank-legend {
    background: linear-gradient(135deg, #fbbf24, #f59e0b);
    color: #1e293b;
}

.rank-genius {
    background: linear-gradient(135deg, #a78bfa, #8b5cf6);
    color: white;
}

.rank-pro {
    background: linear-gradient(135deg, #60a5fa, #3b82f6);
    color: white;
}

.rank-skilled {
    background: linear-gradient(135deg, #34d399, #10b981);
    color: white;
}

.rank-learner {
    background: linear-gradient(135deg, #94a3b8, #64748b);
    color: white;
}

/* Profile Insights Section */
.profile-insights {
    background: rgba(99, 102, 241, 0.08);
    border: 1px solid rgba(99, 102, 241, 0.2);
    border-radius: 16px;
    padding: 1rem;
    margin-bottom: 1rem;
}

.insight-row {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.5rem 0;
}

.insight-row:not(:last-child) {
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.insight-icon {
    font-size: 1.5rem;
    flex-shrink: 0;
}

.insight-content {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
    flex: 1;
}

.insight-label {
    font-size: 0.7rem;
    color: #94a3b8;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.insight-value {
    font-size: 0.95rem;
    font-weight: 600;
    color: #e2e8f0;
}

/* Profile Recommendation Section */
.profile-recommendation {
    background: linear-gradient(135deg, rgba(236, 72, 153, 0.1), rgba(139, 92, 246, 0.1));
    border: 1px solid rgba(236, 72, 153, 0.3);
    border-radius: 16px;
    padding: 1rem;
    display: flex;
    gap: 1rem;
    align-items: flex-start;
    animation: slideIn 0.5s ease-out;
}

@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.recommendation-icon {
    font-size: 1.75rem;
    flex-shrink: 0;
}

.recommendation-content {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.recommendation-title {
    font-size: 0.75rem;
    color: #ec4899;
    text-transform: uppercase;
    letter-spacing: 1px;
    font-weight: 600;
}

.recommendation-text {
    font-size: 0.9rem;
    color: #e2e8f0;
    line-height: 1.5;
}

/* Responsive adjustments for profile */
@media (max-width: 640px) {
    .profile-stats-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 0.75rem;
    }

    .profile-stat-item {
        padding: 0.5rem;
    }

    .profile-stat-item .stat-value {
        font-size: 1.1rem;
    }

    .insight-icon {
        font-size: 1.25rem;
    }

    .recommendation-icon {
        font-size: 1.5rem;
    }
}

/* History List */
.history-list {
    max-height: 520px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.history-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.75rem;
    background: rgba(255, 255, 255, 0.03);
    border-radius: 12px;
    font-size: 0.9rem;
}

.history-item .date {
    color: #94a3b8;
    font-size: 0.8rem;
}

.history-item .score {
    font-weight: 600;
    color: var(--secondary-color);
}

.empty-state {
    text-align: center;
    color: #64748b;
    font-style: italic;
    padding: 1rem;
}

/* Difficulty Selector */
.difficulty-selector {
    background: var(--glass-bg);
    backdrop-filter: blur(16px);
    border: 1px solid var(--glass-border);
    padding: 2rem;
    border-radius: 24px;
    width: 100%;
    max-width: 500px;
    text-align: center;
    animation: fadeIn 0.3s ease-out;
    margin: 0 auto;
}

.buttons {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    margin-top: 1.5rem;
}

.btn-difficulty {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    padding: 1rem;
    border-radius: 16px;
    color: white;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 1rem;
    text-align: left;
}

.btn-difficulty:hover {
    background: rgba(255, 255, 255, 0.15);
    transform: translateY(-2px);
    border-color: var(--primary-color);
}

.diff-icon {
    font-size: 1.5rem;
    background: rgba(255, 255, 255, 0.1);
    width: 40px;
    height: 40px;
    display: flex;
    justify-content: center;
    align-items: center;
    border-radius: 10px;
}

.diff-info {
    display: flex;
    flex-direction: column;
}

.level-name {
    font-weight: 600;
    font-size: 1.1rem;
}

.level-desc {
    font-size: 0.85rem;
    color: #94a3b8;
}

/* Buttons */
.btn-primary {
    background: linear-gradient(135deg, var(--primary-color), var(--accent-color));
    color: white;
    border: none;
    padding: 1rem 2.5rem;
    font-size: 1.2rem;
    font-weight: 600;
    border-radius: 50px;
    cursor: pointer;
    transition: all 0.3s;
    box-shadow: 0 10px 20px rgba(99, 102, 241, 0.3);
}

.btn-primary:hover {
    transform: translateY(-3px) scale(1.02);
    box-shadow: 0 15px 30px rgba(99, 102, 241, 0.4);
}

.btn-large {
    font-size: 1.5rem;
    padding: 1.2rem 3.5rem;
}

.btn-secondary {
    background: rgba(255, 255, 255, 0.1);
    color: white;
    border: 1px solid rgba(255, 255, 255, 0.2);
    padding: 1rem 2rem;
    font-size: 1rem;
    font-weight: 600;
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-secondary:hover {
    background: rgba(255, 255, 255, 0.2);
}

.btn-text {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.15);
    color: #cbd5e1;
    margin-top: 1.5rem;
    padding: 0.75rem 2rem;
    font-size: 1rem;
    font-weight: 500;
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0.0, 0.2, 1);
    backdrop-filter: blur(8px);
    position: relative;
    overflow: hidden;
}

.btn-text::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.1), transparent);
    transition: left 0.5s;
}

.btn-text:hover::before {
    left: 100%;
}

.btn-text:hover {
    background: rgba(255, 255, 255, 0.1);
    border-color: var(--primary-color);
    color: white;
    transform: translateY(-2px);
    box-shadow: 0 8px 16px rgba(99, 102, 241, 0.2);
}

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

/* Game Board & Cards */
.game-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100%;
    max-width: 600px;
    margin-bottom: 1.5rem;
    background: var(--glass-bg);
    backdrop-filter: blur(12px);
    padding: 0.75rem 1.5rem;
    border-radius: 20px;
    border: 1px solid var(--glass-border);
}

.stat-box {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
}

.stat-label {
    font-size: 0.8rem;
    color: #94a3b8;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.stat-value {
    font-size: 1.5rem;
    font-weight: 700;
    font-variant-numeric: tabular-nums;
}

.btn-icon {
    background: none;
    border: none;
    color: white;
    cursor: pointer;
    padding: 0.5rem;
    border-radius: 50%;
    transition: background 0.3s;
}

.btn-icon:hover {
    background: rgba(255, 255, 255, 0.1);
}

.game-board {
    display: grid;
    gap: 0.75rem;
    width: 100%;
    max-width: 600px;
    margin: 0 auto;
    perspective: 1000px;
}

.card {
    position: relative;
    background: transparent;
    cursor: pointer;
    aspect-ratio: 1;
    transform-style: preserve-3d;
    transition: transform 0.6s cubic-bezier(0.4, 0.0, 0.2, 1);
}

.card.flipped {
    transform: rotateY(180deg);
}

.card-face {
    position: absolute;
    width: 100%;
    height: 100%;
    backface-visibility: hidden;
    border-radius: 12px;
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: clamp(1.5rem, 4vw, 2.5rem);
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    border: 1px solid var(--glass-border);
    user-select: none;
}

.card-front {
    background: var(--card-back);
    transform: rotateY(0deg);
}

.card-back {
    background: rgba(255, 255, 255, 0.9);
    color: #1e293b;
    transform: rotateY(180deg);
}

.card.matched .card-back {
    background: #22c55e;
    color: white;
    animation: pulse 0.5s ease-in-out;
}

@keyframes pulse {
    0% {
        transform: rotateY(180deg) scale(1);
    }

    50% {
        transform: rotateY(180deg) scale(1.1);
    }

    100% {
        transform: rotateY(180deg) scale(1);
    }
}

/* Modal */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    backdrop-filter: blur(8px);
    z-index: 100;
    justify-content: center;
    align-items: center;
    padding: 20px;
}

.modal.active {
    display: flex;
    animation: fadeIn 0.3s ease-out;
}

.modal-content {
    background: #1e293b;
    padding: 2.5rem;
    border-radius: 24px;
    text-align: center;
    border: 1px solid var(--glass-border);
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
    width: 100%;
    max-width: 450px;
}

.modal-content h2 {
    font-size: 2rem;
    margin-bottom: 0.5rem;
    background: linear-gradient(to right, #4ade80, #22c55e);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.modal-subtitle {
    color: #94a3b8;
    margin-bottom: 2rem;
}

.assessment-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1rem;
    margin-bottom: 2rem;
    background: rgba(255, 255, 255, 0.05);
    padding: 1rem;
    border-radius: 16px;
}

.assessment-item {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.assessment-item .label {
    font-size: 0.75rem;
    color: #94a3b8;
    text-transform: uppercase;
}

.assessment-item .value {
    font-size: 1.5rem;
    font-weight: 700;
    color: white;
}

/* Advanced Analysis */
.advanced-analysis {
    background: rgba(99, 102, 241, 0.1);
    border: 1px solid rgba(99, 102, 241, 0.3);
    border-radius: 16px;
    padding: 1.5rem;
    margin-bottom: 2rem;
    text-align: left;
}

.advanced-analysis h3 {
    font-size: 1.1rem;
    color: #a5b4fc;
    margin-bottom: 1rem;
    text-align: center;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.analysis-row {
    display: flex;
    justify-content: space-between;
    margin-bottom: 1rem;
}

.analysis-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.25rem;
}

.value-badge {
    background: var(--primary-color);
    padding: 0.25rem 0.75rem;
    border-radius: 12px;
    font-size: 0.9rem;
    font-weight: 600;
}

.analysis-insight {
    font-size: 0.9rem;
    color: #cbd5e1;
    text-align: center;
    font-style: italic;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    padding-top: 1rem;
}

.final-stats-row {
    display: flex;
    justify-content: center;
    gap: 2rem;
    margin-bottom: 2rem;
    color: #cbd5e1;
    font-size: 0.9rem;
}

.modal-actions {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

/* Responsive Adjustments */
@media (max-width: 480px) {
    .game-board {
        gap: 0.5rem;
    }

    .card-face {
        border-radius: 8px;
    }

    .assessment-grid {
        gap: 0.5rem;
    }

    .assessment-item .value {
        font-size: 1.2rem;
    }

    .analysis-row {
        flex-direction: column;
        gap: 1rem;
    }
}

/* Footer */
.site-footer {
    width: 100%;
    text-align: center;
    padding: 2rem 1rem;
    margin-top: auto;
    background: var(--glass-bg);
    backdrop-filter: blur(16px);
    border-top: 1px solid var(--glass-border);
    border-radius: 20px 20px 0 0;
    margin-top: 20px;
}

.footer-text {
    font-size: 1rem;
    color: #cbd5e1;
    margin-bottom: 0.5rem;
    font-weight: 400;
}

.footer-heart {
    display: inline-block;
    color: #ec4899;
    animation: heartbeat 1.5s ease-in-out infinite;
}

@keyframes heartbeat {

    0%,
    100% {
        transform: scale(1);
    }

    50% {
        transform: scale(1.2);
    }
}

.footer-name {
    font-weight: 600;
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color), var(--accent-color));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    transition: all 0.3s ease;
}

.footer-copyright {
    font-size: 0.85rem;
    color: #64748b;
    font-weight: 300;
}

/* Footer Responsive */
@media (max-width: 768px) {
    .site-footer {
        padding: 1.5rem 1rem;
    }

    .footer-text {
        font-size: 0.9rem;
    }

    .footer-copyright {
        font-size: 0.75rem;
    }
}

@media (max-width: 480px) {
    .site-footer {
        padding: 1.25rem 0.75rem;
    }

    .footer-text {
        font-size: 0.85rem;
    }

    .footer-copyright {
        font-size: 0.7rem;
    }
}