@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600&display=swap');

* {
    box-sizing: border-box;
}

html, body {
    margin: 0;
    padding: 0;
    height: 100%;
    overflow: hidden;
    overscroll-behavior: none;
    -webkit-overflow-scrolling: none;
    touch-action: none;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    background: linear-gradient(135deg, #0f0f0f 0%, #1a1a1a 100%);
    color: #ffffff;
    position: fixed;
    width: 100%;
    height: 100%;
}

#gameCanvas {
    border: none;
    background: rgba(255, 255, 255, 0.03);
    display: block;
    margin: 90px auto 40px;
    touch-action: none;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3), 
                0 0 100px rgba(255, 255, 255, 0.05) inset;
    border-radius: 20px;
    backdrop-filter: blur(10px);
    position: relative;
}

#info {
    position: fixed;
    top: 20px;
    left: 50%;
    transform: translateX(-50%);
    text-align: center;
    background: rgba(255, 255, 255, 0.05);
    padding: 12px 24px;
    border-radius: 30px;
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    font-size: 14px;
    font-weight: 400;
    letter-spacing: 0.5px;
    transition: all 0.3s ease;
    z-index: 100;
    white-space: nowrap;
    display: flex;
    align-items: center;
    gap: 10px;
    max-width: 90vw;
}

#usernameDisplay {
    color: #4ECDC4;
    font-weight: 500;
}

#status {
    color: rgba(255, 255, 255, 0.7);
    font-size: 13px;
}

/* Ping indicator - perfect circle */
.ping-indicator {
    display: inline-block;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    margin: 0 3px;
    vertical-align: middle;
    animation: pulse 2s ease-in-out infinite;
}

@keyframes pulse {
    0%, 100% {
        opacity: 1;
        transform: scale(1);
    }
    50% {
        opacity: 0.8;
        transform: scale(0.9);
    }
}

#chatContainer {
    position: fixed;
    bottom: 30px;
    left: 30px;
    width: 320px;
    height: 280px;
    background: linear-gradient(135deg, rgba(15, 15, 15, 0.95) 0%, rgba(25, 25, 25, 0.95) 100%);
    backdrop-filter: blur(20px);
    border: 1px solid rgba(78, 205, 196, 0.2);
    border-radius: 16px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.4),
                0 0 80px rgba(78, 205, 196, 0.05);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

#chatContainer.minimized {
    height: 50px;
    width: 200px;
}

#chatContainer.minimized #chatMessages,
#chatContainer.minimized #chatInputContainer {
    display: none;
}

#chatHeader {
    background: rgba(78, 205, 196, 0.1);
    padding: 8px 16px;
    border-bottom: 1px solid rgba(78, 205, 196, 0.2);
    display: flex;
    justify-content: space-between;
    align-items: center;
    cursor: pointer;
    user-select: none;
}

#chatHeader h3 {
    margin: 0;
    font-size: 13px;
    font-weight: 600;
    color: #4ECDC4;
    letter-spacing: 0.3px;
}

#chatToggle {
    width: 24px;
    height: 24px;
    background: none;
    border: none;
    color: #4ECDC4;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 4px;
    transition: all 0.2s ease;
}

#chatToggle:hover {
    background: rgba(78, 205, 196, 0.2);
}

#chatMessages {
    flex: 1;
    overflow-y: auto;
    padding: 12px;
    scrollbar-width: thin;
    scrollbar-color: rgba(78, 205, 196, 0.3) transparent;
}

#chatMessages::-webkit-scrollbar {
    width: 4px;
}

#chatMessages::-webkit-scrollbar-track {
    background: transparent;
}

#chatMessages::-webkit-scrollbar-thumb {
    background: rgba(78, 205, 196, 0.3);
    border-radius: 2px;
}

#chatMessages::-webkit-scrollbar-thumb:hover {
    background: rgba(78, 205, 196, 0.5);
}

#chatInputContainer {
    padding: 10px;
    background: rgba(0, 0, 0, 0.3);
    border-top: 1px solid rgba(78, 205, 196, 0.2);
    display: flex;
    gap: 8px;
    align-items: center;
}

#chatInput {
    flex: 1;
    padding: 8px 14px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(78, 205, 196, 0.2);
    border-radius: 20px;
    color: white;
    font-size: 13px;
    font-family: inherit;
    transition: all 0.3s ease;
    outline: none;
}

#chatInput:focus {
    background: rgba(255, 255, 255, 0.08);
    border-color: #4ECDC4;
    box-shadow: 0 0 0 2px rgba(78, 205, 196, 0.2);
}

#chatInput::placeholder {
    color: rgba(255, 255, 255, 0.4);
}

#sendBtn {
    width: 36px;
    height: 36px;
    padding: 0;
    background: linear-gradient(135deg, #4ECDC4 0%, #44A08D 100%);
    border: none;
    border-radius: 50%;
    color: #0f0f0f;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    font-family: inherit;
    font-size: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 15px rgba(78, 205, 196, 0.3);
}

#sendBtn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(78, 205, 196, 0.4);
}

#sendBtn:active {
    transform: translateY(0);
}

.chatMessage {
    margin-bottom: 8px;
    padding: 6px 10px;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 8px;
    border-left: 2px solid #4ECDC4;
    word-wrap: break-word;
    animation: messageSlide 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
    transition: all 0.2s ease;
}

.chatMessage:hover {
    background: rgba(255, 255, 255, 0.08);
    transform: translateX(2px);
}

@keyframes messageSlide {
    from {
        opacity: 0;
        transform: translateX(-20px) scale(0.9);
    }
    to {
        opacity: 1;
        transform: translateX(0) scale(1);
    }
}

.chatMessage .sender {
    font-weight: 600;
    color: #4ECDC4;
    font-size: 11px;
    display: inline;
    margin-right: 6px;
    text-transform: none;
}

.chatMessage .message-text {
    color: rgba(255, 255, 255, 0.85);
    font-size: 13px;
    line-height: 1.3;
    display: inline;
}

.chatMessage .timestamp {
    font-size: 9px;
    color: rgba(255, 255, 255, 0.3);
    margin-left: 8px;
    display: inline;
}

.chatMessage.system-message {
    background: rgba(255, 107, 107, 0.1);
    border-left-color: #FF6B6B;
}

.chatMessage.system-message .sender {
    color: #FF6B6B;
}

.chat-separator {
    text-align: center;
    color: rgba(255, 255, 255, 0.4);
    font-size: 10px;
    margin: 10px 0;
    padding: 5px;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.8);
    backdrop-filter: blur(10px);
    animation: fadeIn 0.3s ease;
}

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

.modal-content {
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.1) 0%, rgba(255, 255, 255, 0.05) 100%);
    margin: 10vh auto;
    padding: 40px;
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 24px;
    width: 380px;
    text-align: center;
    backdrop-filter: blur(20px);
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3),
                0 0 100px rgba(78, 205, 196, 0.1);
    animation: modalSlide 0.4s ease;
    position: relative;
}

@keyframes modalSlide {
    from {
        transform: translateY(-50px);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

.modal-content h2 {
    margin: 0 0 20px 0;
    font-size: 28px;
    font-weight: 600;
    background: linear-gradient(135deg, #4ECDC4 0%, #44A08D 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    letter-spacing: -0.5px;
}

.modal-content p {
    color: rgba(255, 255, 255, 0.7);
    margin-bottom: 30px;
    font-size: 16px;
    font-weight: 300;
}

.modal-content input {
    width: 100%;
    padding: 16px 20px;
    margin: 0 0 20px 0;
    font-size: 16px;
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: 12px;
    color: white;
    font-family: inherit;
    transition: all 0.3s ease;
    outline: none;
}

.modal-content input:focus {
    background: rgba(255, 255, 255, 0.12);
    border-color: #4ECDC4;
    box-shadow: 0 0 0 3px rgba(78, 205, 196, 0.1);
}

.modal-content input::placeholder {
    color: rgba(255, 255, 255, 0.4);
}

.modal-content button {
    width: 100%;
    padding: 16px 32px;
    font-size: 16px;
    font-weight: 600;
    background: linear-gradient(135deg, #4ECDC4 0%, #44A08D 100%);
    color: #0f0f0f;
    border: none;
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.3s ease;
    font-family: inherit;
    letter-spacing: 0.5px;
    box-shadow: 0 4px 15px rgba(78, 205, 196, 0.3);
}

.modal-content button:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 25px rgba(78, 205, 196, 0.4);
}

.modal-content button:active {
    transform: translateY(0);
}

#reconnectBtn {
    margin-left: 15px;
    padding: 8px 16px;
    background: linear-gradient(135deg, #4ECDC4 0%, #44A08D 100%);
    border: none;
    border-radius: 20px;
    color: #0f0f0f;
    font-weight: 600;
    font-size: 13px;
    cursor: pointer;
    transition: all 0.3s ease;
    font-family: inherit;
    box-shadow: 0 2px 10px rgba(78, 205, 196, 0.3);
}

#reconnectBtn:hover {
    transform: scale(1.05);
    box-shadow: 0 4px 15px rgba(78, 205, 196, 0.4);
}

#reconnectBtn:active {
    transform: scale(0.98);
}

#profileBtn, #friendsBtn, #settingsBtn, #helpBtn, #roomsBtn, #achievementsBtn {
    margin-left: 10px;
    padding: 8px 12px;
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 50%;
    color: #ffffff;
    font-size: 16px;
    cursor: pointer;
    transition: all 0.3s ease;
    font-family: inherit;
}

