@import url('https://fonts.googleapis.com/css2?family=Bangers&family=Roboto:wght@400;700&display=swap');

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Roboto', sans-serif;
    background-color: #b8926a;
    color: #3a2313;
    line-height: 1.6;
    background-image: url("data:image/svg+xml,%3Csvg width='100' height='100' viewBox='0 0 100 100' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M11 18c3.866 0 7-3.134 7-7s-3.134-7-7-7-7 3.134-7 7 3.134 7 7 7zm48 25c3.866 0 7-3.134 7-7s-3.134-7-7-7-7 3.134-7 7 3.134 7 7 7zm-43-7c1.657 0 3-1.343 3-3s-1.343-3-3-3-3 1.343-3 3 1.343 3 3 3zm63 31c1.657 0 3-1.343 3-3s-1.343-3-3-3-3 1.343-3 3 1.343 3 3 3zM34 90c1.657 0 3-1.343 3-3s-1.343-3-3-3-3 1.343-3 3 1.343 3 3 3zm56-76c1.657 0 3-1.343 3-3s-1.343-3-3-3-3 1.343-3 3 1.343 3 3 3zM12 86c2.21 0 4-1.79 4-4s-1.79-4-4-4-4 1.79-4 4 1.79 4 4 4zm28-65c2.21 0 4-1.79 4-4s-1.79-4-4-4-4 1.79-4 4 1.79 4 4 4zm23-11c2.76 0 5-2.24 5-5s-2.24-5-5-5-5 2.24-5 5 2.24 5 5 5zm-6 60c2.21 0 4-1.79 4-4s-1.79-4-4-4-4 1.79-4 4 1.79 4 4 4zm29 22c2.76 0 5-2.24 5-5s-2.24-5-5-5-5 2.24-5 5 2.24 5 5 5zM32 63c2.76 0 5-2.24 5-5s-2.24-5-5-5-5 2.24-5 5 2.24 5 5 5zm57-13c2.76 0 5-2.24 5-5s-2.24-5-5-5-5 2.24-5 5 2.24 5 5 5zm-9-21c1.105 0 2-.895 2-2s-.895-2-2-2-2 .895-2 2 .895 2 2 2zM60 91c1.105 0 2-.895 2-2s-.895-2-2-2-2 .895-2 2 .895 2 2 2zM35 41c1.105 0 2-.895 2-2s-.895-2-2-2-2 .895-2 2 .895 2 2 2zM12 60c1.105 0 2-.895 2-2s-.895-2-2-2-2 .895-2 2 .895 2 2 2z' fill='%239C92AC' fill-opacity='0.08' fill-rule='evenodd'/%3E%3C/svg%3E");
    transition: background-color 0.5s, color 0.5s;
    padding-bottom: 30px; /* Add padding to bottom of page */
}

/* Rhyme Mode Styles */
body.rhyme-mode {
    background-color: #5b8bb2;
    color: #033b73;
    background-image: url("data:image/svg+xml,%3Csvg width='100' height='100' viewBox='0 0 100 100' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M11 18c3.866 0 7-3.134 7-7s-3.134-7-7-7-7 3.134-7 7 3.134 7 7 7zm48 25c3.866 0 7-3.134 7-7s-3.134-7-7-7-7 3.134-7 7 3.134 7 7 7zm-43-7c1.657 0 3-1.343 3-3s-1.343-3-3-3-3 1.343-3 3 1.343 3 3 3zm63 31c1.657 0 3-1.343 3-3s-1.343-3-3-3-3 1.343-3 3 1.343 3 3 3zM34 90c1.657 0 3-1.343 3-3s-1.343-3-3-3-3 1.343-3 3 1.343 3 3 3zm56-76c1.657 0 3-1.343 3-3s-1.343-3-3-3-3 1.343-3 3 1.343 3 3 3zM12 86c2.21 0 4-1.79 4-4s-1.79-4-4-4-4 1.79-4 4 1.79 4 4 4zm28-65c2.21 0 4-1.79 4-4s-1.79-4-4-4-4 1.79-4 4 1.79 4 4 4zm23-11c2.76 0 5-2.24 5-5s-2.24-5-5-5-5 2.24-5 5 2.24 5 5 5zm-6 60c2.21 0 4-1.79 4-4s-1.79-4-4-4-4 1.79-4 4 1.79 4 4 4zm29 22c2.76 0 5-2.24 5-5s-2.24-5-5-5-5 2.24-5 5 2.24 5 5 5zM32 63c2.76 0 5-2.24 5-5s-2.24-5-5-5-5 2.24-5 5 2.24 5 5 5zm57-13c2.76 0 5-2.24 5-5s-2.24-5-5-5-5 2.24-5 5 2.24 5 5 5zm-9-21c1.105 0 2-.895 2-2s-.895-2-2-2-2 .895-2 2 .895 2 2 2zM60 91c1.105 0 2-.895 2-2s-.895-2-2-2-2 .895-2 2 .895 2 2 2zM35 41c1.105 0 2-.895 2-2s-.895-2-2-2-2 .895-2 2 .895 2 2 2zM12 60c1.105 0 2-.895 2-2s-.895-2-2-2-2 .895-2 2 .895 2 2 2z' fill='%236AA0D5' fill-opacity='0.1' fill-rule='evenodd'/%3E%3C/svg%3E");
}

