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

:root {
    --primary-bg: #fdfdff;
    --secondary-bg: #f4f7fa;
    --card-bg: #ffffff;
    --text-color: #1a202c;
    --light-text-color: #4a5568;
    --accent-color: #4f46e5;
    --accent-gradient: linear-gradient(45deg, #4f46e5, #818cf8);
    --border-color: #e2e8f0;
    --shadow-color: rgba(0, 0, 0, 0.05);
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background-color: var(--primary-bg);
    color: var(--light-text-color);
    margin: 0;
    line-height: 1.7;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 2rem;
}

h1, h2, h3 {
    color: var(--text-color);
    font-weight: 800;
}

h2 {
    text-align: center;
    font-size: 2.8rem;
    margin-bottom: 4rem;
    position: relative;
}

h2::after {
    content: '';
    display: block;
    width: 70px;
    height: 5px;
    background: var(--accent-gradient);
    margin: 12px auto 0;
    border-radius: 3px;
}

/* Language Switcher */
.language-switcher {
    position: absolute;
    top: 1.5rem;
    right: 2rem;
    font-size: 1rem;
    background: rgba(31, 41, 55, 0.5);
    padding: 0.5rem 1rem;
    border-radius: 20px;
    backdrop-filter: blur(8px);
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.language-switcher a {
    color: #d1d5db;
    text-decoration: none;
    transition: color 0.3s;
    font-weight: 500;
}

.language-switcher a:hover {
    color: white;
}

.language-switcher span {
    color: white;
    font-weight: 700;
}

/* Hero Section */
.hero {
    position: relative;
    background-color: #111827;
    color: white;
    padding: 8rem 0;
    text-align: center;
    overflow: hidden;
}

.hero::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: 
        radial-gradient(circle at 15% 50%, rgba(124, 58, 237, 0.2), transparent 40%),
        radial-gradient(circle at 85% 30%, rgba(59, 130, 246, 0.15), transparent 40%);
    opacity: 0.5;
}

.hero h1 {
    font-size: 4.5rem;
    margin-bottom: 1rem;
    color: white;
    text-shadow: 0 2px 4px rgba(0,0,0,0.2);
}

.hero .subtitle {
    font-size: 1.75rem;
    color: rgba(255, 255, 255, 0.9);
    margin-bottom: 2rem;
    font-weight: 500;
}

.hero p {
    max-width: 650px;
    margin: 0 auto 2.5rem;
    font-size: 1.1rem;
    color: rgba(255, 255, 255, 0.85);
}

.cta-button {
    background: var(--accent-gradient);
    color: white;
    border: none;
    padding: 1rem 2.5rem;
    border-radius: 50px;
    text-decoration: none;
    font-size: 1.1rem;
    font-weight: 700;
    transition: all 0.3s ease;
    box-shadow: 0 8px 20px rgba(79, 70, 229, 0.3);
}

.cta-button:hover {
    transform: translateY(-3px) scale(1.05);
    box-shadow: 0 12px 25px rgba(79, 70, 229, 0.4);
}

/* Navigation Bar */
.main-nav {
    background-color: var(--primary-bg);
    border-bottom: 1px solid var(--border-color);
    position: sticky;
    top: 0;
    z-index: 999;
    box-shadow: 0 2px 10px var(--shadow-color);
    transition: top 0.3s;
}

.main-nav ul {
    display: flex;
    justify-content: center;
    list-style: none;
    margin: 0;
    padding: 1rem 0;
}

.main-nav li {
    margin: 0 1.5rem;
}

.main-nav a {
    color: var(--light-text-color);
    text-decoration: none;
    font-weight: 700;
    font-size: 1rem;
    transition: color 0.3s;
    position: relative;
    padding-bottom: 0.5rem;
}

.main-nav a::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    width: 0;
    height: 3px;
    background: var(--accent-gradient);
    transition: width 0.3s;
    border-radius: 2px;
}

.main-nav a:hover,
.main-nav a.active {
    color: var(--accent-color);
}

.main-nav a:hover::after,
.main-nav a.active::after {
    width: 100%;
}


