/* --- Spectator / Preview Adjustments --- */
.cb-spectator-mode .hud_button {
    display: none !important;
}

.cb-spectator-mode #game-header {
    gap: 14px !important;
    padding: 0 !important;
    margin-bottom: 0px !important;
    height: 50px !important; 
    justify-content: center !important; 
    width: 100% !important;
}

.cb-spectator-mode #game-header > div:last-child {
    display: none !important;
}

.cb-spectator-mode .fish-timer {
    width: 40px !important;
    height: 40px !important;
}

.cb-spectator-mode #time {
    font-size: 1.17rem !important; 
}

.cb-spectator-mode #time-label {
    font-size: 0.57rem !important;
    margin-top: 0px !important;
}

.cb-spectator-mode #score-container {
    padding: 0px 9px !important;
    height: 32px !important;
    border-radius: 9px !important;
}

.cb-spectator-mode #score, 
.cb-spectator-mode #score-label {
    font-size: 1.17rem !important;
}

.cb-spectator-mode #score-label {
    margin-right: 6px !important;
}

.cb-spectator-mode #canvas-wrapper {
    align-items: center; /* Center the board vertically in the space below the header */
}

.cb-spectator-mode #game-board-area {
    border-radius: 0px !important; /* Remove radius entirely to prevent any corner clipping */
}

.cb-spectator-mode .fish-timer {
    width: 45px;
    height: 45px;
}

.cb-spectator-mode #time {
    font-size: 1.1rem;
}

.cb-spectator-mode #time-label {
    font-size: 0.6rem;
}

.cb-spectator-mode #score-container {
    padding: 4px 12px;
}

.cb-spectator-mode #score, 
.cb-spectator-mode #score-label {
    font-size: 1.1rem;
}

.cb-spectator-mode #score-label {
    margin-right: 5px;
}

/* lollipop.css */
* {
    box-sizing: border-box;
}

html, body {
    width: 100%;
    height: 100%;
    margin: 0;
    padding: 0;
    overflow: hidden;
}

body {
    font-family: 'Bangers', cursive;
    color: #ffdb7e;
    /* Lollipop Card Background */
    background-color: #EE72EC;
    background-image: radial-gradient(circle at 50% 50%, rgba(255,255,255,0.1) 0%, transparent 20%), radial-gradient(circle at 80% 20%, rgba(255,255,255,0.1) 0%, transparent 20%);
    background-size: 100px 100px;
    background-attachment: fixed;
}

.hud_button {
    /* width: 50px; Removed fixed width */
    height: 44px;
    position: relative;
    cursor: pointer;
    filter: drop-shadow(0px 0px 1px black) drop-shadow(1px 1px 1px #111);
    opacity: 0.5;
}

#mute-toggle-btn {
    width: 45px; /* Slimmer size */
}

.hud_button_visual {
    width: 100%;
    height: 100%;
    border-radius: 20px;
    background: rgb(255 255 255);
    /* box-shadow: inset 0 1px 2px rgba(255, 255, 255, 0.3), 0 2px 4px rgba(0, 0, 0, 0.1); */
    /* backdrop-filter: blur(5px); */
    position: relative; 
    overflow: hidden; 
    
    /* Create the transparent cutout using a mask */
    mask-image:url("/img/musicnote.svg"),
        linear-gradient(black, black);

    /* Composite: Cut the note OUT of the gradient */
    mask-composite: exclude;
    -webkit-mask-composite: destination-out; /* Webkit support */

    mask-repeat: no-repeat;
    mask-position: 40% center; /* Centered */
    mask-size: 30px, 100%; /* Smaller icon for slimmer button */
    -webkit-mask-repeat: no-repeat;
    -webkit-mask-position: 40% center;
    -webkit-mask-size: 30px, 100%;
}



/* Red Cross SVG Overlay */
.mute-cross {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 10;
    opacity: 0;
    transition: opacity 0.1s;
    filter: drop-shadow(0px 0px 1px black);
}

