/*
 * gry.css  (Etap C split, 2026-06-22)
 * Wydzielone z wlasny.css: MEMO GAME + STREFA RELAKSU (gry).
 * Ladowane WARUNKOWO tylko na stronie agencja (memo-game.php).
 * #scrollTopBtn (mobile, globalny) ZOSTAWIONY w wlasny.css.
 */

/* ==========================================================================
   MEMO GAME STYLES
   ========================================================================== */

.memo-section {
    background-color: #ffffff;
    padding: 60px 20px;
    margin-top: 40px;
}

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

.memo-title {
    color: #727272;
    font-family: var(--font-sans);
    font-size: 1.5rem;
    font-weight: 700;
    text-align: center;
    margin-bottom: 40px;
    letter-spacing: 0.04em;
    word-spacing: 0.15em;
}

.memo-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 30px;
    flex-wrap: wrap;
    gap: 20px;
}

.memo-instructions {
    color: #666666;
    font-family: var(--font-sans);
    font-size: 1rem;
    margin: 0;
}

.memo-controls {
    display: flex;
    align-items: center;
    gap: 20px;
}

.memo-restart-btn {
    background-color: #727272;
    color: #ffffff;
    font-family: var(--font-sans);
    border: none;
    padding: 12px 24px;
    border-radius: 8px;
    font-size: 0.95rem;
    font-weight: 500;
    cursor: pointer;
    transition: background-color 0.2s ease;
}

.memo-restart-btn:hover {
    background-color: #555555;
}

.memo-moves {
    display: flex;
    align-items: center;
    gap: 10px;
    color: #666666;
    font-family: var(--font-sans);
    font-size: 0.95rem;
}

.memo-moves-number {
    background-color: #f5f5f5;
    color: #333333;
    padding: 8px 16px;
    border-radius: 6px;
    min-width: 50px;
    text-align: center;
    border: 1px solid #dddddd;
}

.memo-board {
    display: grid;
    grid-template-columns: repeat(8, 1fr);
    gap: 12px;
    max-width: 1000px;
    margin: 0 auto;
}

.memo-card {
    aspect-ratio: 1;
    perspective: 1000px;
    cursor: pointer;
}

.memo-card-inner {
    position: relative;
    width: 100%;
    height: 100%;
    transition: transform 0.5s ease;
    transform-style: preserve-3d;
}

.memo-card.flipped .memo-card-inner {
    transform: rotateY(180deg);
}

.memo-card.matched .memo-card-inner {
    transform: rotateY(180deg);
}

.memo-card-front,
.memo-card-back {
    position: absolute;
    width: 100%;
    height: 100%;
    backface-visibility: hidden;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.memo-card-front {
    background-color: #e8e8e8;
    border: 2px solid #d0d0d0;
    background-image: url('../img/wspolne/memo/memo_kwadrat_glowny.svg');
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
}

.memo-card-back {
    transform: rotateY(180deg);
    border: 2px solid transparent;
}

.memo-card-back img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 8px;
}

.memo-card-back .memo-placeholder {
    font-size: 0.7rem;
    color: #333;
    text-align: center;
    padding: 5px;
    word-break: break-all;
}

