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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: #1a1a1a;
    color: #ccc;
    min-height: 100vh;
}

.hidden { display: none !important; }

/* Login */
.login-screen {
    position: fixed;
    inset: 0;
    background: #1a1a1a;
    display: flex;
    justify-content: center;
    align-items: center;
}

.login-box {
    background: #222;
    padding: 32px;
    border-radius: 8px;
    width: 320px;
    border: 1px solid #333;
}

.login-box h2 {
    text-align: center;
    color: #fff;
    margin-bottom: 4px;
    font-size: 20px;
}

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

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

.form-group label {
    display: block;
    margin-bottom: 6px;
    color: #888;
    font-size: 12px;
}

.form-group input,
.form-group select {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid #333;
    border-radius: 4px;
    background: #2a2a2a;
    color: #fff;
    font-size: 14px;
}

.form-group input:focus,
.form-group select:focus {
    outline: none;
    border-color: #555;
}

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

.select-row select {
    flex: 1;
}

.btn-small {
    padding: 10px 14px;
    border: 1px solid #333;
    border-radius: 4px;
    background: #2a2a2a;
    color: #fff;
    font-size: 16px;
    cursor: pointer;
}

.btn-small:hover {
    background: #3a3a3a;
}

.help-text {
    font-size: 11px;
    color: #666;
    margin-top: 6px;
}

.status-text {
    text-align: center;
    font-size: 12px;
    padding: 8px;
    border-radius: 4px;
    margin-bottom: 16px;
}

.status-text.connected {
    background: #1a3a1a;
    color: #4a4;
}

.status-text.disconnected {
    background: #3a1a1a;
    color: #a44;
}

.status-text.error {
    background: #3a2a1a;
    color: #a64;
}

.btn {
    width: 100%;
    padding: 10px;
    border: none;
    border-radius: 4px;
    background: #3a3a3a;
    color: #fff;
    font-size: 14px;
    cursor: pointer;
}

.btn:hover:not(:disabled) {
    background: #444;
}

.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: 16px;
    padding-bottom: 16px;
    border-bottom: 1px solid #333;
}

.header h1 {
    font-size: 18px;
    color: #fff;
}

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

.status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #c44;
}

.status-dot.connected {
    background: #4a4;
}

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

.main {
    display: grid;
    grid-template-columns: 1fr 300px;
    gap: 16px;
}

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

/* Panels */
.panel {
    background: #222;
    border-radius: 6px;
    padding: 16px;
    border: 1px solid #333;
}

.panel h2 {
    font-size: 13px;
    color: #888;
    margin-bottom: 12px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

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

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

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

.user-item {
    display: flex;
    align-items: center;
    padding: 10px;
    margin-bottom: 6px;
    background: #2a2a2a;
    border-radius: 4px;
    border: 1px solid transparent;
}

.user-item.speaking {
    border-color: #4a4;
    background: rgba(68, 170, 68, 0.1);
}

.user-item.self {
    background: #2d2d2d;
}

.user-info {
    flex: 1;
}

.user-name {
    font-size: 14px;
    color: #ddd;
}

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


.user-volume {
    width: 60px;
}

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

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

.control-group label {
    display: block;
    font-size: 12px;
    color: #888;
    margin-bottom: 6px;
}

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

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

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

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

/* Volume Meter */
.meter {
    height: 6px;
    background: #2a2a2a;
    border-radius: 3px;
    margin-top: 6px;
    position: relative;
    overflow: hidden;
}

.meter-fill {
    position: absolute;
    left: 0;
    top: 0;
    height: 100%;
    background: #4a4;
    border-radius: 3px;
    transition: width 0.05s;
    width: 0%;
}

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

/* Buttons */
.button-row {
    display: flex;
    gap: 8px;
}

.btn-toggle {
    flex: 1;
    padding: 8px;
    border: 1px solid #333;
    border-radius: 4px;
    background: #2a2a2a;
    color: #888;
    font-size: 13px;
    cursor: pointer;
}

.btn-toggle:hover {
    background: #333;
    color: #ccc;
}

.btn-toggle.active {
    background: #c44;
    border-color: #c44;
    color: #fff;
}

/* Position Box */
.position-box {
    position: relative;
    width: 100%;
    height: 150px;
    background: #2a2a2a;
    border-radius: 4px;
    cursor: crosshair;
    margin-bottom: 10px;
    overflow: hidden;
}

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

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

.position-marker.self {
    background: #5a5;
    box-shadow: 0 0 6px rgba(85, 170, 85, 0.5);
}

.position-marker.other {
    background: #58f;
}

.position-marker.speaking {
    background: #fa0;
}

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

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

.coords b {
    color: #888;
}

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

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

input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 12px;
    height: 12px;
    background: #666;
    border-radius: 50%;
    cursor: pointer;
}

input[type="range"]::-webkit-slider-thumb:hover {
    background: #888;
}

/* Footer */
.footer {
    text-align: center;
    padding: 16px;
    color: #555;
    font-size: 12px;
    border-top: 1px solid #2a2a2a;
    margin-top: 16px;
}

.footer p {
    margin: 0;
}

/* Verification code box */
.code-box {
    background: #1a1a1a;
    border: 2px solid #4a9eff;
    border-radius: 6px;
    padding: 12px 16px;
    font-family: 'Courier New', monospace;
    font-size: 18px;
    font-weight: bold;
    color: #4a9eff;
    text-align: center;
    letter-spacing: 2px;
    cursor: pointer;
    transition: all 0.2s;
    user-select: all;
}

.code-box:hover {
    background: #222;
    border-color: #6ab0ff;
}

.code-box.copied {
    border-color: #4ade80;
    color: #4ade80;
}

.verification-success {
    color: #4ade80 !important;
}

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

