/* GamesNeon.com - Fully Fluid Responsive Design */

:root {
    /* Brand */
    --primary: #33f;
    --secondary: #f6f;
    --gradient: linear-gradient(135deg, var(--primary), var(--secondary));

    /* Dark theme defaults */
    --bg:           #0f0f1e;
    --bg-surface:   #1a1a2e;
    --text:         #ffffff;
    --text-muted:   #888888;
    --text-subtle:  #f5f5f5;
    --form-bg:      rgba(255, 255, 255, 0.1);
    --form-border:  rgba(255, 0, 110, 0.3);
    --btn-bg:       rgba(255, 255, 255, 0.15);
    --btn-border:   rgba(255, 255, 255, 0.3);
    --accent-subtle: rgba(0, 245, 255, 0.05);
    --surface-3:    #333333;
    --surface-4:    #444444;
    --shadow:       rgba(0, 0, 0, 0.5);
    --card-border:  rgba(255, 0, 110, 0.3);

    /* Layout */
    --border-radius: 8px;
    --transition:    all 0.3s ease;
    --base-font:     clamp(18px, 2vw, 22px);
    --spacing:       clamp(0.5rem, 2vw, 2rem);
}

/* Light theme */
html[data-theme="light"] {
    --bg:           #f0f0f6;
    --bg-surface:   #ffffff;
    --text:         #1a1a2e;
    --text-muted:   #666666;
    --text-subtle:  #333333;
    --secondary:    #0033cc;
    --form-bg:      rgba(0, 0, 0, 0.06);
    --form-border:  rgba(255, 0, 110, 0.4);
    --btn-bg:       rgba(0, 0, 0, 0.08);
    --btn-border:   rgba(0, 0, 0, 0.2);
    --accent-subtle: rgba(0, 50, 200, 0.05);
    --surface-3:    #e0e0eb;
    --surface-4:    #d0d0e0;
    --shadow:       rgba(0, 0, 0, 0.12);
    --card-border:  rgba(255, 0, 110, 0.25);
}

/* System preference fallback (no saved theme) */
@media (prefers-color-scheme: light) {
    html:not([data-theme="dark"]) {
        --bg:           #f0f0f6;
        --bg-surface:   #ffffff;
        --text:         #1a1a2e;
        --text-muted:   #666666;
        --text-subtle:  #333333;
        --secondary:    #0033cc;
        --form-bg:      rgba(0, 0, 0, 0.06);
        --form-border:  rgba(255, 0, 110, 0.4);
        --btn-bg:       rgba(0, 0, 0, 0.08);
        --btn-border:   rgba(0, 0, 0, 0.2);
        --accent-subtle: rgba(0, 50, 200, 0.05);
        --surface-3:    #e0e0eb;
        --surface-4:    #d0d0e0;
        --shadow:       rgba(0, 0, 0, 0.12);
        --card-border:  rgba(255, 0, 110, 0.25);
    }
}

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

html, body {
    width: 100%;
    height: 100%;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background-color: var(--bg);
    color: var(--text);
    line-height: 1.6;
    font-size: var(--base-font);
}

h1,h2,h3,h4 { font-size: 1em; }
a { text-decoration: none; color: var(--secondary); }

/* ===== NAVBAR ===== */
.navbar {
    background: linear-gradient(135deg, var(--bg) 0%, var(--bg-surface) 100%);
    border-bottom: 2px solid var(--primary);
    padding: clamp(0.25rem, 1vw, 0.5rem);    
    box-shadow: 0 4px 20px rgba(255, 0, 110, 0.2);
}

.navbar-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 clamp(0.5rem, 3vw, 1rem);
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: clamp(0.5rem, 2vw, 1rem);
}

.navbar-brand {
    display: flex;
    align-items: center;
    gap: clamp(0.5rem, 2vw, 1rem);
}

.logo {
    display: flex;
    align-items: center;
    gap: 0.3em;
    font-weight: bold;
    font-size: 1.2em;
    color: var(--secondary);
    transition: var(--transition);
}

.logo:hover {
    color: var(--primary);
    transform: scale(1.05);
}

