:root {
    --bg-gradient: linear-gradient(135deg, #09090b 0%, #1a1b2e 100%);
    --card-bg: rgba(255, 255, 255, 0.03);
    --card-border: rgba(255, 255, 255, 0.08);
    --glass-blur: blur(12px);

    --text-primary: #ffffff;
    --text-secondary: #a1a1aa;
    --text-muted: #52525b;

    --primary-gradient: linear-gradient(135deg, #6366f1 0%, #8b5cf6 100%);
    /* Indigo to Violet */
    --primary-solid: #6366f1;
    --danger-gradient: linear-gradient(135deg, #ef4444 0%, #dc2626 100%);

    --msg-sent-bg: #6366f1;
    --msg-received-bg: rgba(255, 255, 255, 0.08);

    --font-family: 'Inter', system-ui, -apple-system, sans-serif;
    --anim-speed: 0.3s;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    outline: none;
}

body {
    font-family: var(--font-family);
    background: var(--bg-gradient);
    color: var(--text-primary);
    height: 100vh;
    overflow: hidden;
    display: flex;
    justify-content: center;
    align-items: center;
    line-height: 1.5;
}

#app {
    width: 100%;
    max-width: 500px;
    height: 100%;
    background: transparent;
    position: relative;
    display: flex;
    flex-direction: column;
    box-shadow: 0 0 50px rgba(0, 0, 0, 0.5);
}

/* Base UI Elements */
button {
    cursor: pointer;
    font-family: inherit;
    font-weight: 500;
    border: none;
    transition: all 0.2s ease;
}

/* Utilities */
.hidden {
    display: none !important;
}

/* View Containers */
.view {
    flex: 1;
    display: flex;
    flex-direction: column;
    height: 100%;
    overflow: hidden;
}

/* LANDING PAGE */
#view-landing {
    padding: 2rem;
    justify-content: center;
    animation: fadeIn 0.5s ease;
}

#view-landing header {
    text-align: center;
    margin-bottom: 2rem;
}

#view-landing h1 {
    font-size: 2.5rem;
    font-weight: 700;
    background: linear-gradient(to right, #fff, #a5a6f6);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    margin-bottom: 0.5rem;
}

#view-landing p {
    color: var(--text-secondary);
    font-size: 1rem;
}

/* Tabs */
.tabs {
    display: flex;
    background: rgba(0, 0, 0, 0.2);
    padding: 4px;
    border-radius: 12px;
    margin-bottom: 1.5rem;
}

.tab-btn {
    flex: 1;
    padding: 0.8rem;
    border-radius: 8px;
    background: transparent;
    color: var(--text-secondary);
    font-size: 0.9rem;
}

.tab-btn.active {
    background: rgba(255, 255, 255, 0.1);
    color: white;
    font-weight: 600;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

/* Forms */
.container {
    background: var(--card-bg);
    border: 1px solid var(--card-border);
    backdrop-filter: var(--glass-blur);
    padding: 2rem;
    border-radius: 20px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.2);
}

.tab-content {
    display: none;
    animation: slideUp 0.3s ease;
}

.tab-content.active {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

input[type="text"],
input[type="password"],
select {
    background: rgba(0, 0, 0, 0.2);
    border: 1px solid var(--card-border);
    padding: 1rem;
    border-radius: 10px;
    color: white;
    font-size: 1rem;
    transition: border-color 0.2s;
}

input:focus,
select:focus {
    border-color: var(--primary-solid);
    background: rgba(0, 0, 0, 0.3);
}

.form-group label {
    display: block;
    font-size: 0.85rem;
    color: var(--text-secondary);
    margin-bottom: 0.5rem;
    margin-left: 0.5rem;
}

/* Buttons */
.primary-btn,
.secondary-btn,
.danger-btn {
    width: 100%;
    padding: 1rem;
    border-radius: 10px;
    font-size: 1rem;
    margin-top: 0.5rem;
}

.primary-btn {
    background: var(--primary-gradient);
    color: white;
    box-shadow: 0 4px 15px rgba(99, 102, 241, 0.3);
}

.primary-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(99, 102, 241, 0.4);
}

