/* ===== IMPORTS ===== */
@import url('https://fonts.googleapis.com/css2?family=Alfa+Slab+One&family=Noto+Sans:ital,wght@0,100..900;1,100..900&family=Playfair:ital,opsz,wght@0,5..1200,300..900;1,5..1200,300..900&display=swap');

/* ===== CSS VARIABLES ===== */
:root {
    /* Font families */
    --font-heading: 'Alfa Slab One', serif;
    --font-body: 'Playfair', serif;
    --font-tile: 'Noto Sans', sans-serif;
    --font-mono: monospace;

    /* Spacing system */
    --spacing-xs: 10px;
    --spacing-sm: 15px;
    --spacing-md: 20px;
    --spacing-lg: 30px;
    --spacing-xl: 40px;
    --spacing-xxl: 60px;
    --spacing-mega: 100px;
    --spacing-gigantic:200px;
    
    /* Smaller spacing increments */
    --spacing-xxs: 5px;
    --spacing-mini: 3px;
    --spacing-micro: 2px;

    /* Colors */
    --correct: #377D71; /* A muted green to complement the warm tones */
    --correct-hover: #055E68;
    --present: #e3a04b; /* A warm orange inspired by the image */
    --present-hover: #c18f28; /* Darker version of --present */
    --absent: #5a4b5eAA; /* A muted purple matching the trees in the image */
    --absent-hover: #483a4c; /* Darker version of --absent */
    --key-bg: #d3d6da;
    --key-hover-bg: #b1b3b5; /* Darker version of --key-bg */
    --border: #d3d6da;
    --bg-color: #f0e8e1; /* A light beige background inspired by the sky */
    --text-color: #3b2f2f; /* A dark brown for text to match the image */
    --dark-border: #5a4b5e;
    --light-hover: #eaeaea;
    --player-name-edit-color: #DC6464; /* A soft red for the player name edit icon */
    --content-max-width: 500px; /* New variable for consistent max widths */

    /* Color variables */
    --black: #000000;
    --white: #ffffff;
    --light-gray: #eeeeee;
    --dark-gray: #333333;
    --mid-gray: #aaaaaa;
    --light-mid-gray: #999999;
    --very-light-gray: #666666;
    --timer-message-color: #3B5360; /* Updated to match the muted green theme */
    --modal-overlay: rgba(0, 0, 0, 0.6);
    --message-bg: rgba(0, 0, 0, 0.8);
    --text-gradient: linear-gradient(to right, #B2700C, #BC560D);
    --border-gradient: linear-gradient(to right bottom, #CC8808 0%, #AA3A12 70%);
    --lose: #D24545; /* New color variable for lose results */

    /* Hover effect variables */
    --dark-hover: var(--dark-gray);
    
    /* Common transition values */
    --transition-short: 0.2s;
    --transition-medium: 0.3s;
    --transition-long: 0.5s;
    --standard-box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
    --key-box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);

    /* Add new CSS variables for metric styling */
    --metric-background:#E8D9B9;
    --metric-gradient: linear-gradient(to right bottom, #CC8808 0%, #AA3A12 70%);
    --metric-shadow: 0 3px 6px rgba(0,0,0,0.15);
    --metric-hover-shadow: 0 6px 12px rgba(0,0,0,0.15);
    --metric-border: 2px solid var(--border-gradient);
    --metric-hover-border: 2px solid var(--correct);
    --metric-transition: all var(--transition-short);
    --metric-hover-transform: translateY(-1px);
}

/* ===== TYPOGRAPHY ===== */
h1, h2 {
    font-family: var(--font-heading);
    font-weight: normal;
}

body {
    /* Positioning & Layout */
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 90dvh;
    
    /* Box Model */
    margin: 0;
    padding: var(--spacing-xs);
    
    /* Visual */
    background-color: var(--bg-color);
    color: var(--text-color);
    
    /* Typography */
    font-family: var(--font-body);
}

button {
    /* Typography */
    font-family: var(--font-body);
    font-size: 1rem;
}

/* ===== LAYOUT & CONTAINERS ===== */

.game-area-container {
    width:100%;
    max-width: var(--content-max-width);
}

.button-bar {
    /* Positioning & Layout */
    display: flex;
    justify-content: center;
    
    /* Box Model */
    gap: var(--spacing-xs);
    padding: var(--spacing-md);
}

.board-container {
    /* Positioning & Layout */
    display: flex;
    justify-content: center;
    align-items: flex-start;
    flex-grow: 1;
    
    /* Box Model */
    margin: 0 auto;
    max-width: var(--content-max-width);
}

.instructions {
    /* Box Model */
    margin-bottom: var(--spacing-md);
    max-width: var(--content-max-width);
    
    /* Typography */
    text-align: center;
}

.game-initial-view-content p {
    /* Typography */
    font-size: 20px;
    text-align: center;
}

.lost, .forfeit {
    color:var(--lose);
}

.won {
    color:var(--correct);
}

/* ===== HEADER & LOGO ===== */
.header {
    /* Positioning & Layout */
    display: flex;
    justify-content: center;
    align-items: center;
    width: 100%;
}

.logo {
    /* Box Model */
    width: 40px;
    height: 40px;
    margin-right: var(--spacing-xs);
}

.title {
    /* Typography */
    font-size: 32px;
    letter-spacing: 0.2px;

    margin:var(--spacing-sm);
}

.initial-header {
    /* Positioning & Layout */
    display: flex;
    justify-content: center;
    align-items: center;
    flex-direction: column;
    width: 100%;

    margin-top:var(--spacing-gigantic);
}

.initial-logo {
    /* Box Model */
    width: 80px;
    height: 80px;
    margin-bottom: var(--spacing-xs);
}

.initial-title {
    /* Box Model */
    margin: 8px;
    
    /* Typography */
    font-size: 48px;
    line-height: 56px;
    letter-spacing: 0.2px;
}

.initial-welcome-message {
    /* Box Model */
    margin-top: var(--spacing-xxl);
}

.initial-welcome-message h3 {
    /* Box Model */
    margin: 8px;
    margin-top:var(--spacing-mega);
    
    /* Typography */
    font-family: var(--font-heading);
    font-weight: 200;
    letter-spacing: 1px;
    text-align: center;
}

/* ===== GAME BOARD ===== */
.board {
    /* Positioning & Layout */
    display: grid;
    grid-template-rows: repeat(6, 1fr);
    
    /* Box Model */
    gap: var(--spacing-xxs);
    margin-bottom: var(--spacing-md);
}

.row {
    /* Positioning & Layout */
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    
    /* Box Model */
    gap: var(--spacing-xxs);
}

.tile {
    /* Positioning & Layout */
    display: flex;
    justify-content: center;
    align-items: center;
    
    /* Box Model */
    width: 62px;
    height: 62px;
    border: var(--spacing-micro) solid var(--border);
    
    /* Typography */
    font-family: var(--font-tile);
    font-size: 32px;
    font-weight: bold;
    text-transform: uppercase;
}

/* ===== KEYBOARD ===== */
.keyboard {
    /* Box Model */
    width: 100%;
    max-width: var(--content-max-width);
    margin-top: auto;
    margin-bottom: var(--spacing-md);
}

.keyboard-row {
    /* Positioning & Layout */
    display: flex;
    justify-content: center;
    
    /* Box Model */
    margin-bottom: 8px;
}

.key {
    /* Positioning & Layout */
    display: flex;
    justify-content: center;
    align-items: center;
    
    /* Box Model */
    height: 58px;
    margin: 0 var(--spacing-mini);
    padding: 0;
    border: none;
    border-radius: 4px;
    
    /* Visual */
    background-color: var(--key-bg);
    color: var(--text-color);
    cursor: pointer;
    --webkit-user-select: none;
    user-select: none;
    
    /* Typography */
    font-family: var(--font-tile);
    font-size: 14px;
    font-weight: 700;
    text-transform: uppercase;
    
    /* Animation */
    transition: all var(--transition-short);
}

.key-letter {
    /* Box Model */
    flex: 0 1 43px;
}

.key-spacer {
    /* Box Model */
    flex: 0.5 0 auto;
}

.key-wide {
    /* Box Model */
    flex: 1.5 0 auto;
    padding: 8px;
    
    /* Typography */
    font-size: 12px;
}

/* Keyboard hover/active states */
.key:hover, .key:active {
    /* Box Model */
    transform: translateY(-2px);
    
    /* Visual */
    background-color: var(--key-hover-bg);
    box-shadow: var(--key-box-shadow);
}

.key.correct:hover, .key.correct:active {
    /* Visual */
    background-color: var(--correct-hover);
}

.key.present:hover, .key.present:active {
    /* Visual */
    background-color: var(--present-hover);
}

.key.absent:hover, .key.absent:active {
    /* Visual */
    background-color: var(--absent-hover);
}

/* ===== LETTER STATE INDICATORS ===== */
.correct {
    /* Visual */
    background-color: var(--correct);
    border-color: var(--correct);
    color: var(--white);
}

.present {
    /* Visual */
    background-color: var(--present);
    border-color: var(--present);
    color: var(--white);
}

.absent {
    /* Visual */
    background-color: var(--absent);
    border-color: var(--absent);
    color: var(--white);
}

/* ===== BUTTON STYLES ===== */
/* Common button styles */
.btn {
    /* Box Model */
    padding: var(--spacing-xs) var(--spacing-md);
    border: var(--spacing-micro) solid var(--black);
    border-radius: 4px;
    
    /* Visual */
    cursor: pointer;
    
    /* Typography */
    font-weight: bold;
    
    /* Animation */
    transition: background-color var(--transition-short);
}

/* Button hover and active states */
.btn:hover, .btn:active {
    /* Visual */
    box-shadow: var(--standard-box-shadow);
}

/* Specific button styles */
.new-game-btn {
    /* Visual */
    background-color: var(--correct);
    color: var(--white);
}

.new-game-btn:hover, .new-game-btn:active {
    /* Visual */
    background-color: var(--correct-hover);
}

.how-to-play-btn {
    /* Visual */
    background-color: var(--black);
    color: var(--white);
}

.clear-stats-btn {
    /* Box Model */
    margin-top: var(--spacing-md);
    align-self: center;
    
    /* Visual */
    background-color: var(--black);
    color: var(--white);
}

.clear-stats-cancel-btn {
    /* Box Model */
    margin-top: var(--spacing-md);
    align-self: center;
    
    /* Visual */
    background-color: var(--white);
    color: var(--black);
}

.how-to-play-content {
    overflow-y: auto;
}

.how-to-play-btn:hover, .how-to-play-btn:active,
.clear-stats-btn:hover, .clear-stats-btn:active {
    /* Visual */
    background-color: var(--dark-hover);
}

.statistics-btn {
    /* Visual */
    background-color: var(--white);
    color: var(--black);
}

.statistics-btn:hover, .statistics-btn:active, .clear-stats-cancel-btn:hover, .clear-stats-cancel-btn:active {  
    /* Visual */
    background-color: var(--light-hover);
}

.start-game-btn {
    /* Visual */
    background-color: var(--white);
    color: var(--black);
}

.start-game-btn:hover, .start-game-btn:active {
    /* Visual */
    background-color: var(--light-hover);
}

.forfeit-game-btn {
    /* Visual */
    background-color: var(--present);
    color: var(--white);
}

.forfeit-game-btn:hover, .forfeit-game-btn:active {
    /* Visual */
    background-color: var(--present-hover);
}


.close-meaning-btn {
    /* Visual */
    background-color: var(--black);
    color: var(--white);
    align-self:center;
}

/* ===== OPTIONS BAR ===== */
.options-bar {
    display: flex;
    flex-direction: column;
    justify-content: space-around;
    align-items: flex-start;
    margin-top: var(--spacing-xxl);
    gap: var(--spacing-xl);
    max-width: var(--content-max-width);
}

.option {
    display: grid;
    grid-template-columns: auto 1fr;
    grid-template-rows: auto 1fr;
    align-items: left;
    text-align: left;
    cursor: pointer;
    transition: transform var(--transition-short)
}

.option:hover {
    transform: translateY(-5px);
    /* box-shadow: var(--standard-box-shadow); */
}

.option-icon {
    width: 72px;
    height: 72px;
    margin-bottom: var(--spacing-xs);
    margin-right: var(--spacing-sm);
    grid-column: 1;
    grid-row:1;
    grid-row-end: 3;
}

.option h3 {
    font-family: var(--font-heading);
    font-size: 16px;
    letter-spacing: 0.7px;
    text-align:left;
    margin: var(--spacing-xxs) 0;
    grid-column:2;
    grid-row:1;
}

.option p {
    font-family: var(--font-body);
    font-size: 18px;
    color: var(--dark-gray);
    grid-column: 2;
    grid-row:2;
    margin:0px;
    text-align:left;
}

.ad {
    background: url('/images/deepguess_duels.jpg') no-repeat center center;
    height:100px;
    background-size:cover;
    border:4px solid;
    border-image: var(--border-gradient) 1;
    margin: var(--spacing-md) 0;
    transition: transform var(--transition-short);
    cursor:pointer;
}

.ad:hover {
    transform: translateY(-5px);
}

/* ===== ANIMATIONS & TRANSITIONS ===== */
.hidden {
    /* Positioning & Layout */
    display: none;
    transform: translateY(20px);
    
    /* Visual */
    opacity: 0;
    
    /* Animation */
    transition: opacity var(--transition-long) ease, transform var(--transition-long) ease;
}

.visible {
    /* Positioning & Layout */
    display: block;
    transform: translateY(0);
    
    /* Visual */
    opacity: 1;
    
    /* Animation */
    transition: opacity var(--transition-long) ease, transform var(--transition-long) ease;
}

.fade-out {
    /* Positioning & Layout */
    transform: translateY(-20px);
    pointer-events: none;
    
    /* Visual */
    opacity: 0;
}

.fade-in-animation {
    /* Animation */
    animation: fadeInSlideUp var(--transition-long) ease forwards;
}

.fade-out-animation {
    /* Animation */
    animation: fadeOutSlideUp var(--transition-long) ease forwards;
}

.bounce {
    /* Animation */
    animation: bounce var(--transition-short);
}

.fade-in {
    /* Animation */
    animation: fadeIn var(--transition-short);
}

.shake {
    /* Animation */
    animation: shake var(--transition-medium);
}

/* Board clear animation when starting new game */
.tile-clear-animation {
    /* Animation */
    animation-duration: var(--transition-medium) !important;
    animation-name: tileClearShake !important;
    animation-timing-function: ease-in-out;
    animation-fill-mode: forwards;
}

/* Animation keyframes */
@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes shake {
    10%, 90% { transform: translate3d(-1px, 0, 0); }
    20%, 80% { transform: translate3d(2px, 0, 0); }
    30%, 50%, 70% { transform: translate3d(-2px, 0, 0); }
    40%, 60% { transform: translate3d(2px, 0, 0); }
}

@keyframes tileClearShake {
    0% {
        transform: translate(0, 0) rotate(0) scale(1);
        opacity: 1;
    }
    10% {
        transform: translate(-3px, -2px) rotate(-2deg) scale(0.97);
        opacity: 1;
    }
    25% {
        transform: translate(4px, 1px) rotate(1deg) scale(1.02);
        opacity: 1;
    }
    40% {
        transform: translate(-2px, 3px) rotate(-1deg) scale(0.98);
        opacity: 1;
    }
    60% {
        transform: translate(3px, -2px) rotate(1.5deg) scale(1.01);
        opacity: 1;
    }
    75% {
        transform: translate(-3px, 1px) rotate(-0.5deg) scale(0.99);
        opacity: 1;
    }
    85% {
        transform: translate(2px, -1px) rotate(0.5deg) scale(1);
        opacity: 0.8;
    }
    100% {
        transform: translate(0, 0) rotate(0) scale(1);
        opacity: 0;
    }
}

@keyframes bounce {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.05); }
}