.logo-icon { font-size: 2em; }
.logo-text {
    background: var(--gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.navbar-menu {
    display: flex;
    gap: clamp(0.75rem, 3vw, 2rem);
    align-items: center;
    flex-wrap: wrap;
}

.theme-toggle {
    background: #000;
    color: #fff;
    width: clamp(36px, 8vw, 40px);
    height: clamp(36px, 8vw, 40px);
    border-radius: 50%;
    cursor: pointer;
    margin-left: 15px;
    
}


/* ===== SEARCH INPUT ===== */
input[type="text"] {
    background: var(--form-bg);
    border: 1px solid var(--form-border);
    color: var(--text);
    padding: clamp(0.3rem, 1vw, 0.4rem) clamp(0.5rem, 2vw, 0.7rem);
    border-radius: var(--border-radius);
    transition: var(--transition);
    min-width: 100px;
}

input[type="text"]:focus {
    border-color: var(--primary);
    box-shadow: 0 0 10px rgba(255, 0, 110, 0.3);
    outline: none;
}

/* ===== MAIN CONTENT ===== */
.main-content {
    min-height: calc(100vh - 60px - 200px);
    max-width: 1500px;
    margin: 0 auto;
    padding: clamp(0.25rem, 2vw, 1rem);
}

/* ===== GAMES GRID ===== */
.games-container {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(clamp(200px, 25vw, 255px), 1fr));
    gap: 10px;
    margin: 10px;
}

.game-card {
    background: var(--bg-surface);
    border: 1px solid var(--card-border);
    border-radius: var(--border-radius);
    padding: 6px;
    transition: var(--transition);
    cursor: pointer;
    box-shadow: 0 4px 15px var(--shadow);
    line-height:0.9em;
    font-size:80%;
    max-width:255px;
}
.game-card img{max-width:99%;max-height:99%;}
.game-card:hover {
    transform: translateY(-8px);
    border-color: var(--primary);
    box-shadow: 0 8px 25px rgba(255, 0, 110, 0.3);
}

.game-icon {
    float: right;
    font-size:3em;
}

.game-title {
    font-weight: bold;
    margin: 0.3em 0;
    color: var(--text);
    line-height: 1.3;
}

.game-description {
    color: var(--text-subtle);
    margin-bottom: 0.5em;
    display:inline-block;
}

.game-meta, .game-category, .game-difficulty { display: none; }

.play-btn {
    display: inline-block;
    background: var(--gradient);
    color: #ffffff;
    padding: clamp(0.3rem, 1vw, 0.4rem) clamp(0.6rem, 2vw, 0.9rem);
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-weight: bold;
    transition: var(--transition);
    text-align: center;
}

.play-btn:hover {
    transform: scale(1.05);
    box-shadow: 0 4px 15px rgba(255, 0, 110, 0.4);
}

.game-stats {
    color: var(--text-muted);
    display: flex;
    gap: clamp(0.5rem, 2vw, 1rem);
    margin: 0.5em 0;
    justify-content: center;
}

.stat-item {
    display: flex;
    flex-direction: column;
    align-items: center;
}

.stat-value {
    color: var(--secondary);
    font-weight: bold;
}

/* ===== RECENTLY PLAYED ===== */
.recently-played-container {
    max-width: 1200px;
    margin: 0 auto clamp(1rem, 3vw, 2rem);
    padding: 0 clamp(0.5rem, 3vw, 1rem);
}

.recently-played-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: clamp(1rem, 2vw, 1.5rem);
    flex-wrap: wrap;
    gap: 1em;
}

.clear-history-btn {
    background: rgba(255, 0, 110, 0.15);
    border: 1px solid var(--primary);
    color: var(--secondary);
    padding: clamp(0.4rem, 1vw, 0.5rem) clamp(0.7rem, 2vw, 1rem);
    border-radius: var(--border-radius);
    cursor: pointer;
    transition: var(--transition);
}

.clear-history-btn:hover {
    background: rgba(255, 0, 110, 0.3);
    box-shadow: 0 2px 10px rgba(255, 0, 110, 0.2);
}

.recently-played-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(clamp(90px, 15vw, 120px), 1fr));
    gap: 1px;
    margin-bottom: 1px;
    padding-bottom: 1px;
    border-bottom: 1px solid var(--card-border);
}

.recently-played-card {
    border: 1px solid var(--card-border);
    border-radius: var(--border-radius);
    text-align: center;
    transition: var(--transition);
    padding: 2px;
}

.recently-played-card:hover {
    transform: translateY(-4px);
    border-color: var(--secondary);
    box-shadow: 0 4px 15px rgba(0, 245, 255, 0.2);
}

.recent-game-link {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5em;
    color: var(--text);
}

.recent-game-title {
    font-weight: 500;
    color: var(--text);
    word-wrap: break-word;
}

/* ===== CONTROLS ===== */
.controls {
    display: flex;
    gap: clamp(0.5rem, 2vw, 1rem);
    margin-bottom: clamp(1rem, 2vw, 2rem);
    flex-wrap: wrap;
}

.control-group {
    display: flex;
    gap: clamp(0.3rem, 1vw, 0.5rem);
    align-items: center;
    flex-wrap: wrap;
}

.control-label {
    font-weight: 600;
    color: var(--secondary);
    white-space: nowrap;
}

select {
    background: var(--form-bg);
    border: 1px solid var(--form-border);
    color: var(--text);
    padding: clamp(0.3rem, 1vw, 0.4rem) clamp(0.5rem, 1.5vw, 0.7rem);
    border-radius: var(--border-radius);
    transition: var(--transition);
    cursor: pointer;
    max-width: 90vw;
}

select:focus {
    border-color: var(--primary);
    box-shadow: 0 0 10px rgba(255, 0, 110, 0.3);
    outline: none;
}

select option {
    background: var(--bg);
    color: var(--text);
}

/* ===== GAME PAGE ===== */
.game-page-container { max-width: 1000px; margin: 0 auto; }
.game-header { padding: clamp(0.5rem, 2vw, 1rem); }

.header-top {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: clamp(1rem, 3vw, 1.5rem);
    margin-bottom: clamp(0.5rem, 2vw, 1rem);
    flex-wrap: wrap;
}

.game-header h1 {
    color: var(--text);
    flex: 1;
    min-width: 200px;
}

.share-buttons {
    display: flex;
    gap: clamp(0.3rem, 1vw, 0.5rem);
    justify-content: center;
}

.share-btn {
    background: var(--btn-bg);
    border: 1px solid var(--btn-border);
    color: var(--text);
    width: clamp(36px, 8vw, 40px);
    height: clamp(36px, 8vw, 40px);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: var(--transition);
    font-weight: bold;
}

