:root {
    --bg-primary: #e0e5ec;
    --text-primary: #4a5568;
    --text-secondary: #718096;
    --accent-primary: #3b82f6;
    --accent-hover: #2563eb;
    --error: #ef4444;

    --shadow-light: #ffffff;
    --shadow-dark: #a3b1c6;
    --shadow-outer: 9px 9px 16px var(--shadow-dark), -9px -9px 16px var(--shadow-light);
    --shadow-inner: inset 6px 6px 10px 0 var(--shadow-dark), inset -6px -6px 10px 0 var(--shadow-light);
    --shadow-outer-sm: 4px 4px 8px var(--shadow-dark), -4px -4px 8px var(--shadow-light);
    --shadow-outer-mid: 6px 6px 12px var(--shadow-dark), -6px -6px 12px var(--shadow-light);
    --shadow-outer-hover: 12px 12px 20px var(--shadow-dark), -12px -12px 20px var(--shadow-light);
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: 'Inter', sans-serif;
    background: var(--bg-primary);
    color: var(--text-primary);
    height: 100vh;
    overflow: hidden;
    display: flex;
    justify-content: center;
    align-items: center;
}

#app {
    width: 100%;
    max-width: 95vw;
    height: calc(100vh - 80px);
    max-height: 1200px;
    padding: 20px 0;
    display: flex;
    flex-direction: column;
}

.panel {
    display: none;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 100%;
}

.panel.active {
    display: flex;
    animation: fadeIn 0.4s ease forwards;
}

#app-footer {
    position: absolute;
    bottom: 10px;
    left: 0;
    right: 0;
    text-align: center;
    color: var(--text-muted);
    font-size: 14px;
    pointer-events: none;
    z-index: 10;
}

.hidden {
    display: none !important;
}

.glass-card {
    background: var(--bg-primary);
    border-radius: 30px;
    padding: 40px 32px;
    box-shadow: var(--shadow-outer);
    text-align: center;
}

.connect-grid {
    display: flex;
    flex-direction: row;
    gap: 30px;
    width: 100%;
    max-width: 1200px;
    align-items: stretch;
    justify-content: center;
}

.info-card {
    flex: 1;
    max-width: 320px;
    padding: 40px 30px;
}

.login-card {
    flex: 0 0 450px;
    padding: 40px;
    display: flex;
    flex-direction: column;
    align-items: center;
    background: var(--bg-primary);
    border-radius: 20px;
    box-shadow: var(--shadow-outer);
    gap: clamp(16px, 3vw, 32px);
}

.logo-container {
    display: flex;
    align-items: center;
    gap: 20px;
    margin-bottom: 20px;
}

.app-logo {
    width: clamp(60px, 8vw, 100px);
    height: clamp(60px, 8vw, 100px);
    filter: drop-shadow(0 4px 6px rgba(0, 0, 0, 0.1));
}

.app-title {
    font-size: clamp(40px, 6vw, 72px);
    font-weight: 800;
    background: linear-gradient(135deg, var(--text-primary) 0%, var(--accent-primary) 100%);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    margin: 0;
}

.logo {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    margin-bottom: 8px;
}

h1 {
    font-size: 64px;
    font-weight: 700;
    color: var(--bg-primary);
    letter-spacing: -0.5px;
    text-shadow: 3px 3px 0 var(--shadow-dark), -3px -3px 0 var(--shadow-light);
    margin-bottom: 30px;
}

.input-group {
    margin-bottom: 24px;
    text-align: left;
}

.input-label {
    display: block;
    color: var(--text-secondary);
    font-size: 16px;
    margin-bottom: 10px;
    font-weight: 500;
    padding-left: 5px;
}

input.big-input {
    -webkit-appearance: none;
    appearance: none;
    width: 100%;
    background: var(--bg-primary);
    border: none;
    color: var(--text-primary);
    padding: clamp(8px, 1.5vw, 16px);
    border-radius: 16px;
    font-size: clamp(24px, 4vw, 40px);
    font-weight: 700;
    font-family: inherit;
    text-align: center;
    letter-spacing: 4px;
    box-shadow: var(--shadow-inner);
    transition: all 0.3s ease;
}

input.big-input:focus {
    outline: none;
}


.main-action-group {
    margin-bottom: 40px;
}

