/* Dark theme (default) */
:root,
[data-theme="dark"] {
  --larx-blue: rgba(81, 133, 255, 1);
  --larx-blue-default: rgb(140, 177, 201);
  --larx-blue-light: rgba(81, 133, 255, 0.3);
  --larx-blue-gray: rgb(121, 147, 172);
  --larx-glow: rgba(176, 196, 244, 1);
  --larx-white-gray: rgba(255, 255, 255, 0.82);
  --larx-ais-active: #4eff4e;
  --larx-ais-inactive: #ff9999;
  --larx-ais-connecting: #ffcc00;
  --larx-ais-error: #ff4400;
  --bg-dark: #192c50;
  --bg-darker: #0d1420;
  --text-color: rgba(255, 255, 255, 0.82);
  --text-muted: rgb(140, 177, 201);
  --border-color: rgba(81, 133, 255, 0.3);
  --window-bg: rgba(0, 0, 0, 0.5);
  --card-bg: rgba(0, 0, 0, 0.5);
  --header-bg: rgba(0, 0, 0, 0.7);
  --nav-bg: rgba(0, 0, 0, 0.4);
  --nav-bg-scrolled: rgba(0, 0, 0, 0.7);
  --input-bg: rgba(0, 0, 0, 0.4);
  --hover-bg: rgba(81, 133, 255, 0.1);
  --modal-bg: rgba(0, 0, 0, 0.85);
  --filter-bg: rgba(0, 0, 0, 0.3);
  
  /* Font family variables */
  --font-primary: 'Space Mono', monospace;
  --font-secondary: 'Space Mono', monospace;
  
  /* Common spacing */
  --spacing-1: 0.25rem;
  --spacing-2: 0.5rem;
  --spacing-3: 0.75rem;
  --spacing-4: 1rem;
  --spacing-6: 1.5rem;
  --spacing-8: 2rem;
  --spacing-12: 3rem;
  --spacing-16: 4rem;
  --spacing-20: 5rem;
  --title-bar-height: 28px;
}

/* Light theme */
[data-theme="light"] {
  --larx-blue: rgb(59, 130, 246);
  --larx-blue-default: rgb(37, 99, 235);
  --larx-blue-light: rgba(59, 130, 246, 0.1);
  --larx-blue-gray: rgb(100, 116, 139);
  --larx-glow: rgb(59, 130, 246);
  --larx-white-gray: rgb(51, 65, 85);
  --larx-ais-active: #059669;
  --larx-ais-inactive: #dc2626;
  --larx-ais-connecting: #d97706;
  --larx-ais-error: #dc2626;
  --bg-dark: linear-gradient(135deg, rgb(248, 250, 252) 0%, rgb(241, 245, 249) 100%);
  --bg-darker: rgb(226, 232, 240);
  --text-color: rgb(51, 65, 85);
  --text-muted: rgb(100, 116, 139);
  --border-color: rgba(59, 130, 246, 0.2);
  --window-bg: rgba(255, 255, 255, 0.95);
  --card-bg: rgba(255, 255, 255, 0.9);
  --header-bg: rgba(255, 255, 255, 0.95);
  --nav-bg: rgba(98, 95, 95, 0.364);
  --nav-bg-scrolled: rgba(98, 95, 95, 0.364);
  --input-bg: rgba(255, 255, 255, 0.9);
  --hover-bg: rgba(59, 130, 246, 0.08);
  --modal-bg: rgba(255, 255, 255, 0.95);
  --filter-bg: rgba(255, 255, 255, 0.9);
}

/* Base Styles */
html {
    height: 100%;
    overflow-x: hidden;
    width: 100%;
    position: relative;
}

body {
    background: radial-gradient(ellipse at center, var(--bg-dark), var(--bg-darker));
    height: 100vh;
    margin: 0;
    overflow: hidden;
    padding: 0;
    position: relative;
    width: 100%;
    user-select: none;
    font-family: var(--font-primary);
    color: var(--text-color);
    transition: background 0.3s ease, color 0.3s ease;
}

