/* Game styles */
body {
    font-family: 'Nunito', sans-serif;
    text-align: center;
    margin: 0;
    padding: 6px;
    background-color: #0b1d3a;
    /* Deep blue fallback */
    background-image: url('../assets/festive_background.png');
    background-size: cover;
    background-position: center bottom;
    background-attachment: fixed;
    color: #5a3e2b;
    /* Dark Brown Text */
}

h1 {
    color: #ffffff;
    /* White for dark bg */
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.5);
    /* Shadow for readability */
    margin-bottom: 15px;
    text-transform: uppercase;
    font-size: 24px;
    font-weight: 800;
    /* Extra bold */
}

#game-container {
    position: relative;
    padding-top: 50px;
    /* Create space for the top controls */
    max-width: 500px;
    margin: 0 auto;

    /* Wood Texture */
    background-color: #A05F2C;
    /* Fallback */
    background-image: url('../assets/wood_texture.png');
    background-size: cover;

    border-radius: 20px;
    /* More rounded */
    padding: 20px;

    /* 3D Bevel Effect - Stronger */
    box-shadow:
        /* Deep Drop Shadow for floating effect */
        8px 8px 20px rgba(0, 0, 0, 0.5),

        /* Strong Top/Left Highlight (The Light Edge) */
        inset 5px 5px 2px rgba(255, 255, 255, 0.2),

        /* Strong Bottom/Right Shadow (The Dark Edge) */
        inset -5px -8px 5px rgba(0, 0, 0, 0.2),

        /* Board Surface Vignette */
        inset 0 0 80px rgba(0, 0, 0, 0.2);
}

/* Create a fixed header area for the controls */
.game-header {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 50px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0 20px;
    background-color: white;
    border-bottom: 1px solid #f0f0f0;
    border-radius: 10px 10px 0 0;
    z-index: 50;
}

canvas {
    /* Remove the border */
    border: none;
    border-radius: 5px;
    display: block;
    margin: 10px auto 20px;
}

.game-controls {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-bottom: 20px;
}

.info {
    margin: 5px 0;
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 10px;
}

button {
    padding: 8px 16px;
    background-color: #4a75e6;
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
    transition: background-color 0.3s;
}

button:hover {
    background-color: #3a65d6;
}

button:disabled {
    background-color: #95a5a6;
    cursor: not-allowed;
}

/* Word and score display */
#word-display {
    font-size: 20px;
    min-height: 30px;
    font-weight: bold;
    margin-bottom: 15px;
    /* More space */
    padding: 0;
    background-color: transparent;
    /* Remove box */
    color: #5a3e2b;
    /* Dark Brown */
    transition: all 0.2s ease;
    text-shadow: 0 1px 0 rgba(255, 255, 255, 0.5);
}

#score-display {
    font-size: 18px;
    font-weight: bold;
    color: #5a3e2b;
}

/* Letters display */
.letters-display {
    font-size: 16px;
    font-weight: bold;
    padding: 0;
    border-radius: 0;
    background-color: transparent;
    /* Remove box */
    color: #5a3e2b;
    display: inline-block;
    margin: 0 5px;
}

/* Button styling */
#button-container {
    display: flex;
    gap: 20px;
    justify-content: center;
    margin-top: 15px;
}

#new-game-btn {
    background-color: #3498db;
    padding: 10px 20px;
    font-weight: bold;
    font-size: 16px;
    border-radius: 6px;
    transition: background-color 0.3s, transform 0.1s;
}

#new-game-btn:hover {
    background-color: #2980b9;
}

#new-game-btn:active {
    transform: scale(0.97);
}

#finish-btn {
    background-color: #f2e8d0;
    /* Cream tile color */
    color: #5a3e2b;
    /* Dark Brown text */
    padding: 0 20px;
    /* Use horizontal padding, height set to match icons */
    height: 36px;
    /* Match icon button height */
    font-weight: bold;
    font-size: 16px;
    border: 1px solid #bea884;
    border-radius: 8px;
    /* Match icon buttons */
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

#finish-btn:hover {
    background-color: #fff;
    transform: translateY(-2px);
}

#finish-btn:active {
    transform: scale(0.97);
}

/* Scoring info panel styles */
.scoring-info-panel {
    position: absolute;
    top: 80px;
    right: -220px;
    width: 200px;
    background-color: white;
    border-radius: 10px;
    padding: 15px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    z-index: 100;
    transition: transform 0.3s ease-in-out;
    text-align: left;
    transform: translateX(0);
}