#profileBtn:hover, #settingsBtn:hover, #helpBtn:hover, #roomsBtn:hover, #achievementsBtn:hover {
    background: rgba(255, 255, 255, 0.15);
    transform: scale(1.1);
    border-color: #4ECDC4;
}

#startVoteBtn {
    position: fixed;
    bottom: 30px;
    left: 50%;
    transform: translateX(-50%);
    padding: 12px 36px;
    background: linear-gradient(135deg, #4ECDC4 0%, #44A08D 100%);
    border: none;
    border-radius: 30px;
    color: #0f0f0f;
    font-size: 16px;
    font-weight: 600;
    letter-spacing: 1px;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 20px rgba(78, 205, 196, 0.3);
    z-index: 50;
}

#startVoteBtn:hover {
    transform: translateX(-50%) translateY(-2px);
    box-shadow: 0 6px 30px rgba(78, 205, 196, 0.5);
}

#startVoteBtn:active {
    transform: translateX(-50%) translateY(0);
}

.profile-modal {
    width: 450px;
    max-width: 90vw;
    max-height: 80vh;
    overflow-y: auto;
}

.profile-modal h2 {
    margin-top: 0;
    margin-bottom: 30px;
}

.close-btn {
    position: absolute;
    top: 5px;
    right: 10px;
    background: none !important;
    border: none !important;
    color: rgba(255, 255, 255, 0.8);
    font-size: 40px;
    font-weight: 200;
    cursor: pointer;
    padding: 5px 10px !important;
    width: auto !important;
    height: auto !important;
    box-shadow: none !important;
    border-radius: 0 !important;
    transition: all 0.2s ease;
    line-height: 1;
}

.close-btn:hover {
    color: #FF6B6B;
    background: none !important;
    transform: scale(1.2) !important;
    box-shadow: none !important;
}

.profile-section {
    margin-bottom: 25px;
}

.profile-section label {
    display: block;
    margin-bottom: 10px;
    color: #4ECDC4;
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 1px;
    font-weight: 600;
}

.profile-section input[type="text"] {
    width: 100%;
    padding: 12px 16px;
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: 8px;
    color: white;
    font-size: 16px;
    font-family: inherit;
    transition: all 0.3s ease;
    outline: none;
}

.profile-section input[type="text"]:focus {
    background: rgba(255, 255, 255, 0.12);
    border-color: #4ECDC4;
    box-shadow: 0 0 0 3px rgba(78, 205, 196, 0.1);
}

.color-picker {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 12px;
    margin-bottom: 15px;
}

.color-option {
    width: 50px;
    height: 50px;
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.3s ease;
    border: 3px solid transparent;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
}

.color-option:hover {
    transform: scale(1.1);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.3);
}

.color-option.selected {
    border-color: #ffffff;
    transform: scale(1.1);
}

#customColor {
    width: 50px;
    height: 50px;
    border: none;
    border-radius: 12px;
    cursor: pointer;
    vertical-align: middle;
}

.custom-color-label {
    display: inline-block;
    margin-left: 10px;
    color: rgba(255, 255, 255, 0.7);
    font-size: 14px;
}

.preview-container {
    background: rgba(255, 255, 255, 0.05);
    border-radius: 12px;
    padding: 20px;
    display: flex;
    justify-content: center;
    align-items: center;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.save-btn {
    width: 100%;
    padding: 14px;
    background: linear-gradient(135deg, #4ECDC4 0%, #44A08D 100%);
    border: none;
    border-radius: 8px;
    color: #0f0f0f;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    font-family: inherit;
    letter-spacing: 0.5px;
    box-shadow: 0 4px 15px rgba(78, 205, 196, 0.3);
    margin-top: 10px;
}

.save-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 25px rgba(78, 205, 196, 0.4);
}

.save-btn:active {
    transform: translateY(0);
}

/* Shape picker styles */
.shape-picker {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 10px;
    margin-top: 10px;
}

.shape-option {
    background: rgba(255, 255, 255, 0.05);
    border: 2px solid rgba(255, 255, 255, 0.1);
    border-radius: 10px;
    padding: 10px;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    justify-content: center;
    align-items: center;
}

.shape-option:hover {
    background: rgba(78, 205, 196, 0.2);
    border-color: rgba(78, 205, 196, 0.5);
    transform: scale(1.05);
}

.shape-option.selected {
    background: rgba(78, 205, 196, 0.3);
    border-color: #4ECDC4;
    box-shadow: 0 0 10px rgba(78, 205, 196, 0.5);
}

.shape-option svg {
    width: 40px;
    height: 40px;
}

.shape-option svg * {
    transition: fill 0.3s ease;
}

.shape-option:hover svg * {
    fill: #4ECDC4 !important;
}

.shape-option.selected svg * {
    fill: #4ECDC4 !important;
}

.preview-container {
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 10px;
    padding: 10px;
    display: flex;
    justify-content: center;
    align-items: center;
    margin-top: 10px;
}

#previewCanvas {
    border-radius: 5px;
}

/* Player List Styles */
#playerList {
    position: fixed;
    top: 80px;
    left: 30px;
    right: auto;
    width: 220px;
    background: linear-gradient(135deg, rgba(15, 15, 15, 0.95) 0%, rgba(25, 25, 25, 0.95) 100%);
    backdrop-filter: blur(20px);
    border: 1px solid rgba(78, 205, 196, 0.2);
    border-radius: 16px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.4),
                0 0 80px rgba(78, 205, 196, 0.05);
    overflow: hidden;
    transition: all 0.3s ease;
}

#playerListHeader {
    background: rgba(78, 205, 196, 0.1);
    padding: 12px 20px;
    border-bottom: 1px solid rgba(78, 205, 196, 0.2);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

#playerListHeader h3 {
    margin: 0;
    font-size: 14px;
    font-weight: 600;
    color: #4ECDC4;
    letter-spacing: 0.5px;
}

#playerCount {
    background: rgba(78, 205, 196, 0.2);
    color: #4ECDC4;
    padding: 2px 8px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 600;
}

#playerListContent {
    max-height: 300px;
    overflow-y: auto;
    padding: 10px;
    scrollbar-width: thin;
    scrollbar-color: rgba(78, 205, 196, 0.3) transparent;
}

#playerListContent::-webkit-scrollbar {
    width: 4px;
}

#playerListContent::-webkit-scrollbar-track {
    background: transparent;
}

#playerListContent::-webkit-scrollbar-thumb {
    background: rgba(78, 205, 196, 0.3);
    border-radius: 2px;
}

.player-item {
    padding: 8px 12px;
    margin-bottom: 8px;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 8px;
    display: flex;
    align-items: center;
    gap: 10px;
    transition: all 0.2s ease;
    border-left: 3px solid transparent;
    position: relative;
}

.player-item:hover {
    background: rgba(255, 255, 255, 0.08);
    transform: translateX(2px);
}

.player-item.self {
    border-left-color: #4ECDC4;
}

.player-color {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    flex-shrink: 0;
}

.player-shape {
    width: 20px;
    height: 20px;
    flex-shrink: 0;
    margin-right: 5px;
}

.player-name {
    color: rgba(255, 255, 255, 0.9);
    font-size: 13px;
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.player-ping {
    color: rgba(255, 255, 255, 0.5);
    font-size: 11px;
    flex-shrink: 0;
}

.player-menu-btn {
    position: absolute;
    right: 8px;
    top: 50%;
    transform: translateY(-50%);
    width: 24px;
    height: 24px;
    background: none;
    border: none;
    color: rgba(255, 255, 255, 0.5);
    font-size: 16px;
    cursor: pointer;
    border-radius: 4px;
    display: none;
    transition: all 0.2s ease;
}

.player-item:hover .player-menu-btn {
    display: block;
}

.player-menu-btn:hover {
    background: rgba(255, 255, 255, 0.1);
    color: #4ECDC4;
}

.context-menu {
    position: absolute;
    background: linear-gradient(135deg, rgba(15, 15, 15, 0.98) 0%, rgba(25, 25, 25, 0.98) 100%);
    backdrop-filter: blur(20px);
    border: 1px solid rgba(78, 205, 196, 0.3);
    border-radius: 8px;
    padding: 4px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.5);
    z-index: 1000;
    min-width: 150px;
}

.context-menu button {
    display: block;
    width: 100%;
    padding: 8px 12px;
    background: none;
    border: none;
    color: rgba(255, 255, 255, 0.9);
    font-size: 13px;
    text-align: left;
    cursor: pointer;
    border-radius: 4px;
    transition: all 0.2s ease;
    font-family: inherit;
}

.context-menu button:hover {
    background: rgba(78, 205, 196, 0.2);
    color: #4ECDC4;
}

/* Loading Screen */
#loadingScreen {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, #0f0f0f 0%, #1a1a1a 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2000;
}

.loading-content {
    text-align: center;
}

.loading-spinner {
    width: 60px;
    height: 60px;
    margin: 0 auto 30px;
    border: 3px solid rgba(78, 205, 196, 0.1);
    border-top-color: #4ECDC4;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

.loading-content h2 {
    color: #4ECDC4;
    font-size: 24px;
    margin-bottom: 10px;
    font-weight: 600;
}

#loadingStatus {
    color: rgba(255, 255, 255, 0.7);
    font-size: 14px;
}