.container {
    max-width: 1200px; /* Increased from 800px to allow more space */
    margin: 0 auto;
    padding: 20px;
}

header {
    text-align: center;
    margin-bottom: 40px; /* Increased from 30px for more spacing */
}

h1 {
    font-family: 'Bangers', cursive;
    font-size: 4rem;
    color: #822d00;
    text-shadow: 3px 3px 0 #000;
    letter-spacing: 2px;
    transition: color 0.5s, text-shadow 0.5s;
    margin-bottom: 15px; /* Added space below title */
}

body.rhyme-mode h1 {
    color: #0056a3;
    text-shadow: 3px 3px 0 #002d5a;
}

.subtitle {
    font-size: 1.2rem;
    font-weight: bold;
    margin-bottom: 25px; /* Increased from 15px */
    transition: color 0.5s;
}

body.rhyme-mode .subtitle {
    color: #033b73;
}

.audio-controls {
    margin: 15px 0 25px; /* Increased from 10px 0 */
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 10px; /* Added gap between buttons */
}

.caveman-button {
    background-color: #5c3c1d;
    color: #f3d9b1;
    border: none;
    padding: 10px 18px; /* Increased from 8px 15px */
    border-radius: 30px;
    cursor: pointer;
    font-weight: bold;
    border: 2px solid #3a2313;
    transition: all 0.3s;
    margin: 0 5px 8px; /* Added bottom margin for better spacing when wrapped */
}

.caveman-button:hover {
    background-color: #3a2313;
}

body.rhyme-mode .caveman-button {
    background-color: #0056a3;
    color: #d4e8ff;
    border: 2px solid #033b73;
}

body.rhyme-mode .caveman-button:hover {
    background-color: #033b73;
}

.rhyme-button {
    background-color: #5c3c1d;
    transition: background-color 0.3s, color 0.3s, border-color 0.3s;
}

body.rhyme-mode .rhyme-button {
    background-color: #0070d7;
    border-color: #0056a3;
}

.music-off {
    display: block;
}

.music-on {
    display: none;
}

body.music-playing .music-off {
    display: none;
}

body.music-playing .music-on {
    display: block;
}

.main-content-wrapper {
    display: flex;
    gap: 30px; /* Increased from 20px */
    align-items: flex-start;
    justify-content: center; /* Center content */
    margin-top: 30px; /* Added top margin */
}

.content {
    background-color: #e8d0aa;
    border-radius: 15px;
    padding: 25px; /* Increased from 20px */
    box-shadow: 0 5px 15px rgba(0,0,0,0.2);
    border: 8px solid #8B5A2B;
    position: relative;
    transition: background-color 0.5s, border-color 0.5s, box-shadow 0.5s;
    width: 100%; /* Make sure it uses available space */
    max-width: 800px; /* Limit maximum width */
}