.scoring-info-panel.visible {
    transform: translateX(-220px);
}

.scoring-info-panel h3 {
    margin: 0 0 10px 0;
    color: #4a75e6;
    font-size: 16px;
    text-align: center;
}

.scoring-tier {
    display: flex;
    justify-content: space-between;
    padding: 5px 0;
    border-bottom: 1px solid #eee;
    transition: background-color 0.2s ease;
}

.scoring-tier.active {
    background-color: #f0f7ff;
    font-weight: bold;
}

.word-length {
    font-size: 14px;
    color: #555;
}

.points {
    font-size: 14px;
    color: #4a75e6;
}

.multiplier-info {
    margin-top: 10px;
    padding-top: 5px;
    border-top: 1px dashed #ccc;
    font-size: 13px;
    color: #e74c3c;
    font-style: italic;
}

.multiplier-info.hidden {
    display: none;
}

/* Info toggle button */
.info-toggle-btn {
    position: relative;
    top: 0;
    right: 0;
    width: 30px;
    height: 30px;
    border-radius: 50%;
    background-color: #4a75e6;
    color: white;
    font-size: 18px;
    line-height: 1;
    cursor: pointer;
    border: none;
    z-index: 101;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.2);
}

.info-toggle-btn:hover {
    background-color: #3a65d6;
}

/* Game over modal */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.7);
    justify-content: center;
    align-items: center;
    z-index: 1000;
}

.modal.active {
    display: flex;
}

.modal-content {
    background-color: white;
    padding: 20px 30px;
    border-radius: 10px;
    max-width: 80%;
    width: 400px;
    text-align: center;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.3);
}

.modal h2 {
    color: #4a75e6;
    margin-top: 0;
}

.top-word {
    display: flex;
    justify-content: space-between;
    padding: 8px 10px;
    margin: 5px 0;
    background-color: #f3f3f3;
    border-radius: 5px;
    font-weight: bold;
}

.top-word .rank {
    width: 30px;
    text-align: left;
    color: #4a75e6;
}

.top-word .word {
    flex-grow: 1;
    text-align: left;
    padding-left: 10px;
}

.top-word .score {
    width: 70px;
    text-align: right;
    color: #2ecc71;
}

#encouragement-message {
    font-style: italic;
    margin: 20px 0;
    color: #7f8c8d;
}

#play-again-btn {
    margin-top: 10px;
    padding: 10px 20px;
    font-size: 16px;
    background-color: #2ecc71;
}

#play-again-btn:hover {
    background-color: #27ae60;
}

/* Burger menu styles */
.burger-menu {
    position: relative;
    top: 0;
    left: 0;
    width: 30px;
    height: 25px;
    cursor: pointer;
    z-index: 102;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
}

.burger-line {
    width: 100%;
    height: 4px;
    /* Thicker lines */
    background-color: #ffffff;
    /* White for contrast */
    border-radius: 3px;
    transition: all 0.3s ease;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.5);
}

.burger-menu.active {
    position: fixed;
    top: 20px;
    left: 20px;
}

.burger-menu.active .burger-line:nth-child(1) {
    transform: translateY(11px) rotate(45deg);
}

.burger-menu.active .burger-line:nth-child(2) {
    opacity: 0;
}

.burger-menu.active .burger-line:nth-child(3) {
    transform: translateY(-11px) rotate(-45deg);
}

/* Side menu panel */
.side-menu {
    position: fixed;
    top: 0;
    left: -300px;
    width: 250px;
    height: 100%;
    background-color: white;
    box-shadow: 2px 0 8px rgba(0, 0, 0, 0.1);
    z-index: 100;
    transition: left 0.3s ease;
    padding: 60px 20px 20px;
    overflow-y: auto;
}

.side-menu.active {
    left: 0;
}

.side-menu h3 {
    color: #4a75e6;
    margin-bottom: 15px;
    font-size: 18px;
    border-bottom: 1px solid #eee;
    padding-bottom: 10px;
}

/* Game mode selection in side menu */
.game-modes {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-bottom: 20px;
}

.mode-option {
    display: flex;
    align-items: center;
    padding: 12px 15px;
    background-color: #f5f5f5;
    border-radius: 8px;
    transition: all 0.2s ease;
    cursor: pointer;
}

.mode-option:hover {
    background-color: #e8f0fe;
}

.mode-option.active {
    background-color: #4a75e6;
    color: white;
}