/* General Section Styling */
section {
    padding: 6rem 0;
}

.features, .why-n-back {
    background-color: var(--secondary-bg);
}

.screenshots, .tech-stack {
    background-color: var(--primary-bg);
}

/* Features Section */
.feature-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
    gap: 2.5rem;
}

.feature-item {
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    padding: 2.5rem;
    border-radius: 16px;
    text-align: center;
    transition: transform 0.3s, box-shadow 0.3s;
    box-shadow: 0 5px 15px var(--shadow-color);
}

.feature-item:hover {
    transform: translateY(-8px);
    box-shadow: 0 12px 25px rgba(0,0,0,0.1);
}

.feature-item h3 {
    font-size: 1.4rem;
    margin-bottom: 1rem;
    color: var(--text-color);
}

/* Why N-Back Section */
.why-n-back .container {
    display: flex;
    flex-direction: column;
    align-items: center;
}

.why-n-back-content {
    max-width: 800px;
    text-align: center;
}

.why-n-back-content p {
    font-size: 1.1rem;
    margin-bottom: 1.5rem;
}

/* Screenshots Section */
.screenshot-gallery {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(400px, 1fr));
    gap: 2.5rem;
    max-width: 1000px;
    margin: 0 auto;
}

.screenshot-gallery figure {
    margin: 0;
    text-align: center;
    background: var(--card-bg);
    padding: 1rem;
    border-radius: 16px;
    border: 1px solid var(--border-color);
    box-shadow: 0 5px 15px var(--shadow-color);
    transition: transform 0.3s, box-shadow 0.3s;
}

.screenshot-gallery figure:hover {
    transform: translateY(-8px);
    box-shadow: 0 12px 25px rgba(0,0,0,0.1);
}

.screenshot-gallery img {
    width: 100%;
    height: auto;
    border-radius: 12px;
    cursor: pointer;
    margin-bottom: 1rem;
}

.screenshot-gallery figcaption {
    font-size: 1rem;
    color: var(--light-text-color);
    font-style: italic;
}

/* Tech Stack Section */
.tech-stack ul {
    list-style: none;
    padding: 0;
    display: flex;
    justify-content: center;
    flex-wrap: wrap;
    gap: 1.5rem;
}

.tech-stack li {
    background: var(--card-bg);
    color: var(--light-text-color);
    padding: 0.7rem 1.8rem;
    border-radius: 50px;
    font-size: 1rem;
    font-weight: 500;
    border: 1px solid var(--border-color);
    box-shadow: 0 2px 5px var(--shadow-color);
    transition: all 0.3s;
}

.tech-stack li:hover {
    transform: translateY(-3px);
    box-shadow: 0 5px 10px rgba(0,0,0,0.08);
}

/* Footer */
footer {
    background-color: var(--secondary-bg);
    text-align: center;
    padding: 3rem 0;
    color: var(--light-text-color);
    font-size: 1rem;
    border-top: 1px solid var(--border-color);
}

/* Modal for Screenshots */
.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    overflow: auto;
    background-color: rgba(0, 0, 0, 0.9);
    justify-content: center;
    align-items: center;
    animation: fadeIn 0.3s;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.modal-content {
    max-width: 90%;
    max-height: 90%;
    display: block;
    margin: auto;
    border-radius: 8px;
}

.close-modal {
    position: absolute;
    top: 25px;
    right: 40px;
    color: #f1f1f1;
    font-size: 50px;
    font-weight: bold;
    transition: 0.3s;
    cursor: pointer;
}

.close-modal:hover {
    color: #bbb;
}

/* Responsive */
@media (max-width: 768px) {
    .hero h1 {
        font-size: 3.5rem;
    }
    h2 {
        font-size: 2.2rem;
    }
    .screenshot-gallery {
        grid-template-columns: 1fr;
    }
}

/* How to Play Section */

.mechanics-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 2.5rem;
    max-width: 900px;
    margin: 0 auto;
}

.mechanics-grid .card {
    text-align: center;
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    padding: 2.5rem;
    border-radius: 16px;
    box-shadow: 0 5px 15px var(--shadow-color);
}

