:root {
    --card-width: 80px;
    --card-height: 100px;
    --card-bg: #2c3e50;
    --card-border: #3498db;
    --card-shadow: 0 4px 8px rgba(0, 0, 0, 0.3);
    --flip-duration: 0.6s;
    --primary-gradient: linear-gradient(45deg, #3498db, #2980b9);
    --success-gradient: linear-gradient(45deg, #2ecc71, #27ae60);
    --danger-gradient: linear-gradient(45deg, #e74c3c, #c0392b);
    --warning-gradient: linear-gradient(45deg, #f1c40f, #f39c12);
    --neon-blue: #3498db;
    --neon-glow: 0 0 10px rgba(52, 152, 219, 0.5);
    --retro-font: 'Press Start 2P', cursive;
    --modern-font: 'Poppins', sans-serif;
    --stats-card-bg: rgba(0, 0, 0, 0.6);
    --stats-card-border: rgba(255, 255, 255, 0.1);
    --stats-card-glow: 0 0 10px rgba(52, 152, 219, 0.5);
    --stats-icon-size: 2rem;
}

/* Mobile-specific variables */
@media (max-width: 576px) {
    :root {
        --card-width: 50px;
        --card-height: 65px;
        --stats-icon-size: 1.5rem;
    }
}

body {
    min-height: 100vh;
    display: flex;
    align-items: center;
    padding: 1rem 0;
    font-family: var(--modern-font);
    position: relative;
    background: linear-gradient(135deg, rgba(26, 26, 46, 0.95) 0%, rgba(22, 33, 62, 0.95) 100%);
    overflow-x: hidden;
}

.game-title {
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
}

.start-card {
    box-shadow: 0 8px 16px rgba(0, 0, 0, 0.2);
    border: 1px solid rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(10px);
}

.start-button {
    background: var(--primary-gradient);
    border: none;
    padding: 1rem;
    font-weight: 600;
    letter-spacing: 0.5px;
    transition: all 0.3s ease;
}

.start-button:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(52, 152, 219, 0.4);
}

.memory-grid {
    display: grid;
    gap: 10px;
    justify-content: center;
    align-items: center;
    margin: 0 auto;
    max-width: 100%;
    padding: 20px;
    grid-auto-flow: row;
}

/* Ajuste específico para cada tamanho de grid para ter mais colunas que linhas */
[data-grid="4"] {
    grid-template-columns: repeat(4, var(--card-width));
    grid-template-rows: repeat(2, 1fr);
    justify-content: center;
    margin: 0 auto;
    max-width: calc(var(--card-width) * 4 + 30px);
}

[data-grid="6"] {
    grid-template-columns: repeat(6, var(--card-width));
    grid-template-rows: repeat(3, 1fr);
    justify-content: center;
    margin: 0 auto;
    max-width: calc(var(--card-width) * 6 + 50px);
}

[data-grid="8"] {
    grid-template-columns: repeat(8, var(--card-width));
    grid-template-rows: repeat(4, 1fr);
    justify-content: flex-start;
}

/* Responsive adjustments for grid */
@media (max-width: 1400px) {
    [data-grid="8"] {
        grid-template-columns: repeat(8, var(--card-width));
        grid-template-rows: repeat(4, 1fr);
    }
}

@media (max-width: 1200px) {
    [data-grid="6"] {
        grid-template-columns: repeat(6, var(--card-width));
        grid-template-rows: repeat(3, 1fr);
        justify-content: center;
        margin: 0 auto;
        max-width: calc(var(--card-width) * 6 + 50px);
    }
}

@media (max-width: 992px) {
    [data-grid="4"] {
        grid-template-columns: repeat(4, var(--card-width));
        grid-template-rows: repeat(2, 1fr);
        justify-content: center;
        margin: 0 auto;
        max-width: calc(var(--card-width) * 4 + 30px);
    }
}

@media (max-width: 768px) {
    [data-grid="8"] {
        grid-template-columns: repeat(8, var(--card-width));
        grid-template-rows: repeat(4, 1fr);
    }
    
    [data-grid="6"] {
        grid-template-columns: repeat(6, var(--card-width));
        grid-template-rows: repeat(3, 1fr);
        justify-content: center;
        margin: 0 auto;
        max-width: calc(var(--card-width) * 6 + 40px);
    }
}

@media (max-width: 576px) {
    [data-grid="4"] {
        grid-template-columns: repeat(4, var(--card-width));
        grid-template-rows: repeat(2, 1fr);
        justify-content: center;
        margin: 0 auto;
        max-width: calc(var(--card-width) * 4 + 20px);
    }
    
    [data-grid="6"] {
        grid-template-columns: repeat(6, var(--card-width));
        grid-template-rows: repeat(3, 1fr);
        justify-content: center;
        margin: 0 auto;
        max-width: calc(var(--card-width) * 6 + 30px);
    }
    
    [data-grid="8"] {
        grid-template-columns: repeat(8, var(--card-width));
        grid-template-rows: repeat(4, 1fr);
    }
    
    .memory-grid {
        gap: 4px;
        padding: 10px 5px;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }
}

/* Landscape Mode Adjustments */
@media (max-width: 576px) and (orientation: landscape) {
    [data-grid="4"] {
        grid-template-columns: repeat(4, var(--card-width));
        grid-template-rows: repeat(2, 1fr);
        justify-content: center;
        margin: 0 auto;
        max-width: calc(var(--card-width) * 4 + 20px);
    }
    
    [data-grid="6"] {
        grid-template-columns: repeat(6, var(--card-width));
        grid-template-rows: repeat(3, 1fr);
        justify-content: center;
        margin: 0 auto;
        max-width: calc(var(--card-width) * 6 + 30px);
    }
    
    [data-grid="8"] {
        grid-template-columns: repeat(8, var(--card-width));
        grid-template-rows: repeat(4, 1fr);
    }
    
    .memory-grid {
        gap: 3px;
        padding: 5px;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }
}

.memory-card {
    width: var(--card-width);
    height: var(--card-height);
    position: relative;
    transform-style: preserve-3d;
    transition: transform var(--flip-duration);
    cursor: pointer;
    perspective: 1000px;
}

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

.memory-card-front,
.memory-card-back {
    position: absolute;
    width: 100%;
    height: 100%;
    backface-visibility: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 10px;
    box-shadow: var(--card-shadow);
}

.memory-card-front {
    background: var(--card-bg);
    border: 2px solid var(--card-border);
}

.memory-card-back {
    background: var(--primary-gradient);
    transform: rotateY(180deg);
    font-size: 2rem;
    color: white;
}

.memory-card.matched {
    opacity: 0.7;
    pointer-events: none;
    transform: scale(0.95);
}

/* Glassmorphism Effect */
.card {
    background: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.2);
    transition: all 0.3s ease;
}

.card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

/* Animation for card flip */
@keyframes flip {
    0% {
        transform: rotateY(0);
    }
    100% {
        transform: rotateY(180deg);
    }
}

.memory-card.flipped {
    animation: flip var(--flip-duration) forwards;
}

/* Hover effect */
.memory-card:not(.flipped):hover {
    transform: scale(1.05);
    transition: transform 0.2s;
}

/* Game stats styling */
#score {
    font-weight: bold;
    color: #f1c40f;
}

#moves {
    font-weight: bold;
    color: #3498db;
}

