/* Login Screen */
.card {
    background: var(--bg-glass-strong);
    padding: 2rem;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
    text-align: center;
    width: 95%;
    max-width: 900px;
    backdrop-filter: blur(20px);
    position: relative;
    overflow: visible;
    display: flex;
    flex-direction: column;
    height: 680px;
}

.card::before {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0; height: 4px;
    background: linear-gradient(90deg, var(--primary), var(--accent));
    border-top-left-radius: var(--radius-lg);
    border-top-right-radius: var(--radius-lg);
}

.game-logo {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.logo-icon {
    width: 60px;
    height: 60px;
    background: linear-gradient(135deg, var(--primary), var(--accent));
    border-radius: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.8rem;
    color: white;
    box-shadow: 0 10px 20px rgba(99, 102, 241, 0.3);
    transform: rotate(-5deg);
}

.game-logo h1 {
    font-family: 'Orbitron', sans-serif;
    font-size: 3.5rem;
    margin: 0;
    background: linear-gradient(to right, #60a5fa, #a78bfa, #f472b6, #fbbf24, #34d399, #60a5fa);
    background-size: 200% auto;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    text-shadow: 
        0 0 2px #fff,
        0 0 5px #fff,
        0 0 10px #a78bfa,
        0 0 20px #a78bfa,
        0 0 40px #60a5fa,
        0 0 80px #60a5fa;
    letter-spacing: -1px;
    animation: shine 4s linear infinite;
}

@keyframes shine {
    to {
        background-position: 200% center;
    }
}

.login-content {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 3rem;
    text-align: left;
    flex: 1;
}

@media (max-width: 768px) {
    .login-content {
        grid-template-columns: 1fr;
        gap: 2rem;
    }
}

.login-avatar-side {
    display: flex;
    flex-direction: column;
    align-items: center;
    border-right: 1px solid var(--border-color);
    padding-right: 3rem;
}

@media (max-width: 768px) {
    .login-avatar-side {
        border-right: none;
        border-bottom: 1px solid var(--border-color);
        padding-right: 0;
        padding-bottom: 2rem;
    }
}

.login-form-side {
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
    padding-top: 1rem;
}

.avatar-section {
    width: 100%;
    text-align: center;
}

.avatar-section h3 {
    margin-bottom: 1.5rem;
    color: var(--text-dim);
    font-size: 1rem;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.avatar-tabs {
    display: inline-flex;
    justify-content: center;
    margin-bottom: 2rem;
    background: rgba(0, 0, 0, 0.3);
    padding: 4px;
    border-radius: 8px;
    border: 1px solid var(--border-color);
    min-width: 320px;
}

.tab-btn {
    background: transparent;
    border: none;
    color: var(--text-dim);
    padding: 0.6rem 1rem;
    font-size: 0.8rem;
    border-radius: 6px;
    backdrop-filter: none;
    cursor: pointer;
    transition: all 0.3s ease;
    font-family: 'Orbitron', sans-serif;
    text-transform: uppercase;
    letter-spacing: 1px;
    flex: 1;
}

.tab-btn:hover {
    color: var(--text-main);
    background: rgba(255, 255, 255, 0.05);
    box-shadow: none;
    transform: none;
}

.tab-btn.active {
    background: var(--primary);
    color: white;
    box-shadow: 0 2px 10px rgba(99, 102, 241, 0.4);
}

.avatar {
    width: 140px;
    height: 140px;
    border-radius: 28px;
    margin: 0 auto 2rem;
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 5rem;
    border: 4px solid rgba(255, 255, 255, 0.1);
    box-shadow: 0 0 40px rgba(0, 0, 0, 0.3);
    background-color: #3498db;
    overflow: hidden;
    transition: transform 0.3s;
}

#avatar-preview {
    padding-bottom: 8px; /* Visual centering fix for emojis */
}

.avatar:hover {
    transform: scale(1.05);
    border-color: var(--primary);
}

canvas.avatar {
    background: white;
    cursor: crosshair;
}

.avatar-mode-content {
    min-height: 100px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.controls {
    width: 100%;
}

.upload-container {
    margin-bottom: 1rem;
}

.zoom-slider {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-top: 0.5rem;
    justify-content: center;
}

.small-icon {
    color: var(--text-dim);
    font-size: 0.8rem;
}

.help-text {
    font-size: 0.75rem;
    color: var(--text-dim);
    margin-top: 0.8rem;
    opacity: 0.8;
}

.control-row {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 1rem;
    margin-bottom: 1rem;
}

.color-trigger {
    width: 32px;
    height: 32px;
    border-radius: var(--radius-sm);
    border: 2px solid var(--border-color);
    padding: 2px;
    cursor: pointer;
    transition: all 0.2s;
    background: rgba(255, 255, 255, 0.05);
    display: inline-block;
    vertical-align: middle;
}

.color-trigger:hover {
    border-color: var(--text-main);
    transform: scale(1.05);
}

#emoji-color-preview, #avatar-color-preview {
    width: 100%;
    height: 100%;
    border-radius: 2px;
    background-color: #000000;
    box-shadow: inset 0 0 5px rgba(0,0,0,0.2);
}

/* Emoji Picker */
.emoji-picker-wrapper {
    position: relative;
    width: 80px;
}

.emoji-picker-trigger {
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 0.5rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    cursor: pointer;
    transition: all 0.2s;
    color: var(--text-main);
    font-size: 1.2rem;
}

.emoji-picker-trigger i {
    font-size: 0.8rem;
    color: var(--text-dim);
}

.emoji-picker-trigger:hover {
    background: rgba(255, 255, 255, 0.1);
    border-color: var(--primary);
}

.emoji-options {
    position: absolute;
    top: calc(100% + 10px);
    left: 50%;
    transform: translateX(-50%);
    width: 320px;
    max-height: 300px;
    overflow-y: auto;
    background: var(--bg-glass-strong);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 0.8rem;
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(40px, 1fr));
    gap: 8px;
    z-index: 1000;
    backdrop-filter: blur(10px);
    box-shadow: 0 10px 30px rgba(0,0,0,0.5);
}

/* Custom Scrollbar for Emoji Picker */
.emoji-options::-webkit-scrollbar {
    width: 6px;
}

.emoji-options::-webkit-scrollbar-track {
    background: rgba(0, 0, 0, 0.1);
    border-radius: 3px;
}

.emoji-options::-webkit-scrollbar-thumb {
    background: var(--primary);
    border-radius: 3px;
}

.emoji-options::-webkit-scrollbar-thumb:hover {
    background: var(--accent);
}

.emoji-options.open-up {
    top: auto;
    bottom: calc(100% + 10px);
}

.emoji-options.open-up::before {
    top: auto;
    bottom: -6px;
    border-bottom: none;
    border-top: 6px solid var(--border-color);
}

.emoji-options.open-up::after {
    top: auto;
    bottom: -5px;
    border-bottom: none;
    border-top: 5px solid var(--bg-glass-strong);
}

.emoji-options::before {
    content: '';
    position: absolute;
    top: -6px;
    left: 50%;
    transform: translateX(-50%);
    border-left: 6px solid transparent;
    border-right: 6px solid transparent;
    border-bottom: 6px solid var(--border-color);
}

.emoji-options::after {
    content: '';
    position: absolute;
    top: -5px;
    left: 50%;
    transform: translateX(-50%);
    border-left: 5px solid transparent;
    border-right: 5px solid transparent;
    border-bottom: 5px solid var(--bg-glass-strong);
}

.emoji-option {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 5px;
    cursor: pointer;
    border-radius: 4px;
    font-size: 1.4rem;
    transition: all 0.2s;
}

.emoji-option:hover {
    background: rgba(255, 255, 255, 0.1);
    transform: scale(1.2);
}

.emoji-option.selected {
    background: var(--primary);
    box-shadow: 0 0 10px var(--primary-glow);
}

.mini-toolbar {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    flex-wrap: wrap;
    background: rgba(0,0,0,0.2);
    padding: 0.5rem;
    border-radius: var(--radius-md);
}

.avatar-tools-row {
    display: flex;
    align-items: center;
    gap: 5px;
}

.avatar-sliders {
    display: flex;
    align-items: center;
    margin-left: 10px;
    padding-left: 10px;
    border-left: 1px solid var(--border-color);
}

.small-btn {
    padding: 0.4rem 0.8rem;
    font-size: 0.8rem;
    min-width: auto;
}

.form-group {
    margin-bottom: 1.5rem;
}

.form-group label {
    display: block;
    color: var(--text-dim);
    margin-bottom: 0.5rem;
    font-size: 0.9rem;
    margin-left: 5px;
}

.room-controls {
    margin-top: 1rem;
    padding-top: 1rem;
    border-top: 1px solid var(--border-color);
}

.divider {
    display: flex;
    align-items: center;
    text-align: center;
    margin: 1.5rem 0;
    color: var(--text-dim);
    font-size: 0.8rem;
}

.divider::before, .divider::after {
    content: '';
    flex: 1;
    border-bottom: 1px solid var(--border-color);
}

.divider span {
    padding: 0 10px;
}

.full-width {
    width: 100%;
}

.emoji-category-header {
    grid-column: 1 / -1;
    font-size: 0.75rem;
    color: var(--text-dim);
    text-transform: uppercase;
    letter-spacing: 1px;
    padding: 8px 4px 4px;
    margin-top: 4px;
    border-bottom: 1px solid var(--border-color);
    margin-bottom: 4px;
}

.emoji-category-header:first-child {
    margin-top: 0;
}

/* Public Lobbies */
.public-lobbies-section {
    margin-bottom: 1.5rem;
}

.public-lobbies-section label {
    display: block;
    color: var(--text-dim);
    margin-bottom: 0.5rem;
    font-size: 0.9rem;
    margin-left: 5px;
}

.lobbies-list {
    background: rgba(0, 0, 0, 0.2);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    max-height: 150px;
    overflow-y: auto;
    padding: 0.5rem;
}

.lobby-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.5rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    transition: background 0.2s;
}

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