.share-btn:hover {
    background: rgba(255, 0, 110, 0.15);
    transform: scale(1.1);
    border-color: var(--primary);
}

.game-info-box {
    background: rgba(255, 0, 110, 0.08);
    border: 1px solid var(--primary);
    padding: clamp(1rem, 3vw, 1.5rem);
    border-radius: var(--border-radius);
    margin-bottom: clamp(1rem, 3vw, 2rem);
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(clamp(120px, 25vw, 150px), 1fr));
    gap: clamp(0.75rem, 2vw, 1rem);
}

.info-label {
    color: var(--text-muted);
    margin-bottom: 0.5em;
}

.info-value {
    color: var(--secondary);
    font-weight: bold;
}

.difficulty-selector { margin-bottom: clamp(1rem, 3vw, 2rem); }
.difficulty-selector h3 {
   
    margin-bottom: 0.5em;
}

.difficulty-options {
    display: flex;
    gap: clamp(0.5rem, 1.5vw, 1rem);
    flex-wrap: wrap;
}

.difficulty-btn {
    background: #9cf;
    border: 1px solid #05f;
    color: #000;
    padding: 2px 5px;
    border-radius: var(--border-radius);
    cursor: pointer;
    transition: var(--transition);
    font-weight: bold;
}
/* ===== CANVAS ===== */
.canvas-container {
    background: var(--bg);
    border: 2px solid var(--primary);
    border-radius: var(--border-radius);
    padding: 2px;
    margin-bottom: 5px;
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: clamp(200px, 50vh, 600px);
    width: 100%;
    max-width: 100vw;
    max-height: 100vh;
    position: relative;
    box-sizing: border-box;
}

canvas {
    max-width: 100%;
    height: auto;
    border-radius: var(--border-radius);
    background: var(--bg);
}

.difficulty-selector {
   
    align-items: center; 
  
    margin-bottom: 1rem;
}

.difficulty-label {
    color: #aaa;
    margin-right: 0.25rem;
}



.difficulty-btn:hover {
    border-color: rgba(255,255,255,0.5);
    color: #fff;
}

.difficulty-btn.active {
    background: var(--gradient);
    border-color: transparent;
    color: #fff;
    font-weight: bold;
}

.play-buttons {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    padding:20px 0;
}

.fullscreen-play-btn {
    background: var(--gradient);
    border: none;
    color: #ffffff;
    padding: 5px 14px;
    border-radius: var(--border-radius);
    font-weight: bold;
    cursor: pointer;
}


.fullscreen-play-btn:hover {
    transform: scale(1.02);
    box-shadow: 0 0 30px rgba(255, 0, 110, 0.6);
}

.exit-fullscreen-btn {
    position: absolute;
    top: clamp(1rem, 3vw, 2rem);
    right: clamp(1rem, 3vw, 2rem);
    background: rgba(255, 0, 110, 0.9);
    border: none;
    color: #ffffff;
    padding: clamp(0.6rem, 1.5vw, 0.8rem) clamp(1rem, 2vw, 1.2rem);
    border-radius: var(--border-radius);
    font-weight: bold;
    cursor: pointer;
    transition: var(--transition);
    z-index: 10001;
}

.exit-fullscreen-btn:hover {
    background: var(--primary);
    box-shadow: 0 0 20px rgba(255, 0, 110, 0.8);
}

.canvas-container.fullscreen {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    max-width: none;
    margin: 0;
    padding: 0;
    border: none;
    border-radius: 0;
    z-index: 10000;
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #000;
}

.canvas-container.fullscreen canvas {
    display: block;
    max-width: 100vw;
    max-height: 100vh;
    border-radius: 0;
}

