/* Font Declarations */

@import url("https://use.typekit.net/fnt1wxx.css");

/* Thin Weight */
@font-face {
  font-family: 'Metropolis';
  src: url('/assets/fonts/metropolis/Metropolis-Thin.woff2') format('woff2'),
       url('/assets/fonts/metropolis/Metropolis-Thin.woff') format('woff');
  font-weight: 100;
  font-style: normal;
  font-display: swap; /* Important for performance */
}

/* Extra Light Weight */
@font-face {
  font-family: 'Metropolis';
  src: url('/assets/fonts/metropolis/Metropolis-ExtraLight.woff2') format('woff2'),
       url('/assets/fonts/metropolis/Metropolis-ExtraLight.woff') format('woff');
  font-weight: 200;
  font-style: normal;
  font-display: swap; /* Important for performance */
}

/* Light Weight */
@font-face {
  font-family: 'Metropolis';
  src: url('/assets/fonts/metropolis/Metropolis-Light.woff2') format('woff2'),
       url('/assets/fonts/metropolis/Metropolis-Light.woff') format('woff');
  font-weight: 300;
  font-style: normal;
  font-display: swap; /* Important for performance */
}

/* Regular Weight */
@font-face {
  font-family: 'Metropolis';
  src: url('/assets/fonts/metropolis/Metropolis-Regular.woff2') format('woff2'),
       url('/assets/fonts/metropolis/Metropolis-Regular.woff') format('woff');
  font-weight: 400;
  font-style: normal;
  font-display: swap; /* Important for performance */
}

/* Medium Weight */
@font-face {
  font-family: 'Metropolis';
  src: url('/assets/fonts/metropolis/Metropolis-Medium.woff2') format('woff2'),
       url('/assets/fonts/metropolis/Metropolis-Medium.woff') format('woff');
  font-weight: 500;
  font-style: normal;
  font-display: swap; /* Important for performance */
}

/* SemiBold Weight */
@font-face {
  font-family: 'Metropolis';
  src: url('/assets/fonts/metropolis/Metropolis-SemiBold.woff2') format('woff2'),
       url('/assets/fonts/metropolis/Metropolis-SemiBold.woff') format('woff');
  font-weight: 600;
  font-style: normal;
  font-display: swap; /* Important for performance */
}

/* Bold Weight */
@font-face {
  font-family: 'Metropolis';
  src: url('/assets/fonts/metropolis/Metropolis-Bold.woff2') format('woff2'),
       url('/assets/fonts/metropolis/Metropolis-Bold.woff') format('woff');
  font-weight: 700;
  font-style: normal;
  font-display: swap;
}

/* ExtraBold Weight */
@font-face {
  font-family: 'Metropolis';
  src: url('/assets/fonts/metropolis/Metropolis-ExtraBold.woff2') format('woff2'),
       url('/assets/fonts/metropolis/Metropolis-ExtraBold.woff') format('woff');
  font-weight: 800;
  font-style: normal;
  font-display: swap;
}

/* Black Weight */
@font-face {
  font-family: 'Metropolis';
  src: url('/assets/fonts/metropolis/Metropolis-Black.woff2') format('woff2'),
       url('/assets/fonts/metropolis/Metropolis-Black.woff') format('woff');
  font-weight: 900;
  font-style: normal;
  font-display: swap;
}

/* End Font Declarations */

/* --- Light Mode (Default) Colors --- */
:root {
  --background-color:#ffffff;  
  --primary-color: #106386;
  --secondary-color: #009bdb;
  --section-border: #dddddd;
  --focus-color: #e4f4fa;
  --text-color: #333333;
  --notes-color: #aaaaaa;
  --error-color: #dc3545;
  --button-text: #ffffff;
  --secondary-button-bgnd: #efefef;
  --secondary-button-bgnd-hover: #dedede;
  --modal-overlay: rgba(0,0,0,0.7);
  --drop-shadow-color: rgba(0,0,0,0.2);
  --headline-font: "greycliff-cf", 'Metropolis', sans-serif;
  --body-font: "greycliff-cf", "azo-sans-web", sans-serif;
}

/* Default State (Light Mode) */
.logo-swap { height: auto; }
.light-logo { display: block; margin:0 auto !important; }
.dark-logo { display: none; }

/* Dark Mode State */
/* @media (prefers-color-scheme: dark) {    
    .light-logo { display: none !important; }
    .dark-logo { display: block !important; }
} */

/* General Body and Container Styling */
body {
    font-family: var(--body-font);
    background-color: var(--background-color);
    color: var(--text-color);
    margin: 0;
    display: flex;
    align-items: center;
    flex-direction: column;
    height: 100vh;
    /* Use dvh (dynamic viewport height) or vh, but 'dvh' is often best for this issue */
    /* If dvh isn't supported, 100vh is usually the second-best option */
    height: 100dvh; 
}

html {
    height: 100vh;
    /* Use dvh (dynamic viewport height) or vh, but 'dvh' is often best for this issue */
    /* If dvh isn't supported, 100vh is usually the second-best option */
    height: 100dvh; 
}

h1, h2, h3, h4, h5, h6, button {
    font-family: var(--headline-font);
    color: var(--primary-color);
    font-weight: 700;
}

p, ul, ol, input, .penalties-list {
    font-family: var(--body-font);
    color: var(--text-color);
    font-weight: 400;
    line-height: 1.4em;
}

.title {
    font-size: 14px;
    font-weight: 700;
    color: var(--text-color);
    margin:0;
}

input::placeholder {
    color:var(--notes-color);
}

input:focus::placeholder {
    color:var(--primary-color);
}

input:focus {
    background-color: var(--focus-color);
    border:1px solid var(--focus-color) !important;
    outline: var(--primary-color) !important;
}