.mute-cross .cross-line {
    fill: none;
    stroke: #ff0000;
    stroke-width: 25;
    stroke-linecap: round;
    stroke-linejoin: round;
    stroke-dasharray: 100; /* Approximate length of the line */
    stroke-dashoffset: 100; /* Initially hidden */
}

/* Trigger Animation when Muted */
.hud_button.muted .mute-cross {
    opacity: 1;
}

.hud_button.muted .line1 {
    animation: drawLine 0.15s ease-out forwards;
}

.hud_button.muted .line2 {
    animation: drawLine 0.15s ease-out 0.15s forwards; /* Starts after line1 */
}

@keyframes drawLine {
    to { stroke-dashoffset: 0; }
}

/* Cleanup old classes */
.hud_button_bg, .hud-icon {
    display: none; 
}


@keyframes rotateBackground {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.gradientAnimatedBackground {
    /* Merged into body or kept for structure */
    display: none; /* Hide the old one */
}

@media (min-width: 800px) {
    .gradientAnimatedBackground {
        --size: 80vw;
    }
}

#game-container {
    display: flex;
    flex-direction: column;
    height: 100dvh;
    width: 100vw;
    max-width: 100%;
    margin: 0 auto;
    position: relative;
    background-size: cover;
    overflow: hidden;
}

/* Ensure canvas wrapper takes available space */
#canvas-wrapper {
    position: relative;
    display: flex;
    justify-content: center;
    align-items: flex-start;
    flex-grow: 1;
    width: 100%;
    height: 100%;
    overflow: visible; /* Allow effects to spill out if needed, though canvas size constrains */
}

/* Streak Background Fill Animation Layer */
#streak-background-fill {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 0%; /* Animated via JS */
    /* Golden gradient, fading from bottom */
    background: linear-gradient(to top, 
        rgba(255, 215, 0, 0.6) 0%, 
        rgba(255, 215, 0, 0.3) 100%);
    
    /* CSS Transition for Elastic Effect */
    transition: height 0.6s cubic-bezier(0.175, 0.885, 0.32, 1.6);
    
    pointer-events: none;
    z-index: 1; /* Behind canvas */
}

#game-canvas {
    position: relative;
    z-index: 10; /* Above background fill */
    touch-action: none;
    /* Box shadow moved to container */
}

/* Max Streak Bonus Animation Layer */
#bonus-drop-bar {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 0%; /* JS Controlled */
    background: linear-gradient(to top, 
        rgba(255, 215, 0, 0.8) 0%, 
        rgba(255, 215, 0, 0.5) 100%); /* Slightly brighter than normal fill */
    pointer-events: none;
    z-index: 2; /* Above normal streak fill */
    display: none;
}

#bonus-drop-text {
    position: absolute;
    left: 50%;
    transform: translate(-50%, -100%); /* Centered horizontally, sitting above the point */
    color: #fff;
    font-family: 'Bangers', cursive;
    font-size: 3rem;
    text-shadow: 2px 2px 0 #cb1da1, -1px -1px 0 #cb1da1, 1px -1px 0 #cb1da1, -1px 1px 0 #cb1da1, 1px 1px 0 #cb1da1;
    pointer-events: none;
    z-index: 20; /* Above game canvas (10) */
    display: none;
    white-space: nowrap;
}

/* --- Header: Timer & Score (Word Game Style) --- */
#game-header {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 20px;
    /* Width will be set by JS to match canvas */
    margin: 0 auto 10px auto; 
    padding: 10px 0;
    box-sizing: border-box;
    z-index: 10;
    flex-shrink: 0; 
}

@media (max-width: 800px) {
    #game-header {
        width: 100% !important;
        justify-content: space-between !important;
        padding: 10px 15px !important;
    }
    #time {
        font-size: 1.8rem !important;
    }
    #time-label {
        font-size: 1rem !important;
    }
    #score, #score-label {
        font-size: 1.8rem !important;
    }
    .modal-content {
        width: 90%;
        padding: 20px;
    }
    .modal-content h2 {
        font-size: 2.5rem;
    }
    .modal-content p {
        font-size: 1.5rem;
    }
    .stats-grid {
        gap: 5px !important;
        width: 100% !important;
    }
    .stats-grid .big-stat {
        font-size: 1.8rem !important;
    }
}