@keyframes fadeInSlideUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes fadeOutSlideUp {
    from {
        opacity: 1;
        transform: translateY(0);
    }
    to {
        opacity: 0;
        transform: translateY(-20px);
    }
}

@keyframes textPop {
    0% {
        transform: scale(0.95);
        opacity: 0.4;
        letter-spacing: -0.5px;
    }
    50% {
        transform: scale(1.05);
        opacity: 1;
        letter-spacing: 0.5px;
        text-shadow: 0 0 8px rgba(0, 0, 0, 0.1);
    }
    100% {
        transform: scale(1);
        opacity: 1;
        letter-spacing: normal;
    }
}

/* ===== MESSAGES & NOTIFICATIONS ===== */
.message {
    /* Positioning & Layout */
    position: fixed;
    top: 30%;
    left: 50%;
    transform: translateX(-50%);
    display: none;
    
    /* Box Model */
    min-width: 200px;
    padding: var(--spacing-sm) var(--spacing-md);
    border-radius: 4px;
    
    /* Visual */
    background-color: var(--message-bg);
    color: var(--white);
    
    /* Typography */
    font-weight: bold;
    text-align: center;
}

.show {
    /* Positioning & Layout */
    display: block;
    
    /* Animation */
    animation: fadeIn var(--transition-medium);
}