button {
    background-color: var(--primary-color);
    color: var(--button-text);
    border-radius:500px !important;
    border: 1px solid var(--primary-color);
    padding: 12px 15px 12px 15px;
    cursor: pointer;
    font-size: 1rem;
    margin-top: 10px;
}

button:hover {
    background-color: var(--secondary-color);
    border: 1px solid var(--secondary-color);
}

.app-container {
    width: 100%;
    max-width: 640px;
    padding: 0 20px;
    box-sizing: border-box;
    background-color: var(--background-color);
    border-radius: 8px;
    /* box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1); */
    display: flex;
    flex-direction: column;
    height: 100%;
    /* Use dvh (dynamic viewport height) or vh, but 'dvh' is often best for this issue */
    /* If dvh isn't supported, 100vh is usually the second-best option */
    height: 100dvh; 
    align-items: center;
}

.giants-logo {
    width:180px;
    max-width:90%;
}

/* Settings Form */

#settings-form input {
    font-size:20px;
    font-weight:600;
    text-align: center;
    color:var(--primary-color);
    border-radius: 500px;
}

.settings-grid {
    display: flex;
    justify-content: space-between;
    flex-wrap: wrap;
}

.settings-grid .one-third {
    width:32%;
}

@media only screen and (max-width: 320px) {
    .settings-grid .one, .settings-grid .two {
        width:48%;
    }
    .settings-grid .three {
        width:100%;
    }
}

.settings-grid label {
    font-size:12px;
    text-transform: uppercase;
    color: var(--primary-color);
    text-align: center;
}

.settings-grid input {
    text-align: left;
    font-size:48px !important;
    margin-bottom:5px !important;
}

@media only screen and (max-width: 480px) {
    .settings-grid input {
        font-size:36px;
    }
}

#location-field {
    margin-bottom:20px;
}

.settings-grid input#half-duration, .settings-grid input#play-clock-duration, .settings-grid input#timeouts-per-half {
    font-family: var(--headline-font);
    text-align: center;
    border-radius:8px;
    padding:5px 10px 10px 10px;
}

/* Team Selection */

/* --- Custom Dropdown Styles --- */
.team-input-wrapper {
    position: relative; /* Essential: Allows positioning the options list absolutely relative to the input */
    margin-bottom: 10px; 
}

.team-options-list {
    list-style: none;
    padding: 0;
    margin: 0;
    position: absolute;
    top: 100%; /* Position below the input */
    left: 0;
    right: 0;
    
    /* Appearance */
    border: 1px solid var(--primary-color);
    background-color: var(--background-color);
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    max-height: 200px; /* Make the list scrollable */
    overflow-y: auto;
    z-index: 10; /* Ensure it appears over other elements */
    text-align: center;
    border-radius: 8px;
}

.team-options-list.hidden {
    display: none;
}

.team-options-list li:hover,
.team-options-list li.highlighted {
    background-color: var(--focus-color);
    color: var(--primary-color);
}

/* --- Team Autocomplete Suggestions with Logo --- */

.team-options-list li {
    /* --- NEW FLEXBOX LAYOUT FOR LOGO + TEXT --- */
    display: flex;         /* Use Flexbox to align image and text */
    align-items: center;   /* Vertically center the logo and text */
    gap: 10px;             /* Space between logo and text */
    text-align: left;      /* Align text to the left for better reading */
    /* --- END NEW LAYOUT --- */

    padding: 10px;
    cursor: pointer;
    font-size: 16px;
    color: var(--primary-color);
    background:white;
    border:none;
    border-radius: 0px !important;
}

/* Add this NEW rule to size the image */
.team-options-list li .team-logo-suggestion {
    width: 28px;           /* Set a small, fixed width */
    height: 28px;          /* Set a small, fixed height */
    object-fit: contain;   /* Ensures the image doesn't stretch */
    flex-shrink: 0;        /* Prevents the image from collapsing */
}

/* End Team Selection */

.settings-grid .settings-notes {
    text-align: center;
    color: var(--notes-color);
    font-size:12px;
    font-weight:600;
}

.settings-grid #half-duration, .settings-grid #play-clock-duration, .settings-grid #timeouts-per-half {
    background-color: var(--focus-color);
    border:1px solid var(--focus-color) !important;
    padding:10px 10px 5px 10px;
    font-weight: 900;
}

/* Coin Toss */

.coin-toss-section {
    text-align: center;
    margin-top:30px;
}

#coin-toss-btn {
    width:90px;
    font-size:24px;
    font-weight:800;
    color: var(--primary-color);
    background-color:var(--background-color);
    border: 1px solid var(--background-color) !important;
    position: relative; 
    padding: 0 0 0 5px !important;
}

#toss-rerun-btn {
    color: var(--primary-color);
    background-color:var(--background-color);
    border-color: var(--primary-color);
}

#coin-toss-btn:hover {
    color:var(--button-text);
    background-color: var(--background-color);
    border:1px solid var(--background-color);
}

#toss-rerun-btn:hover {
    color:var(--button-text);
    background-color: var(--secondary-color);
    border-color:var(--secondary-color);
}

#coin-toss-result {
    font-size:24px;
    font-weight:600;
}

#coin-toss-result-area {
    text-align: center;
}

#toss-result-message {
    color:var(--primary-color);
    font-size: 72px;
    font-weight: bold;
    margin: 0 0 20px 0;    
}

.coin-toss-content {
    width: 640px;
    display: flex;
    flex-direction: column;
    align-items: center; /* Centers items horizontally */
}

#coin-animation-area {
    width: 540px;
    height: 540px;
    margin: 20px auto;
    margin-left: 50px;
}

.toss-control-buttons {
    display: flex;
    justify-content: center;
    gap: 10px;    
}