/* Room Modal */
.room-modal {
    width: 500px;
    max-width: 90vw;
}

.account-modal {
    max-width: 400px;
}

#roomList {
    max-height: 300px;
    overflow-y: auto;
    margin-bottom: 20px;
    padding: 10px;
    background: rgba(255, 255, 255, 0.03);
    border-radius: 8px;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.room-item {
    padding: 15px;
    margin-bottom: 10px;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 8px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.room-item:hover {
    background: rgba(78, 205, 196, 0.1);
    border-color: rgba(78, 205, 196, 0.3);
    transform: translateX(5px);
}

.room-item.social-room {
    background: linear-gradient(135deg, rgba(255, 215, 0, 0.05) 0%, rgba(255, 215, 0, 0.02) 100%);
    border-color: rgba(255, 215, 0, 0.2);
}

.room-item.social-room:hover {
    background: linear-gradient(135deg, rgba(255, 215, 0, 0.1) 0%, rgba(255, 215, 0, 0.05) 100%);
    border-color: rgba(255, 215, 0, 0.4);
}

.room-item.last-room {
    position: relative;
}

.room-item.last-room::after {
    content: 'Last Room';
    position: absolute;
    top: 5px;
    right: 10px;
    font-size: 10px;
    color: #4ECDC4;
    background: rgba(78, 205, 196, 0.1);
    padding: 2px 8px;
    border-radius: 10px;
    border: 1px solid rgba(78, 205, 196, 0.3);
}

.room-name {
    font-size: 16px;
    color: #ffffff;
    font-weight: 500;
}

.room-players {
    font-size: 14px;
    color: rgba(255, 255, 255, 0.6);
}

.room-item.room-full {
    opacity: 0.5;
    cursor: not-allowed;
    background: rgba(255, 107, 107, 0.05);
    border-color: rgba(255, 107, 107, 0.2);
}

.room-item.room-full:hover {
    transform: none;
    background: rgba(255, 107, 107, 0.05);
    border-color: rgba(255, 107, 107, 0.2);
}

.room-item.room-almost-full {
    background: rgba(254, 202, 87, 0.05);
    border-color: rgba(254, 202, 87, 0.2);
}

.room-item.room-almost-full:hover {
    background: rgba(254, 202, 87, 0.1);
    border-color: rgba(254, 202, 87, 0.3);
}


/* Friends Container */
#friendsContainer {
    position: fixed;
    bottom: 320px;
    left: 30px;
    width: 320px;
    background: linear-gradient(135deg, rgba(15, 15, 15, 0.95) 0%, rgba(25, 25, 25, 0.95) 100%);
    backdrop-filter: blur(20px);
    border: 1px solid rgba(78, 205, 196, 0.2);
    border-radius: 16px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.4),
                0 0 80px rgba(78, 205, 196, 0.05);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    overflow: hidden;
}

#friendsContainer.minimized {
    height: 50px;
}

#friendsContainer.minimized #friendsContent {
    display: none;
}

#friendsHeader {
    background: rgba(78, 205, 196, 0.1);
    padding: 8px 16px;
    border-bottom: 1px solid rgba(78, 205, 196, 0.2);
    display: flex;
    align-items: center;
    cursor: pointer;
    user-select: none;
}

#friendsHeader h3 {
    margin: 0;
    font-size: 13px;
    font-weight: 600;
    color: #4ECDC4;
    letter-spacing: 0.3px;
    flex: 1;
}

#friendsOnlineCount {
    background: rgba(78, 205, 196, 0.2);
    color: #4ECDC4;
    padding: 2px 8px;
    border-radius: 12px;
    font-size: 11px;
    font-weight: 600;
    margin-right: 10px;
}

#friendsToggle {
    width: 24px;
    height: 24px;
    background: none;
    border: none;
    color: #4ECDC4;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 4px;
    transition: all 0.2s ease;
}

#friendsToggle:hover {
    background: rgba(78, 205, 196, 0.2);
}

#friendsContent {
    padding: 12px;
}

.friends-compact-add {
    display: flex;
    gap: 8px;
    margin-bottom: 12px;
}

.friends-compact-add input {
    flex: 1;
    padding: 6px 12px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(78, 205, 196, 0.2);
    border-radius: 20px;
    color: white;
    font-size: 12px;
    font-family: inherit;
    transition: all 0.3s ease;
    outline: none;
}

.friends-compact-add input:focus {
    background: rgba(255, 255, 255, 0.08);
    border-color: #4ECDC4;
}

.friends-compact-add button {
    width: 32px;
    height: 32px;
    padding: 0;
    background: linear-gradient(135deg, #4ECDC4 0%, #44A08D 100%);
    border: none;
    border-radius: 50%;
    color: #0f0f0f;
    font-weight: 600;
    font-size: 18px;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.friends-compact-add button:hover {
    transform: scale(1.1);
    box-shadow: 0 4px 15px rgba(78, 205, 196, 0.4);
}

.friends-compact-list {
    max-height: 150px;
    overflow-y: auto;
    scrollbar-width: thin;
    scrollbar-color: rgba(78, 205, 196, 0.3) transparent;
}

.friends-compact-list::-webkit-scrollbar {
    width: 4px;
}

.friends-compact-list::-webkit-scrollbar-track {
    background: transparent;
}

.friends-compact-list::-webkit-scrollbar-thumb {
    background: rgba(78, 205, 196, 0.3);
    border-radius: 2px;
}

.friend-compact-item {
    padding: 6px 8px;
    margin-bottom: 4px;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 6px;
    display: flex;
    align-items: center;
    gap: 8px;
    transition: all 0.2s ease;
    cursor: pointer;
    font-size: 12px;
}

.friend-compact-item:hover {
    background: rgba(255, 255, 255, 0.08);
    transform: translateX(2px);
}

.friend-compact-item.pending {
    background: rgba(254, 202, 87, 0.1);
    border-left: 2px solid #FECA57;
}

.friend-compact-status {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: #FF6B6B;
    flex-shrink: 0;
}

.friend-compact-status.online {
    background: #4EFF4E;
    box-shadow: 0 0 4px rgba(78, 255, 78, 0.5);
}

.friend-compact-name {
    flex: 1;
    color: rgba(255, 255, 255, 0.9);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.friend-compact-actions {
    display: flex;
    gap: 4px;
    opacity: 0;
    transition: opacity 0.2s ease;
}

.friend-compact-item:hover .friend-compact-actions {
    opacity: 1;
}

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

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

.friend-compact-actions button.accept {
    color: #4ECDC4;
    border-color: #4ECDC4;
}

.friend-compact-actions button.reject {
    color: #FF6B6B;
    border-color: #FF6B6B;
}

/* Mobile Controls */
#mobileControls {
    display: none;
    position: fixed;
    bottom: 30px;
    right: 30px;
    z-index: 500;
}

#joystickContainer {
    width: 120px;
    height: 120px;
    background: rgba(255, 255, 255, 0.1);
    border: 2px solid rgba(78, 205, 196, 0.3);
    border-radius: 50%;
    position: relative;
    touch-action: none;
}

#joystick {
    width: 50px;
    height: 50px;
    background: linear-gradient(135deg, #4ECDC4 0%, #44A08D 100%);
    border-radius: 50%;
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    box-shadow: 0 4px 15px rgba(78, 205, 196, 0.4);
    touch-action: none;
}

/* Achievements styles */
.achievements-modal {
    max-width: 600px;
    max-height: 80vh;
    overflow-y: auto;
}

.achievements-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: 15px;
    padding: 20px 0;
}

.achievement-card {
    background: rgba(255, 255, 255, 0.05);
    border: 2px solid rgba(255, 255, 255, 0.1);
    border-radius: 10px;
    padding: 15px;
    text-align: center;
    transition: all 0.3s ease;
    cursor: pointer;
}

.achievement-card.unlocked {
    background: rgba(78, 205, 196, 0.1);
    border-color: var(--primary-color);
    box-shadow: 0 0 15px rgba(78, 205, 196, 0.3);
}

.achievement-card.locked {
    opacity: 0.5;
    filter: grayscale(100%);
}

.achievement-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 5px 20px rgba(78, 205, 196, 0.4);
}

.achievement-icon {
    font-size: 2.5em;
    margin-bottom: 10px;
    display: block;
}

.achievement-name {
    font-weight: bold;
    font-size: 0.9em;
    margin-bottom: 5px;
    color: var(--primary-color);
}

.achievement-description {
    font-size: 0.8em;
    color: rgba(255, 255, 255, 0.7);
    line-height: 1.3;
}

.achievement-progress {
    margin-top: 10px;
    font-size: 0.75em;
    color: var(--secondary-color);
}


/* Power-up animations */
@keyframes slideDown {
    from {
        transform: translateX(-50%) translateY(-20px);
        opacity: 0;
    }
    to {
        transform: translateX(-50%) translateY(0);
        opacity: 1;
    }
}

@keyframes slideUp {
    from {
        transform: translateX(-50%) translateY(0);
        opacity: 1;
    }
    to {
        transform: translateX(-50%) translateY(-20px);
        opacity: 0;
    }
}

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

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

/* Show mobile controls on touch devices */
@media (hover: none) and (pointer: coarse) {
    #mobileControls {
        display: block;
    }
}

