/* ==========================================================================
   2048 Games Hub - Game Engine & Board Stylesheet
   Responsive boards (3x3 to 6x6), Themes, Tiles, Overlays & Micro-Animations
   ========================================================================== */

.game-page-container {
    max-width: 900px;
    margin: 1.5rem auto 3rem;
    padding: 0 1.25rem;
}

.game-page-header {
    text-align: center;
    margin-bottom: 1.5rem;
}

.game-page-title {
    font-size: clamp(1.8rem, 4vw, 2.6rem);
    letter-spacing: -0.02em;
    margin-bottom: 0.5rem;
}

.game-page-subtitle {
    color: var(--text-secondary);
    font-size: 1rem;
    max-width: 650px;
    margin: 0 auto;
}

/* Wrapper */
.g2048-wrapper {
    max-width: 520px;
    margin: 0 auto;
    user-select: none;
    -webkit-user-select: none;
    touch-action: pan-y;
}

/* Header & Scores */
.g2048-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 0.85rem;
    gap: 1rem;
}

.g2048-badge {
    display: inline-block;
    padding: 0.35rem 0.85rem;
    background: var(--bg-muted);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-full);
    font-size: 0.8rem;
    font-weight: 700;
    color: var(--text-secondary);
    letter-spacing: 0.05em;
}

.g2048-scores {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.score-card {
    background: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 0.45rem 1rem;
    text-align: center;
    min-width: 84px;
    position: relative;
    box-shadow: var(--shadow-sm);
}

.score-label {
    display: block;
    font-size: 0.68rem;
    font-weight: 700;
    color: var(--text-muted);
    letter-spacing: 0.05em;
}

.score-val {
    display: block;
    font-family: var(--font-heading);
    font-size: 1.35rem;
    font-weight: 800;
    color: var(--text-primary);
    line-height: 1.1;
}

.score-addition {
    position: absolute;
    bottom: -10px;
    left: 50%;
    transform: translateX(-50%);
    font-size: 0.95rem;
    font-weight: 800;
    color: var(--success);
    opacity: 0;
    pointer-events: none;
}

.score-addition.active {
    animation: floatScore 0.8s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

@keyframes floatScore {
    0% {
        opacity: 1;
        transform: translate(-50%, 0) scale(1);
    }
    100% {
        opacity: 0;
        transform: translate(-50%, -28px) scale(1.2);
    }
}

/* Toolbar */
.g2048-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
    margin-bottom: 1rem;
}

.btn-game-tool {
    flex: 1;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.4rem;
    padding: 0.6rem 0.85rem;
    background: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    color: var(--text-primary);
    font-size: 0.88rem;
    font-weight: 700;
    cursor: pointer;
    box-shadow: var(--shadow-sm);
    transition: all var(--transition-fast);
}

.btn-game-tool:hover:not(:disabled) {
    background: var(--bg-muted);
    transform: translateY(-1px);
    border-color: var(--primary);
}

.btn-game-tool:disabled {
    opacity: 0.45;
    cursor: not-allowed;
}

#btn-sound {
    flex: 0 0 46px;
    font-size: 1.1rem;
    padding: 0.6rem 0;
}

/* Board Container */
.g2048-board-container {
    --grid-gap: 12px;
    --grid-size: 4;
    width: 100%;
    aspect-ratio: 1 / 1;
    background: #bbada0;
    border-radius: var(--radius-lg);
    padding: var(--grid-gap);
    position: relative;
    box-shadow: inset 0 3px 6px rgba(0,0,0,0.15), 0 10px 25px -5px rgba(0,0,0,0.1);
    outline: none;
    overflow: hidden;
    margin-bottom: 1.25rem;
    touch-action: none;
    overscroll-behavior: contain;
}

[data-theme="dark"] .g2048-board-container {
    background: #1e1e24;
    border: 4px solid #3f3f46;
    border-radius: 16px;
    box-shadow: 0 12px 30px rgba(0, 0, 0, 0.5), inset 0 2px 4px rgba(255, 255, 255, 0.05);
}

.theme-cyberdark .g2048-board-container {
    background: #0f172a;
    border: 1px solid #334155;
    box-shadow: 0 0 30px rgba(99, 102, 241, 0.2);
}

/* Background grid */
.g2048-grid-background {
    width: 100%;
    height: 100%;
    display: grid;
    gap: var(--grid-gap);
}

