body {
    margin: 0;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, 'Open Sans', 'Helvetica Neue', sans-serif;
    background-color: #1a1a1a;
    color: #f0f0f0;
    display: flex;
    justify-content: center;
    align-items: center;
    height: 100vh;
    overflow: hidden;
}

#container {
    display: flex;
    gap: 20px;
    align-items: center;
}

#game-canvas {
    border: 2px solid #555;
    background-color: #222;
    box-shadow: 0 0 20px rgba(0, 0, 0, 0.5);
}

#controls {
    width: 250px;
    padding: 20px;
    background-color: #282c34;
    border-radius: 8px;
    box-shadow: 0 0 20px rgba(0, 0, 0, 0.5);
    border: 1px solid #444;
}

#weapon-buttons {
    max-height: 250px; /* Limit height and enable scrolling */
    overflow-y: auto;
    padding-right: 10px; /* Space for scrollbar */
    margin-right: -10px; /* Offset parent padding */
}

h1 {
    color: #61dafb;
    margin-top: 0;
}

p {
    font-size: 0.9rem;
    line-height: 1.4;
}

button {
    width: 100%;
    padding: 10px;
    margin-top: 10px;
    border: none;
    border-radius: 5px;
    background-color: #61dafb;
    color: #282c34;
    font-size: 1rem;
    font-weight: bold;
    cursor: pointer;
    transition: background-color 0.2s, transform 0.2s;
}

button:hover {
    background-color: #21a1f2;
    transform: translateY(-2px);
}

button:active {
    transform: translateY(0);
}

#vs-mode-container, #3-team-vs-mode-container {
    width: 100%;
}

#vs-mode-toggle-button, #3-team-vs-mode-toggle-button {
    width: 100%;
    background-color: #4a5a70;
}

#vs-mode-toggle-button:hover, #3-team-vs-mode-toggle-button:hover {
    background-color: #5a6a80;
}

#vs-mode-buttons button, #3-team-vs-mode-buttons button {
    background-color: #3b4b60;
    margin-top: 5px;
}

#vs-mode-buttons button:hover, #3-team-vs-mode-buttons button:hover {
    background-color: #4a5a70;
}

#fan-toggle-container {
    margin-top: 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px;
    background-color: #333942;
    border-radius: 5px;
}

#fan-toggle-container label {
    font-size: 0.9rem;
    font-weight: bold;
}

#fan-weapons-toggle {
    width: 20px;
    height: 20px;
    cursor: pointer;
}

#ball-count-display {
    margin-top: 20px;
    font-weight: bold;
}

#game-info p {
    margin-top: 15px;
}

#winner-display {
    font-weight: bold;
    color: #61dafb;
    min-height: 1.2em; /* Reserve space to prevent layout shift */
}

#tournament-info {
    margin-top: 15px;
    padding: 10px;
    background-color: #333942;
    border-radius: 5px;
    border: 1px solid #444;
}

#tournament-info p {
    margin: 5px 0;
    font-size: 0.9rem;
}

#speed-controls {
    margin-top: 15px;
    display: flex;
    align-items: center;
    gap: 10px;
}

#speed-controls label {
    font-size: 0.9rem;
}

#speed-controls button {
    width: auto;
    padding: 5px 10px;
    font-size: 0.8rem;
    margin-top: 0;
    flex-grow: 1;
}

#speed-controls button.active {
    background-color: #21a1f2;
    transform: translateY(0);
}

#aim-controls {
    margin-top: 15px;
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px;
    background-color: #333942;
    border-radius: 5px;
}

#aim-controls label {
    font-size: 0.9rem;
}

#aim-controls input {
    width: 18px;
    height: 18px;
    cursor: pointer;
}

#unarmed-speed-control {
    margin-top: 15px;
}

#unarmed-speed-control label {
    font-size: 0.9rem;
    display: block;
    margin-bottom: 5px;
}

#unarmed-slider-container {
    display: flex;
    align-items: center;
    gap: 10px;
}

#unarmed-speed-slider {
    flex-grow: 1;
    margin: 0;
}

#unarmed-speed-value {
    font-weight: bold;
    min-width: 25px;
    text-align: center;
    background-color: #333942;
    padding: 3px 6px;
    border-radius: 4px;
}

#reset-button {
    margin-bottom: 10px;
}

#add-weapon-container {
    display: flex;
    align-items: center;
    gap: 5px;
    margin-bottom: 10px;
}

#add-weapon-select {
    flex-grow: 1;
    padding: 5px;
    background-color: #333942;
    color: #f0f0f0;
    border: 1px solid #555;
    border-radius: 4px;
}

#add-weapon-button {
    width: auto;
    padding: 5px 10px;
    font-size: 1rem;
    margin-top: 0;
}

