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

body {
    font-family: 'Noto Sans', sans-serif;
    background-color: #0f1419;
    overflow: hidden;
    user-select: none;
}

#main {
    position: relative;
    width: 100vw;
    height: 100vh;
    overflow: hidden;
}

#canvas {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background-color: white;
    image-rendering: pixelated;
    image-rendering: -moz-crisp-edges;
    image-rendering: crisp-edges;
    cursor: crosshair;
}

#canvas.cooldown {
    cursor: not-allowed;
}

#selector {
    position: absolute;
    pointer-events: none;
    z-index: 10;
    display: none;
}

#selector-container {
    position: relative;
}

#selector-border {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
}

#ui {
    position: fixed;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    flex-direction: row;
    gap: 8px;
    z-index: 1000;
    align-items: flex-end;
}

#modUi {
    position: fixed;
    bottom: 20px;
    left: 20px;
    z-index: 1000;
}

#picker {
    position: fixed;
    padding: 20px;
    width: 100%;
    background-color: white;
    border-top: 3px solid #111111;
    bottom: 0;
    transition: transform 0.2s ease-out;
    transform: translateY(100%);
    pointer-events: all;
    display: flex;
    justify-content: center;
    flex-direction: column;
    z-index: 2000;
    box-shadow: 0 -10px 30px rgba(0,0,0,0.3);
}

#picker.open {
    transform: translateY(0px);
}

#picker .container {
    width: 100%;
    padding: 10px;
    display: flex;
    justify-content: center;
    align-items: center;
}

#pixel-counter {
    text-align: center;
    font-size: 14px;
    font-weight: 600;
    color: #333;
    margin: 10px 0;
    padding: 8px 16px;
    background: rgba(0, 0, 0, 0.05);
    border-radius: 20px;
    border: 1px solid rgba(0, 0, 0, 0.1);
}

#cooldown-timer {
    position: fixed;
    bottom: 100px;
    left: 50%;
    transform: translateX(-50%);
    background-color: #ff4500;
    color: white;
    padding: 12px 24px;
    border-radius: 24px;
    font-size: 14px;
    font-weight: 600;
    display: none;
    z-index: 2001;
    box-shadow: 0 4px 16px rgba(255, 69, 0, 0.3);
    border: none;
}

#cooldown-timer.active {
    display: block;
}

/* Pixel Queue Controls */
#queue-controls {
    position: fixed;
    top: 20px;
    left: 50%;
    transform: translateX(-50%);
    background-color: #ffffff;
    border-radius: 12px;
    padding: 12px 16px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    z-index: 1000;
    box-shadow: 0 4px 16px rgba(0,0,0,0.15);
    border: 1px solid rgba(0,0,0,0.1);
    min-width: 200px;
}

#queue-info {
    font-size: 14px;
    font-weight: 600;
    color: #333;
}

#queue-buttons {
    display: flex;
    gap: 8px;
}

#submit-queue-btn, #clear-queue-btn {
    padding: 8px 16px;
    border-radius: 8px;
    border: none;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.15s ease;
}

#submit-queue-btn {
    background-color: #ff4500;
    color: white;
}

#submit-queue-btn.inactive {
    background-color: #cccccc;
    color: #666666;
    cursor: not-allowed;
}

#submit-queue-btn:not(.inactive):hover {
    background-color: #e63e00;
}

#clear-queue-btn {
    background-color: #878a8c;
    color: white;
}

#clear-queue-btn:hover {
    background-color: #6a6d70;
}

/* Queued Pixel Styling */
.queued-pixel {
    /* No animations - clean pending pixel display */
    opacity: 1;
}

/* Hamburger Dropdown Menu */
.hamburger-dropdown {
    position: absolute;
    bottom: 100%;
    left: 0;
    margin-bottom: 8px;
    background: rgba(0, 0, 0, 0.9);
    border-radius: 8px;
    border: 1px solid rgba(255, 255, 255, 0.2);
    padding: 8px;
    min-width: 180px;
    z-index: 2000;
    backdrop-filter: blur(10px);
}

.hamburger-dropdown.hidden {
    display: none;
}

.hamburger-item {
    display: flex;
    align-items: center;
    gap: 8px;
    width: 100%;
    padding: 12px;
    background: transparent;
    border: none;
    color: white;
    font-size: 14px;
    border-radius: 6px;
    cursor: pointer;
    transition: background-color 0.2s ease;
}

.hamburger-item:hover {
    background: rgba(255, 255, 255, 0.1);
}

.hamburger-item svg {
    opacity: 0.8;
}

#hamburger-menu {
    position: relative;
}

/* Notification Settings Modal */
.notification-setting {
    margin-bottom: 20px;
}

.notification-setting label {
    display: block;
    margin-bottom: 8px;
    color: white;
    font-weight: 500;
}

.notification-setting input[type="checkbox"] {
    margin-right: 8px;
}

.notification-setting input[type="range"] {
    width: 200px;
    margin-right: 10px;
}

.notification-setting input[type="url"] {
    width: 100%;
    padding: 8px;
    margin-bottom: 8px;
    border: 1px solid #555;
    border-radius: 4px;
    background: #333;
    color: white;
}