/* Mobile overlay — hidden by default */
#mobileOverlay {
    display: none;
    position: fixed;
    top: 0; left: 0;
    width: 100%; height: 100%;
    background: #0f0f0f;
    z-index: 10000;
    justify-content: center;
    align-items: center;
    color: white;
}

/* Show mobile overlay on touch devices */
@media (hover: none) and (pointer: coarse) {
    #mobileOverlay {
        display: flex;
    }
}

/* Mobile hamburger menu — hidden on desktop */
#mobileMenuBtn {
    display: none;
}

#mobileMenu {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(0, 0, 0, 0.92);
    backdrop-filter: blur(12px);
    z-index: 2000;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
}

#mobileMenuContent {
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding: 20px 24px;
    max-width: 400px;
    margin: 0 auto;
}

#mobileMenuContent button {
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.15);
    color: white;
    padding: 16px 20px;
    border-radius: 12px;
    font-size: 17px;
    text-align: left;
    cursor: pointer;
    transition: background 0.2s;
}

#mobileMenuContent button:active {
    background: rgba(78, 205, 196, 0.2);
    border-color: rgba(78, 205, 196, 0.4);
}

/* Room display in header */
#roomDisplay {
    color: #FECA57;
    font-weight: 500;
    margin-right: 10px;
}

#roomDisplay:before {
    content: "Room: ";
    color: rgba(255, 255, 255, 0.5);
    font-weight: 400;
}

/* Settings Modal */
.settings-modal, .tutorial-modal {
    width: 500px;
    max-width: 90vw;
    max-height: 80vh;
    overflow-y: auto;
}

.settings-section, .tutorial-section {
    margin-bottom: 30px;
    padding: 20px;
    background: rgba(255, 255, 255, 0.03);
    border-radius: 12px;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.settings-section h3, .tutorial-section h3 {
    margin: 0 0 20px 0;
    color: #4ECDC4;
    font-size: 18px;
    font-weight: 600;
}

.setting-item {
    margin-bottom: 15px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.setting-item label {
    color: rgba(255, 255, 255, 0.9);
    font-size: 14px;
    flex: 1;
}

.setting-item input[type="range"] {
    width: 150px;
    margin: 0 15px;
}

.setting-item input[type="checkbox"] {
    width: 20px;
    height: 20px;
    cursor: pointer;
}

.setting-item span {
    color: #4ECDC4;
    font-weight: 600;
    min-width: 50px;
    text-align: right;
}

.tutorial-section p {
    color: rgba(255, 255, 255, 0.8);
    margin: 10px 0;
    line-height: 1.6;
}

.tutorial-section strong {
    color: #4ECDC4;
    font-weight: 600;
}

/* Voting Modal */
.voting-modal {
    width: 400px;
    max-width: 90vw;
}

#votingTimeLeft {
    text-align: center;
    color: #FECA57;
    font-size: 16px;
    margin-bottom: 20px;
    font-weight: 600;
}

#gameModeOptions {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-bottom: 20px;
}

.game-mode-option {
    padding: 15px;
    background: rgba(255, 255, 255, 0.05);
    border: 2px solid rgba(255, 255, 255, 0.1);
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s ease;
}

.game-mode-option:hover {
    background: rgba(78, 205, 196, 0.1);
    border-color: rgba(78, 205, 196, 0.3);
}

.game-mode-option.selected {
    background: rgba(78, 205, 196, 0.2);
    border-color: #4ECDC4;
}

.game-mode-option h3 {
    margin: 0 0 5px 0;
    color: #ffffff;
    font-size: 16px;
}

.game-mode-option p {
    margin: 0;
    color: rgba(255, 255, 255, 0.6);
    font-size: 13px;
}

#voteResults {
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.vote-result {
    display: flex;
    align-items: center;
    gap: 10px;
}

.vote-bar {
    flex: 1;
    height: 20px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 10px;
    overflow: hidden;
    position: relative;
}

.vote-fill {
    height: 100%;
    background: linear-gradient(90deg, #4ECDC4 0%, #44A08D 100%);
    transition: width 0.3s ease;
}

.vote-count {
    position: absolute;
    right: 10px;
    top: 50%;
    transform: translateY(-50%);
    color: white;
    font-size: 12px;
    font-weight: 600;
}

/* Game Info Panel */
#gameInfoPanel {
    position: fixed;
    top: 130px;
    right: 20px;
    left: auto;
    background: linear-gradient(135deg, rgba(15, 15, 15, 0.95) 0%, rgba(25, 25, 25, 0.95) 100%);
    backdrop-filter: blur(20px);
    border: 1px solid rgba(78, 205, 196, 0.2);
    border-radius: 16px;
    padding: 15px 20px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.4);
    display: none;
}

#gameModeName {
    color: #4ECDC4;
    font-size: 18px;
    font-weight: 600;
    margin-bottom: 10px;
}

#gameTimer {
    color: #FECA57;
    font-size: 24px;
    font-weight: 700;
    margin-bottom: 15px;
    text-align: center;
}

#scoreBoard {
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.score-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 5px;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 4px;
}

.score-item.self {
    background: rgba(78, 205, 196, 0.1);
    border: 1px solid rgba(78, 205, 196, 0.3);
}

.score-name {
    color: rgba(255, 255, 255, 0.9);
    font-size: 13px;
}

.score-value {
    color: #4ECDC4;
    font-weight: 600;
    font-size: 14px;
}

/* Results Modal */
.results-modal {
    width: 500px;
    max-width: 90vw;
}

#resultsContent {
    margin: 20px 0;
}

.result-item {
    display: flex;
    align-items: center;
    padding: 15px;
    margin-bottom: 10px;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 8px;
    border-left: 3px solid transparent;
}

.result-item.first {
    background: rgba(255, 215, 0, 0.1);
    border-left-color: #FFD700;
}

.result-item.second {
    background: rgba(192, 192, 192, 0.1);
    border-left-color: #C0C0C0;
}

.result-item.third {
    background: rgba(205, 127, 50, 0.1);
    border-left-color: #CD7F32;
}

.result-item.winner {
    animation: winnerGlow 2s ease-in-out infinite;
    box-shadow: 0 0 20px rgba(78, 205, 196, 0.5);
}

@keyframes winnerGlow {
    0%, 100% {
        box-shadow: 0 0 20px rgba(78, 205, 196, 0.5);
    }
    50% {
        box-shadow: 0 0 30px rgba(78, 205, 196, 0.8);
    }
}

/* ==============================================
   MOBILE — tablets and phones (max 768px)
   ============================================== */
