/* ════════════════════════════════════════════
   PuzzleKids — puzzle.css
   ════════════════════════════════════════════ */

:root {
    --coral: #FF6B6B;
    --sky: #6EC6F5;
    --sun: #FFD93D;
    --purple: #C77DFF;
    --green: #6BCB77;
    --orange: #FF8E53;
    --white: #FFFDF7;
    --dark: #2D2D2D;
    --shadow: 0 8px 32px rgba(0,0,0,0.13);
    --radius: 20px;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: 'Nunito', sans-serif;
    background: linear-gradient(150deg, #a8edea 0%, #fed6e3 55%, #ffecd2 100%);
    min-height: 100vh;
    overflow-x: hidden;
}

/* ════════════════════════════════
   FLOATING DECORATIONS
   ════════════════════════════════ */
.deco {
    position: fixed;
    pointer-events: none;
    z-index: 0;
    font-size: 2.4rem;
    opacity: 0.2;
    animation: floatDeco 6s ease-in-out infinite;
}

.d1 {
    top: 4%;
    left: 2%;
    animation-delay: 0s;
}

.d2 {
    top: 12%;
    right: 3%;
    animation-delay: 1.2s;
}

.d3 {
    bottom: 8%;
    left: 5%;
    animation-delay: 2s;
}

.d4 {
    bottom: 15%;
    right: 6%;
    animation-delay: 0.7s;
}

.d5 {
    top: 48%;
    left: 1%;
    animation-delay: 1.8s;
}

@keyframes floatDeco {
    0%,100% {
        transform: translateY(0) rotate(-6deg);
    }

    50% {
        transform: translateY(-20px) rotate(6deg);
    }
}

/* ════════════════════════════════
   SITE HEADER
   ════════════════════════════════ */
.site-header {
    text-align: center;
    padding: 32px 16px 16px;
    position: relative;
    z-index: 1;
}

.site-header-inner h1 {
    font-family: 'Fredoka One', cursive;
    font-size: clamp(2.4rem, 7vw, 4rem);
    color: #fff;
    text-shadow: 4px 4px 0 var(--coral), 8px 8px 0 rgba(0,0,0,0.1);
    letter-spacing: 2px;
}

.site-header-inner p {
    color: #fff;
    font-size: 1.05rem;
    font-weight: 700;
    opacity: 0.9;
    margin-top: 6px;
}

/* ════════════════════════════════
   SCREENS
   ════════════════════════════════ */
.screen {
    position: relative;
    z-index: 1;
}

/* ════════════════════════════════
   SETUP SCREEN
   ════════════════════════════════ */
.setup-wrap {
    max-width: 860px;
    margin: 0 auto;
    padding: 10px 18px 50px;
}

.section-title {
    font-family: 'Fredoka One', cursive;
    font-size: 1.45rem;
    color: #fff;
    text-shadow: 2px 2px 0 rgba(0,0,0,0.15);
    margin-bottom: 14px;
    text-align: center;
}

/* Gallery wrapper */
.preset-grid {
    display: block;
    margin-bottom: 30px;
}


/* Upload area */
.upload-area {
    background: rgba(255,255,255,0.5);
    backdrop-filter: blur(8px);
    border: 3px dashed rgba(255,107,107,0.6);
    border-radius: var(--radius);
    padding: 36px 24px;
    text-align: center;
    cursor: pointer;
    transition: background .25s, border-color .25s;
    position: relative;
    margin-bottom: 10px;
}

    .upload-area:hover, .upload-area.drag-over {
        background: rgba(255,255,255,0.75);
        border-color: var(--coral);
    }

.upload-icon {
    font-size: 3rem;
    line-height: 1;
}

.upload-text {
    font-family: 'Fredoka One', cursive;
    font-size: 1.25rem;
    color: var(--dark);
    margin: 10px 0 4px;
}

.upload-hint {
    color: #777;
    font-size: .88rem;
}

.file-input {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    opacity: 0;
    cursor: pointer;
}

/* Difficulty */
.diff-row {
    display: flex;
    gap: 14px;
    justify-content: center;
    flex-wrap: wrap;
    margin-bottom: 10px;
}

.diff-btn {
    background: rgba(255,255,255,0.6);
    backdrop-filter: blur(6px);
    border: 3px solid transparent;
    border-radius: 18px;
    padding: 16px 20px;
    cursor: pointer;
    text-align: center;
    font-family: 'Nunito', sans-serif;
    font-size: 1.7rem;
    width: 150px;
    box-shadow: var(--shadow);
    transition: transform .2s, border-color .2s, background .2s;
    line-height: 1.4;
}

    .diff-btn span {
        display: block;
        font-size: 1rem;
        font-weight: 900;
        color: var(--dark);
    }

    .diff-btn small {
        font-size: .78rem;
        color: #666;
        font-weight: 700;
    }

    .diff-btn:hover {
        transform: translateY(-4px);
        background: rgba(255,255,255,0.85);
    }

    .diff-btn.active {
        border-color: var(--coral);
        background: rgba(255,107,107,0.15);
        transform: scale(1.06);
    }

/* Start button */
.btn-start {
    font-family: 'Fredoka One', cursive;
    font-size: 1.5rem;
    padding: 16px 52px;
    background: linear-gradient(135deg, var(--coral) 0%, var(--orange) 100%);
    color: #fff;
    border: none;
    border-radius: 60px;
    cursor: pointer;
    box-shadow: 0 8px 24px rgba(255,107,107,0.45);
    transition: transform .2s, box-shadow .2s;
    letter-spacing: 1px;
    text-shadow: 1px 1px 0 rgba(0,0,0,0.15);
}

    .btn-start:hover {
        transform: translateY(-4px) scale(1.04);
        box-shadow: 0 14px 36px rgba(255,107,107,0.55);
    }

    .btn-start:active {
        transform: scale(.97);
    }

/* ════════════════════════════════
   PUZZLE SCREEN
   ════════════════════════════════ */
.puzzle-wrap {
    max-width: 1100px;
    margin: 0 auto;
    padding: 10px 16px 50px;
}

.puzzle-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 10px;
    margin-bottom: 18px;
}