/* Space background with stars - only for dark theme */
[data-theme="dark"] body::before,
:root body::before {
  content: '';
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-image: 
    radial-gradient(1px 1px at 10% 5%, white, transparent),
    radial-gradient(1px 1px at 25% 10%, white, transparent),
    radial-gradient(1.5px 1.5px at 40% 15%, rgba(255, 255, 255, 0.9), transparent),
    radial-gradient(1px 1px at 50% 25%, white, transparent),
    radial-gradient(2px 2px at 60% 30%, white, transparent),
    radial-gradient(1px 1px at 75% 40%, white, transparent),
    radial-gradient(1.5px 1.5px at 85% 45%, rgba(255, 255, 255, 0.9), transparent),
    radial-gradient(2px 2px at 20% 60%, white, transparent),
    radial-gradient(2.5px 2.5px at 30% 65%, rgba(255, 255, 255, 0.9), transparent),
    radial-gradient(2px 2px at 40% 80%, white, transparent),
    radial-gradient(1px 1px at 50% 85%, white, transparent),
    radial-gradient(3px 3px at 60% 90%, rgba(255, 255, 255, 0.8), transparent),
    radial-gradient(1px 1px at 80% 95%, white, transparent),
    radial-gradient(1.5px 1.5px at 95% 20%, rgba(255, 255, 255, 0.9), transparent),
    radial-gradient(2.5px 2.5px at 5% 70%, rgba(255, 255, 255, 0.8), transparent),
    radial-gradient(1.5px 1.5px at 90% 75%, rgba(255, 255, 255, 0.9), transparent);
  background-repeat: no-repeat;
  background-size: 100% 100%;
  z-index: -1;
  opacity: 0.6;
  pointer-events: none;
}

/* Additional animated stars layer - only for dark theme */
[data-theme="dark"] body::after,
:root body::after {
  content: '';
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-image: 
    radial-gradient(2px 2px at 15% 15%, rgba(255, 255, 255, 0.8), transparent),
    radial-gradient(1.5px 1.5px at 35% 25%, rgba(255, 255, 255, 0.7), transparent),
    radial-gradient(1px 1px at 55% 35%, white, transparent),
    radial-gradient(2.5px 2.5px at 70% 55%, rgba(255, 255, 255, 0.9), transparent),
    radial-gradient(1.5px 1.5px at 85% 75%, rgba(255, 255, 255, 0.8), transparent),
    radial-gradient(2px 2px at 32% 82%, white, transparent),
    radial-gradient(3px 3px at 45% 95%, rgba(255, 255, 255, 0.7), transparent),
    radial-gradient(1px 1px at 65% 15%, white, transparent),
    radial-gradient(2px 2px at 75% 35%, rgba(255, 255, 255, 0.8), transparent);
  background-repeat: no-repeat;
  background-size: 100% 100%;
  z-index: -1;
  opacity: 0.4;
  pointer-events: none;
}

/* Light theme subtle pattern */
[data-theme="light"] body::before {
  content: '';
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: linear-gradient(135deg, rgb(248, 250, 252) 0%, rgb(241, 245, 249) 100%);
  background-size: 100% 100%;
  z-index: -1;
  opacity: 1;
  pointer-events: none;
}

[data-theme="light"] body::after {
  display: none;
}

/* Typography */
h1, h2, h3, h4, h5, h6 {
  margin-top: 0;
  color: var(--larx-white-gray);
  transition: color 0.3s ease;
  font-family: var(--font-primary);
}

h1 {
  font-size: 1.5rem;
  font-weight: 700;
}

h2 {
  font-size: 1.25rem;
  font-weight: 600;
}

h3 {
  font-size: 1.125rem;
  font-weight: 500;
  color: var(--larx-blue-default);
}

p {
  margin-top: 0;
}

/* Theme transition effect */
* {
  transition-property: color, background-color, border-color, text-shadow, box-shadow;
  transition-duration: 0.3s;
  transition-timing-function: ease;
}

/* Login Screen Styles */
.login-container {
    visibility: hidden;
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    padding: 2rem;
    background: radial-gradient(ellipse at center, var(--bg-dark), var(--bg-darker));
}

.login-box {
    position: relative;
    height: 100%;
    border-radius: 6px;
    box-shadow: 0 0 25px rgba(0, 0, 0, 0.5);
    overflow: hidden;
    color: var(--larx-glow);
    display: flex;
    font-family: var(--font-primary);
    text-transform: uppercase;
    padding: 2rem;
    background: var(--window-bg);
    backdrop-filter: blur(10px);
    border: 1px solid var(--border-color);
    min-width: 500px;
}