@media only screen and (max-width: 300px) {
    .toss-control-buttons {
        flex-direction: column !important;
    }
}

.coin-toss-buttons {
    display: flex;
    justify-content: center;
    gap: 10px;
}

@media only screen and (max-width: 350px) {
    .coin-toss-buttons {
        flex-direction: column !important;
    }
    #coin-toss-btn {
        width:100%;
    }
}

#toss-rerun-btn {
    background-color: var(--button-text);
    color:var(--primary-color);
    border-color:var(--primary-color);
}

/* Styling for the new GIF inside the button */
.coin-toss-gif {
    /* Set a max size for the GIF, often around 40px-50px */
    width: 60px; 
    height: 60px;
    /* This ensures the image doesn't warp */
    object-fit: contain; 
    
    /* Ensure it has space from the button text */
    margin-right: 8px; 
}

/* Optional: Center the content if the button is using Flexbox */
.animated-toss-btn {
    display: flex;
    align-items: center;
    justify-content: center;
}

#lobby-coin-animation svg {
    width: 90px !important;
    height: 90px !important; 
    transform: rotate(290deg) !important;
    margin: -20px !important;
}

#start-game-btn {
    width:100%;
    font-size:24px;
    font-weight:700;
}

#current-game-id {
    text-align: center;
    margin:20px 0;
    color:var(--primary-color);
    font-size:10px;
}

#game-id-text {
    color: var(--primary-color);
    font-weight: 400;
}

#current-game-id .share-notes {
    color: var(--notes-color);
}

/* Common Form and Button Styles */
#settings-form {
    padding: 30px 12px 100px 12px;
    max-width:480px;
    width:100%;
}

#game-interface {
    padding: 10px 12px 100px 12px;
    max-width:720px;
    width:100%;
}

.hidden {
    display: none !important;
}

h2, h3 {
    text-align: center;
}

label {
    display: block;
    margin-top: 10px;
    margin-bottom: 5px;
    font-weight: 600;
}

input[type="text"], input[type="number"], input[type="date"] {
    width: 100%;
    padding: 12px;
    margin-bottom: 10px;
    border: 1px solid var(--notes-color);
    border-radius: 4px;
    box-sizing: border-box;
    font-size:18px;
}

/* For WebKit browsers (Chrome, Safari) */
input[type="number"]::-webkit-outer-spin-button,
input[type="number"]::-webkit-inner-spin-button {
    -webkit-appearance: none; /* Removes the default arrow appearance */
    margin: 0; /* Important: Removes space reserved for the arrows */
}

/* For Firefox */
input[type="number"] {
    -moz-appearance: textfield; /* Removes the spinner in Firefox */
    appearance: textfield;
}

/* New: Disabled state for controls */
.disabled {
    pointer-events: none; /* Prevents clicks */
    /* display: none !important; */ /* Hides the element completely */
}

/* LOBBY-SPECIFIC STYLES */
#game-lobby {
    padding: 20px;
    text-align: center;
    display: flex;
    flex-direction: column;
    max-width:480px;
    /* background:url(/assets/play.svg); */
    background-repeat:no-repeat;
    background-position: bottom right;
    background-size: 50%;
    gap:30px;
    flex-grow: 1; /* Allows this element to take up all remaining vertical space */
    /* overflow-y: auto; */ /* IMPORTANT: Enables vertical scrolling ONLY on this element */    
    /* Keep the padding you added earlier to lift content above the footer */
    padding-bottom: 0px;
    justify-content: center;
    width:100%;
}

#game-lobby h2 {
    text-align: left;
    font-size:60px;
    font-weight:900;
    margin:0;
    line-height: 1em;
}

.lobby-logo img {
    width: 240px;
    max-width: 100%;
}

.main-btn {
    width: 100%;
    padding: 15px;
    font-size: 1.2rem;
    font-weight: 600;
    margin-top: 20px;
}

#start-new-game-btn {
    padding:0;
    text-align:center;
    font-weight:800;
    font-size:24px;
    background:var(--primary-color);
    border:none;
    border-radius: 500px !important;
    margin:0 auto;
    color:var(--button-text);
    padding:14px 24px;
}

#start-new-game-btn:hover {
    background:var(--secondary-color);
}

@media (max-width: 320px) {
    #start-new-game-btn {
        font-size:18px;
        padding:10px 18px;
    }
}

.join-game-section {
    margin-top: 20px;
}

.join-game-section h2 {
    margin-bottom:5px;
}

.join-game-section hr {
    margin: 20px 0;
    border: 0;
    /* border-top: 1px solid #ccc; */
}

.join-game-section input {
    font-size:36px;
    font-weight: 600;
    text-align: center;
    border:none !important;
}

.error-message {
    color: var(--error-color);;
    font-size: 0.9rem;
    margin-top: 5px;
}

.role-selection {
    margin-top: 20px;
}

.role-selection h3 {
    margin-bottom: 10px;
}

.role-selection-wrapper {
    display: flex;
    justify-content: center;
    gap: 10px;
    flex-wrap: wrap;
}

.role-selection-wrapper input[type="radio"] {
    display: none;
}

.role-selection-wrapper label {
    display: inline-block;
    padding: 10px 15px;
    border: 2px solid var(--primary-color);
    border-radius: 5px;
    cursor: pointer;
    background-color:var(--background-color);
    color: var(--primary-color);
    font-weight: 600;
    text-align: center;
    transition: background-color 0.2s, color 0.2s;
}

.role-selection-wrapper input[type="radio"]:checked + label {
    background-color: var(--primary-color);;
    color: var(--button-text);
}

.role-selection-wrapper label:hover {
    background-color: var(--focus-color);;
}

/* END LOBBY-SPECIFIC STYLES */