.button-group-vertical {
    display: flex;
    flex-direction: column;
    gap: 16px;
    margin-bottom: 16px;
}

.btn {
    background: var(--bg-primary);
    color: var(--text-primary);
    border: none;
    padding: 14px 28px;
    border-radius: 12px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    box-shadow: var(--shadow-outer);
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
}

.btn:hover {
    box-shadow: var(--shadow-outer-mid);
    filter: brightness(0.95);
    transform: translateY(0);
}

.btn:active {
    box-shadow: var(--shadow-outer-sm);
    filter: brightness(0.95);
    transform: scale(0.96);
}

.btn.massive {
    padding: 24px 48px;
    font-size: 20px;
    font-weight: bold;
    border-radius: 16px;
    letter-spacing: 1px;
}

.room-info {
    text-align: left;
}

.room-info h2 {
    font-size: 20px;
    margin-bottom: 8px;
    color: var(--text-primary);
}

.badge {
    box-shadow: var(--shadow-inner);
    color: var(--accent-primary);
    padding: 6px 12px;
    border-radius: 10px;
    font-size: 12px;
    font-weight: 600;
    display: inline-block;
}


.transfer-area {
    padding: 0 16px;
    border-radius: 20px;
    box-shadow: var(--shadow-inner);
}

#transfer-area {
    overflow: hidden;
    max-height: 0;
    opacity: 0;
    margin-top: 0 !important;
    padding-top: 0;
    padding-bottom: 0;
    transform: translateY(20px) scale(0.98);
    transition: max-height 0.4s cubic-bezier(0.34, 1.56, 0.64, 1),
                margin-top 0.4s cubic-bezier(0.34, 1.56, 0.64, 1),
                padding-top 0.4s cubic-bezier(0.34, 1.56, 0.64, 1),
                padding-bottom 0.4s cubic-bezier(0.34, 1.56, 0.64, 1),
                opacity 0.4s cubic-bezier(0.34, 1.56, 0.64, 1),
                transform 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
}

#transfer-area.active {
    max-height: 200px;
    opacity: 1;
    margin-top: 20px !important;
    padding-top: 24px;
    padding-bottom: 24px;
    transform: translateY(0) scale(1);
}

.progress-container {
    width: 100%;
    height: 20px;
    background: var(--bg-primary);
    border-radius: 10px;
    box-shadow: inset 2px 2px 5px var(--shadow-dark),
        inset -2px -2px 5px var(--shadow-light);
    margin-bottom: 10px;
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    width: 0%;
    background: var(--success, #22c55e);
    border-radius: 10px;
    transition: width 0.2s ease;
}

.transfer-stats {
    display: flex;
    justify-content: space-between;
    align-items: center;
    color: var(--text-muted);
}

.room-grid {
    display: grid;
    grid-template-columns: 420px 1fr;
    gap: 40px;
    width: 100%;
    height: 100%;
    padding: 0 30px;
}

@media (max-width: 768px) {
    #app {
        height: auto;
        min-height: 100vh;
        max-height: none;
        overflow: visible;
        padding: 20px 10px 0 10px;
        max-width: 100vw;
    }
    
    #app-footer {
        position: static;
        margin-top: auto;
        padding-top: 20px;
        padding-bottom: 20px;
    }

    body {
        overflow-y: auto;
        overflow-x: hidden;
        height: auto;
        min-height: 100vh;
    }
}

.drop-zone.dragover {
    background: rgba(99, 102, 241, 0.05) !important;
    box-shadow: inset 4px 4px 8px var(--shadow-dark),
        inset -4px -4px 8px var(--shadow-light);
    border: 2px dashed var(--accent-primary);
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes shake {

    0%,
    100% {
        transform: translateX(0);
    }

    25% {
        transform: translateX(-4px);
    }
}

#display-room-id:hover {
    color: var(--text-primary);
    filter: brightness(1.3);
}

#display-room-id:active {
    transform: scale(0.95);
}

.user-list {
    margin-top: 15px;
    overflow-y: auto;
    padding: 10px 10px 10px 10px;
    margin-left: -10px;
    margin-right: -10px;
    min-width: 0;
    min-height: 0;
}

.users-section {
    min-width: 0;
    min-height: 0;
}

.sidebar-card {
    min-width: 0;
    min-height: 0;
}

