@import url('https://fonts.googleapis.com/css2?family=Press+Start+2P&display=swap');

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

body {
    margin: 0;
    padding: 0;
    background: linear-gradient(135deg, #1a1a2e 0%, #16213e 50%, #0f3460 100%);
    color: #fff;
    font-family: 'Press Start 2P', cursive;
    display: flex;
    justify-content: center;
    align-items: center;
    height: 100vh;
    overflow: hidden;
    padding-top: 80px; /* Add padding at the top */
}

/* Utility classes */
.mt-2 {
    margin-top: 10px;
}

.mt-4 {
    margin-top: 20px;
}

/* Star background */
.stars {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: url('https://i.imgur.com/YKY28eT.png') repeat top center;
    z-index: 0;
}

.twinkling {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: url('https://i.imgur.com/XYMF4ca.png') repeat top center;
    z-index: 1;
    animation: move-twink-back 200s linear infinite;
}

@keyframes move-twink-back {
    from {background-position: 0 0;}
    to {background-position: -10000px 5000px;}
}

.game-container {
    display: flex;
    gap: 60px; /* Further increased gap for better separation */
    padding: 30px;
    background: rgba(0, 0, 0, 0.6);
    border-radius: 10px;
    box-shadow: 0 0 20px rgba(0, 0, 0, 0.8);
    position: relative;
    z-index: 10;
    max-width: 1400px; /* Further increased max-width to accommodate more space */
    margin-top: 40px; /* Add top margin */
    align-items: flex-start; /* Align items to the top */
}

.score-container {
    min-width: 200px;
    padding: 15px;
    background: rgba(51, 51, 51, 0.8);
    border-radius: 8px;
    border: 2px solid #444;
    box-shadow: 0 0 10px rgba(0, 0, 0, 0.5);
    display: flex;
    flex-direction: column;
    justify-content: space-around;
    width: 180px; /* Ensure width is sufficient */
}

.score-container p {
    margin: 15px 0;
    font-size: 14px;
    text-shadow: 0 0 5px #00ffff, 0 0 10px #00ffff;
}

.score-container span {
    color: #ff9900;
    font-size: 18px;
    text-shadow: 0 0 5px #ff9900, 0 0 10px #ff9900;
}

.game-btn {
    margin-top: 15px;
    background: linear-gradient(45deg, #ff00dd, #00ddff);
    border: none;
    color: white;
    padding: 10px 15px;
    font-family: 'Press Start 2P', cursive;
    font-size: 12px;
    border-radius: 5px;
    cursor: pointer;
    transition: all 0.2s;
    box-shadow: 0 0 10px rgba(0, 255, 255, 0.5);
}

.game-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 0 15px rgba(0, 255, 255, 0.8);
}

.game-btn:active {
    transform: translateY(1px);
}

.game-wrapper {
    position: relative;
    margin-right: 0; /* Remove the right margin */
}

canvas {
    border: 4px solid #444;
    background-color: #000;
    box-shadow: 0 0 15px rgba(0, 255, 255, 0.5);
}

/* Game title */
.game-title {
    position: absolute;
    top: 20px;
    left: 0;
    right: 0;
    text-align: center;
    font-size: 36px;
    letter-spacing: 3px;
    color: transparent;
    background: linear-gradient(45deg, #ff00ff, #00ffff);
    -webkit-background-clip: text;
    background-clip: text;
    text-shadow: 0 0 10px rgba(255, 0, 255, 0.5);
    z-index: 20;
    pointer-events: none; /* Allow clicking through the title */
    margin-bottom: 10px;
}

#next-piece-preview {
    position: relative; /* Change from absolute to relative */
    top: auto;
    left: auto; /* Remove positioning outside game wrapper */
    margin: 0 0 15px 0; /* Add bottom margin instead of left margin */
    background: rgba(51, 51, 51, 0.8);
    padding: 10px;
    border-radius: 8px;
    border: 2px solid #444;
    box-shadow: 0 0 10px rgba(0, 0, 0, 0.5);
    display: flex;
    flex-direction: column;
    align-items: center;
    width: 90%; /* Adjust width to fit score container better */
    box-sizing: border-box;
    z-index: 5;
}

#next-piece-preview h3 {
    margin-bottom: 10px;
    font-size: 14px;
    color: #00ffff;
    text-shadow: 0 0 5px #00ffff, 0 0 10px #00ffff;
}

