/* Mobile-friendly tweaks: tap targets, spacing, and overflow control */
a, button {
    min-height: 44px;
    padding: 10px 14px;
}
.nav-link, .nav-dropdown-item {
    min-height: 44px;
    padding: 10px 14px;
}

img, canvas, svg {
    max-width: 100%;
    height: auto;
}

/* Prevent horizontal scroll on small screens */
html, body { overflow-x: hidden; }

/* Compact spacing on narrow screens */
@media (max-width: 480px) {
    .main-header .header-content { padding: 8px 12px; }
    .main-nav { gap: 6px; }
    .nav-link { font-size: 14px; }
    .nav-dropdown-menu { padding: 6px; }

    .container, .home-content { padding: 12px; }
    .cards-section .section-title { font-size: 18px; margin: 6px 0 10px; }
    .card-grid { grid-template-columns: 1fr; gap: 10px; }
    .card { padding: 12px; border-radius: 12px; }
    .card h4 { font-size: 16px; }
    .card p { font-size: 13px; }
    .cta-banner { padding: 12px; border-radius: 14px; }
    .cta-btn { width: 100%; text-align: center; }

    /* Common game containers */
    .game-container, .grid, .board, .maze, .puzzle-panel, .instructions-panel {
        padding: 8px;
        margin: 0;
    }
    .controls, .actions, .btn-group { gap: 8px; }
    .btn, .button { font-size: 14px; padding: 10px 12px; }
}
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: Arial, sans-serif;
    background-color: #f9f9f9;
}

/* Global promo banner above header */
.site-banner {
    width: 100%;
    background: linear-gradient(120deg, #ff9a9e 0%, #fecfef 40%, #a1c4fd 100%);
    color: #1f2933;
    box-shadow: 0 2px 10px rgba(15, 23, 42, 0.25);
    padding: 10px 0;
    position: relative;
    z-index: 40;
}

.site-banner-inner {
    max-width: 1600px;
    margin: 0 auto;
    padding: 0 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-wrap: wrap;
    gap: 8px;
    text-align: center;
    overflow: hidden; /* hide marquee overflow */
}

.site-banner-text {
    display: inline-flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: center;
    gap: 8px;
    font-family: "Segoe UI", system-ui, -apple-system, BlinkMacSystemFont, "Helvetica Neue", sans-serif;
    font-size: 15px;
    font-weight: 600;
    letter-spacing: 0.3px;
    white-space: nowrap;
    animation: site-banner-marquee 20s linear infinite;
}

.site-banner-pill {
    background: rgba(255, 255, 255, 0.9);
    color: #1f2933;
    padding: 4px 10px;
    border-radius: 999px;
    font-size: 14px;
    font-weight: 600;
    box-shadow: 0 1px 4px rgba(15, 23, 42, 0.18);
}

.site-banner-highlight {
    font-weight: 700;
}

.site-banner-dot {
    opacity: 0.8;
}

@keyframes site-banner-marquee {
    0% {
        transform: translateX(100%);
    }
    100% {
        transform: translateX(-100%);
    }
}

@media (max-width: 640px) {
    .site-banner-text {
        font-size: 14px;
        gap: 6px;
    }

    .site-banner-pill {
        font-size: 13px;
        padding: 3px 8px;
    }
}

.main-header {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.2);
    padding: 15px 0;
    margin-bottom: 20px;
}

.header-content {
    max-width: 1600px;
    margin: 0 auto;
    padding: 0 20px;
    display: flex;
    justify-content: flex-start;
    align-items: center;
    gap: 40px;
    position: relative; /* anchor mobile menu toggle inside header, below banner */
}

.site-title {
    color: #ffffff;
    font-size: 32px;
    font-weight: bold;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    letter-spacing: 1px;
    margin: 0;
}

.main-nav {
    display: flex;
    gap: 20px;
    align-items: center;
}

.nav-link {
    color: #ffffff;
    text-decoration: none;
    font-size: 16px;
    font-weight: 600;
    padding: 10px 20px;
    border-radius: 5px;
    transition: background-color 0.3s, transform 0.2s;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: transparent;
    border: none;
    cursor: pointer;
}