body.rhyme-mode .content {
    background-color: #d4e8ff;
    border: 8px solid #0056a3;
    box-shadow: 0 5px 15px rgba(0,43,90,0.3);
}

.content::before {
    content: '';
    position: absolute;
    top: -3px;
    left: -3px;
    right: -3px;
    bottom: -3px;
    border: 3px dashed #5c3c1d;
    border-radius: 15px;
    pointer-events: none;
    transition: border-color 0.5s;
}

body.rhyme-mode .content::before {
    border: 3px dashed #0056a3;
}

.grug-container {
    position: relative;
    display: flex;
    justify-content: center;
    margin-bottom: 40px; /* Increased from 30px */
    min-height: 300px; /* Added minimum height to prevent layout shifts */
}

.grug-image {
    max-width: 300px;
    transition: transform 0.3s ease;
}

.grug-image.shake {
    animation: shake 0.5s ease-in-out;
}

.grug-image.shake-rhythm {
    animation: shakeRhythm 0.8s ease-in-out;
}

.grug-image.victorious {
    animation: victorious 1s ease-in-out;
}

@keyframes shake {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-10px) rotate(-5deg); }
    50% { transform: translateX(10px) rotate(5deg); }
    75% { transform: translateX(-10px) rotate(-5deg); }
}

@keyframes shakeRhythm {
    0%, 100% { transform: translateX(0) rotate(0); }
    10% { transform: translateX(-10px) rotate(-3deg); }
    20% { transform: translateX(10px) rotate(3deg); }
    30% { transform: translateX(-10px) rotate(-3deg); }
    40% { transform: translateX(10px) rotate(3deg); }
    50% { transform: translateX(-10px) rotate(-3deg); }
    60% { transform: translateX(10px) rotate(3deg); }
    70% { transform: translateX(-10px) rotate(-3deg); }
    80% { transform: translateX(10px) rotate(3deg); }
    90% { transform: translateX(-5px) rotate(-1deg); }
}

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

.speech-bubble {
    position: absolute;
    top: 20px;
    right: 50px;
    background-color: #f9e7c9;
    border-radius: 20px;
    padding: 18px; /* Increased from 15px */
    max-width: 300px; /* Increased from 250px */
    box-shadow: 0 3px 10px rgba(0,0,0,0.1);
    border: 3px solid #8B5A2B;
    font-family: 'Bangers', cursive;
    letter-spacing: 0.5px;
    transition: background-color 0.5s, border-color 0.5s, color 0.5s;
    font-size: 1.1rem; /* Added font size */
}

body.rhyme-mode .speech-bubble {
    background-color: #e8f4ff;
    border: 3px solid #0056a3;
    color: #033b73;
}

.speech-bubble:after {
    content: '';
    position: absolute;
    bottom: -15px;
    left: 50%;
    border-width: 15px 15px 0;
    border-style: solid;
    border-color: #8B5A2B transparent;
    transform: translateX(-50%);
    transition: border-color 0.5s;
}

body.rhyme-mode .speech-bubble:after {
    border-color: #0056a3 transparent;
}

.hidden {
    display: none;
}

.challenge-form {
    display: flex;
    flex-direction: column;
    gap: 15px; /* Increased from 10px */
    margin-bottom: 30px; /* Increased from 20px */
}

.image-upload-container {
    background-color: #f9e7c9;
    border: 2px dashed #8B5A2B;
    border-radius: 8px;
    padding: 20px; /* Increased from 15px */
    text-align: center;
    margin-bottom: 15px; /* Increased from 10px */
    transition: background-color 0.3s, border-color 0.3s;
    cursor: pointer;
}

body.rhyme-mode .image-upload-container {
    display: none; 
}

.image-upload-container.drag-over {
    background-color: #f3d9b1;
    border-color: #822d00;
}

.image-upload-container p {
    margin: 8px 0; /* Increased from 5px */
    font-weight: bold;
}

.upload-icon {
    font-size: 2.5rem; /* Increased from 2rem */
    margin-bottom: 10px; /* Increased from 5px */
    color: #8B5A2B;
}