.login-form-container {
    width: 50%;
    height: 100%;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.login-info-container {
    width: 50%;
    height: auto;
    display: flex;
    flex-direction: column;
    justify-content: center;
    text-align: right;
    padding-left: 2rem;
}

.login-header {
    text-align: center;
    margin-bottom: 30px;
}

.login-header h1 {
    font-size: 24px;
    color: var(--larx-white-gray);
    margin: 0;
    text-transform: uppercase;
}

.login-header p {
    font-size: 0.75rem;
    color: var(--larx-white-gray);
    margin: 10px 0 0 0;
}

.login-info-container h2 {
    font-size: 1.5rem;
    line-height: 1.4;
    text-transform: uppercase;
    color: var(--larx-white-gray);
    margin: 0;
}

.login-info-container p {
    font-size: 0.75rem;
    color: var(--larx-white-gray);
    margin: 10px 0 0 0;
}

/* Form Styles */
.form-group {
    position: relative;
    width: 100%;
    height: auto;
    margin: 1rem 0;
    padding-top: 0.5rem;
    padding-bottom: 0.5rem;
}

.form-group input {
    width: 100%;
    height: auto;
    background: transparent;
    border: none;
    outline: none;
    border-bottom: 2px solid var(--larx-white-gray);
    color: var(--larx-white-gray);
    font-family: var(--font-primary);
    font-size: 14px;
    padding: 8px 0;
}

.form-group label {
    position: absolute;
    top: 50%;
    left: 0;
    transform: translateY(-50%);
    color: var(--larx-white-gray);
    pointer-events: none;
    font-size: 14px;
    transition: 0.5s;
    text-transform: uppercase;
}

.form-group input:focus ~ label,
.form-group input:not(:placeholder-shown) ~ label {
    top: -5px;
    font-size: 12px;
    color: var(--larx-blue);
}

.form-group input:focus {
    border-bottom-color: var(--larx-blue);
}

.login-button {
    position: relative;
    width: 100%;
    height: auto;
    background: var(--larx-white-gray);
    color: black;
    border: none;
    outline: none;
    border-radius: 10px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 600;
    text-transform: uppercase;
    font-family: var(--font-primary);
    padding: 12px;
    margin-top: 20px;
    transition: all 0.3s ease;
}

.login-button:hover:not(:disabled) {
    background: var(--larx-blue);
    color: white;
    transform: translateY(-1px);
}

.login-button:disabled {
    background: rgba(255, 255, 255, 0.3);
    color: rgba(0, 0, 0, 0.5);
    cursor: not-allowed;
    transform: none;
}

.login-status {
    margin-top: 15px;
    text-align: center;
    font-size: 12px;
    min-height: 20px;
    font-family: var(--font-primary);
}

.login-status.error {
    color: var(--larx-ais-error);
}

.login-status.success {
    color: var(--larx-ais-active);
}

.login-status.info {
    color: var(--larx-blue);
}

/* Main App Styles */
.app-container {
    display: none;
    padding: 8px;
    min-height: 100vh;
    box-sizing: border-box;
    background: radial-gradient(ellipse at center, var(--bg-dark), var(--bg-darker));
}

.app-container.show {
    display: flex;
    flex-direction: column;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    width: 100%;
    flex: 1;
    display: flex;
    flex-direction: column;
}

/* Window Base Styles */
.header {
    -webkit-backdrop-filter: blur(10px);
    backdrop-filter: blur(10px);
    background: var(--header-bg);
    border: 1px solid var(--border-color);
    border-radius: 4px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    padding: 15px;
    transition: box-shadow 0.3s ease;
    min-width: 275px;
}

.header:hover {
    box-shadow: 0 0 10px rgba(255, 255, 255, 0.1);
}

.header h1 {
    margin: 0;
    font-size: 18px;
    color: var(--larx-white-gray);
    font-family: var(--font-primary);
    text-transform: uppercase;
    font-weight: normal;
}

.header-controls {
    display: flex;
    align-items: center;
    gap: 15px;
}

.user-info {
    font-size: 10px;
    color: var(--larx-blue-gray);
    font-family: var(--font-primary);
    text-transform: uppercase;
}

.logout-btn {
    background-color: var(--input-bg);
    border: 1px solid var(--border-color);
    border-radius: 3px;
    color: var(--larx-white-gray);
    cursor: pointer;
    font-family: var(--font-primary);
    font-size: 7.2px;
    margin: 2px;
    padding: 3.6px 7.2px;
    min-width: 25.2px;
    text-transform: uppercase;
    transition: all 0.2s ease;
}

.logout-btn:hover {
    background-color: var(--hover-bg);
}

.status-indicator {
    padding: 5px 15px;
    border-radius: 3px;
    font-size: 10px;
    font-weight: bold;
    font-family: var(--font-primary);
    text-transform: uppercase;
}

.status-indicator.connected {
    background: var(--larx-ais-active);
    color: black;
}

.status-indicator.disconnected {
    background: var(--larx-ais-inactive);
    color: black;
}

/* Theme Toggle Button */
.theme-toggle {
    background: var(--input-bg);
    border: 1px solid var(--border-color);
    border-radius: 3px;
    color: var(--larx-white-gray);
    cursor: pointer;
    font-family: var(--font-primary);
    font-size: 7.2px;
    margin: 2px;
    padding: 3.6px 7.2px;
    min-width: 25.2px;
    text-transform: uppercase;
    transition: all 0.2s ease;
}

.theme-toggle:hover {
    background-color: var(--hover-bg);
}

/* Viewer Counter */
.viewer-count {
    background: var(--input-bg);
    border: 1px solid var(--border-color);
    border-radius: 3px;
    color: var(--larx-blue);
    font-family: var(--font-primary);
    font-size: 7.2px;
    margin: 2px;
    padding: 3.6px 7.2px;
    text-transform: uppercase;
    font-weight: bold;
    min-width: 50px;
    text-align: center;
}

/* Panel Styles */
.main-content {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
    flex: 1;
}

.panel {
    -webkit-backdrop-filter: blur(10px);
    backdrop-filter: blur(10px);
    background: var(--window-bg);
    border: 1px solid var(--border-color);
    border-radius: 4px;
    padding: 20px;
    display: flex;
    flex-direction: column;
    transition: box-shadow 0.3s ease;
    min-width: 275px;
}

.panel:hover {
    box-shadow: 0 0 10px rgba(255, 255, 255, 0.1);
}

.panel h2 {
    margin: 0 0 15px 0;
    font-size: 14px;
    color: var(--larx-white-gray);
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 10px;
    font-family: var(--font-primary);
    text-transform: uppercase;
    font-weight: normal;
}

.controls {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.control-group {
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.control-group label {
    font-size: 10px;
    color: var(--larx-blue-gray);
    font-family: var(--font-primary);
    text-transform: uppercase;
}

.control-group input[type="text"],
.control-group input[type="number"],
.control-group select {
    background: var(--input-bg);
    border: 1px solid var(--border-color);
    color: var(--larx-white-gray);
    padding: 8px;
    border-radius: 3px;
    font-family: var(--font-primary);
    font-size: 11px;
}

.control-group input:focus {
    border-color: var(--larx-blue);
    outline: none;
}

.control-group input:read-only {
    background: rgba(0, 0, 0, 0.3);
    color: var(--larx-blue-gray);
}

.control-group small {
    display: block;
    font-size: 9px;
    color: var(--larx-blue-gray);
    margin-top: 2px;
    font-style: italic;
    font-family: var(--font-primary);
}

.button-group {
    display: flex;
    gap: 10px;
}

/* Button Styles */
button {
    background-color: var(--input-bg);
    border: 1px solid var(--border-color);
    border-radius: 3px;
    color: var(--larx-white-gray);
    cursor: pointer;
    font-family: var(--font-primary);
    font-size: 7.2px;
    margin: 2px;
    padding: 3.6px 7.2px;
    min-width: 25.2px;
    text-transform: uppercase;
    transition: all 0.2s ease;
}

button:hover:not(:disabled) {
    background-color: var(--hover-bg);
}

button:disabled {
    background: rgba(0, 0, 0, 0.3);
    color: rgba(255, 255, 255, 0.4);
    cursor: not-allowed;
}

button.danger {
    background: var(--larx-ais-error);
    color: white;
}

button.danger:hover:not(:disabled) {
    background: rgba(255, 68, 0, 0.8);
}

#regenerate-feed-id {
    background: var(--input-bg);
    border: 1px solid var(--border-color);
    color: var(--larx-white-gray);
    cursor: pointer;
    transition: all 0.2s;
    padding: 8px 12px;
    min-width: auto;
    font-size: 12px;
}

#regenerate-feed-id:hover:not(:disabled) {
    background: var(--hover-bg);
    transform: rotate(180deg);
}

#regenerate-feed-id:disabled {
    background: rgba(0, 0, 0, 0.3);
    color: rgba(255, 255, 255, 0.4);
    cursor: not-allowed;
    transform: none;
}