#game-interface {
    flex-grow: 1; /* Allows this element to take up all remaining vertical space */
    overflow-y: auto; /* IMPORTANT: Enables vertical scrolling ONLY on this element */
    /* Keep the padding you added earlier to lift content above the footer */
    padding-bottom: 100px;    
}

/* Header and Game Clocks Section */
header {
    text-align: center;
    margin-bottom: 0px;
    display: none;
}

.game-info {
    font-size: 1.1rem;
    color: var(--primary-color);;
    margin-bottom: 10px;
    margin-top: 0px;
    font-weight:600;
}

.clock-container {
    display: flex;
    flex-direction: row;
    justify-content: space-between;
    flex-wrap: wrap;
}

.clocks-section {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 20px;
    margin-bottom: 20px;
}

.game-clocks-section, .play-clock-section {
    width: 46%;
    text-align: center;
    display:flex;
    flex-direction: column;
    align-items:center;
    opacity: 1;
}

@media (max-width: 480px) {
    .game-clocks-section, .play-clock-section {
        width: 100%;
    }
}

.clock-display {
    border: 1px solid #ddd;
    width: 100%;
    padding: 15px 10px 20px 10px;
    border-radius: 8px;
    margin: 0 10px 10px 10px;
    opacity: 1;
}

.clock-display .title {
    margin-bottom:0px;
}

.clock-time {
    font-size: 60px;
    font-weight: 900;
    line-height:1em;
    color: var(--primary-color);
}

@media (max-width: 480px) {
    .clock-time {
        font-size:60px;
    }
}

.clock-label {
    font-size: 18px;
    font-weight: 600;
    color: var(--text-color);
    margin:0;
}

.clock-controls, .play-clock-controls {
    display: flex;
    flex-direction: row;
    justify-content: center;
    gap:10px;
}

@media (max-width: 480px) {
    .clock-controls, .play-clock-controls {
        flex-direction: row;
        gap:10px;
    }
}

.clock-controls button, .play-clock-controls button {
    font-size: 18px;
    font-weight:600;
    padding: 4px 20px 7px 20px;
}

.reset-btn {
    color: var(--text-color);
    background-color:var(--background-color);
    border:1px solid var(--secondary-button-bgnd-hover);
}

.reset-btn:hover {
    color: var(--text-color);
    background-color:var(--secondary-button-bgnd);
    border:1px solid var(--secondary-button-bgnd-hover);
}

/* -------------------------------------------------------------------------------------------------- */
/* STICKY GAME CLOCK STYLES */
/* -------------------------------------------------------------------------------------------------- */

/* 1. Base styles and transitions for a smooth effect */
.game-clocks-section {
    /* Apply transition to all properties that change to ensure a smooth transition */
    transition: all 0.3s ease-in-out; 
    /* The transform/transition is subtle and applies to all changes */
}

/* 2. Sticky state positioning and appearance */
.game-clocks-section.sticky-clock-active {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 1000; /* Ensure it's on top of other content */
    background-color: var(--background-color); /* Match background color */
    box-shadow: 0 4px 10px -2px rgba(0, 0, 0, 0.15); /* Subtle shadow for lift */
    padding: 0px; /* Reduced vertical padding */
    
    /* Center on wider screens (assuming a max-width parent) */
    width: 100vw; 
    margin: 0 auto;
}

/* 3. Re-layout: Clock and Pause/Resume button side-by-side (Horizontally) */
/* This targets the immediate children of the clock section to make them flex containers.
   You may need to inspect your HTML and adjust the selectors (e.g., .game-clocks-section.sticky-clock-active .timer-controls) 
   to ensure the correct parent of your clock and button elements gets 'display: flex'. 
*/
.game-clocks-section.sticky-clock-active > div { 
    display: flex;
    justify-content: space-between; /* Spreads out contents */
    align-items: center;
}

.game-clocks-section.sticky-clock-active .clock-display {
    border:none;
    padding:15px 0px 15px 0px;
    width: 100%;
    justify-content: center;
    margin: 0px;
    border-radius: 0px;
    background-color: var(--primary-color);
    transition: all 0.3s ease-in-out;
}

/* 4. Hide the Reset Button */
.game-clocks-section.sticky-clock-active .title, .game-clocks-section.sticky-clock-active .reset-btn {
    display: none; 
}

/* 5. Shrink the Clock Display */
.game-clocks-section.sticky-clock-active .clock-time {
    font-size: 48px; /* Significantly smaller font */
    line-height: 1; /* Tighter spacing */
    padding: 0; 
    margin-right: 16px; /* Space from the button */
    color:var(--background-color);
}

/* 6. Shrink the Play/Pause Button */
.game-clocks-section.sticky-clock-active .start-stop-btn {
    font-size: 18px;
    border-color: #ffffff;
    background-color:#ffffff;
    color:#106386;
    margin-top:4px;
}

.game-clocks-section.sticky-clock-active .start-stop-btn:hover {
    border-color:#009bdb;
    background-color:#009bdb;
    color:#ffffff;
}

/* .game-clocks-section.sticky-clock-active .start-stop-btn svg {
    width: 18px;
    height: 18px;
} */