.mode-title {
    font-weight: bold;
    font-size: 16px;
    margin-bottom: 5px;
}

.mode-desc {
    font-size: 13px;
    color: #666;
}

.mode-option.active .mode-desc {
    color: rgba(255, 255, 255, 0.8);
}

/* Overlay */
.menu-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    z-index: 99;
    display: none;
}

.menu-overlay.active {
    display: block;
}

/* Timer styles for Timed Mode */
#timer-container {
    display: none;
    position: relative;
    margin: 10px auto;
    text-align: center;
}

#timer-display {
    font-size: 24px;
    font-weight: bold;
    color: #333;
    background-color: #f8f8f8;
    padding: 5px 15px;
    border-radius: 15px;
    display: inline-block;
    min-width: 80px;
    transition: color 0.3s, background-color 0.3s;
}

#timer-display.warning {
    color: white;
    background-color: #e74c3c;
    animation: pulse 1s infinite;
}

#timer-display.highlight {
    animation: highlight-pulse 0.5s;
}

/* Start button for timed mode */
#start-timer-btn {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    padding: 15px 30px;
    font-size: 20px;
    font-weight: bold;
    background-color: #2ecc71;
    color: white;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    z-index: 100;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
    transition: background-color 0.3s, transform 0.1s;
}

#start-timer-btn:hover {
    background-color: #27ae60;
}

#start-timer-btn:active {
    transform: translate(-50%, -50%) scale(0.97);
}

/* Time extension animation */
.time-extension {
    position: absolute;
    font-weight: bold;
    color: #2ecc71;
    font-size: 16px;
    animation: float-up 1.5s forwards;
    pointer-events: none;
    z-index: 200;
}

@keyframes float-up {
    0% {
        opacity: 0;
        transform: translateY(0);
    }

    20% {
        opacity: 1;
    }

    80% {
        opacity: 1;
    }

    100% {
        opacity: 0;
        transform: translateY(-50px);
    }
}

@keyframes pulse {
    0% {
        opacity: 1;
    }

    50% {
        opacity: 0.7;
    }

    100% {
        opacity: 1;
    }
}

@keyframes highlight-pulse {
    0% {
        transform: scale(1);
        background-color: #f8f8f8;
    }

    50% {
        transform: scale(1.1);
        background-color: #2ecc71;
    }

    100% {
        transform: scale(1);
        background-color: #f8f8f8;
    }
}

/* Add these styles to position buttons at the top */

/* Create a page header that contains the title and buttons */
.page-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0 5px;
    margin-bottom: 10px;
    position: relative;
}

/* Center the title in the header */
.page-header h1 {
    flex-grow: 1;
    text-align: center;
    margin: 0;
}

/* Remove the header from inside the game container */
.game-header {
    display: none;
}

/* Position buttons in the page header */
.header-stats {
    background-color: rgba(237, 227, 202, 1);
    padding: 10px 20px;
    border-radius: 8px;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
    margin: 0 auto 20px;
    max-width: 500px;
    display: flex;
    justify-content: space-around;
    align-items: center;
    backdrop-filter: blur(5px);
}

.left-controls,
.right-controls {
    width: 40px;
    display: flex;
    justify-content: center;
    align-items: center;
}

/* Reposition burger menu */
.burger-menu {
    position: relative;
    top: 0;
    left: 0;
    margin: 0;
    z-index: 50;
}

.burger-menu.active {
    position: fixed;
    top: 20px;
    left: 20px;
}

/* Reposition info toggle button */
.info-toggle-btn {
    position: relative;
    top: 0;
    right: 0;
    margin: 0;
}

/* Ensure the game container doesn't need extra top padding */
#game-container {
    padding-top: 20px;
}

/* Keep the game container centered and well-spaced */
#game-container {
    position: relative;
    max-width: 500px;
    margin: 0 auto;
    background-color: white;
    border-radius: 10px;
    padding: 20px;
    /* box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1); */
}

/* Sound controls */
/* Sound controls */
.sound-toggle {
    width: 30px;
    height: 30px;
    border-radius: 10%;
    background-color: transparent;
    /* Transparent button */
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 50;
    box-shadow: none;
    /* Remove shadow */
}

.sound-toggle i {
    color: #5a3e2b;
    /* Dark Brown */
    font-size: 20px;
}

/* Generic Icon Button (reusing sound-toggle styles) */
.icon-btn {
    width: 30px;
    height: 30px;
    border-radius: 10%;
    background-color: transparent;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 50;
    box-shadow: none;
    margin-left: 5px;
    /* Spacing between icons */
}