/* --- CIRCULAR TIMER STYLES --- */
.fish-timer {
    position: relative;
    width: 60px; /* Reduced size */
    height: 60px; /* Reduced size */
    display: flex;
    align-items: center;
    justify-content: center;
}

.timer-wrapper {
    position: absolute;
    width: 100%;
    height: 100%;
    top: 0;
    left: 0;
}

.timer-svg {
    width: 100%;
    height: 100%;
    transform: rotate(-90deg); /* Start at 12 o'clock */
    overflow: visible; 
    viewBox: "0 0 60 60"; /* Adjusted viewBox for new size */
}

.timer-track {
    fill: none;
    stroke: rgba(0, 0, 0, 0.2);
    stroke-width: 10; /* Changed stroke width to 10px */
    cx="30"; 
    cy="30"; 
    r="25"; /* Adjusted radius (30 - 10/2) */
}

.timer-progress {
    fill: none;
    stroke: #cb1da1; /* New stroke color */
    stroke-width: 14; /* Adjusted stroke width */
    stroke-linecap: round; 
    stroke-dasharray: 100; 
    stroke-dashoffset: 0; 
    transition: stroke-dashoffset 0.1s linear;
    cx="30"; 
    cy="30"; 
    r="23"; /* Adjusted radius (30 - 14/2) */
}
/* Inner Text - Reverted Look & Feel */
.timer-text {
    position: relative;
    z-index: 2;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    line-height: 1;
}

#time {
    font-size: 1.5rem;
    font-weight: 700;
    color: #ffffff;
    text-shadow: 1px 1px 1px #444;
    margin: 0;
    line-height: 0.7;
}

#time-label {
    font-size: 0.9rem; /* Slightly smaller to fit circle better, but style matches */
    color: #fff;
    font-weight: bold;
    margin-top: 2px;
}

/* Pulsing Animation for Low Time */
.fish-timer.pulsing .timer-wrapper {
    animation: pulseTimer 1s infinite;
}

@keyframes pulseTimer {
    0% { transform: scale(1); }
    50% { transform: scale(1.1); }
    100% { transform: scale(1); }
}

/* --- End Circular Timer --- */

#score-container {
    display: flex;
    align-items: center;
    background-color: rgba(0, 0, 0, 0.2);
    padding: 8px 16px;
    border-radius: 20px;
    backdrop-filter: blur(5px);
}

#score {
    font-size: 1.5rem;
    font-weight: 700;
    margin-right: 8px;
    color: #ffd700;
    text-shadow: 1px 1px 0 #000;
}

#score-label {
    font-size: 1.5rem; /* Matched to score value */
    color: #fff;
    margin-right: 10px;
    font-weight: bold;
}

#mute-btn {
    background: transparent;
    box-shadow: none;
    padding: 0;
    width: 30px;
    height: 30px;
    font-size: 1.2rem;
    margin-left: 5px;
    border: 1px solid rgba(255,255,255,0.3);
}

#mute-btn:active {
    transform: scale(0.9);
}

/* --- Buttons --- */
button {
    background: #ff5e78;
    border: none;
    padding: 8px 16px;
    border-radius: 20px;
    color: white;
    font-family: 'Bangers', cursive;
    cursor: pointer;
    font-size: 1.2rem;
    transition: transform 0.1s;
    box-shadow: 0 4px 0 #831843;
    text-shadow: 1px 1px 0 #000;
    letter-spacing: 1px;
}

button:active {
    transform: translateY(4px);
    box-shadow: 0 0 0 #831843;
}

.icon-btn {
    width: 40px;
    height: 40px;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
    border-radius: 50%;
}