.secondary-btn {
    background: rgba(255, 255, 255, 0.1);
    color: white;
    border: 1px solid var(--card-border);
}

.danger-btn {
    background: var(--danger-gradient);
    color: white;
}

/* Checkbox */
.checkbox-group {
    display: flex;
    align-items: center;
    gap: 0.8rem;
    font-size: 0.9rem;
    color: var(--text-secondary);
}

.checkbox-group input {
    accent-color: var(--primary-solid);
    width: 1.2rem;
    height: 1.2rem;
    cursor: pointer;
}

.policy-link {
    color: #a5a6f6;
    text-decoration: none;
    border-bottom: 1px dashed #a5a6f6;
}

/* CHAT VIEW */
.chat-header {
    background: rgba(22, 22, 29, 0.9);
    backdrop-filter: blur(10px);
    padding: 1rem;
    border-bottom: 1px solid var(--card-border);
    display: flex;
    justify-content: space-between;
    align-items: center;
    z-index: 10;
}

.room-info {
    display: flex;
    flex-direction: column;
}

#room-status {
    font-size: 0.75rem;
    color: #4ade80;
    /* Green */
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 1px;
}

#room-timer-display {
    font-family: 'Inter', monospace;
    font-size: 1.1rem;
    font-weight: 700;
    color: white;
}

/* Chat Controls */
.room-controls {
    display: flex;
    align-items: center;
    gap: 12px;
}

.room-controls button {
    background: rgba(255, 255, 255, 0.08);
    /* Lighter for visibility */
    color: var(--text-secondary);
    min-width: 40px;
    /* Square base */
    height: 40px;
    /* Taller */
    padding: 0 12px;
    /* Space for text */
    border-radius: 12px;
    /* Rounded Square / Squircle */
    font-size: 0.9rem;
    display: flex;
    /* Flexbox for centering */
    align-items: center;
    justify-content: center;
    gap: 6px;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.room-controls button:hover {
    background: rgba(255, 255, 255, 0.2);
    color: white;
    transform: translateY(-2px);
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.3);
}

.room-controls button.danger-btn {
    background: rgba(239, 68, 68, 0.15);
    color: #fca5a5;
    border: 1px solid rgba(239, 68, 68, 0.2);
}

.room-controls button.danger-btn:hover {
    background: rgba(239, 68, 68, 0.25);
    border-color: rgba(239, 68, 68, 0.4);
}

/* Messages */
#chat-container {
    flex: 1;
    overflow-y: auto;
    padding: 1.5rem;
    display: flex;
    flex-direction: column;
    gap: 1rem;
    scroll-behavior: smooth;
    background: radial-gradient(circle at 50% 50%, rgba(99, 102, 241, 0.05) 0%, transparent 50%);
}

.message {
    max-width: 85%;
    padding: 0.8rem 1.2rem;
    border-radius: 18px;
    font-size: 0.95rem;
    line-height: 1.5;
    position: relative;
    animation: slideIn 0.3s ease;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
}

.message.sent {
    align-self: flex-end;
    background: var(--msg-sent-bg);
    color: white;
    border-bottom-right-radius: 4px;
}

.message.received {
    align-self: flex-start;
    background: var(--msg-received-bg);
    border: 1px solid var(--card-border);
    color: #e4e4e7;
    border-bottom-left-radius: 4px;
}

.message.system {
    align-self: center;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 20px;
    font-size: 0.75rem;
    color: var(--text-secondary);
    padding: 0.4rem 1rem;
    border: 1px dashed var(--card-border);
    max-width: 90%;
    text-align: center;
}