/* Card colors - matching pairs */
.memo-card[data-color="coral"] .memo-card-back { background-color: #d4887a; }
.memo-card[data-color="sage"] .memo-card-back { background-color: #8a9a7b; }
.memo-card[data-color="mint"] .memo-card-back { background-color: #a8c4b8; }
.memo-card[data-color="rose"] .memo-card-back { background-color: #c9899a; }
.memo-card[data-color="lavender"] .memo-card-back { background-color: #9a8ac4; }
.memo-card[data-color="sky"] .memo-card-back { background-color: #7a9ac4; }
.memo-card[data-color="peach"] .memo-card-back { background-color: #d4a87a; }
.memo-card[data-color="olive"] .memo-card-back { background-color: #8a9a6b; }

/* Matched cards effect */
.memo-card.matched {
    opacity: 0.85;
    pointer-events: none;
}

/* Win modal */
.memo-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.8);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
}

.memo-modal-content {
    background-color: #ffffff;
    padding: 40px 60px;
    border-radius: 16px;
    text-align: center;
    color: #333333;
    box-shadow: 0 10px 40px rgba(0,0,0,0.3);
}

.memo-modal-content h3 {
    font-family: var(--font-sans);
    font-size: 2rem;
    margin-bottom: 15px;
    color: #727272;
}

.memo-modal-content p {
    font-family: var(--font-sans);
    font-size: 1.1rem;
    color: #666666;
    margin-bottom: 25px;
}

/* Responsive */
@media (max-width: 900px) {
    .memo-board {
        grid-template-columns: repeat(6, 1fr);
    }
}

@media (max-width: 600px) {
    .memo-board {
        grid-template-columns: repeat(4, 1fr);
        gap: 8px;
    }
    
    .memo-title {
        font-size: 2rem;
    }
    
    .memo-header {
        flex-direction: column;
        align-items: flex-start;
    }
    
    .memo-controls {
        width: 100%;
        justify-content: space-between;
    }
}

@media (max-width: 400px) {
    .memo-board {
        grid-template-columns: repeat(4, 1fr);
        gap: 6px;
    }
}

/* ==========================================================================
   STREFA RELAKSU - Zakładki z grami (wewnątrz memo-section)
   ========================================================================== */

/* Zakładki gier */
.relax-tabs {
    display: flex;
    justify-content: center;
    flex-wrap: wrap;
    gap: 12px;
    margin-bottom: 30px;
}

.relax-tab {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px 24px;
    background: #ffffff;
    border: 1px solid #333333;
    border-radius: 25px;
    font-family: var(--font-sans);
    font-size: 0.95rem;
    font-weight: 500;
    color: #333333;
    cursor: pointer;
    transition: all 0.3s ease;
}

.relax-tab:hover {
    background: #f8f9fa;
    border-color: #555555;
}

.relax-tab.active {
    background: #333333;
    color: #ffffff;
    border-color: #333333;
}

.relax-tab i {
    font-size: 1.1rem;
}

/* Kontener gry */
.relax-game-container {
    border: 1px solid #333333;
    border-radius: 20px;
    padding: 30px;
    background: #ffffff;
    overflow: hidden;
    max-width: 100%;
    box-sizing: border-box;
}

/* Fnake - tło z grafiką (lazy loaded via JS) */
#game-snake {
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    border-radius: 12px;
    padding: 20px;
    margin: -10px;
}
#game-snake.bg-loaded {
    background-image: url('../img/wspolne/memo/fnake-background.svg');
}

#game-snake .game-canvas-wrapper canvas {
    background: rgba(255, 255, 255, 0.1);
}

#game-snake .game-header {
    background: rgba(255, 255, 255, 0.5);
    padding: 15px;
    border-radius: 10px;
    margin-bottom: 20px;
}

#game-snake .game-overlay {
    background: transparent;
}

#game-snake .game-overlay .overlay-content {
    background: rgba(255, 255, 255, 0.95);
    padding: 40px;
    border-radius: 12px;
}

#game-puzzle {
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    border-radius: 12px;
    padding: 20px;
    margin: -10px;
}
#game-puzzle.bg-loaded {
    background-image: url('../img/wspolne/memo/fuzzle-background.svg');
}

#game-puzzle .game-canvas-wrapper canvas {
    background: rgba(255, 255, 255, 0.1);
}

#game-puzzle .game-header {
    background: rgba(255, 255, 255, 0.6);
    padding: 15px;
    border-radius: 10px;
    margin-bottom: 20px;
}

#game-puzzle .game-overlay {
    background: transparent;
}

#game-puzzle .game-overlay .overlay-content {
    background: rgba(255, 255, 255, 0.95);
    padding: 40px;
    border-radius: 12px;
}

/* Frickout - tło z grafiką (lazy loaded via JS) */
#game-breakout {
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    border-radius: 12px;
    padding: 20px;
    margin: -10px;
}
#game-breakout.bg-loaded {
    background-image: url('../img/wspolne/memo/frickout-background.svg');
}

#game-breakout .game-canvas-wrapper canvas {
    background: rgba(255, 255, 255, 0.1);
}

#game-breakout .game-header {
    background: rgba(255, 255, 255, 0.5);
    padding: 15px;
    border-radius: 10px;
    margin-bottom: 20px;
}

#game-breakout .game-overlay {
    background: transparent;
}

#game-breakout .game-overlay .overlay-content {
    background: rgba(255, 255, 255, 0.95);
    padding: 40px;
    border-radius: 12px;
}

#game-pong {
    background-image: url('../img/wspolne/memo/tlo.webp');
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    border-radius: 12px;
    padding: 20px;
    margin: -10px;
}

