/*
========================================
  IMPORTS & ROOT VARIABLES
  (imports must be at top for fonts)
========================================
*/
@import url('https://fonts.googleapis.com/css2?family=Fredericka+the+Great&family=Rye&family=Sancreek&display=swap');

:root {
    --primary-font: 'Rye', cursive;
    --secondary-font: 'Sancreek', cursive;
    --tertiary-font: 'Fredericka the Great', cursive;
}

/*
========================================
  TYPOGRAPHY
========================================
*/
h1, h2, h3 {
    font-family: var(--primary-font);
}

h4, h5, h6, p {
    font-family: var(--secondary-font);
}

.btn, button {
    font-family: var(--secondary-font);
}

.accent, .accent-text, li {
    font-family: var(--tertiary-font);
}

/*
========================================
  HEADER
========================================
*/
.headerImage {
    max-width: 100vw;
    padding-top: 1rem;
}

/* Ensure the page fills the viewport and allows pushing the footer to the bottom
   when content is shorter than the browser height. Using a flex column layout
   is the least invasive approach and works with Bootstrap utilities. */
html, body {
    height: 100%;
}

body {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    background-image: url('../images/Western_Background_Image.webp');
    background-repeat: no-repeat;
    background-size: 100vw auto;
    background-position: top center;
    background-color: #A66500;
}

/* let the main content grow and take available space so the footer is pushed
   to the bottom on short pages */
main {
    flex: 1 0 auto;
}

/*
========================================
  HOW TO PLAY BUTTON + IMAGES
========================================
*/
.howToPlayBtn {
    display:block;
    background:transparent;
    position: relative;
}

.howToPlayImg {
    object-fit: contain;
    width: 225px;
    height: 100px;
}

.howToPlayText {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -60%);
    width: 100%;
    text-align: center;
    color: white;
    font-weight: bold;
    z-index: 2;
    pointer-events: none;
    font-size: 25px;
}

.how-to-img {
    max-width: 100%;
    height: 250px;
}

/*
========================================
  KEYBOARD SHORTCUTS (visual helper)
========================================
*/
.keyboard-shortcuts-container {
    border-radius: 1rem;
    padding: 2rem 1rem;
    margin: 2rem auto;
    max-width: 900px;
}
.keyboard-shortcuts-title {
    font-size: 2rem;
    font-weight: 700;
    text-align: center;
    margin-bottom: 1.5rem;
}

.shortcut-badge {
    display: inline-block;
    min-width: 40px;
    min-height: 40px;
    font-size: 1.5rem;
    font-weight: bold;
    color: #fff;
    border-radius: 8px;
    text-align: center;
    line-height: 40px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.08);
    vertical-align: middle;
}
.shortcut-badge.h { background: #111; }
.shortcut-badge.s { background: #2ecc40; }
.shortcut-badge.r { background: #900022; }
.shortcut-badge.d { background: #0099e6; }
.shortcut-badge.b { background: #ffe600; color: #222; }
.shortcut-badge.e { background: #2ecc40; }
.shortcut-badge.m { background: #ffe600; color: #222; }
.shortcut-badge.hh { background: #e60000; }

.shortcut-explanation {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    background: #fff;
    border-radius: 0.5rem;
    box-shadow: 0 1px 4px rgba(0,0,0,0.06);
    padding: 0.5rem 1rem;
    margin: 0.5rem 0.5rem;
    min-width: 220px;
}
.shortcut-explanation .badge {
    font-size: 1.25rem;
    padding: 0.5rem 1.25rem;
    border-radius: 0.5rem;
    box-shadow: 0 1px 4px rgba(0,0,0,0.10);
    border: 2px solid #dee2e6;
}
.shortcut-explanation .text-muted {
    font-size: 0.95rem;
    margin-left: 0.25rem;
}

.section-title, .section-description {
    color: white !important;
}

/*
========================================
  MODALS (Instructions, Difficulty, Best Of)
========================================
*/
#difficultyModal .modal-content {
    background-color: #7f634b;
}

#instructionsModal .modal-content {
    background-color: #7f634b;
}

#bestOfModal .modal-content {
    background-color: #7f634b;
}

/*
========================================
  DIFFICULTY BUTTON ART + WANTED LABEL
========================================
*/
.wanted-label {
    font-family: var(--primary-font);
    font-size: 1.25rem;
    color: #000;
    letter-spacing: 2px;
    text-shadow: none;
    font-weight: bold;
    text-align: center;
    display: block;
}

.peseta-img {
    max-height: 16px;
}

/*
========================================
  GAME BUTTONS (User & CPU images + selected state)
========================================
*/
.move-choice-btn img,
.CPU-btn img {
    width: 140px;
    height: 140px;
    margin: 2px !important;
}

.selected-move-btn img {
    width: 350px !important;
    height: 350px !important;
    font-size: 2rem;
    z-index: 2;
    transition: all 0.2s ease-in-out;
}

/*
========================================
  SCORE AREA
========================================
*/
.scoreTxt {
    font-family: var(--secondary-font);
    font-size: 1.5rem;
}

#playerScore, #cpuScore, #drawScore {
    font-family: var(--secondary-font);
    font-size: 1.5rem;
}

.greyed-out {
    border: none;
}

/*
========================================
  COUNTDOWN & GAME STATE MESSAGE
========================================
*/
.countdown-active {
    padding: 1rem 2rem;
    background: white;
    border-radius: 12px;
    font-size: 4rem;
    font-weight: bold;
    text-align: center;
    z-index: 3;
}

#game-state-message {
    color: white;
}

/*
========================================
  SELECTED STATES: DIFFICULTY & BEST OF
========================================
*/
#easyBtn.selected {
    background-color: #198754 !important; /* Bootstrap success */
    color: #fff !important;
    border-color: #198754 !important;
}
#mediumBtn.selected {
    background-color: #ffc107 !important; /* Bootstrap warning */
    color: #212529 !important;
    border-color: #ffc107 !important;
}
#hardBtn.selected {
    background-color: #dc3545 !important; /* Bootstrap danger */
    color: #fff !important;
    border-color: #dc3545 !important;
}