.image-preview-container {
    display: none;
    margin: 15px 0; /* Increased from 10px */
    text-align: center;
}

.image-preview {
    max-width: 100%;
    max-height: 250px; /* Increased from 200px */
    border: 3px solid #8B5A2B;
    border-radius: 8px;
}

.remove-image-btn {
    background-color: #822d00;
    color: white;
    border: none;
    border-radius: 50%;
    width: 32px; /* Increased from 30px */
    height: 32px; /* Increased from 30px */
    font-size: 18px; /* Increased from 16px */
    cursor: pointer;
    position: relative;
    top: -15px;
    margin-left: 10px;
}

body.rhyme-mode .remove-image-btn {
    background-color: #0070d7;
}

.upload-spinner {
    display: none;
    width: 50px; /* Increased from 40px */
    height: 50px; /* Increased from 40px */
    margin: 15px auto; /* Increased from 10px */
    border: 5px solid #f9e7c9; /* Increased from 4px */
    border-top: 5px solid #822d00; /* Increased from 4px */
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

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

#challenger-input {
    padding: 15px; /* Increased from 12px */
    font-size: 1.1rem; /* Increased from 1rem */
    border: 2px solid #8B5A2B;
    border-radius: 8px;
    background-color: #f9e7c9;
    transition: border-color 0.5s, background-color 0.5s;
}

body.rhyme-mode #challenger-input {
    border: 2px solid #0056a3;
    background-color: #e8f4ff;
}

body.rhyme-mode #challenger-input::placeholder {
    color: #4785b8;
}

#challenge-button {
    padding: 15px; /* Increased from 12px */
    background-color: #822d00;
    color: white;
    border: none;
    border-radius: 8px;
    font-family: 'Bangers', cursive;
    font-size: 1.5rem; /* Increased from 1.3rem */
    cursor: pointer;
    letter-spacing: 1px;
    transition: background-color 0.3s, border-color 0.3s;
    border: 3px solid #5c1f00;
}

body.rhyme-mode #challenge-button {
    background-color: #0070d7;
    border: 3px solid #0056a3;
}

#challenge-button:hover {
    background-color: #5c1f00;
    transform: scale(1.03);
}

body.rhyme-mode #challenge-button:hover {
    background-color: #0056a3;
}

body.rhyme-mode .challenge-form button {
    background-color: #0070d7;
    border: 3px solid #0056a3;
    text-shadow: 1px 1px 0 #003366;
}

body.rhyme-mode .challenge-form button:hover {
    background-color: #0056a3;
    transform: scale(1.03);
}

.stats {
    text-align: center;
    font-weight: bold;
    font-size: 1.3rem; /* Increased from 1.2rem */
    margin-bottom: 30px; /* Increased from 20px */
    font-family: 'Bangers', cursive;
    letter-spacing: 1px;
    transition: color 0.5s;
}

body.rhyme-mode .stats {
    color: #033b73;
}

.history {
    background-color: rgba(255, 255, 255, 0.5);
    border-radius: 8px;
    padding: 20px; /* Increased from 15px */
    border: 3px solid #8B5A2B;
    transition: border-color 0.5s, background-color 0.5s;
    margin-top: 20px; /* Added space above history */
}

body.rhyme-mode .history {
    background-color: rgba(212, 232, 255, 0.5);
    border: 3px solid #0056a3;
}

.history h3 {
    font-family: 'Bangers', cursive;
    margin-bottom: 15px; /* Increased from 10px */
    text-align: center;
    letter-spacing: 1px;
    font-size: 1.5rem; /* Added font size */
    transition: color 0.5s;
}

body.rhyme-mode .history h3 {
    color: #033b73;
}

#history-list {
    list-style-type: none;
    max-height: 250px; /* Increased from 200px */
    overflow-y: auto;
}

#history-list li {
    padding: 10px; /* Increased from 8px */
    border-bottom: 1px solid #8B5A2B;
    transition: border-color 0.5s, color 0.5s;
    margin-bottom: 5px; /* Added spacing between items */
}

body.rhyme-mode #history-list li {
    border-bottom: 1px solid #0056a3;
    color: #033b73;
}