/* ===== MODAL STYLES ===== */
.modal {
    /* Positioning & Layout */
    position: fixed;
    z-index: 100;
    left: 0;
    top: 0;
    display: none;
    overflow: auto;
    
    /* Box Model */
    width: 100%;
    height: 100%;
    
    /* Visual */
    background-color: var(--modal-overlay);
}

.modal-content {
    /* Positioning & Layout */
    position: relative;
    display:flex;
    flex-direction: column;
    
    /* Box Model */
    width: 80%;
    max-height: 80%;
    margin: var(--spacing-lg) auto;
    padding: var(--spacing-md);
    border-radius: 5px;
    
    /* Visual */
    background-color: var(--bg-color);
    
    /* Animation */
    animation: fadeIn var(--transition-medium);
}

.modal-content-header {
    display: flex;
    justify-content: space-between;
}

.close {
    /* Positioning & Layout */
    
    /* Visual */
    color: var(--dark-gray);
    cursor: pointer;
    
    /* Typography */
    font-size: 32px;
    font-weight: bold;
}

.close:hover,
.close:focus {
    /* Visual */
    color: var(--black);
    text-decoration: none;
}

/* ===== EXAMPLE TILES (IN MODAL) ===== */
.examples {
    /* Box Model */
    margin: var(--spacing-md) 0;
}