.btn-back {
    font-family: 'Nunito', sans-serif;
    font-size: 1rem;
    font-weight: 800;
    background: rgba(255,255,255,0.7);
    border: 2px solid rgba(0,0,0,0.1);
    border-radius: 30px;
    padding: 8px 20px;
    cursor: pointer;
    transition: transform .2s, background .2s;
}

    .btn-back:hover {
        transform: translateX(-4px);
        background: #fff;
    }

.puzzle-title {
    font-family: 'Fredoka One', cursive;
    font-size: clamp(1.3rem, 4vw, 2rem);
    color: #fff;
    text-shadow: 2px 2px 0 rgba(0,0,0,0.15);
}

.puzzle-info {
    display: flex;
    gap: 14px;
    font-family: 'Fredoka One', cursive;
    font-size: 1rem;
    color: #fff;
    background: rgba(255,255,255,0.25);
    border-radius: 30px;
    padding: 6px 18px;
}

.game-area {
    display: flex;
    gap: 20px;
    align-items: flex-start;
    flex-wrap: wrap;
}

.reference-box {
    background: var(--white);
    border-radius: var(--radius);
    padding: 12px;
    box-shadow: var(--shadow);
    min-width: 140px;
    text-align: center;
    flex-shrink: 0;
}

.ref-label {
    font-family: 'Fredoka One', cursive;
    font-size: .95rem;
    color: var(--dark);
    margin-bottom: 8px;
}

#refCanvas {
    width: 130px;
    height: 130px;
    border-radius: 10px;
    display: block;
    margin: 0 auto;
}

.boards-row {
    display: flex;
    gap: 20px;
    flex: 1;
    flex-wrap: wrap;
    justify-content: center;
}

.board-container {
    flex: 1;
    min-width: 260px;
}

.board-label {
    font-family: 'Fredoka One', cursive;
    font-size: 1.1rem;
    color: #fff;
    text-align: center;
    margin-bottom: 10px;
}

.board {
    background: rgba(255,255,255,0.4);
    backdrop-filter: blur(6px);
    border-radius: var(--radius);
    border: 3px dashed rgba(255,255,255,0.7);
    box-shadow: var(--shadow);
    display: grid;
    gap: 5px;
    padding: 10px;
    min-height: 300px;
}

.puzzle-board {
    border-color: rgba(255,107,107,0.5);
}

    .puzzle-board.drag-over {
        background: rgba(255,255,255,0.65);
        border-color: var(--coral);
        border-style: solid;
    }

