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

body {
    font-family: 'Arial', sans-serif;
    background: linear-gradient(135deg, #0f4c3a, #2d8659);
    min-height: 100vh;
    color: white;
    overflow-x: hidden;
}

.game-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 10px;
    padding-bottom: 100px; /* Add bottom padding to prevent footer overlap */
}

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

h1 {
    font-size: 2rem;
    margin-bottom: 15px;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.5);
}

.game-info {
    display: flex;
    justify-content: center;
    gap: 30px;
    font-size: 1rem;
    font-weight: bold;
    align-items: center;
}

/* Card rules tooltip */
.card-rules-tooltip {
    position: relative;
    display: inline-block;
}

.tooltip-trigger {
    cursor: pointer;
    font-size: 0.85rem;
    font-weight: 900;
    padding: 2px 4px;
    border-radius: 50%;
    background-color: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.15);
    transition: all 0.2s ease;
    user-select: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 16px;
    min-height: 16px;
}

.tooltip-trigger:hover,
.tooltip-trigger:focus {
    background-color: rgba(255, 255, 255, 0.25);
    border-color: rgba(255, 255, 255, 0.5);
    transform: scale(1.05);
    outline: none;
}

.tooltip-content {
    visibility: hidden;
    opacity: 0;
    position: absolute;
    bottom: 125%;
    left: 50%;
    transform: translateX(-50%);
    background-color: rgba(0, 0, 0, 0.9);
    color: white;
    text-align: center;
    padding: 8px 12px;
    border-radius: 6px;
    font-size: 0.9rem;
    white-space: nowrap;
    z-index: 1000;
    transition: opacity 0.3s ease, visibility 0.3s ease;
    pointer-events: none;
}

.tooltip-content::after {
    content: "";
    position: absolute;
    top: 100%;
    left: 50%;
    margin-left: -5px;
    border-width: 5px;
    border-style: solid;
    border-color: rgba(0, 0, 0, 0.9) transparent transparent transparent;
}

.card-rules-tooltip:hover .tooltip-content,
.card-rules-tooltip:focus-within .tooltip-content {
    visibility: visible;
    opacity: 1;
}

.face-up-cards {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
    max-width: 100%;
    margin: 0 auto 20px;
    padding: 0 5px;
}

.card {
    width: 100%;
    aspect-ratio: 3/4;
    max-width: 110px;
    background: linear-gradient(145deg, #ffffff, #f8f9fa);
    border-radius: 12px;
    position: relative;
    color: black;
    font-size: 1.2rem;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.3s ease;
    border: 2px solid transparent;
    padding: 8px;
    box-shadow: 
        0 4px 8px rgba(0, 0, 0, 0.15),
        0 1px 3px rgba(0, 0, 0, 0.1),
        inset 0 1px 0 rgba(255, 255, 255, 0.8);
    margin: 0 auto;
    font-family: 'Georgia', serif;
}

.card:hover {
    transform: translateY(-3px) scale(1.02);
    box-shadow: 
        0 8px 16px rgba(0, 0, 0, 0.2),
        0 4px 8px rgba(0, 0, 0, 0.15),
        inset 0 1px 0 rgba(255, 255, 255, 0.9);
}

.card.selected {
    border-color: #ffd700;
    border-width: 3px;
    box-shadow: 
        0 0 20px rgba(255, 215, 0, 0.6),
        0 8px 16px rgba(0, 0, 0, 0.2),
        0 4px 8px rgba(0, 0, 0, 0.15),
        inset 0 1px 0 rgba(255, 255, 255, 0.9);
    transform: translateY(-2px) scale(1.03);
    position: relative;
}

.card.correct-guess {
    border-color: #4caf50 !important;
    border-width: 3px !important;
    box-shadow: 0 0 20px rgba(76, 175, 80, 0.6) !important, 0 8px 16px rgba(0, 0, 0, 0.2), 0 4px 8px rgba(0, 0, 0, 0.15), inset 0 1px 0 rgba(255, 255, 255, 0.9);
    transform: translateY(-2px) scale(1.03);
}

/* Floating action buttons for guessing */
.floating-guess-buttons {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    display: flex;
    flex-direction: column;
    gap: 8px;
    z-index: 10;
    pointer-events: none;
}

.floating-guess-buttons button {
    pointer-events: auto;
    width: 70px;
    height: 40px;
    border: none;
    border-radius: 20px;
    font-size: 0.9rem;
    font-weight: 900;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 
        0 6px 16px rgba(0, 0, 0, 0.3),
        0 2px 8px rgba(0, 0, 0, 0.2);
    display: flex;
    align-items: center;
    justify-content: center;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.3);
    letter-spacing: 0.5px;
}

.floating-guess-buttons button:hover {
    transform: scale(1.15);
    box-shadow: 
        0 8px 20px rgba(0, 0, 0, 0.4),
        0 4px 12px rgba(0, 0, 0, 0.3);
}