/* Main Controls Section (Grid-based layout) */
.main-controls {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.down-buttons-section {
    width: 100%;
    text-align: center;
    display:flex;
    flex-direction: column;
    align-items:center;
}

.down-buttons-section-wrapper {
    border: 1px solid #ddd;
    width: 100%;
    padding: 15px 10px 20px 10px;
    border-radius: 8px;
    margin: 10px;
}

.down-label {
    font-size: 18px;
    font-weight: 600;
    color: var(--text-color);
    margin:0;
}

.down-buttons button {
    width: 60px;
    height: 60px;
    padding: 10px;
    font-size: 18px;
    font-weight:600;
    border-radius: 500px !important;
    margin-right: 5px;
    background-color:var(--secondary-button-bgnd);
    color:var(--text-color);
    border-color: var(--secondary-button-bgnd);
}

.down-buttons button:hover {
    background-color:var(--secondary-button-bgnd-hover);
}

.down-buttons button.active {
    background-color: var(--primary-color);
    color:var(--button-text);
}

.scoreboard-container {
    display: flex;
    flex-direction: row;
    justify-content: space-between;
    flex-wrap: wrap;
}

.scoreboard-and-downs {
    display: grid;
    grid-template-columns: 1fr 1fr;
    grid-template-areas:
        "team1-score team2-score"
        "down-buttons down-buttons";
    gap: 10px;
    text-align: center;
}

.home-team-scoreboard-section, .away-team-scoreboard-section {
    width: 46%;
    text-align: center;
    display:flex;
    flex-direction: column;
    align-items:center;
}

.team-score {
    border: 1px solid #ddd;
    width: 100%;
    padding: 15px 10px 20px 10px;
    border-radius: 8px;
    margin: 10px;
    height:100%;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
}

@media (max-width: 480px) {
    .home-team-scoreboard-section, .away-team-scoreboard-section {
        width: 100%;
    }
}

#team1-name-display { grid-area: team1-name; }
#team2-name-display { grid-area: team2-name; }
.down-buttons { grid-area: down-buttons; }

.team-name {
    font-size: 1.2rem;
    font-weight: 600;
}

.score-container {
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 10px 0;
}

.score {
    font-size: 48px;
    font-weight: 900;
    color: var(--primary-color);;
    line-height: 1;
    margin: 0 10px; /* New: Added horizontal margin for spacing */
}

.adjust-btn {
    padding: 2px 8px;
    font-size: 24px;
    font-weight: 600;
    line-height: 1;
    margin: 2px 0;
    width: 25px;
    height: 25px;
    display: flex;
    align-items: center;
    justify-content: center;
    background:none;
    color:var(--secondary-color);
    border:none;
}

.adjust-btn:hover {
    background-color: var(--focus-color);
    border:none;
}

.score-buttons {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    gap: 5px;
}

.score-buttons button {
    display: flex;
    flex-direction: row;
    gap:5px;
    align-items: center;
    justify-content: center;
    height: auto;
    width: 48%;
    padding: 6px 5px 8px 6px;
    background-color: var(--secondary-button-bgnd);
    color: var(--text-color);
    border: none;
}

.score-buttons button:hover {
    background-color: var(--secondary-button-bgnd-hover);
}

.score-buttons .button-label {
    font-size: 1rem;
    font-weight: 600;
}

.score-buttons .button-score {
    font-size: 1rem;
    font-weight: 600;
}

.timeout-buttons-section {
    width: 100%;
    text-align: center;
    display:flex;
    flex-direction: column;
    align-items:center;
}

.timeout-buttons-section-wrapper {
    border: 1px solid #ddd;
    width: 100%;
    padding: 15px 10px 20px 10px;
    border-radius: 8px;
    margin: 10px;
}


.timeout-buttons {
    display: flex;
    justify-content: center;
    gap: 20px;
    width: 100%;
    text-align: center;
    margin-top: 20px;
}

.timeout-button-wrapper {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 5px;
    width:44%;
    justify-content: space-between;
}

.timeout-label {
    font-size: 1rem;
    font-weight: 600;
}

.use-timeout-btn {
    background-color: var(--primary-color);
    color:var(--button-text);
    width: 80px;
    height: 80px;
    padding: 10px;
    border: none;
    border-radius: 500px !important;
    display: flex;
    align-items: center;
    justify-content: center;
}

.use-timeout-btn:hover {
    background-color: var(--secondary-color);
    border:none;
}

.timeout-count {
    font-size: 2rem;
    font-weight: 800;
}

/* Log and End Game Section */
.score-log {
    margin-top: 20px;
    padding-top: 20px;
}

ul {
    list-style-type: none;
    padding: 0;
}

.log-container ul {
    margin-top:5px;
}

.log-placeholder {
    color:var(--notes-color);
}

li {
    /* background-color: var(--secondary-button-bgnd); */
    border-bottom: 1px solid var(--secondary-button-bgnd-hover);
    padding: 8px;
    margin-bottom: 5px;
    border-radius: 0px;
}

#score-log li, #timeout-log li, #defence-log li, #summary-score-log li, #summary-timeout-log li, #summary-defence-log li {
    font-weight: 400;
    line-height: 1.3em;
}

.log-title {
    text-align: left;
}

h4.log-title {
    margin-bottom:0px;
}

button.defence-stats-btn {
    padding:6px 15px 8px 15px;
}

/* Styles for the undo and end game buttons */
.action-buttons {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-top: 20px;
}

.undo-btn, .end-game-btn {
    width: 100%;
    padding: 15px;
    font-size: 1.2rem;
}

.undo-btn {
    color: var(--primary-color);
    background-color:var(--background-color);
    border:1px solid var(--secondary-button-bgnd-hover);
    font-weight: 600;
}

.undo-btn:hover {
    color: var(--text-color);
    background-color:var(--secondary-button-bgnd);
    border:1px solid var(--secondary-button-bgnd-hover);
}

/* .end-game-btn {
    background-color: #dc3545;
    border:none;
    font-weight: 600;
}

.end-game-btn:hover {
    background-color: #c82333;
    border:none;
} */

/* New: Styles for the pop-up modal overlay */
#score-popup, #defence-popup {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: var(--background-color);
    display: flex;
    justify-content: center;
    align-items: start;
    z-index: 100;
}

.popup-content, .defence-popup-content {
    background-color: var(--background-color);
    padding: 40px 20px 120px 20px;
    width: 100%;
    max-width: 740px;
    margin: 0 auto;
}