#bestOf3Btn.selected {
    background-color: #0d6efd !important; /* Bootstrap primary */
    color: #fff !important;
    border-color: #0d6efd !important;
}
#bestOf5Btn.selected {
    background-color: #6f42c1 !important; /* Bootstrap purple */
    color: #fff !important;
    border-color: #6f42c1 !important;
}
#endlessBtn.selected {
    background-color: #20c997 !important; /* Bootstrap teal */
    color: #fff !important;
    border-color: #20c997 !important;
}

/* Custom Bootstrap outline purple button */
.btn-outline-purple {
    color: #6f42c1;
    border-color: #6f42c1;
}
.btn-outline-purple:hover, .btn-outline-purple:focus {
    background-color: #6f42c1;
    color: #fff;
    border-color: #6f42c1;
}

/*
========================================
  CANVAS (confetti) & UTILITIES
========================================
*/
canvas {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    z-index: 10000; /* Set lower than modals, higher than background */
    pointer-events: none; /* Allows clicks to pass through if needed */
    display: block;
}

/*
========================================
  RESPONSIVE RULES (grouped by breakpoints)
========================================
*/
/* Extra small devices (portrait phones, less than 576px) */
@media (max-width: 575.98px) {
    .headerImage {
        height: 120px;
        padding-top: 0.25rem;
    }

    .howToPlayText {
        font-size: 14px;
    }

    .howToPlayImg {
        width: 120px;
        height: 50px;
    }
    .move-choice-btn img,
    .CPU-btn img {
        width: 60px;
        height: 60px;
    }
    h2 { font-size: 1rem; }
    p { font-size: 0.9rem; }

    .smBtn {
        display: flex;
        justify-content: center;
    }

    /* Only resize the 3 difficulty buttons and their elements for small screens */
    #easyBtn,
    #mediumBtn,
    #hardBtn {
        width: 26vw;
        max-width: 120px;
        min-width: 80px;
    }

    .wanted-label {
        font-size: 1rem;
    }
}

/* Small devices (landscape phones, 576px and up) */
@media (min-width: 576px) and (max-width: 767.98px) {
    .headerImage {
        height: 180px;
        padding-top: 0.4rem;
    }

    .howToPlayText {
        font-size: 20px;
    }

    .howToPlayImg {
        width: 150px;
        height: 70px;
    }
    .move-choice-btn img,
    .CPU-btn img {
        width: 75px;
        height: 75px;
    }
    h2 { font-size: 1.1rem; }
    p { font-size: 1rem; }
}

/* Medium devices (tablets, 768px and up) */
@media (min-width: 768px) and (max-width: 991.98px) {
    .headerImage {
        height: 250px;
        padding-top: 0.5rem;
    }
    .howToPlayImg {
        width: 180px;
        height: 80px;
    }
    .move-choice-btn img,
    .CPU-btn img {
        width: 85px;
        height: 85px;
    }
    h2 { font-size: 1.2rem; }
    p { font-size: 1rem; }
}

/*
========================================
  FOOTER
========================================
*/
.site-footer {
    background: linear-gradient(180deg, rgba(0,0,0,0.6), rgba(0,0,0,0.9));
    border-top: 2px solid rgba(255,255,255,0.04);
}
.site-footer .footer-link {
    text-decoration: none;
    font-family:'Franklin Gothic Medium', 'Arial Narrow', Arial, sans-serif;
    font-size: large;
    opacity: 0.9;
}
.site-footer .footer-link:hover,
.site-footer .footer-link:focus {
    text-decoration: underline;
    opacity: 1;
}

@media (max-width: 575.98px) {
    .site-footer {
        padding-top: 0.75rem;
        padding-bottom: 0.75rem;
        font-size: 0.9rem;
    }
}

/* Large devices (desktops, 992px and up) */
@media (min-width: 992px) and (max-width: 1199.98px) {
    .headerImage {
        height: 250px;
        padding-top: 0.5rem;
    }
    .howToPlayImg {
        width: 200px;
        height: 90px;
    }
    .move-choice-btn img,
    .CPU-btn img {
        width: 120px;
        height: 120px;
    }
    h2 { font-size: 1.5rem; }
    p { font-size: 1.1rem; }
}

/* Extra large devices (large desktops, 1200px and up) */
@media (min-width: 1200px) {
    .headerImage {
        height: 400px;
        padding-top: 2rem;
    }
    .howToPlayImg {
        width: 225px;
        height: 100px;
    }
    .move-choice-btn img,
    .CPU-btn img {
        width: 140px;
        height: 140px;
    }
    h2 { font-size: 2rem; }
    p { font-size: 1.25rem; }
}

/* Footer favicon sizing to preserve aspect ratio and avoid squashing */
.footer-favicon {
    width: 96px !important;
    height: auto;
    display: inline-block;
}

@media (max-width: 575.98px) {
    .footer-favicon {
        width: 64px;
    }
}