.test-sound-btn {
    padding: 6px 12px;
    background: #007acc;
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 12px;
}

.test-sound-btn:hover {
    background: #005999;
}

.notification-info {
    background: rgba(255, 255, 255, 0.1);
    padding: 12px;
    border-radius: 6px;
    font-size: 12px;
    line-height: 1.4;
    color: #ccc;
}

#volume-display {
    color: #ccc;
    font-size: 14px;
    min-width: 40px;
    display: inline-block;
}

/* Removed pulse-queue animation */

.button {
    border-radius: 20px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.15s ease;
    border: none;
    font-family: inherit;
    font-weight: 600;
}

.button:hover {
    transform: translateY(-1px);
    filter: brightness(1.05);
}

.shadow {
    box-shadow: 10px 10px #111111C0;
}

.container {
    margin-bottom: 15px;
}

.white {
    background-color: #ffffff;
    color: #000000;
    border: 1px solid rgba(0,0,0,0.1);
}

.gray {
    background-color: #878a8c;
    color: #ffffff;
}

.purple {
    background-color: #ff4500;
    color: #ffffff;
}

.green {
    background-color: #46d160;
    color: #ffffff;
}

.orange {
    background-color: #ff4500;
    color: #ffffff;
}

.blue {
    background-color: #0079d3;
    color: #ffffff;
}

.inactive {
    opacity: 0.5;
    pointer-events: none;
}

.fs-s {
    font-size: 12px;
}

.fs-m {
    font-size: 14px;
}

#place {
    padding: 12px 16px;
    text-align: center;
    min-width: 100px;
    height: 40px;
}

#hamburger-menu {
    padding: 12px;
    width: 40px;
    height: 40px;
}

#stats {
    padding: 12px;
    width: 40px;
    height: 40px;
}

#settings {
    padding: 12px;
    width: 40px;
    height: 40px;
}

#share {
    padding: 8px;
    width: 40px;
    height: 40px;
}

.container {
    margin-bottom: 15px;
}

#colors {
    width: min(700px, 100%);
    height: 100%;
    display: flex;
    justify-content: center;
    align-content: center;
    align-items: center;
    flex-wrap: wrap;
    gap: 3px;
}

.color {
    border: 1px solid #E5E5E5;
    aspect-ratio: 1 / 1;
    width: min(12%, 50px);
    cursor: pointer;
    transition: all 0.15s ease;
    pointer-events: all;
}

.color:hover {
    transform: scale(1.1);
}

.color.selected {
    transform: scale(1.3);
    border: 2px solid #111111;
    box-shadow: 7px 7px #111111E0;
}

.color.disabled {
    opacity: 0.5;
    cursor: not-allowed;
    pointer-events: none;
}

/* Color picker buttons */
#cancel,
#confirm {
    width: min(35%, 270px);
    height: 55px;
    margin: 0 15px 0 15px;
    border: 3px solid #111111;
    display: flex;
    justify-content: center;
    align-items: center;
    pointer-events: all;
    transition: all 0.15s ease;
    cursor: pointer;
}

#cancel {
    background-color: #E9EDEE;
}

#confirm {
    background-color: #00ff6c;
    color: white;
    transition: background-color 0.3s ease;
}

#confirm.inactive {
    background-color: #2C3C41;
    cursor: not-allowed;
}

#cancel:hover,
#confirm:hover {
    filter: brightness(80%);
}

#cancel:active,
#confirm:active {
    transform: scale(0.95);
}

#picker.disabled {
    opacity: 0.6;
}

.tooltip {
    background-color: #1a1a1b;
    color: #ffffff;
    padding: 8px 12px;
    border-radius: 6px;
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%);
    margin-bottom: 8px;
    white-space: nowrap;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s ease;
}

.action {
    font-weight: 700;
}

.info {
    color: #999;
    margin-top: 4px;
}

.hidden {
    display: none !important;
}

/* Login Modal */
#login-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(0, 0, 0, 0.8);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 3000;
}

#login-modal.hidden {
    display: none;
}

/* Stats Modal */
#stats-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(0, 0, 0, 0.8);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 3000;
}

#stats-modal.active {
    display: flex;
}

/* Notification Modal */
#notification-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(0, 0, 0, 0.8);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 3000;
}

#notification-modal.active {
    display: flex;
}

/* Notification Modal Specific Styles */
.notification-setting {
    margin-bottom: 20px;
    text-align: left;
}

.notification-setting label {
    display: block;
    margin-bottom: 8px;
    font-weight: bold;
    color: #ff4500;
}

.notification-setting input[type="checkbox"] {
    margin-right: 10px;
    transform: scale(1.2);
}

.notification-setting input[type="range"] {
    width: 200px;
    margin: 0 10px;
}

.notification-setting input[type="url"] {
    width: 300px;
    padding: 8px 12px;
    border: 2px solid #2d2d30;
    border-radius: 6px;
    background: #1a1a1b;
    color: white;
    margin-right: 10px;
}

.notification-setting input[type="url"]:focus {
    border-color: #ff4500;
    outline: none;
}

.test-sound-btn {
    padding: 8px 16px;
    background: #ff4500;
    color: white;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-weight: bold;
}