.nav-link:hover {
    background-color: rgba(255, 255, 255, 0.2);
    transform: translateY(-2px);
}

.nav-link.active {
    background-color: rgba(255, 255, 255, 0.3);
    font-weight: bold;
}

.nav-dropdown {
    position: relative;
}

.nav-dropdown-toggle {
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.nav-dropdown-menu {
    display: none;
    position: absolute;
    top: calc(100% - 4px); /* overlap slightly to avoid hover gap */
    left: 0;
    margin-top: 0;
    min-width: 180px;
    background: #ffffff;
    border-radius: 6px;
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.15);
    padding: 6px 0;
    z-index: 100;
}

.nav-dropdown:hover > .nav-dropdown-menu {
    display: block;
}

.nav-dropdown-item {
    position: relative;
    display: block;
    padding: 10px 14px;
    color: #333;
    font-weight: 600;
    font-size: 15px;
    cursor: pointer;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}

.nav-dropdown-item:hover {
    background: #f0f4ff;
    color: #0056b3;
}

.nav-dropdown-item.has-submenu {
    padding-right: 30px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.nav-submenu {
    display: none;
    position: absolute;
    top: -6px;
    left: 100%;
    margin-left: 5px;
    min-width: 180px;
    background: #ffffff;
    border-radius: 6px;
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.15);
    padding: 6px 0;
    z-index: 101;
}

.nav-dropdown-item.has-submenu:hover > .nav-submenu {
    display: block;
}

.nav-submenu-item {
    display: block;
    padding: 10px 14px;
    color: #333;
    text-decoration: none;
    font-weight: 600;
    font-size: 14px;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}

.nav-submenu-item:hover {
    background: #f0f4ff;
    color: #0056b3;
}

/* Game Container */
.game-container {
    max-width: 1600px;
    margin: 0 auto;
    padding: 0 20px;
}

/* Game Info Panel Styles */
.game-info {
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    padding: 20px 40px;
    border-radius: 15px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
    margin: 20px;
    margin-top: 0;
    margin-bottom: 20px;
    gap: 30px;
    max-width: 100%;
}

.control-group {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-shrink: 0;
}

.control-group label {
    color: white;
    font-weight: bold;
    font-size: 16px;
    white-space: nowrap;
}

.control-group select {
    padding: 8px 15px;
    border: 2px solid white;
    border-radius: 8px;
    font-size: 14px;
    font-weight: bold;
    background: white;
    color: #667eea;
    cursor: pointer;
    transition: all 0.3s;
    min-width: 150px;
}

.control-group select:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 10px rgba(255, 255, 255, 0.3);
}

.reset-btn {
    padding: 10px 25px;
    font-size: 16px;
    font-weight: bold;
    background: white;
    color: #667eea;
    border: none;
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.3s;
    flex-shrink: 0;
}

.reset-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(255, 255, 255, 0.4);
}

.start-game-btn {
    padding: 10px 25px;
    font-size: 16px;
    font-weight: bold;
    background: white;
    color: #667eea;
    border: none;
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.3s;
}

.start-game-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(255, 255, 255, 0.4);
}

.stats {
    display: flex;
    gap: 50px;
    flex-shrink: 0;
}

.stat-item {
    display: flex;
    align-items: center;
    gap: 12px;
    white-space: nowrap;
}

.stat-label {
    color: white;
    font-weight: bold;
    font-size: 16px;
    white-space: nowrap;
}

.stat-value {
    background: rgba(255, 255, 255, 0.2);
    color: white;
    padding: 5px 15px;
    border-radius: 8px;
    font-weight: bold;
    font-size: 18px;
    min-width: 60px;
    text-align: center;
}

.container {
    display: flex;
    gap: 20px;
    max-width: 100%;
    margin: 0 auto;
    padding: 20px;
    width: 100%;
    align-items: flex-start;
}

.instructions-panel {
    width: 350px;
    padding: 20px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-radius: 8px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
    height: fit-content;
    flex-shrink: 0;
}

.instructions-panel h2 {
    color: #ffffff;
    margin-bottom: 15px;
    font-size: 24px;
    font-weight: bold;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    letter-spacing: 0.5px;
}

