:root {
    --primary: #4a6bff;
    --primary-dark: #3a56cc;
    --secondary: #6c757d;
    --light: #f8f9fa;
    --dark: #2c3e50;
    --success: #28a745;
    --danger: #dc3545;
    --warning: #ffc107;
    --info: #17a2b8;
    --bg: #f4f7f9;
    --card-bg: white;
    --text: #333;
    --text-light: #777;
    --border: #dee2e6;
    --shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
}

.dark-mode {
    --bg: #1a1a1a;
    --card-bg: #2d2d2d;
    --text: #e0e0e0;
    --text-light: #999;
    --border: #444;
    --shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
}

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

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    line-height: 1.6;
    background-color: var(--bg);
    color: var(--text);
    transition: background-color 0.3s, color 0.3s;
}

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

/* Header & Nav */
header { background: linear-gradient(135deg, #007bff, #2c3e50); color: white; padding: 1rem 0; box-shadow: 0 2px 10px rgba(0,0,0,0.1); }
.header-content { padding-top: 1rem; text-align: center; }
h1 { font-size: 2.2rem; font-weight: 700; margin-bottom: 0.5rem; }
.tagline { font-size: 1.1rem; color: rgba(255, 255, 255, 0.9); margin-bottom: 1rem; }
.main-nav { display: flex; justify-content: space-between; align-items: center; padding: 0.5rem 0; }
.nav-brand .logo-link { display: flex; align-items: center; gap: 0.5rem; font-size: 1.2rem; font-weight: 600; color: white; text-decoration: none; }
.nav-brand .logo-link img { height: 30px; width: auto; }
.nav-links { display: flex; list-style: none; gap: 1.5rem; }
.nav-link { color: rgba(255, 255, 255, 0.9); text-decoration: none; font-weight: 500; display: flex; align-items: center; gap: 0.5rem; transition: color 0.3s ease; }
.nav-link:hover { color: white; }
.nav-actions { display: flex; align-items: center; gap: 1rem; }

/* Dark Mode Toggle */
.toggle-container { display: flex; align-items: center; gap: 0.75rem; color: white; }
.toggle-switch { position: relative; display: inline-block; width: 60px; height: 30px; }
.toggle-switch input { opacity: 0; width: 0; height: 0; }
.slider { position: absolute; cursor: pointer; top: 0; left: 0; right: 0; bottom: 0; background-color: var(--secondary); transition: .4s; border-radius: 34px; }
.slider:before { position: absolute; content: ""; height: 22px; width: 22px; left: 4px; bottom: 4px; background-color: white; transition: .4s; border-radius: 50%; }
input:checked + .slider { background-color: var(--primary); }
input:checked + .slider:before { transform: translateX(30px); }

/* Breadcrumb */
.breadcrumb { padding: 1rem 0; font-size: 0.9rem; color: var(--text-light); }
.breadcrumb a { color: var(--primary); text-decoration: none; }
.breadcrumb a:hover { text-decoration: underline; }
.breadcrumb span { margin: 0 5px; }

/* Main Content */
main { padding: 2rem 0; }
.game-wrapper {
    background: var(--card-bg);
    padding: 2rem;
    border-radius: 12px;
    box-shadow: var(--shadow);
    border: 1px solid var(--border);
    max-width: 800px;
    margin: auto;
    text-align: center;
}

.game-stats {
    display: flex;
    justify-content: space-around;
    margin-bottom: 1.5rem;
    font-size: 1.2rem;
    font-weight: 600;
    color: var(--primary);
}
.stat-item { display: flex; align-items: center; gap: 0.5rem; }

.game-board {
    display: grid;
    grid-template-columns: repeat(var(--grid-cols, 4), 1fr);
    gap: 1rem;
    perspective: 1000px;
}

.card {
    aspect-ratio: 1;
    position: relative;
    transform-style: preserve-3d;
    transition: transform 0.6s;
    cursor: pointer;
}

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

.card-face {
    position: absolute;
    width: 100%;
    height: 100%;
    backface-visibility: hidden;
    border-radius: 8px;
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 2.5rem;
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
}

.card-front {
    background: var(--primary);
    color: white;
}

.card-back {
    background: var(--light);
    color: var(--primary);
    transform: rotateY(180deg);
}
.dark-mode .card-back {
    background: var(--dark-border);
}

.card.matched .card-back {
    background: var(--success);
    color: white;
}

.game-controls {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1.5rem;
    margin-top: 2rem;
}

.difficulty-controls {
     display: flex;
     gap: 1rem;
 }

.btn {
    padding: 0.75rem 1.5rem;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: 1rem;
    font-weight: 600;
    transition: all 0.2s ease-in-out;
    text-transform: uppercase;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
}
.btn.primary { background-color: var(--primary); color: white; }
.btn.primary:hover:not(:disabled) { background-color: var(--primary-dark); }
.btn.difficulty-btn {
     background-color: var(--secondary);
 }
 .btn.difficulty-btn.active {
     background-color: var(--success);
     transform: translateY(-2px);
     box-shadow: 0 4px 10px rgba(0, 0, 0, 0.2);
 }

/* Content Section Styles */
 .content-section {
     background: var(--card-bg);
     padding: 2rem;
     border-radius: 12px;
     box-shadow: var(--shadow);
     border: 1px solid var(--border);
     max-width: 900px;
     margin: 2rem auto;
 }
 .content-section h2 {
     color: var(--primary);
     margin-bottom: 1.5rem;
 }
 .content-grid {
     display: grid;
     grid-template-columns: 1fr 1fr;
     gap: 2rem;
     align-items: center;
 }
 .content-image {
     width: 100%;
     border-radius: 8px;
     box-shadow: var(--shadow);
 }

/* Modal Styles */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.6);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
}
.modal-content {
    background: var(--card-bg);
    padding: 2rem;
    border-radius: 8px;
    text-align: center;
    box-shadow: 0 5px 15px rgba(0,0,0,0.3);
}
.modal-content h2 {
    color: var(--success);
    margin-bottom: 1rem;
}
.modal-content p {
    margin-bottom: 1.5rem;
}

/* Social Sharing */
 .social-sharing {
     padding: 15px 0;
     text-align: center;
 }
 .social-sharing span {
     font-weight: 500;
     margin-right: 12px;
     color: white;
     font-size: 14px;
 }
 .social-sharing a {
     color: white;
     font-size: 18px;
     margin: 0 8px;
     transition: color 0.3s ease;
 }
 .social-sharing a:hover {
     color: var(--light);
 }

/* Footer */
footer { background-color: var(--dark); color: white; padding: 1.5rem 0; text-align: center; font-size: 0.9rem; margin-top: 2rem; }
 .footer-content { display: flex; flex-direction: column; align-items: center; }
 .footer-links { display: flex; gap: 1.5rem; margin-bottom: 1rem; flex-wrap: wrap; justify-content: center; }
 .footer-links a { color: white; text-decoration: none; transition: opacity 0.2s; }
 .footer-links a:hover { opacity: 0.8; }
 .copyright { opacity: 0.7; }

@media (max-width: 768px) {
    h1 { font-size: 1.8rem; }
    .main-nav { flex-direction: column; gap: 1rem; }
    .content-grid { grid-template-columns: 1fr; }
    .nav-links { flex-wrap: wrap; justify-content: center; }
    .card-face { font-size: 2rem; }
}

@media (max-width: 480px) {
    .card-face { font-size: 1.5rem; }
    .difficulty-controls { flex-direction: column; }
}