@media (max-width: 768px) {

    /* Canvas: FULLSCREEN — everything else overlays on top */
    #gameCanvas {
        width: 100vw !important;
        max-width: 100vw;
        height: 100vh !important;
        max-height: 100vh;
        margin: 0;
        border-radius: 0;
        position: fixed;
        top: 0;
        left: 0;
        z-index: 1;
    }

    /* Info bar: small pill, top-left, overlays canvas */
    #info {
        top: 6px;
        left: 6px;
        right: auto;
        transform: none;
        padding: 5px 10px;
        gap: 8px;
        max-width: none;
        border-radius: 10px;
        display: flex;
        align-items: center;
        z-index: 100;
        background: rgba(15, 15, 15, 0.7);
        backdrop-filter: blur(8px);
    }

    /* Show room name on mobile */
    #infoLeft {
        display: flex;
        gap: 6px;
        align-items: center;
    }

    #infoLeft #status,
    #infoLeft #usernameDisplay {
        display: none;
    }

    #infoLeft #roomDisplay {
        font-size: 12px;
        max-width: 100px;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
    }

    /* Hide all desktop buttons on mobile */
    #infoButtons {
        display: none !important;
    }

    /* Show hamburger menu button */
    #mobileMenuBtn {
        display: block;
        background: rgba(78, 205, 196, 0.25);
        border: 1px solid rgba(78, 205, 196, 0.4);
        color: white;
        font-size: 20px;
        padding: 5px 10px;
        border-radius: 8px;
        cursor: pointer;
        line-height: 1;
    }

    /* Player list: hidden on mobile — accessible via menu */
    #playerList {
        display: none;
    }

    /* Currency: top-right overlay */
    #currencyDisplay {
        top: 6px;
        bottom: auto;
        right: 8px;
        gap: 4px;
        flex-direction: row;
        align-items: center;
        z-index: 100;
        background: rgba(15, 15, 15, 0.6);
        backdrop-filter: blur(6px);
        border-radius: 10px;
        padding: 4px 8px;
    }

    .currency-item {
        padding: 4px 10px;
        font-size: 13px;
        border-radius: 14px;
    }

    .currency-icon {
        font-size: 15px;
    }

    /* Game info panel: centered strip below info bar */
    #gameInfoPanel {
        top: 66px;
        right: auto;
        left: 50%;
        transform: translateX(-50%);
        min-width: unset;
        white-space: nowrap;
        padding: 6px 16px;
        display: flex;
        flex-direction: row;
        align-items: center;
        gap: 12px;
        border-left: none;
        border-top: 3px solid #4ECDC4;
        border-radius: 0 0 12px 12px;
    }

    #gameModeName {
        font-size: 13px;
        margin-bottom: 0;
    }

    #gameTimer {
        font-size: 22px;
        margin: 0;
    }

    #timerLabel {
        font-size: 9px;
        margin: 0;
    }

    #scoreBoard {
        font-size: 11px;
    }

    /* Event feed: smaller, right side */
    #eventFeed {
        top: auto;
        bottom: 260px;
        right: 8px;
        width: 160px;
    }

    .event-item {
        font-size: 11px !important;
        padding: 6px 10px !important;
    }

    /* Chat: bottom-left overlay, semi-transparent */
    #chatContainer {
        width: 200px;
        max-width: 45vw;
        height: 120px;
        bottom: 8px;
        left: 8px;
        font-size: 12px;
        z-index: 100;
        background: rgba(15, 15, 15, 0.6) !important;
        backdrop-filter: blur(6px);
    }

    #chatContainer.minimized {
        height: 30px;
        width: 70px;
        background: rgba(15, 15, 15, 0.5) !important;
    }

    /* Vote button: above joystick area */
    #startVoteBtn {
        bottom: 155px;
        padding: 8px 18px;
        font-size: 12px;
    }

    /* Joystick: bottom-right, overlays canvas, semi-transparent */
    #mobileControls {
        bottom: 15px;
        right: 15px;
        top: auto;
        transform: none;
        z-index: 100;
    }

    #joystickContainer {
        width: 120px;
        height: 120px;
        background: rgba(255, 255, 255, 0.08);
        border: 2px solid rgba(78, 205, 196, 0.35);
    }

    #joystick {
        width: 50px;
        height: 50px;
        opacity: 0.85;
    }

    /* Modals: fullscreen on mobile for readability */
    .modal {
        align-items: stretch;
    }

    .modal-content,
    .modal-content.room-modal,
    .modal-content.profile-modal,
    .modal-content.settings-modal,
    .modal-content.shop-modal,
    .modal-content.achievements-modal,
    .modal-content.tutorial-modal,
    .modal-content.daily-reward-modal,
    .modal-content.results-modal,
    .modal-content.voting-modal {
        width: 100vw !important;
        max-width: 100vw !important;
        height: 100vh !important;
        max-height: 100vh !important;
        margin: 0 !important;
        padding: 20px 24px;
        border-radius: 0 !important;
        border: none !important;
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
        background: rgba(15, 15, 15, 0.97);
    }

    /* Room list inside fullscreen modal should use available space */
    #roomList {
        max-height: calc(100vh - 140px);
    }

    .room-item {
        padding: 18px 16px;
        font-size: 16px;
        margin-bottom: 8px;
    }

    /* Close button */
    .close-btn {
        width: 40px !important;
        height: 40px !important;
        font-size: 22px !important;
        top: 10px !important;
        right: 10px !important;
    }

    /* All buttons in modals: large touch targets */
    .modal-content button,
    .save-btn,
    .modal-close-btn,
    #claimDailyBtn,
    #sendBtn,
    #reconnectBtn {
        min-height: 48px;
        font-size: 15px;
    }

    .modal-content input[type="text"],
    .modal-content input[type="email"],
    .modal-content input[type="password"] {
        min-height: 44px;
        font-size: 16px; /* prevents iOS zoom on focus */
    }

    .modal-content h2 {
        font-size: 22px !important;
        margin-bottom: 16px;
    }

    .modal-content p,
    .modal-content label {
        font-size: 15px;
    }

    /* Help modal tabs wrap on small screens */
    .help-tabs {
        gap: 4px;
        flex-wrap: wrap;
    }

    .help-tab {
        padding: 10px 14px !important;
        font-size: 14px !important;
        min-height: 44px;
    }

    /* Shop tabs */
    .shop-tab {
        padding: 10px 14px !important;
        font-size: 14px !important;
        min-height: 44px;
    }

    /* Shop grid: 2 columns on mobile, bigger cards */
    .shop-content {
        grid-template-columns: repeat(2, 1fr);
    }

    /* Tutorial modal wider */
    .tutorial-modal {
        width: 95vw !important;
        max-width: 95vw !important;
    }

    /* Alpha notices — hide on mobile to reduce clutter */
    .alpha-notice-page,
    .alpha-notice {
        display: none;
    }

    /* Event feed: right side, overlays canvas */
    #eventFeed {
        top: 40px;
        bottom: auto;
        right: 8px;
        width: 150px;
        z-index: 100;
    }

    .event-item {
        background: rgba(15, 15, 15, 0.6) !important;
        backdrop-filter: blur(4px);
    }

    /* Friends container: hidden on mobile */
    #friendsContainer {
        display: none;
    }

    /* Vote button: top area, overlays canvas */
    #startVoteBtn {
        bottom: auto;
        top: 42px;
        left: 6px;
        transform: none;
        padding: 6px 14px;
        font-size: 12px;
        z-index: 100;
        background: rgba(15, 15, 15, 0.7);
    }

    /* Game info panel: top-center overlay */
    #gameInfoPanel {
        top: 6px;
        left: 50%;
        right: auto;
        transform: translateX(-50%);
        z-index: 100;
        background: rgba(15, 15, 15, 0.7) !important;
        backdrop-filter: blur(6px);
    }
}

/* ==============================================
   MOBILE — small phones (max 480px)
   ============================================== */
@media (max-width: 480px) {
    /* Canvas is already fullscreen from 768px breakpoint — no changes needed */

    /* Joystick: slightly smaller on tiny screens */
    #joystickContainer {
        width: 100px;
        height: 100px;
    }

    #joystick {
        width: 44px;
        height: 44px;
    }

    /* Modals: tighter padding */
    .modal-content {
        padding: 12px 16px;
    }

    .tutorial-modal {
        width: 100vw !important;
        max-width: 100vw !important;
        border-radius: 12px 12px 0 0 !important;
        margin-bottom: 0 !important;
        align-self: flex-end;
    }
}

@keyframes announceIn {
    from {
        opacity: 0;
        transform: translate(-50%, -50%) scale(0.8);
    }
    to {
        opacity: 1;
        transform: translate(-50%, -50%) scale(1);
    }
}

@keyframes announceOut {
    from {
        opacity: 1;
        transform: translate(-50%, -50%) scale(1);
    }
    to {
        opacity: 0;
        transform: translate(-50%, -50%) scale(0.8);
    }
}

.result-rank {
    font-size: 24px;
    font-weight: 700;
    width: 40px;
    color: #4ECDC4;
}

.result-name {
    flex: 1;
    font-size: 16px;
    color: #ffffff;
}

.result-score {
    font-size: 20px;
    font-weight: 600;
    color: #FECA57;
}

#nextGameTimer {
    text-align: center;
    color: rgba(255, 255, 255, 0.6);
    font-size: 14px;
    margin-top: 20px;
}

/* ===== UI/HUD Enhancements ===== */

/* Timer urgency — flashes red when ≤ 10 s */
#gameTimer.urgent {
    color: #FF6B6B !important;
    text-shadow: 0 0 12px rgba(255, 107, 107, 0.8);
    animation: timerUrgent 0.5s ease-in-out infinite;
}

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

/* Improved game info panel */
#gameInfoPanel {
    border-left: 3px solid #4ECDC4 !important;
    min-width: 185px;
    animation: panelSlideIn 0.35s cubic-bezier(0.34, 1.56, 0.64, 1);
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.5),
                0 0 0 1px rgba(78, 205, 196, 0.12),
                0 0 40px rgba(78, 205, 196, 0.07) !important;
}

@keyframes panelSlideIn {
    from { transform: translateX(-24px); opacity: 0; }
    to   { transform: translateX(0);     opacity: 1; }
}

#gameModeName {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 13px !important;
    text-transform: uppercase;
    letter-spacing: 0.8px;
    opacity: 0.85;
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
    padding-bottom: 8px;
    margin-bottom: 8px !important;
}

/* Event feed — right side, below game info panel */
#eventFeed {
    position: fixed;
    top: 420px;
    right: 20px;
    width: 220px;
    pointer-events: none;
    z-index: 89;
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.event-item {
    background: rgba(8, 8, 12, 0.88);
    backdrop-filter: blur(14px);
    border: 1px solid rgba(255, 255, 255, 0.07);
    border-left: 3px solid #4ECDC4;
    border-radius: 8px;
    padding: 6px 12px;
    font-size: 12px;
    color: rgba(255, 255, 255, 0.88);
    animation: eventSlideIn 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
    transition: opacity 0.4s ease;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

@keyframes eventSlideIn {
    from { transform: translateX(28px); opacity: 0; }
    to   { transform: translateX(0);    opacity: 1; }
}

/* Low-health vignette */
#healthVignette {
    position: fixed;
    inset: 0;
    pointer-events: none;
    z-index: 6;
    background: radial-gradient(ellipse at center, transparent 33%, rgba(210, 25, 25, 0.52) 100%);
    opacity: 0;
    transition: opacity 0.4s ease;
}

#healthVignette.active {
    animation: vignetteFlash 1.3s ease-in-out infinite;
}

@keyframes vignetteFlash {
    0%, 100% { opacity: 0.45; }
    50%       { opacity: 0.85; }
}

/* Ping signal bars */
.ping-bars {
    display: inline-flex;
    align-items: flex-end;
    gap: 2px;
    height: 14px;
    margin: 0 3px;
    vertical-align: middle;
}

.ping-bar {
    width: 4px;
    background: rgba(255, 255, 255, 0.15);
    border-radius: 1px;
    transition: background 0.3s ease;
}

.ping-bar:nth-child(1) { height: 4px; }
.ping-bar:nth-child(2) { height: 7px; }
.ping-bar:nth-child(3) { height: 10px; }
.ping-bar:nth-child(4) { height: 14px; }