/* Video Styles */
#local-video {
    width: 100%;
    height: 300px;
    background: #000;
    border-radius: 3px;
    margin-bottom: 15px;
    object-fit: cover;
    border: 1px solid var(--border-color);
}

/* Telemetry Grid */
.telemetry-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
    margin-top: 15px;
}

.telemetry-item {
    background: var(--card-bg);
    padding: 10px;
    border-radius: 3px;
    border: 1px solid var(--border-color);
    transition: background 0.2s ease;
}

.telemetry-item:hover {
    background: var(--hover-bg);
}

.telemetry-item .label {
    font-size: 9px;
    color: var(--larx-blue-gray);
    margin-bottom: 5px;
    font-family: var(--font-primary);
    text-transform: uppercase;
}

.telemetry-item .value {
    font-size: 14px;
    font-weight: bold;
    color: var(--larx-blue);
    font-family: var(--font-primary);
}

/* Log Container */
.log-container {
    flex: 1;
    overflow-y: auto;
    background: var(--card-bg);
    padding: 10px;
    border-radius: 3px;
    font-size: 9px;
    line-height: 1.5;
    max-height: 300px;
    border: 1px solid var(--border-color);
    scrollbar-color: rgba(255, 255, 255, 0.5) rgba(0, 0, 0, 0.5);
    scrollbar-width: thin;
}