#balance-info {
    padding: 15px;
    background-color: #333942;
    border-radius: 5px;
    border: 1px solid #444;
    font-size: 0.9rem;
    text-align: center;
}

#balance-info p {
    margin: 5px 0;
    color: #f0f0f0;
}

#pva-start-buttons {
    display: none; /* Initially hidden */
    gap: 10px;
    margin-top: 10px;
}

#pva-opponent-selection {
    display: flex;
    align-items: center;
    gap: 10px;
}

#pva-opponent-selection label {
    font-size: 0.9rem;
}

#pva-opponent-selection select {
    flex-grow: 1;
    padding: 8px;
    background-color: #333942;
    color: #f0f0f0;
    border: 1px solid #555;
    border-radius: 4px;
}

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

#stats-content {
    background-color: #282c34;
    padding: 30px;
    border-radius: 8px;
    border: 1px solid #444;
    width: 90%;
    max-width: 500px;
    box-shadow: 0 0 30px rgba(0, 0, 0, 0.6);
}

#stats-content h2 {
    color: #61dafb;
    margin-top: 0;
    text-align: center;
}

#stats-content p {
    text-align: center;
    font-size: 0.8rem;
    color: #aaa;
    margin-bottom: 20px;
}

#stats-table-container {
    max-height: 50vh;
    overflow-y: auto;
    margin-bottom: 20px;
}

#stats-content table {
    width: 100%;
    border-collapse: collapse;
}

#stats-content th, #stats-content td {
    padding: 10px;
    text-align: left;
    border-bottom: 1px solid #444;
}

#stats-content th {
    background-color: #333942;
    position: sticky;
    top: 0;
}

#stats-content tr:nth-child(even) {
    background-color: #333942;
}

#stats-modal-buttons {
    display: flex;
    gap: 10px;
    margin-top: 20px;
}

#reset-stats-button {
    background-color: #f03e3e;
}

#reset-stats-button:hover {
    background-color: #c92a2a;
}

/* Inspiration Modal */
#inspiration-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.8);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 2005; /* High z-index */
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s, visibility 0.3s;
}

#inspiration-modal.visible {
    opacity: 1;
    visibility: visible;
}

#inspiration-content {
    background-color: #282c34;
    padding: 30px;
    border-radius: 8px;
    border: 1px solid #444;
    width: 90%;
    max-width: 400px;
    box-shadow: 0 0 30px rgba(0, 0, 0, 0.6);
    text-align: center;
}

#inspiration-content h2 {
    color: #61dafb;
    margin-top: 0;
}

#inspiration-content p {
    font-size: 1rem;
    margin-bottom: 25px;
}

#inspiration-buttons {
    display: flex;
    gap: 15px;
    justify-content: center;
    margin-bottom: 15px;
}

.inspiration-button {
    flex-grow: 1;
    padding: 12px;
    text-decoration: none;
    color: #fff;
    font-weight: bold;
    border-radius: 5px;
    transition: background-color 0.2s, transform 0.2s;
    text-align: center;
}

.inspiration-button:hover {
    transform: translateY(-2px);
}

.inspiration-button.youtube {
    background-color: #ff0000; /* YouTube Red */
}

.inspiration-button.youtube:hover {
    background-color: #cc0000;
}

.inspiration-button.tiktok {
    background-color: #00f2ea; /* TikTok Cyan */
    color: #000;
}

.inspiration-button.tiktok:hover {
    background-color: #00c9c3;
}

#close-inspiration-button {
    background-color: #4a5a70;
    width: 100%;
}

#close-inspiration-button:hover {
    background-color: #5a6a80;
}

#discord-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.8);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 2005;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s, visibility 0.3s;
}

#discord-modal.visible {
    opacity: 1;
    visibility: visible;
}

#discord-content {
    background-color: #282c34;
    padding: 30px;
    border-radius: 8px;
    border: 1px solid #444;
    width: 90%;
    max-width: 400px;
    box-shadow: 0 0 30px rgba(0, 0, 0, 0.6);
    text-align: center;
}

#discord-content h2 {
    color: #5865F2; /* Discord Blurple */
    margin-top: 0;
}

#discord-content p {
    font-size: 1rem;
    margin-bottom: 25px;
}

#discord-buttons {
    display: flex;
    justify-content: center;
    margin-bottom: 15px;
}

.discord-join-button {
    flex-grow: 1;
    padding: 12px;
    text-decoration: none;
    color: #fff;
    font-weight: bold;
    border-radius: 5px;
    transition: background-color 0.2s, transform 0.2s;
    text-align: center;
    background-color: #5865F2; /* Discord Blurple */
}

.discord-join-button:hover {
    background-color: #4752C4;
    transform: translateY(-2px);
}

#close-discord-button {
    background-color: #4a5a70;
    width: 100%;
}