.grid-cell {
    background: rgba(238, 228, 218, 0.35);
    border-radius: 10px;
}

[data-theme="dark"] .grid-cell {
    background: #121216;
    border-radius: 10px;
    box-shadow: inset 0 2px 5px rgba(0, 0, 0, 0.6);
}

/* Tile Container - Absolute layer for smooth gliding animations */
.g2048-tile-container {
    position: absolute;
    top: var(--grid-gap);
    left: var(--grid-gap);
    right: var(--grid-gap);
    bottom: var(--grid-gap);
    pointer-events: none;
}

.tile {
    position: absolute;
    top: 0;
    left: 0;
    width: calc((100% - (var(--grid-cols, var(--grid-size)) - 1) * var(--grid-gap)) / var(--grid-cols, var(--grid-size)));
    height: calc((100% - (var(--grid-rows, var(--grid-size)) - 1) * var(--grid-gap)) / var(--grid-rows, var(--grid-size)));
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: var(--font-heading);
    font-weight: 800;
    transition: transform 140ms cubic-bezier(0.25, 1, 0.5, 1);
    will-change: transform;
    z-index: 2;
}

.tile.tile-merged {
    z-index: 4;
}

.tile-inner {
    width: 100%;
    height: 100%;
    border-radius: 10px;
    border: 1px solid rgba(255, 255, 255, 0.25);
    box-shadow: 0 4px 0 rgba(0, 0, 0, 0.35), 0 6px 12px rgba(0, 0, 0, 0.25), inset 0 1px 1px rgba(255, 255, 255, 0.4);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    position: relative;
    font-family: var(--font-heading, inherit);
    font-weight: 900;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.2);
    transition: transform 0.1s, box-shadow 0.1s;
}

/* Scaling 3D bevels for high-density boards */
.g2048-wrapper[data-size="8"] .tile,
.g2048-wrapper[data-size="8"] .tile-inner {
    border-radius: 6px;
    box-shadow: 0 2px 0 rgba(0, 0, 0, 0.35), 0 4px 8px rgba(0, 0, 0, 0.25), inset 0 1px 1px rgba(255, 255, 255, 0.4);
}
.g2048-wrapper[data-size="10"] .tile,
.g2048-wrapper[data-size="10"] .tile-inner,
.g2048-wrapper[data-size="11"] .tile,
.g2048-wrapper[data-size="11"] .tile-inner,
.g2048-wrapper[data-size="13"] .tile,
.g2048-wrapper[data-size="13"] .tile-inner,
.g2048-wrapper[data-size="16"] .tile,
.g2048-wrapper[data-size="16"] .tile-inner {
    border-radius: 4px;
    border-width: 0.5px;
    box-shadow: 0 1px 0 rgba(0, 0, 0, 0.35), 0 2px 4px rgba(0, 0, 0, 0.2);
}

