:root {
    --primary-bg: #e0f2f7;
    --secondary-bg: #c1e4f0;
    --container-bg: #fcfcfc;
    --primary-text: #333333;
    --secondary-text: #555555;
    --light-gray: #cccccc;
    --medium-gray: #888888;
    --border-color: #e0e0e0;

    --button-bg: #6a8eab;
    --button-hover-bg: #7b9ebc;
    --action-btn-bg: #4CAF50;
    --action-btn-hover-bg: #45a049;
    --rules-btn-bg: #607d8b;
    --rules-btn-hover-bg: #546e7a;
    --close-btn-bg: #28a745;
    --close-btn-hover-bg: #218838;

    --day-selected-bg: #ffcc00;
    --day-selected-border: #e6b800;
    --night-selected-bg: #334466;
    --night-selected-border: #223355;
    --move-selected-bg: #28a745;
    --move-selected-border: #1c7430;

    --win-color: #28a745;
    --lose-color: #dc3545;
    --tie-color: #333333;

    --font-main: 'Inter', 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    --font-display: "Nova Oval", sans-serif;
}

* {
    box-sizing: border-box;
}

body {
    background: linear-gradient(135deg, var(--primary-bg), var(--secondary-bg));
    font-family: var(--font-main);
    color: var(--primary-text);
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    margin: 0;
    text-align: center;
}

.site-container {
    background-color: var(--container-bg);
    padding: 1rem 4rem;
    border-radius: 15px;
    box-shadow: 0 15px 40px rgba(0, 0, 0, 0.15);
    width: 90%;
    max-width: 900px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    height: auto;
    max-height: 98vh;
    overflow-y: auto;
}

.logo-box {
    margin-top: 0;
    margin-bottom: 1.5rem;
    cursor: pointer;
}

.logo-img {
    width: 120px;
    height: 120px;
    margin-bottom: 0.5rem;
}

.logo-text {
    font-family: var(--font-display);
    font-size: 2.5rem;
    font-weight: bold;
    color: #222;
    letter-spacing: 1.5px;
}

h2, h4, button {
    font-family: var(--font-display);
    letter-spacing: 0.5px;
}

.game-box {
    display: flex;
    gap: 1.5rem;
    align-items: center;
    justify-content: center;
    padding: 0.5rem 0;
}

.participant-box {
    display: flex;
    flex-direction: column;
    background-color: var(--container-bg);
    padding: 1.5rem;
    border-radius: 12px;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.05);
    flex: 1;
    height: auto;
}

h2 {
    font-size: 1.8rem;
    color: #444;
    margin: 0 0 0.75rem 0;
    padding-bottom: 0.5rem;
    margin-bottom: auto;
}

h4 {
    font-size: 1.2rem;
    color: var(--secondary-text);
    margin-bottom: 0.5rem;
    margin-top: auto;
}

.result-indicator-box {
    font-size: 4rem;
    font-weight: 800;
    color: var(--medium-gray);
    min-width: 60px;
    flex-shrink: 0;
}

.player-actions {
    margin-top: 1.5rem;
    padding: 1.5rem;
    background-color: var(--container-bg);
    border-radius: 12px;
    box-shadow: inset 0 0 10px rgba(0, 0, 0, 0.03);
    border: 1px solid #eeeeee;
    display: flex;
    flex-direction: column;
    gap: 1rem;
    align-items: center;
}

.action-set {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 1rem;
    width: 100%;
}

.action-group {
    display: flex;
    flex-direction: column;
    align-items: center;
    border: none;
    padding: 1rem;
    border-radius: 10px;
    background-color: #ffffff;
    box-shadow: 0 3px 10px rgba(0, 0, 0, 0.08);
}

.plus-divider {
    font-size: 1.5rem;
    color: #aaaaaa;
    font-weight: bold;
}

.button-group {
    display: flex;
    gap: 0.5rem;
}

button {
    background-color: var(--button-bg);
    color: white;
    border: 2px solid transparent;
    padding: 10px 20px;
    border-radius: 10px;
    font-size: 0.95rem;
    cursor: pointer;
    transition: background-color 0.3s, transform 0.2s, border-color 0.3s, box-shadow 0.3s;
    font-weight: bold;
    letter-spacing: 0.5px;
}

button:hover:not(:disabled) {
    background-color: var(--button-hover-bg);
    transform: translateY(-2px) scale(1.01);
    box-shadow: 0 3px 10px rgba(0, 0, 0, 0.08);
}

button:disabled {
    background-color: var(--light-gray);
    color: var(--medium-gray);
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

button.selected {
    border-color: transparent;
    transform: translateY(-2px);
    box-shadow: 0 3px 8px rgba(0, 0, 0, 0.1);
}

button.time-btn.selected#day-btn {
    background-color: var(--day-selected-bg);
    border-color: var(--day-selected-border);
    color: var(--primary-text);
}

button.time-btn.selected#night-btn {
    background-color: var(--night-selected-bg);
    border-color: var(--night-selected-border);
}

button.move-btn.selected {
    background-color: var(--move-selected-bg);
    border-color: var(--move-selected-border);
}

#action-btn {
    margin-top: 0.75rem;
    width: 50%;
    background-color: var(--action-btn-bg);
    box-shadow: 0 3px 8px rgba(76, 175, 80, 0.3);
}

#action-btn:disabled {
    background-color: var(--light-gray);
    color: var(--medium-gray);
    box-shadow: none;
}

#action-btn:hover:not(:disabled) {
    background-color: var(--action-btn-hover-bg);
    transform: translateY(-2px);
    box-shadow: 0 4px 10px rgba(76, 175, 80, 0.4);
}