.popup-content h2, .defence-popup-content h2 {
    text-align: left;
}

#score-popup h2 {
    margin-bottom:0px;
}

.score-popup-notes {
    margin-top:5px;
}

.popup-content input, .defence-popup-content input {
    /* border-radius: 500px; */
    /* font-size:20px; */
    font-weight:bold;
    border-radius: 8px;
    font-size: 30px;
    font-weight: 900;
    background: var(--focus-color);
    border-color: var(--focus-color);
    color:var(--primary-color);
    text-align: center;
}

#log-score-btn, #log-defence-stat-btn {
    padding:8px 15px 12px 15px;
}

#cancel-popup-btn svg, #defence-cancel-popup-btn svg {
    width:30px;
    height:30px;
}

.player-input-grid, .defence-input-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 15px;
}

.player-input-grid > *:first-child {
    grid-column: span 2;
}

.player-input-grid > div, .defence-input-grid > div {
    display: flex;
    flex-direction: column;
}

.popup-buttons {
    display: flex;
    justify-content: right;
    margin-top: 20px;
}

.popup-buttons #cancel-popup-btn, .popup-buttons #defence-cancel-popup-btn {
    background-color:var(--background-color);
    border-color:var(--primary-color);
    color:var(--primary-color);
}

.popup-buttons #cancel-popup-btn:hover, .popup-buttons #defence-cancel-popup-btn:hover {
    background-color:var(--secondary-color);
    border-color:var(--secondary-color);
    color:var(--background-color);
}

/* New styles for the game summary screen */
#game-summary {
    padding: 20px;
    text-align: center;
    max-width:480px;
    width:100%;
}

.logo-image-summary {
    width:180px;
    margin-bottom:20px;
}

/* Styling for the summary logos */
.summary-logo {
    width: 40px; /* Adjust size as needed */
    height: 40px; 
    object-fit: contain;
    margin-right: 0px;
}

/* Optional: Style the container to align name/score/logo nicely */
.summary-team-block {
    display: flex;
    align-items: center;
    gap: 10px;
}

.summary-scoreboard {
    display: flex;
    justify-content: center;
    gap: 20px;
    margin-top: 20px;
}

@media (max-width: 360px) {
    .summary-scoreboard {
        flex-wrap:wrap;
    }
}

.summary-team {
    display: flex;
    flex-direction: column;
    align-items: center;
    border: 1px solid var(--focus-color);
    background-color:var(--focus-color);
    width: 50%;
    padding: 20px;
    border-radius:6px;
    justify-content: space-between;
}

@media (max-width: 480px) {
    .summary-team {
        width: 100%;
    }
}

.summary-team-name {
    font-size: 18px;
    font-weight: 700;
    color: var(--primary-color);
}

.summary-score {
    font-size: 60px;
    font-weight: 800;
    color: var(--primary-color);
    margin-top:10px;
}

.summary-logs {
    margin-top: 40px;
    text-align: left;
}

#download-summary-btn {
    background:var(--background-color);
    border-color:var(--primary-color);
    color:var(--primary-color);  
    width:240px; 
    margin:0 auto;
    margin-top:40px;
}

#download-summary-btn:hover {
    background:var(--secondary-color);
    border-color:var(--secondary-color);
    color:var(--button-text);  
}

/* Update the main button style for horizontal icon alignment */
#download-summary-btn {
    display: flex;
    flex-direction: row; /* Aligns icon and text side-by-side */
    align-items: center; /* Vertically center icon and text */
    justify-content: center;
    gap: 8px; /* Adds space between the icon and the text */
}

.download-icon {
    margin-bottom: 0 !important; 
    fill: currentColor !important; 
    stroke: none !important;
    width: 20px;
    height: 20px;
    margin-right:4px;
}

#start-new-game-from-summary-btn {
    width:240px;
}

/* Mobile-first adjustments for small screens */
@media (max-width: 600px) {
    .clocks-section {
        flex-direction: column;
        gap: 10px;
    }
}