.log-entry {
    margin-bottom: 5px;
    color: var(--larx-white-gray);
    font-family: var(--font-primary);
}

.log-entry.error {
    color: var(--larx-ais-error);
}

.log-entry.success {
    color: var(--larx-ais-active);
}

.log-entry.info {
    color: var(--larx-blue);
}

/* Checkbox Styles */
.checkbox-group {
    display: flex;
    align-items: center;
    gap: 10px;
}

.checkbox-group input[type="checkbox"] {
    width: 16px;
    height: 16px;
    accent-color: var(--larx-blue);
}

.checkbox-group label {
    font-size: 10px;
    color: var(--larx-white-gray);
    font-family: var(--font-primary);
    text-transform: uppercase;
}

/* Animations */
.fade-in {
    animation: fadeIn 0.5s ease-in;
}

.fade-out {
    animation: fadeOut 0.5s ease-out;
}

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

@keyframes fadeOut {
    from { 
        opacity: 1; 
        transform: translateY(0); 
    }
    to { 
        opacity: 0; 
        transform: translateY(-20px); 
    }
}

/* Light Theme Overrides */
[data-theme="light"] .login-box {
    background: var(--window-bg);
    box-shadow: 0 4px 20px rgba(59, 130, 246, 0.08), 0 1px 3px rgba(0, 0, 0, 0.05);
}

[data-theme="light"] .form-group input {
    border-bottom: 2px solid var(--text-color);
    color: var(--text-color);
}

[data-theme="light"] .form-group label {
    color: var(--text-color);
}

[data-theme="light"] .form-group input:focus ~ label,
[data-theme="light"] .form-group input:not(:placeholder-shown) ~ label {
    color: var(--larx-blue);
}

[data-theme="light"] .login-button {
    background: var(--larx-blue);
    color: white;
}

[data-theme="light"] .login-button:hover:not(:disabled) {
    background: var(--larx-blue-default);
}

[data-theme="light"] .control-group input:read-only {
    background: rgba(255, 255, 255, 0.5);
    color: var(--text-muted);
}

[data-theme="light"] button:disabled {
    background: rgba(255, 255, 255, 0.5);
    color: rgba(0, 0, 0, 0.4);
}

[data-theme="light"] #regenerate-feed-id:disabled {
    background: rgba(255, 255, 255, 0.5);
    color: rgba(0, 0, 0, 0.4);
}

/* Responsive Design */
/* Large tablets and small desktops */
@media (max-width: 1024px) {
    .container {
        max-width: 100%;
        padding: 0 10px;
    }
    
    .header {
        padding: 10px;
        margin-bottom: 15px;
    }
    
    .header h1 {
        font-size: 16px;
    }
    
    .panel {
        padding: 15px;
        min-width: auto;
    }
    
    .telemetry-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 8px;
    }
    
    #local-video {
        height: 250px;
    }
}

