/* Pong Game Styles - Using Portfolio Colors */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --primary-bg: #181a20;
    --accent-color: #ffb347;
    --text-secondary: #b2becd;
    --border-color: #353866;
}

body {
    font-family: 'Montserrat', 'Roboto', Arial, sans-serif;
    background: #181a20;
    color: #f5f6fa;
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    margin: 0;
}

.container {
    width: 100vw;
    min-height: 100vh;
    background: linear-gradient(120deg, #23263a 60%, #353866 100%);
    padding: 15px;
    box-sizing: border-box;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
}

.game-header {
    text-align: center;
    margin-bottom: 20px;
}

.game-header h1 {
    font-size: clamp(1.8rem, 4vw, 3rem);
    color: #ffb347;
    font-weight: 700;
    margin-bottom: 10px;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.5);
}

.game-header p {
    color: #b2becd;
    font-size: clamp(0.9rem, 2vw, 1.1rem);
}

.game-area {
    display: grid;
    grid-template-columns: minmax(200px, 250px) auto minmax(200px, 250px);
    gap: 30px;
    margin-bottom: 20px;
    align-items: start;
    max-width: 1400px;
    justify-content: center;
}

.game-board {
    position: relative;
    background: #181a20;
    border: 3px solid #ffb347;
    border-radius: 10px;
    padding: 15px;
    display: flex;
    flex-direction: column;
    align-items: center;
}

#gameCanvas {
    background: #0f1015;
    border: 2px solid #353866;
    border-radius: 5px;
    display: block;
    max-width: 100%;
    height: auto;
}

.score-panel {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.score-display {
    background: #181a20;
    border: 2px solid #353866;
    border-radius: 10px;
    padding: 20px;
    text-align: center;
}

.score-display h3 {
    color: #ffb347;
    font-size: 1.2rem;
    margin-bottom: 15px;
    font-weight: 600;
}

.score-value {
    font-size: 3rem;
    font-weight: bold;
    color: #f5f6fa;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.5);
    line-height: 1;
}

.controls-info,
.difficulty-selector {
    background: #181a20;
    border: 2px solid #353866;
    border-radius: 10px;
    padding: 15px;
}

.controls-info h4,
.difficulty-selector h4 {
    color: #ffb347;
    font-size: 1rem;
    margin-bottom: 12px;
    text-align: center;
    font-weight: 600;
}

.control-item {
    color: #b2becd;
    font-size: 0.9rem;
    margin-bottom: 8px;
    padding: 5px 10px;
    background: rgba(53, 56, 102, 0.3);
    border-radius: 5px;
    text-align: left;
}

#difficultySelect {
    width: 100%;
    padding: 8px;
    background: #353866;
    color: #f5f6fa;
    border: 2px solid #ffb347;
    border-radius: 5px;
    font-size: 0.9rem;
    text-align: center;
}

#difficultySelect:focus {
    outline: none;
    border-color: #ff9500;
}

/* Game Overlays */
.game-over,
.pause-screen,
.start-screen {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: rgba(24, 26, 32, 0.95);
    border: 3px solid #ffb347;
    border-radius: 15px;
    padding: 30px;
    text-align: center;
    z-index: 100;
    min-width: 300px;
}

.game-over.hidden,
.pause-screen.hidden,
.start-screen.hidden {
    display: none;
}

.game-over h2,
.pause-screen h2,
.start-screen h2 {
    color: #ffb347;
    margin-bottom: 15px;
    font-size: 1.8rem;
}

.restart-btn,
.resume-btn,
.start-btn {
    background: linear-gradient(45deg, #ffb347, #ff9500);
    color: #181a20;
    border: none;
    padding: 12px 24px;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: transform 0.2s, box-shadow 0.2s;
    margin-top: 15px;
}

.restart-btn:hover,
.resume-btn:hover,
.start-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(255, 179, 71, 0.4);
}