/* Smooth slow-motion appearance & pop on merge */
.tile.tile-new .tile-inner {
    animation: tileAppear 0.2s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

.tile.tile-merged .tile-inner {
    animation: tilePop 0.22s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

@keyframes tileAppear {
    0% {
        transform: scale(0);
        opacity: 0;
    }
    100% {
        transform: scale(1);
        opacity: 1;
    }
}

@keyframes tilePop {
    0% {
        transform: scale(0.85);
    }
    50% {
        transform: scale(1.18);
    }
    100% {
        transform: scale(1);
    }
}

.tile-text {
    line-height: 1;
}


/* Font Sizing by Board Dimensions - Exactly like classic 2048 (Large, Bold & Prominent) */
.tile {
    font-size: 55px;
    font-weight: 800;
}

.g2048-wrapper[data-size="2"] .tile { font-size: clamp(3.2rem, 12vw, 5.2rem); }
.g2048-wrapper[data-size="3"] .tile { font-size: clamp(2.8rem, 8vw, 4.2rem); }
.g2048-wrapper[data-size="4"] .tile { font-size: clamp(2.2rem, 6.2vw, 3.5rem); }
.g2048-wrapper[data-size="5"] .tile { font-size: clamp(1.6rem, 4.5vw, 2.4rem); }
.g2048-wrapper[data-size="6"] .tile { font-size: clamp(1.2rem, 3.5vw, 1.8rem); }
.g2048-wrapper[data-size="7"] .g2048-board-container { --grid-gap: 8px; }
.g2048-wrapper[data-size="7"] .tile { font-size: clamp(1.0rem, 2.8vw, 1.55rem); }
.g2048-wrapper[data-size="8"] .g2048-board-container { --grid-gap: 8px; }
.g2048-wrapper[data-size="8"] .tile { font-size: clamp(0.85rem, 2.2vw, 1.25rem); }
.g2048-wrapper[data-size="8"] .tile.tile-128,
.g2048-wrapper[data-size="8"] .tile.tile-256,
.g2048-wrapper[data-size="8"] .tile.tile-512 { font-size: clamp(0.72rem, 1.8vw, 1.05rem) !important; }
.g2048-wrapper[data-size="8"] .tile.tile-1024,
.g2048-wrapper[data-size="8"] .tile.tile-2048,
.g2048-wrapper[data-size="8"] .tile.tile-super { font-size: clamp(0.6rem, 1.5vw, 0.9rem) !important; }

.g2048-wrapper[data-size="10"] .g2048-board-container { --grid-gap: 5px; }
.g2048-wrapper[data-size="10"] .tile { font-size: clamp(0.65rem, 1.6vw, 0.95rem); }
.g2048-wrapper[data-size="10"] .tile.tile-128,
.g2048-wrapper[data-size="10"] .tile.tile-256,
.g2048-wrapper[data-size="10"] .tile.tile-512 { font-size: clamp(0.55rem, 1.3vw, 0.8rem) !important; }
.g2048-wrapper[data-size="10"] .tile.tile-1024,
.g2048-wrapper[data-size="10"] .tile.tile-2048,
.g2048-wrapper[data-size="10"] .tile.tile-super { font-size: clamp(0.48rem, 1.1vw, 0.7rem) !important; }

.g2048-wrapper[data-size="11"] .g2048-board-container { --grid-gap: 5px; }
.g2048-wrapper[data-size="11"] .tile { font-size: clamp(0.6rem, 1.5vw, 0.88rem); }
.g2048-wrapper[data-size="11"] .tile.tile-128,
.g2048-wrapper[data-size="11"] .tile.tile-256,
.g2048-wrapper[data-size="11"] .tile.tile-512 { font-size: clamp(0.5rem, 1.2vw, 0.75rem) !important; }
.g2048-wrapper[data-size="11"] .tile.tile-1024,
.g2048-wrapper[data-size="11"] .tile.tile-2048,
.g2048-wrapper[data-size="11"] .tile.tile-super { font-size: clamp(0.42rem, 1.0vw, 0.65rem) !important; }

.g2048-wrapper[data-size="13"] .g2048-board-container { --grid-gap: 4px; }
.g2048-wrapper[data-size="13"] .tile { font-size: clamp(0.5rem, 1.3vw, 0.75rem); }
.g2048-wrapper[data-size="13"] .tile.tile-128,
.g2048-wrapper[data-size="13"] .tile.tile-256,
.g2048-wrapper[data-size="13"] .tile.tile-512 { font-size: clamp(0.42rem, 1.0vw, 0.65rem) !important; }

.g2048-wrapper[data-size="16"] .g2048-board-container { --grid-gap: 3px; }
.g2048-wrapper[data-size="16"] .tile { font-size: clamp(0.4rem, 1.0vw, 0.62rem); }
.g2048-wrapper[data-size="16"] .tile.tile-128,
.g2048-wrapper[data-size="16"] .tile.tile-256,
.g2048-wrapper[data-size="16"] .tile.tile-512 { font-size: clamp(0.35rem, 0.85vw, 0.52rem) !important; }

/* Rectangular Grids (2x3 and 3x4) */
.g2048-wrapper[data-grid="2x3"] .tile { font-size: clamp(2.4rem, 7vw, 3.8rem); }
.g2048-wrapper[data-grid="3x4"] .tile { font-size: clamp(2.0rem, 5.5vw, 3.2rem); }

/* High numbers scaling so 3, 4, 5 digits fit smoothly inside tile */
.g2048-wrapper[data-size="4"] .tile.tile-128,
.g2048-wrapper[data-size="4"] .tile.tile-256,
.g2048-wrapper[data-size="4"] .tile.tile-512 {
    font-size: clamp(1.8rem, 5vw, 2.8rem) !important;
}

.g2048-wrapper[data-size="4"] .tile.tile-1024,
.g2048-wrapper[data-size="4"] .tile.tile-2048 {
    font-size: clamp(1.4rem, 4vw, 2.1rem) !important;
}

.g2048-wrapper[data-size="4"] .tile.tile-super {
    font-size: clamp(1.1rem, 3.2vw, 1.7rem) !important;
}

/* Subscript value label underneath emoji/animal */
.tile-val-sub {
    font-size: 0.72rem;
    font-weight: 800;
    line-height: 1;
    opacity: 0.85;
    margin-top: 2px;
    font-family: var(--font-heading);
    letter-spacing: -0.02em;
}

.g2048-wrapper[data-size="5"] .tile-val-sub {
    font-size: 0.58rem;
}

.g2048-wrapper[data-size="6"] .tile-val-sub {
    font-size: 0.5rem;
}

/* Emoji & Animal icon sizing - Scaled & Balanced with Subscript */
.tile-theme-emoji .tile,
.tile-theme-animals .tile,
.theme-animals .tile,
.theme-emoji .tile {
    font-size: clamp(1.8rem, 4.8vw, 2.4rem);
}

.tile-theme-emoji .tile-text,
.tile-theme-animals .tile-text,
.theme-animals .tile-text,
.theme-emoji .tile-text {
    line-height: 1;
    display: block;
}

.g2048-wrapper[data-size="3"].tile-theme-emoji .tile,
.g2048-wrapper[data-size="3"].tile-theme-animals .tile {
    font-size: clamp(2.4rem, 6vw, 3.2rem) !important;
}

.g2048-wrapper[data-size="4"].tile-theme-emoji .tile,
.g2048-wrapper[data-size="4"].tile-theme-animals .tile {
    font-size: clamp(1.8rem, 4.8vw, 2.4rem) !important;
}

.g2048-wrapper[data-size="5"].tile-theme-emoji .tile,
.g2048-wrapper[data-size="5"].tile-theme-animals .tile {
    font-size: clamp(1.3rem, 3.2vw, 1.7rem) !important;
}

.g2048-wrapper[data-size="6"].tile-theme-emoji .tile,
.g2048-wrapper[data-size="6"].tile-theme-animals .tile {
    font-size: clamp(1rem, 2.4vw, 1.3rem) !important;
}

/* Tactile 3D Embossed Palette (like /tiles/ edition) */
.tile.tile-1 .tile-inner { 
    background: linear-gradient(180deg, #fef08a 0%, #f59e0b 100%); 
    color: #451a03; 
    box-shadow: 0 4px 0 #b45309, 0 0 20px rgba(245, 158, 11, 0.5);
}
.tile.tile-2 .tile-inner { background: linear-gradient(180deg, #fafafa 0%, #e4e4e7 100%); color: #27272a; text-shadow: none; }
.tile.tile-4 .tile-inner { background: linear-gradient(180deg, #fef08a 0%, #fde047 100%); color: #451a03; text-shadow: none; }
.tile.tile-8 .tile-inner { background: linear-gradient(180deg, #fed7aa 0%, #fb923c 100%); color: #ffffff; text-shadow: 0 1px 3px rgba(0,0,0,0.4); }
.tile.tile-16 .tile-inner { background: linear-gradient(180deg, #fdba74 0%, #f97316 100%); color: #ffffff; }
.tile.tile-32 .tile-inner { background: linear-gradient(180deg, #fca5a5 0%, #ef4444 100%); color: #ffffff; }
.tile.tile-64 .tile-inner { background: linear-gradient(180deg, #f87171 0%, #dc2626 100%); color: #ffffff; }
.tile.tile-128 .tile-inner { background: linear-gradient(180deg, #67e8f9 0%, #06b6d4 100%); color: #ffffff; box-shadow: 0 4px 0 #0891b2, 0 0 20px rgba(6, 182, 212, 0.5); }
.tile.tile-256 .tile-inner { background: linear-gradient(180deg, #93c5fd 0%, #3b82f6 100%); color: #ffffff; box-shadow: 0 4px 0 #2563eb, 0 0 22px rgba(59, 130, 246, 0.5); }
.tile.tile-512 .tile-inner { background: linear-gradient(180deg, #c4b5fd 0%, #8b5cf6 100%); color: #ffffff; box-shadow: 0 4px 0 #7c3aed, 0 0 25px rgba(139, 92, 246, 0.5); }
.tile.tile-1024 .tile-inner { background: linear-gradient(180deg, #f472b6 0%, #db2777 100%); color: #ffffff; box-shadow: 0 4px 0 #be185d, 0 0 30px rgba(219, 39, 119, 0.6); }
.tile.tile-2048 .tile-inner { background: linear-gradient(180deg, #fef08a 0%, #eab308 100%); color: #713f12; box-shadow: 0 4px 0 #ca8a04, 0 0 35px rgba(234, 179, 8, 0.8); border: 2px solid #fef08a; }
.tile.tile-super .tile-inner { background: linear-gradient(180deg, #38bdf8 0%, #6366f1 100%); color: #ffffff; box-shadow: 0 4px 0 #4f46e5, 0 0 40px rgba(99, 102, 241, 0.9); }

/* Compatibility direct tile classes */
.tile-2 { color: #27272a; }
.tile-4 { color: #451a03; }
.tile-8, .tile-16, .tile-32, .tile-64, .tile-128, .tile-256, .tile-512, .tile-1024, .tile-super { color: #ffffff; }
.tile-2048 { color: #713f12; }

/* Cyberdark Theme Overrides - High Contrast Visible Tiles */
.theme-cyberdark .g2048-board-container {
    background: #0b1120;
    border: 2px solid #1e293b;
    box-shadow: 0 0 30px rgba(99, 102, 241, 0.2);
}

.theme-cyberdark .grid-cell {
    background: #151f32;
    border-radius: var(--radius-sm);
}

.theme-cyberdark .tile-1 { 
    background: linear-gradient(135deg, #ec4899, #8b5cf6); 
    color: #ffffff; 
    box-shadow: 0 0 30px rgba(236, 72, 153, 0.9); 
    border: 2px solid rgba(255, 255, 255, 0.85);
    font-weight: 900;
}
.theme-cyberdark .tile-2 { background: #1e293b; color: #f1f5f9; border: 1px solid #334155; }
.theme-cyberdark .tile-4 { background: #334155; color: #f8fafc; border: 1px solid #475569; }
.theme-cyberdark .tile-8 { background: #0284c7; color: #ffffff; box-shadow: 0 0 14px rgba(2, 132, 199, 0.6); }
.theme-cyberdark .tile-16 { background: #0ea5e9; color: #ffffff; box-shadow: 0 0 16px rgba(14, 165, 233, 0.7); }
.theme-cyberdark .tile-32 { background: #06b6d4; color: #ffffff; box-shadow: 0 0 18px rgba(6, 182, 212, 0.8); }
.theme-cyberdark .tile-64 { background: #10b981; color: #ffffff; box-shadow: 0 0 20px rgba(16, 185, 129, 0.8); }
.theme-cyberdark .tile-128 { background: #8b5cf6; color: #ffffff; box-shadow: 0 0 22px rgba(139, 92, 246, 0.9); }
.theme-cyberdark .tile-256 { background: #a855f7; color: #ffffff; box-shadow: 0 0 24px rgba(168, 85, 247, 0.9); }
.theme-cyberdark .tile-512 { background: #d946ef; color: #ffffff; box-shadow: 0 0 26px rgba(217, 70, 239, 0.95); }
.theme-cyberdark .tile-1024 { background: #ec4899; color: #ffffff; box-shadow: 0 0 28px rgba(236, 72, 153, 1); }
.theme-cyberdark .tile-2048 { background: #f43f5e; color: #ffffff; box-shadow: 0 0 35px rgba(244, 63, 94, 1); }
.theme-cyberdark .tile-super { background: linear-gradient(135deg, #00f5ff, #ff007f); color: #fff; box-shadow: 0 0 40px #00f5ff; }

/* Overlays (Win / Game Over) */
.g2048-overlay {
    position: absolute;
    inset: 0;
    background: rgba(238, 228, 218, 0.85);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    pointer-events: none;
    transition: opacity var(--transition-normal);
    z-index: 10;
    border-radius: var(--radius-lg);
    padding: 1.5rem;
}

[data-theme="dark"] .g2048-overlay {
    background: rgba(11, 15, 25, 0.88);
}

.g2048-overlay.is-visible {
    opacity: 1;
    pointer-events: auto;
}

.overlay-modal {
    text-align: center;
    transform: scale(0.85);
    transition: transform var(--transition-normal);
    max-width: 320px;
}

.g2048-overlay.is-visible .overlay-modal {
    transform: scale(1);
}

.overlay-icon {
    font-size: 3.5rem;
    margin-bottom: 0.5rem;
    animation: iconBounce 1s infinite alternate;
}

@keyframes iconBounce {
    0% { transform: translateY(0); }
    100% { transform: translateY(-8px); }
}

.overlay-title {
    font-size: 1.8rem;
    margin-bottom: 0.5rem;
    color: var(--text-primary);
}

.overlay-desc {
    font-size: 0.95rem;
    color: var(--text-secondary);
    margin-bottom: 1.5rem;
}

.overlay-actions {
    display: flex;
    gap: 0.75rem;
    justify-content: center;
}

.btn-overlay {
    padding: 0.75rem 1.4rem;
    border-radius: var(--radius-md);
    font-weight: 700;
    font-size: 0.95rem;
    cursor: pointer;
    border: none;
    transition: all var(--transition-fast);
}

.btn-keep-going {
    background: var(--bg-surface);
    color: var(--text-primary);
    border: 1px solid var(--border-color);
}

.btn-keep-going:hover {
    background: var(--bg-muted);
}

.btn-retry {
    background: var(--primary);
    color: #ffffff;
    box-shadow: 0 4px 12px rgba(245, 158, 11, 0.4);
}

.btn-retry:hover {
    background: var(--primary-hover);
    transform: translateY(-2px);
}

.g2048-mobile-hints {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.6rem;
    text-align: center;
    font-size: 0.88rem;
    font-weight: 600;
    color: var(--text-secondary);
    margin: 1.5rem auto 1.5rem;
    padding: 0.7rem 1.4rem;
    background: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-full);
    box-shadow: var(--shadow-sm);
    max-width: 420px;
}

.g2048-mobile-hints .hint-icon {
    font-size: 1.15rem;
    line-height: 1;
}

/* Game Content Accordion & Tabs below game */
.game-details-box {
    background: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 2rem;
    margin-top: 2rem;
    box-shadow: var(--shadow-sm);
}

.game-details-box h2 {
    font-size: 1.45rem;
    margin-bottom: 1rem;
    color: var(--text-primary);
}

.game-details-box p {
    font-size: 0.98rem;
    color: var(--text-secondary);
    margin-bottom: 1.25rem;
    line-height: 1.65;
}

.game-details-box ul, .game-details-box ol {
    margin-left: 1.5rem;
    margin-bottom: 1.25rem;
    color: var(--text-secondary);
}

.game-details-box li {
    margin-bottom: 0.4rem;
}

@media (max-width: 600px) {
    .game-page-container {
        padding: 0 0.5rem;
        margin: 0.5rem auto 2rem;
    }

    .game-page-header {
        margin-bottom: 0.85rem;
    }

    .game-page-title {
        font-size: 1.45rem;
        margin-bottom: 0.25rem;
    }

    .game-page-subtitle {
        font-size: 0.85rem;
        line-height: 1.4;
    }

    .g2048-header {
        margin-bottom: 0.5rem;
        gap: 0.4rem;
    }

    .g2048-badge {
        font-size: 0.72rem;
        padding: 0.25rem 0.55rem;
    }

    .g2048-scores {
        gap: 0.35rem;
    }

    .score-card {
        padding: 0.3rem 0.55rem;
        min-width: 64px;
    }

    .score-label {
        font-size: 0.6rem;
    }

    .score-val {
        font-size: 1.15rem;
    }

    .g2048-toolbar {
        gap: 0.35rem;
        margin-bottom: 0.65rem;
    }

    .btn-game-tool {
        padding: 0.5rem 0.4rem;
        font-size: 0.8rem;
        min-height: 42px;
        border-radius: var(--radius-sm);
    }

    #btn-sound {
        flex: 0 0 42px;
        min-height: 42px;
    }

    .g2048-board-container {
        --grid-gap: clamp(6px, 1.8vw, 10px);
        border-width: 3px;
        border-radius: 12px;
        margin-bottom: 0.85rem;
        touch-action: none;
        overscroll-behavior: contain;
    }

    .grid-cell {
        border-radius: 8px;
    }

    .tile, .tile-inner {
        border-radius: 8px;
    }

    /* Dense grids gap scaling */
    .g2048-wrapper[data-size="5"] .g2048-board-container { --grid-gap: 5px !important; }
    .g2048-wrapper[data-size="6"] .g2048-board-container,
    .g2048-wrapper[data-size="7"] .g2048-board-container { --grid-gap: 4px !important; }
    .g2048-wrapper[data-size="8"] .g2048-board-container { --grid-gap: 3px !important; }
    .g2048-wrapper[data-size="10"] .g2048-board-container,
    .g2048-wrapper[data-size="11"] .g2048-board-container,
    .g2048-wrapper[data-size="13"] .g2048-board-container,
    .g2048-wrapper[data-size="16"] .g2048-board-container { --grid-gap: 2px !important; }

    /* Mobile Tile Font Sizing - Prevents numbers from overflowing on 320px-420px screens */
    .g2048-wrapper[data-size="2"] .tile { font-size: clamp(2.5rem, 10vw, 4.2rem); }
    .g2048-wrapper[data-size="3"] .tile { font-size: clamp(2.0rem, 7.5vw, 3.2rem); }
    .g2048-wrapper[data-size="4"] .tile { font-size: clamp(1.6rem, 5.8vw, 2.4rem); }
    .g2048-wrapper[data-size="4"] .tile.tile-128,
    .g2048-wrapper[data-size="4"] .tile.tile-256,
    .g2048-wrapper[data-size="4"] .tile.tile-512 { font-size: clamp(1.25rem, 4.4vw, 1.8rem) !important; }
    .g2048-wrapper[data-size="4"] .tile.tile-1024,
    .g2048-wrapper[data-size="4"] .tile.tile-2048 { font-size: clamp(1.0rem, 3.6vw, 1.45rem) !important; }
    .g2048-wrapper[data-size="4"] .tile.tile-super { font-size: clamp(0.85rem, 3.0vw, 1.2rem) !important; }

    .g2048-wrapper[data-size="5"] .tile { font-size: clamp(1.1rem, 3.6vw, 1.55rem); }
    .g2048-wrapper[data-size="5"] .tile.tile-128,
    .g2048-wrapper[data-size="5"] .tile.tile-256,
    .g2048-wrapper[data-size="5"] .tile.tile-512 { font-size: clamp(0.92rem, 3.0vw, 1.25rem) !important; }
    .g2048-wrapper[data-size="5"] .tile.tile-1024,
    .g2048-wrapper[data-size="5"] .tile.tile-2048 { font-size: clamp(0.78rem, 2.4vw, 1.05rem) !important; }

    .g2048-wrapper[data-size="6"] .tile { font-size: clamp(0.85rem, 2.7vw, 1.2rem); }
    .g2048-wrapper[data-size="6"] .tile.tile-128,
    .g2048-wrapper[data-size="6"] .tile.tile-256,
    .g2048-wrapper[data-size="6"] .tile.tile-512 { font-size: clamp(0.7rem, 2.2vw, 0.95rem) !important; }

    .g2048-wrapper[data-size="7"] .tile { font-size: clamp(0.72rem, 2.2vw, 1.0rem); }
    .g2048-wrapper[data-size="8"] .tile { font-size: clamp(0.62rem, 1.8vw, 0.85rem); }
    .g2048-wrapper[data-size="8"] .tile.tile-128,
    .g2048-wrapper[data-size="8"] .tile.tile-256,
    .g2048-wrapper[data-size="8"] .tile.tile-512 { font-size: clamp(0.5rem, 1.5vw, 0.7rem) !important; }

    .g2048-wrapper[data-grid="2x3"] .tile { font-size: clamp(1.8rem, 6vw, 3.0rem); }
    .g2048-wrapper[data-grid="3x4"] .tile { font-size: clamp(1.6rem, 5vw, 2.5rem); }

    .g2048-mobile-hints {
        margin-top: 0.75rem;
        font-size: 0.8rem;
        padding: 0.45rem 0.85rem;
    }

    .game-details-box {
        padding: 1.25rem 1rem;
        margin-top: 1.5rem;
    }
}
