/* Variable definitions */
:root {
    --primary: #bb86fc; /* Updated to match template */
    --secondary: #2ecc71;
    --accent: #3498db;
    --dark: #121212; /* Updated to match template */
    --dark-card: #1E1E1E;
    --dark-accent: #2D2D2D;
    --light: #e0e0e0; /* Updated to match template */
    --border-radius: 12px;
    --shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
    --card-color: #2a2a2a;
    --text-light: #a0a0a0;
}

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

body.dark-theme {
    font-family: 'Poppins', sans-serif;
    background-color: var(--dark);
    color: var(--light);
    line-height: 1.6;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

/* Container */
.container {
    max-width: 1100px;
    margin: 0 auto;
    padding: 0 20px;
}

/* Game Page Header */
.game-page-header {
    background-color: #1f1f1f;
    padding: 0.8rem 0;
    border-bottom: 1px solid #333;
    box-shadow: 0 2px 5px rgba(0,0,0,0.3);
    flex-shrink: 0;
}

.back-link {
    color: var(--primary);
    text-decoration: none;
    font-size: 0.95rem;
    font-weight: 500;
    transition: color 0.2s ease;
}

.back-link:hover {
    color: var(--light);
}

/* Main Game Content Area */
.game-content {
    padding: 2rem 0;
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.game-title {
    font-size: 2.2rem;
    font-weight: 600;
    color: var(--primary);
    text-align: center;
    margin-bottom: 1.5rem;
    text-shadow: 0 2px 10px rgba(187, 134, 252, 0.3);
    background: linear-gradient(to right, var(--primary), #c39dff);
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
}

/* The Game Container */
#game-container {
    width: 100%;
    max-width: 800px;
    min-height: 500px;
    background-color: var(--card-color);
    border: 2px solid #444;
    border-radius: 8px;
    margin: 0 auto 2rem auto;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.4);
    overflow: hidden;
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 1.5rem;
}

#game-container::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.05) 0%, transparent 50%);
    z-index: 0;
    pointer-events: none;
}

/* Game Instructions Area */
.game-instructions {
    background-color: #1e1e1e;
    border: 1px solid #333;
    border-radius: 6px;
    padding: 1rem 1.5rem;
    max-width: 700px;
    width: 90%;
    margin: 0 auto;
    text-align: center;
}

.game-instructions h2 {
    font-size: 1.3rem;
    color: var(--light);
    margin-bottom: 0.75rem;
    font-weight: 600;
}

.game-instructions p {
    font-size: 0.95rem;
    color: #a0a0a0;
    line-height: 1.7;
}

/* Footer Styles */
.site-footer {
    background-color: #1f1f1f;
    color: #a0a0a0;
    text-align: center;
    padding: 1.5rem 0;
    margin-top: auto;
    font-size: 0.9rem;
    border-top: 1px solid #333;
    flex-shrink: 0;
}

.site-footer p {
    margin: 0;
}

/* Responsive Adjustments */
@media (max-width: 768px) {
    .game-title {
        font-size: 1.8rem;
    }
    #game-container {
        min-height: 400px;
    }
    .game-instructions {
        width: 95%;
        padding: 0.8rem 1rem;
    }
    .game-instructions h2 {
        font-size: 1.2rem;
    }
    .game-instructions p {
        font-size: 0.9rem;
    }
}

@media (max-width: 480px) {
    .game-title {
        font-size: 1.6rem;
    }
    #game-container {
        min-height: 300px;
        border-width: 1px;
    }
    .back-link {
        font-size: 0.9rem;
    }
}

/* ================= Game-specific styles below ================= */

/* Game Info Section */
.game-info {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px 20px;
    background: rgba(0, 0, 0, 0.2);
    border-radius: var(--border-radius);
    margin-bottom: 30px;
    position: relative;
    z-index: 1;
    width: 100%;
}

.score-container {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 5px;
}

.score, .high-score, .timer {
    font-size: 1.2rem;
    font-weight: 500;
}

.score-value, .high-score-value, .timer-value {
    font-weight: 700;
    color: #fff;
}

/* Game Board */
.game-board {
    position: relative;
    z-index: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 25px;
    width: 100%;
}