.example {
    /* Box Model */
    margin-bottom: var(--spacing-sm);
}

.example-row {
    /* Positioning & Layout */
    display: flex;
    
    /* Box Model */
    margin-bottom: var(--spacing-xxs);
}

.example-tile {
    /* Positioning & Layout */
    display: flex;
    justify-content: center;
    align-items: center;
    
    /* Box Model */
    width: 40px;
    height: 40px;
    margin-right: var(--spacing-micro);
    border: var(--spacing-micro) solid var(--border);
    
    /* Typography */
    font-family: var(--font-tile);
    font-size: 20px;
    font-weight: bold;
    text-transform: uppercase;
}

.example-meaning {
    background: var(--metric-background);
    border: 4px solid var(--border);
    border-image: var(--border-gradient) 1;
}

/* ===== TIMER STYLES ===== */
.timer-container {
    /* Positioning & Layout */
    display: flex;
    justify-content: center;
    
    /* Box Model */
    margin: var(--spacing-xs) 0 var(--spacing-md);
}

#timer {
    /* Box Model */
    margin: 0;
    padding: var(--spacing-xxs) var(--spacing-sm);
    border-radius: 5px;
    
    /* Visual */
    background-color: var(--bg-color);
    color: var(--text-color);
    
    /* Typography */
    font-family: var(--font-heading);
    font-weight: normal;
}