.instructions-panel ul {
    list-style-position: inside;
    color: #f0f0f0;
    line-height: 2;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    font-size: 15px;
}

.instructions-panel li {
    margin-bottom: 12px;
    padding-left: 10px;
    border-left: 3px solid #ffffff;
    padding-bottom: 8px;
}

.instructions-intro {
    margin-bottom: 15px;
    padding: 15px;
    background-color: rgba(255, 255, 255, 0.1);
    border-radius: 8px;
}

.instructions-intro p {
    margin: 8px 0;
    line-height: 2;
    color: #f0f0f0;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    font-size: 15px;
}

.instructions-intro strong {
    color: #ffffff;
}

.hints-section {
    margin-bottom: 15px;
    padding: 15px;
    background-color: rgba(255, 255, 255, 0.1);
    border-radius: 8px;
}

.hints-title {
    color: #f0f0f0;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    font-size: 15px;
    margin-bottom: 10px;
    line-height: 2;
}

.hints-title strong {
    color: #ffffff;
}

.hints-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.hint-item {
    margin-bottom: 8px;
    padding: 0;
    color: #f0f0f0;
    font-size: 15px;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    line-height: 2;
    border-left: none;
    background-color: transparent;
    border-radius: 0;
}

.puzzle-number {
    font-weight: bold;
    color: #ffffff;
    font-size: 15px;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    display: inline;
}

.hint-text {
    color: #f0f0f0;
    font-size: 15px;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    display: inline;
}

.instructions-tips {
    margin-top: 20px;
    padding: 15px;
    background-color: rgba(255, 255, 255, 0.1);
    border-radius: 8px;
}

.instructions-tips p {
    color: #f0f0f0;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    font-size: 15px;
    margin-bottom: 10px;
}

.instructions-tips strong {
    color: #ffffff;
}

.instructions-tips ul {
    list-style-position: inside;
    padding-left: 10px;
}

.instructions-tips li {
    margin: 8px 0;
    color: #f0f0f0;
    font-size: 14px;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    line-height: 2;
}

.puzzle-panel {
    padding: 20px;
    background-color: white;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    display: flex;
    flex-direction: column;
    flex: 1;
    min-width: 400px;
}

.puzzle-panel h2 {
    color: #333;
    margin-bottom: 20px;
    font-size: 24px;
    font-weight: bold;
}

.puzzles-table {
    width: 100%;
    border-collapse: collapse;
    background-color: white;
    table-layout: auto;
}

.puzzles-table thead {
    background-color: #007bff;
    color: white;
    position: sticky;
    top: 0;
}

.puzzles-table th {
    padding: 12px;
    text-align: center;
    font-weight: bold;
}

.puzzles-table td {
    padding: 12px;
    border-bottom: 1px solid #ddd;
    text-align: center;
}

.puzzles-table tbody tr:hover {
    background-color: #f9f9f9;
}

.puzzles-table tbody tr.correct {
    background-color: #d4edda;
}

.puzzle-grid {
    display: flex;
    gap: 8px;
    justify-content: center;
    align-items: center;
    flex-wrap: nowrap;
}

.letter-input {
    width: 40px;
    height: 40px;
    min-width: 40px;
    padding: 5px;
    text-align: center;
    font-size: 18px;
    font-weight: bold;
    border: 2px solid #007bff;
    border-radius: 4px;
    text-transform: uppercase;
    flex-shrink: 0;
}

.letter-input:focus {
    outline: none;
    border-color: #0056b3;
    box-shadow: 0 0 5px rgba(0, 86, 179, 0.5);
}

.submit-all-button {
    width: 100%;
    padding: 12px;
    margin-top: 20px;
    background-color: #28a745;
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 16px;
    font-weight: bold;
}

.submit-all-button:hover {
    background-color: #218838;
}

.celebration-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.7);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
    animation: fadeIn 0.5s ease-in;
}

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

.celebration-content {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    padding: 40px;
    border-radius: 20px;
    text-align: center;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
    animation: slideUp 0.5s ease-out;
}

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

.celebration-content h1 {
    color: #ffffff;
    font-size: 48px;
    margin: 20px 0;
}