#matches {
    font-weight: bold;
    color: #2ecc71;
}

/* Timer styling */
#timer {
    font-family: monospace;
    font-size: 1.2em;
    color: #2ecc71;
}

/* Button styling */
.btn-primary {
    background: var(--primary-gradient);
    border: none;
    transition: all 0.3s ease;
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
}

.btn-danger {
    background: var(--danger-gradient);
    border: none;
    transition: all 0.3s ease;
}

.btn-danger:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
}

/* Modal styling */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: none;
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    pointer-events: none;
}

.modal.show {
    display: flex !important;
}

.modal-dialog {
    pointer-events: auto;
    margin: 1.75rem auto;
    position: relative;
    width: auto;
    max-width: 500px;
}

.modal-content {
    background: rgba(13, 17, 23, 0.95) !important;
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 15px;
    box-shadow: 0 0 30px rgba(0, 0, 0, 0.5);
    position: relative;
    pointer-events: auto;
    display: flex;
    flex-direction: column;
    width: 100%;
    backdrop-filter: blur(10px);
}

.modal-header {
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    padding: 1.5rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.modal-title {
    font-family: var(--retro-font);
    font-size: 1.5rem;
    color: #fff;
    text-shadow: 0 0 10px rgba(52, 152, 219, 0.5);
    margin: 0;
}

.modal-body {
    padding: 1.5rem;
}

.result-item {
    background: rgba(255, 255, 255, 0.05);
    border-radius: 10px;
    padding: 1rem 1.5rem;
    margin-bottom: 1rem;
    display: flex;
    align-items: center;
    transition: all 0.3s ease;
}

.result-item:hover {
    background: rgba(255, 255, 255, 0.1);
    transform: translateX(5px);
}

.result-item i {
    margin-right: 1rem;
    font-size: 1.2rem;
    color: #3498db;
}

.modal-footer {
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    padding: 1.5rem;
    display: flex;
    justify-content: flex-end;
    gap: 1rem;
}

.modal-backdrop {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    z-index: 9998;
    pointer-events: none;
}

/* Modal Buttons */
.modal .btn {
    min-width: 140px;
    font-family: var(--retro-font);
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 1px;
    padding: 0.8rem 1.5rem;
    position: relative;
    overflow: hidden;
    transition: all 0.3s ease;
}

.modal .btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 0 15px rgba(52, 152, 219, 0.5);
}