#game-pong .game-canvas-wrapper canvas {
    background: rgba(255, 255, 255, 0.1);
}

#game-pong .game-header {
    background: rgba(255, 255, 255, 0.6);
    padding: 15px;
    border-radius: 10px;
    margin-bottom: 20px;
}

#game-pong .game-overlay {
    background: transparent;
}

#game-pong .game-overlay .overlay-content {
    background: rgba(255, 255, 255, 0.95);
    padding: 40px;
    border-radius: 12px;
}

#game-pong .pong-wrapper {
    position: relative;
    display: flex;
    justify-content: center;
    align-items: center;
}

#game-pong .pong-player-img {
    position: absolute;
    left: 0;
    top: 50%;
    transform: translateY(-50%);
    height: 70%;
    width: auto;
    opacity: 0.62;
    pointer-events: none;
    z-index: 0;
}

#game-pong .pong-cpu-img {
    position: absolute;
    right: 0;
    top: 50%;
    transform: translateY(-50%);
    height: 70%;
    width: auto;
    opacity: 0.62;
    pointer-events: none;
    z-index: 0;
}

#game-pong .game-canvas-wrapper canvas {
    position: relative;
    z-index: 2;
}

.relax-game {
    display: none;
}

.relax-game.active {
    display: block;
}

/* Nagłówek gry */
.game-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 30px;
    flex-wrap: wrap;
    gap: 20px;
}

.game-instructions {
    color: #666666;
    font-family: var(--font-sans);
    font-size: 1rem;
    margin: 0;
}

.game-controls {
    display: flex;
    align-items: center;
    gap: 20px;
    flex-wrap: wrap;
}

.game-btn {
    background-color: #727272;
    color: #ffffff;
    font-family: var(--font-sans);
    border: none;
    padding: 12px 24px;
    border-radius: 8px;
    font-size: 0.95rem;
    font-weight: 500;
    cursor: pointer;
    transition: background-color 0.2s ease;
}

.game-btn:hover {
    background-color: #555555;
}

.game-score {
    display: flex;
    align-items: center;
    gap: 10px;
    color: #666666;
    font-family: var(--font-sans);
    font-size: 0.95rem;
}

.game-score-value {
    background-color: #f5f5f5;
    color: #333333;
    padding: 8px 16px;
    border-radius: 6px;
    min-width: 50px;
    text-align: center;
    border: 1px solid #dddddd;
    font-weight: 600;
}

/* Canvas games wrapper */
.game-canvas-wrapper {
    position: relative;
    display: flex;
    justify-content: center;
    margin: 0 auto;
}

.game-canvas-wrapper canvas {
    border: 1px solid #e0e0e0;
    border-radius: 12px;
    max-width: 100%;
    height: auto;
}

/* Specific aspect ratios for each game canvas */
#snake-canvas {
    aspect-ratio: 400 / 400; /* 1:1 square */
}

#puzzle-canvas {
    aspect-ratio: 320 / 320; /* 1:1 square */
}

#pong-canvas {
    aspect-ratio: 600 / 400; /* 3:2 ratio */
}

#breakout-canvas {
    aspect-ratio: 600 / 450; /* 4:3 ratio */
}

/* Mobile: override inline styles from JS to enable responsive scaling */
@media (max-width: 650px) {
    .game-canvas-wrapper canvas {
        width: 100% !important;
        height: auto !important;
    }


    /* Center and resize restart buttons on mobile */
    .game-controls {
        justify-content: center !important;
    }

    /* Memo controls - wrap button to new line and center */
    .memo-controls {
        flex-wrap: wrap !important;
        justify-content: center !important;
        gap: 10px !important;
    }

    .memo-controls .memo-restart-btn {
        width: 100%;
        order: 3; /* Put button last (below scores) */
    }

    .game-btn,
    .memo-restart-btn {
        padding: 10px 20px;
        font-size: 0.9rem;
    }
}

/* Game overlay */
.game-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(255, 255, 255, 0.95);
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 12px;
    z-index: 10;
}

.overlay-content {
    text-align: center;
    font-family: var(--font-sans);
    color: #333333;
}

.overlay-content p {
    margin: 10px 0;
    font-size: 1rem;
}

.overlay-content .mobile-hint {
    font-size: 0.85rem;
    color: #888888;
}

/* Tetris specific */
.tetris-wrapper {
    display: flex;
    justify-content: center;
    gap: 20px;
    flex-wrap: wrap;
}