#history-list li:last-child {
    border-bottom: none;
}

.rhyme-mode-history {
    background-color: rgba(0, 86, 163, 0.1);
    font-style: italic;
    border-left: 3px solid #0056a3;
    padding-left: 5px !important;
}

body:not(.rhyme-mode) .rhyme-mode-history {
    display: none;
}

body.rhyme-mode #history-list li:not(.rhyme-mode-history) {
    display: none;
}

.history-image {
    max-width: 90px; /* Increased from 80px */
    max-height: 70px; /* Increased from 60px */
    border-radius: 4px;
    margin-right: 15px; /* Increased from 10px */
    vertical-align: middle;
}

.history-item {
    display: flex;
    align-items: center;
    padding: 10px; /* Increased from 8px */
}

.history-item-text {
    flex: 1;
}

.online-users {
    margin-top: 25px; /* Increased from 15px */
    text-align: center;
    padding: 15px; /* Added padding */
    background-color: rgba(255, 255, 255, 0.2); /* Added subtle background */
    border-radius: 10px; /* Added rounded corners */
}

.online-users h3 {
    font-family: 'Bangers', cursive;
    margin-bottom: 15px; /* Increased from 10px */
    letter-spacing: 1px;
    color: #3a2313;
    font-size: 1.4rem; /* Added font size */
    transition: color 0.5s;
}

body.rhyme-mode .online-users h3 {
    color: #033b73;
}

.users-container {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 15px; /* Increased from 10px */
    margin-top: 15px; /* Increased from 10px */
}

.user-avatar {
    display: flex;
    flex-direction: column;
    align-items: center;
    margin: 8px; /* Increased from 5px */
}

.avatar-img {
    width: 45px; /* Increased from 40px */
    height: 45px; /* Increased from 40px */
    border-radius: 50%;
    border: 2px solid #8B5A2B;
    background-color: #f9e7c9;
    overflow: hidden;
}

.username {
    font-size: 0.9rem; /* Increased from 0.8rem */
    margin-top: 8px; /* Increased from 5px */
    max-width: 90px; /* Increased from 80px */
    text-align: center;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.user-avatar.current-user .avatar-img {
    border: 2px solid #822d00;
    box-shadow: 0 0 5px rgba(130, 45, 0, 0.5);
}

.challenge-notification {
    position: fixed;
    top: 20px;
    right: 20px;
    background-color: #f9e7c9;
    border: 3px solid #8B5A2B;
    border-radius: 8px;
    padding: 15px; /* Increased from 10px */
    box-shadow: 0 3px 10px rgba(0,0,0,0.2);
    z-index: 100;
    animation: slideIn 0.3s ease-out forwards;
    font-family: 'Bangers', cursive;
}

@keyframes slideIn {
    from { transform: translateX(100%); opacity: 0; }
    to { transform: translateX(0); opacity: 1; }
}

/* Animation for new items */
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

.fade-in {
    animation: fadeIn 0.5s ease-out;
}

.admin-button {
    background-color: #822d00;
    margin-left: 10px;
}

.admin-button:hover {
    background-color: #5c1f00;
}

.admin-panel {
    padding: 15px; /* Increased from 10px */
    margin-top: 15px; /* Increased from 10px */
    background-color: rgba(255, 255, 255, 0.3);
    border-radius: 8px;
    text-align: center;
}

#admin-code-input {
    padding: 10px; /* Increased from 8px */
    margin-right: 15px; /* Increased from 10px */
    border: 2px solid #8B5A2B;
    border-radius: 5px;
}

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

.modal-content {
    background-color: #e8d0aa;
    border-radius: 15px;
    padding: 30px; /* Increased from 20px */
    width: 90%; /* Increased from 80% */
    max-width: 800px; /* Increased from 700px */
    max-height: 90vh;
    overflow-y: auto;
    position: relative;
    border: 8px solid #8B5A2B;
    box-shadow: 0 5px 15px rgba(0,0,0,0.3);
}

.close-button {
    position: absolute;
    top: 15px; /* Increased from 10px */
    right: 25px; /* Increased from 20px */
    font-size: 32px; /* Increased from 28px */
    cursor: pointer;
    color: #822d00;
    font-weight: bold;
}