.timer-message {
    /* Positioning & Layout */
    display: grid;
    place-items: center;
    
    /* Box Model */
    width: 90%;
    max-width: var(--content-max-width);
    min-height: 50px;
    margin: auto;
    border-radius: 5px;
    
    /* Visual */
    color: var(--timer-message-color);
    
    /* Typography */
    font-family: var(--font-body);
    font-size: 18px;
    font-weight: bold;
    text-align: center;
    
    /* Animation */
    transition: all var(--transition-medium) ease;
}

.timer-message.animate {
    /* Animation */
    animation: textPop var(--transition-medium) ease-in-out;
}

/* ===== STATISTICS STYLES ===== */
#statistics-container {
    /* Positioning & Layout */
    display: flex;
    flex-direction: column;
    overflow-y: auto;
    
    /* Box Model */
    max-height: 70vh;
    gap: var(--spacing-sm);
}

/* Tabs styling */
.stats-tabs-container {
    display: flex;
    justify-content: center;
    border-bottom: 2px solid var(--border);
    margin-bottom: var(--spacing-sm);
}

.stats-tab-btn {
    background: none;
    border: none;
    padding: var(--spacing-xs) var(--spacing-md);
    font-family: var(--font-heading);
    font-size: 18px;
    cursor: pointer;
    position: relative;
    transition: all var(--transition-short);
    color: var(--dark-gray);
    opacity: 0.7;
}