.modal .btn-primary {
    background: linear-gradient(45deg, #3498db, #2980b9);
    border: none;
}

.modal .btn-secondary {
    background: linear-gradient(45deg, #34495e, #2c3e50);
    border: none;
}

/* Ensure modal is always on top but doesn't block interaction */
.modal-open .modal {
    display: flex !important;
    pointer-events: none;
}

.modal-open {
    overflow: auto !important;
    padding-right: 0 !important;
}

.btn-close-white {
    filter: brightness(0) invert(1);
    opacity: 0.7;
    transition: opacity 0.3s ease;
}

.btn-close-white:hover {
    opacity: 1;
}

/* Form styling */
.form-control, .form-select {
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    color: white;
    transition: all 0.3s ease;
}

.form-control:focus, .form-select:focus {
    background: rgba(255, 255, 255, 0.15);
    border-color: #3498db;
    color: white;
    box-shadow: 0 0 0 0.25rem rgba(52, 152, 219, 0.25);
}

/* Icon styling */
.bi {
    vertical-align: -0.125em;
}

/* Game Stats Styling */
.game-stats-row {
    position: relative;
    z-index: 3;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 1rem;
    padding: 0.5rem;
    background: rgba(0, 0, 0, 0.3);
    border-radius: 10px;
    border: 1px solid var(--stats-card-border);
    box-shadow: 0 0 20px rgba(0, 0, 0, 0.3);
    overflow-x: auto;
    white-space: nowrap;
    -webkit-overflow-scrolling: touch;
}

.stats-card {
    display: flex;
    align-items: center;
    padding: 0.5rem 1rem;
    background: var(--stats-card-bg);
    border-radius: 8px;
    border: 1px solid var(--stats-card-border);
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
    min-width: 120px;
    flex: 1;
}

.stats-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 2px;
    background: var(--primary-gradient);
    opacity: 0;
    transition: opacity 0.3s ease;
}

.stats-card:hover::before {
    opacity: 1;
}

.stats-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--stats-card-glow);
}

