:root {
    --table-green: #2e7d32;
    --table-dark: #1b5e20;
    --card-white: #f5f5f5;
    --text-gold: #ffd700;
    --modal-bg: rgba(0, 0, 0, 0.8);
    --header-bg: #1a1a2e;
}

/* ===== Main Header ===== */
.main-header {
    background: var(--header-bg);
    padding: 15px 20px;
    position: sticky;
    top: 0;
    z-index: 1000;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.3);
}

.header-container {
    max-width: 1200px;
    margin: 0 auto;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.site-logo {
    font-size: 1.5rem;
    font-weight: bold;
    color: var(--text-gold);
    text-decoration: none;
}

.main-nav {
    display: flex;
    gap: 20px;
}

.main-nav a {
    color: white;
    text-decoration: none;
    padding: 8px 15px;
    border-radius: 5px;
    transition: background 0.3s;
}

.main-nav a:hover,
.main-nav a.active {
    background: rgba(255, 215, 0, 0.2);
    color: var(--text-gold);
}

.menu-toggle {
    display: none;
    background: none;
    border: none;
    color: white;
    font-size: 1.8rem;
    cursor: pointer;
}

/* Mobile Navigation */
@media (max-width: 768px) {
    .menu-toggle {
        display: block;
    }

    .main-nav {
        display: none;
        position: absolute;
        top: 100%;
        left: 0;
        right: 0;
        background: var(--header-bg);
        flex-direction: column;
        padding: 20px;
        gap: 10px;
        box-shadow: 0 5px 10px rgba(0, 0, 0, 0.3);
    }

    .main-nav.active {
        display: flex;
    }

    .main-nav a {
        padding: 12px 15px;
        border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    }
}

/* ===== Main Footer ===== */
.main-footer {
    background: var(--header-bg);
    padding: 40px 20px 20px;
    margin-top: 40px;
}

.footer-container {
    max-width: 1200px;
    margin: 0 auto;
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 30px;
}

.footer-brand .footer-logo {
    font-size: 1.3rem;
    font-weight: bold;
    color: var(--text-gold);
}

.footer-brand p {
    color: #aaa;
    margin-top: 10px;
    font-size: 0.9rem;
}

.footer-links h4 {
    color: var(--text-gold);
    margin-bottom: 15px;
}

.footer-links a {
    display: block;
    color: #ccc;
    text-decoration: none;
    padding: 5px 0;
    transition: color 0.3s;
}

.footer-links a:hover {
    color: var(--text-gold);
}

.footer-bottom {
    text-align: center;
    padding-top: 30px;
    margin-top: 30px;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    color: #888;
    font-size: 0.85rem;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    font-family: 'Roboto', sans-serif;
    user-select: none;
    /* Prevent text selection checks */
}

body {
    background-color: var(--table-dark);
    background-image: radial-gradient(circle, var(--table-green) 0%, var(--table-dark) 100%);
    min-height: 100vh;
    overflow-x: hidden;
    color: white;
}

/* ===== How to Play Section ===== */
.how-to-play {
    background: linear-gradient(135deg, #1a237e 0%, #311b92 100%);
    padding: 40px 20px;
    text-align: center;
}

.how-to-container {
    max-width: 900px;
    margin: 0 auto;
}

.how-to-play h1 {
    color: var(--text-gold);
    font-size: 2rem;
    margin-bottom: 15px;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.5);
}

.how-to-play .intro {
    font-size: 1.1rem;
    color: #e8eaf6;
    margin-bottom: 30px;
}

.rules-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
}

.rule-card {
    background: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(10px);
    border-radius: 12px;
    padding: 20px;
    border: 1px solid rgba(255, 255, 255, 0.2);
    transition: transform 0.3s;
}

.rule-card:hover {
    transform: translateY(-5px);
}

.rule-card h3 {
    color: var(--text-gold);
    margin-bottom: 10px;
}

.rule-card p {
    color: #e0e0e0;
    line-height: 1.5;
}

.rule-card .red {
    color: #ef5350;
}

.steps {
    background: rgba(0, 0, 0, 0.3);
    border-radius: 12px;
    padding: 20px;
    margin-bottom: 30px;
    text-align: left;
}

.steps h3 {
    color: var(--text-gold);
    margin-bottom: 15px;
    text-align: center;
}

.steps ol {
    padding-left: 25px;
}

.steps li {
    margin-bottom: 10px;
    color: #e0e0e0;
}