/* Pieces */
.piece {
    border-radius: 10px;
    border: 3px solid rgba(255,255,255,0.85);
    box-shadow: 0 4px 12px rgba(0,0,0,0.18);
    transition: transform .15s, box-shadow .15s;
    user-select: none;
    cursor: grab;
    background-size: cover;
    background-repeat: no-repeat;
    background-position: center;
}

    .piece:hover {
        transform: scale(1.07) rotate(1deg);
        box-shadow: 0 8px 24px rgba(0,0,0,0.28);
        z-index: 10;
        position: relative;
    }

    .piece:active {
        cursor: grabbing;
    }

/* Drop slot */
.drop-slot {
    border-radius: 10px;
    border: 2px dashed rgba(255,107,107,0.35);
    background: rgba(255,255,255,0.12);
    transition: background .2s, border-color .2s;
    position: relative;
}

    .drop-slot.hover {
        background: rgba(255,107,107,0.18);
        border-color: var(--coral);
        border-style: solid;
    }

    .drop-slot.occupied {
        border: none;
        background: none;
    }

.slot-hint {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: 'Fredoka One', cursive;
    font-size: clamp(.6rem, 2vw, 1rem);
    color: rgba(0,0,0,0.18);
    pointer-events: none;
}

/* Controls */
.controls-row {
    display: flex;
    gap: 12px;
    justify-content: center;
    flex-wrap: wrap;
    margin-top: 22px;
}

.btn-ctrl {
    font-family: 'Fredoka One', cursive;
    font-size: 1rem;
    padding: 12px 28px;
    border: none;
    border-radius: 40px;
    cursor: pointer;
    box-shadow: 0 6px 18px rgba(0,0,0,0.18);
    transition: transform .2s, box-shadow .2s;
    color: #fff;
}

    .btn-ctrl:hover {
        transform: translateY(-3px);
        box-shadow: 0 10px 28px rgba(0,0,0,0.24);
    }

    .btn-ctrl:active {
        transform: scale(.96);
    }

.btn-hint {
    background: linear-gradient(135deg, var(--sun), var(--orange));
    color: #333;
}

.btn-shuffle {
    background: linear-gradient(135deg, var(--sky), var(--purple));
}

.btn-solve {
    background: linear-gradient(135deg, var(--green), #3ECC72);
}

/* ════════════════════════════════
   WIN MODAL
   ════════════════════════════════ */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.55);
    backdrop-filter: blur(6px);
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
    animation: fadeIn .3s;
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

.modal-box {
    background: var(--white);
    border-radius: 28px;
    padding: 44px 36px 36px;
    text-align: center;
    max-width: 400px;
    width: 90%;
    box-shadow: 0 24px 80px rgba(0,0,0,0.3);
    animation: popIn .4s cubic-bezier(.175,.885,.32,1.275);
}

@keyframes popIn {
    from {
        transform: scale(.5) translateY(60px);
        opacity: 0;
    }

    to {
        transform: scale(1) translateY(0);
        opacity: 1;
    }
}

.modal-emoji {
    font-size: 4.5rem;
    line-height: 1;
    margin-bottom: 10px;
}

.modal-title {
    font-family: 'Fredoka One', cursive;
    font-size: 2.4rem;
    color: var(--coral);
    text-shadow: 3px 3px 0 rgba(255,107,107,0.2);
}

.modal-sub {
    font-size: 1.05rem;
    color: #666;
    font-weight: 700;
    margin: 6px 0 24px;
}

.modal-stats {
    display: flex;
    justify-content: center;
    gap: 18px;
    margin-bottom: 28px;
}