#next-piece {
    background-color: #000;
    border: 2px solid #444;
}

.controls-info {
    min-width: 260px;
    max-width: 260px;
    padding: 15px;
    background: rgba(51, 51, 51, 0.8);
    border-radius: 8px;
    border: 2px solid #444;
    box-shadow: 0 0 10px rgba(0, 0, 0, 0.5);
    max-height: 640px;
    overflow-y: auto;
    position: relative;
    z-index: 15;
    margin-left: 20px; /* Reduce from 160px to 20px */
}

.controls-info h3 {
    margin-top: 0;
    margin-bottom: 15px;
    text-align: center;
    font-size: 16px; /* Slightly reduced font size */
    color: #00ffff;
    text-shadow: 0 0 5px #00ffff, 0 0 10px #00ffff;
    position: sticky; /* Make headers sticky when scrolling */
    top: 0;
    background: rgba(51, 51, 51, 0.9);
    padding: 5px 0;
    z-index: 5;
}

.controls-info p {
    margin: 8px 0; /* Reduced margin */
    font-size: 11px; /* Reduced font size */
    line-height: 1.6;
}

/* Key highlights */
.key {
    display: inline-block;
    background: #333;
    color: #fff;
    padding: 3px 6px; /* Reduced padding */
    border-radius: 4px;
    box-shadow: 0 2px 0 #222;
    min-width: 18px; /* Reduced min-width */
    text-align: center;
    margin: 0 2px; /* Reduced margin */
    font-size: 10px; /* Added smaller font size */
}

/* Controller button highlights */
.ctrl {
    display: inline-block;
    background: #2a2a5a;
    color: #fff;
    padding: 3px 6px; /* Reduced padding */
    border-radius: 4px;
    box-shadow: 0 2px 0 #1a1a3a;
    min-width: 18px; /* Reduced min-width */
    text-align: center;
    margin: 0 2px; /* Reduced margin */
    font-size: 10px; /* Added smaller font size */
}

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

.modal.active {
    display: flex;
}

.modal-content {
    background: rgba(10, 10, 20, 0.85);
    border: 2px solid rgba(0, 255, 255, 0.6);
    border-radius: 10px;
    color: white;
    padding: 20px;
    width: 90%;
    max-width: 500px;
    box-shadow: 0 0 30px rgba(0, 255, 255, 0.5);
    text-align: center;
}

.modal h2 {
    margin-top: 0;
    color: #00ffff;
    text-shadow: 0 0 10px rgba(0, 255, 255, 0.7);
    text-transform: uppercase;
    letter-spacing: 2px;
}

.modal-content p {
    margin-bottom: 20px;
    font-size: 16px;
}

#final-score {
    color: #00ffff;
    font-size: 22px;
    text-shadow: 0 0 10px #00ffff;
}

/* Controller message */
.controller-message {
    position: fixed;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(0, 0, 0, 0.8);
    color: #00ffff;
    padding: 10px 20px;
    border-radius: 5px;
    border: 2px solid #00ffff;
    font-family: 'Press Start 2P', cursive;
    font-size: 12px;
    text-align: center;
    z-index: 1000;
    box-shadow: 0 0 15px rgba(0, 255, 255, 0.5);
    transition: opacity 0.5s ease;
}

.controller-message.fade-out {
    opacity: 0;
}

/* Controller indicator in controls panel */
.controller-indicator {
    margin-top: 20px;
    padding: 10px;
    background-color: rgba(0, 0, 0, 0.5);
    border-radius: 5px;
    text-align: center;
    font-size: 11px;
    transition: all 0.3s ease;
}

.controller-indicator.connected {
    border: 2px solid #00ff00;
    color: #00ff00;
    text-shadow: 0 0 5px #00ff00;
}