.stats-icon {
    width: 1.5rem;
    height: 1.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-right: 0.75rem;
    font-size: 1.25rem;
    color: #3498db;
    text-shadow: 0 0 10px rgba(52, 152, 219, 0.5);
}

.stats-content {
    flex: 1;
    min-width: 0;
}

.stats-label {
    color: #95a5a6;
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-bottom: 0.25rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.stats-value {
    font-size: 1.1rem;
    font-weight: bold;
    font-family: 'Courier New', monospace;
    display: block;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Specific card styles */
.player-card .stats-value {
    color: #3498db;
    text-shadow: 0 0 10px rgba(52, 152, 219, 0.5);
}

.timer-card .stats-value {
    color: #2ecc71;
    text-shadow: 0 0 10px rgba(46, 204, 113, 0.5);
}

.score-card .stats-value {
    color: #f1c40f;
    text-shadow: 0 0 10px rgba(241, 196, 15, 0.5);
}

.moves-card .stats-value {
    color: #3498db;
    text-shadow: 0 0 10px rgba(52, 152, 219, 0.5);
}

.matches-card .stats-value {
    color: #e74c3c;
    text-shadow: 0 0 10px rgba(231, 76, 60, 0.5);
}

/* Retro Text Styling */
.retro-text {
    font-family: var(--retro-font);
    text-transform: uppercase;
    letter-spacing: 2px;
    color: #fff;
    text-shadow: 0 0 10px var(--neon-blue),
                 0 0 20px var(--neon-blue),
                 0 0 30px var(--neon-blue);
    margin-bottom: 1rem;
}

.game-subtitle {
    font-family: var(--modern-font);
    font-size: 1.2rem;
    font-weight: 300;
    color: #a8b2d1;
    text-shadow: 0 0 10px rgba(168, 178, 209, 0.3);
}

.retro-label {
    font-family: var(--retro-font);
    font-size: 0.8rem !important;
    letter-spacing: 1px;
    color: #a8b2d1;
    margin-bottom: 0.5rem;
    text-shadow: 0 0 5px rgba(168, 178, 209, 0.3);
}

.retro-value {
    font-family: var(--retro-font);
    font-size: 1rem;
    letter-spacing: 1px;
}

/* Custom Input Styling */
.custom-input, .custom-select {
    background: rgba(255, 255, 255, 0.05) !important;
    border: 2px solid rgba(52, 152, 219, 0.3) !important;
    color: #fff !important;
    font-family: var(--modern-font);
    font-size: 1rem;
    padding: 1rem 1.5rem;
    transition: all 0.3s ease;
}

.custom-input:focus, .custom-select:focus {
    background: rgba(255, 255, 255, 0.1) !important;
    border-color: var(--neon-blue) !important;
    box-shadow: 0 0 0 0.25rem rgba(52, 152, 219, 0.25);
    color: #fff !important;
}

.custom-input::placeholder {
    color: rgba(255, 255, 255, 0.5);
}

.custom-select option {
    background-color: #1a1a2e;
    color: #fff;
    padding: 10px;
}

/* Neon Button Effect */
.neon-button {
    position: relative;
    overflow: hidden;
    transition: all 0.3s ease;
    text-transform: uppercase;
    font-family: var(--retro-font);
    font-size: 0.8rem;
    letter-spacing: 2px;
}

.neon-button::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(255, 255, 255, 0.1);
    transform: translateX(-100%);
    transition: transform 0.3s ease;
}

.neon-button:hover::before {
    transform: translateX(0);
}

.neon-button:hover {
    transform: translateY(-2px);
    box-shadow: 0 0 15px rgba(52, 152, 219, 0.5);
}

/* Game Background */
.game-background {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-image: url('https://images.unsplash.com/photo-1550745165-9bc0b252726f');
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    opacity: 0.2;
    z-index: 1;
}

/* Container and Game Elements */
.container {
    position: relative;
    z-index: 2;
}

.game-stats-row {
    position: relative;
    z-index: 3;
}

.memory-grid {
    position: relative;
    z-index: 3;
}

/* Sound Controls */
.sound-controls {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    background: rgba(255, 255, 255, 0.05);
    padding: 0.5rem;
    border-radius: 8px;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.sound-controls .btn-sm {
    padding: 0.25rem 0.5rem;
    font-size: 0.875rem;
    min-width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.sound-controls .vr {
    height: 24px;
    opacity: 0.2;
}

.sound-controls .form-range {
    height: 4px;
}

.sound-controls .form-range::-webkit-slider-thumb {
    width: 12px;
    height: 12px;
    background: #3498db;
    border: 2px solid #fff;
    box-shadow: 0 0 10px rgba(52, 152, 219, 0.5);
    cursor: pointer;
}

.sound-controls .form-range::-moz-range-thumb {
    width: 12px;
    height: 12px;
    background: #3498db;
    border: 2px solid #fff;
    box-shadow: 0 0 10px rgba(52, 152, 219, 0.5);
    cursor: pointer;
}

.sound-controls .form-range::-webkit-slider-runnable-track {
    background: rgba(255, 255, 255, 0.1);
    height: 4px;
    border-radius: 2px;
}

.sound-controls .form-range::-moz-range-track {
    background: rgba(255, 255, 255, 0.1);
    height: 4px;
    border-radius: 2px;
}

/* Victory Modal Styles */
.modal-content.victory {
    background: linear-gradient(135deg, rgba(46, 204, 113, 0.95), rgba(52, 152, 219, 0.95)) !important;
    animation: victoryPulse 2s infinite;
    border: 2px solid rgba(255, 255, 255, 0.3);
}

.victory .modal-header {
    border-bottom-color: rgba(255, 255, 255, 0.2);
}

.victory .modal-footer {
    border-top-color: rgba(255, 255, 255, 0.2);
}

.victory-title {
    font-family: var(--retro-font);
    color: #fff;
    text-shadow: 0 0 10px rgba(255, 255, 255, 0.5);
    text-align: center;
    width: 100%;
    font-size: 1.5rem;
    margin: 0;
    animation: victoryBounce 1s ease-in-out infinite;
}

.victory-icon {
    font-size: 3rem;
    color: #f1c40f;
    text-shadow: 0 0 20px rgba(241, 196, 15, 0.7);
    margin-bottom: 1rem;
    animation: victorySpin 4s linear infinite;
}

.victory-stats {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 10px;
    padding: 1.5rem;
    margin: 1rem 0;
    border: 1px solid rgba(255, 255, 255, 0.2);
}

.victory-stat-item {
    display: flex;
    align-items: center;
    margin-bottom: 1rem;
    padding: 0.5rem;
    border-radius: 5px;
    background: rgba(255, 255, 255, 0.1);
    transition: transform 0.3s ease;
}

.victory-stat-item:hover {
    transform: translateX(5px);
    background: rgba(255, 255, 255, 0.15);
}

.victory-stat-item:last-child {
    margin-bottom: 0;
}

.victory-stat-icon {
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 50%;
    margin-right: 1rem;
}

.victory-stat-icon i {
    font-size: 1.2rem;
    color: #fff;
}

.victory-stat-content {
    flex: 1;
}

.victory-stat-label {
    font-size: 0.8rem;
    color: rgba(255, 255, 255, 0.8);
    margin-bottom: 0.2rem;
}

.victory-stat-value {
    font-family: var(--retro-font);
    font-size: 1.2rem;
    color: #fff;
    text-shadow: 0 0 5px rgba(255, 255, 255, 0.5);
}

.victory-buttons {
    display: flex;
    gap: 1rem;
    justify-content: flex-end;
}

.victory-button {
    min-width: 140px;
    font-family: var(--retro-font);
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 1px;
    padding: 0.8rem 1.5rem;
    border: none;
    position: relative;
    overflow: hidden;
    transition: all 0.3s ease;
}

.victory-button:hover {
    transform: translateY(-2px);
    box-shadow: 0 0 15px rgba(255, 255, 255, 0.3);
}

/* Victory Animations */
@keyframes victoryPulse {
    0% { box-shadow: 0 0 20px rgba(46, 204, 113, 0.5); }
    50% { box-shadow: 0 0 30px rgba(52, 152, 219, 0.7); }
    100% { box-shadow: 0 0 20px rgba(46, 204, 113, 0.5); }
}

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

@keyframes victorySpin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Confetti Animation */
.confetti {
    position: fixed;
    width: 10px;
    height: 10px;
    background-color: #f1c40f;
    position: absolute;
    left: 50%;
    animation: confetti 5s ease-in-out infinite;
    transform-origin: left top;
}

@keyframes confetti {
    0% { transform: rotate(0deg) translate(-50%, 0); opacity: 1; }
    100% { transform: rotate(360deg) translate(-50%, 100vh); opacity: 0; }
}

/* Enhanced Mobile Responsiveness */
@media (max-width: 576px) {
    .container {
        padding: 0.5rem;
    }

    .game-title h1 {
        font-size: 1.5rem;
    }

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

    .start-card {
        margin: 0 1rem;
    }

    .custom-input, .custom-select {
        font-size: 0.9rem;
        padding: 0.75rem 1rem;
    }

    .game-stats-row {
        flex-wrap: wrap;
        gap: 0.25rem;
        padding: 0.25rem;
    }

    .stats-card {
        min-width: calc(50% - 0.25rem);
        padding: 0.25rem 0.5rem;
    }

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

    .stats-value {
        font-size: 0.9rem;
    }

    .memory-grid {
        gap: 4px;
        padding: 10px 5px;
    }

    .memory-card {
        width: var(--card-width);
        height: var(--card-height);
    }

    .memory-card-back {
        font-size: 1.5rem;
    }

    .btn-lg {
        padding: 0.5rem 1rem;
        font-size: 0.9rem;
    }

    .modal-dialog {
        margin: 0.5rem;
    }

    .modal-content {
        padding: 0.5rem;
    }

    .victory-stat-item {
        padding: 0.25rem;
    }

    .victory-stat-icon {
        width: 30px;
        height: 30px;
    }

    .victory-stat-label {
        font-size: 0.7rem;
    }

    .victory-stat-value {
        font-size: 1rem;
    }

    .sound-controls {
        flex-wrap: wrap;
        gap: 0.25rem;
    }

    .sound-controls .btn-sm {
        padding: 0.2rem 0.4rem;
        font-size: 0.8rem;
    }

    .sound-controls .form-range {
        width: 60px;
    }
}

/* Landscape Mode Adjustments */
@media (max-width: 576px) and (orientation: landscape) {
    .memory-grid {
        gap: 3px;
        padding: 5px;
    }

    .game-stats-row {
        flex-wrap: nowrap;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }

    .stats-card {
        min-width: 100px;
    }
}

/* Prevent text selection on mobile */
.memory-card, .btn, .stats-card {
    -webkit-touch-callout: none;
    -webkit-user-select: none;
    -khtml-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
    user-select: none;
}

/* Touch feedback */
.memory-card:active {
    transform: scale(0.95);
}

.btn:active {
    transform: scale(0.98);
}

/* History Modal Styles */
#history-modal .modal-dialog {
    max-width: 95%;
    margin: 0.5rem auto;
}

#history-modal .modal-content {
    background: rgba(13, 17, 23, 0.95);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 15px;
    box-shadow: 0 0 30px rgba(0, 0, 0, 0.5);
}

#history-modal .modal-header {
    padding: 1rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

#history-modal .modal-title {
    font-size: 1.2rem;
    font-family: var(--retro-font);
    color: #fff;
    text-shadow: 0 0 10px rgba(52, 152, 219, 0.5);
}