.stat-box {
    background: linear-gradient(135deg,#f8f8f8,#eee);
    border-radius: 14px;
    padding: 14px 20px;
    min-width: 80px;
}

    .stat-box span {
        display: block;
        font-family: 'Fredoka One', cursive;
        font-size: 1.6rem;
        color: var(--dark);
    }

    .stat-box small {
        font-size: .78rem;
        color: #888;
        font-weight: 700;
    }

.btn-modal {
    font-family: 'Fredoka One', cursive;
    font-size: 1.1rem;
    padding: 14px 32px;
    border: none;
    border-radius: 40px;
    cursor: pointer;
    transition: transform .2s, box-shadow .2s;
    box-shadow: 0 6px 18px rgba(0,0,0,0.15);
    color: #fff;
}

    .btn-modal:hover {
        transform: translateY(-3px) scale(1.04);
    }

.btn-play-again {
    background: linear-gradient(135deg, var(--coral), var(--orange));
}

.btn-new {
    background: linear-gradient(135deg, var(--sky), var(--purple));
}

/* ════════════════════════════════
   INFO SECTION
   ════════════════════════════════ */
.info-section {
    max-width: 980px;
    margin: 0 auto;
    padding: 10px 18px 40px;
    position: relative;
    z-index: 1;
    display: flex;
    flex-direction: column;
    gap: 28px;
}

/* Each info block (card) */
.info-block {
    background: rgba(255,255,255,0.55);
    backdrop-filter: blur(10px);
    border-radius: 24px;
    border: 2px solid rgba(255,255,255,0.8);
    box-shadow: 0 8px 32px rgba(0,0,0,0.1);
    overflow: hidden;
}

.info-block-header {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 20px 26px 18px;
    background: rgba(255,255,255,0.4);
    border-bottom: 2px solid rgba(255,255,255,0.7);
}

.info-icon {
    font-size: 2.2rem;
    line-height: 1;
    flex-shrink: 0;
}

.info-block-header h2 {
    font-family: 'Fredoka One', cursive;
    font-size: clamp(1.3rem, 3.5vw, 1.75rem);
    color: var(--dark);
    margin: 0;
}

.info-block-body {
    padding: 24px 26px 28px;
    display: flex;
    flex-direction: column;
    gap: 18px;
}

    .info-block-body p {
        font-size: .98rem;
        color: #444;
        line-height: 1.75;
        margin: 0;
    }

    .info-block-body strong {
        color: var(--dark);
    }

/* What-is cards row */
.what-cards {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
    gap: 14px;
    margin-top: 4px;
}

.what-card {
    background: #fff;
    border-radius: 16px;
    padding: 18px 14px 16px;
    text-align: center;
    box-shadow: 0 4px 14px rgba(0,0,0,0.08);
    transition: transform .2s, box-shadow .2s;
}

    .what-card:hover {
        transform: translateY(-4px);
        box-shadow: 0 10px 28px rgba(0,0,0,0.13);
    }

.what-card-icon {
    font-size: 2rem;
    line-height: 1;
    margin-bottom: 10px;
}

.what-card strong {
    display: block;
    font-size: .95rem;
    color: var(--dark);
    margin-bottom: 6px;
}

.what-card p {
    font-size: .82rem;
    color: #666;
    line-height: 1.55;
    margin: 0;
}

/* How-to-play steps */
.steps-list {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.step {
    display: flex;
    gap: 16px;
    align-items: flex-start;
    background: #fff;
    border-radius: 16px;
    padding: 16px 18px;
    box-shadow: 0 3px 12px rgba(0,0,0,0.07);
}

.step-num {
    flex-shrink: 0;
    width: 42px;
    height: 42px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--coral), var(--orange));
    color: #fff;
    font-family: 'Fredoka One', cursive;
    font-size: 1.4rem;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 12px rgba(255,107,107,0.4);
}

.step-content {
    flex: 1;
}

    .step-content strong {
        display: block;
        font-size: 1.02rem;
        color: var(--dark);
        margin-bottom: 5px;
    }

    .step-content p {
        font-size: .9rem;
        color: #555;
        line-height: 1.65;
        margin: 0;
    }

/* Tips box */
.tips-box {
    background: linear-gradient(135deg, rgba(255,211,61,0.18), rgba(255,142,83,0.12));
    border: 2px solid rgba(255,211,61,0.45);
    border-radius: 18px;
    padding: 20px 22px;
}

.tips-title {
    font-family: 'Fredoka One', cursive;
    font-size: 1.1rem;
    color: var(--dark);
    margin-bottom: 12px;
}

.tips-list {
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex;
    flex-direction: column;
    gap: 9px;
}

    .tips-list li {
        font-size: .9rem;
        color: #444;
        line-height: 1.6;
        padding-left: 22px;
        position: relative;
    }

        .tips-list li::before {
            content: '✦';
            position: absolute;
            left: 0;
            color: var(--orange);
            font-size: .75rem;
            top: 3px;
        }