#game-canvas {
    border-radius: 10px;
    touch-action: none; 
    box-shadow: 0 10px 30px rgba(0,0,0,0.3);
    /* Margins handled by flex wrapper */
}

.modal-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    /* background: rgba(0,0,0,0.7); Removed as requested */
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 20;
}

.modal-content {
    background: white;
    padding: 40px;
    border-radius: 30px;
    text-align: center;
    box-shadow: 0 10px 40px rgba(0,0,0,0.3);
    animation: popIn 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    width: auto;
    max-width: 90%;
    box-sizing: border-box;
    font-family: 'Bangers', cursive;
}

.modal-content h2 {
    color: #ff5e78;
    font-size: 3.5rem;
    margin: 0 0 20px 0;
    text-shadow: 2px 2px 0 #000;
}

.modal-content p {
    font-size: 2rem;
    color: #555;
    margin-bottom: 30px;
}

.hidden {
    display: none !important;
}

@keyframes popIn {
    from { transform: scale(0.5); opacity: 0; }
    to { transform: scale(1); opacity: 1; }
}

/* New styles for menu button text */
#menu-open-btn {
    width: 80px;
    font-family: 'Bangers', cursive; /* Inherited by SVG text */
    background: transparent;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
}

.setting-row {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    margin-bottom: 20px;
    font-size: 1.5rem;
    color: #555;
    text-align: left;
}
.setting-row label {
    margin-bottom: 5px;
    font-size: 1.2rem;
}
.slider {
    -webkit-appearance: none;
    width: 100%;
    height: 15px;
    border-radius: 5px;
    background: #e0e0e0;
    outline: none;
    opacity: 0.9;
    transition: .2s;
}
.slider:hover { opacity: 1; }
.slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 25px;
    height: 25px;
    border-radius: 50%;
    background: #ff5e78;
    cursor: pointer;
    box-shadow: 0 2px 5px rgba(0,0,0,0.2);
}
.slider::-moz-range-thumb {
    width: 25px;
    height: 25px;
    border-radius: 50%;
    background: #ff5e78;
    cursor: pointer;
    box-shadow: 0 2px 5px rgba(0,0,0,0.2);
}
.menu-buttons {
    display: flex;
    flex-direction: column;
    gap: 15px;
    margin-top: 20px;
}
.menu-buttons button {
    width: 100%;
}
.close-btn {
    background: #ccc;
    box-shadow: 0 4px 0 #999;
    color: #333;
}
.close-btn:active {
    box-shadow: 0 0 0 #999;
}

/* Confetti */
.confetti { position: absolute; width: 8px; height: 10px; z-index: 10000; pointer-events: none; border-radius: 2px; box-shadow: 0 2px 5px rgba(0,0,0,0.2); }

#scoreboard-timer-wrapper { margin-top: 10px; text-align: center; }
#scoreboard-timer-container {
    display: inline-block;
    background: rgba(0,0,0,0.3);
    padding: 5px 15px;
    border-radius: 20px;
    color: white;
}
#scoreboard-timer-element {
    font-family: monospace;
    font-weight: bold;
    font-size: 1.2rem;
}

.hall-slide h2 {
    color: #cb1da1;
    font-size: 2.5rem;
    margin: 0px 10px 10px 10px;
    text-shadow: 1px 1px 0 #000;
}

.stat-box {
    background: #f0f0f0;
    padding: 15px;
    border-radius: 15px;
    width: 80%;
    margin-bottom: 15px;
}

/* Chat Bubble Padding Reduction */
.chat-message .bubble-content {
    background: #e0e0e0;
    padding: 4px 10px; /* Reduced top/bottom padding */
    border-radius: 15px;
    border-bottom-left-radius: 2px;
    position: relative;
    font-family: sans-serif;
}

.stat-box p {
    font-size: 1.5rem;
    color: #555;
    margin: 0;
}

.big-stat {
    font-size: 4rem;
    color: #FFD700;
    font-weight: bold;
    text-shadow: 2px 2px 0 #000;
    display: block;
    margin-top: 10px;
}