.close-button:hover {
    color: #5c1f00;
}

.about-grug-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 15px; /* Increased from 10px */
}

.about-grug-image {
    max-width: 240px; /* Increased from 200px */
    border-radius: 10px;
    border: 4px solid #8B5A2B;
    margin-bottom: 20px; /* Increased from 15px */
}

.grug-info h3 {
    font-family: 'Bangers', cursive;
    font-size: 2rem; /* Increased from 1.8rem */
    color: #822d00;
    margin-bottom: 15px; /* Increased from 10px */
    letter-spacing: 1px;
    text-align: center;
}

.grug-info p {
    margin-bottom: 15px; /* Increased from 10px */
    line-height: 1.7; /* Added line height for readability */
}

.grug-description {
    text-align: justify;
    margin-bottom: 20px; /* Increased from 15px */
    padding: 0 15px; /* Increased from 10px */
}

.grug-powers {
    background-color: rgba(255, 255, 255, 0.5);
    padding: 20px; /* Increased from 15px */
    border-radius: 8px;
    border: 2px solid #8B5A2B;
    margin-top: 20px; /* Increased from 15px */
    line-height: 1.8; /* Added line height for readability */
}

.about-button {
    background-color: #5c3c1d;
}

.about-button:hover {
    background-color: #3a2313;
}

.modal.hidden {
    display: none !important;
}

body.rhyme-mode #page-title {
    font-size: 3.8rem;
    letter-spacing: 3px;
    text-shadow: 4px 4px 0 #002d5a;
    animation: pulse 2s infinite alternate;
}

@keyframes pulse {
    from { transform: scale(1); }
    to { transform: scale(1.03); }
}

.ban-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.9);
    z-index: 2000;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    animation: banModalIn 0.5s ease-in-out;
}

@keyframes banModalIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.ban-content {
    background-color: #7a0000;
    padding: 40px; /* Increased from 30px */
    border-radius: 10px;
    text-align: center;
    border: 5px solid #ff0000;
    max-width: 90%;
    animation: pulse-red 2s infinite;
}

@keyframes pulse-red {
    0% { box-shadow: 0 0 0 0 rgba(255, 0, 0, 0.7); }
    70% { box-shadow: 0 0 0 15px rgba(255, 0, 0, 0); }
    100% { box-shadow: 0 0 0 0 rgba(255, 0, 0, 0); }
}

.ban-content h2 {
    font-family: 'Bangers', cursive;
    font-size: 3.5rem; /* Increased from 3rem */
    margin-bottom: 25px; /* Increased from 20px */
    color: #ff0000;
    text-shadow: 2px 2px 0 #000;
}

.ban-icon {
    font-size: 6rem; /* Increased from 5rem */
    margin: 25px 0; /* Increased from 20px */
    animation: rotation 2s infinite linear;
}

@keyframes rotation {
    from { transform: rotate(0deg); }
    to { transform: rotate(359deg); }
}

.ban-countdown {
    font-size: 1.7rem; /* Increased from 1.5rem */
    margin-top: 25px; /* Increased from 20px */
    font-weight: bold;
}

.ban-modal.hidden {
    display: none;
}

/* New Chat Panel Styles */
.chat-panel {
    background-color: #e8d0aa;
    border-radius: 15px;
    border: 8px solid #8B5A2B;
    width: 350px; /* Increased from 300px */
    height: 650px; /* Increased from 600px */
    display: flex;
    flex-direction: column;
    box-shadow: 0 5px 15px rgba(0,0,0,0.2);
    transition: background-color 0.5s, border-color 0.5s;
    position: relative;
    margin-left: 20px; /* Added left margin */
}

body.rhyme-mode .chat-panel {
    background-color: #d4e8ff;
    border: 8px solid #0056a3;
}

.chat-panel::before {
    content: '';
    position: absolute;
    top: -3px;
    left: -3px;
    right: -3px;
    bottom: -3px;
    border: 3px dashed #5c3c1d;
    border-radius: 15px;
    pointer-events: none;
    transition: border-color 0.5s;
    z-index: -1;
}