/* Benefits intro */
.benefits-intro {
    font-size: 1rem !important;
    color: #444 !important;
}

/* Benefits grid */
.benefits-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
    gap: 16px;
}

.benefit-card {
    background: #fff;
    border-radius: 18px;
    padding: 20px 18px 18px;
    border-top: 4px solid var(--accent, var(--coral));
    box-shadow: 0 4px 16px rgba(0,0,0,0.08);
    transition: transform .2s, box-shadow .2s;
}

    .benefit-card:hover {
        transform: translateY(-4px);
        box-shadow: 0 10px 30px rgba(0,0,0,0.13);
    }

.benefit-icon {
    font-size: 2rem;
    line-height: 1;
    margin-bottom: 10px;
}

.benefit-card h3 {
    font-family: 'Fredoka One', cursive;
    font-size: 1.05rem;
    color: var(--dark);
    margin: 0 0 8px;
}

.benefit-card p {
    font-size: .88rem;
    color: #555;
    line-height: 1.6;
    margin: 0;
}

/* Age guide */
.age-guide {
    background: rgba(255,255,255,0.6);
    border-radius: 20px;
    padding: 22px 22px 18px;
    border: 2px solid rgba(255,255,255,0.9);
    box-shadow: 0 4px 18px rgba(0,0,0,0.07);
}

.age-guide-title {
    font-family: 'Fredoka One', cursive;
    font-size: 1.2rem;
    color: var(--dark);
    margin-bottom: 16px;
    text-align: center;
}

.age-row {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 14px;
}

.age-card {
    background: #fff;
    border-radius: 16px;
    padding: 18px 14px;
    text-align: center;
    box-shadow: 0 3px 12px rgba(0,0,0,0.07);
}

.age-badge {
    display: inline-block;
    font-family: 'Fredoka One', cursive;
    font-size: 1.3rem;
    color: #fff;
    border-radius: 30px;
    padding: 4px 18px;
    margin-bottom: 8px;
    box-shadow: 0 3px 10px rgba(0,0,0,0.15);
}

.age-card strong {
    display: block;
    font-size: 1rem;
    color: var(--dark);
    margin-bottom: 6px;
}

.age-card p {
    font-size: .84rem;
    color: #555;
    line-height: 1.55;
    margin: 0;
}

/* ════════════════════════════════
   FOOTER
   ════════════════════════════════ */
.site-footer {
    text-align: center;
    padding: 28px 16px 40px;
    position: relative;
    z-index: 1;
}

.footer-title {
    font-family: 'Fredoka One', cursive;
    font-size: 1.15rem;
    color: rgba(255,255,255,0.95);
    text-shadow: 1px 1px 3px rgba(0,0,0,0.2);
    margin-bottom: 12px;
}

.footer-badges {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 10px;
}

    .footer-badges span {
        background: rgba(255,255,255,0.3);
        backdrop-filter: blur(6px);
        border: 1.5px solid rgba(255,255,255,0.6);
        border-radius: 30px;
        padding: 5px 16px;
        font-size: .85rem;
        font-weight: 800;
        color: #fff;
        text-shadow: 1px 1px 2px rgba(0,0,0,0.15);
    }

/* ════════════════════════════════
   RESPONSIVE
   ════════════════════════════════ */
@media (max-width: 700px) {
    .game-area {
        flex-direction: column;
        align-items: center;
    }

    .reference-box {
        width: 100%;
        max-width: 300px;
    }

    #refCanvas {
        width: 100%;
        height: auto;
    }

    .boards-row {
        flex-direction: column;
    }

    .board-container {
        min-width: unset;
        width: 100%;
    }

    .diff-btn {
        width: 120px;
    }

    .info-block-header {
        padding: 16px 18px 14px;
    }

    .info-block-body {
        padding: 18px 16px 20px;
    }

    .step {
        flex-direction: column;
        gap: 10px;
    }

    .step-num {
        width: 36px;
        height: 36px;
        font-size: 1.2rem;
    }

    .what-cards {
        grid-template-columns: 1fr 1fr;
    }

    .benefits-grid {
        grid-template-columns: 1fr;
    }

    .age-row {
        grid-template-columns: 1fr;
    }

    .modal-box {
        padding: 32px 20px 28px;
    }
}

/* ════════════════════════════════════════
   GALLERY — tabs + image grid
   ════════════════════════════════════════ */