.choice-display {
    width: 100%;
    max-width: 200px;
    margin-left: auto;
    margin-right: auto;
    aspect-ratio: 1 / 1;
    border-radius: 8px;
    border: 3px solid var(--border-color);
    display: flex;
    justify-content: center;
    align-items: center;
    background-color: #f0f0f0;
    background-repeat: no-repeat;
    background-size: cover;
    box-shadow: inset 0 0 10px rgba(0, 0, 0, 0.05);
    overflow: hidden;
}

.choice-display p {
    font-size: 5rem;
    color: #b0b0b0;
    font-weight: bold;
    text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.05);
}

.selection-text {
    margin-top: 0.75rem;
    font-size: 0.9rem;
    font-style: italic;
    color: var(--secondary-text);
    height: 24px;
}

/* Combined classes for choices */
.choice-day-blunt { background-image: url('img/blunt-day.jpg'); background-color: #ffffff; }
.choice-night-blunt { background-image: url('img/blunt-night.jpg'); background-color: #4A4A4A; }
.choice-day-flex { background-image: url('img/flex-day.jpg'); background-color: #ffffff; }
.choice-night-flex { background-image: url('img/flex-night.jpg'); background-color: #4A4A4A; }
.choice-day-sharp { background-image: url('img/sharp-day.jpg'); background-color: #ffffff; }
.choice-night-sharp { background-image: url('img/sharp-night.jpg'); background-color: #4A4A4A; }


footer { margin-top: 1.5rem; }
.rules-btn {
    background-color: var(--rules-btn-bg);
    width: 36px;
    height: 36px;
    border-radius: 50%;
    padding: 0;
    font-size: 1.1rem;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.2);
    font-weight: bold;
}
.rules-btn:hover {
    background-color: var(--rules-btn-hover-bg);
    transform: translateY(-2px);
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.3);
}
.foot { margin-top: 0.75rem; color: var(--medium-gray); font-size: 0.85rem; }

.modal { display: none; position: fixed; z-index: 1000; left: 0; top: 0; width: 100%; height: 100%; background-color: rgba(0,0,0,0.6); justify-content: center; align-items: center; }
.modal-content {
    background-color: #ffffff;
    padding: 30px;
    border-radius: 20px;
    box-shadow: 0 20px 50px rgba(0,0,0,0.3);
    width: 90%;
    max-width: 450px;
    text-align: center;
    font-family: var(--font-display);
    border: none;
}
.modal-content h1 {
    font-size: 2.5rem;
    margin-bottom: 1rem;
    color: var(--primary-text);
}
.modal-content h2 {
    font-size: 1.6rem;
    margin-bottom: 1rem;
    color: #444;
    border-bottom: 2px solid #eee;
    padding-bottom: 0.5rem;
}
.modal-content p {
    font-size: 1rem;
    margin-bottom: 0.75rem;
    line-height: 1.5;
    color: var(--secondary-text);
}
.rules-condition {
    font-size: 0.85rem;
    font-style: italic;
    color: #666;
    margin-top: -0.2rem;
    margin-bottom: 1rem;
}
.modal-content ul {
    list-style-type: none;
    padding: 0;
    margin-bottom: 1rem;
    font-size: 1rem;
    line-height: 1.5;
}
.modal-content li {
    margin-bottom: 0.4rem;
    color: var(--secondary-text);
}

#modal-close-btn, #rules-close-btn { background-color: var(--close-btn-bg); }
#modal-close-btn:hover, #rules-close-btn:hover { background-color: var(--close-btn-hover-bg); }

/* Mobile Optimizations */
@media (max-width: 768px) {
    body {
        height: 100vh;
        padding: 0;
        align-items: stretch;
    }

    .site-container {
        padding: 0.5rem;
        width: 100%;
        height: 100%;
        max-height: 100vh;
        border-radius: 0;
        justify-content: space-around;
    }

    .logo-box {
        margin-bottom: 0; 
    }

    .logo-text {
        font-size: 1.5rem;
    }

    .logo-img {
        width: 60px;
        height: 60px;
        margin-bottom: 0.25rem;
    }

    .game-box {
        flex-direction: row;
        gap: 0.25rem;
        padding: 0;
    }

    .participant-box {
        padding: 0.25rem;
    }
    
    .selection-text {
        margin-top: 0.25rem;
        font-size: 0.8rem;
        min-height: 18px;
    }

    h2 {
        font-size: 1.1rem;
        margin-bottom: 0.25rem;
    }

    h4 {
        font-size: 1rem;
        margin-bottom: 0.25rem;
    }

    .result-indicator-box {
        margin: 0;
        font-size: 2rem;
    }

    .player-actions {
        padding: 0.5rem;
        margin-top: 0.25rem; 
        gap: 0.5rem;
    }
    
    .action-group {
        padding: 0.5rem;
    }
    
    .action-set {
        gap: 0.5rem;
    }

    .button-group {
        gap: 0.25rem;
        display: flex;
    }

    .button-group button {
        flex: 1; 
        display: flex; 
        align-items: center; 
        justify-content: center; 
    }

    button {
        padding: 10px 12px;
        font-size: 0.85rem;
    }

    #action-btn {
        width: 100%;
        padding: 12px;
        font-size: 1rem;
        margin-top: 0.25rem;
    }
    
    footer {
        margin-top: 0.5rem;
    }
    
    .foot {
        margin-top: 0.25rem;
    }

    .modal-content {
        padding: 20px;
        width: 95%;
    }

    .modal-content h1 {
        font-size: 2rem;
    }
}