.play-now-btn {
    display: inline-block;
    background: linear-gradient(135deg, #ffd700, #ffab00);
    color: #1a237e;
    padding: 15px 40px;
    border-radius: 50px;
    font-size: 1.2rem;
    font-weight: bold;
    text-decoration: none;
    box-shadow: 0 4px 15px rgba(255, 215, 0, 0.4);
    transition: transform 0.3s, box-shadow 0.3s;
}

.play-now-btn:hover {
    transform: scale(1.05);
    box-shadow: 0 6px 20px rgba(255, 215, 0, 0.6);
}

/* ===== Game Container ===== */
.game-container {
    width: 100%;
    max-width: 1000px;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    padding: 10px;
    margin: 0 auto;
}

/* Header */
.game-header {
    display: flex;
    justify-content: space-between;
    padding: 10px 20px;
    background: rgba(0, 0, 0, 0.2);
    border-radius: 8px;
}

.logo {
    font-size: 1.2rem;
    font-weight: bold;
    color: var(--text-gold);
}

.btn {
    padding: 8px 16px;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-weight: bold;
    transition: transform 0.1s;
}

.btn:active {
    transform: scale(0.95);
}

.btn.primary {
    background-color: var(--text-gold);
    color: #333;
}

.btn.secondary {
    background-color: #ddd;
    color: #333;
}

/* Areas */
.player-area {
    padding: 10px;
    display: flex;
    flex-direction: column;
    align-items: center;
    position: relative;
}

.avatary {
    font-size: 0.9rem;
    margin-top: 5px;
    opacity: 0.8;
}

/* Hand */
.hand {
    display: flex;
    justify-content: center;
    height: 120px;
    /* Space for cards */
    width: 100%;
    margin: 10px 0;
}

/* Cards */
.card {
    width: 80px;
    height: 112px;
    background-color: var(--card-white);
    border-radius: 6px;
    box-shadow: 2px 2px 5px rgba(0, 0, 0, 0.3);
    margin: 0 -35px;
    /* Overlap cards */
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 1.5rem;
    font-weight: bold;
    color: #333;
    position: relative;
    transition: transform 0.2s, margin 0.2s;
    cursor: pointer;
    border: 1px solid #ccc;
}

.card:hover {
    transform: translateY(-20px);
    z-index: 100;
}

.card.back {
    background: linear-gradient(135deg, #b71c1c 25%, #d32f2f 25%, #d32f2f 50%, #b71c1c 50%, #b71c1c 75%, #d32f2f 75%, #d32f2f 100%);
    background-size: 10px 10px;
    border: 2px solid white;
}

.card.red {
    color: #d32f2f;
}

.card.black {
    color: #212121;
}

.card-value-top,
.card-value-bottom {
    position: absolute;
    font-size: 0.8rem;
}

.card-value-top {
    top: 4px;
    left: 4px;
}

.card-value-bottom {
    bottom: 4px;
    right: 4px;
    transform: rotate(180deg);
}

/* Center Table */
.table-center {
    flex-grow: 1;
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 40px;
}

.deck-container,
.discard-container {
    display: flex;
    flex-direction: column;
    align-items: center;
}

.deck,
.discard-pile {
    width: 90px;
    height: 122px;
    border: 2px dashed rgba(255, 255, 255, 0.3);
    border-radius: 8px;
    display: flex;
    justify-content: center;
    align-items: center;
    position: relative;
}

.deck .card,
.discard-pile .card {
    margin: 0;
    position: absolute;
}

.label {
    margin-top: 5px;
    font-size: 0.8rem;
    color: #ddd;
}

.action-hint {
    margin-top: 10px;
    font-size: 1.1rem;
    color: var(--text-gold);
    font-weight: bold;
    text-shadow: 1px 1px 2px black;
}

/* Modal */
.hidden {
    display: none;
}

.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: var(--modal-bg);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
}

.modal-content {
    background: white;
    padding: 20px;
    border-radius: 8px;
    color: #333;
    max-width: 400px;
    width: 90%;
}

.close-btn {
    float: right;
    font-size: 1.5rem;
    cursor: pointer;
}

/* Animations */
@keyframes deal {
    from {
        transform: translateY(-200px) scale(0.5);
        opacity: 0;
    }

    to {
        transform: translateY(0) scale(1);
        opacity: 1;
    }
}

.interactive-card {
    /* Style for player cards */
    background-color: white;
}

.selected {
    transform: translateY(-20px);
    box-shadow: 0 0 10px var(--text-gold);
    border: 2px solid var(--text-gold);
}