/* ===== DOT-TO-DOT GALLERY ===== */
.dot-gallery {
    margin: 1rem 0;
}
.dot-gallery-header {
    font-size: 0.85rem;
    font-weight: 700;
    color: var(--text-subtle);
    text-transform: uppercase;
    letter-spacing: 0.07em;
    margin-bottom: 0.6rem;
}
.dot-gallery-loading {
    color: var(--text-subtle);
    font-size: 0.85rem;
    padding: 0.5rem 0;
}
.dot-gallery-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}
.dot-thumb {
    width: 80px;
    cursor: pointer;
    text-align: center;
    background:#fff;
    border: 2px solid rgba(255,255,255,0.08);
    border-radius: 10px;
    padding: 6px 4px 4px;
    transition: border-color 0.15s, background 0.15s, transform 0.1s;
    flex-shrink: 0;
}
.dot-thumb:hover {
    border-color: var(--primary);
}
.dot-thumb.active {
    border-color: var(--primary);
   
}
.dot-thumb img {
    width: 56px;
    height: 56px;
    object-fit: contain;
    display: block;
    margin: 0 auto;
}
.dot-thumb span {
    display: block;
    font-size: 10px;
    color: #999;
    margin-top: 4px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.dot-gallery-pagination {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 10px 0 4px;
    flex-wrap: wrap;
}
.dot-page-btn {
    min-width: 32px;
    height: 32px;
    padding: 0 8px;
    background: rgba(255,255,255,0.05);
    border: 1px solid rgba(255,255,255,0.12);
    border-radius: 6px;
    color: #ccc;
    font-size: 0.82rem;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.15s, border-color 0.15s, color 0.15s;
}
.dot-page-btn:hover:not(:disabled) {
    background: rgba(0,245,255,0.12);
    border-color: var(--primary);
    color: #fff;
}
.dot-page-btn.active {
    background: var(--primary);
    border-color: var(--primary);
    color: #000;
    font-weight: 700;
    cursor: default;
}
.dot-page-btn:disabled {
    opacity: 0.35;
    cursor: not-allowed;
}
.dot-page-ellipsis {
    color: #666;
    font-size: 0.85rem;
    padding: 0 4px;
    line-height: 32px;
}
@media (max-width: 480px) {
    .dot-thumb { width: 68px; }
    .dot-thumb img { width: 48px; height: 48px; }
}

/* ===== INSTRUCTIONS ===== */
.game-instructions, .controls-info {
    background: var(--accent-subtle);
    padding: clamp(0.75rem, 2vw, 1rem);
    border-radius: var(--border-radius);
    margin-bottom: clamp(1rem, 2vw, 1.5rem);
    line-height: 1.8;
}

.controls-info h4 {   
    display: block;
    margin-bottom: 0.5em;
}

.game-instructions p, .game-instructions ul, .game-instructions ol {
    color: var(--text);
    margin-bottom: 0.75em;
}

.game-instructions ul, .game-instructions ol {
    margin-left: 1.5em;
}

.game-instructions li {
    margin-bottom: 0.5em;
}

.game-instructions a {
    color: var(--secondary);
    border-bottom: 1px solid var(--secondary);
}

.game-instructions a:hover {
    color: var(--primary);
    border-bottom-color: var(--primary);
}

/* ===== BREADCRUMBS ===== */
.breadcrumbs {
    display: flex;
    align-items: center;
    gap: 0.25em;
}

.breadcrumb-link {
    color: var(--secondary);
    transition: var(--transition);
    padding: 0.3em 0.6em;
    border-radius: 4px;
}

.breadcrumb-link:hover {
    background: var(--accent-subtle);
    color: var(--primary);
}

.breadcrumb-separator { color: var(--text-muted); margin: 0 0.25em; }
.breadcrumb-current {
    color: var(--primary);
    font-weight: bold;
}

/* ===== FOOTER ===== */
.footer {
    background: linear-gradient(135deg, var(--bg) 0%, var(--bg-surface) 100%);
    border-top: 2px solid var(--primary);
    padding: clamp(1.5rem, 4vw, 3rem) clamp(0.75rem, 3vw, 1rem) clamp(0.5rem, 2vw, 1rem);
    margin-top: clamp(1.5rem, 4vw, 3rem);
    color: var(--text);
}

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

.footer-content {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(clamp(180px, 30vw, 200px), 1fr));
    gap: clamp(1rem, 3vw, 2rem);
    margin-bottom: clamp(1rem, 2vw, 2rem);
}

.footer-section h3, .footer-section h4 {
    margin-bottom: 0.5em;
}

.footer-section p {
    color: var(--text-subtle);
    margin-bottom: 0.5em;
}

.footer-section ul { list-style: none; }
.footer-section ul li { margin-bottom: 0.5em; }

.footer-section a {
    transition: var(--transition);
}

.footer-section a:hover { color: var(--secondary); }

.footer-bottom {
    border-top: 1px solid rgba(255, 0, 110, 0.2);
    padding-top: clamp(0.5rem, 1.5vw, 1rem);
    text-align: center;
    color: var(--text-muted);
}

/* ===== PUZZLE STYLES ===== */
#puzzle-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.85);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

.puzzle-setup {
    background: linear-gradient(135deg, var(--bg) 0%, var(--bg-surface) 100%);
    border: 2px solid var(--primary);
    border-radius: var(--border-radius);
    padding: clamp(1rem, 3vw, 2rem);
    max-width: clamp(300px, 90vw, 600px);
    max-height: 90vh;
    overflow-y: auto;
    color: var(--text);
    box-shadow: 0 8px 32px rgba(255, 0, 110, 0.3);
}

.puzzle-setup h2 {
    margin-bottom: 1em;
    color: var(--secondary);
}

.puzzle-setup h3 {
    margin-top: 1.5em;
    margin-bottom: 0.75em;
    color: var(--primary);
}

.puzzle-image-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 5px;
    margin-bottom: 0.75em;
}