.lobby-item:hover {
    background: rgba(255, 255, 255, 0.05);
}

.lobby-info {
    display: flex;
    align-items: center;
    gap: 1rem;
    font-size: 0.9rem;
}

.lobby-code {
    font-weight: bold;
    color: var(--primary);
}

.lobby-players {
    color: var(--text-dim);
    display: flex;
    align-items: center;
    gap: 4px;
}

.lobby-status {
    font-size: 0.75rem;
    padding: 2px 6px;
    border-radius: 4px;
    background: rgba(255, 255, 255, 0.1);
}

.status-lobby { color: var(--success); background: rgba(46, 204, 113, 0.2); }
.status-playing { color: var(--warning); background: rgba(241, 196, 15, 0.2); }

.btn-join-lobby {
    padding: 0.3rem 0.8rem;
    font-size: 0.8rem;
    background: var(--primary);
    border: none;
    border-radius: 4px;
    color: white;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-join-lobby:hover {
    background: var(--primary-hover);
}

.lobby-item-empty {
    text-align: center;
    color: var(--text-dim);
    padding: 1rem;
    font-style: italic;
}

/* Login Tabs */
.login-tabs-container {
    margin-top: 0.5rem;
    background: rgba(0, 0, 0, 0.2);
    border-radius: var(--radius-md);
    padding: 1rem;
    border: 1px solid var(--border-color);
}

.login-tabs {
    display: flex;
    margin-bottom: 1rem;
    background: rgba(0, 0, 0, 0.3);
    padding: 4px;
    border-radius: 8px;
    border: 1px solid var(--border-color);
}

.login-tab {
    background: transparent;
    border: none;
    color: var(--text-dim);
    padding: 0.6rem 1rem;
    font-size: 0.9rem;
    cursor: pointer;
    position: relative;
    transition: all 0.3s ease;
    font-family: 'Orbitron', sans-serif;
    flex: 1;
    text-align: center;
    border-radius: 6px;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.login-tab:hover {
    color: var(--text-main);
    background: rgba(255, 255, 255, 0.05);
}

.login-tab.active {
    color: white;
    background: var(--primary);
    box-shadow: 0 2px 10px rgba(99, 102, 241, 0.4);
}

.login-tab.active::after {
    display: none;
}

.login-tab-content {
    display: none;
    animation: fadeIn 0.3s ease;
}

.login-tab-content.active {
    display: block;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(5px); }
    to { opacity: 1; transform: translateY(0); }
}