#close-discord-button:hover {
    background-color: #5a6a80;
}

#feedback-container {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 100;
    display: flex;
    flex-direction: column;
    gap: 10px;
    align-items: flex-end;
}

#feedback-container > div {
    display: flex;
    gap: 10px;
}

#feedback-container button {
    width: auto;
    padding: 8px 16px;
    font-size: 0.9rem;
    margin-top: 0;
}

#changelog-button {
    background-color: #94d82d;
    color: #282c34;
}

#changelog-button:hover {
    background-color: #82c91e;
}

#view-feedback-button {
    background-color: #fcc419;
    color: #282c34;
}

#view-feedback-button:hover {
    background-color: #f5b105;
}

#achievements-button {
    background-color: #fcc419;
    color: #282c34;
}

#achievements-button:hover {
    background-color: #f5b105;
}

#discord-button {
    background-color: #36497d;
}

#discord-button:hover {
    background-color: #4a5a9e;
}

/* Modal Styles (similar to stats modal) */
#feedback-modal, #view-feedback-modal, #changelog-modal, #add-changelog-modal, #achievements-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.7);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
}

#feedback-content, #view-feedback-content, #changelog-content, #add-changelog-content, #achievements-content {
    background-color: #282c34;
    padding: 30px;
    border-radius: 8px;
    border: 1px solid #444;
    width: 90%;
    max-width: 500px;
    box-shadow: 0 0 30px rgba(0, 0, 0, 0.6);
}

#feedback-content h2, #view-feedback-content h2, #changelog-content h2, #add-changelog-content h2, #achievements-content h2 {
    color: #61dafb;
    margin-top: 0;
    text-align: center;
}

#feedback-content p {
    text-align: center;
    font-size: 0.9rem;
    color: #aaa;
    margin-bottom: 20px;
}

#feedback-textarea, #changelog-body-textarea {
    width: 100%;
    box-sizing: border-box; /* Include padding and border in the element's total width and height */
    padding: 10px;
    margin-bottom: 20px;
    border-radius: 5px;
    background-color: #1e1e1e;
    color: #f0f0f0;
    border: 1px solid #555;
    resize: vertical;
    font-family: inherit;
}

#changelog-title-input {
    width: 100%;
    box-sizing: border-box;
    padding: 10px;
    margin-bottom: 10px;
    border-radius: 5px;
    background-color: #1e1e1e;
    color: #f0f0f0;
    border: 1px solid #555;
    font-family: inherit;
}

#feedback-modal-buttons, #add-changelog-modal-buttons {
    display: flex;
    gap: 10px;
    margin-top: 10px;
}

#view-feedback-modal-buttons, #changelog-modal-buttons, #achievements-modal-buttons {
    display: flex;
    gap: 10px;
    margin-top: 20px;
}

#view-feedback-modal-buttons button {
    margin-top: 20px;
}

#feedback-list-container, #changelog-list-container, #achievements-list-container {
    max-height: 60vh;
    overflow-y: auto;
    padding: 10px;
    background-color: #1e1e1e;
    border-radius: 5px;
}

#feedback-category-selector {
    margin-bottom: 15px;
    display: flex;
    align-items: center;
    gap: 10px;
}

#feedback-category-selector label {
    font-size: 0.9rem;
}

#feedback-category {
    flex-grow: 1;
    padding: 8px;
    background-color: #1e1e1e;
    color: #f0f0f0;
    border: 1px solid #555;
    border-radius: 5px;
}

.feedback-item, .changelog-item {
    border-bottom: 1px solid #444;
    padding: 15px 10px;
}

.achievement-item {
    display: flex;
    align-items: center;
    gap: 15px;
    border-bottom: 1px solid #444;
    padding: 15px 10px;
    opacity: 0.5;
    transition: opacity 0.3s;
}

.achievement-icon {
    font-size: 2.5rem;
    width: 50px;
    height: 50px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    background-color: #1e1e1e;
    border-radius: 8px;
    overflow: hidden; /* Ensure image respects the border radius */
}

.achievement-icon img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 5px;
}

.achievement-item.unlocked .achievement-icon {
    background-color: #333;
}

.achievement-details {
    display: flex;
    flex-direction: column;
    flex-grow: 1;
}

.achievement-item.unlocked {
    opacity: 1;
}

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

.feedback-item:last-child, .changelog-item:last-child {
    border-bottom: none;
}

.feedback-header, .changelog-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
    color: #aaa;
    font-size: 0.8rem;
}

.achievement-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
}

.achievement-header .name {
    font-weight: bold;
    color: #f0f0f0;
}

.achievement-header .status {
    color: #aaa;
    font-size: 0.8rem;
}

.achievement-item.unlocked .achievement-header .name {
    color: #fcc419; /* Gold for unlocked achievements */
}