.floating-guess-buttons button:active {
    transform: scale(0.9);
    transition: transform 0.1s ease;
}

#higher-btn {
    background: linear-gradient(145deg, #607d8b, #546e7a);
    color: white;
    margin-bottom: 5px;
}

#higher-btn:hover {
    background: linear-gradient(145deg, #546e7a, #455a64);
}

#lower-btn {
    background: linear-gradient(145deg, #757575, #616161);
    color: white;
    margin-top: 5px;
}

#lower-btn:hover {
    background: linear-gradient(145deg, #616161, #424242);
}

.card.new-card {
    animation: newCardPulse 2s ease-in-out;
    background: linear-gradient(45deg, #fff, #e3f2fd, #fff);
    border-color: #2196f3;
    box-shadow: 0 0 20px rgba(33, 150, 243, 0.6);
}

.card.new-card-incorrect {
    animation: incorrectCardPulse 2s ease-in-out;
    background: linear-gradient(45deg, #fff, #ffebee, #fff);
    border-color: #f44336;
    box-shadow: 0 0 20px rgba(244, 67, 54, 0.6);
}

@keyframes newCardPulse {
    0% {
        transform: scale(1);
        box-shadow: 0 0 20px rgba(33, 150, 243, 0.6);
        background: linear-gradient(45deg, #fff, #e3f2fd, #fff);
    }
    25% {
        transform: scale(1.05);
        box-shadow: 0 0 30px rgba(33, 150, 243, 0.8);
        background: linear-gradient(45deg, #e3f2fd, #bbdefb, #e3f2fd);
    }
    50% {
        transform: scale(1.02);
        box-shadow: 0 0 25px rgba(33, 150, 243, 0.7);
        background: linear-gradient(45deg, #fff, #e3f2fd, #fff);
    }
    75% {
        transform: scale(1.05);
        box-shadow: 0 0 30px rgba(33, 150, 243, 0.8);
        background: linear-gradient(45deg, #e3f2fd, #bbdefb, #e3f2fd);
    }
    100% {
        transform: scale(1);
        box-shadow: 0 2px 6px rgba(0, 0, 0, 0.3);
        background: white;
    }
}

@keyframes incorrectCardPulse {
    0% {
        transform: scale(1);
        box-shadow: 0 0 20px rgba(244, 67, 54, 0.6);
        background: linear-gradient(45deg, #fff, #ffebee, #fff);
    }
    25% {
        transform: scale(1.05);
        box-shadow: 0 0 30px rgba(244, 67, 54, 0.8);
        background: linear-gradient(45deg, #ffebee, #ffcdd2, #ffebee);
    }
    50% {
        transform: scale(1.02);
        box-shadow: 0 0 25px rgba(244, 67, 54, 0.7);
        background: linear-gradient(45deg, #fff, #ffebee, #fff);
    }
    75% {
        transform: scale(1.05);
        box-shadow: 0 0 30px rgba(244, 67, 54, 0.8);
        background: linear-gradient(45deg, #ffebee, #ffcdd2, #ffebee);
    }
    100% {
        transform: scale(1);
        box-shadow: 0 2px 6px rgba(0, 0, 0, 0.3);
        background: white;
    }
}

.card.burned {
    background: linear-gradient(145deg, #424242, #2c2c2c);
    color: #888;
    cursor: not-allowed;
    opacity: 0.9;
    border: 2px solid #555;
    box-shadow: 
        0 4px 8px rgba(0, 0, 0, 0.3),
        0 1px 3px rgba(0, 0, 0, 0.2),
        inset 0 1px 0 rgba(255, 255, 255, 0.1);
}

.card.burned:hover {
    transform: none;
    box-shadow: 
        0 4px 8px rgba(0, 0, 0, 0.3),
        0 1px 3px rgba(0, 0, 0, 0.2),
        inset 0 1px 0 rgba(255, 255, 255, 0.1);
}

.burned-indicator {
    font-size: 0.9rem;
    font-weight: 900;
    text-align: center;
    margin-top: 50%;
    transform: translateY(-50%);
    color: #aaa;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.5);
    letter-spacing: 1px;
}

/* Card corner elements */
.card .corner {
    position: absolute;
    display: flex;
    flex-direction: column;
    align-items: center;
    line-height: 1;
}

.card .corner.top-left {
    top: 8px;
    left: 8px;
}

.card .corner.bottom-right {
    bottom: 8px;
    right: 8px;
    transform: rotate(180deg);
}

.card .corner .rank {
    font-size: 1rem;
    font-weight: 900;
    line-height: 1;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
}

.card .corner .suit {
    font-size: 1.2rem;
    line-height: 1;
    margin-top: 1px;
}

/* Center suit */
.card .center-suit {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 2.5rem;
    line-height: 1;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
}

.card.red {
    color: #c62828;
    text-shadow: 0 1px 2px rgba(198, 40, 40, 0.2);
}

.card.black {
    color: #1a1a1a;
    text-shadow: 0 1px 2px rgba(26, 26, 26, 0.2);
}

/* Celebration animation styles */
@keyframes flyCard {
    0% {
        transform: translate(0, 0) rotate(0deg) scale(1);
        opacity: 1;
    }
    25% {
        transform: translate(var(--fly-x), var(--fly-y)) rotate(var(--rotate)) scale(1.1);
        opacity: 0.8;
    }
    50% {
        transform: translate(calc(var(--fly-x) * 1.5), calc(var(--fly-y) * 1.5)) rotate(calc(var(--rotate) * 2)) scale(0.9);
        opacity: 0.6;
    }
    75% {
        transform: translate(calc(var(--fly-x) * 2), calc(var(--fly-y) * 2)) rotate(calc(var(--rotate) * 3)) scale(0.7);
        opacity: 0.4;
    }
    100% {
        transform: translate(calc(var(--fly-x) * 2.5), calc(var(--fly-y) * 2.5)) rotate(calc(var(--rotate) * 4)) scale(0.5);
        opacity: 0;
    }
}

.celebration-card {
    position: fixed;
    width: 60px;
    height: 84px;
    background: linear-gradient(145deg, #ffffff, #f0f0f0);
    border: 2px solid #ddd;
    border-radius: 8px;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
    z-index: 999;
    pointer-events: none;
    animation: flyCard 3s ease-out forwards;
}

.celebration-card .rank,
.celebration-card .suit {
    position: absolute;
    font-family: 'Georgia', serif;
}

.celebration-card .rank.top-left {
    top: 4px;
    left: 4px;
    font-size: 12px;
    font-weight: bold;
}

.celebration-card .rank.bottom-right {
    bottom: 4px;
    right: 4px;
    font-size: 12px;
    font-weight: bold;
    transform: rotate(180deg);
}

.celebration-card .suit.top-left {
    top: 4px;
    left: 16px;
    font-size: 8px;
}

.celebration-card .suit.bottom-right {
    bottom: 4px;
    right: 16px;
    font-size: 8px;
    transform: rotate(180deg);
}

.celebration-card .center-suit {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 16px;
}

.celebration-card.red {
    color: #c62828;
}

.celebration-card.black {
    color: #1a1a1a;
}

/* Header layout */
.header-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
}

.header-left {
    width: 40px;
    flex-shrink: 0;
}

.header-middle {
    flex: 1;
    text-align: center;
}

.header-right {
    width: 40px;
    flex-shrink: 0;
}

/* Game subtitle */
.game-subtitle {
    text-align: left;
    color: #666;
    margin: 0 0 15px 0;
    font-size: 1.1rem;
    font-weight: 300;
}

/* Game instructions */
.game-instructions {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 12px;
    padding: 20px;
    margin: 20px 0;
    border: 1px solid rgba(255, 255, 255, 0.2);
}

.game-instructions h2 {
    color: #fff;
    margin-bottom: 15px;
    font-size: 1.3rem;
}

.game-instructions ol {
    color: #e0e0e0;
    line-height: 1.6;
    margin: 0;
    padding-left: 20px;
}

.game-instructions li {
    margin-bottom: 8px;
}

/* Screen reader only text */
.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

/* Footer styles */
footer {
    position: fixed;
    bottom: 0;
    left: 0;
    width: 100%;
    padding: 20px;
    text-align: center;
    color: #888;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    z-index: 100;
}

.footer-content {
    max-width: 600px;
    margin: 0 auto;
}

.footer-content p {
    margin-bottom: 15px;
}

.footer-content nav ul {
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex;
    justify-content: center;
    gap: 20px;
}

.footer-content nav a {
    color: #888;
    text-decoration: none;
    transition: color 0.3s ease;
}

.footer-content nav a:hover {
    color: #4caf50;
}

/* Hamburger Menu Styles */
.hamburger-menu {
    background: none;
    border: none;
    cursor: pointer;
    padding: 8px;
    display: flex;
    flex-direction: column;
    gap: 4px;
    border-radius: 4px;
    transition: background-color 0.3s ease;
}

.hamburger-menu:hover {
    background-color: rgba(255, 255, 255, 0.1);
}

.hamburger-line {
    width: 24px;
    height: 3px;
    background-color: #fff;
    border-radius: 2px;
    transition: all 0.3s ease;
}

/* Menu Overlay */
.menu-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.9);
    z-index: 2000;
    display: none;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.menu-overlay.active {
    display: flex;
    opacity: 1;
}

.menu-content {
    background: #1a1a1a;
    width: 90%;
    max-width: 500px;
    height: 90%;
    max-height: 600px;
    margin: auto;
    border-radius: 12px;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
}

.menu-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px;
    border-bottom: 1px solid #333;
    background: #2a2a2a;
}

.menu-header h2 {
    color: #fff;
    margin: 0;
    font-size: 1.5rem;
}

.close-menu {
    background: none;
    border: none;
    color: #fff;
    font-size: 2rem;
    cursor: pointer;
    padding: 0;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: background-color 0.3s ease;
}

.close-menu:hover {
    background-color: #333;
}



/* Single Menu Content */
.menu-content-single {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
    color: #e0e0e0;
    line-height: 1.6;
}

.menu-content-single p {
    margin-bottom: 20px;
    font-size: 1.1rem;
}

.menu-content-single p:last-child {
    margin-bottom: 0;
}

.game-over {
    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: 1000;
}

.game-over-content {
    background: white;
    color: black;
    padding: 40px;
    border-radius: 12px;
    text-align: center;
    max-width: 400px;
    margin: 20px;
}

.game-over-content h2 {
    margin-bottom: 20px;
    font-size: 2rem;
}

.game-over-content p {
    margin-bottom: 30px;
    font-size: 1.2rem;
}

#new-game-btn {
    padding: 15px 30px;
    background: #4caf50;
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 1.2rem;
    cursor: pointer;
    transition: background 0.3s ease;
}

#new-game-btn:hover {
    background: #45a049;
}

@media (max-width: 768px) {
    .game-container {
        padding: 8px;
    }
    
    h1 {
        font-size: 1.8rem;
        margin-bottom: 10px;
    }
    
    header {
        margin-bottom: 15px;
    }
    
    .game-info {
        gap: 20px;
        font-size: 0.9rem;
    }
    
    .face-up-cards {
        gap: 6px;
        margin-bottom: 15px;
    }
    
    .card {
        font-size: 1rem;
        padding: 6px;
        border-radius: 10px;
    }
    
    .card .corner.top-left {
        top: 6px;
        left: 6px;
    }
    
    .card .corner.bottom-right {
        bottom: 6px;
        right: 6px;
    }
    
    .card .corner .rank {
        font-size: 0.9rem;
    }
    
    .card .corner .suit {
        font-size: 1.1rem;
    }
    
    .card .center-suit {
        font-size: 2.2rem;
    }
    
    .card .suit {
        font-size: 1.2rem;
    }
    
    .burned-indicator {
        font-size: 0.7rem;
    }
    
    .floating-guess-buttons button {
        width: 60px;
        height: 35px;
        font-size: 0.8rem;
    }

    /* Mobile menu adjustments */
    .menu-content {
        width: 95%;
        height: 95%;
        max-height: none;
    }
    

    

}

@media (max-width: 480px) {
    .game-container {
        padding: 5px;
    }
    
    h1 {
        font-size: 1.5rem;
        margin-bottom: 8px;
    }
    
    .game-info {
        flex-direction: column;
        gap: 8px;
        font-size: 0.8rem;
    }
    
    .face-up-cards {
        gap: 4px;
        padding: 0 2px;
    }
    
    .card {
        font-size: 0.9rem;
        padding: 5px;
        max-width: 90px;
        border-radius: 8px;
    }
    
    .card .corner.top-left {
        top: 5px;
        left: 5px;
    }
    
    .card .corner.bottom-right {
        bottom: 5px;
        right: 5px;
    }
    
    .card .corner .rank {
        font-size: 0.8rem;
    }
    
    .card .corner .suit {
        font-size: 1rem;
    }
    
    .card .center-suit {
        font-size: 2rem;
    }
    
    .card .suit {
        font-size: 1rem;
    }
    
    .burned-indicator {
        font-size: 0.6rem;
    }
    
    .floating-guess-buttons button {
        width: 55px;
        height: 32px;
        font-size: 0.75rem;
    }
    
    .cancel-btn {
        padding: 6px 12px;
        font-size: 0.8rem;
    }
}

@media (max-width: 360px) {
    h1 {
        font-size: 1.3rem;
    }
    
    .card {
        font-size: 0.8rem;
        max-width: 80px;
        padding: 4px;
        border-radius: 6px;
    }
    
    .card .corner.top-left {
        top: 4px;
        left: 4px;
    }
    
    .card .corner.bottom-right {
        bottom: 4px;
        right: 4px;
    }
    
    .card .corner .rank {
        font-size: 0.7rem;
    }
    
    .card .corner .suit {
        font-size: 0.9rem;
    }
    
    .card .center-suit {
        font-size: 1.8rem;
    }
    
    .card .suit {
        font-size: 0.9rem;
    }
    
    .burned-indicator {
        font-size: 0.5rem;
    }
    
    .floating-guess-buttons button {
        width: 50px;
        height: 30px;
        font-size: 0.7rem;
    }
}