@media (max-width: 480px) {
    .puzzle-image-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

.puzzle-image-card {
    position: relative;
    cursor: pointer;
    border-radius: var(--border-radius);
    overflow: hidden;   
}

.puzzle-image-card img {
    width: 100%;
    height: 80%;
    object-fit: cover;
}

.puzzle-image-card:hover {
    border-color: var(--secondary);
    transform: scale(1.05);
    box-shadow: 0 4px 12px rgba(0, 245, 255, 0.3);
}

.puzzle-image-card.selected {
    border: solid 4px var(--primary);
    box-shadow: 0 4px 12px rgba(255, 0, 110, 0.5);
}

.puzzle-image-title {
    color: var(--text);
    text-align: center;
    padding: 0.5em;
    width: 100%;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    background: rgba(0, 0, 0, 0.4);
}

.puzzle-preset-btns {
    display: flex;
    gap: clamp(0.3rem, 1vw, 0.5rem);
    flex-wrap: wrap;
    margin-bottom: 1em;
}

.puzzle-preset-btn {
    padding: clamp(0.4rem, 1.2vw, 0.6rem) clamp(0.6rem, 1.8vw, 1rem);
    background: var(--surface-3);
    color: var(--text);
    border: 2px solid var(--text-muted);
    border-radius: var(--border-radius);
    cursor: pointer;
    transition: var(--transition);
}

.puzzle-preset-btn:hover {
    border-color: var(--secondary);
    color: var(--secondary);
}

.puzzle-preset-btn.active {
    background: var(--primary);
    border-color: var(--primary);
    color: #ffffff;
}

.custom-grid-input {
    display: flex;
    gap: clamp(0.3rem, 1vw, 0.5rem);
    align-items: center;
    margin-bottom: 1.5em;
    flex-wrap: wrap;
}

.custom-grid-input label {
    display: flex;
    align-items: center;
    gap: 0.25em;
}

.custom-grid-input input {
    width: clamp(40px, 10vw, 50px);
    padding: clamp(0.4rem, 1vw, 0.5rem);
    background: var(--surface-3);
    color: var(--text);
    border: 1px solid var(--text-muted);
    border-radius: 4px;
}

.custom-grid-input input:focus {
    outline: none;
    border-color: var(--secondary);
    background: var(--surface-4);
}

.puzzle-start-btn {
    width: 100%;
    padding: clamp(0.6rem, 1.5vw, 0.8rem);
    background: var(--gradient);
    color: #ffffff;
    border: none;
    border-radius: var(--border-radius);
    font-weight: bold;
    cursor: pointer;
    transition: var(--transition);
    box-shadow: 0 4px 12px rgba(255, 0, 110, 0.3);
}

.puzzle-start-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(255, 0, 110, 0.5);
}

.puzzle-random-btn {
   
    padding: 10px;
    background: var(--surface-3);
    color: var(--text);
    border: 2px dashed var(--secondary);
    border-radius: var(--border-radius);
    font-size: clamp(0.85rem, 2vw, 1rem);
    font-weight: bold;
    cursor: pointer;
    margin-bottom: 0.5rem;
}

.puzzle-random-btn:hover {
    background: var(--secondary);
    color:var(--text);
    border-style: solid;
}

.puzzle-random-label {
    text-align: center;
    font-size: 0.8rem;
    color: var(--secondary);
    min-height: 1.2em;
    margin-bottom: 0.5rem;
}

.puzzle-pagination {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 1rem;
    margin: 0.75rem 0;
}

.puzzle-page-btn {
    padding: 0.35rem 0.9rem;
    background: var(--surface-3);
    color: var(--text);
    border: 1px solid var(--primary);
    border-radius: var(--border-radius);
    cursor: pointer;
    font-size: 0.85rem;
    transition: var(--transition);
}

.puzzle-page-btn:hover:not(:disabled) {
    background: var(--primary);
    color: #fff;
}

.puzzle-page-btn:disabled {
    opacity: 0.35;
    cursor: default;
}

.puzzle-page-info {
    font-size: 0.85rem;
    color: var(--text-muted);
    min-width: 90px;
    text-align: center;
}

/* ===== GAME CONTROL BUTTONS ===== */
.game-btn-pause,
.game-btn-restart {
    background: rgba(0, 0, 0, 0.7);
    color: #ffffff;
    border: 2px solid var(--primary);
    border-radius: 8px;
    padding: 8px 16px;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 8px;
}

.game-btn-pause:hover,
.game-btn-restart:hover {
    background: var(--primary);
    color: #ffffff;
    transform: scale(1.05);
}

.game-btn-pause.resuming:hover {
    background: #00ff00;
    border-color: #00ff00;
}

.game-control-buttons {
    position: absolute;
    top: 10px;
    left: 10px;
    z-index: 10000;
    gap: 10px;
}

/* ===== UTILITY CLASSES ===== */
.w { white-space: nowrap; }
.right { float: right; margin: 0.3em 0 0.3em 0.3em; }

.icon {
width:32px;
height:32px;
margin:1px;
fill:currentColor;
vertical-align:middle;
}

/* ===== ONSCREEN CONTROLS ===== */
.onscreen-controls {
    display: none;
    position: absolute;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 1000;
    gap: 10px;
    background: rgba(0,0,0,0.3);
    border-radius: 12px;
    backdrop-filter: blur(4px);
    border: 1px solid rgba(255,255,255,0.1);
}

/* Snake game specific onscreen controls */
.snake-theme .control-btn {
    background: rgba(0, 245, 255, 0.15);
    border: 1px solid rgba(0, 245, 255, 0.3);
    box-shadow: 0 0 8px rgba(0, 245, 255, 0.2);
}

.snake-theme .control-btn:hover {
    background: rgba(0, 245, 255, 0.25);
    box-shadow: 0 0 12px rgba(0, 245, 255, 0.4);
    border-color: rgba(0, 245, 255, 0.5);
}

.snake-theme .control-btn:active {
    background: rgba(0, 245, 255, 0.35);
    box-shadow: 0 0 6px rgba(0, 245, 255, 0.6);
    border-color: rgba(0, 245, 255, 0.7);
}

.onscreen-controls .control-btn {
    width: 50px;
    height: 50px;
    border: none;
    background: rgba(255,255,255,0.1);
    border-radius: 10px;
    color: #fff;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s, transform 0.1s;
    -webkit-tap-highlight-color: transparent;
}

.onscreen-controls .control-btn:hover {
    background: rgba(255,255,255,0.2);
}

.onscreen-controls .control-btn:active {
    transform: scale(0.92);
    background: rgba(255,255,255,0.3);
}

.onscreen-controls .control-btn svg {
    width: 32px;
    height: 32px;
    fill: currentColor;
}