/* Tablets */
@media (max-width: 768px) {
    /* Allow vertical scrolling on body */
    body {
        overflow: auto;
        height: auto;
        min-height: 100vh;
    }
    
    .app-container {
        min-height: auto;
        padding: 5px;
    }
    
    .container {
        padding: 0 5px;
    }
    
    /* Switch to single column layout */
    .main-content {
        grid-template-columns: 1fr;
        gap: 15px;
    }
    
    /* Login screen responsive */
    .login-container {
        padding: 1rem;
        min-height: 100vh;
    }
    
    .login-box {
        flex-direction: column;
        min-width: 300px;
        max-width: 90vw;
        padding: 1.5rem;
    }
    
    .login-form-container,
    .login-info-container {
        width: 100%;
    }
    
    .login-info-container {
        text-align: center;
        padding-left: 0;
        margin-top: 15px;
    }
    
    /* Header responsive */
    .header {
        flex-direction: column;
        align-items: stretch;
        gap: 10px;
        padding: 10px;
        min-width: auto;
    }
    
    .header h1 {
        text-align: center;
        font-size: 14px;
    }
    
    .header-controls {
        flex-wrap: wrap;
        justify-content: center;
        gap: 8px;
    }
    
    .user-info {
        font-size: 9px;
        text-align: center;
        width: 100%;
        order: -1;
    }
    
    /* Panel adjustments */
    .panel {
        padding: 12px;
        min-width: auto;
    }
    
    .panel h2 {
        font-size: 12px;
        margin-bottom: 10px;
    }
    
    /* Telemetry grid becomes single column on small tablets */
    .telemetry-grid {
        grid-template-columns: 1fr;
        gap: 8px;
    }
    
    /* Video smaller on tablets */
    #local-video {
        height: 200px;
    }
    
    /* Log container smaller */
    .log-container {
        max-height: 200px;
        font-size: 8px;
    }
    
    /* Button adjustments */
    .button-group {
        flex-direction: column;
        gap: 8px;
    }
    
    button {
        font-size: 8px;
        padding: 5px 10px;
    }
    
    /* Location input grid responsive */
    .location-input-grid {
        grid-template-columns: 1fr;
        gap: 10px;
    }
}

/* Large phones / small tablets */
@media (max-width: 640px) {
    .login-container {
        padding: 0.5rem;
    }
    
    .login-box {
        min-width: 280px;
        padding: 1rem;
    }
    
    .login-header h1 {
        font-size: 20px;
    }
    
    .login-info-container h2 {
        font-size: 1.2rem;
    }
    
    .app-container {
        padding: 3px;
    }
    
    .container {
        padding: 0 3px;
    }
    
    .header {
        padding: 8px;
        margin-bottom: 10px;
    }
    
    .header h1 {
        font-size: 12px;
    }
    
    .panel {
        padding: 10px;
    }
    
    .controls {
        gap: 10px;
    }
    
    .control-group input[type="text"],
    .control-group input[type="number"] {
        padding: 6px;
        font-size: 10px;
    }
    
    .control-group label {
        font-size: 9px;
    }
    
    .control-group small {
        font-size: 8px;
    }
    
    #local-video {
        height: 180px;
    }
    
    .telemetry-item {
        padding: 8px;
    }
    
    .telemetry-item .label {
        font-size: 8px;
    }
    
    .telemetry-item .value {
        font-size: 12px;
    }
    
    .log-container {
        max-height: 180px;
        font-size: 7px;
        padding: 8px;
    }
    
    /* Make buttons touch-friendly */
    button {
        padding: 8px 12px;
        font-size: 9px;
        min-height: 32px;
    }
    
    .logout-btn,
    .theme-toggle {
        padding: 6px 10px;
        font-size: 8px;
        min-height: 28px;
    }
    
    #regenerate-feed-id {
        padding: 6px 10px;
        font-size: 10px;
        min-height: 32px;
    }
}

