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

:root {
    --bg-main: #0f172a;
    --bg-card: rgba(30, 41, 59, 0.7);
    --primary: #8b5cf6;
    --primary-hover: #7c3aed;
    --secondary: #3b82f6;
    --accent: #f43f5e;
    --text-main: #f8fafc;
    --text-muted: #94a3b8;
    --glass-border: rgba(255, 255, 255, 0.1);
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    font-family: 'Outfit', sans-serif;
}

body {
    background-color: var(--bg-main);
    background-image: 
        radial-gradient(at 0% 0%, rgba(139, 92, 246, 0.15) 0px, transparent 50%),
        radial-gradient(at 100% 100%, rgba(59, 130, 246, 0.15) 0px, transparent 50%);
    background-attachment: fixed;
    color: var(--text-main);
    height: 100vh;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

#app {
    width: 100%;
    height: 100%;
    max-height: 100vh;
    padding: 1.5rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    flex: 1;
}

h1.logo {
    font-size: 3.5rem;
    font-weight: 800;
    background: linear-gradient(to right, var(--primary), var(--secondary));
    -webkit-background-clip: text;
    color: transparent;
    margin-bottom: 2rem;
    text-shadow: 0 10px 30px rgba(139, 92, 246, 0.3);
    animation: float 3s ease-in-out infinite;
}

@keyframes float {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-10px); }
}

.screen {
    display: none;
    width: 100%;
    max-width: 1800px;
    background: var(--bg-card);
    border: 1px solid var(--glass-border);
    border-radius: 24px;
    padding: 2.5rem;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
    animation: slideUp 0.5s cubic-bezier(0.16, 1, 0.3, 1) forwards;
    flex: 1;
    overflow-y: auto;
}

.screen.active {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

#screen-menu, #screen-join, #screen-end {
    max-width: 600px;
    margin: auto;
    justify-content: center;
}

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

/* Form Elements */
input {
    width: 100%;
    padding: 1rem 1.5rem;
    background: rgba(15, 23, 42, 0.6);
    border: 2px solid var(--glass-border);
    border-radius: 12px;
    color: white;
    font-size: 1.1rem;
    transition: all 0.3s ease;
    outline: none;
}

input:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 4px rgba(139, 92, 246, 0.2);
}

.btn {
    padding: 1rem 2rem;
    border: none;
    border-radius: 12px;
    font-size: 1.1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    background: var(--primary);
    color: white;
    box-shadow: 0 4px 14px 0 rgba(139, 92, 246, 0.39);
}

.btn:hover {
    transform: translateY(-2px);
    background: var(--primary-hover);
    box-shadow: 0 6px 20px rgba(139, 92, 246, 0.23);
}

.btn.secondary {
    background: transparent;
    border: 2px solid var(--primary);
}
.btn.secondary:hover {
    background: rgba(139, 92, 246, 0.1);
}

.settings-group {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
    background: rgba(0,0,0,0.2);
    padding: 1.5rem;
    border-radius: 16px;
}

.setting-item {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

/* Grid for lobby */
.players-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: 1rem;
}

.player-card {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--glass-border);
    border-radius: 16px;
    padding: 1rem;
    text-align: center;
    transition: transform 0.2s;
}

/* Pick Character */
.characters-grid {
    display: flex;
    flex-wrap: nowrap;
    gap: 1rem;
    overflow-x: auto;
    overflow-y: hidden;
    padding-bottom: 15px;
}

::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}
::-webkit-scrollbar-thumb {
    background: rgba(139, 92, 246, 0.5);
    border-radius: 4px;
}
::-webkit-scrollbar-thumb:hover {
    background: rgba(139, 92, 246, 0.8);
}
::-webkit-scrollbar-track {
    background: rgba(0, 0, 0, 0.2);
    border-radius: 4px;
}

.char-card {
    flex: 0 0 120px;
    cursor: pointer;
    border-radius: 12px;
    overflow: hidden;
    transition: all 0.2s;
    border: 3px solid transparent;
}

.char-card:hover {
    transform: scale(1.05);
}

.char-card.selected {
    border-color: var(--accent);
    box-shadow: 0 0 20px rgba(244, 63, 94, 0.4);
    transform: scale(1.05);
}

.char-card img {
    width: 100%;
    aspect-ratio: 1;
    object-fit: cover;
    display: block;
}

/* Voting Grid */
.vote-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 1.5rem;
}

.vote-card {
    background: rgba(0,0,0,0.3);
    border-radius: 16px;
    padding: 1rem;
    text-align: center;
    cursor: pointer;
    border: 2px solid transparent;
    transition: all 0.2s;
}
.vote-card img {
    width: 100px;
    height: 100px;
    border-radius: 50%;
    object-fit: cover;
    margin-bottom: 1rem;
}
.vote-card:hover {
    background: rgba(255,255,255,0.1);
    transform: translateY(-5px);
}
.vote-card.selected {
    border-color: var(--secondary);
    box-shadow: 0 0 20px rgba(59, 130, 246, 0.4);
}

.big-note {
    font-size: 4rem;
    font-weight: 800;
    color: var(--accent);
    text-align: center;
    margin: 1rem 0;
    text-shadow: 0 0 20px rgba(244, 63, 94, 0.4);
}

/* Notifications */
.status {
    text-align: center;
    color: var(--text-muted);
    font-weight: 600;
}
.error { color: #ef4444; }

.hidden { display: none !important; }

/* Tier List Styles */
.tier-row {
    display: flex;
    background: rgba(0, 0, 0, 0.4);
    border-radius: 6px;
    overflow: hidden;
    min-height: 50px;
    border: 1px solid var(--glass-border);
}

.tier-label {
    width: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 800;
    font-size: 1rem;
    color: #111;
    text-shadow: 0px 1px 2px rgba(255,255,255,0.5);
    flex-shrink: 0;
}

.tier-content {
    flex: 1;
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    padding: 4px;
    min-height: 50px;
}

.tier-char {
    width: 40px;
    height: 40px;
    border-radius: 6px;
    object-fit: cover;
    cursor: grab;
    transition: transform 0.1s;
}
.tier-char:active {
    cursor: grabbing;
    transform: scale(0.95);
}

.tierlist-tab {
    padding: 0.5rem 1rem;
    background: rgba(255,255,255,0.1);
    border: 1px solid var(--glass-border);
    border-radius: 8px;
    color: white;
    cursor: pointer;
    white-space: nowrap;
}
.tierlist-tab.active {
    background: var(--primary);
    border-color: var(--primary);
}

/* Size slider */
.size-slider {
    -webkit-appearance: none;
    appearance: none;
    height: 6px;
    background: rgba(255, 255, 255, 0.15);
    border-radius: 3px;
    outline: none;
    cursor: pointer;
}
.size-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: var(--primary);
    cursor: pointer;
    box-shadow: 0 0 6px rgba(139, 92, 246, 0.5);
}
.size-slider::-moz-range-thumb {
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: var(--primary);
    cursor: pointer;
    border: none;
    box-shadow: 0 0 6px rgba(139, 92, 246, 0.5);
}