/* Show onscreen controls on touch devices and small screens 
@media (max-width: 768px), (hover: none) and (pointer: coarse) {
    .onscreen-controls {
        display: flex;
    }
}*/

/* Snake game: always show onscreen controls */
.snake-onscreen-controls {
    display: flex !important;
}

/* ===== FIND THE DIFFERENCES GAME ===== */
/* ── Find the Differences ───────────────────────────────────────────────── */

.find-differences-game-wrapper {
    display: flex;
    width: 100%;
    min-height: clamp(300px, 70vw, 500px);
}

.find-differences-game {
    display: flex;
    flex-direction: column;
    align-items: center;
    width: 100%;
    padding: clamp(0.75rem, 2vw, 1.5rem);
    gap: clamp(0.75rem, 1.5vw, 1.2rem);
}

/* Header bar */
.fd-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    max-width: 860px;
    font-size: clamp(1em, 2vw, 1.3em);
    font-weight: bold;
    color: var(--primary);
    gap: 1rem;
}

.fd-level, .fd-score {
    min-width: 80px;
    text-align: center;
}

/* Timer */
.fd-timer-wrap {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    flex: 1;
}

.fd-timer {
    font-size: clamp(1em, 2vw, 1.25em);
    font-weight: bold;
    color: var(--primary);
    transition: color 0.3s;
}

.fd-timer.fd-timer-low { color: #ff006e; }

.fd-timer-track {
    width: 100%;
    max-width: 200px;
    height: 6px;
    background: rgba(255,255,255,0.1);
    border-radius: 3px;
    overflow: hidden;
}

.fd-timer-bar {
    height: 100%;
    background: var(--primary);
    border-radius: 3px;
    transition: width 0.9s linear, background 0.3s;
}

.fd-timer-bar.fd-timer-bar-low { background: #ff006e; }

/* Grids wrapper */
.fd-grids-wrapper {
    display: flex;
    align-items: flex-start;
    justify-content: center;
    gap: clamp(0.5rem, 2vw, 1.5rem);
    width: 100%;
    max-width: 860px;
    flex-wrap: wrap;
}

.fd-grid-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.4rem;
}

.fd-grid-label {
    font-size: 0.85em;
    color: var(--text-muted);
    letter-spacing: 0.05em;
    text-transform: uppercase;
}

/* The grid itself — no visible lines between cells */
.fd-emoji-grid {
    display: grid;
    grid-template-columns: repeat(var(--grid-size), 1fr);
    gap: clamp(4px, 1vw, 8px);
    padding: clamp(0.6rem, 1.5vw, 1rem);
    background: var(--bg-surface);
    border-radius: var(--border-radius);
    box-shadow: 0 4px 18px rgba(0,245,255,0.08);
}

/* Cells: no border, no background — just emoji floating on the grid bg */
.fd-emoji-cell {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    aspect-ratio: 1;
    border-radius: 6px;
    cursor: pointer;
    transition: background 0.15s, transform 0.15s;
    user-select: none;
    overflow: visible;
}

.fd-emoji-cell:hover:not(.found):not(.wrong) {
    background: rgba(0, 245, 255, 0.10);
    transform: scale(1.08);
}

.fd-emoji {
    font-size: clamp(1.4em, 3.5vw, 2.4em);
    line-height: 1;
    pointer-events: none;
    display: inline-block;
}

/* Found state — subtle green wash, no border */
.fd-emoji-cell.found {
    background: rgba(0, 220, 100, 0.18);
}

/* Wrong state — brief red wash */
.fd-emoji-cell.wrong {
    background: rgba(255, 50, 100, 0.18);
    animation: fd-shake 0.3s ease;
}

/* Tick mark */
.tick {
    position: absolute;
    top: 1px;
    right: 2px;
    font-size: 0.85em;
    color: #00e56a;
    font-weight: bold;
    line-height: 1;
    text-shadow: 0 0 6px rgba(0,229,106,0.5);
    pointer-events: none;
}

/* Wrong mark */
.wrong-mark {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 1.3em;
    color: #ff3264;
    font-weight: bold;
    pointer-events: none;
}

/* Hint flash — pulsing glow, no ripple */
.fd-emoji-cell.hint-flash {
    animation: fd-hint-pulse 0.5s ease 0s 3 alternate;
}

@keyframes fd-hint-pulse {
    from { background: rgba(255, 200, 0, 0.10); }
    to   { background: rgba(255, 200, 0, 0.45); }
}

@keyframes fd-shake {
    0%, 100% { transform: translateX(0); }
    30%       { transform: translateX(-5px); }
    70%       { transform: translateX(5px); }
}

/* Divider between grids */
.fd-vs-divider {
    display: flex;
    align-items: center;
    font-size: clamp(1.2em, 2.5vw, 1.8em);
    color: var(--text-muted);
    padding-top: 2rem;
    opacity: 0.5;
    user-select: none;
}

/* Progress text */
.fd-progress {
    font-size: clamp(0.9em, 1.5vw, 1.1em);
    color: var(--text-muted);
}

/* Buttons row */
.fd-buttons {
    display: flex;
    gap: 1rem;
    flex-wrap: wrap;
    justify-content: center;
}

.fd-hint-btn,
.fd-skip-btn {
    padding: clamp(0.5rem, 1.5vw, 0.7rem) clamp(1rem, 2.5vw, 1.4rem);
    font-size: clamp(0.85em, 1.4vw, 1em);
    font-weight: 600;
    border: 2px solid;
    border-radius: 6px;
    cursor: pointer;
    transition: background 0.2s, transform 0.15s, box-shadow 0.2s;
}

.fd-hint-btn {
    background: rgba(255,200,0,0.10);
    border-color: #ffc800;
    color: #ffc800;
}

.fd-hint-btn:hover:not(:disabled) {
    background: rgba(255,200,0,0.22);
    transform: scale(1.04);
    box-shadow: 0 3px 10px rgba(255,200,0,0.2);
}

.fd-hint-btn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

.fd-skip-btn {
    background: rgba(0, 245, 255, 0.08);
    border-color: var(--primary);
    color: var(--primary);
}

.fd-skip-btn:hover {
    background: rgba(0, 245, 255, 0.18);
    transform: scale(1.04);
    box-shadow: 0 3px 10px rgba(0,245,255,0.15);
}

.fd-skip-btn:active,
.fd-hint-btn:active {
    transform: scale(0.97);
}

/* Success / Time-up overlay */
.find-differences-success {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.78);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2000;
    animation: fd-fade-in 0.25s ease;
}