.test-sound-btn:hover {
    background: #e03e00;
}

#volume-display {
    color: #ff4500;
    font-weight: bold;
    min-width: 40px;
    display: inline-block;
}

.notification-info {
    background: rgba(255, 69, 0, 0.1);
    border: 1px solid rgba(255, 69, 0, 0.3);
    border-radius: 6px;
    padding: 15px;
    margin-top: 20px;
    font-size: 14px;
    line-height: 1.4;
}

.notification-info strong {
    color: #ff4500;
}

/* Pixel Info Modal Styles */
.pixel-info-display {
    display: flex;
    align-items: center;
    gap: 20px;
    text-align: left;
}

.pixel-preview {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
}

.pixel-color-box {
    width: 60px;
    height: 60px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

.pixel-details {
    flex: 1;
}

.info-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

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

.info-label {
    font-weight: bold;
    color: #ff4500;
    min-width: 120px;
}

.info-value {
    color: white;
    font-family: monospace;
}

/* General Modal Styles */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(0, 0, 0, 0.8);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 3000;
}

.modal.active {
    display: flex;
}

.modal-content {
    background: #1a1a1b;
    border-radius: 12px;
    border: 2px solid #ff4500;
    padding: 30px;
    text-align: center;
    max-width: 600px;
    width: 90%;
    position: relative;
    color: white;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.7);
}

.modal-header {
    margin-bottom: 25px;
    position: relative;
    border-bottom: 2px solid #2d2d30;
    padding-bottom: 15px;
}

.modal-header h2 {
    font-size: 24px;
    margin-bottom: 5px;
    color: #ff4500;
    font-weight: bold;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.modal-header p {
    color: #999;
    font-size: 16px;
}

.close-btn {
    position: absolute;
    top: -15px;
    right: -15px;
    background: #ff4500;
    border: 2px solid #1a1a1b;
    border-radius: 50%;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    color: #fff;
    font-weight: bold;
    font-size: 18px;
    transition: all 0.2s ease;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

.close-btn:hover {
    background: #ff6b35;
    transform: scale(1.1);
    box-shadow: 0 6px 16px rgba(255, 69, 0, 0.4);
}

.stats-container {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
    margin-bottom: 30px;
}

.stat-item {
    background: #2a2a2b;
    border-radius: 12px;
    padding: 20px;
    text-align: center;
}

.stat-value {
    font-size: 24px;
    font-weight: bold;
    color: #7c3aed;
    margin-bottom: 8px;
}

.stat-label {
    font-size: 14px;
    color: #999;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.user-profile {
    display: flex;
    align-items: center;
    background: #2a2a2b;
    border-radius: 12px;
    padding: 20px;
    text-align: left;
}

.user-profile img {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    margin-right: 15px;
}

.user-info-text h3 {
    margin: 0 0 5px 0;
    font-size: 18px;
    color: #ffffff;
}

.user-info-text p {
    margin: 0;
    color: #999;
    font-size: 14px;
}

.discord-login-button {
    display: inline-flex;
    align-items: center;
    gap: 12px;
    background: #5865f2;
    color: white;
    text-decoration: none;
    padding: 12px 24px;
    border-radius: 8px;
    font-weight: 600;
    font-size: 16px;
    transition: all 0.2s ease;
}

.discord-login-button:hover {
    background: #4752c4;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(88, 101, 242, 0.4);
}

.login-container {
    background: #1a1a1b;
    border-radius: 16px;
    padding: 40px;
    text-align: center;
    box-shadow: 0 16px 64px rgba(0, 0, 0, 0.5);
    max-width: 400px;
    width: 90%;
}

.login-container h2 {
    color: #ffffff;
    margin-bottom: 10px;
    font-size: 24px;
}

.login-container p {
    color: #999;
    margin-bottom: 30px;
    line-height: 1.5;
}

.discord-login-btn {
    background: #5865f2;
    color: white;
    padding: 12px 24px;
    border: none;
    border-radius: 8px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    display: inline-flex;
    align-items: center;
    gap: 10px;
    text-decoration: none;
}

.discord-login-btn:hover {
    background: #4752c4;
    transform: translateY(-2px);
}

/* User Info */
#user-info {
    position: fixed;
    top: 20px;
    right: 20px;
    background: #1a1a1b;
    border-radius: 12px;
    padding: 12px 16px;
    display: flex;
    align-items: center;
    gap: 10px;
    z-index: 1000;
    box-shadow: 0 4px 12px rgba(0,0,0,0.3);
}

#user-info.hidden {
    display: none;
}

.user-avatar img {
    width: 32px;
    height: 32px;
    border-radius: 50%;
}

.user-details {
    flex: 1;
}

.user-name {
    color: #ffffff;
    font-weight: 600;
    font-size: 14px;
    margin-bottom: 2px;
}

.user-stats {
    color: #999;
    font-size: 12px;
}

.logout-button {
    background: #ff6b35;
    border: none;
    border-radius: 6px;
    padding: 6px;
    cursor: pointer;
    color: white;
    transition: all 0.2s ease;
    margin-left: 8px;
}

.logout-button:hover {
    background: #e55a2b;
    transform: scale(1.1);
}