#history-modal .modal-body {
    padding: 1rem;
}

#history-modal .stats-summary {
    margin-bottom: 1rem;
}

#history-modal .stats-card {
    background: rgba(255, 255, 255, 0.05);
    border-radius: 8px;
    padding: 0.75rem;
    margin-bottom: 0.5rem;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

#history-modal .stats-label {
    font-size: 0.7rem;
    color: rgba(255, 255, 255, 0.7);
    margin-bottom: 0.25rem;
}

#history-modal .stats-value {
    font-size: 1.1rem;
    font-weight: bold;
    color: #fff;
}

#history-modal .table {
    color: #fff;
    margin-bottom: 0;
}

#history-modal .table th {
    border-top: none;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    font-size: 0.8rem;
    color: rgba(255, 255, 255, 0.7);
    padding: 0.5rem;
}

#history-modal .table td {
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    padding: 0.5rem;
    font-size: 0.9rem;
    vertical-align: middle;
}

#history-modal .modal-footer {
    padding: 1rem;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
}

/* Mobile Responsive Adjustments */
@media (max-width: 576px) {
    #history-modal .modal-dialog {
        margin: 0.5rem;
    }

    #history-modal .modal-content {
        border-radius: 12px;
    }

    #history-modal .modal-header {
        padding: 0.75rem;
    }

    #history-modal .modal-title {
        font-size: 1rem;
    }

    #history-modal .modal-body {
        padding: 0.75rem;
    }

    #history-modal .stats-card {
        padding: 0.5rem;
    }

    #history-modal .stats-label {
        font-size: 0.6rem;
    }

    #history-modal .stats-value {
        font-size: 0.9rem;
    }

    #history-modal .table th {
        font-size: 0.7rem;
        padding: 0.4rem;
    }

    #history-modal .table td {
        font-size: 0.8rem;
        padding: 0.4rem;
    }

    #history-modal .table-responsive {
        margin: 0 -0.5rem;
    }

    #history-modal .modal-footer {
        padding: 0.75rem;
        flex-direction: column;
        gap: 0.5rem;
    }

    #history-modal .modal-footer .btn {
        width: 100%;
        margin: 0;
    }
}