#hall-leaderboard-list {
    list-style: none;
    padding: 0;
    width: 100%;
    text-align: left;
    max-height: 250px;
    overflow-y: auto;
}

#hall-leaderboard-list li {
    background: #eee;
    margin: 5px 0;
    padding: 10px 15px;
    border-radius: 10px;
    display: flex;
    justify-content: space-between;
    font-size: 1.2rem;
    color: #333;
}

#hall-leaderboard-list li:nth-child(1) { background: #FFD700; color: white; text-shadow: 1px 1px 0 #000; }
#hall-leaderboard-list li:nth-child(2) { background: #C0C0C0; color: white; text-shadow: 1px 1px 0 #000; }
#hall-leaderboard-list li:nth-child(3) { background: #CD7F32; color: white; text-shadow: 1px 1px 0 #000; }

/* Shoutout Area */
.hall-shoutout-area {
    position: absolute;
    bottom: 15px; 
    left: 0;
    width: 100%;
    padding: 15px;
    background: rgba(255,255,255,0.95);
    border-top: 2px solid #eee;
    z-index: 10;
    box-sizing: border-box;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

#shoutout-display {
    height: 35px;
    /* line-height: 35px; */
    color: #cb1da1;
    font-size: 1.4rem;
    /* text-align: center; */
    /* white-space: nowrap; */
    /* overflow: hidden; */
    text-overflow: ellipsis;
    animation: bounceIn 0.5s;
}

.shoutout-controls {
    display: flex;
    gap: 10px;
}

#shoutout-input {
    flex-grow: 1;
    padding: 8px 15px;
    border: 2px solid #ddd;
    border-radius: 20px;
    font-family: 'Bangers', cursive;
    font-size: 1.2rem;
    outline: none;
    color: #333;
}

#shoutout-input:focus {
    border-color: #cb1da1;
}

#shoutout-btn {
    width: 50px;
    padding: 0;
    font-size: 1.5rem;
    background: #cb1da1;
    box-shadow: 0 4px 0 #8e1572;
}

#hall-fun-stat {
    margin-top: 20px;
    font-size: 1.8rem;
    color: #ff5e78;
    text-shadow: 1px 1px 0 #000;
    transform: rotate(-2deg);
    min-height: 1.8rem;
}

@keyframes bounceIn {
    0% { transform: scale(0.5); opacity: 0; }
    60% { transform: scale(1.1); }
    100% { transform: scale(1); opacity: 1; }
}

/* Timer Bar */
.timer-bar {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 10px;
    background: #ddd;
}

.timer-bar .fill {
    height: 100%;
    background: #ff5e78;
    width: 100%;
    transform-origin: left;
    /* Animation will be applied via JS style injection for precise duration */
}

@keyframes timerDeplete {
    from { transform: scaleX(1); }
    to { transform: scaleX(0); }
}

/* --- New Stats Grid --- */
.stats-grid {
    display: flex;
    gap: 15px;
    width: 90%;
    margin-top: 20px;
    justify-content: center;
}

.stats-grid .stat-box {
    width: 33%;
    padding: 15px 5px;
    margin-bottom: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    background: #f8f8f8;
}

.stats-grid .big-stat {
    font-size: 2.5rem; /* Smaller to fit 3 */
}

/* --- Messenger Style Chat --- */
.hall-chat-section {
    position: relative;
    width: 100%;
    flex: 1; /* Take remaining height */
    min-height: 250px; /* Ensure minimum usable chat space */
    padding: 10px;
    background: #f9f9f9;
    border-top: 2px solid #eee;
    z-index: 10;
    box-sizing: border-box;
    display: flex;
    flex-direction: column;
    border-radius: 0 0 30px 30px;
}

.chat-messages {
    flex-grow: 1;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding: 5px;
    margin-bottom: 8px;
    background: white;
    border-radius: 10px;
    border: 1px solid #eee;
}

.chat-message {
    display: flex;
    align-items: flex-end;
    gap: 8px;
    max-width: 80%;
}