.stats-tab-btn.active {
    color: var(--text-color);
    opacity: 1;
}

.stats-tab-btn::after {
    content: '';
    position: absolute;
    bottom: -2px;
    left: 0;
    width: 100%;
    height: 3px;
    background-color: var(--correct);
    transform: scaleX(0);
    transition: transform var(--transition-short);
}

.stats-tab-btn.active::after {
    transform: scaleX(1);
}

.stats-tab-btn:hover {
    opacity: 1;
}

.stats-tab-content {
    display: none;
    width: 100%;
}

.stats-tab-content.active {
    display: block;
    animation: fadeIn var(--transition-short);
}

/* Statistics summary section styles */
.stats-summary-container {
    display: flex;
    flex-direction: column;
    padding: var(--spacing-xs) 0;
    margin-bottom: var(--spacing-xs);
}

.stats-summary-title {
    margin: var(--spacing-xxs) 0 var(--spacing-sm);
    font-family: var(--font-heading);
    font-size: 18px;
    text-align: center;
}

.stats-metrics-grid {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: var(--spacing-lg);
    padding: var(--spacing-xs);
}

/* Updated metric item styling to match the design */
.metric-item {
    display: flex;
    min-width: 200px;
    max-width: 300px;
    border-radius: 8px;
    background-color: var(--metric-background);
    padding: var(--spacing-xs);
    box-shadow: var(--metric-shadow);
    transition: var(--metric-transition);
    position: relative;
    border: 4px solid var(--border);
    border-image: var(--border-gradient) 1;
}



.metric-icon-container {
    display: flex;
    justify-content: center;
    padding-right: var(--spacing-sm);
    z-index: 1;

    margin-left:-25px;
    margin-top:-25px;

}

.metric-icon {
    width: 48px;
    height: 48px;
    object-fit: contain;
    border:4px solid var(--border);
    border-image: var(--border-gradient) 1;
}

.metric-text-container {
    display: flex;
    flex-direction: column;
    justify-content: center;
    flex-grow: 1;
    z-index: 1;
}

.metric-value {
    font-family: var(--font-heading);
    font-size: 32px;
    color: var(--text-color);
    margin-bottom: var(--spacing-xxs);
}

.metric-label {
    font-family: var(--font-heading);
    font-size: 18px;
    color: var(--dark-gray);
}


.metric-description {
    font-family: var(--font-body);
    font-size: 14px;
    font-weight: 500;
    margin-bottom: var(--spacing-sm);
}

/* .metric-item:hover {
    transform: var(--metric-hover-transform);
    box-shadow: var(--metric-hover-shadow);
    border: var(--metric-hover-border);
} */

.stats-divider {
    width: 100%;
    margin: var(--spacing-xs) 0;
    border: none;
    border-top: 1px solid var(--border);
}

.table-container {
    /* Box Model */
    /* max-height: 400px;
    
    /* Positioning & Layout */
    /* overflow-y: auto;  */
}

.stats-header {
    /* Positioning & Layout */
    position: sticky;
    top: 0;
    z-index: 1;
    
    /* Box Model */
    padding: var(--spacing-xs);
    border-bottom: var(--spacing-micro) solid var(--border);
    
    /* Visual */
    background-color: var(--bg-color);
    
    /* Typography */
    text-align: left;
}

.stats-list {
    /* Positioning & Layout */
    display: flex;
    flex-direction: column;
    
    /* Box Model */
    gap: 12px;
    margin-top: var(--spacing-md);
    
    /* Typography */
    font-family: var(--font-body);
}

.stats-serial {
    /* Box Model */
    width: 25px;
    margin-right: var(--spacing-xxs);
    
    /* Typography */
    text-align: right;
    font-weight: bold;
}

.stats-word {
    /* Positioning & Layout */
    display: inline-flex;
    
    /* Box Model */
    gap: var(--spacing-micro);
    margin-right: var(--spacing-xxs);
}

.stats-tile {
    /* Positioning & Layout */
    display: inline-flex;
    justify-content: center;
    align-items: center;
    
    /* Box Model */
    width: 24px;
    height: 24px;
    margin-right: var(--spacing-micro);
    padding: var(--spacing-xxs);
    border-radius: 3px;
    
    /* Visual */
    color: var(--white);
    
    /* Typography */
    font-family: var(--font-tile);
    font-size: 12px;
    font-weight: bold;
    text-transform: uppercase;
}