.admin-button {
    background: #4CAF50;
    border: none;
    border-radius: 6px;
    padding: 6px 12px;
    cursor: pointer;
    color: white;
    transition: all 0.2s ease;
    margin-right: 8px;
    font-size: 12px;
    display: flex;
    align-items: center;
    gap: 4px;
}

.admin-button:hover {
    background: #45a049;
    transform: scale(1.05);
}

.admin-button svg {
    width: 14px;
    height: 14px;
}

.logout-btn {
    background: #ed4245;
    color: white;
    border: none;
    padding: 6px 12px;
    border-radius: 6px;
    font-size: 12px;
    cursor: pointer;
    margin-left: 10px;
}

.logout-btn:hover {
    background: #d63638;
}

/* Connection Status */
.connection-status {
    position: fixed;
    top: 20px;
    left: 20px;
    background: #1a1a1b;
    border-radius: 12px;
    padding: 12px 16px;
    display: flex;
    align-items: center;
    gap: 8px;
    z-index: 1000;
    box-shadow: 0 4px 12px rgba(0,0,0,0.3);
    font-size: 14px;
    color: #ffffff;
}

.status-indicator {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: #ffa500;
    animation: pulse 2s infinite;
}

.status-indicator.connected {
    background: #46d160;
    animation: none;
}

.status-indicator.disconnected {
    background: #ff6b35;
    animation: pulse 1s infinite;
}

.online-count {
    color: #999;
    font-size: 12px;
    margin-left: 4px;
}

.online-count.hidden {
    display: none;
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

/* Template Manager Modal Styles */
#template-manager-modal .modal-content {
    max-width: 700px;
    width: 90%;
}

/* Template Input Fields */
.template-input {
    background: #2d2d30;
    border: 2px solid #444;
    border-radius: 8px;
    padding: 12px 15px;
    color: white;
    font-family: 'Noto Sans', sans-serif;
    font-size: 14px;
    width: 100%;
    margin-bottom: 15px;
    transition: all 0.2s ease;
}

.template-input:focus {
    outline: none;
    border-color: #ff4500;
    box-shadow: 0 0 0 3px rgba(255, 69, 0, 0.1);
}

.template-input::placeholder {
    color: #999;
}

/* File Input Styling */
.template-input[type="file"] {
    background: #2d2d30;
    border: 2px solid #444;
    border-radius: 8px;
    padding: 12px 15px;
    color: white;
    font-family: 'Noto Sans', sans-serif;
    font-size: 14px;
    width: 100%;
    margin-bottom: 15px;
    transition: all 0.2s ease;
    cursor: pointer;
}

.template-input[type="file"]:hover {
    border-color: #ff4500;
    background: #3d3d40;
}

.template-input[type="file"]:focus {
    outline: none;
    border-color: #ff4500;
    box-shadow: 0 0 0 3px rgba(255, 69, 0, 0.1);
}

/* File input button styling */
.template-input[type="file"]::-webkit-file-upload-button {
    background: #ff4500;
    color: white;
    border: none;
    padding: 8px 16px;
    border-radius: 6px;
    cursor: pointer;
    font-weight: 600;
    font-size: 13px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-right: 12px;
    transition: all 0.2s ease;
    font-family: 'Noto Sans', sans-serif;
}

.template-input[type="file"]::-webkit-file-upload-button:hover {
    background: #e63e00;
}

/* Firefox file input button */
.template-input[type="file"]::file-selector-button {
    background: #ff4500;
    color: white;
    border: none;
    padding: 8px 16px;
    border-radius: 6px;
    cursor: pointer;
    font-weight: 600;
    font-size: 13px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-right: 12px;
    transition: all 0.2s ease;
    font-family: 'Noto Sans', sans-serif;
}

.template-input[type="file"]::file-selector-button:hover {
    background: #e63e00;
}

.template-input-small {
    width: calc(50% - 7.5px);
    display: inline-block;
    margin-right: 15px;
}

.template-input-small:last-child {
    margin-right: 0;
}

/* Template Buttons */
.template-btn {
    background: #ff4500;
    color: white;
    border: none;
    padding: 12px 20px;
    border-radius: 8px;
    cursor: pointer;
    font-weight: 600;
    font-size: 14px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    transition: all 0.2s ease;
    font-family: 'Noto Sans', sans-serif;
    margin-right: 10px;
    margin-bottom: 10px;
}

.template-btn:hover {
    background: #e63e00;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(255, 69, 0, 0.3);
}

.template-btn:active {
    transform: translateY(0);
    box-shadow: 0 2px 6px rgba(255, 69, 0, 0.2);
}

.template-btn:last-child {
    margin-right: 0;
}

.template-btn-danger {
    background: #dc3545;
}

.template-btn-danger:hover {
    background: #c82333;
    box-shadow: 0 4px 12px rgba(220, 53, 69, 0.3);
}

/* Upload Mode Toggle */
.upload-mode-toggle {
    display: flex;
    gap: 0;
    margin-bottom: 20px;
    border-radius: 8px;
    overflow: hidden;
    border: 2px solid #ff4500;
}