.icon-btn i {
    color: #5a3e2b;
    /* Dark Brown */
    font-size: 18px;
    /* Slightly smaller as requested */
}

/* Help Modal Content */
.help-content {
    text-align: left;
    line-height: 1.6;
    color: #333;
}

.help-content h3 {
    color: #4a75e6;
    margin-top: 15px;
    margin-bottom: 5px;
    border-bottom: 1px solid #eee;
    padding-bottom: 5px;
}

.help-content ul {
    margin: 5px 0 15px 0;
    padding-left: 20px;
}

.help-content li {
    margin-bottom: 5px;
    font-size: 14px;
}

.help-content strong {
    color: #5a3e2b;
}

.icon-wrapper {
    display: flex;
    align-items: center;
    gap: 5px;
    /* Space between icons in header */
}

/* Footer Icon Buttons (on wood background) */
.footer-icon-btn {
    background-color: #f2e8d0;
    /* Cream tile color */
    border: 1px solid #bea884;
    border-radius: 8px;
    /* Match standard buttons */
    width: 36px;
    /* Slightly larger targets */
    height: 36px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
    transition: all 0.2s ease;
}

.footer-icon-btn:hover {
    background-color: #fff;
    transform: translateY(-2px);
}

.footer-icon-btn i {
    font-size: 16px;
    color: #5a3e2b;
}

/* Responsive adjustments */
@media (max-width: 500px) {
    .page-header {
        padding: 0 10px;
    }

    #game-container {
        padding: 15px;
    }
}

/* Bonus Letters Display */
#bonus-letters-container {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 6px;
    margin: 10px auto;
    padding: 8px 16px;

    /* Inset Wood Look */
    background-color: rgba(60, 30, 10, 0.35);
    /* Dark transparent tint */
    border-radius: 12px;
    border: none;
    box-shadow:
        inset 2px 2px 6px rgba(0, 0, 0, 0.35),
        inset -1px -1px 2px rgba(255, 255, 255, 0.6);

    position: relative;
    z-index: 10;
    width: fit-content;
    /* Center properly */
}

/* Knocked back score text */
.bonus-score-text {
    font-size: 15px;
    font-weight: 800;
    color: rgb(87, 43, 13);
    /* Knocked back brown */
    margin-left: 6px;
    letter-spacing: 0.5px;
}

.bonus-letter {
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    background-color: #e0e0e0;
    color: #999;
    font-weight: bold;
    border-radius: 4px;
    font-size: 16px;
    border: 1px solid #ccc;
    box-shadow: inset 1px 1px 2px rgba(0, 0, 0, 0.1);
    transition: all 0.3s ease;
}

.bonus-letter.collected {
    background: linear-gradient(135deg, #4fc3f7, #0288d1);
    /* Cyan to Blue */
    color: white;
    border-color: #0277bd;
    box-shadow: 0 0 10px rgba(0, 247, 255, 0.6);
    /* Cyan glow */
    transform: scale(1.1);
    text-shadow: 0 1px 1px rgba(0, 0, 0, 0.3);
    border: none;
}

/* Multiplier Info Text */
#multiplier-info {
    font-size: 14px;
    color: #4a75e6;
    margin-top: 5px;
    font-style: italic;
    min-height: 20px;
}

/* Glassmorphism Results Modal */
.modal-content.daily-results {
    background: rgba(255, 255, 255, 0.85);
    /* Translucent white */
    backdrop-filter: blur(12px);
    /* Blur effect */
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid rgba(255, 255, 255, 0.4);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
    border-radius: 20px;
    padding: 30px;
    max-width: 480px;
    width: 90%;
    color: #333;
    font-family: 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
}

.daily-results h2 {
    font-size: 20px;
    color: #555;
    margin-bottom: 25px;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.result-summary {
    background: transparent;
    padding: 0;
    margin-bottom: 30px;
    border: none;
}

.final-score {
    font-size: 56px;
    font-weight: 800;
    color: #4a90e2;
    /* Clear solid blue, no gradient/glow */
    margin-bottom: 25px;
    line-height: 1;
}

/* Score Breakdown Table */
.score-breakdown {
    background: rgba(255, 255, 255, 0.5);
    border-radius: 12px;
    padding: 15px 20px;
    box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.05);
}

.breakdown-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 0;
    font-size: 16px;
    color: #444;
}