/* Dice Container */
.dice-container {
    display: flex;
    justify-content: center;
    flex-wrap: wrap;
    gap: 20px;
    margin-bottom: 10px;
}

.die {
    width: 80px;
    height: 80px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 14px;
    background: linear-gradient(145deg, #333333, #222222);
    box-shadow: 0 6px 12px rgba(0, 0, 0, 0.3);
    cursor: pointer;
    transition: all 0.25s ease;
    font-size: 2.5rem;
    position: relative;
    border: 2px solid rgba(255, 255, 255, 0.1);
}

.die::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    border-radius: 12px;
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.1) 0%, transparent 50%);
    z-index: -1;
}

.die.selected {
    border-color: #e74c3c;
    background: linear-gradient(145deg, #3a3a3a, #2d2d2d);
    box-shadow: 0 0 15px rgba(231, 76, 60, 0.6);
    transform: translateY(-5px);
}

.die.selected::before {
    background: linear-gradient(135deg, rgba(231, 76, 60, 0.2) 0%, transparent 70%);
}

.die-value {
    color: white;
    text-shadow: 0 2px 5px rgba(0, 0, 0, 0.3);
}

/* Controls Container */
.controls-container {
    margin: 20px 0;
}

.action-button {
    padding: 12px 35px;
    font-size: 1.2rem;
    font-weight: 600;
    background: linear-gradient(to right, var(--primary), #9d70d8);
    color: white;
    border: none;
    border-radius: 50px;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(187, 134, 252, 0.4);
    position: relative;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
}

.action-button::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.2), transparent);
    transition: all 0.5s ease;
}

.action-button:hover {
    background: linear-gradient(to right, #9d70d8, #7c54bb);
    transform: translateY(-2px);
    box-shadow: 0 7px 20px rgba(187, 134, 252, 0.5);
}

.action-button:hover::before {
    left: 100%;
}

.action-button:active {
    transform: translateY(1px);
    box-shadow: 0 2px 8px rgba(46, 204, 113, 0.4);
}

/* Message Container */
.message-container {
    min-height: 60px;
    font-size: 1.4rem;
    font-weight: 500;
    color: #f5f5f5;
    text-align: center;
    margin: 10px 0;
    padding: 12px 20px;
    background-color: rgba(187, 134, 252, 0.15);
    border-radius: 12px;
    border: 1px solid rgba(187, 134, 252, 0.3);
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.2);
    display: inline-block;
}

/* Hide the message container when empty */
.message-container:empty {
    display: none;
}

/* Hand Guide */
.hand-guide {
    background-color: rgba(0, 0, 0, 0.2);
    border-radius: var(--border-radius);
    padding: 15px 20px;
    margin-top: 10px;
    width: 100%;
}

.hand-guide h3 {
    color: var(--light);
    font-size: 1.3rem;
    margin-bottom: 10px;
    text-align: center;
}

.hand-list {
    list-style: none;
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 10px;
}

.hand-list li {
    padding: 8px 12px;
    background: rgba(0, 0, 0, 0.15);
    border-radius: 8px;
    transition: all 0.2s ease;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.hand-list li:hover {
    background: rgba(0, 0, 0, 0.25);
}

.hand-name {
    font-weight: 500;
    color: var(--light);
}

.points {
    color: var(--primary);
    font-weight: 600;
}

@keyframes rollDice {
    0% { transform: translateY(0) rotate(0); }
    50% { transform: translateY(-20px) rotate(180deg); }
    100% { transform: translateY(0) rotate(360deg); }
}

.die.rolling {
    animation: rollDice 0.5s ease;
}

@media (max-width: 768px) {
    .game-info {
        flex-direction: column;
        gap: 15px;
    }
    
    .hand-list {
        grid-template-columns: 1fr;
    }
    
    .dice-container {
        gap: 15px;
    }
    
    .die {
        width: 65px;
        height: 65px;
        font-size: 2rem;
    }
}

@media (max-width: 480px) {
    .game-info {
        padding: 10px 15px;
    }
    
    .score-container {
        align-items: center;
    }
    
    .dice-container {
        gap: 10px;
    }
    
    .die {
        width: 55px;
        height: 55px;
        font-size: 1.8rem;
    }
    
    .action-button {
        padding: 10px 25px;
        font-size: 1rem;
    }
}