.upload-mode-btn {
    flex: 1;
    margin: 0;
    border-radius: 0;
    background: #2d2d30;
    color: #ccc;
    transition: all 0.2s ease;
}

.upload-mode-btn.active {
    background: #ff4500;
    color: white;
}

.upload-mode-btn:hover {
    background: #3d3d40;
    transform: none;
    box-shadow: none;
}

.upload-mode-btn.active:hover {
    background: #e63e00;
}

/* Upload Sections */
.upload-section {
    margin-bottom: 15px;
}

/* Template Controls Layout */
.template-controls {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

/* Input Groups */
.input-group {
    margin-bottom: 15px;
}

/* Template Sections */
.template-section {
    background: #2d2d30;
    border-radius: 8px;
    border: 2px solid #ff4500;
    padding: 20px;
    margin-bottom: 20px;
}

.template-section:last-child {
    margin-bottom: 0;
}

.template-section h3 {
    color: #ff4500;
    font-size: 18px;
    font-weight: 600;
    margin-bottom: 15px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* Template List */
.template-list {
    max-height: 300px;
    overflow-y: auto;
}

.template-list p {
    color: #999;
    font-style: italic;
    text-align: center;
    padding: 20px;
}

/* Template Item Styles */
.template-item {
    background: #1a1a1b;
    border: 2px solid #444;
    border-radius: 8px;
    padding: 15px;
    margin-bottom: 10px;
    display: flex;
    align-items: center;
    gap: 15px;
    transition: all 0.2s ease;
}

.template-item:hover {
    border-color: #ff4500;
    background: #252526;
}

.template-preview {
    flex-shrink: 0;
}

.template-info {
    flex: 1;
}

.template-name {
    color: white;
    font-weight: 600;
    font-size: 16px;
    margin-bottom: 5px;
}

.template-details {
    color: #999;
    font-size: 12px;
    margin-bottom: 2px;
}

.template-actions {
    display: flex;
    gap: 8px;
    align-items: center;
}

.template-actions .template-btn {
    background: #444;
    color: white;
    border: none;
    padding: 6px 12px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 12px;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    transition: all 0.2s ease;
    margin: 0;
    min-width: 50px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: 'Noto Sans', sans-serif;
}

.template-actions .template-btn:hover {
    background: #555;
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
}

.template-actions .template-btn.active {
    background: #ff4500;
    color: white;
}

.template-actions .template-btn.active:hover {
    background: #e63e00;
    box-shadow: 0 2px 8px rgba(255, 69, 0, 0.4);
}

.template-actions .template-btn.danger {
    background: #dc3545;
}

.template-actions .template-btn.danger:hover {
    background: #c82333;
    box-shadow: 0 2px 8px rgba(220, 53, 69, 0.4);
}
#template-menu-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(0, 0, 0, 0.8);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 3000;
}

#template-menu-modal.active {
    display: flex;
}

/* Template Modal Content Container */
.template-modal-content {
    background: #2d2d30;
    border-radius: 8px;
    border: 2px solid #ff4500;
    padding: 20px;
    max-width: 800px;
    max-height: 80vh;
    width: 90vw;
    overflow-y: auto;
    position: relative;
}

/* Template Modal Grid Layout */
.template-sections-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(350px, 1fr));
    gap: 20px;
    max-height: 70vh;
    overflow-y: auto;
}

/* Template Modal Title */
.template-modal-title {
    color: #ff4500;
    font-size: 24px;
    font-weight: bold;
    text-transform: uppercase;
    letter-spacing: 1px;
    margin: 0 0 20px 0;
    padding-bottom: 10px;
    border-bottom: 2px solid #ff4500;
    text-align: center;
}

.template-menu-buttons {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 15px;
    width: 100%;
    margin-bottom: 20px;
}

.template-menu-btn {
    background: #ff4500;
    color: white;
    border: none;
    padding: 15px 20px;
    border-radius: 8px;
    cursor: pointer;
    font-size: 16px;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 12px;
    transition: all 0.15s ease;
    min-height: 50px;
}

.template-menu-btn:hover {
    background: #e63e00;
    transform: translateY(-1px);
}

.template-menu-btn svg {
    flex-shrink: 0;
}

/* Remove old template tools styling */

/* Template Sections - Updated to match Stats Modal */
.template-section {
    background: #2d2d30;
    border-radius: 8px;
    border: 2px solid #ff4500;
    padding: 20px;
    margin-bottom: 20px;
    min-height: 150px;
}

.template-section h3 {
    color: #ff4500;
    font-size: 18px;
    font-weight: bold;
    text-transform: uppercase;
    letter-spacing: 1px;
    margin: 0 0 15px 0;
    padding-bottom: 10px;
    border-bottom: 2px solid #ff4500;
}

/* Template Forms */
#template-url-form,
#url-template-form,
#template-upload-form {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-bottom: 15px;
}

#template-url-form input,
#url-template-form input,
#template-upload-form input[type="text"], 
#template-upload-form input[type="url"],
#template-upload-form input[type="file"] {
    padding: 12px 16px;
    border: 2px solid #2d2d30;
    border-radius: 6px;
    background: #1a1a1b;
    color: white;
    font-size: 14px;
    font-family: 'Noto Sans', sans-serif;
    transition: border-color 0.2s ease;
}