/* Two-minute warning animation */
@keyframes flash-warning {
    0%   { background-color: #dc3545; color: var(--button-text); }
    50%  { background-color: #c82333; color: var(--button-text); }
    100% { background-color: #dc3545; color: var(--button-text); }
}

.warning {
    animation: flash-warning 1s infinite;
}

.warning .clock-time, .warning .title {
    color: var(--button-text);
}

/* 1. Ensure the element is visible (overrides any problematic 'display: none' or 'visibility: hidden') */
.disabled {
    /* If another rule is hiding it, these will force it to show: */
    display: inline-block !important; /* or block/flex, depending on the button's original display */
    visibility: visible !important;
}

/* 2. Apply the visual and functional disabling styles */
.disabled {
    /* Set the cursor to indicate the button is not clickable */
    cursor: not-allowed !important;

    /* Visually grey out the button/control to indicate it's inactive */
    /* opacity: 0.5 !important; */
    /* background-color: #f0f0f0 !important; */ /* Add a neutral background */
    /* color: #666 !important; */ /* Grey out the text */

    /* IMPORTANT: This is the only functional change needed to prevent clicks */
    pointer-events: none !important;

    /* Remove hover/active effects */
    box-shadow: none !important;
    transform: none !important;
    border-color: var(--secondary-button-bgnd-hover) !important;
}

/* 3. Hide sections that don't need to be visible */
.clock-btn.disabled, .score-btn.disabled, .undo-btn.disabled, .end-game-btn.disabled, .adjust-btn.disabled, .play-clock-options.disabled, .share-links-section.disabled, #start-new-game-from-summary-btn.disabled, #info-btn.disabled, #undo-btn.disabled, #penalty-lookup-btn.disabled, #end-game-btn.disabled, #share-links-btn.disabled, #fixed-footer-links-container.disabled, #info-modal-admin.disabled, #info-modal-ref.disabled, #info-modal-scorer.disabled, #info-modal-clock.disabled, #info-modal-coach.disabled, .defence-stats-btn.disabled
 {
    display: none !important;
}

/* Share Links Section Styles */
.share-links-section {
    margin-top: 30px;
    padding-top: 20px;
    text-align: center;
}

.share-links-grid {
    display: grid;
    /* Two columns for desktop/wide view */
    grid-template-columns: 1fr 1fr;  
    gap: 20px;
    margin-bottom: 15px;
}

/* Ensure buttons take full width on small screens */
@media only screen and (max-width: 480px) {
    .share-links-grid {
        /* Single column for mobile */
        grid-template-columns: 1fr 1fr;
        gap: 15px;
    }
}

/* Ensure buttons take full width on small screens */
@media only screen and (max-width: 320px) {
    .share-links-grid {
        /* Single column for mobile */
        grid-template-columns: 1fr;
        gap: 10px;
    }
}

.share-link-btn {
    width: 100%;
    padding: 8px 12px;
    font-size: 18px;
    color:var(--primary-color);
    background-color:var(--background-color);
    border-color: var(--primary-color);
}

.share-link-btn:hover {
    background-color: var(--primary-color);
    border-color: var(--primary-color);
    color:var(--background-color);
}

#qr-code-container {
    display:flex;
    justify-content: center;
    padding:20px;
}

#qr-code-container img {
    display: flex;
    background: #ffffff;
    padding: 15px;
    border-radius: 8px;    
}

#share-feedback {
    color: var(--primary-color);
    font-weight: 600;
    font-size: 0.9rem;
    margin-top:0px;
    text-align: center;
}

#share-notes {
    margin-top:10px;
}

.feedback-link a {
    text-decoration: none;
    color:var(--secondary-color);
}

/* Version number styling */
.version, .version-notes {
    display: block;
    /* position: absolute; */
    bottom: 10px;
    right: 10px;
    font-size: 0.7rem;
    color: var(--notes-color);
    text-align: center;
}

.version-notes {
    font-weight: bold;
}

/* Custom temporary style to hide join/role selection functionality */
.join-game-section,
.role-selection,
#join-game-btn,
#join-error-message {
    display: none !important;
}

/* Penalties */

/* --- NEW Styles for Penalty Search List (Grid Layout) --- */

#penalty-lookup-btn {
    width:100%;
    max-width:100%;
    color: var(--primary-color);
    background-color: var(--background-color);
    border: none;    
}

#penalty-lookup-btn:hover {
    color: var(--secondary-color);
}

.search-input {
    width: calc(100% - 20px); 
    padding: 10px;
    margin-bottom: 15px;
    border: 1px solid var(--notes-color);
    border-radius: 5px;
    font-size: 16px;
    box-sizing: border-box;
    font-weight:400;
    color:var(--text-color);
}

.search-input:focus {
    background-color:var(--background-color);
}

.search-input::placeholder {
    color:var(--notes-color);
}

/* --- Wrapper for Horizontal Overflow (The Key Change) --- */
/* This container ensures the content scrolls horizontally if it's too wide */
.penalties-table-wrapper {
    overflow-x: auto; 
}

.penalties-list {
    display: flex;
    flex-direction: column;
    gap: 1px; /* Small gap to create a table look */
    border: none;
    border-radius: 0px;
    overflow: hidden; /* Ensures rounded corners */
    min-width: 720px; 
    width:740px;
}

/* Base grid layout for header and items (4 columns) */
.penalty-header-row, .penalty-item-grid {
    display: grid;
    /* Define the 5 columns: Name (150px), Description (200px), Yards (70px), Enforced (150px), Effect (100px) */
    grid-template-columns: 150px 200px 70px 150px 150px; 
    padding: 10px 15px;
    align-items: center;
    border-bottom: 1px solid var(--focus-color); 
    white-space: nowrap; 
}

/* Header Row Styling */
.penalty-header-row {
    background-color: var(--secondary-button-bgnd);
    color: var(--primary-color);
    font-weight: 700;
    font-size: 1em;
    letter-spacing: 0px;
}

/* Penalty Item Styling */
.penalty-item-grid {
    background-color: white;
    font-size: 14px;
    color: var(--text-color);
    align-items:start;
}

.penalty-item-grid:nth-child(even) {
    background-color: var(--background-color); /* Zebra stripping */
}

.penalty-item-grid:last-child {
    border-bottom: none;
}

/* Header Column Styles */
.penalty-header-row .col-name {
    color:var(--primary-color);
    font-weight: 600;
    text-align: left;
}

.penalty-header-row .col-yards {
    color:var(--primary-color);
    font-weight: 600;
}

.penalty-header-row .col-enforced {
    color:var(--primary-color);
    font-weight: 600;
}

.penalty-header-row .col-description {
    color:var(--primary-color);
    font-weight:600;
    text-align: left;
}

.penalty-header-row .col-effect {
    color:var(--primary-color);
    font-weight: 600;
}

/* Column Specific Styles */
.col-name {
    color:var(--text-color);
    font-weight: 600;
    text-align: left;
    text-wrap: auto;
    padding: 0 10px 0 0;
}

.col-yards {
    color:var(--text-color);
    text-align: center;
    font-weight: 600;
    text-wrap: auto;
    padding: 0 10px 0 10px;}

.col-enforced {
    color:var(--text-color);
    text-align: center;
    font-weight: 400;
    text-wrap: auto;
    padding: 0 10px 0 10px;
}

.col-description {
    color:var(--text-color);
    text-align: left;
    font-weight: 400;
    text-wrap: auto;
    padding: 0 10px 0 10px;
}

