* { box-sizing: border-box; margin: 0; padding: 0; }

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', sans-serif;
    background: linear-gradient(135deg, #0a1428 0%, #1a0f2e 50%, #0d1f2d 100%);
    color: #e0e0ff;
    min-height: 100vh;
}

.hidden { display: none !important; }

/* Login */
.login-screen {
    position: fixed;
    inset: 0;
    background: linear-gradient(135deg, #0a1428 0%, #1a0f2e 50%, #0d1f2d 100%);
    display: flex;
    justify-content: center;
    align-items: center;
}

.login-box {
    background: linear-gradient(135deg, rgba(26, 15, 46, 0.9) 0%, rgba(15, 30, 60, 0.9) 100%);
    padding: 40px 32px;
    border-radius: 12px;
    width: 340px;
    border: 2px solid #6b5aff;
    box-shadow: 0 0 30px rgba(107, 90, 255, 0.3), 0 8px 32px rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(10px);
}

.login-box h2 {
    text-align: center;
    color: #e0e0ff;
    margin-bottom: 8px;
    font-size: 24px;
    font-weight: 600;
}

.login-box .subtitle {
    text-align: center;
    color: #b3a1ff;
    margin-bottom: 24px;
    font-size: 13px;
}

.form-group {
    margin-bottom: 18px;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    color: #b3a1ff;
    font-size: 12px;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.form-group input,
.form-group select {
    width: 100%;
    padding: 11px 14px;
    border: 2px solid #4a3f8f;
    border-radius: 6px;
    background: rgba(20, 15, 45, 0.8);
    color: #e0e0ff;
    font-size: 14px;
    transition: all 0.2s ease;
}

.form-group input:focus,
.form-group select:focus {
    outline: none;
    border-color: #7d5fff;
    background: rgba(30, 20, 60, 0.9);
    box-shadow: 0 0 0 3px rgba(125, 95, 255, 0.25);
}

.select-row {
    display: flex;
    gap: 8px;
}

.select-row select {
    flex: 1;
}

.btn-small {
    padding: 10px 14px;
    border: 2px solid #4a3f8f;
    border-radius: 6px;
    background: rgba(20, 15, 45, 0.8);
    color: #b3a1ff;
    font-size: 16px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.btn-small:hover {
    background: rgba(30, 25, 60, 0.9);
    border-color: #6b5aff;
    color: #e0e0ff;
}

.help-text {
    font-size: 12px;
    color: #9b8bcc;
    margin-top: 6px;
}

.status-text {
    text-align: center;
    font-size: 13px;
    padding: 10px;
    border-radius: 6px;
    margin-bottom: 18px;
    transition: all 0.3s ease;
}

.status-text.connected {
    background: rgba(82, 255, 122, 0.15);
    color: #52ff7a;
    border: 1px solid rgba(82, 255, 122, 0.3);
}

.status-text.disconnected {
    background: rgba(255, 107, 107, 0.15);
    color: #ff6b6b;
    border: 1px solid rgba(255, 107, 107, 0.3);
}

.status-text.error {
    background: rgba(255, 215, 0, 0.15);
    color: #ffd700;
    border: 1px solid rgba(255, 215, 0, 0.3);
}

.btn {
    width: 100%;
    padding: 11px;
    border: none;
    border-radius: 6px;
    background: linear-gradient(135deg, #7d5fff 0%, #6b5aff 100%);
    color: #fff;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.btn:hover:not(:disabled) {
    background: linear-gradient(135deg, #9b7fff 0%, #8b75ff 100%);
    box-shadow: 0 6px 20px rgba(123, 95, 255, 0.4);
    transform: translateY(-2px);
}

.btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* Main Layout */
.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 16px;
}

.header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    padding-bottom: 18px;
    border-bottom: 2px solid #4a3f8f;
}

.header h1 {
    font-size: 20px;
    color: #e0e0ff;
    font-weight: 600;
}

.status {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 13px;
    color: #b3a1ff;
}

.status-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: #ff6b6b;
    animation: pulse 2s infinite;
}

.status-dot.connected {
    background: #52ff7a;
    animation: none;
    box-shadow: 0 0 10px #52ff7a;
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

.ping {
    color: #777;
    font-size: 12px;
}

.main {
    display: grid;
    grid-template-columns: 1fr 320px;
    gap: 18px;
}

@media (max-width: 800px) {
    .main { grid-template-columns: 1fr; }
}

/* Panels */
.panel {
    background: linear-gradient(135deg, rgba(26, 30, 60, 0.8) 0%, rgba(30, 25, 50, 0.8) 100%);
    border-radius: 8px;
    padding: 18px;
    border: 2px solid #4a3f8f;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.3), inset 0 1px 0 rgba(123, 95, 255, 0.1);
}

.panel h2 {
    font-size: 12px;
    color: #b3a1ff;
    margin-bottom: 14px;
    text-transform: uppercase;
    letter-spacing: 0.8px;
    font-weight: 600;
}

.sidebar {
    display: flex;
    flex-direction: column;
    gap: 18px;
}

/* Users List */
.users-list {
    max-height: 500px;
    overflow-y: auto;
}

.empty-state {
    color: #666;
    text-align: center;
    font-size: 13px;
    padding: 24px 20px;
}

.user-item {
    display: flex;
    align-items: center;
    padding: 12px;
    margin-bottom: 8px;
    background: rgba(20, 15, 45, 0.6);
    border-radius: 6px;
    border: 2px solid transparent;
    transition: all 0.2s ease;
}

.user-item:hover {
    background: rgba(30, 25, 60, 0.8);
    border-color: #4a3f8f;
}

.user-item.speaking {
    border-color: #52ff7a;
    background: rgba(82, 255, 122, 0.1);
}

.user-item.self {
    background: rgba(123, 95, 255, 0.15);
    border-color: #7d5fff;
}

.user-info {
    flex: 1;
}

.user-name {
    font-size: 14px;
    color: #e0e0ff;
    font-weight: 500;
}

.user-name .tag {
    color: #9b8bcc;
    font-size: 12px;
}

.user-volume {
    width: 70px;
}

.user-volume input {
    width: 100%;
}

/* Controls */
.controls {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.control-group label {
    display: block;
    font-size: 12px;
    color: #b3a1ff;
    margin-bottom: 8px;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.slider-row {
    display: flex;
    align-items: center;
    gap: 12px;
}

.slider-row input[type="range"] {
    flex: 1;
}

.slider-row span {
    font-size: 12px;
    color: #9b8bcc;
    min-width: 40px;
    text-align: right;
    font-weight: 500;
}

.slider-row label {
    font-size: 12px;
    color: #b3a1ff;
    min-width: 50px;
}

.meter {
    height: 8px;
    background: rgba(20, 15, 45, 0.8);
    border-radius: 4px;
    margin-top: 8px;
    position: relative;
    overflow: hidden;
    border: 2px solid #4a3f8f;
}

.meter-fill {
    position: absolute;
    left: 0;
    top: 0;
    height: 100%;
    background: linear-gradient(90deg, #52ff7a, #7dff9e);
    border-radius: 4px;
    transition: width 0.05s;
    width: 0%;
    box-shadow: 0 0 8px rgba(82, 255, 122, 0.5);
}

.meter-threshold {
    position: absolute;
    top: 0;
    width: 2px;
    height: 100%;
    background: #ff6b6b;
    left: 5%;
}

.btn-toggle {
    flex: 1;
    padding: 10px;
    border: 2px solid #4a3f8f;
    border-radius: 6px;
    background: rgba(20, 15, 45, 0.8);
    color: #b3a1ff;
    font-size: 13px;
    cursor: pointer;
    font-weight: 500;
    transition: all 0.2s ease;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

.btn-toggle:hover {
    background: rgba(30, 25, 60, 0.9);
    color: #e0e0ff;
    border-color: #6b5aff;
}

.btn-toggle.active {
    background: linear-gradient(135deg, #ff6b6b, #ff8b9e);
    border-color: #ff6b6b;
    color: #fff;
    box-shadow: 0 4px 15px rgba(255, 107, 107, 0.4);
}

/* Position Box */
.position-box {
    position: relative;
    width: 100%;
    height: 150px;
    background: rgba(20, 15, 45, 0.8);
    border-radius: 8px;
    cursor: crosshair;
    margin-bottom: 10px;
    overflow: hidden;
    border: 2px solid #4a3f8f;
    box-shadow: inset 0 1px 0 rgba(123, 95, 255, 0.1);
}

.position-grid {
    position: absolute;
    inset: 0;
    background-image:
        linear-gradient(rgba(255,255,255,0.05) 1px, transparent 1px),
        linear-gradient(90deg, rgba(255,255,255,0.05) 1px, transparent 1px);
    background-size: 15px 15px;
}

.position-marker {
    position: absolute;
    width: 12px;
    height: 12px;
    border-radius: 50%;
    transform: translate(-50%, -50%);
    pointer-events: none;
}

.position-marker.self {
    background: #52ff7a;
    box-shadow: 0 0 12px rgba(82, 255, 122, 0.8);
}

.position-marker.other {
    background: #7d5fff;
    box-shadow: 0 0 10px rgba(125, 95, 255, 0.6);
}

.position-marker.speaking {
    background: #ffd700;
    box-shadow: 0 0 12px rgba(255, 215, 0, 0.7);
}

.marker-label {
    position: absolute;
    bottom: 12px;
    left: 50%;
    transform: translateX(-50%);
    font-size: 9px;
    color: #b3a1ff;
    white-space: nowrap;
}

.coords {
    display: flex;
    justify-content: center;
    gap: 16px;
    font-size: 12px;
    color: #9b8bcc;
    margin-top: 10px;
}

.coords b {
    color: #b3a1ff;
}

/* Scrollbar */
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: #404040; border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: #505050; }

/* Range inputs */
input[type="range"] {
    -webkit-appearance: none;
    height: 4px;
    background: #404040;
    border-radius: 2px;
    cursor: pointer;
}

input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 14px;
    height: 14px;
    background: linear-gradient(135deg, #7d5fff, #6b5aff);
    border-radius: 50%;
    cursor: pointer;
    transition: all 0.2s ease;
    box-shadow: 0 2px 8px rgba(123, 95, 255, 0.5);
}

input[type="range"]::-webkit-slider-thumb:hover {
    background: linear-gradient(135deg, #9b7fff, #8b75ff);
    box-shadow: 0 2px 12px rgba(123, 95, 255, 0.7);
}

input[type="range"]::-moz-range-track {
    background: #404040;
    border: none;
    border-radius: 2px;
}

input[type="range"]::-moz-range-thumb {
    background: linear-gradient(135deg, #7d5fff, #6b5aff);
    border: none;
    border-radius: 50%;
    width: 14px;
    height: 14px;
    cursor: pointer;
    transition: all 0.2s ease;
}

/* Footer */
.footer {
    text-align: center;
    padding: 18px;
    color: #9b8bcc;
    font-size: 12px;
    border-top: 2px solid #4a3f8f;
    margin-top: 20px;
}

.footer p {
    margin: 0;
}

/* Verification code box */
.code-box {
    background: linear-gradient(135deg, rgba(10, 20, 40, 0.9) 0%, rgba(26, 15, 46, 0.9) 100%);
    border: 2px solid #7d5fff;
    border-radius: 8px;
    padding: 14px 16px;
    font-family: 'Courier New', 'Consolas', monospace;
    font-size: 18px;
    font-weight: bold;
    color: #7d5fff;
    text-align: center;
    letter-spacing: 2px;
    cursor: pointer;
    transition: all 0.2s ease;
    user-select: all;
    box-shadow: 0 0 20px rgba(123, 95, 255, 0.2);
}

.code-box:hover {
    background: linear-gradient(135deg, rgba(20, 30, 60, 0.9) 0%, rgba(36, 25, 70, 0.9) 100%);
    border-color: #9b7fff;
    box-shadow: 0 0 30px rgba(123, 95, 255, 0.4);
}

.code-box.copied {
    border-color: #52ff7a;
    color: #52ff7a;
    background: linear-gradient(135deg, rgba(10, 40, 20, 0.9) 0%, rgba(15, 46, 30, 0.9) 100%);
    box-shadow: 0 0 20px rgba(82, 255, 122, 0.3);
}

.verification-success {
    color: #52cc73 !important;
}

.verification-pending {
    color: #fbbf24 !important;
}