#template-url-form input:focus,
#url-template-form input:focus,
#template-upload-form input:focus {
    outline: none;
    border-color: #ff4500;
    box-shadow: 0 0 0 3px rgba(255, 69, 0, 0.1);
}

#template-url-form input::placeholder,
#url-template-form input::placeholder,
#template-upload-form input::placeholder {
    color: #818384;
}

#template-url-form input[type="file"],
#url-template-form input[type="file"],
#template-upload-form input[type="file"] {
    padding: 8px;
    cursor: pointer;
}

#template-url-form button,
#url-template-form button,
#template-upload-form button {
    background: #ff4500;
    color: white;
    border: none;
    padding: 12px 20px;
    border-radius: 6px;
    cursor: pointer;
    font-weight: bold;
    font-size: 14px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    transition: all 0.2s ease;
    font-family: 'Noto Sans', sans-serif;
}

#template-url-form button:hover,
#url-template-form button:hover,
#template-upload-form button:hover {
    background: #ff6b35;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(255, 69, 0, 0.3);
}

#template-url-form button:active,
#url-template-form button:active,
#template-upload-form button:active {
    transform: translateY(0);
    box-shadow: 0 2px 6px rgba(255, 69, 0, 0.2);
}

.template-info {
    color: #818384;
    font-size: 13px;
    line-height: 1.5;
    margin: 0;
    background: rgba(255, 69, 0, 0.05);
    padding: 12px;
    border-radius: 6px;
    border-left: 3px solid #ff4500;
}

/* Template List */
#template-list {
    display: flex;
    flex-direction: column;
    gap: 15px;
    max-height: 400px;
    overflow-y: auto;
    padding: 5px;
}

.template-item {
    background: #1a1a1b;
    border: 1px solid #444;
    border-radius: 8px;
    padding: 15px;
    transition: all 0.3s ease;
}

.template-item:hover {
    border-color: #ff4500;
    box-shadow: 0 4px 15px rgba(255, 69, 0, 0.2);
    background: #222;
}

.template-item img {
    max-width: 80px;
    max-height: 80px;
    object-fit: contain;
    border: 1px solid #666;
    border-radius: 4px;
    background: white;
}

.template-item button {
    background: #ff4500;
    color: white;
    border: none;
    padding: 6px 12px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 12px;
    font-weight: 500;
    transition: all 0.2s ease;
    font-family: 'Noto Sans', sans-serif;
}

.template-item button:hover {
    background: #e63e00;
    transform: translateY(-1px);
}

.template-preview {
    width: 80px;
    height: 80px;
    margin: 0 auto 10px;
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 4px;
    background: rgba(255, 255, 255, 0.1);
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

.template-preview img {
    max-width: 100%;
    max-height: 100%;
    image-rendering: pixelated;
}

.template-name {
    color: white;
    font-size: 14px;
    font-weight: 500;
    margin-bottom: 5px;
}

.template-info-text {
    color: #cccccc;
    font-size: 12px;
    margin-bottom: 10px;
}

.template-actions {
    display: flex;
    gap: 5px;
    justify-content: center;
    flex-wrap: wrap;
}

.template-actions button {
    background: rgba(255, 255, 255, 0.1);
    color: white;
    border: 1px solid rgba(255, 255, 255, 0.2);
    padding: 6px 10px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 12px;
    transition: all 0.3s ease;
}

.template-actions button:hover {
    background: rgba(255, 255, 255, 0.2);
}

.template-actions button.active {
    background: linear-gradient(135deg, #4facfe 0%, #00f2fe 100%);
    border-color: transparent;
}

.template-actions button.delete {
    background: linear-gradient(135deg, #ff6b6b 0%, #ee5a24 100%);
    border-color: transparent;
}

/* Template Settings */
.template-setting {
    margin-bottom: 15px;
}

.template-setting label {
    display: block;
    color: #ffd700;
    font-size: 14px;
    margin-bottom: 5px;
}

.template-setting input[type="range"] {
    width: 100%;
    margin-bottom: 5px;
}

.template-setting input[type="number"] {
    width: 80px;
    padding: 4px 8px;
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 4px;
    background: rgba(0, 0, 0, 0.3);
    color: white;
    font-size: 12px;
}

.template-setting-group {
    display: flex;
    gap: 15px;
    align-items: center;
}

.template-setting-value {
    color: #cccccc;
    font-size: 12px;
    min-width: 40px;
    text-align: right;
}

/* Template Overlay */
.template-dot {
    position: absolute;
    border-radius: 50%;
    pointer-events: none;
    box-shadow: 0 0 2px rgba(0, 0, 0, 0.5);
}

@media (max-width: 768px) {
    #template-tools {
        top: 70px;
        right: 10px;
    }
    
    #template-list {
        grid-template-columns: 1fr;
    }
}

/* Stats Modal Styles */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 20px;
    max-height: 70vh;
    overflow-y: auto;
}

.stat-category {
    background: #2d2d30;
    border-radius: 8px;
    border: 2px solid #ff4500;
    padding: 20px;
    min-height: 200px;
}