.user-list::-webkit-scrollbar {
    width: 8px;
}

.user-list::-webkit-scrollbar-track {
    background: transparent;
}

.user-list::-webkit-scrollbar-thumb {
    background: var(--shadow-dark);
    border-radius: 4px;
}

.user-item {
    display: flex;
    align-items: center;
    justify-content: flex-start;
    gap: 16px;
    padding: 12px 16px;
    margin-bottom: 12px;
    background: var(--bg-primary);
    border-radius: 12px;
    box-shadow: 4px 4px 8px var(--shadow-dark),
        -4px -4px 8px var(--shadow-light);
    transition: transform 0.2s ease;
    min-width: 0;
    max-width: 100%;
}

.user-info {
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 16px;
    font-weight: 600;
    flex: 1;
    min-width: 0;
}

.user-name, .marquee {
    white-space: nowrap;
    overflow-x: auto;
    scrollbar-width: none;
}

.user-name {
    padding-left: 4px;
}

.user-name.overflowing, .marquee.overflowing {
    -webkit-mask-image: linear-gradient(to right, transparent 0%, black 15px, black calc(100% - 15px), transparent 100%);
    mask-image: linear-gradient(to right, transparent 0%, black 15px, black calc(100% - 15px), transparent 100%);
}

.user-name::-webkit-scrollbar, .marquee::-webkit-scrollbar {
    display: none;
}

.right-icons {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-left: auto;
    flex-shrink: 0;
}

.user-crown {
    width: 20px;
    height: 20px;
}


#host-settings-panel {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-bottom: 20px;
    margin-left: 5px;
}

#host-settings-panel .neu-checkbox {
    width: 32px;
    height: 32px;
    border-radius: 8px;
}

.host-setting-row {
    display: flex;
    align-items: center;
    gap: 10px;
    min-height: 40px;
}

.host-setting-row span {
    font-size: 14px;
    color: var(--text-muted);
    padding-left: 4px;
}

.neu-input {
    -webkit-appearance: none;
    appearance: none;
    background: var(--bg-primary);
    border: none;
    padding: 14px 18px;
    border-radius: 8px;
    font-size: 16px;
    color: var(--text-primary);
    box-shadow: inset 2px 2px 5px var(--shadow-dark), inset -2px -2px 5px var(--shadow-light);
    outline: none;
    width: 180px;
}


.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(0, 0, 0, 0.4);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
}

.modal-overlay.show {
    opacity: 1;
    pointer-events: auto;
}

.modal-content {
    background: var(--bg-primary);
    color: var(--text-primary);
    padding: 30px 40px;
    border-radius: 24px;
    box-shadow: 0 0 80px rgba(255, 255, 255, 0.6), 10px 10px 30px rgba(0, 0, 0, 0.4), -10px -10px 30px rgba(255, 255, 255, 0.05);
    font-size: 20px;
    font-weight: bold;
    transform: scale(0.9);
    transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 20px;
    max-width: 90vw;
    overflow: hidden;
    min-width: 0;
}

.modal-content>div {
    min-width: 0;
    max-width: 100%;
}

#receive-modal-text,
#receive-modal-title,
#modal-text,
#modal-title {
    display: block;
    width: 100%;
    white-space: nowrap;
    overflow-x: auto;
    scrollbar-width: none;
}

#receive-modal-text::-webkit-scrollbar,
#receive-modal-title::-webkit-scrollbar,
#modal-text::-webkit-scrollbar,
#modal-title::-webkit-scrollbar {
    display: none;
}

.modal-overlay.show .modal-content {
    transform: scale(1);
}

.neu-checkbox {
    -webkit-appearance: none;
    appearance: none;
    width: 28px;
    height: 28px;
    background: var(--bg-primary);
    border-radius: 8px;
    border: none;
    box-shadow: 4px 4px 8px var(--shadow-dark),
        -4px -4px 8px var(--shadow-light);
    position: relative;
    cursor: pointer;
    outline: none;
    flex-shrink: 0;
    transition: box-shadow 0.2s ease, opacity 0.2s ease;
}

.neu-checkbox:checked {
    box-shadow: inset 2px 2px 5px var(--shadow-dark),
        inset -2px -2px 5px var(--shadow-light);
}