.achievement-item.unlocked .achievement-header .status {
    color: #51cf66; /* Green for unlocked status */
}

.feedback-header strong, .changelog-header strong {
    color: #61dafb;
}

.feedback-body, .changelog-body {
    white-space: pre-wrap; /* Preserve newlines */
    word-wrap: break-word;
    font-size: 0.95rem;
}

.achievement-body {
    font-size: 0.9rem;
    color: #ccc;
}

#weapon-generator .back-to-menu {
    background-color: #4a5a70;
}

#weapon-generator .back-to-menu:hover {
    background-color: #5a6a80;
}

#weapon-generator textarea {
    width: 100%;
    box-sizing: border-box; /* Include padding and border in the element's total width and height */
    padding: 10px;
    margin-top: 10px;
    border-radius: 5px;
    background-color: #1e1e1e;
    color: #f0f0f0;
    border: 1px solid #555;
    resize: vertical;
    font-family: inherit;
}

/* Notification Styles */
#notification-container {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 2003;
    display: flex;
    flex-direction: column;
    gap: 10px;
    align-items: flex-end;
}

.notification {
    background-color: rgba(10, 20, 40, 0.85);
    color: #fff;
    padding: 20px;
    border-radius: 12px;
    border-left: 5px solid #0070d1;
    display: flex;
    align-items: center;
    gap: 20px;
    min-width: 350px;
    max-width: 400px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(5px);
    transform: translateX(120%);
    animation: slideIn 0.5s ease-out forwards, slideOut 0.5s ease-in 4.5s forwards;
}

.notification-icon {
    font-size: 2.5rem;
    line-height: 1;
    width: 50px;
    height: 50px;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
}

.notification-icon img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 5px;
}

.large-image-notification {
    min-width: 450px;
}

.large-image-notification .notification-icon {
    width: 150px;
    height: 100%;
    font-size: 5rem;
    align-self: stretch;
    margin-top: -20px;
    margin-bottom: -20px;
    margin-left: -20px;
    padding-left: 20px;
    border-top-left-radius: 7px;
    border-bottom-left-radius: 7px;
    overflow: hidden;
}

.large-image-notification .notification-icon img {
    object-fit: contain;
}

.notification-content {
    display: flex;
    flex-direction: column;
}

.notification-content p {
    margin: 0;
    line-height: 1.2;
}

.notification-title {
    font-weight: bold;
    margin-bottom: 5px;
    color: #f0f0f0;
    font-size: 1.1rem;
}

.notification-description {
    font-size: 1rem;
    color: #ccc;
}

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

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

/* Admin Panel Styles */
#admin-button {
    position: fixed;
    bottom: 5px;
    right: 5px;
    width: 10px;
    height: 10px;
    background-color: #1a1a1a;
    border: none;
    cursor: pointer;
    z-index: 2001;
    transition: background-color 0.2s;
    padding: 0;
    margin: 0;
}

#admin-button:hover {
    background-color: #333;
}

#admin-panel-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.7);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 2002;
}

#admin-panel-content {
    background-color: #282c34;
    padding: 30px;
    border-radius: 8px;
    border: 1px solid #444;
    width: 90%;
    max-width: 600px;
    box-shadow: 0 0 30px rgba(0, 0, 0, 0.6);
}

#admin-panel-content h2 {
    color: #f03e3e; /* Red for admin */
    margin-top: 0;
    text-align: center;
}

#admin-panel-body {
    min-height: 200px;
    max-height: 60vh;
    overflow-y: auto;
    padding: 10px;
    background-color: #1e1e1e;
    border-radius: 5px;
}

.admin-section {
    padding: 15px;
    border-bottom: 1px solid #444;
}

.admin-section:last-child {
    border-bottom: none;
}

.admin-section h4 {
    margin-top: 0;
    color: #61dafb;
}

.admin-controls {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

.admin-controls label {
    font-size: 0.9rem;
}

.admin-controls select {
    flex-grow: 1;
    padding: 8px;
    background-color: #333942;
    color: #f0f0f0;
    border: 1px solid #555;
    border-radius: 4px;
}

.admin-controls button {
    width: auto;
    padding: 8px 12px;
    font-size: 0.9rem;
    margin-top: 0;
}

#admin-grant-achievement {
    background-color: #51cf66;
}

#admin-grant-achievement:hover {
    background-color: #40c057;
}

#admin-remove-achievement {
    background-color: #ff6b6b;
}

#admin-remove-achievement:hover {
    background-color: #fa5252;
}

.admin-status {
    margin-top: 10px;
    font-size: 0.85rem;
    min-height: 1.2em;
    font-style: italic;
}

.admin-panel-buttons {
    display: flex;
    gap: 10px;
    margin-top: 20px;
}