.stat-group {
    display: flex;
    align-items: center;
    gap: 8px;
    /* Distinct gap between label and count */
}

.stat-label {
    font-weight: 500;
    color: #7f8c8d;
    /* Softer text for label */
    text-transform: capitalize;
}

.stat-count {
    font-weight: 700;
    color: #2c3e50;
    /* Bold dark number */
    background: rgba(0, 0, 0, 0.05);
    /* Optional subtle badge feel? Or just text */
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 0.95em;
}

.stat-score {
    font-weight: 700;
    color: #333;
    font-family: monospace;
    /* Align numbers nicely? Or standard sans */
}

/* Bonus Letters Configuration */
.breakdown-bonus-row {
    flex-direction: column;
    /* Stack label and tiles */
    align-items: flex-start;
    gap: 8px;
}

.bonus-header {
    display: flex;
    justify-content: space-between;
    width: 100%;
}


.mini-bonus-display {
    display: inline-flex;
    flex-wrap: nowrap;
    justify-content: flex-end;
    gap: 2px;
    width: auto;
    margin: 0 0 0 4px !important;
    vertical-align: middle;
}

.mini-bonus-display span {
    display: inline-flex;
    justify-content: center;
    align-items: center;
    width: 18px;
    height: 18px;
    background: #e0e6ed;
    color: #999;
    font-weight: 700;
    font-size: 10px;
    border-radius: 4px;
    vertical-align: middle;
    position: relative;
    top: -1px;
    /* Subtle lift */
    /* Clean look, no glow */
}

.mini-bonus-display span.got {
    background: #4fc3f7;
    /* Solid cyan/blue */
    color: #fff;
    box-shadow: 0 2px 4px rgba(79, 195, 247, 0.3);
    /* Subtle shadow only */
}

/* Penalty Color */
.breakdown-row.penalty span:last-child {
    color: #e74c3c;
}

.breakdown-divider {
    height: 1px;
    background: rgba(0, 0, 0, 0.1);
    margin: 15px 0;
}

.breakdown-row.total {
    font-size: 20px;
    margin-top: 5px;
}

.breakdown-row.total span:last-child {
    color: #2c3e50;
    font-weight: 800;
}

/* Inputs and Buttons */
.name-input-section {
    display: flex;
    /* Ensure side-by-side */
    gap: 8px;
    margin-bottom: 25px;
}

.name-input-section input {
    background: rgba(255, 255, 255, 0.8);
    border: 1px solid #ccc;
    padding: 10px 15px;
    border-radius: 8px;
    font-size: 16px;
    flex: 1;
}

.name-input-section button {
    background: #4a90e2;
    color: white;
    border: none;
    border-radius: 8px;
    padding: 10px 20px;
    /* Match input padding-top/bottom */
    font-weight: 600;
    cursor: pointer;
    transition: transform 0.1s;
}

.action-buttons {
    display: flex;
    gap: 12px;
}

.action-buttons button {
    flex: 1;
    padding: 12px;
    border-radius: 10px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    border: none;
    transition: transform 0.1s, box-shadow 0.1s;
}

.action-buttons button:active {
    transform: translateY(1px);
}

#share-btn {
    background: linear-gradient(135deg, #4fc3f7, #0288d1);
    color: white;
    box-shadow: 0 4px 10px rgba(2, 136, 209, 0.3);
}

#retry-btn {
    background: white;
    color: #555;
    border: 1px solid #ddd;
}

#retry-btn:hover {
    background: #f8f9fa;
    border-color: #ccc;
}

/* Responsive adjustment for small screens */
@media (max-width: 400px) {
    .modal-content.daily-results {
        padding: 20px;
    }

    .final-score {
        font-size: 42px;
    }
}

/* Leaderboard List */
#leaderboard-container {
    margin-bottom: 20px;
    max-height: 200px;
    overflow-y: auto;
    border: 1px solid #eee;
    border-radius: 6px;
}

/* Leaderboard Styles */
.leaderboard-header,
.leaderboard-row {
    display: grid;
    grid-template-columns: 40px 1fr 40px 40px 60px;
    /* Rank, Name, W, T, Score */
    gap: 10px;
    align-items: center;
    padding: 8px;
    border-bottom: 1px solid rgba(80, 50, 20, 0.2);
    font-size: 14px;
}

.leaderboard-header {
    background-color: rgba(80, 50, 20, 0.1);
    font-weight: 800;
    color: #5a3e2b;
    border-radius: 8px 8px 0 0;
    margin-bottom: 5px;
}