/* Outer wrapper is plain block so tabs + grid stack vertically */
#presetGrid {
    display: block;
    margin-bottom: 28px;
}

/* ── Tab bar ── */
.gtab-bar {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    justify-content: center;
    margin-bottom: 14px;
}

.gtab {
    display: flex;
    align-items: center;
    gap: 5px;
    font-family: 'Nunito', sans-serif;
    font-weight: 800;
    font-size: .85rem;
    padding: 7px 16px;
    border: 2px solid rgba(255,255,255,.7);
    border-radius: 30px;
    background: rgba(255,255,255,.45);
    backdrop-filter: blur(6px);
    color: var(--dark);
    cursor: pointer;
    transition: transform .15s, background .2s, border-color .2s, box-shadow .2s;
    white-space: nowrap;
}

    .gtab:hover {
        background: rgba(255,255,255,.75);
        transform: translateY(-2px);
        box-shadow: 0 4px 14px rgba(0,0,0,.12);
    }

.gtab-on {
    background: linear-gradient(135deg, var(--coral), var(--orange)) !important;
    border-color: transparent !important;
    color: #fff !important;
    box-shadow: 0 4px 16px rgba(255,107,107,.4) !important;
    transform: translateY(-2px) !important;
}

.gtab-emoji {
    font-size: 1rem;
    line-height: 1;
}

.gtab-label {
    font-size: .82rem;
}

/* ── Image grid ──
   THIS is the grid — not #presetGrid */
.gimg-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
    gap: 12px;
}

/* ── Individual card ── */
.gcard {
    background: var(--white);
    border-radius: 16px;
    padding: 8px 8px 6px;
    cursor: pointer;
    border: 4px solid transparent;
    box-shadow: 0 4px 16px rgba(0,0,0,.1);
    transition: transform .2s, border-color .2s, box-shadow .2s;
    text-align: center;
    user-select: none;
    position: relative;
    overflow: hidden;
}

    .gcard:hover {
        transform: translateY(-5px) scale(1.04);
        box-shadow: 0 14px 36px rgba(0,0,0,.18);
    }

.gcard-on {
    border-color: var(--coral) !important;
    transform: scale(1.07) !important;
    box-shadow: 0 0 0 5px rgba(255,107,107,.25), 0 8px 24px rgba(0,0,0,.15) !important;
}

    /* Checkmark badge on selected card */
    .gcard-on::after {
        content: '✓';
        position: absolute;
        top: 6px;
        right: 7px;
        background: var(--coral);
        color: #fff;
        font-size: .7rem;
        font-weight: 900;
        width: 20px;
        height: 20px;
        border-radius: 50%;
        display: flex;
        align-items: center;
        justify-content: center;
        line-height: 20px;
        box-shadow: 0 2px 6px rgba(255,107,107,.5);
    }

/* Loading spinner overlay */
.gcard-loading::before {
    content: '';
    position: absolute;
    inset: 0;
    background: rgba(255,255,255,.65);
    border-radius: 12px;
    z-index: 2;
}

.gcard-loading::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 26px;
    height: 26px;
    margin: -13px 0 0 -13px;
    border: 3px solid rgba(255,107,107,.3);
    border-top-color: var(--coral);
    border-radius: 50%;
    animation: spin .7s linear infinite;
    z-index: 3;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

/* Thumbnail container — forces square aspect ratio */
.gcard-thumb {
    width: 100%;
    aspect-ratio: 1;
    border-radius: 10px;
    overflow: hidden;
    background: linear-gradient(135deg,#e8e8e8,#f5f5f5);
    display: flex;
    align-items: center;
    justify-content: center;
}

    .gcard-thumb img {
        width: 100%;
        height: 100%;
        object-fit: cover;
        display: block;
        border-radius: 10px;
    }

/* Label below thumbnail */
.gcard-label {
    margin-top: 6px;
    font-weight: 800;
    font-size: .78rem;
    color: var(--dark);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* ── Responsive ── */
@media (max-width: 500px) {
    .gimg-grid {
        grid-template-columns: repeat(auto-fill, minmax(85px,1fr));
        gap: 8px;
    }

    .gtab {
        font-size: .75rem;
        padding: 6px 11px;
    }

    .gtab-emoji {
        display: none;
    }
}