/* Effect column containing both text and the tick */
.col-effect {
    color:var(--text-color);
    /* display: flex;
    justify-content: space-between; */
    align-items: center;
    font-weight: 400;
    text-wrap: auto;
    padding: 0 10px 0 10px;
}

/* .effect-tick {
    font-size: 1.2em;
    line-height: 1; 
    margin-left: 5px;
} */

/* --- New Modal/Overlay Styles for Penalty Lookup --- */

.modal-overlay, .modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: var(--background-color); /* Dark overlay */
    z-index: 1000; /* Ensure it is above all other content */
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 30px;
    box-sizing: border-box;
    overflow-y: auto; /* Allow scrolling within the overlay */
    overflow-x: hidden;
}

.penalty-finder-container {
    background-color: var(--background-color);
    padding: 20px 0 120px 0;
    width: 100%;
    max-width: 740px;
    margin: auto;
}

.info-modal-content, .share-modal-content {
    background-color: var(--background-color);
    padding: 20px 0 120px 0;
    width: 100%;
    max-width: 740px;
    margin: auto;
}

.penalty-finder-container h2, .info-modal-content h2, .share-modal-content h2 {
    text-align:left;
}

.info-modal-content h3 {
    text-align:left;
    line-height: 1.4em;
    margin-bottom:10px;
    color:var(--secondary-color);
}

.info-modal-content h4, .info-modal-content p {
    text-align:left;
    line-height: 1.4em;
    margin-bottom:10px;
}

.penalty-finder-container .title, .info-modal-content .title {
    margin: 0 0 10px 0;
    text-align: center;
    color: var(--primary-color);
}

#close-penalty-modal-btn, #close-info-modal-btn, #close-share-modal-btn, #cancel-popup-btn, #defence-cancel-popup-btn, #close-coin-toss-modal-btn {
    padding: 5px;
    width: 40px;
    height: 40px;
    border-radius: 500px !important;
    background-color: var(--primary-color); 
    color: var(--button-text);
    display: flex;
    justify-content: center;
    align-items: center;
    border:none;
    position: fixed;
    top: 0px;
    right: 20px;
    z-index: 1001;
}

#close-penalty-modal-btn:hover, #close-info-modal-btn:hover, #close-share-modal-btn:hover, #cancel-popup-btn:hover, #defence-cancel-popup-btn:hover {
    background-color: var(--secondary-color);
    cursor: pointer;
}

#close-penalty-modal-btn svg, #close-info-modal-btn svg, #close-share-modal-btn svg {
    display: block; /* Ensure the SVG behaves as a block element */
    width: 100%;    /* Make the SVG fill the button space */
    height: 100%;
    /* Inherit the stroke color from the button's 'color' property */
    stroke: currentColor; 
}

/* Info Modal */

#info-modal, #share-modal {
    display: none; /* Hidden by default */
}

/* Modal Links */

#info-modal-ref a, #info-modal-scorer a, #info-modal-clock a, #info-modal-coach a {
    text-decoration: none;
    color: var(--primary-color);
    font-weight: bold;
}

#info-modal-ref a:hover, #info-modal-scorer a:hover, #info-modal-clock a:hover, #info-modal-coach a:hover {
    color: var(--secondary-color);
}

.info-link {
    padding-top:10px;
    margin-top:20px;
    border-top:1px solid var(--section-border);
}

#info-modal-img .light-logo { margin-left:0 !important; }
#info-modal-img .dark-logo { margin-left:0 !important; }

#info-modal-img img {
    width:180px;
}

/* Fixed Footer */

#fixed-footer-links-container {
    position:fixed;
    bottom:0;
    left:0;
    right:0;
    width: 100%;
    padding-bottom: env(safe-area-inset-bottom);
    padding-top: 0px;
    padding-left: 0px;
    padding-right: 0px;
    display:none;
    justify-content: center;
    z-index: 9999;
    box-sizing:border-box;
    border-top: 1px solid var(--secondary-button-bgnd-hover);
    background-color: var(--background-color);
    box-shadow: 0 0 20px -2px var(--drop-shadow-color);
}

#fixed-footer-links-container.visible {
    display: flex; 
}

#fixed-footer-links-container.hidden, #undoBtn.hidden, #endGameBtn.hidden {
    display: none; 
}

.fixed-footer-links {
    display: flex;
    flex-direction: row;
    flex-wrap: nowrap;
    padding:2px 12px 12px 12px;
    gap:2px;
    justify-content: space-between;
    max-width:740px;
    width:100%;
    /* border-top: 1px solid #dedede; */
    /* border-radius: 500px; */
    /* background: #ffffff; */
    /* box-shadow: 0 0 20px -2px var(--drop-shadow-color); */
}

.fixed-footer-links button {
    font-size:18px;
    display: flex;
    flex-direction: column;
    align-items: center;
    flex-grow: 1;
    flex-basis: 0;
    background-color: var(--background-color);
    color:var(--primary-color);
    border:none;
    padding:8px 8px;
    border-radius: 8px !important;
}

.fixed-footer-links button:hover {
    color:var(--secondary-color);
    background-color:var(--focus-color);
}

#penalty-lookup-btn:hover {
    color:var(--secondary-color) !important;
    background-color:var(--focus-color) !important;
}

.fixed-footer-links button .button-icon {
    width: 24px;
    height: 24px;
    margin-bottom: 4px;
    fill: none;
    stroke: currentColor;
    stroke-width: 1.5px;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.fixed-footer-links button .button-text {
    font-size: 11px;
    font-weight:500;
    line-height: 1.2;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

@media only screen and (max-width: 320px) {
    .fixed-footer-links button .button-text {
        display:none;
    }
}