/* Phones */
@media (max-width: 480px) {
    /* Ensure scrolling on very small screens */
    html {
        overflow-x: auto;
    }
    
    body {
        overflow-x: auto;
        overflow-y: auto;
    }
    
    .login-container {
        padding: 0.25rem;
        align-items: flex-start;
        padding-top: 1rem;
    }
    
    .login-box {
        min-width: 260px;
        max-width: 95vw;
        padding: 0.75rem;
        margin: 0;
    }
    
    .login-header h1 {
        font-size: 18px;
    }
    
    .login-header p {
        font-size: 0.7rem;
    }
    
    .app-container {
        padding: 2px;
    }
    
    .container {
        padding: 0 2px;
        min-width: 300px;
    }
    
    /* Horizontal scroll for header if needed */
    .header {
        padding: 6px;
        margin-bottom: 8px;
        overflow-x: auto;
    }
    
    .header h1 {
        font-size: 11px;
        white-space: nowrap;
    }
    
    .header-controls {
        gap: 5px;
        min-width: max-content;
    }
    
    .user-info {
        font-size: 8px;
        white-space: nowrap;
    }
    
    /* Panel adjustments for very small screens */
    .panel {
        padding: 8px;
        margin-bottom: 10px;
        min-width: auto;
        overflow-x: auto;
    }
    
    .panel h2 {
        font-size: 11px;
        margin-bottom: 8px;
    }
    
    /* Controls stack vertically */
    .controls {
        gap: 8px;
    }
    
    .control-group {
        gap: 3px;
    }
    
    .control-group input[type="text"],
    .control-group input[type="number"] {
        padding: 5px;
        font-size: 9px;
        min-height: 28px;
    }
    
    .control-group label {
        font-size: 8px;
    }
    
    .control-group small {
        font-size: 7px;
    }
    
    /* Video responsive */
    #local-video {
        height: 150px;
        width: 100%;
    }
    
    /* Telemetry items smaller */
    .telemetry-item {
        padding: 6px;
    }
    
    .telemetry-item .label {
        font-size: 7px;
        margin-bottom: 3px;
    }
    
    .telemetry-item .value {
        font-size: 10px;
    }
    
    /* Log container very compact */
    .log-container {
        max-height: 150px;
        font-size: 6px;
        padding: 6px;
        line-height: 1.3;
    }
    
    /* Buttons stack and are touch-friendly */
    .button-group {
        gap: 6px;
    }
    
    button {
        padding: 10px 15px;
        font-size: 10px;
        min-height: 36px;
        width: 100%;
    }
    
    .logout-btn,
    .theme-toggle {
        padding: 8px 12px;
        font-size: 9px;
        min-height: 32px;
        min-width: 60px;
    }
    
    #regenerate-feed-id {
        padding: 8px 12px;
        font-size: 12px;
        min-height: 36px;
    }
    
    /* Checkbox groups stack */
    .checkbox-group {
        flex-direction: column;
        align-items: flex-start;
        gap: 5px;
    }
    
    .checkbox-group input[type="checkbox"] {
        width: 18px;
        height: 18px;
    }
    
    .checkbox-group label {
        font-size: 9px;
    }
    
    /* Manual location section */
    .manual-location-section {
        padding: 10px;
        margin: 10px 0;
    }
    
    .manual-location-section h3 {
        font-size: 12px;
        margin-bottom: 10px;
    }
    
    .location-input-grid {
        gap: 8px;
    }
    
    .manual-location-btn {
        padding: 12px;
        font-size: 11px;
        min-height: 40px;
    }
}

/* Very small screens */
@media (max-width: 360px) {
    .login-box {
        min-width: 240px;
        padding: 0.5rem;
    }
    
    .container {
        min-width: 280px;
    }
    
    .header h1 {
        font-size: 10px;
    }
    
    .panel {
        padding: 6px;
    }
    
    .panel h2 {
        font-size: 10px;
    }
    
    #local-video {
        height: 120px;
    }
    
    .log-container {
        max-height: 120px;
        font-size: 5px;
    }
    
    .telemetry-item .value {
        font-size: 9px;
    }
    
    button {
        font-size: 9px;
        padding: 8px 12px;
        min-height: 32px;
    }
}

/* Landscape orientation adjustments for phones */
@media (max-height: 500px) and (orientation: landscape) {
    .login-container {
        padding: 0.5rem;
        align-items: center;
    }
    
    .app-container {
        padding: 3px;
    }
    
    .header {
        margin-bottom: 5px;
    }
    
    .main-content {
        gap: 10px;
    }
    
    .panel {
        padding: 8px;
    }
    
    #local-video {
        height: 120px;
    }
    
    .log-container {
        max-height: 100px;
    }
    
    .telemetry-grid {
        grid-template-columns: repeat(3, 1fr);
        gap: 5px;
    }
    
    .telemetry-item {
        padding: 5px;
    }
    
    .telemetry-item .label {
        font-size: 6px;
    }
    
    .telemetry-item .value {
        font-size: 8px;
    }
}

/* GPS Status Indicators */
.gps-status-active {
    color: var(--larx-ais-active);
    font-weight: bold;
}

.gps-status-denied {
    color: var(--larx-ais-error);
    font-weight: bold;
}

.gps-status-error {
    color: var(--larx-ais-connecting);
    font-weight: bold;
}

.gps-status-unavailable {
    color: var(--text-muted);
    font-weight: bold;
}

.gps-status-unknown {
    color: var(--text-muted);
    font-weight: bold;
}

/* GPS Accuracy Indicators */
.accuracy-high {
    color: var(--larx-ais-active);
    font-weight: bold;
}

.accuracy-medium {
    color: var(--larx-ais-connecting);
    font-weight: bold;
}