/* All 4 bars lit = excellent (teal) */
.ping-bars.excellent .ping-bar { background: #4ECDC4; }

/* 3 bars = good (teal) */
.ping-bars.good .ping-bar:nth-child(-n+3) { background: #4ECDC4; }

/* 2 bars = fair (yellow) */
.ping-bars.fair .ping-bar:nth-child(-n+2) { background: #FECA57; }

/* 1 bar = poor (red) */
.ping-bars.poor .ping-bar:nth-child(1) { background: #FF6B6B; }

/* ================================================================
   BIG VISUAL OVERHAUL
   ================================================================ */

/* 1. ANIMATED BACKGROUND BUBBLES */
#bgBubbles {
    position: fixed;
    inset: 0;
    pointer-events: none;
    z-index: 0;
    overflow: hidden;
}

.bg-bubble {
    position: absolute;
    border-radius: 50%;
    opacity: 0;
    filter: blur(1px);
    animation: bgBubbleFloat linear infinite;
}

@keyframes bgBubbleFloat {
    0%   { transform: translateY(0) translateX(0) scale(0.8); opacity: 0; }
    8%   { opacity: 0.18; }
    50%  { transform: translateY(-50vh) translateX(30px) scale(1); opacity: 0.12; }
    92%  { opacity: 0.08; }
    100% { transform: translateY(-110vh) translateX(-20px) scale(1.3); opacity: 0; }
}

/* 2. CANVAS GLOW */
#gameCanvas {
    border: 1px solid rgba(78, 205, 196, 0.35) !important;
    animation: canvasGlow 4s ease-in-out infinite;
}

@keyframes canvasGlow {
    0%, 100% {
        box-shadow:
            0 0 0 1px rgba(78, 205, 196, 0.08),
            0 0 40px rgba(78, 205, 196, 0.18),
            0 0 80px rgba(78, 205, 196, 0.06),
            0 20px 80px rgba(0, 0, 0, 0.5);
    }
    50% {
        box-shadow:
            0 0 0 1px rgba(78, 205, 196, 0.22),
            0 0 70px rgba(78, 205, 196, 0.32),
            0 0 140px rgba(78, 205, 196, 0.1),
            0 20px 80px rgba(0, 0, 0, 0.5);
    }
}

/* 3. INFO BAR REDESIGN */
#info {
    flex-direction: row !important;
    gap: 16px !important;
    padding: 10px 20px !important;
    border-radius: 20px !important;
    background: linear-gradient(135deg, rgba(10,10,18,0.92) 0%, rgba(20,20,32,0.92) 100%) !important;
    border: 1px solid rgba(78, 205, 196, 0.25) !important;
    box-shadow: 0 4px 30px rgba(0,0,0,0.4), 0 0 60px rgba(78,205,196,0.06) !important;
}

#infoLeft {
    display: flex;
    align-items: center;
    gap: 10px;
    flex: 1;
}

#infoButtons {
    display: flex;
    align-items: center;
    gap: 4px;
}

/* Icon+label nav buttons */
#infoButtons button {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
    padding: 6px 10px !important;
    background: rgba(255,255,255,0.06) !important;
    border: 1px solid rgba(255,255,255,0.1) !important;
    border-radius: 10px !important;
    cursor: pointer;
    transition: all 0.2s ease;
    margin: 0 !important;
    min-width: 50px;
}

#infoButtons button:hover {
    background: rgba(78,205,196,0.18) !important;
    border-color: rgba(78,205,196,0.5) !important;
    transform: translateY(-2px) !important;
    box-shadow: 0 4px 14px rgba(78,205,196,0.25);
}

.btn-icon {
    font-size: 18px;
    line-height: 1;
}

.btn-label {
    font-size: 9px;
    color: rgba(255,255,255,0.55);
    text-transform: uppercase;
    letter-spacing: 0.3px;
    font-weight: 500;
    font-family: 'Inter', sans-serif;
}

#infoButtons button:hover .btn-label {
    color: #4ECDC4;
}

/* 4. PLAYER LIST OVERHAUL */
#playerList {
    border: 1px solid rgba(78,205,196,0.22) !important;
    background: linear-gradient(160deg, rgba(10,10,18,0.96) 0%, rgba(18,18,30,0.96) 100%) !important;
    box-shadow: 0 10px 50px rgba(0,0,0,0.5), 0 0 60px rgba(78,205,196,0.05) !important;
}

#playerListHeader {
    background: linear-gradient(90deg, rgba(78,205,196,0.15) 0%, rgba(78,205,196,0.05) 100%) !important;
    padding: 10px 16px !important;
    gap: 8px;
}

.panel-icon {
    font-size: 16px;
}

#playerListHeader h3 {
    font-size: 12px !important;
    text-transform: uppercase;
    letter-spacing: 1px;
}

/* Player card */
.player-card {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 12px;
    margin-bottom: 6px;
    background: rgba(255,255,255,0.04);
    border-radius: 10px;
    border: 1px solid rgba(255,255,255,0.06);
    transition: all 0.2s ease;
    position: relative;
    animation: cardSlideIn 0.3s ease-out;
}

@keyframes cardSlideIn {
    from { transform: translateX(20px); opacity: 0; }
    to   { transform: translateX(0);    opacity: 1; }
}

.player-card:hover {
    background: rgba(255,255,255,0.08);
    border-color: rgba(78,205,196,0.2);
    transform: translateX(-2px);
}

.player-card.self {
    background: rgba(78,205,196,0.08);
    border-color: rgba(78,205,196,0.3);
}

.player-card.self::before {
    content: '';
    position: absolute;
    left: 0; top: 0; bottom: 0;
    width: 3px;
    background: #4ECDC4;
    border-radius: 10px 0 0 10px;
}

/* Avatar circle */
.player-avatar {
    position: relative;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 10px rgba(0,0,0,0.3);
}

.player-avatar canvas {
    display: block;
}

.player-avatar-ring {
    position: absolute;
    inset: -2px;
    border-radius: 50%;
    border: 2px solid transparent;
    background: conic-gradient(from 0deg, var(--pcolor) 0%, transparent 60%) border-box;
    -webkit-mask: linear-gradient(#fff 0 0) padding-box, linear-gradient(#fff 0 0);
    -webkit-mask-composite: destination-out;
    mask-composite: exclude;
    animation: ringRotate 3s linear infinite;
    opacity: 0.6;
}

@keyframes ringRotate { to { transform: rotate(360deg); } }

/* Player info section */
.player-info {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 3px;
}

.player-name-row {
    display: flex;
    align-items: center;
    gap: 5px;
}

.player-name-text {
    font-size: 13px;
    font-weight: 600;
    color: #fff;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.player-badge {
    font-size: 13px;
    line-height: 1;
    flex-shrink: 0;
}

.player-meta {
    display: flex;
    align-items: center;
    gap: 6px;
}

.player-status-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: #4EFF4E;
    box-shadow: 0 0 5px rgba(78,255,78,0.6);
    flex-shrink: 0;
}

.player-status-dot.away {
    background: #FECA57;
    box-shadow: 0 0 5px rgba(254,202,87,0.6);
}

.player-status-dot.disconnected {
    background: #FF6B6B;
    box-shadow: 0 0 5px rgba(255,107,107,0.6);
}

.player-status-label {
    font-size: 10px;
    color: rgba(255,255,255,0.45);
}

/* 5. GAME INFO PANEL OVERHAUL */
#gameInfoPanel {
    top: 130px !important;
    right: 20px !important;
    left: auto !important;
    min-width: 200px !important;
    padding: 18px 22px !important;
    background: linear-gradient(160deg, rgba(8,8,18,0.97) 0%, rgba(15,15,28,0.97) 100%) !important;
    border: 1px solid rgba(78,205,196,0.3) !important;
    border-left: 3px solid #4ECDC4 !important;
    box-shadow: 0 15px 60px rgba(0,0,0,0.6), 0 0 80px rgba(78,205,196,0.08) !important;
}

#gameModeName {
    font-size: 11px !important;
    color: rgba(78,205,196,0.8) !important;
    text-transform: uppercase !important;
    letter-spacing: 1.5px !important;
    font-weight: 700 !important;
    display: flex !important;
    align-items: center !important;
    gap: 6px !important;
    padding-bottom: 10px !important;
    border-bottom: 1px solid rgba(255,255,255,0.07) !important;
    margin-bottom: 10px !important;
}

#gameTimer {
    font-size: 52px !important;
    font-weight: 800 !important;
    letter-spacing: -2px !important;
    text-align: center !important;
    color: #fff !important;
    line-height: 1 !important;
    margin-bottom: 4px !important;
    text-shadow: 0 0 30px rgba(255,255,255,0.15);
}

#timerLabel {
    text-align: center;
    font-size: 10px;
    color: rgba(255,255,255,0.3);
    text-transform: uppercase;
    letter-spacing: 2px;
    margin-bottom: 12px;
}

#scoreBoard {
    margin-top: 12px;
    border-top: 1px solid rgba(255,255,255,0.07);
    padding-top: 10px;
}

.score-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 8px !important;
    border-radius: 8px !important;
    margin-bottom: 4px;
}

.score-rank-emoji {
    font-size: 14px;
    width: 20px;
    text-align: center;
    flex-shrink: 0;
}

.score-name {
    flex: 1;
    font-size: 12px !important;
}