.chat-message.own {
    align-self: flex-end;
    flex-direction: row-reverse;
}

.chat-message.other {
    align-self: flex-start;
}

.chat-message .avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: #ddd;
    border: 2px solid white;
    box-shadow: 0 2px 2px rgba(0,0,0,0.1);
}

.chat-message .bubble-content {
    background: #e0e0e0;
    padding: 8px 12px;
    border-radius: 15px;
    border-bottom-left-radius: 2px;
    position: relative;
    font-family: sans-serif; /* Cleaner font for chat */
}

.chat-message.own .bubble-content {
    background: #cb1da1;
    color: white;
    border-bottom-left-radius: 15px;
    border-bottom-right-radius: 2px;
}

.chat-message .sender {
    font-size: 0.7rem;
    color: #666;
    margin-bottom: 2px;
    font-weight: bold;
}

.chat-message.own .sender {
    display: none; /* Hide sender name for own messages */
}

.chat-message .text {
    font-size: 0.9rem;
    line-height: 1.2;
}

/* Adjust Leaderboard List to look better with details */
#hall-leaderboard-list li {
    align-items: center;
}
#hall-leaderboard-list .rank {
    font-weight: bold;
    font-size: 1.5rem;
    width: 30px;
}
#hall-leaderboard-list .player-info {
    flex-grow: 1;
    text-align: left;
    display: flex;
    flex-direction: column;
    padding-left: 10px;
}
#hall-leaderboard-list .name {
    font-size: 1.6rem;
    line-height: 1;
}
#hall-leaderboard-list .details {
    font-size: 1rem;
    opacity: 0.8;
}
#hall-leaderboard-list .score {
    font-size: 1.5rem;
    font-weight: bold;
}

/* --- Scoreboard Countdown Timer (Copied from Word Blast) --- */
#scoreboard-timer-wrapper {
    position: relative;
    top: 0; 
    left: 0;
    width: 100%;
    display: flex;
    justify-content: center;
    transition: opacity 0.5s ease-in-out;
    z-index: 20; 
    pointer-events: none;
    margin-bottom: 10px;
}

@media (max-height: 700px) {
    .hall-slides-wrapper {
        flex: 0 0 250px !important; /* Force a smaller top section on short screens */
    }
    .hall-chat-section {
        min-height: 150px !important; /* Allow chat to shrink more */
    }
}


#scoreboard-timer-container {
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.1rem;
    font-weight: 700;
    color: white; /* White text */
    text-shadow: 1px 1px 2px rgba(0,0,0,0.5); /* Shadow for contrast */
}

.next-round-text { 
    margin-right: 10px;
    color: white;
    text-shadow: 1px 1px 2px rgba(0,0,0,0.5);
}

#new-timer-clone {
    display: flex;
    align-items: center;
    background-color: rgb(255 255 255 / 20%);
    padding: 6px 12px;
    border-radius: 20px;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
}

#scoreboard-timer-element {
    font-size: 1.2rem;
    font-weight: 700;
    margin-left: 8px;
    color: white;
}

#timer-icon {
    font-size: 1.2rem;
}

@keyframes explodeClock {
    0% { transform: scale(1); opacity: 1; }
    50% { transform: scale(1.5) rotate(10deg); opacity: 0.5; }
    100% { transform: scale(2) rotate(-10deg); opacity: 0; }
}

.exploded {
    animation: explodeClock 0.6s cubic-bezier(0.25, 0.46, 0.45, 0.94) forwards;
    pointer-events: none;
}

/* --- Tournament Lobby Styles --- */
.tournament-lobby-container {
    width: 95%;
    max-width: 800px;
    height: 90vh;
    max-height: 800px;
    background: white;
    border-radius: 30px;
    box-shadow: 0 20px 50px rgba(0,0,0,0.5);
    display: flex;
    flex-direction: column;
    color: #333;
    font-family: sans-serif;
    padding: 20px;
    box-sizing: border-box;
    position: relative;
}