@keyframes fd-fade-in {
    from { opacity: 0; }
    to   { opacity: 1; }
}

.success-content {
    text-align: center;
    animation: fd-pop-in 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
}

@keyframes fd-pop-in {
    0%   { transform: scale(0.5); opacity: 0; }
    100% { transform: scale(1);   opacity: 1; }
}

.success-text {
    font-size: clamp(2.2em, 6vw, 4em);
    font-weight: bold;
    background: var(--gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin-bottom: 0.4rem;
}

.fd-timeup-text {
    background: linear-gradient(135deg, #ff006e, #ff6b35) !important;
    -webkit-background-clip: text !important;
    background-clip: text !important;
}

.level-text {
    font-size: clamp(1.1em, 2.5vw, 1.6em);
    color: var(--primary);
}

/* Responsive */
@media (max-width: 600px) {
    .fd-grids-wrapper { flex-direction: column; align-items: center; }
    .fd-vs-divider { padding-top: 0; transform: rotate(90deg); }
    .fd-header { gap: 0.5rem; }
}

/* Find Differences – Images variant */
.fdi-loading {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    width: 100%;
    min-height: 300px;
    gap: 1rem;
    color: var(--text-muted);
    font-size: 1.1em;
}

.fdi-spinner {
    width: 44px;
    height: 44px;
    border: 4px solid rgba(0,245,255,0.15);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: fdi-spin 0.8s linear infinite;
}

@keyframes fdi-spin {
    to { transform: rotate(360deg); }
}

.fdi-img-grid {
    /* cell size: clamp between 60px and 110px depending on viewport */
    --cell: clamp(60px, 12vw, 110px);
    grid-template-columns: repeat(var(--grid-size), var(--cell)) !important;
    gap: clamp(4px, 1vw, 8px);
}

.fdi-img-cell {
    width: var(--cell, 90px);
    height: var(--cell, 90px);
    padding: 6px;
    overflow: hidden;
}

.fdi-img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    pointer-events: none;
    display: block;
    transition: transform 0.2s;
}

/* ===== PAGINATION ===== */
.pagination {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: clamp(0.5rem, 2vw, 1rem);
    margin: clamp(1.5rem, 4vw, 2.5rem) 0;
    flex-wrap: wrap;
}

.pagination a {
    padding: clamp(0.4rem, 1vw, 0.6rem) clamp(0.8rem, 2vw, 1.2rem);
    background: var(--bg-surface);
    border: 1px solid var(--primary);
    color: var(--text);
    border-radius: var(--border-radius);
    font-weight: bold;
    transition: var(--transition);
}

.pagination a:hover {
    background: var(--primary);
    color: #ffffff;
    box-shadow: 0 4px 12px rgba(255, 0, 110, 0.4);
}

.pagination .page-info {
    padding: clamp(0.4rem, 1vw, 0.6rem) clamp(0.8rem, 2vw, 1.2rem);
    color: var(--text-muted);
    font-weight: 500;
}

/* ===== ALPHABET TRACING GAME ===== */

/* Layout wrapper + controls bar */
#tracingWrapper {
    display: flex;
    flex-direction: column;
    gap: 6px;
    flex: 1 1 auto;
    min-height: 0;
}
#tracingControlsBar {
    display: flex;
    flex-direction: row;
    flex-wrap: wrap;
    gap: 8px;
    padding: 8px 10px;
    background: #1a1a2e;
    border-radius: 8px;
    justify-content: center;
    align-items: center;
    width: 100%;
    box-sizing: border-box;
}
@media (min-width: 600px) {
    #tracingWrapper {
        flex-direction: row;
        align-items: flex-start;
        gap: 8px;
    }
    #tracingControlsBar {
        flex-direction: column;
        justify-content: flex-start;
        align-items: stretch;
        width: 100px;
        flex-shrink: 0;
        padding: 10px 8px;
    }
}