.mechanics-grid .icon {
    font-size: 3.5rem;
    margin-bottom: 1rem;
    display: block;
}

.mechanics-grid h3 {
    font-size: 1.5rem;
    font-weight: 700;
    margin-bottom: 1rem;
}

.simulator-container {
    display: flex;
    gap: 2.5rem;
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    padding: 2.5rem;
    border-radius: 16px;
    box-shadow: 0 5px 15px var(--shadow-color);
    margin-top: 2.5rem;
}

.visual-simulator {
    flex: 1;
    text-align: center;
}

.controls-simulator {
    flex: 1;
    padding-left: 2.5rem;
    border-left: 1px solid var(--border-color);
}

.grid-container {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 0.5rem;
    width: 240px;
    margin: 1rem auto;
}

.grid-cell {
    width: 75px;
    height: 75px;
    border: 2px solid var(--border-color);
    border-radius: 8px;
    transition: background-color 0.3s ease;
}

.current-stimulus {
    background-color: #90cdf4 !important;
    border-color: #2b6cb0 !important;
}

.n-back-match {
    background-color: #faf089 !important;
    border-color: #b7791f !important;
}

.audio-stimulus-display {
    text-align: center;
    margin-bottom: 2rem;
}

.audio-stimulus-display p:first-child {
    font-size: 1rem;
    color: var(--light-text-color);
}

#audio-stimulus {
    font-size: 5rem;
    font-weight: 800;
    color: var(--accent-color);
    height: 80px;
    line-height: 80px;
}

#audio-n-back {
    font-weight: 700;
}

.controls-group {
    text-align: center;
    margin-bottom: 2rem;
}

.controls-group p {
    font-weight: 500;
    margin-bottom: 0.5rem;
}

.n-level-buttons, .action-buttons {
    display: flex;
    justify-content: center;
    gap: 0.5rem;
}

.btn {
    border: none;
    border-radius: 8px;
    padding: 0.75rem 1.5rem;
    font-weight: 700;
    color: white;
    transition: background-color 0.3s, transform 0.2s;
    cursor: pointer;
    background-color: #a0aec0;
}

.btn:hover {
    background-color: #718096;
}

.btn.active {
    background-color: var(--accent-color);
    transform: scale(1.05);
    box-shadow: 0 5px 15px rgba(79, 70, 229, 0.3);
}

.btn-primary {
    background-color: var(--accent-color);
    width: 100%;
}
.btn-primary:hover {
    background-color: #4338ca;
}

#reset-btn {
    background: none;
    border: none;
    color: var(--light-text-color);
    margin-top: 1rem;
    cursor: pointer;
    font-weight: 500;
}
#reset-btn:hover {
    color: var(--text-color);
}

.explanation-box {
    margin-top: 2rem;
    padding: 1.5rem;
    border-radius: 12px;
    text-align: center;
    font-size: 1.1rem;
    line-height: 1.6;
    border: 1px solid;
}

.explanation-box.info {
    background-color: #ebf8ff;
    border-color: #90cdf4;
    color: #2b6cb0;
}

.explanation-box.success {
    background-color: #f0fff4;
    border-color: #9ae6b4;
    color: #2f855a;
}

.flow-timeline {
    position: relative;
    max-width: 700px;
    margin: 0 auto;
}

.timeline-line {
    position: absolute;
    left: 24px;
    top: 0;
    bottom: 0;
    width: 4px;
    background: var(--border-color);
    border-radius: 2px;
}

.timeline-item {
    position: relative;
    padding-left: 70px;
    margin-bottom: 2rem;
}

.timeline-dot {
    position: absolute;
    left: 0;
    top: 5px;
    width: 50px;
    height: 50px;
    border-radius: 50%;
    background: var(--accent-gradient);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    font-weight: 700;
    border: 4px solid var(--primary-bg);
}

@media (max-width: 768px) {
    .mechanics-grid, .simulator-container {
        grid-template-columns: 1fr;
        flex-direction: column;
    }
    .controls-simulator {
        padding-left: 0;
        border-left: none;
        border-top: 1px solid var(--border-color);
        padding-top: 2.5rem;
    }
}