body.rhyme-mode .chat-panel::before {
    border: 3px dashed #0056a3;
}

.chat-header {
    padding: 15px; /* Increased from 10px */
    background-color: #8B5A2B;
    color: #f9e7c9;
    font-family: 'Bangers', cursive;
    border-radius: 7px 7px 0 0;
    display: flex;
    justify-content: space-between;
    align-items: center;
    transition: background-color 0.5s, color 0.5s;
}

body.rhyme-mode .chat-header {
    background-color: #0056a3;
    color: #d4e8ff;
}

.chat-header h3 {
    margin: 0;
    letter-spacing: 1px;
    font-size: 1.5rem; /* Added font size */
}

.close-chat {
    cursor: pointer;
    font-size: 24px; /* Increased from 20px */
    font-weight: bold;
}

.chat-messages {
    flex-grow: 1;
    overflow-y: auto;
    padding: 15px; /* Increased from 10px */
    background-color: rgba(255, 255, 255, 0.5);
    display: flex;
    flex-direction: column;
    gap: 12px; /* Increased from 8px */
}

.chat-message {
    padding: 10px 15px; /* Increased from 8px 12px */
    border-radius: 12px;
    max-width: 85%;
    word-break: break-word;
    position: relative;
    animation: fadeIn 0.3s ease-out;
    font-size: 1.05rem; /* Added font size */
    line-height: 1.4; /* Added line height */
}

.chat-message.own-message {
    align-self: flex-end;
    background-color: #8B5A2B;
    color: #f9e7c9;
}

body.rhyme-mode .chat-message.own-message {
    background-color: #0056a3;
    color: #d4e8ff;
}

.chat-message.other-message {
    align-self: flex-start;
    background-color: #f9e7c9;
    color: #3a2313;
}

body.rhyme-mode .chat-message.other-message {
    background-color: #d4e8ff;
    color: #033b73;
}

.message-sender {
    font-weight: bold;
    font-size: 0.85em;
    margin-bottom: 6px; /* Increased from 4px */
}

.message-time {
    font-size: 0.75em;
    text-align: right;
    margin-top: 6px; /* Increased from 4px */
    opacity: 0.7;
}

.chat-input-container {
    display: flex;
    padding: 15px; /* Increased from 10px */
    border-top: 2px solid #8B5A2B;
    transition: border-color 0.5s;
}

body.rhyme-mode .chat-input-container {
    border-color: #0056a3;
}

#chat-input {
    flex-grow: 1;
    padding: 12px; /* Increased from 8px */
    border: 2px solid #8B5A2B;
    border-radius: 8px;
    background-color: #f9e7c9;
    margin-right: 10px; /* Increased from 8px */
    transition: border-color 0.5s, background-color 0.5s;
    font-size: 1rem; /* Added font size */
}

body.rhyme-mode #chat-input {
    border-color: #0056a3;
    background-color: #e8f4ff;
}

#send-message {
    padding: 10px 15px; /* Increased from 8px 12px */
    font-size: 1.1rem; /* Increased from 1rem */
}

.player-stats-container {
    background-color: rgba(255, 255, 255, 0.5);
    padding: 15px; /* Increased from 10px */
    max-height: 170px; /* Increased from 150px */
    overflow-y: auto;
    border-top: 2px solid #8B5A2B;
    transition: border-color 0.5s;
}

body.rhyme-mode .player-stats-container {
    border-color: #0056a3;
}

.player-stats-container h4 {
    margin: 0 0 12px 0; /* Increased from 8px */
    font-family: 'Bangers', cursive;
    text-align: center;
    letter-spacing: 1px;
    color: #3a2313;
    font-size: 1.3rem; /* Added font size */
    transition: color 0.5s;
}

body.rhyme-mode .player-stats-container h4 {
    color: #033b73;
}

.player-stats-list {
    display: flex;
    flex-direction: column;
    gap: 8px; /* Increased from 5px */
}