.accuracy-low {
    color: var(--larx-ais-inactive);
    font-weight: bold;
}

.accuracy-simulated {
    color: var(--larx-blue);
    font-weight: bold;
}

/* Manual Location Section */
.manual-location-section {
    background: var(--input-bg);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 15px;
    margin: 15px 0;
    animation: fadeIn 0.3s ease-in;
}

.manual-location-section h3 {
    margin: 0 0 15px 0;
    color: var(--larx-blue);
    font-size: 14px;
    font-weight: bold;
}

.location-input-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 15px;
    margin-bottom: 15px;
}

.manual-location-btn {
    width: 100%;
    padding: 10px;
    background: var(--larx-blue);
    color: white;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-family: var(--font-primary);
    font-size: 12px;
    font-weight: bold;
    transition: all 0.2s ease;
}

.manual-location-btn:hover {
    background: var(--larx-blue-default);
    transform: translateY(-1px);
}

.manual-location-btn:active {
    transform: translateY(0);
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Stream Status and Monitoring */
#stream-status-indicator {
    position: absolute;
    top: 10px;
    left: 10px;
    padding: 4px 8px;
    border-radius: 3px;
    font-size: 10px;
    font-family: monospace;
    font-weight: bold;
    color: white;
    z-index: 20;
    transition: all 0.3s ease;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
}

#stream-disconnection-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.8);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    color: #ff4444;
    font-size: 14px;
    font-family: monospace;
    z-index: 10;
    text-align: center;
    backdrop-filter: blur(2px);
}

.stream-disconnect-notification {
    position: fixed;
    top: 80px;
    right: 20px;
    padding: 15px 20px;
    background-color: rgba(244, 67, 54, 0.95);
    color: white;
    border-radius: 5px;
    font-size: 12px;
    font-family: monospace;
    z-index: 10000;
    max-width: 350px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
    border: 1px solid rgba(255, 255, 255, 0.2);
    transform: translateX(100%);
    transition: transform 0.3s ease;
}

/* Video Container Positioning */
.video-container {
    position: relative;
}

/* Stream Status Colors */
.stream-status-live {
    background-color: rgba(76, 175, 80, 0.9) !important;
}

.stream-status-no-viewers {
    background-color: rgba(255, 193, 7, 0.9) !important;
}

.stream-status-offline {
    background-color: rgba(244, 67, 54, 0.9) !important;
}

/* Video Disconnection Effects */
.video-disconnected {
    filter: grayscale(1) brightness(0.5);
    opacity: 0.7;
    transition: all 0.5s ease;
}

/* Pulsing Animation for Disconnection Overlay */
@keyframes disconnectionPulse {
    0% { opacity: 0.8; }
    50% { opacity: 1; }
    100% { opacity: 0.8; }
}

#stream-disconnection-overlay {
    animation: disconnectionPulse 2s infinite ease-in-out;
}

/* Enhanced Status Indicator Styles */
.status-indicator.stream-connected {
    background-color: rgba(76, 175, 80, 0.9);
    color: white;
}

.status-indicator.stream-disconnected {
    background-color: rgba(244, 67, 54, 0.9);
    color: white;
    animation: disconnectionPulse 1.5s infinite ease-in-out;
}

/* Recording State Indicators */
.recording-active {
    border: 2px solid rgba(244, 67, 54, 0.8);
    box-shadow: 0 0 10px rgba(244, 67, 54, 0.3);
}

.recording-stopped {
    border: 2px solid rgba(128, 128, 128, 0.5);
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(-10px); }
    to { opacity: 1; transform: translateY(0); }
}

.stream-url-banner {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-top: 10px;
    padding: 10px 14px;
    border-radius: 6px;
    background: rgba(78, 255, 78, 0.08);
    border: 1px solid var(--larx-ais-active);
    animation: fadeIn 0.3s ease;
}

.stream-url-label {
    font-weight: 700;
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--larx-ais-active);
    white-space: nowrap;
}

.stream-url-link {
    flex: 1;
    color: var(--larx-ais-active);
    text-decoration: none;
    font-family: 'Space Mono', monospace;
    font-size: 0.85rem;
    word-break: break-all;
}

.stream-url-link:hover {
    text-decoration: underline;
}

.copy-stream-url {
    background: none;
    border: 1px solid var(--larx-ais-active);
    border-radius: 4px;
    padding: 4px 8px;
    cursor: pointer;
    font-size: 0.9rem;
    transition: background 0.2s;
}

.copy-stream-url:hover {
    background: rgba(78, 255, 78, 0.15);
} 