.leaderboard-header .stat {
    text-align: center;
    cursor: help;
}

.leaderboard-header .name {
    text-align: left;
    padding-left: 0;
    /* Align with data */
}

.leaderboard-header .score {
    text-align: right;
}

.leaderboard-row:last-child {
    border-bottom: none;
}

.leaderboard-row .rank {
    font-weight: bold;
    color: #888;
    text-align: center;
}

.leaderboard-row.top-rank .rank {
    color: #d35400;
    /* Bronze/Gold/Silver implicit */
    font-size: 1.1em;
}

.leaderboard-row .name {
    text-align: left;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    font-weight: 700;
    color: #3e2723;
}

.leaderboard-row .stat {
    text-align: center;
    color: #666;
    font-weight: 600;
}

.leaderboard-row .score {
    font-weight: 800;
    color: #27ae60;
    text-align: right;
}

.leaderboard-row.highlight-me {
    background-color: rgba(255, 215, 0, 0.2);
    border-radius: 4px;
    border: 1px solid rgba(255, 215, 0, 0.5);
}

.no-scores {
    padding: 20px;
    color: #999;
    font-style: italic;
}

/* Modal Actions */
.action-buttons {
    display: flex;
    justify-content: center;
    gap: 15px;
}

.share-btn {
    background-color: #2ecc71;
}

.share-btn:hover {
    background-color: #27ae60;
}

.secondary-btn {
    background-color: #95a5a6;
}

.secondary-btn:hover {
    background-color: #7f8c8d;
}

/* Page Header Structure */
.page-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 5px 5px;
    background: transparent;
    width: 100%;
    max-width: 550px;
    margin: 0 auto;
    box-sizing: border-box;
}

.page-header h1 {
    margin: 0;
    font-size: 24px;
    color: #4a90e2;
    text-transform: uppercase;
    font-weight: 800;
}

.left-controls,
.right-controls {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 40px;
    /* Balance spacing */
    justify-content: center;
}

/* Stats Row */
.header-stats {
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100%;
    max-width: 540px;
    margin: 0 auto 8px;
    padding: 0 10px;
    /* Match header padding */
    box-sizing: border-box;
    position: relative;
    height: 30px;
    /* Reserve space */
}

#letters-display,
#score-display {
    font-weight: bold;
    color: #2c3e50;
    font-size: 18px;
    position: static;
    /* Normalize */
    width: auto;
    margin: 0;
    padding: 0;
}

/* Floating Word Display */
#word-display {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    z-index: 100;

    background: rgba(255, 255, 255, 0.9);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);

    padding: 6px 20px;
    min-width: 180px;
    text-align: center;
    border-radius: 12px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);

    font-size: 20px;
    font-weight: 700;
    color: #4a90e2;
    letter-spacing: 1px;
    pointer-events: none;

    transition: all 0.2s ease;
    white-space: nowrap;
}

#word-display:empty {
    display: none;
    opacity: 0;
}

/* Top 5 Words Section in Result Modal */
/* Top 5 Words Section in Result Modal */
.micro-btn {
    background: none;
    border: none;
    color: #4a90e2;
    font-size: 11px;
    cursor: pointer;
    text-decoration: none;
    padding: 2px 5px;
    margin-left: 5px;
    background: rgba(74, 144, 226, 0.1);
    border-radius: 4px;
    display: inline-flex;
    align-items: center;
    gap: 3px;
    vertical-align: middle;
    width: auto;
}

.micro-btn:hover {
    background: rgba(74, 144, 226, 0.2);
    color: #357abd;
}


#toggle-top-words-btn:hover {
    /* Specific hover override if needed, otherwise handled by class */
    color: #357abd;
}

.top-words-list {
    background: rgba(255, 255, 255, 0.5);
    border-radius: 8px;
    padding: 8px;
    margin-bottom: 12px;
}

.top-word-row {
    display: flex;
    justify-content: space-between;
    padding: 4px 6px;
    border-bottom: 1px solid rgba(0, 0, 0, 0.05);
    font-size: 14px;
}

.top-word-row:last-child {
    border-bottom: none;
}

.top-word-row .rank {
    color: #888;
    width: 25px;
}

.top-word-row .word {
    font-weight: bold;
    color: #333;
    flex-grow: 1;
    text-align: left;
}

.top-word-row .score {
    color: #27ae60;
    font-weight: bold;
}