#tournament-lobby-timer-wrapper {
    position: absolute;
    top: -25px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 2;
}

.tournament-lobby-header {
    display: flex;
    align-items: center;
    gap: 20px;
    padding-bottom: 15px;
    border-bottom: 2px solid #f0f0f0;
    text-align: left;
}

.tournament-lobby-header img {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    object-fit: cover;
    box-shadow: 0 4px 10px rgba(0,0,0,0.2);
}

.tournament-lobby-header .header-text h2 {
    margin: 0;
    font-family: 'Bangers', cursive;
    font-size: 2.2rem;
    color: #cb1da1;
    text-shadow: 1px 1px 0 #000;
}
.tournament-lobby-header .header-text p {
    margin: 0;
    font-size: 1rem;
    color: #555;
}

.tournament-lobby-body {
    flex-grow: 1;
    display: flex;
    flex-direction: column; /* Stack vertically */
    gap: 20px;
    padding: 15px 0;
    overflow: hidden;
}

.participant-list-container {
    flex: 0 0 auto; /* Don't grow, size to content */
    display: flex;
    flex-direction: column;
    background: #f9f9f9;
    border-radius: 10px;
    padding: 15px;
    box-sizing: border-box;
}

.tournament-chat-container {
    flex: 1; /* Take up remaining space */
    display: flex;
    flex-direction: column;
    background: #f9f9f9;
    border-radius: 10px;
    padding: 15px;
    box-sizing: border-box;
    overflow: hidden;
}

.participant-list-container h3, .tournament-chat-container h3 {
    margin: 0 0 10px 0;
    font-family: 'Bangers', cursive;
    text-align: center;
    font-size: 1.5rem;
    color: #555;
}

#tournament-participant-list {
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex; /* Use flex for horizontal list */
    flex-wrap: wrap;
    justify-content: center;
    gap: 10px;
    max-height: 120px;
    overflow-y: auto;
}

#tournament-participant-list li {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 5px 10px;
    background: #fff;
    border-radius: 20px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}
#tournament-participant-list li img {
    width: 30px;
    height: 30px;
    border-radius: 50%;
}

.tournament-lobby-footer {
    padding-top: 15px;
    border-top: 2px solid #f0f0f0;
    text-align: center;
}

#unjoin-tournament-btn {
    background: #e74c3c;
    box-shadow: 0 4px 0 #c0392b;
    padding: 10px 30px;
}
#unjoin-tournament-btn:active {
    box-shadow: 0 0 0 #c0392b;
}

/* Re-use chat styles */
#tournament-chat-messages {
    flex-grow: 1;
    overflow-y: auto;
    background: white;
    border-radius: 5px;
    padding: 5px;
    margin-bottom: 10px;
}
#tournament-chat-container .shoutout-controls {
    display: flex;
    gap: 10px;
}
#tournament-chat-container input {
    flex-grow: 1;
    border-radius: 15px;
    border: 1px solid #ddd;
    padding: 8px 12px;
    font-family: sans-serif;
}
#tournament-chat-container button {
    padding: 8px 15px;
}

/* --- Tournament Tree Styles (Survivors vs Eliminated) --- */
.tree-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    width: 100%;
    margin-top: 20px;
}

.tree-node-round {
    background: #cb1da1;
    color: white;
    padding: 10px 25px;
    border-radius: 25px;
    font-size: 1.5rem;
    font-family: 'Bangers', cursive;
    position: relative;
    margin-bottom: 30px; /* Space for lines */
    box-shadow: 0 4px 0 #8e1572;
    z-index: 2;
}

/* Vertical line down from Round */
.tree-node-round::after {
    content: '';
    position: absolute;
    bottom: -30px;
    left: 50%;
    width: 4px;
    height: 30px;
    background: #ccc;
    transform: translateX(-50%);
    z-index: 1;
}

.tree-branches {
    display: flex;
    justify-content: center;
    /* gap removed to ensure 25%/75% centering logic holds */
    width: 100%;
    position: relative;
}