.neu-checkbox.is-me {
    box-shadow: 4px 4px 8px var(--shadow-dark),
        -4px -4px 8px var(--shadow-light);
    cursor: default;
    opacity: 0.6;
}

.neu-checkbox.is-me::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 14px;
    height: 14px;
    transform: translate(-50%, -50%);
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 12 12'%3E%3Cpath fill='%234a5568' d='M1.5 6a.5.5 0 0 1 .5-.5h6.793L6.146 2.854a.5.5 0 1 1 .708-.708l3.5 3.5a.5.5 0 0 1 0 .708l-3.5 3.5a.5.5 0 0 1-.708-.708L8.793 6.5H2a.5.5 0 0 1-.5-.5'/%3E%3C/svg%3E");
    background-size: contain;
    background-repeat: no-repeat;
}

.neu-checkbox:checked::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 16px;
    height: 16px;
    transform: translate(-50%, -50%);
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 12 12'%3E%3Cpath fill='%234a5568' d='M9.765 3.205a.75.75 0 0 1 .03 1.06l-4.25 4.5a.75.75 0 0 1-1.075.015L2.22 6.53a.75.75 0 0 1 1.06-1.06l1.705 1.704l3.72-3.939a.75.75 0 0 1 1.06-.03'/%3E%3C/svg%3E");
    background-size: contain;
    background-repeat: no-repeat;
}

.neu-slider {
    -webkit-appearance: none;
    appearance: none;
    width: 100%;
    height: 24px;
    background: transparent;
    outline: none;
}

.neu-slider::-webkit-slider-runnable-track {
    width: 100%;
    height: 12px;
    background: var(--bg-primary);
    border-radius: 6px;
    box-shadow: inset 3px 3px 6px var(--shadow-dark), inset -3px -3px 6px var(--shadow-light);
    cursor: pointer;
}

.neu-slider::-moz-range-track {
    width: 100%;
    height: 12px;
    background: var(--bg-primary);
    border-radius: 6px;
    box-shadow: inset 3px 3px 6px var(--shadow-dark), inset -3px -3px 6px var(--shadow-light);
    cursor: pointer;
}

.neu-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background: var(--bg-primary);
    cursor: pointer;
    box-shadow: 3px 3px 6px var(--shadow-dark), -3px -3px 6px var(--shadow-light);
    transition: transform 0.1s;
    border: none;
    margin-top: -6px;
}

.neu-slider::-webkit-slider-thumb:hover {
    transform: scale(1.1);
}

.neu-slider::-moz-range-thumb {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background: var(--bg-primary);
    cursor: pointer;
    box-shadow: 3px 3px 6px var(--shadow-dark), -3px -3px 6px var(--shadow-light);
    transition: transform 0.1s;
    border: none;
}

.neu-slider::-moz-range-thumb:hover {
    transform: scale(1.1);
}

.user-flag {
    width: 20px;
    height: 15px;
    border-radius: 2px;
}

/* =========================================================
   Mobile Optimization
   ========================================================= */
@media (max-width: 900px) {
    /* Use the same logic, but we already have the primary overrides in the other block now, so we can just add the missing padding here for layout */
    .connect-grid {
        flex-direction: column;
        align-items: center;
        gap: 20px;
        padding: 20px 10px;
    }
    
    .info-card, .login-card {
        width: 100%;
        max-width: 100%;
        padding: 20px;
        box-sizing: border-box;
    }

    .room-grid {
        display: flex;
        flex-direction: column;
        gap: 20px;
        padding: 10px;
    }

    .glass-card {
        padding: 25px 20px;
        border-radius: 24px;
        margin-bottom: 20px;
    }

    .sidebar-card, .main-card {
        flex: none;
        width: 100%;
        max-height: none;
        min-height: auto;
        box-sizing: border-box;
    }

    .action-row {
        flex-direction: column;
    }

    .action-row > * {
        width: 100%;
    }

    .btn-secondary, .btn-primary {
        padding: 16px;
        font-size: 16px;
        width: 100%;
    }

    #speed-limit-container {
        flex-direction: column;
        align-items: flex-start !important;
        gap: 12px !important;
        margin-bottom: 20px !important;
    }

    #speed-limit-slider {
        margin-left: 0 !important;
        max-width: 100% !important;
        width: 100%;
    }

    #drop-zone {
        padding: 30px 15px !important;
    }
}