/* Mobile Touch Controls */
.mobile-controls {
    display: none;
    margin: 10px 0 0 0;
    width: 100%;
}

.touch-controls {
    display: flex;
    gap: 15px;
    justify-content: center;
}

.touch-btn {
    background: linear-gradient(45deg, #353866, #23263a);
    color: #f5f6fa;
    border: 2px solid #ffb347;
    border-radius: 50%;
    width: 55px;
    height: 55px;
    font-size: 24px;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    user-select: none;
    -webkit-tap-highlight-color: transparent;
}

.touch-btn:hover {
    background: linear-gradient(45deg, #ffb347, #ff9500);
    color: #181a20;
    transform: scale(1.1);
}

.touch-btn:active {
    transform: scale(0.95);
}

.touch-btn.pressed {
    background: linear-gradient(45deg, #ffb347, #ff9500) !important;
    color: #181a20 !important;
    transform: scale(1.05) !important;
    box-shadow: 0 0 15px rgba(255, 179, 71, 0.6);
}

/* Game Footer */
.game-footer {
    display: flex;
    justify-content: center;
    gap: 15px;
    flex-wrap: wrap;
    margin-bottom: 15px;
}

.control-btn {
    background: linear-gradient(45deg, #353866, #23263a);
    color: #f5f6fa;
    border: 2px solid #ffb347;
    padding: 12px 20px;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    min-width: 120px;
}

.control-btn:hover:not(:disabled) {
    background: linear-gradient(45deg, #ffb347, #ff9500);
    color: #181a20;
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(255, 179, 71, 0.4);
}

.control-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
}

/* Game Stats */
.game-stats {
    display: flex;
    justify-content: center;
    gap: 30px;
    flex-wrap: wrap;
}

.stat-item {
    background: rgba(24, 26, 32, 0.8);
    border: 1px solid #353866;
    border-radius: 8px;
    padding: 10px 15px;
    text-align: center;
}

.stat-label {
    color: #b2becd;
    font-size: 0.9rem;
    display: block;
    margin-bottom: 5px;
}

.stat-item span:last-child {
    color: #ffb347;
    font-weight: bold;
    font-size: 1.1rem;
}

.return-section {
    display: grid;
    margin-top: 40px;
    text-align: center;
    animation: fadeInUp 0.8s ease 0.3s both;
}
.btn-return {
    background: var(--primary-bg);
    color: var(--text-secondary);
    border: 2px solid var(--border-color);
    padding: 12px 25px;
    border-radius: 10px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    font-family: 'Montserrat', Arial, sans-serif;
}
    
.btn-return:hover {
    background: var(--border-color);
    color: var(--accent-color);
    border-color: var(--accent-color);
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(53, 56, 102, 0.4);
}

/* Ensure scrollbars work properly */
::-webkit-scrollbar {
    width: 10px;
}
    
::-webkit-scrollbar-track {
    background: var(--primary-bg);
}
    
::-webkit-scrollbar-thumb {
    background: var(--accent-color);
    border-radius: 4px;
}
    
::-webkit-scrollbar-thumb:hover {
    background: #ff8c42;
}

/* Show mobile controls on touch devices */
@media (hover: none) and (pointer: coarse) {
    .mobile-controls {
        display: block;
    }
}

/* Adjust controls for smaller mobile screens */
@media (max-width: 480px) and (hover: none) and (pointer: coarse) {
    .mobile-controls {
        margin: 8px 0 0 0;
    }
    
    .touch-btn {
        width: 50px;
        height: 50px;
        font-size: 22px;
    }
    
    .touch-controls {
        gap: 12px;
    }
}

/* Responsive Design */
@media (max-width: 1024px) {
    .container {
        padding: 10px;
    }
    
    .game-area {
        grid-template-columns: 1fr;
        gap: 15px;
        max-width: 100%;
    }
    
    .score-panel {
        flex-direction: row;
        justify-content: space-around;
    }
    
    .left-panel {
        order: 2;
    }
    
    .game-board {
        order: 1;
        justify-self: center;
    }
    
    .right-panel {
        order: 3;
    }
    
    #gameCanvas {
        width: min(700px, 90vw);
        height: auto;
    }
}

@media (max-width: 768px) {
    .game-header h1 {
        font-size: clamp(1.5rem, 5vw, 2rem);
    }
    
    .game-area {
        gap: 10px;
    }
    
    .score-panel {
        gap: 10px;
    }
    
    .score-display {
        padding: 15px;
        flex: 1;
    }
    
    .controls-info,
    .difficulty-selector {
        padding: 10px;
        flex: 1;
    }
    
    .score-value {
        font-size: 2rem;
    }
    
    #gameCanvas {
        width: min(600px, 85vw);
    }
    
    .game-stats {
        gap: 15px;
    }
    
    .stat-item {
        padding: 8px 12px;
        flex: 1;
        min-width: 120px;
    }
}

@media (max-width: 480px) {
    .container {
        padding: 5px;
    }
    
    .game-header h1 {
        font-size: clamp(1.2rem, 6vw, 1.6rem);
    }
    
    .game-header p {
        font-size: 0.8rem;
    }
    
    #gameCanvas {
        width: min(400px, 80vw);
    }
    
    .score-panel {
        flex-direction: column;
        gap: 8px;
    }
    
    .score-display {
        padding: 12px;
    }
    
    .score-value {
        font-size: 1.8rem;
    }
    
    .controls-info,
    .difficulty-selector {
        padding: 8px;
    }
    
    .control-item {
        font-size: 0.8rem;
        margin-bottom: 4px;
        padding: 3px 8px;
    }
    
    .game-footer {
        flex-direction: column;
        gap: 8px;
        align-items: center;
    }
    
    .control-btn {
        width: 100%;
        max-width: 200px;
        padding: 10px 16px;
        font-size: 0.9rem;
    }
    
    .game-stats {
        flex-direction: column;
        gap: 8px;
        align-items: center;
    }
    
    .stat-item {
        width: 100%;
        max-width: 200px;
    }
    
    .game-over,
    .pause-screen,
    .start-screen {
        padding: 20px;
        min-width: 250px;
        width: 90%;
    }
}

/* Landscape orientation for mobile */
@media (max-width: 768px) and (orientation: landscape) {
    .container {
        justify-content: flex-start;
        padding-top: 5px;
    }
    
    .game-header {
        margin-bottom: 10px;
    }
    
    .game-header h1 {
        font-size: 1.5rem;
        margin-bottom: 5px;
    }
    
    .game-header p {
        font-size: 0.8rem;
    }
    
    .game-area {
        grid-template-columns: 150px auto 150px;
        gap: 15px;
    }
    
    .score-panel {
        flex-direction: column;
        gap: 10px;
    }
    
    .left-panel {
        order: 1;
    }
    
    .game-board {
        order: 2;
    }
    
    .right-panel {
        order: 3;
    }
    
    #gameCanvas {
        width: min(500px, 50vw);
        height: min(250px, 40vh);
    }
    
    .score-display {
        padding: 8px;
    }
    
    .score-value {
        font-size: 1.5rem;
    }
    
    .controls-info,
    .difficulty-selector {
        padding: 6px;
    }
    
    .game-footer,
    .game-stats {
        display: none; /* Hide to save space in landscape */
    }
}

/* Animations */
@keyframes scoreUpdate {
    0% { transform: scale(1); }
    50% { transform: scale(1.2); color: #ff9500; }
    100% { transform: scale(1); }
}

.score-animation {
    animation: scoreUpdate 0.3s ease-out;
}

@keyframes ballHit {
    0% { filter: brightness(1); }
    50% { filter: brightness(1.5); }
    100% { filter: brightness(1); }
}

.ball-hit-effect {
    animation: ballHit 0.2s ease-out;
}