.tetris-side {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.tetris-next {
    background: #f8f9fa;
    border: 1px solid #e0e0e0;
    border-radius: 12px;
    padding: 15px;
    text-align: center;
}

.tetris-next span {
    display: block;
    font-family: var(--font-sans);
    font-size: 0.85rem;
    color: #666666;
    margin-bottom: 10px;
}

.tetris-next canvas {
    border: none !important;
}

/* Mobile controls */
.mobile-controls {
    display: none;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    margin-top: 20px;
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
}

.mobile-btn-row {
    display: flex;
    gap: 58px;
    flex-wrap: wrap;
    justify-content: center;
}

.mobile-btn {
    width: 60px;
    height: 60px;
    border: 1px solid #333333;
    border-radius: 12px;
    background: #ffffff;
    color: #333333;
    font-size: 1.5rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    -webkit-tap-highlight-color: transparent;
    user-select: none;
}

.mobile-btn:active {
    background: #333333;
    color: #ffffff;
}

.mobile-controls-horizontal {
    flex-direction: row;
    justify-content: space-between;
    width: 100%;
}

.mobile-controls-pong {
    flex-direction: row;
    gap: 25px;
    flex-wrap: nowrap;
    justify-content: center;
    padding: 15px 0;
    margin-top: 10px;
}

.mobile-controls-pong .mobile-btn {
    width: 70px;
    height: 70px;
    flex-shrink: 0;
    font-size: 1.6rem;
    border-radius: 50%;
    box-shadow: 0 4px 15px rgba(0,0,0,0.15);
    background: linear-gradient(145deg, #ffffff, #f0f0f0);
    border: 2px solid #e0e0e0;
}

.mobile-controls-pong .mobile-btn:active {
    background: linear-gradient(145deg, #333333, #555555);
    transform: scale(0.95);
}

/* Responsive dla nowych gier */
@media (max-width: 768px) {
    .relax-game-container {
        padding: 20px;
        border-radius: 15px;
    }

    .relax-tabs {
        gap: 8px;
    }

    .relax-tab {
        padding: 10px 16px;
        font-size: 0.85rem;
    }

    .relax-tab span {
        display: none;
    }

    .relax-tab i {
        font-size: 1.3rem;
    }

    .game-header {
        flex-direction: column;
        align-items: flex-start;
    }

    .game-controls {
        width: 100%;
        justify-content: space-between;
    }

    .mobile-controls {
        display: flex;
    }

    .game-canvas-wrapper canvas {
        max-width: 100%;
    }
}

@media (max-width: 600px) {
    .game-score {
        font-size: 0.85rem;
    }

    .game-score-value {
        padding: 6px 12px;
        min-width: 40px;
    }

    .mobile-btn {
        width: 50px;
        height: 50px;
        font-size: 1.2rem;
    }

    .mobile-controls-pong .mobile-btn {
        width: 60px;
        height: 60px;
    }
}

@media (max-width: 400px) {
    .game-btn {
        padding: 10px 16px;
        font-size: 0.85rem;
    }

    .mobile-btn {
        width: 44px;
        height: 44px;
        font-size: 1rem;
        border-radius: 10px;
    }

    .mobile-controls-pong .mobile-btn {
        width: 52px;
        height: 52px;
    }

    .mobile-controls {
        gap: 6px;
    }

    .mobile-btn-row {
        gap: 56px;
    }
}

@media (max-width: 360px) {
    .mobile-btn {
        width: 40px;
        height: 40px;
        font-size: 0.9rem;
        border-radius: 8px;
    }

    .mobile-controls-pong .mobile-btn {
        width: 46px;
        height: 46px;
    }

    .mobile-controls-pong {
        gap: 10px;
    }

    .game-canvas-wrapper {
        margin: 0 -10px;
    }

    .game-score {
        font-size: 0.8rem;
    }

    .game-score-value {
        padding: 4px 8px;
        min-width: 35px;
    }

    .relax-game-container {
        padding: 12px;
    }
}

@media (max-width: 320px) {
    .mobile-btn {
        width: 36px;
        height: 36px;
        font-size: 0.85rem;
    }

    .mobile-controls-pong .mobile-btn {
        width: 42px;
        height: 42px;
    }

    .mobile-controls {
        gap: 4px;
    }

    .mobile-btn-row {
        gap: 54px;
    }

    .game-header {
        gap: 8px;
    }

    .game-btn {
        padding: 8px 12px;
        font-size: 0.75rem;
    }
}