.stats-separator {
    /* Visual */
    color: var(--light-mid-gray);
    
    /* Typography */
    font-family: var(--font-mono);
    letter-spacing: 2px;
}

.stats-result {
    /* Typography */
    font-weight: bold;
    text-align: center;
    text-align: left;
}

.result-chiclet {
    /* Positioning & Layout */
    display: inline-block;
    
    /* Box Model */
    min-width: 50px;
    padding: 6px 10px;
    border-radius: 12px;
    
    /* Visual */
    color: var(--white);
    
    /* Typography */
    font-size: 14px;
    font-weight: bold;
    text-align: center;
}

.result-win {
    /* Visual */
    background-color: var(--correct);
}

.result-lose {
    /* Visual */
    background-color: var(--lose);
}

.stats-time {
    /* Typography */
    font-family: var(--font-mono);
    font-weight: bold;
    font-size: 16px;
}

.stats-tries {
    /* Typography */
    font-weight: bold;
    text-align: center;
}

.stats-target {
    /* Typography */
    font-weight: bold;
}

.stats-target.clickable {
    cursor:pointer;
}

.no-stats-message {
    /* Box Model */
    margin: var(--spacing-xl) var(--spacing-md);
    
    /* Typography */
    font-style: italic;
    text-align: center;
    
    /* Visual */
    color: var(--very-light-gray);
}

.stats-table {
    /* Positioning & Layout */
    /* overflow-y: auto; */
    
    /* Box Model */
     width: 100%;
    /* max-height: 400px; */
    
    /* Visual */
    border-collapse: collapse;
    
    /* Typography */
    font-family: var(--font-mono);
    font-size: 16px;
}

.stats-header th {
    /* Box Model */
    padding: var(--spacing-xs);
    border-bottom: var(--spacing-micro) solid var(--border);
    
    /* Typography */
    font-weight: bold;
    text-align: left;
}

.stats-row td {
    /* Box Model */
    padding: var(--spacing-xs);
}

/* ===== SCROLLBAR STYLES ===== */
.table-container::-webkit-scrollbar,
.stats-table::-webkit-scrollbar,
.word-definition-container::-webkit-scrollbar,
.how-to-play-content::-webkit-scrollbar,
#statistics-container::-webkit-scrollbar {
    /* Box Model */
    width: 8px;
}

.table-container::-webkit-scrollbar-track,
.stats-table::-webkit-scrollbar-track,
.word-definition-container::-webkit-scrollbar-track,
.how-to-play-content::-webkit-scrollbar-track,
#statistics-container::-webkit-scrollbar-track {
    /* Visual */
    background: transparent;
}

.table-container::-webkit-scrollbar-thumb,
.stats-table::-webkit-scrollbar-thumb,
.word-definition-container::-webkit-scrollbar-thumb,
.how-to-play-content::-webkit-scrollbar-thumb,
#statistics-container::-webkit-scrollbar-thumb {
    /* Box Model */
    border: 3px solid transparent;
    border-radius: 10px;
    
    /* Visual */
    background-color: var(--dark-border);
}

/* ===== SORT CONTROLS ===== */
.sort-controls {
    /* Positioning & Layout */
    display: flex;
    align-items: center;
    
    /* Box Model */
    padding: var(--spacing-xxs) 0;
}

.sort-label {
    /* Box Model */
    margin-right: var(--spacing-xs);
    
    /* Typography */
    font-weight: bold;
}

.sort-select, .sort-direction-btn {
    /* Box Model */
    border: var(--spacing-micro) solid var(--dark-border);
    
    /* Visual */
    cursor: pointer;
    
    /* Animation */
    transition: all var(--transition-medium) ease;
}

.sort-select {
    /* Box Model */
    padding: 8px var(--spacing-xs);
    margin-right: var(--spacing-xs);
    border-radius: 8px;
    
    /* Visual */
    background-color: var(--black);
    color: var(--white);
    
    /* Typography */
    font-family: var(--font-body);
    font-size: 16px;
    font-weight: bold;
}