.player-stat-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px; /* Increased from 5px */
    border-bottom: 1px solid rgba(139, 90, 43, 0.3);
    font-size: 1rem; /* Increased from 0.9rem */
}

.player-stat-item:last-child {
    border-bottom: none;
}

.player-name {
    font-weight: bold;
    display: flex;
    align-items: center;
    gap: 8px; /* Increased from 5px */
}

.player-name-text {
    max-width: 140px; /* Increased from 120px */
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.player-avatar-small {
    width: 24px; /* Increased from 20px */
    height: 24px; /* Increased from 20px */
    border-radius: 50%;
    border: 1px solid #8B5A2B;
    overflow: hidden;
}

.player-record {
    font-family: 'Bangers', cursive;
    font-size: 1.1rem; /* Added font size */
}

.wins {
    color: #006400;
}

.losses {
    color: #8B0000;
}

.system-message {
    align-self: center;
    background-color: rgba(0, 0, 0, 0.1);
    color: #3a2313;
    padding: 8px 12px; /* Increased from 5px 10px */
    border-radius: 15px;
    font-style: italic;
    font-size: 0.9rem; /* Increased from 0.85rem */
    max-width: 90%;
    text-align: center;
}

body.rhyme-mode .system-message {
    color: #033b73;
    background-color: rgba(0, 86, 163, 0.1);
}

@media (max-width: 1100px) {
    .main-content-wrapper {
        flex-direction: column;
        align-items: center; /* Center items when stacked */
    }
    
    .chat-panel {
        width: 100%;
        height: 450px; /* Increased from 400px */
        margin-top: 30px; /* Add space between content and chat */
        margin-left: 0; /* Reset margin when stacked */
    }
    
    .content {
        max-width: 100%;
    }
}

.chat-button {
    background-color: #5c3c1d;
}

body.rhyme-mode .chat-button {
    background-color: #0056a3;
}

/* Make chat panel responsive */
@media (max-width: 768px) {
    .container {
        padding: 15px 10px; /* Reduced padding for small screens */
    }
    
    h1 {
        font-size: 3rem; /* Smaller font for small screens */
    }
    
    .chat-panel {
        position: fixed;
        bottom: 0;
        left: 0;
        right: 0;
        width: 100%;
        height: 400px; /* Increased from 350px */
        border-radius: 15px 15px 0 0;
        z-index: 100;
        margin-top: 0; /* Reset margin */
    }
    
    .chat-panel.hidden {
        transform: translateY(100%);
    }
    
    .chat-panel {
        transform: translateY(0);
        transition: transform 0.3s ease-out;
    }
    
    .grug-image {
        max-width: 250px; /* Smaller image on mobile */
    }
    
    .speech-bubble {
        max-width: 220px; /* Smaller speech bubble on mobile */
        top: 10px;
        right: 20px;
    }
    
    .audio-controls {
        flex-direction: column;
        align-items: center;
        gap: 8px;
    }
    
    .caveman-button {
        width: 90%; /* Make buttons wider on mobile */
        margin: 0 0 8px;
    }
}

@media (min-width: 769px) and (max-width: 1100px) {
    .challenge-form {
        flex-direction: row;
        flex-wrap: wrap;
    }
    
    #challenger-input {
        flex-grow: 1;
        flex-basis: 70%;
    }
    
    #challenge-button {
        flex-basis: 25%;
    }
    
    .about-grug-content {
        flex-direction: row;
        align-items: flex-start;
    }
    
    .about-grug-image {
        margin-right: 25px; /* Increased from 20px */
        margin-bottom: 0;
    }
    
    .grug-info {
        flex: 1;
    }
}

/* Make sure elements in content area don't overflow on small screens */
@media (max-width: 480px) {
    h1 {
        font-size: 2.5rem; /* Even smaller font for very small screens */
    }
    
    .subtitle {
        font-size: 1rem;
    }
    
    .grug-image {
        max-width: 200px; /* Even smaller image on very small screens */
    }
    
    .speech-bubble {
        right: 10px;
        max-width: 180px;
        padding: 12px;
        font-size: 0.95rem;
    }
    
    .history-image {
        max-width: 70px;
        max-height: 60px;
    }
}