.controller-indicator.disconnected {
    border: 2px solid #ff0000;
    color: #ff6666;
}

#controller-mapping {
    opacity: 0.8;
}

#controller-mapping p {
    font-size: 10px;
}

/* Animations for various elements */
@keyframes glow {
    0% { box-shadow: 0 0 5px rgba(0, 255, 255, 0.5); }
    50% { box-shadow: 0 0 20px rgba(0, 255, 255, 0.8); }
    100% { box-shadow: 0 0 5px rgba(0, 255, 255, 0.5); }
}

canvas#tetris {
    animation: glow 2s infinite;
}

/* Media queries for responsiveness */
@media (max-width: 768px) {
    .game-container {
        flex-direction: column;
        align-items: center;
        padding: 10px;
    }
    
    canvas {
        max-width: 100%;
        height: auto;
    }
    
    .score-container, .controls-info {
        min-width: 100%;
        margin-bottom: 15px;
    }
    
    .game-title {
        font-size: 24px;
    }
    
    #next-piece-preview {
        position: static;
        margin-top: 15px;
    }
}

/* Options menu styles */
.option-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
    position: relative;
}

.option-row label {
    margin-right: 10px;
    min-width: 180px;
}

.tooltip {
    font-size: 12px;
    color: #aaa;
    font-style: italic;
    margin-left: 10px;
    max-width: 200px;
}

/* Mobile-only class should be hidden always since we're removing mobile support */
.mobile-only {
    display: none;
}

/* Toggle switch styles */
.switch {
    position: relative;
    display: inline-block;
    width: 60px;
    height: 30px;
}

.switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: #444;
    transition: .4s;
    box-shadow: inset 0 0 5px rgba(0, 0, 0, 0.5);
}

.slider:before {
    position: absolute;
    content: "";
    height: 22px;
    width: 22px;
    left: 4px;
    bottom: 4px;
    background-color: white;
    transition: .4s;
    box-shadow: 0 0 3px rgba(0, 0, 0, 0.3);
}

input:checked + .slider {
    background: linear-gradient(45deg, #ff00dd, #00ddff);
}

input:focus + .slider {
    box-shadow: 0 0 1px #2196F3;
}

input:checked + .slider:before {
    transform: translateX(30px);
}

/* Rounded sliders */
.slider.round {
    border-radius: 34px;
}

.slider.round:before {
    border-radius: 50%;
}

/* Slider for animation speed */
input[type=range] {
    -webkit-appearance: none;
    width: 60%;
    height: 10px;
    border-radius: 5px;
    background: #444;
    outline: none;
    box-shadow: inset 0 0 5px rgba(0, 0, 0, 0.5);
}

input[type=range]::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: linear-gradient(45deg, #ff00dd, #00ddff);
    cursor: pointer;
    box-shadow: 0 0 5px rgba(0, 0, 0, 0.5);
}

input[type=range]::-moz-range-thumb {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: linear-gradient(45deg, #ff00dd, #00ddff);
    cursor: pointer;
    box-shadow: 0 0 5px rgba(0, 0, 0, 0.5);
}

/* 3D Rotation buttons - keep these for desktop */
.rotate-buttons {
    position: fixed;
    bottom: 20px;
    right: 20px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    z-index: 100;
}

.rotate-btn {
    background: linear-gradient(45deg, #007bff, #00ddff);
    color: white;
    border: none;
    padding: 12px 15px;
    border-radius: 50px;
    font-size: 14px;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
    transition: all 0.2s ease;
    font-weight: bold;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.3);
}

.rotate-btn:active {
    transform: scale(0.95);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
    background: linear-gradient(45deg, #0062cc, #00b3ff);
}

/* Performance toggle - Since we're removing mobile support */
/* Removing mobile-specific media queries and styles */

/* Removing touch-instructions class and related styles */
.instructions-btn {
    margin-top: 15px;
    background: linear-gradient(45deg, #ff9900, #ff5500);
}

.button-row {
    display: flex;
    justify-content: space-between;
    margin-top: 20px;
}

.button-row .game-btn {
    margin: 0 5px;
} 