: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, var(--primary), var(--dark)); 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: 1100px;
    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-layout {
     display: grid;
     grid-template-columns: 1fr auto;
    gap: 2rem;
    align-items: flex-start;
}

 .game-sidebar {
     display: flex;
     flex-direction: column;
     gap: 2rem;
 }

.word-search-grid {
    display: grid;
    grid-template-columns: repeat(var(--grid-size, 10), 1fr);
    gap: 4px;
    background-color: var(--border);
    padding: 4px;
    border-radius: 8px;
    user-select: none;
}

.grid-cell {
    width: 100%;
    aspect-ratio: 1;
    background-color: var(--card-bg);
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 1.2rem;
    font-weight: bold;
    text-transform: uppercase;
    cursor: pointer;
    transition: background-color 0.2s, font-size 0.2s;
}

.dark-mode .grid-cell {
    background-color: var(--dark-card);
}

.grid-cell.selected {
    background-color: var(--warning);
    color: white;
}

.grid-cell.found {
    background-color: var(--success);
    color: white;
}

.word-search-grid.difficulty-medium .grid-cell {
     font-size: 1rem;
 }

 .word-search-grid.difficulty-hard .grid-cell {
     font-size: 0.9rem;
 }

.word-list {
    text-align: left;
}

.word-list h3 {
    color: var(--primary);
    margin-bottom: 1rem;
}

.word-list ul {
    list-style: none;
    padding: 0;
}

.word-list li {
    margin-bottom: 0.5rem;
    font-size: 1.1rem;
    transition: all 0.3s;
}

.word-list li.found {
    text-decoration: line-through;
    color: var(--text-light);
    opacity: 0.7;
}

.game-controls {
     display: flex;
     flex-direction: column;
     align-items: stretch;
     gap: 1.5rem;
}

.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);
}
.content-section a {
     color: var(--primary);
 }
 .dark-mode .content-section a {
     color: var(--info);
     text-decoration: underline;
 }
.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; } .nav-links { flex-wrap: wrap; justify-content: center; }
    .content-grid { grid-template-columns: 1fr; }
}

@media (max-width: 820px) {
     .game-layout {
         grid-template-columns: 1fr;
         justify-items: center;
     }
     .word-search-grid {
         max-width: 500px;
         order: 1;
     }
     .game-sidebar {
         order: 2;
         width: 100%;
         max-width: 500px;
     }
 }

 @media (max-width: 480px) {
     .difficulty-controls { flex-direction: column; }
     .word-search-grid.difficulty-easy .grid-cell { font-size: 1rem; }
     .word-search-grid.difficulty-medium .grid-cell { font-size: 0.8rem; }
     .word-search-grid.difficulty-hard .grid-cell { font-size: 0.7rem; }
 }
        /* Updated mobile responsiveness for header */
        @media (max-width: 768px) {
            .main-nav {
                flex-direction: column;
                gap: 1rem;
                align-items: stretch;
            }

            .nav-links {
                gap: 1rem;
            }
            .nav-link i {
                 font-size: 1.1rem;
            }
            .nav-link span {
                display: none; /* Hide text on mobile, show only icons */
            }

            .nav-actions {
                justify-content: center;
                margin-top: 0.5rem;
            }

            .header-content {
                padding-top: 0.5rem;
            }

            h1 {
                font-size: 1.8rem;
            }

            .tagline {
                font-size: 1rem;
            }

            /* Adjust the main content for mobile */
            .main-content {
                padding: 1.5rem;
            }

            .text-inputs {
                grid-template-columns: 1fr;
            }

            textarea {
                height: 200px;
            }

            .action-buttons {
                flex-direction: column;
            }

            .btn {
                width: 100%;
            }
        }

        @media (max-width: 480px) {
            h1 {
                font-size: 1.5rem;
            }

            .header-content {
                padding: 0 1rem;
            }

            .main-content {
                padding: 1rem;
            }

            .diff-container {
                max-height: 300px;
            }

            .nav-brand .logo-link span {
                font-size: 1.1rem; /* Slightly smaller logo text */
            }

            .toggle-container {
                font-size: 0.9rem; /* Smaller toggle text */
            }
        }