.score-value {
    font-size: 15px !important;
    font-weight: 700 !important;
}

/* 6. CHAT BUBBLE IMPROVEMENTS */
.chatMessage {
    padding: 7px 12px !important;
    border-radius: 10px !important;
    border-left: 3px solid #4ECDC4;
    position: relative;
}

.chatMessage.own-message {
    background: rgba(78,205,196,0.1) !important;
    border-left-color: #4ECDC4;
}

.chatMessage.system-message {
    border-left-color: #FF6B6B !important;
    background: rgba(255,107,107,0.08) !important;
}

.chatMessage .sender {
    font-size: 12px !important;
    font-weight: 700 !important;
}

#chatHeader h3 {
    font-size: 12px !important;
    text-transform: uppercase;
    letter-spacing: 1px;
}

#chatContainer {
    border: 1px solid rgba(78,205,196,0.25) !important;
    background: linear-gradient(160deg, rgba(8,8,18,0.97) 0%, rgba(15,15,28,0.97) 100%) !important;
    box-shadow: 0 10px 50px rgba(0,0,0,0.5), 0 0 60px rgba(78,205,196,0.05) !important;
}

/* 7. FRIENDS PANEL MATCH */
#friendsContainer {
    border: 1px solid rgba(78,205,196,0.22) !important;
    background: linear-gradient(160deg, rgba(10,10,18,0.96) 0%, rgba(18,18,30,0.96) 100%) !important;
}

/* 8. VOTE BUTTON */
#startVoteBtn {
    background: linear-gradient(135deg, #a29bfe 0%, #6c5ce7 100%) !important;
    box-shadow: 0 4px 20px rgba(108,92,231,0.4) !important;
    font-size: 15px !important;
    letter-spacing: 0.5px !important;
}

#startVoteBtn:hover {
    box-shadow: 0 6px 30px rgba(108,92,231,0.6) !important;
}


/* ================================================================
   MODAL REDESIGN
   ================================================================ */

/* Backdrop */
.modal {
    background: rgba(0,0,0,0.88) !important;
    backdrop-filter: blur(18px) !important;
}

/* Base card */
.modal-content {
    background: linear-gradient(160deg, rgba(10,10,20,0.98) 0%, rgba(16,16,30,0.98) 100%) !important;
    border: 1px solid rgba(78,205,196,0.2) !important;
    border-top: 2px solid rgba(78,205,196,0.5) !important;
    box-shadow:
        0 30px 80px rgba(0,0,0,0.7),
        0 0 0 1px rgba(255,255,255,0.04) inset,
        0 0 120px rgba(78,205,196,0.08) !important;
    animation: modalPop 0.35s cubic-bezier(0.34,1.56,0.64,1) !important;
}

@keyframes modalPop {
    from { transform: translateY(30px) scale(0.95); opacity: 0; }
    to   { transform: translateY(0)    scale(1);    opacity: 1; }
}

/* H2 modal title */
.modal-content h2 {
    font-size: 22px !important;
    font-weight: 700 !important;
    letter-spacing: -0.3px !important;
    padding-bottom: 16px !important;
    border-bottom: 1px solid rgba(255,255,255,0.07) !important;
    margin-bottom: 24px !important;
}

/* ---- CLOSE BUTTON ---- */
.close-btn {
    position: absolute !important;
    top: 14px !important;
    right: 14px !important;
    width: 32px !important;
    height: 32px !important;
    padding: 0 !important;
    background: rgba(255,255,255,0.08) !important;
    border: 1px solid rgba(255,255,255,0.18) !important;
    border-radius: 50% !important;
    color: rgba(255,255,255,0.7) !important;
    font-size: 18px !important;
    font-weight: 400 !important;
    line-height: 1 !important;
    cursor: pointer !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    transition: all 0.2s ease !important;
    box-shadow: none !important;
}

.close-btn:hover {
    background: rgba(255,107,107,0.3) !important;
    border-color: #FF6B6B !important;
    color: #FF6B6B !important;
    transform: scale(1.15) rotate(90deg) !important;
    box-shadow: 0 0 12px rgba(255,107,107,0.4) !important;
}

/* ---- SETTINGS SECTIONS ---- */
.settings-section {
    background: rgba(255,255,255,0.03) !important;
    border: 1px solid rgba(255,255,255,0.07) !important;
    border-radius: 14px !important;
    padding: 18px 20px !important;
    margin-bottom: 14px !important;
}

.settings-section h3 {
    font-size: 13px !important;
    text-transform: uppercase !important;
    letter-spacing: 1.2px !important;
    color: #4ECDC4 !important;
    margin: 0 0 16px 0 !important;
    padding-left: 10px !important;
    border-left: 3px solid #4ECDC4 !important;
}

/* Settings section icons via ::before */
.settings-section:nth-child(2) h3::before { content: '🔊 '; }
.settings-section:nth-child(3) h3::before { content: '🎨 '; }
.settings-section:nth-child(4) h3::before { content: '🎮 '; }

.setting-item {
    display: flex !important;
    align-items: center !important;
    justify-content: space-between !important;
    padding: 8px 0 !important;
    border-bottom: 1px solid rgba(255,255,255,0.04) !important;
}
.setting-item:last-child { border-bottom: none !important; }

.setting-item label {
    color: rgba(255,255,255,0.82) !important;
    font-size: 13px !important;
}

/* Range sliders */
.setting-item input[type="range"] {
    accent-color: #4ECDC4;
    height: 4px;
}

/* Checkboxes */
.setting-item input[type="checkbox"] {
    accent-color: #4ECDC4;
    width: 18px !important;
    height: 18px !important;
    cursor: pointer !important;
}

/* ---- TUTORIAL SECTIONS ---- */
.tutorial-section {
    background: rgba(255,255,255,0.03) !important;
    border: 1px solid rgba(255,255,255,0.07) !important;
    border-radius: 14px !important;
    padding: 16px 20px !important;
    margin-bottom: 12px !important;
    text-align: left !important;
}

.tutorial-section h3 {
    font-size: 13px !important;
    text-transform: uppercase !important;
    letter-spacing: 1px !important;
    color: #FECA57 !important;
    margin: 0 0 10px 0 !important;
    padding-left: 10px !important;
    border-left: 3px solid #FECA57 !important;
}

/* Tutorial section icons */
.tutorial-section:nth-child(2) h3::before { content: '🕹️ '; }
.tutorial-section:nth-child(3) h3::before { content: '💬 '; }
.tutorial-section:nth-child(4) h3::before { content: '👤 '; }
.tutorial-section:nth-child(5) h3::before { content: '🚪 '; }

.tutorial-section p {
    font-size: 13px !important;
    color: rgba(255,255,255,0.72) !important;
    margin: 6px 0 !important;
    line-height: 1.6 !important;
}