.stat-category h3 {
    color: #ff4500;
    font-size: 18px;
    font-weight: bold;
    text-transform: uppercase;
    letter-spacing: 1px;
    margin: 0 0 15px 0;
    padding-bottom: 10px;
    border-bottom: 2px solid #ff4500;
}

.stat-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

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

.stat-label {
    color: #cccccc;
    font-size: 14px;
}

.stat-value {
    color: #ffffff;
    font-weight: bold;
    font-size: 16px;
}

.leaderboard {
    max-height: 300px;
    overflow-y: auto;
}

.leaderboard-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.leaderboard-rank {
    font-weight: bold;
    color: #ff4500;
    width: 30px;
}

.leaderboard-user {
    flex: 1;
    color: #ffffff;
    margin-left: 10px;
}

.leaderboard-score {
    color: #cccccc;
    font-weight: bold;
}

.color-distribution {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(40px, 1fr));
    gap: 5px;
    margin-top: 10px;
}

.color-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 5px;
    border-radius: 4px;
    background: rgba(255, 255, 255, 0.05);
}

.color-swatch {
    width: 30px;
    height: 30px;
    border-radius: 4px;
    border: 2px solid rgba(255, 255, 255, 0.2);
}

.color-count {
    color: #cccccc;
    font-size: 11px;
    margin-top: 5px;
}

.recent-activity {
    max-height: 250px;
    overflow-y: auto;
}

.activity-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    font-size: 13px;
}

.activity-user {
    color: #ff4500;
    font-weight: bold;
}

.activity-time {
    color: #888888;
    font-size: 11px;
}

.activity-coords {
    color: #cccccc;
}

@media (max-width: 768px) {
    .stats-grid {
        grid-template-columns: 1fr;
        gap: 15px;
    }
    
    .stat-category {
        padding: 15px;
    }
}

/* Template System Styles */
.template-section {
    margin-bottom: 20px;
    padding: 15px;
    background-color: rgba(255, 255, 255, 0.05);
    border-radius: 8px;
}

.template-section h3 {
    color: #ffffff;
    margin-bottom: 10px;
    font-size: 16px;
}

.template-upload {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.template-upload input[type="file"] {
    background-color: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 4px;
    padding: 8px;
    color: #ffffff;
}

.template-upload input[type="text"],
.template-upload input[type="number"] {
    background-color: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 4px;
    padding: 8px;
    color: #ffffff;
    font-size: 14px;
}

.template-upload input[type="text"]:focus,
.template-upload input[type="number"]:focus {
    border-color: #ff4500;
    outline: none;
}

.template-upload .input-group {
    display: flex;
    gap: 10px;
    align-items: center;
}

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

.template-controls button {
    background-color: #ff4500;
    color: white;
    border: none;
    padding: 8px 16px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
    transition: background-color 0.2s;
}

.template-controls button:hover {
    background-color: #e63900;
}

.template-list {
    max-height: 300px;
    overflow-y: auto;
}

.template-item {
    background-color: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 6px;
    padding: 12px;
    margin-bottom: 10px;
}

.template-item strong {
    color: #ffffff;
    font-size: 14px;
}

.template-item small {
    color: #cccccc;
    font-size: 12px;
}

.template-item button {
    background-color: #ff4500;
    color: white;
    border: none;
    padding: 6px 12px;
    border-radius: 3px;
    cursor: pointer;
    font-size: 12px;
    transition: background-color 0.2s;
}

.template-item button:hover {
    background-color: #e63900;
}

.template-item button:last-child {
    background-color: #dc3545;
}

.template-item button:last-child:hover {
    background-color: #c82333;
}

/* Template overlay canvas is positioned via JavaScript */

/* Touch feedback - keep for desktop touch devices */
.touch-feedback {
    background-color: rgba(255, 255, 255, 0.1) !important;
    transition: background-color 0.1s ease;
}

/* Improve touch scrolling - keep for all devices */
.scrollable {
    -webkit-overflow-scrolling: touch;
    overscroll-behavior: contain;
}

/* Prevent zoom on double tap for non-canvas elements - keep for all devices */
* {
    touch-action: manipulation;
}

/* Allow pan and zoom only on canvas - keep for all devices */
#canvas {
    touch-action: none;
}

/* ============ SHOP MODAL STYLES ============ */

.shop-currency-display {
    display: flex;
    justify-content: center;
    gap: 30px;
    margin-bottom: 30px;
    padding: 20px;
    background: #3a3a3a;
    border-radius: 8px;
    border: 2px solid #444;
}

.currency-item {
    text-align: center;
}

.currency-label {
    color: #ccc;
    font-size: 14px;
    margin-bottom: 5px;
}

.currency-amount {
    font-size: 24px;
    font-weight: bold;
    color: #4CAF50;
}

.bits-amount {
    color: #FFD700 !important;
}

.shop-items {
    display: grid;
    gap: 20px;
}

.shop-item {
    background: #3a3a3a;
    padding: 20px;
    border-radius: 8px;
    border: 2px solid #444;
    display: flex;
    justify-content: space-between;
    align-items: center;
    transition: border-color 0.3s;
}

.shop-item:hover:not(.shop-item-disabled) {
    border-color: #4CAF50;
}

