/* Tetris Game Styles - Legends of Jix Theme */
.tetris-container {
    max-width: 1400px;
}

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

.tetris-header h1 {
    background: linear-gradient(135deg, #14b8a6 0%, #0ea5e9 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    font-size: 2.5em;
    font-weight: bold;
    margin: 0;
}

.game-stats {
    display: flex;
    gap: 15px;
    flex-wrap: wrap;
}

.stat-item {
    background: linear-gradient(135deg, #14b8a6 0%, #0ea5e9 100%);
    color: white;
    padding: 10px 20px;
    border-radius: 10px;
    font-size: 1.1em;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

.stat-label {
    font-weight: bold;
    margin-right: 5px;
}

.tetris-game-area {
    display: flex;
    gap: 20px;
    justify-content: center;
    flex-wrap: wrap;
    position: relative;
    overflow: visible;
}

.tetris-sidebar {
    display: flex;
    flex-direction: column;
    gap: 20px;
    min-width: 150px;
}

.next-piece-container {
    background: rgba(255, 255, 255, 0.95);
    border-radius: 15px;
    padding: 15px;
    text-align: center;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
}

.next-piece-container h3 {
    margin: 0 0 10px 0;
    color: #0d9488;
    font-size: 1.2em;
}

#nextCanvas {
    border: 2px solid #14b8a6;
    border-radius: 8px;
    background: #f0fdfa;
    display: block;
    margin: 0 auto;
    box-shadow: 0 4px 10px rgba(20, 184, 166, 0.2);
    image-rendering: -webkit-optimize-contrast;
    image-rendering: crisp-edges;
}

.tetris-main {
    flex: 1;
    display: flex;
    justify-content: center;
    position: relative;
    overflow: visible;
    min-width: 0; /* Allow flex shrinking */
}

.canvas-wrapper {
    display: flex;
    gap: 10px;
    align-items: flex-start;
    position: relative;
}

.jix-canvas {
    border: 2px solid rgba(20, 184, 166, 0.3);
    border-radius: 12px;
    background: linear-gradient(135deg, rgba(15, 23, 42, 0.8) 0%, rgba(30, 41, 59, 0.8) 100%);
    box-shadow: 0 8px 20px rgba(20, 184, 166, 0.2);
    display: block;
}

.tetris-game-area {
    position: relative;
    overflow: visible;
}

#gameCanvas {
    border: 3px solid #14b8a6;
    border-radius: 12px;
    background: #0f172a;
    box-shadow: 
        0 15px 40px rgba(20, 184, 166, 0.3),
        inset 0 0 20px rgba(20, 184, 166, 0.1);
    display: block;
    touch-action: none;
    -webkit-tap-highlight-color: transparent;
    image-rendering: -webkit-optimize-contrast;
    image-rendering: crisp-edges;
    image-rendering: pixelated;
}

.game-controls-panel {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.game-btn {
    background: linear-gradient(135deg, #14b8a6 0%, #0ea5e9 100%);
    color: white;
    border: none;
    padding: 12px 20px;
    font-size: 1em;
    border-radius: 10px;
    cursor: pointer;
    font-weight: 600;
    transition: transform 0.2s, box-shadow 0.2s;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

.game-btn:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 6px 12px rgba(20, 184, 166, 0.3);
}

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

.btn-danger {
    background: linear-gradient(135deg, #ef4444 0%, #dc2626 100%);
}

.controls-info {
    margin-top: 20px;
    text-align: center;
    color: #555;
    font-size: 0.9em;
}

.controls-info p {
    margin: 5px 0;
}

.mobile-controls {
    display: none;
}

/* Tetris Touch Controls */
.tetris-touch-controls {
    display: none;
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    width: 100%;
    padding: 20px;
    z-index: 10000;
    pointer-events: none;
    gap: 15px;
    flex-direction: column;
    align-items: center;
}

.touch-control-row {
    display: flex;
    gap: 15px;
    pointer-events: auto;
    justify-content: center;
}

.tetris-touch-controls .touch-btn {
    background: rgba(20, 184, 166, 0.85);
    border: 3px solid rgba(255, 255, 255, 0.5);
    border-radius: 50%;
    width: 65px;
    height: 65px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.8rem;
    color: white;
    cursor: pointer;
    user-select: none;
    -webkit-user-select: none;
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.3);
    transition: transform 0.1s ease, background 0.1s ease;
    pointer-events: auto;
    font-weight: bold;
}

.tetris-touch-controls .touch-btn:active,
.tetris-touch-controls .touch-btn.active {
    transform: scale(0.9);
    background: rgba(20, 184, 166, 1);
}

.tetris-rotate {
    background: rgba(103, 232, 249, 0.85) !important;
}

.tetris-rotate:active,
.tetris-rotate.active {
    background: rgba(103, 232, 249, 1) !important;
}

.tetris-hard-drop {
    background: rgba(59, 130, 246, 0.85) !important;
}

.tetris-hard-drop:active,
.tetris-hard-drop.active {
    background: rgba(59, 130, 246, 1) !important;
}

/* Fullscreen Styles */
.tetris-container.fullscreen {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    max-width: 100vw;
    border-radius: 0;
    padding: 0;
    z-index: 9999;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.tetris-container.fullscreen .back-home-link,
.tetris-container.fullscreen .game-notice,
.tetris-container.fullscreen .controls-info {
    display: none;
}

.tetris-container.fullscreen .tetris-header {
    padding: 10px 20px;
    margin-bottom: 10px;
}

.tetris-container.fullscreen .tetris-game-area {
    flex: 1;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
}

.tetris-container.fullscreen #gameCanvas {
    border-radius: 0;
    border: none;
}

.tetris-container.fullscreen .canvas-wrapper {
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.tetris-container.fullscreen .jix-canvas {
    display: none; /* Hide Jix in fullscreen to maximize game area */
}

.tetris-container.fullscreen .tetris-touch-controls {
    display: flex;
}

/* Responsive Design */
@media (max-width: 768px) {
    .tetris-header {
        flex-direction: column;
        align-items: flex-start;
    }

    .tetris-header h1 {
        font-size: 2em;
    }

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

    .stat-item {
        flex: 1;
        min-width: 0;
        padding: 8px 12px;
        font-size: 0.95em;
        text-align: center;
    }

    .tetris-game-area {
        flex-direction: column;
    }

    .tetris-sidebar {
        width: 100%;
        flex-direction: row;
        justify-content: space-around;
    }

    .next-piece-container {
        flex: 1;
    }

    .game-controls-panel {
        flex-direction: row;
        flex-wrap: wrap;
        flex: 1;
    }

    .game-btn {
        flex: 1;
        min-width: 80px;
        padding: 10px 15px;
        font-size: 0.9em;
    }

    .canvas-wrapper {
        width: 100%;
        justify-content: center;
    }

    #gameCanvas {
        width: 100%;
        max-width: 100%;
    }

    .jix-canvas {
        display: none; /* Hide Jix on mobile to save space */
    }

    .desktop-controls {
        display: none;
    }

    .mobile-controls {
        display: block;
        font-weight: 600;
        color: #14b8a6;
    }

    .tetris-touch-controls {
        display: flex;
    }
}

@media (max-width: 480px) {
    .tetris-header h1 {
        font-size: 1.5em;
    }

    .stat-item {
        padding: 6px 10px;
        font-size: 0.85em;
    }

    .tetris-touch-controls .touch-btn {
        width: 55px;
        height: 55px;
        font-size: 1.5rem;
    }

    .tetris-touch-controls {
        padding: 15px;
        gap: 12px;
    }

    .touch-control-row {
        gap: 12px;
    }

    .canvas-wrapper {
        flex-direction: column;
    }
}

@media (orientation: landscape) and (max-height: 500px) {
    .tetris-touch-controls .touch-btn {
        width: 50px;
        height: 50px;
        font-size: 1.3rem;
    }

    .tetris-touch-controls {
        padding: 10px;
    }
}

/* Overlay Styles */
.overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 10000;
}

.overlay.hidden {
    display: none;
}

.overlay-content {
    background: linear-gradient(135deg, #ffffff 0%, #f8f9fa 100%);
    padding: 40px;
    border-radius: 20px;
    text-align: center;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
    max-width: 500px;
    width: 90%;
    animation: fadeIn 0.3s ease-in;
    border: 3px solid rgba(20, 184, 166, 0.3);
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: scale(0.9);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

.overlay-content h2 {
    color: #14b8a6;
    margin-bottom: 20px;
    font-size: 2.5em;
    background: linear-gradient(135deg, #14b8a6 0%, #0ea5e9 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.overlay-content p {
    color: #555;
    margin: 10px 0;
    font-size: 1.1em;
}

.overlay-content span {
    color: #14b8a6;
    font-weight: bold;
    font-size: 1.2em;
}

/* Splash Screen Styles */
.splash-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, #0f172a 0%, #1e293b 50%, #334155 100%);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 20000;
    animation: fadeIn 0.5s ease-in;
}

.splash-overlay.hidden {
    display: none;
}

.splash-content {
    text-align: center;
    max-width: 600px;
    padding: 40px;
    background: rgba(255, 255, 255, 0.95);
    border-radius: 25px;
    box-shadow: 0 25px 80px rgba(20, 184, 166, 0.4);
    border: 3px solid rgba(20, 184, 166, 0.3);
    animation: fadeIn 0.5s ease-out;
}

.splash-title h1 {
    font-size: 3rem;
    background: linear-gradient(135deg, #14b8a6 0%, #0ea5e9 50%, #3b82f6 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin-bottom: 10px;
    text-shadow: none;
}

.splash-subtitle {
    font-size: 1.3rem;
    color: #0d9488;
    margin-bottom: 20px;
    font-weight: 600;
    letter-spacing: 2px;
}

.splash-character {
    font-size: 6rem;
    margin: 20px 0;
    animation: bounce 2s ease-in-out infinite;
}

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

.splash-description {
    color: #555;
    font-size: 1rem;
    line-height: 1.6;
    margin: 20px 0;
}

.splash-description p {
    margin: 10px 0;
}

.splash-features {
    display: flex;
    justify-content: center;
    flex-wrap: wrap;
    gap: 12px;
    margin: 20px 0;
}

.splash-feature {
    background: linear-gradient(135deg, rgba(20, 184, 166, 0.15) 0%, rgba(14, 165, 233, 0.15) 100%);
    border: 2px solid rgba(20, 184, 166, 0.4);
    border-radius: 25px;
    padding: 10px 20px;
    color: #0d9488;
    font-weight: 600;
    font-size: 0.9rem;
    transition: all 0.3s ease;
}

.splash-feature:hover {
    transform: translateY(-3px);
    box-shadow: 0 4px 15px rgba(20, 184, 166, 0.3);
}

.splash-btn {
    margin-top: 25px;
    padding: 15px 40px;
    font-size: 1.2rem;
    background: linear-gradient(135deg, #14b8a6 0%, #0ea5e9 100%);
    color: white;
    border: none;
    border-radius: 30px;
    cursor: pointer;
    font-weight: 700;
    transition: all 0.3s ease;
    box-shadow: 0 8px 25px rgba(20, 184, 166, 0.4);
}

.splash-btn:hover {
    transform: scale(1.05);
    box-shadow: 0 12px 35px rgba(20, 184, 166, 0.6);
}

@media (max-width: 768px) {
    .splash-content {
        padding: 25px;
        margin: 20px;
        max-width: 90%;
    }

    .splash-title h1 {
        font-size: 2rem;
    }

    .splash-subtitle {
        font-size: 1rem;
    }

    .splash-character {
        font-size: 4rem;
    }

    .splash-feature {
        padding: 8px 15px;
        font-size: 0.85rem;
    }

    .splash-btn {
        padding: 12px 30px;
        font-size: 1rem;
    }
}