/* Controls */
.tracing-color-label {
    display: flex;
    align-items: center;
    gap: 6px;
    color: #fff;
    font-size: 13px;
    cursor: pointer;
    white-space: nowrap;
}
.tracing-color-input {
    width: 38px;
    height: 34px;
    border: none;
    padding: 2px;
    background: none;
    cursor: pointer;
    border-radius: 6px;
    flex-shrink: 0;
}
.tracing-slider-wrap {
    display: flex;
    flex-direction: column;
    gap: 3px;
    color: #fff;
    font-size: 12px;
    cursor: pointer;
}
.tracing-slider-label { white-space: nowrap; }
.tracing-slider-wrap input[type=range] {
    width: 100%;
    cursor: pointer;
    accent-color: #ff006e;
}
.tracing-timer {
    color: #fff;
    font-size: 15px;
    font-weight: bold;
    text-align: center;
    letter-spacing: 1px;
    padding: 4px 0;
}
.tracing-ctrl-btn {
    padding: 8px 10px;
    background: #2d2d5e;
    color: #fff;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-size: 13px;
    font-weight: bold;
    white-space: nowrap;
    display: flex;
    align-items: center;
    justify-content: center;
}
.tracing-ctrl-btn:hover { background: #ff006e; }

/* Alphabet strip */
/* Tracing nav bar (Next / Language) */
#tracingNavBar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 4px 6px;
    background: #111128;
    border-bottom: 1px solid #2d2d5e;
    flex-shrink: 0;
}
.tracing-nav-btn {
    padding: 5px 14px;
    border-radius: 8px;
    border: none;
    cursor: pointer;
    font-size: 13px;
    font-weight: 700;
    line-height: 1;
}
.tracing-nav-next    { background: #00c3ff; color: #000; }
.tracing-nav-restart { background: #ff4466; color: #fff; }
.tracing-nav-btn:hover { filter: brightness(1.15); }

#alphabetStrip {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    padding: 6px 8px;
    background: #111128;
    flex-shrink: 0;
    justify-content: center;
    border-top: 1px solid #2d2d5e;
}
.alpha-btn {
    min-width: 32px;
    height: 32px;
    background: #2d2d5e;
    color: #fff;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: 13px;
    font-weight: bold;
    flex-shrink: 0;
}
.alpha-btn:not(.active):hover { background: #444480; }
.alpha-btn.active             { background: #ff006e; }
.alpha-group-label {
    width: 100%;
    font-size: 11px;
    font-weight: 700;
    color: #94a3b8;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    padding: 4px 4px 0;
    margin-top: 2px;
}

/* Word section */
#wordSection {
    display: flex;
    flex-direction: column;
    gap: 6px;
    padding: 8px;
    background: #0d0d1f;
    border-top: 1px solid #2d2d5e;
    flex-shrink: 0;
}
.word-cards-row {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    flex-wrap: wrap;
}
.word-arrow-btn {
    background: none;
    border: none;
    cursor: pointer;
    padding: 4px;
    color: #fff;
    opacity: 1;
    flex-shrink: 0;
}
.word-arrow-btn.disabled {
    opacity: 0.3;
    cursor: default;
}
.word-cards {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
    justify-content: center;
}
.word-card {
    background: #1a1a3e;
    color: #fff;
    border: 1px solid #2d2d5e;
    border-radius: 8px;
    padding: 6px 12px;
    font-weight: bold;
    font-size: 14px;
    cursor: pointer;
}
.word-card:not(.active):hover { background: #2d2d5e; }
.word-card.active {
    background: #ff006e;
    border-color: #ff006e;
}
.word-input-row {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}
.word-input {
    background: #1a1a2e;
    color: #fff;
    border: 1px solid #2d2d5e;
    border-radius: 6px;
    padding: 6px 10px;
    font-size: 15px;
    width: 160px;
    text-transform: uppercase;
    outline: none;
    letter-spacing: 2px;
}
.trace-btn {
    padding: 7px 14px;
    background: #ff006e;
    color: #fff;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-size: 13px;
    font-weight: bold;
}
.trace-btn:hover { background: #cc0055; }

form {display:inline-block}

/* ===== PHOTO PUZZLE STYLES ===== */
#photo-puzzle-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.85);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

.photo-puzzle-setup {
    background: linear-gradient(135deg, var(--bg) 0%, var(--bg-surface) 100%);
    border: 2px solid var(--primary);
    border-radius: var(--border-radius);
    padding: clamp(1rem, 3vw, 2rem);
    max-width: clamp(300px, 90vw, 500px);
    color: var(--text);
    box-shadow: 0 8px 32px rgba(255, 0, 110, 0.3);
    text-align: center;
}

.photo-puzzle-setup h2 {
    margin-bottom: 0.5em;
    color: var(--secondary);
    font-size: clamp(1.2rem, 2vw, 1.8rem);
}

.photo-puzzle-setup p {
    margin-bottom: 1.5em;
    color: var(--text-muted);
    font-size: clamp(0.9rem, 1.5vw, 1rem);
}

.photo-puzzle-image-label {
    text-align: center;
    font-size: 0.8rem;
    color: var(--secondary);
    min-height: 100px;
    margin-bottom: 1rem;
    display: flex;
    align-items: center;
    justify-content: center;
}

#tagline{color:#ff0;padding:1px 5px;}
html[data-theme="light"] #tagline{color:#000;}

/* ===== SIMILAR GAMES SECTION ===== */
.similar-games-container {
    margin-top: clamp(2rem, 4vw, 3rem);
    padding: clamp(1rem, 2vw, 2rem) 0;
}

.similar-games-title {
    text-align: center;
    margin-bottom: clamp(1rem, 2vw, 1.5rem);
    font-size: clamp(1.5rem, 3vw, 2rem);
    color: var(--secondary);
}

.similar-games-container .games-container {
    margin: 0 auto;
    max-width: 1200px;
}