.sender-name {
    display: block;
    font-size: 0.7rem;
    color: rgba(255, 255, 255, 0.5);
    margin-bottom: 0.3rem;
    margin-left: 0.2rem;
}

/* Input Area */
.chat-input-area {
    padding: 1rem;
    background: rgba(22, 22, 29, 0.9);
    border-top: 1px solid var(--card-border);
}

.input-wrapper {
    display: flex;
    gap: 0.8rem;
    align-items: center;
    background: rgba(255, 255, 255, 0.05);
    padding: 0.5rem;
    border-radius: 25px;
    border: 1px solid var(--card-border);
}

.input-wrapper:focus-within {
    border-color: var(--primary-solid);
    background: rgba(255, 255, 255, 0.08);
}

#message-input {
    flex: 1;
    background: transparent;
    border: none;
    padding: 0.8rem;
    color: white;
}

#message-input:focus {
    background: transparent;
}

#btn-send {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: var(--primary-gradient);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    margin-right: 4px;
    box-shadow: 0 0 10px rgba(99, 102, 241, 0.4);
}

#btn-send:hover {
    transform: scale(1.05);
}

/* User List */
#user-list-panel {
    background: #111;
    border-bottom: 1px solid var(--card-border);
    padding: 1rem;
}

.user-item {
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    padding: 0.8rem 0;
}

.user-badge {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 4px;
    padding: 2px 6px;
    font-size: 0.7rem;
}

.user-badge.admin {
    background: var(--primary-solid);
    color: white;
}

.btn-kick {
    background: rgba(239, 68, 68, 0.2);
    color: #f87171;
    border: 1px solid rgba(239, 68, 68, 0.3);
    padding: 0.25rem 0.6rem;
    font-size: 0.75rem;
    border-radius: 6px;
    cursor: pointer;
    margin-left: auto;
    transition: all 0.2s;
}

.btn-kick:hover {
    background: rgba(239, 68, 68, 0.3);
    color: white;
}

/* Modals & Overlays */
.overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100vh;
    background: rgba(0, 0, 0, 0.8);
    backdrop-filter: blur(8px);
    z-index: 9999;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 1rem;
    animation: fadeIn 0.2s ease;
}

.modal-content {
    background: #18181b;
    width: 100%;
    max-width: 500px;
    max-height: 85vh;
    border-radius: 20px;
    border: 1px solid var(--card-border);
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.5);
    padding: 1.5rem;
    display: flex;
    flex-direction: column;
    animation: slideUp 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

.modal-content h2 {
    margin-bottom: 1rem;
    font-size: 1.2rem;
    color: white;
}

.scroll-area {
    overflow-y: auto;
    flex: 1;
    margin-bottom: 1rem;
    padding-right: 0.5rem;
    text-align: left;
}

.scroll-area h3 {
    margin-top: 1rem;
    margin-bottom: 0.5rem;
    color: var(--primary-solid);
    font-size: 1rem;
}

.scroll-area p {
    font-size: 0.9rem;
    color: var(--text-secondary);
    margin-bottom: 0.8rem;
    line-height: 1.5;
}

footer {
    text-align: center;
    margin-top: 2rem;
    color: var(--text-muted);
    font-size: 0.8rem;
}

/* Animations */
@keyframes fadeIn {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

@keyframes slideUp {
    from {
        transform: translateY(20px);
        opacity: 0;
    }

    to {
        transform: translateY(0);
        opacity: 1;
    }
}

@keyframes slideIn {
    from {
        transform: translateY(10px);
        opacity: 0;
    }

    to {
        transform: translateY(0);
        opacity: 1;
    }
}

/* Typing Indicator */
#typing-indicator {
    font-size: 0.75rem;
    color: var(--text-secondary);
    margin-bottom: 0.5rem;
    padding-left: 1rem;
    font-style: italic;
    animation: fadeIn 0.3s ease;
}

/* Custom Scrollbar */
::-webkit-scrollbar {
    width: 6px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.2);
}