.shop-item-disabled {
    opacity: 0.5;
}

.shop-item-info {
    flex: 1;
}

.shop-item-name {
    font-size: 18px;
    font-weight: bold;
    color: #4CAF50;
    margin-bottom: 5px;
}

.shop-item-description {
    color: #ccc;
    font-size: 14px;
    margin-bottom: 10px;
}

.shop-item-price {
    color: #FFD700;
    font-weight: bold;
}

.shop-item-actions {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
}

.shop-buy-btn {
    padding: 10px 20px;
    background: #4CAF50;
    color: white;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    font-size: 14px;
    font-weight: bold;
    transition: background 0.3s;
}

.shop-buy-btn:hover:not(:disabled) {
    background: #45a049;
}

.shop-buy-btn:disabled {
    background: #666;
    cursor: not-allowed;
    opacity: 0.5;
}

#shop-message-area .success {
    background: #4CAF50;
    color: white;
    padding: 10px;
    border-radius: 5px;
    margin-bottom: 20px;
    text-align: center;
}

#shop-message-area .error {
    background: #f44336;
    color: white;
    padding: 10px;
    border-radius: 5px;
    margin-bottom: 20px;
    text-align: center;
}

/* Queue Amount Selector */
.queue-amount-selector {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    margin-bottom: 10px;
}

.queue-amount-selector label {
    font-size: 14px;
    color: #ccc;
    font-weight: bold;
}

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

.amount-btn {
    width: 30px;
    height: 30px;
    background: #444;
    color: white;
    border: none;
    border-radius: 50%;
    cursor: pointer;
    font-size: 16px;
    font-weight: bold;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.3s;
}

.amount-btn:hover {
    background: #555;
}

.amount-btn:active {
    background: #333;
}

#queue-amount {
    width: 60px;
    height: 30px;
    text-align: center;
    background: #2a2a2a;
    border: 1px solid #555;
    border-radius: 5px;
    color: white;
    font-size: 16px;
    font-weight: bold;
}

.shop-item-price {
    text-align: center;
}

/* Loading Screen Styles */
.loading-screen {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    opacity: 1;
    transition: opacity 0.5s ease-out;
}

.loading-screen.hidden {
    opacity: 0;
    pointer-events: none;
}

.loading-container {
    text-align: center;
    color: white;
}

.anime-loader {
    position: relative;
    margin-bottom: 30px;
}

.anime-character {
    display: flex;
    justify-content: center;
    align-items: center;
    margin: 0 auto 20px;
    animation: characterBob 3s ease-in-out infinite;
}

.anime-character img {
    max-height: 200px;
    border-radius: 15px;
    box-shadow: 0 8px 25px rgba(0,0,0,0.3);
    filter: drop-shadow(0 0 10px rgba(255,255,255,0.2));
}

.loading-pixels {
    display: flex;
    justify-content: center;
    gap: 10px;
    margin-top: 20px;
}

.pixel {
    width: 12px;
    height: 12px;
    background: white;
    border-radius: 2px;
    animation: pixelFloat 1.5s ease-in-out infinite;
}

.pixel.p1 { animation-delay: 0s; background: #FF6B6B; }
.pixel.p2 { animation-delay: 0.2s; background: #4ECDC4; }
.pixel.p3 { animation-delay: 0.4s; background: #45B7D1; }
.pixel.p4 { animation-delay: 0.6s; background: #96CEB4; }
.pixel.p5 { animation-delay: 0.8s; background: #FFEAA7; }

.loading-text h2 {
    font-size: 2.5em;
    margin-bottom: 10px;
    text-shadow: 0 2px 4px rgba(0,0,0,0.3);
    background: linear-gradient(45deg, #FFB6C1, #87CEEB, #98FB98);
    background-size: 200% 200%;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    animation: gradientShift 3s ease-in-out infinite;
}

.loading-text p {
    font-size: 1.2em;
    margin-bottom: 20px;
    opacity: 0.9;
}

.loading-progress {
    max-width: 300px;
    margin: 0 auto;
}

.progress-bar {
    width: 100%;
    height: 8px;
    background: rgba(255,255,255,0.2);
    border-radius: 4px;
    overflow: hidden;
    margin-bottom: 10px;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, #FFB6C1, #87CEEB);
    width: 0%;
    transition: width 0.3s ease;
    border-radius: 4px;
}

.progress-text {
    font-size: 0.9em;
    opacity: 0.8;
}

/* Loading Animations */
@keyframes characterBob {
    0%, 100% { 
        transform: translateY(0) rotate(0deg); 
    }
    25% { 
        transform: translateY(-8px) rotate(-1deg); 
    }
    50% { 
        transform: translateY(-12px) rotate(0deg); 
    }
    75% { 
        transform: translateY(-8px) rotate(1deg); 
    }
}

@keyframes pixelFloat {
    0%, 100% { transform: translateY(0) rotate(0deg); }
    50% { transform: translateY(-10px) rotate(180deg); }
}

@keyframes gradientShift {
    0% { background-position: 0% 50%; }
    50% { background-position: 100% 50%; }
    100% { background-position: 0% 50%; }
}