.celebration-content p {
    color: #f0f0f0;
    font-size: 18px;
    margin: 10px 0 20px 0;
}

.flowers {
    font-size: 40px;
    margin: 10px 0;
    animation: bounce 1s infinite;
}

@keyframes bounce {
    0%, 100% {
        transform: translateY(0);
    }
    50% {
        transform: translateY(-20px);
    }
}

.next-set-btn {
    padding: 12px 30px;
    background-color: #28a745;
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 18px;
    font-weight: bold;
    cursor: pointer;
    margin-top: 20px;
    transition: background-color 0.3s;
}

.next-set-btn:hover {
    background-color: #218838;
}

/* Unified celebration buttons across all games */
.celebration-buttons {
    display: flex;
    gap: 16px;
    justify-content: center;
    margin-top: 22px;
    flex-wrap: wrap;
}

.play-again-btn {
    padding: 14px 36px;
    font-size: 18px;
    font-weight: 800;
    letter-spacing: 0.3px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: #fff;
    border: none;
    border-radius: 12px;
    cursor: pointer;
    transition: transform 0.18s ease, box-shadow 0.25s ease, filter 0.2s ease;
    box-shadow: 0 8px 24px rgba(102, 126, 234, 0.35);
}

.play-again-btn:hover {
    transform: translateY(-2px) scale(1.02);
    box-shadow: 0 12px 28px rgba(102, 126, 234, 0.45);
    filter: saturate(110%);
}

.play-again-btn:active {
    transform: translateY(0px) scale(0.99);
}

.play-again-btn.accent {
    background: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
    box-shadow: 0 8px 24px rgba(245, 87, 108, 0.35);
}
.play-again-btn.accent:hover {
    box-shadow: 0 12px 30px rgba(245, 87, 108, 0.5);
}

.ads-panel {
    width: 280px;
    padding: 20px;
    background-color: white;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    height: fit-content;
    overflow-y: auto;
    max-height: 800px;
    flex-shrink: 0;
}

.ads-panel h2 {
    color: #333;
    margin-bottom: 15px;
    font-size: 20px;
    font-weight: bold;
    text-align: center;
}

.ad-placeholder {
    width: 100%;
    height: 300px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    display: flex;
    justify-content: center;
    align-items: center;
    color: white;
    font-size: 18px;
    font-weight: bold;
    border-radius: 8px;
}

.ad-box {
    margin-bottom: 15px;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
}

.final-content {
    min-width: 500px;
}

.final-buttons {
    display: flex;
    gap: 15px;
    justify-content: center;
    margin-top: 20px;
}

.next-level-btn {
    background-color: #ff6b6b;
}

.next-level-btn:hover {
    background-color: #e63946;
}

.correct-answers-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.8);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
    animation: fadeIn 0.5s ease-in;
}

.correct-answers-content {
    background: white;
    padding: 40px;
    border-radius: 20px;
    text-align: center;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
    max-width: 500px;
    animation: slideUp 0.5s ease-out;
}

.correct-answers-content h2 {
    color: #dc3545;
    font-size: 32px;
    margin-bottom: 20px;
}

.correct-answers-content p {
    color: #666;
    font-size: 16px;
    margin-bottom: 20px;
}

.answers-list {
    list-style: none;
    padding: 0;
    margin: 20px 0;
    text-align: left;
}

.answers-list li {
    padding: 10px;
    margin: 5px 0;
    background-color: #f8f9fa;
    border-radius: 5px;
    font-size: 18px;
}

.answer-buttons {
    display: flex;
    gap: 10px;
    justify-content: center;
    margin-top: 20px;
}

.answer-btn {
    padding: 10px 20px;
    border: none;
    border-radius: 5px;
    font-size: 16px;
    font-weight: bold;
    cursor: pointer;
    transition: background-color 0.3s;
}

.try-btn {
    background-color: #ffc107;
    color: #000;
}

.try-btn:hover {
    background-color: #ffb300;
}

.show-btn {
    background-color: #17a2b8;
    color: white;
}

.show-btn:hover {
    background-color: #138496;
}

.next-btn {
    background-color: #28a745;
    color: white;
}

.next-btn:hover {
    background-color: #218838;
}