/* Landscape Mode Adjustments */
@media (max-width: 576px) and (orientation: landscape) {
    #history-modal .modal-dialog {
        max-height: 90vh;
        margin: 0.5rem auto;
    }

    #history-modal .modal-body {
        max-height: calc(90vh - 120px);
        overflow-y: auto;
    }

    #history-modal .table-responsive {
        margin: 0;
    }
}

/* Table Cell Content Adjustments */
#history-modal .table td {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 120px;
}

#history-modal .table th:nth-child(1),
#history-modal .table td:nth-child(1) {
    max-width: 100px;
}

#history-modal .table th:nth-child(2),
#history-modal .table td:nth-child(2) {
    max-width: 80px;
}

#history-modal .table th:nth-child(3),
#history-modal .table td:nth-child(3) {
    max-width: 80px;
}

#history-modal .table th:nth-child(4),
#history-modal .table td:nth-child(4) {
    max-width: 100px;
}

#history-modal .table th:nth-child(5),
#history-modal .table td:nth-child(5) {
    max-width: 80px;
}

.footer {
    position: fixed;
    bottom: 0;
    right: 0;
    padding: 1rem;
    background-color: transparent;
    z-index: 1000;
}

.github-link {
    text-decoration: none;
    color: #fff;
    transition: all 0.3s ease;
}

.github-link:hover {
    color: #3498db;
    text-shadow: 0 0 10px rgba(52, 152, 219, 0.5);
}

.github-link span {
    font-family: 'Poppins', sans-serif;
    font-size: 0.9rem;
    opacity: 0.8;
} 