/* The horizontal bar will be drawn by the container using a trick */
.tree-connector-bar {
    position: absolute;
    top: 0;
    left: 25%; /* Connects mid-left to mid-right roughly */
    right: 25%;
    height: 4px;
    background: #ccc;
    transform: translateY(-2px); /* Center on line */
}

.tree-branch {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    position: relative;
    padding-top: 20px; /* Space for vertical line up */
    padding-left: 10px;
    padding-right: 10px;
}

/* Vertical line UP from branch */
.tree-branch::before {
    content: '';
    position: absolute;
    top: 0;
    left: 50%;
    width: 4px;
    height: 20px;
    background: #ccc;
    transform: translateX(-50%);
}

.branch-label {
    font-family: 'Bangers', cursive;
    font-size: 1.2rem;
    color: #555;
    margin-bottom: 10px;
    text-transform: uppercase;
}

.branch-label.survivors { color: #27ae60; }
.branch-label.eliminated { color: #e74c3c; }

.player-list {
    display: flex;
    flex-wrap: wrap;
    gap: 5px;
    justify-content: center;
}

.player-node {
    padding: 5px 10px;
    border-radius: 15px;
    font-size: 0.9rem;
    font-family: sans-serif;
    color: white;
    box-shadow: 0 2px 0 rgba(0,0,0,0.1);
    white-space: nowrap;
}

.player-node.survivor { background: #27ae60; }
.player-node.eliminated { background: #e74c3c; opacity: 0.8; }

/* --- Bracket Tournament Tree Styles --- */
.bracket-wrapper {
    display: flex;
    flex-direction: row;
    overflow-x: auto;
    padding: 40px 20px;
    font-family: 'Bangers', cursive;
    width: 100%;
}

.bracket-round {
    display: flex;
    flex-direction: column;
    justify-content: space-around;
    min-width: 180px;
    margin-right: 40px;
    position: relative;
}

.bracket-round:last-child {
    margin-right: 0;
}

.bracket-round-title {
    text-align: center;
    color: #cb1da1;
    font-size: 1.2rem;
    margin-bottom: 10px;
    position: absolute;
    top: -30px;
    width: 100%;
}

.bracket-match {
    background: white;
    border: 2px solid #ddd;
    border-radius: 10px;
    padding: 5px;
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
    position: relative;
    width: 100%;
    box-sizing: border-box;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.bracket-match.active {
    border-color: #cb1da1;
    box-shadow: 0 0 10px rgba(203, 29, 161, 0.3);
}

.bracket-participant {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 3px 8px;
    border-radius: 5px;
    background: #f9f9f9;
    font-size: 0.9rem;
    color: #555;
}

.bracket-participant.winner {
    background: #cb1da1;
    color: white;
    font-weight: bold;
}

.bracket-participant.loser {
    opacity: 0.5;
    text-decoration: line-through;
}

.bracket-participant .score {
    font-family: sans-serif;
    font-weight: bold;
    margin-left: 5px;
}

.match-wrapper {
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: center;
    position: relative;
    width: 100%;
}

/* Connectors */
.bracket-round:not(:last-child) .match-wrapper.odd::after {
    content: '';
    position: absolute;
    right: -20px; 
    bottom: -2px; 
    height: 50%;
    width: 20px;
    border-right: 2px solid #ccc;
    border-top: 2px solid #ccc;
    border-top-right-radius: 10px;
    top: 50%;
}

.bracket-round:not(:last-child) .match-wrapper.even::after {
    content: '';
    position: absolute;
    right: -20px;
    top: -2px; 
    height: 50%;
    width: 20px;
    border-right: 2px solid #ccc;
    border-bottom: 2px solid #ccc;
    border-bottom-right-radius: 10px;
    bottom: 50%;
}

.bracket-round:not(:first-child) .match-wrapper::before {
    content: '';
    position: absolute;
    left: -20px;
    top: 50%;
    width: 20px;
    height: 2px;
    background: #ccc;
}