.tutorial-section strong { color: #4ECDC4 !important; }

/* ---- PROFILE SECTIONS ---- */
.profile-section {
    text-align: left !important;
    margin-bottom: 18px !important;
    padding: 14px 16px !important;
    background: rgba(255,255,255,0.03) !important;
    border: 1px solid rgba(255,255,255,0.07) !important;
    border-radius: 12px !important;
}

.profile-section label {
    display: flex !important;
    align-items: center !important;
    gap: 6px !important;
    font-size: 11px !important;
    text-transform: uppercase !important;
    letter-spacing: 1.2px !important;
    color: #4ECDC4 !important;
    margin-bottom: 10px !important;
    font-weight: 700 !important;
}

/* Profile section icons */
.profile-section:nth-child(2) > label::before { content: '👤 '; }
.profile-section:nth-child(3) > label::before { content: '🎨 '; }
.profile-section:nth-child(4) > label::before { content: '🔷 '; }
.profile-section:nth-child(5) > label::before { content: '🔍 '; }
.profile-section:nth-child(6) > label::before { content: '📊 '; }

/* ---- SAVE / ACTION BUTTON ---- */
.save-btn {
    background: linear-gradient(135deg, #4ECDC4 0%, #44A08D 100%) !important;
    border-radius: 12px !important;
    font-size: 15px !important;
    font-weight: 700 !important;
    letter-spacing: 0.5px !important;
    padding: 14px !important;
    box-shadow: 0 4px 20px rgba(78,205,196,0.35) !important;
    transition: all 0.25s ease !important;
}

.save-btn:hover {
    transform: translateY(-2px) !important;
    box-shadow: 0 8px 30px rgba(78,205,196,0.5) !important;
}

/* ---- MODAL CLOSE BUTTON LABEL ---- */
.modal-close-btn {
    background: rgba(255,255,255,0.08) !important;
    border: 1px solid rgba(255,255,255,0.15) !important;
    border-radius: 10px !important;
    color: rgba(255,255,255,0.8) !important;
    font-size: 14px !important;
    padding: 10px 24px !important;
    cursor: pointer !important;
    transition: all 0.2s ease !important;
    width: auto !important;
    margin-top: 16px !important;
    box-shadow: none !important;
}
.modal-close-btn:hover {
    background: rgba(255,255,255,0.14) !important;
    border-color: #4ECDC4 !important;
    color: #4ECDC4 !important;
    transform: none !important;
    box-shadow: none !important;
}

/* ---- VOTING MODAL ---- */
.voting-modal h2::before { content: '🗳️ '; }

#votingTimeLeft {
    font-size: 13px !important;
    padding: 8px 16px !important;
    background: rgba(254,202,87,0.1) !important;
    border: 1px solid rgba(254,202,87,0.3) !important;
    border-radius: 20px !important;
    display: inline-block !important;
    margin-bottom: 20px !important;
}

.game-mode-option {
    border-radius: 12px !important;
    padding: 14px 18px !important;
    text-align: left !important;
}

.game-mode-option h3 {
    font-size: 15px !important;
    margin-bottom: 4px !important;
}

/* ---- RESULTS MODAL ---- */
.results-modal h2::before { content: '🏆 '; }

.result-item {
    border-radius: 12px !important;
    padding: 12px 16px !important;
    gap: 12px !important;
}

.result-rank {
    font-size: 22px !important;
    width: 36px !important;
}

/* ---- ROOM MODAL ---- */
.room-modal h2::before { content: '🚪 '; }

.room-item {
    border-radius: 12px !important;
    padding: 14px 18px !important;
}

/* ---- SHOP TAB OVERRIDE ---- */
/* Undo broad .modal-content button styles for shop tabs */
.shop-tab {
    width: auto !important;
    padding: 10px 20px !important;
    background: none !important;
    border: none !important;
    border-bottom: 2px solid transparent !important;
    border-radius: 0 !important;
    color: rgba(255, 255, 255, 0.6) !important;
    font-size: 15px !important;
    font-weight: 500 !important;
    box-shadow: none !important;
    letter-spacing: normal !important;
    transform: none !important;
}
.shop-tab:hover {
    color: rgba(255, 255, 255, 0.9) !important;
    transform: none !important;
    box-shadow: none !important;
    background: none !important;
}
.shop-tab.active {
    color: #4ECDC4 !important;
    border-bottom-color: #4ECDC4 !important;
    background: none !important;
    box-shadow: none !important;
}
.btn-confirm {
    width: auto !important;
    padding: 10px 30px !important;
    border-radius: 5px !important;
    background: #4ECDC4 !important;
    color: #000 !important;
    font-weight: bold !important;
    letter-spacing: normal !important;
}
.btn-cancel {
    width: auto !important;
    padding: 10px 30px !important;
    border-radius: 5px !important;
    background: #FF6B6B !important;
    color: #fff !important;
    letter-spacing: normal !important;
    box-shadow: none !important;
}
.btn-cancel:hover {
    background: #e05555 !important;
    transform: translateY(-1px) !important;
}

/* ========== HELP / TUTORIAL REDESIGN ========== */

.tutorial-modal {
    width: 620px !important;
    max-width: 96vw !important;
    max-height: 88vh !important;
    overflow-y: auto !important;
}

/* Help tabs row */
.help-tabs {
    display: flex;
    gap: 6px;
    margin-bottom: 18px;
    border-bottom: 2px solid rgba(255,255,255,0.08);
    flex-wrap: wrap;
}

.help-tab {
    width: auto !important;
    padding: 10px 18px !important;
    background: none !important;
    border: none !important;
    border-bottom: 2px solid transparent !important;
    border-radius: 0 !important;
    color: rgba(255,255,255,0.55) !important;
    font-size: 15px !important;
    font-weight: 500 !important;
    box-shadow: none !important;
    letter-spacing: normal !important;
    cursor: pointer !important;
    transition: color 0.2s, border-color 0.2s !important;
    transform: none !important;
    margin-bottom: -2px;
}
.help-tab:hover {
    color: rgba(255,255,255,0.9) !important;
    background: none !important;
    box-shadow: none !important;
    transform: none !important;
}
.help-tab.active {
    color: #FECA57 !important;
    border-bottom-color: #FECA57 !important;
    background: none !important;
    box-shadow: none !important;
}

/* Tab content panels */
.help-tab-content {
    display: none;
}
.help-tab-content.active {
    display: block;
}

/* Key bindings grid */
.key-grid {
    margin-top: 12px;
    display: flex;
    flex-direction: column;
    gap: 6px;
}
.key-row {
    display: flex;
    align-items: center;
    gap: 10px;
}
.key {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 46px;
    padding: 5px 12px;
    background: rgba(255,255,255,0.1);
    border: 1px solid rgba(255,255,255,0.2);
    border-radius: 6px;
    font-family: monospace;
    font-size: 15px;
    font-weight: 700;
    color: #FECA57;
    box-shadow: 0 2px 0 rgba(0,0,0,0.4);
    white-space: nowrap;
}
.key-desc {
    font-size: 15px;
    color: rgba(255,255,255,0.8);
}

/* Mode card badges */
.mode-req {
    font-size: 12px;
    font-weight: 400;
    color: rgba(255,255,255,0.4);
    margin-left: 8px;
}

/* Power-up list */
.powerup-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-top: 10px;
}
.powerup-item {
    display: flex;
    align-items: flex-start;
    gap: 14px;
    background: rgba(255,255,255,0.04);
    border-radius: 10px;
    padding: 10px 14px;
}
.powerup-icon {
    font-size: 26px;
    flex-shrink: 0;
    line-height: 1.2;
}
.powerup-item strong {
    color: #4ECDC4;
}
.powerup-item div {
    font-size: 15px;
    color: rgba(255,255,255,0.82);
    line-height: 1.6;
}

/* Tips list */
.tip-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-top: 8px;
}
.tip-item {
    background: rgba(255,255,255,0.04);
    border-left: 3px solid #FECA57;
    border-radius: 0 8px 8px 0;
    padding: 10px 16px;
    font-size: 15px;
    color: rgba(255,255,255,0.85);
    line-height: 1.6;
}
.tip-item strong {
    color: #4ECDC4;
}

/* Override tutorial-section styles inside help modal for consistency */
.tutorial-modal .tutorial-section {
    margin-bottom: 12px !important;
    padding: 16px 18px !important;
}
.tutorial-modal .tutorial-section h3 {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 15px !important;
    text-transform: uppercase !important;
    letter-spacing: 0.8px !important;
    color: #FECA57 !important;
    margin: 0 0 12px 0 !important;
    padding-left: 10px !important;
    border-left: 3px solid #FECA57 !important;
}
.tutorial-modal .tutorial-section p {
    font-size: 15px !important;
    color: rgba(255,255,255,0.82) !important;
    line-height: 1.65 !important;
    margin: 7px 0 !important;
}
/* Remove the nth-child emoji injections for tutorial sections inside help modal */
.tutorial-modal .tutorial-section:nth-child(n) h3::before { content: '' !important; }

/* ========== ALPHA NOTICE — PAGE (below canvas) ========== */

.alpha-notice-page {
    position: fixed;
    top: 700px;
    left: 50%;
    transform: translateX(-50%);
    width: auto;
    animation: alphaFlash 1.2s ease-in-out infinite;
    z-index: 50;
    user-select: none;
}

.alpha-notice-page .alpha-badge {
    display: inline-block;
    cursor: pointer;
    padding: 5px 14px;
    border-radius: 6px;
    font-size: 12px;
    letter-spacing: 1px;
}

.alpha-notice-page.acknowledged {
    animation: none;
}

.alpha-notice-page.acknowledged .alpha-badge {
    background: rgba(255, 68, 68, 0.4);
}

/* Dropdown panel — hidden by default, opens upward */
.alpha-notice-dropdown {
    display: none;
    position: absolute;
    bottom: calc(100% + 8px);
    left: 50%;
    transform: translateX(-50%);
    width: 320px;
    background: rgba(30, 10, 10, 0.97);
    border: 2px solid #FF4444;
    border-radius: 10px;
    padding: 14px 16px;
    box-shadow: 0 -8px 30px rgba(255, 68, 68, 0.25);
}

.alpha-notice-page.open .alpha-notice-dropdown {
    display: block;
}

.alpha-notice-dropdown p {
    margin: 0;
    font-size: 14px;
    color: rgba(255, 200, 200, 0.9);
    line-height: 1.6;
}

.alpha-notice-dropdown strong {
    color: #FF8888;
}

/* ========== ALPHA NOTICE ========== */

@keyframes alphaFlash {
    0%, 100% {
        border-color: #FF4444;
        box-shadow: 0 0 0 0 rgba(255, 68, 68, 0);
    }
    50% {
        border-color: #FF8888;
        box-shadow: 0 0 14px 4px rgba(255, 68, 68, 0.5);
    }
}

.alpha-notice {
    margin-top: 18px;
    background: rgba(180, 30, 30, 0.18);
    border: 2px solid #FF4444;
    border-radius: 10px;
    padding: 14px 18px;
    cursor: pointer;
    animation: alphaFlash 1.2s ease-in-out infinite;
    transition: background 0.3s;
    user-select: none;
}

.alpha-notice.acknowledged {
    animation: none;
    border-color: rgba(255, 68, 68, 0.4);
    background: rgba(180, 30, 30, 0.08);
    cursor: default;
}

.alpha-notice-header {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 8px;
}

.alpha-badge {
    background: #FF4444;
    color: #fff;
    font-size: 11px;
    font-weight: 800;
    letter-spacing: 1.5px;
    padding: 3px 10px;
    border-radius: 4px;
}

.alpha-notice.acknowledged .alpha-badge {
    background: rgba(255, 68, 68, 0.5);
}

.alpha-notice p {
    margin: 0;
    font-size: 13px;
    color: rgba(255, 200, 200, 0.9);
    line-height: 1.6;
}

.alpha-notice strong {
    color: #FF8888;
}