.sort-direction-btn {
    /* Positioning & Layout */
    display: flex;
    align-items: center;
    justify-content: center;
    
    /* Box Model */
    padding: 8px var(--spacing-xs);
    border-radius: 50%;
    
    /* Visual */
    background-color: var(--white);
    color: var(--text-color);
    
    /* Typography */
    font-size: 18px;
    font-weight: bold;
}

.sort-select:hover, .sort-direction-btn:hover {
    /* Visual */
    background-color: var(--light-gray);
    border-color: var(--correct);
}

.sort-select:hover {
    /* Visual */
    color: var(--black);
}

.sort-direction-btn:hover {
    /* Visual */
    color: var(--correct);
}

.sort-select:focus {
    /* Visual */
    background-color: var(--black);
}

/* ===== MEDIA QUERIES ===== */
@media (max-width: 500px) {
    .tile {
        /* Box Model */
        width: 50px;
        height: 50px;
        
        /* Typography */
        font-size: 28px;
    }
    
    .key {
        /* Box Model */
        height: 50px;
    }
    
    /* Stats table responsive layout */
    .stats-table {
        /* Positioning & Layout */
        display: block;
    }

    .stats-header {
        /* Positioning & Layout */
        display: none;
    }

    .stats-row {
        /* Positioning & Layout */
        display: inline-block;
        flex-direction: column;
        
        /* Box Model */
        gap: var(--spacing-xxs);
        margin: var(--spacing-xs) 0;
        padding-bottom: var(--spacing-xs);
        border-bottom: 1px solid var(--light-mid-gray);
    }

    .stats-row td {
        /* Positioning & Layout */
        display: inline-block;
        
        /* Box Model */
        padding: var(--spacing-xxs);
        margin-right: var(--spacing-xs);
        box-sizing: border-box;
        
        /* Typography */
        text-align: left;
    }

    .stats-row .stats-target {
        /* Box Model */
        margin-left: var(--spacing-sm);
    }

    .stats-row .stats-tries::before {
        /* Typography */
        content: 'Tries:';
        
        /* Box Model */
        padding: var(--spacing-xxs);
    }

    .stats-row .stats-time::before {
        /* Typography */
        content: 'Time:';
        
        /* Box Model */
        padding: var(--spacing-xxs);
    }
}

.edit-name-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: var(--spacing-md);
    margin: var(--spacing-md) 0;
}

#player-name-input {
    width: 100%;
    max-width: 300px;
    padding: var(--spacing-xs);
    border: 2px solid var(--dark-border);
    border-radius: 4px;
    font-family: var(--font-body);
    font-size: 18px;
}

#save-name-btn {
    background-color: var(--correct);
    color: var(--white);
}

#save-name-btn:hover {
    background-color: var(--correct-hover);
}

#playerId {
    position: relative;
    transition: color var(--transition-short);
    padding:var(--spacing-xxs);
    border-radius: var(--spacing-xxs);
}

#playerId[data-editable="true"] {
    cursor: pointer;
    background-color: var(--player-name-edit-color);
    color:var(--white);
}

#playerId[data-editable="true"]:hover {

    color: var(--black);
}

#playerId[data-editable="true"]::after {
    content: "✎";
    font-size: 0.7em;
    position: relative;
    top: 0;
    margin-left: 0.3em;
    opacity: 0.7;
}

#playerId:not([data-editable="true"])::after {
    content: "!";
    font-size: 1em;
    position: relative;
    margin-left: 0.3em;
}



/* ===== WORD MEANING MODAL ===== */
#meaning-modal .modal-content {
    max-width: 500px;
}

.word-definition-container {
     /* Positioning & Layout */
     display: flex;
     flex-direction: column;
     overflow-y: auto;
     
     /* Box Model */
     max-height: 90vh;
     height:80vh;
     gap: var(--spacing-sm);
}

.word-meaning-container {
    display: flex; 
    justify-content: center; 
    flex-direction: column;
}

.word-meaning-container span {
    font-size:120px;
    line-height: 120px;
    height: 60px;
}

.word-meaning-container span:last-child {
    text-align: right;
}

#word-definition {
    position: relative;
    font-style: italic;
    font-size: 24px;
    color: var(--text-color);
    border-radius: 4px;
    margin: var(--spacing-sm) var(--spacing-xl);
    text-align: center;
}

#word-intro-text,
#meaning-modal p {
    text-align: center;
    margin: 15px 0;
}

#word-letters {
    justify-content: center;
}