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

html, body {
    width: 100%;
    height: 100%;
    margin: 0;
    padding: 0;
    background: #000;
    overflow: hidden;
    font-family: 'Rajdhani', sans-serif;
    color: #fff;
}

/* Canvas fills entire viewport */
#blackHoleCanvas {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: block;
}

/* ========== START OVERLAY ========== */
#start-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: radial-gradient(ellipse at center, rgba(5, 2, 15, 0.75) 0%, rgba(0, 0, 0, 0.85) 70%);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2000;
    cursor: pointer;
    transition: opacity 0.8s ease, transform 0.8s ease;
    backdrop-filter: blur(3px);
}

#start-overlay.hidden {
    opacity: 0;
    transform: scale(1.1);
    pointer-events: none;
}

.start-content {
    text-align: center;
    position: relative;
}

/* Animated rings */
.start-rings {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    pointer-events: none;
}

.ring {
    position: absolute;
    border-radius: 50%;
    border: 1px solid;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
}

.ring-1 {
    width: 200px;
    height: 200px;
    border-color: rgba(255, 100, 50, 0.3);
    animation: ring-pulse 3s ease-in-out infinite;
}

.ring-2 {
    width: 280px;
    height: 280px;
    border-color: rgba(255, 150, 50, 0.2);
    animation: ring-pulse 3s ease-in-out infinite 0.5s;
}

.ring-3 {
    width: 360px;
    height: 360px;
    border-color: rgba(255, 200, 100, 0.1);
    animation: ring-pulse 3s ease-in-out infinite 1s;
}

@keyframes ring-pulse {
    0%, 100% { transform: translate(-50%, -50%) scale(1); opacity: 1; }
    50% { transform: translate(-50%, -50%) scale(1.1); opacity: 0.5; }
}

/* Black hole icon */
.start-icon {
    width: 140px;
    height: 140px;
    margin: 0 auto 30px;
    position: relative;
    z-index: 1;
}

.black-hole-icon {
    width: 100%;
    height: 100%;
    filter: drop-shadow(0 0 30px rgba(255, 100, 0, 0.6)) drop-shadow(0 0 60px rgba(255, 50, 0, 0.3));
}

.hole-circle {
    animation: hole-glow 2s ease-in-out infinite;
}

.disk-ring {
    animation: disk-rotate 8s linear infinite;
    transform-origin: center;
}

@keyframes hole-glow {
    0%, 100% { filter: brightness(1); }
    50% { filter: brightness(1.3); }
}

@keyframes disk-rotate {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

/* Text styles */
.start-title {
    font-family: 'Orbitron', sans-serif;
    font-size: clamp(2rem, 6vw, 3.5rem);
    font-weight: 700;
    color: #fff;
    letter-spacing: 0.2em;
    margin-bottom: 10px;
    text-shadow: 0 0 30px rgba(255, 100, 50, 0.8), 0 0 60px rgba(255, 50, 0, 0.4);
    animation: title-glow 2s ease-in-out infinite;
}

@keyframes title-glow {
    0%, 100% { text-shadow: 0 0 30px rgba(255, 100, 50, 0.8), 0 0 60px rgba(255, 50, 0, 0.4); }
    50% { text-shadow: 0 0 40px rgba(255, 100, 50, 1), 0 0 80px rgba(255, 50, 0, 0.6); }
}

.start-subtitle {
    font-family: 'Rajdhani', sans-serif;
    font-size: clamp(0.6rem, 2vw, 1rem);
    color: rgba(255, 180, 120, 0.8);
    letter-spacing: 0.3em;
    text-transform: uppercase;
    margin-bottom: 50px;
}

.start-prompt {
    display: inline-flex;
    align-items: center;
    gap: 12px;
    padding: 15px 35px;
    background: linear-gradient(135deg, rgba(0, 255, 255, 0.15) 0%, rgba(0, 200, 255, 0.1) 100%);
    border: 2px solid rgba(0, 255, 255, 0.5);
    border-radius: 50px;
    margin-bottom: 20px;
    animation: prompt-pulse 2s ease-in-out infinite;
    transition: all 0.3s ease;
}

.start-prompt:hover {
    background: linear-gradient(135deg, rgba(0, 255, 255, 0.25) 0%, rgba(0, 200, 255, 0.2) 100%);
    border-color: rgba(0, 255, 255, 0.8);
    transform: scale(1.05);
}

@keyframes prompt-pulse {
    0%, 100% { box-shadow: 0 0 20px rgba(0, 255, 255, 0.3), inset 0 0 20px rgba(0, 255, 255, 0.05); }
    50% { box-shadow: 0 0 40px rgba(0, 255, 255, 0.5), inset 0 0 30px rgba(0, 255, 255, 0.1); }
}

.prompt-icon {
    font-size: 1.5rem;
    color: #00ffff;
    animation: icon-bounce 1s ease-in-out infinite;
}

@keyframes icon-bounce {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-3px); }
}

.prompt-text {
    font-family: 'Orbitron', sans-serif;
    font-size: clamp(0.7rem, 2vw, 1rem);
    color: #00ffff;
    letter-spacing: 0.15em;
    text-shadow: 0 0 10px rgba(0, 255, 255, 0.5);
}

.start-hint {
    font-family: 'Rajdhani', sans-serif;
    font-size: clamp(0.55rem, 1.5vw, 0.8rem);
    color: rgba(255, 255, 255, 0.4);
    font-style: italic;
    letter-spacing: 0.1em;
}

/* Mobile adjustments for overlay */
@media (max-width: 600px) {
    .ring-1 { width: 150px; height: 150px; }
    .ring-2 { width: 210px; height: 210px; }
    .ring-3 { width: 270px; height: 270px; }
    .start-icon { width: 100px; height: 100px; margin-bottom: 20px; }
    .start-prompt { padding: 12px 25px; gap: 10px; }
    .prompt-icon { font-size: 1.2rem; }
}

/* Title - prominent */
.title-overlay {
    position: fixed;
    top: 15px;
    left: 50%;
    transform: translateX(-50%);
    text-align: center;
    pointer-events: none;
    z-index: 100;
    white-space: nowrap;
}

.title-overlay h1 {
    font-family: 'Orbitron', sans-serif;
    font-size: clamp(1rem, 3.5vw, 2rem);
    font-weight: 700;
    color: #fff;
    letter-spacing: 0.15em;
    text-shadow: 0 0 20px rgba(255, 100, 50, 0.9), 0 0 40px rgba(255, 50, 0, 0.5);
    margin-bottom: 3px;
}

.title-overlay p {
    font-size: clamp(0.45rem, 1.5vw, 0.7rem);
    color: rgba(255, 200, 150, 0.8);
    letter-spacing: 0.1em;
    text-transform: uppercase;
}

/* Panels - dynamic sizing based on viewport */
.panel {
    position: fixed;
    background: linear-gradient(145deg, rgba(8, 8, 12, 0.92) 0%, rgba(12, 16, 24, 0.88) 100%);
    border-radius: 6px;
    backdrop-filter: blur(12px);
    z-index: 100;
}

/* Control Panel - Right side */
#controls-panel {
    position: fixed;
    top: 60px;
    right: 10px;
    width: clamp(150px, 15vw, 260px);
    max-height: calc(100vh - 70px);
    overflow-y: auto;
    background: linear-gradient(145deg, rgba(8, 8, 12, 0.92) 0%, rgba(12, 16, 24, 0.88) 100%);
    border: 1px solid rgba(255, 100, 50, 0.3);
    border-radius: 6px;
    padding: clamp(8px, 1vw, 14px);
    z-index: 100;
    backdrop-filter: blur(12px);
}

/* Particle Panel - Left side */
#particle-panel {
    position: fixed;
    top: 60px;
    left: 10px;
    width: clamp(140px, 14vw, 240px);
    max-height: calc(100vh - 130px);
    overflow-y: auto;
    background: linear-gradient(145deg, rgba(8, 8, 12, 0.92) 0%, rgba(12, 16, 24, 0.88) 100%);
    border: 1px solid rgba(0, 255, 255, 0.3);
    border-radius: 6px;
    padding: clamp(8px, 1vw, 14px);
    z-index: 100;
    backdrop-filter: blur(12px);
}

/* Telemetry - Bottom center */
#telemetry-panel {
    position: fixed;
    bottom: 8px;
    left: 50%;
    transform: translateX(-50%);
    background: linear-gradient(145deg, rgba(8, 8, 12, 0.92) 0%, rgba(12, 16, 24, 0.88) 100%);
    border: 1px solid rgba(0, 255, 255, 0.3);
    border-radius: 6px;
    padding: clamp(4px, 0.6vw, 10px);
    z-index: 100;
    backdrop-filter: blur(12px);
    max-width: calc(100vw - 16px);
}

.telemetry-header {
    display: flex;
    align-items: center;
    gap: clamp(3px, 0.5vw, 6px);
    margin-bottom: 4px;
    padding-bottom: 3px;
    border-bottom: 1px solid rgba(0, 255, 255, 0.2);
}

.telemetry-header h3 {
    font-family: 'Orbitron', sans-serif;
    font-size: clamp(0.4rem, 0.9vw, 0.55rem);
    color: #00ffff;
    letter-spacing: 0.05em;
    white-space: nowrap;
}

.telemetry-icon {
    color: #00ffff;
    font-size: clamp(0.5rem, 0.8vw, 0.7rem);
    text-shadow: 0 0 8px #00ffff;
}

.telemetry-nav {
    display: flex;
    align-items: center;
    gap: 4px;
    margin-left: auto;
}

.telemetry-nav span {
    font-family: 'Orbitron', sans-serif;
    font-size: clamp(0.4rem, 0.7vw, 0.5rem);
    color: rgba(255, 255, 255, 0.7);
    min-width: 32px;
    text-align: center;
}

.nav-btn {
    background: rgba(0, 255, 255, 0.15);
    border: 1px solid rgba(0, 255, 255, 0.4);
    color: #00ffff;
    padding: 3px 8px;
    border-radius: 3px;
    cursor: pointer;
    font-size: clamp(0.5rem, 0.8vw, 0.6rem);
    transition: all 0.2s;
}

.nav-btn:hover {
    background: rgba(0, 255, 255, 0.3);
}

.telemetry-warning {
    text-align: center;
    font-size: clamp(0.4rem, 0.7vw, 0.5rem);
    padding: 2px;
    margin-bottom: 3px;
    border-radius: 3px;
    min-height: 12px;
}

.telemetry-warning.danger {
    background: rgba(255, 50, 50, 0.25);
    color: #ff5555;
    animation: pulse 1s infinite;
}

.telemetry-warning.escape {
    background: rgba(50, 255, 50, 0.25);
    color: #55ff55;
}

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

.telemetry-content {
    /* Default: always visible on desktop */
    display: block;
}

/* mobile-collapsed: Only applies on mobile via JS - marker class */
.mobile-collapsed {
    /* Marker class - actual collapsed styles applied via .collapsed */
    /* JS adds 'collapsed' class on mobile devices only */
    transition: all 0.3s ease;
}

.telemetry-grid {
    display: flex;
    flex-wrap: wrap;
    gap: clamp(3px, 0.4vw, 5px);
    justify-content: center;
}

.telemetry-item {
    display: flex;
    flex-direction: column;
    padding: clamp(2px, 0.4vw, 4px) clamp(4px, 0.6vw, 6px);
    background: rgba(0, 255, 255, 0.05);
    border-radius: 3px;
    border-left: 2px solid rgba(0, 255, 255, 0.3);
    min-width: clamp(48px, 6vw, 65px);
}

.telemetry-label {
    font-size: clamp(0.3rem, 0.55vw, 0.4rem);
    color: rgba(255, 255, 255, 0.55);
    text-transform: uppercase;
    white-space: nowrap;
}

.telemetry-value {
    font-family: 'Orbitron', monospace;
    font-size: clamp(0.42rem, 0.75vw, 0.55rem);
    color: #00ffff;
    white-space: nowrap;
}

/* Mobile Zoom Panel - Only visible on mobile */
#zoom-panel {
    display: none;
    position: fixed;
    right: 8px;
    bottom: 95px;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    padding: 6px 4px;
    background: linear-gradient(145deg, rgba(8, 8, 12, 0.85) 0%, rgba(12, 16, 24, 0.8) 100%);
    border: 1px solid rgba(0, 255, 255, 0.25);
    border-radius: 15px;
    z-index: 90;
    backdrop-filter: blur(8px);
}

.zoom-label {
    font-family: 'Orbitron', sans-serif;
    font-size: 0.6rem;
    color: #00ffff;
    text-shadow: 0 0 5px rgba(0, 255, 255, 0.5);
    user-select: none;
    line-height: 1;
}


#zoomSlider {
    -webkit-appearance: slider-vertical;
    appearance: slider-vertical;
    width: 14px;
    height: 70px;
    background: transparent;
    cursor: pointer;
}

#zoomSlider::-webkit-slider-runnable-track {
    width: 3px;
    height: 100%;
    background: linear-gradient(to top, rgba(0, 255, 255, 0.2), rgba(0, 255, 255, 0.5));
    border-radius: 2px;
}

#zoomSlider::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 12px;
    height: 12px;
    background: #00ffff;
    border-radius: 50%;
    cursor: pointer;
    box-shadow: 0 0 6px rgba(0, 255, 255, 0.7);
    margin-left: -4px;
}

#zoomSlider::-moz-range-track {
    width: 3px;
    height: 100%;
    background: linear-gradient(to top, rgba(0, 255, 255, 0.2), rgba(0, 255, 255, 0.5));
    border-radius: 2px;
}

#zoomSlider::-moz-range-thumb {
    width: 12px;
    height: 12px;
    background: #00ffff;
    border-radius: 50%;
    cursor: pointer;
    border: none;
    box-shadow: 0 0 6px rgba(0, 255, 255, 0.7);
}

/* Info Panel - Hidden on most screens */
#info-panel {
    display: none;
}

.panel-header {
    display: flex;
    align-items: center;
    gap: clamp(3px, 0.5vw, 5px);
    margin-bottom: clamp(4px, 0.6vw, 6px);
    padding-bottom: 4px;
    border-bottom: 1px solid rgba(255, 100, 50, 0.25);
}

.panel-header h2 {
    font-family: 'Orbitron', sans-serif;
    font-size: clamp(0.5rem, 0.9vw, 0.65rem);
    color: #ff8844;
    letter-spacing: 0.05em;
}

.panel-icon {
    color: #ff6633;
    font-size: clamp(0.6rem, 0.9vw, 0.75rem);
}

.control-section {
    margin-bottom: clamp(4px, 0.6vw, 8px);
}

.control-section h3 {
    font-family: 'Orbitron', sans-serif;
    font-size: clamp(0.4rem, 0.7vw, 0.5rem);
    color: rgba(255, 150, 100, 0.9);
    letter-spacing: 0.05em;
    margin-bottom: clamp(3px, 0.4vw, 5px);
    text-transform: uppercase;
}

.control-group {
    display: grid;
    grid-template-columns: 1fr auto;
    align-items: center;
    gap: clamp(2px, 0.3vw, 4px);
    margin-bottom: clamp(4px, 0.5vw, 6px);
}

.control-group label {
    font-size: clamp(0.42rem, 0.7vw, 0.52rem);
    color: rgba(255, 255, 255, 0.8);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.control-group input[type="range"] {
    width: 100%;
    grid-column: 1 / -1;
    height: 3px;
    background: rgba(255, 100, 50, 0.25);
    border-radius: 2px;
    -webkit-appearance: none;
    appearance: none;
    cursor: pointer;
}

.control-group input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 12px;
    height: 12px;
    background: #ff6633;
    border-radius: 50%;
    cursor: pointer;
    box-shadow: 0 0 6px rgba(255, 100, 50, 0.5);
}

#particle-panel .control-group input[type="range"] {
    background: rgba(0, 255, 255, 0.25);
}

#particle-panel .control-group input[type="range"]::-webkit-slider-thumb {
    background: #00ffff;
    box-shadow: 0 0 6px rgba(0, 255, 255, 0.5);
}

.value-display {
    font-family: 'Orbitron', monospace;
    font-size: clamp(0.4rem, 0.65vw, 0.5rem);
    color: #ff8844;
    text-align: right;
    min-width: clamp(20px, 3vw, 28px);
}

#particle-panel .value-display {
    color: #00ffff;
}

.checkbox-group {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.checkbox-group input[type="checkbox"] {
    width: 14px;
    height: 14px;
    accent-color: #ff6633;
    cursor: pointer;
}

.button-group {
    display: flex;
    gap: clamp(3px, 0.4vw, 5px);
    margin-bottom: clamp(4px, 0.5vw, 6px);
}

.control-button {
    flex: 1;
    padding: clamp(4px, 0.6vw, 7px) clamp(5px, 0.7vw, 8px);
    border: none;
    border-radius: 4px;
    font-family: 'Orbitron', sans-serif;
    font-size: clamp(0.4rem, 0.65vw, 0.5rem);
    cursor: pointer;
    text-transform: uppercase;
    transition: all 0.2s;
}

.launch-btn {
    background: rgba(0, 255, 255, 0.2);
    color: #00ffff;
    border: 1px solid rgba(0, 255, 255, 0.4);
}

.launch-btn:hover {
    background: rgba(0, 255, 255, 0.35);
}

.reset-btn {
    background: rgba(255, 100, 50, 0.2);
    color: #ff8844;
    border: 1px solid rgba(255, 100, 50, 0.4);
}

.reset-btn:hover {
    background: rgba(255, 100, 50, 0.35);
}

.particle-status {
    display: flex;
    justify-content: space-between;
    padding: clamp(3px, 0.4vw, 5px) clamp(4px, 0.5vw, 6px);
    background: rgba(0, 255, 255, 0.06);
    border-radius: 3px;
    border: 1px solid rgba(0, 255, 255, 0.2);
}

.status-label {
    font-size: clamp(0.4rem, 0.6vw, 0.48rem);
    color: rgba(255, 255, 255, 0.55);
    text-transform: uppercase;
}

.status-value {
    font-family: 'Orbitron', sans-serif;
    font-size: clamp(0.42rem, 0.65vw, 0.5rem);
    color: #00ffff;
}

.info-section {
    margin-bottom: clamp(4px, 0.5vw, 6px);
}

.info-section h4 {
    font-size: clamp(0.38rem, 0.6vw, 0.45rem);
    color: rgba(255, 150, 100, 0.75);
    margin-bottom: 3px;
    text-transform: uppercase;
}

.info-item {
    display: flex;
    justify-content: space-between;
    padding: 3px 0;
    border-bottom: 1px solid rgba(255, 100, 50, 0.1);
}

.info-label {
    font-size: clamp(0.4rem, 0.6vw, 0.48rem);
    color: rgba(255, 255, 255, 0.65);
}

.info-value {
    font-family: 'Orbitron', monospace;
    font-size: clamp(0.45rem, 0.7vw, 0.52rem);
    color: #ff8844;
}

.info-text {
    font-size: clamp(0.35rem, 0.55vw, 0.42rem);
    color: rgba(255, 255, 255, 0.45);
    line-height: 1.3;
}

::-webkit-scrollbar { width: 3px; }
::-webkit-scrollbar-track { background: rgba(0, 0, 0, 0.3); }
::-webkit-scrollbar-thumb { background: rgba(255, 100, 50, 0.5); border-radius: 2px; }

/* ========== RESPONSIVE BREAKPOINTS ========== */

/* Large screens (1200px+) - show info panel */
@media (min-width: 1200px) {
    #controls-panel { width: 260px; padding: 14px; }
    #particle-panel { width: 240px; padding: 14px; }
    #info-panel {
        display: block;
        position: fixed;
        bottom: 12px;
        right: 12px;
        width: 200px;
        background: linear-gradient(145deg, rgba(8, 8, 12, 0.92) 0%, rgba(12, 16, 24, 0.88) 100%);
        border: 1px solid rgba(255, 100, 50, 0.3);
        border-radius: 6px;
        padding: 12px;
        z-index: 100;
    }
    .telemetry-item { min-width: 75px; padding: 4px 6px; }
    .telemetry-label { font-size: 0.42rem; }
    .telemetry-value { font-size: 0.58rem; }
    .control-group label { font-size: 0.58rem; }
    .value-display { font-size: 0.52rem; }
    .control-section h3 { font-size: 0.52rem; }
    .control-button { font-size: 0.5rem; padding: 7px 9px; }
    .panel-header h2 { font-size: 0.68rem; }
}

/* Extra large screens (1500px+) */
@media (min-width: 1500px) {
    #controls-panel { width: 300px; padding: 16px; }
    #particle-panel { width: 280px; padding: 16px; }
    #info-panel { width: 230px; padding: 14px; }
    .telemetry-item { min-width: 85px; padding: 5px 8px; }
    .telemetry-label { font-size: 0.45rem; }
    .telemetry-value { font-size: 0.62rem; }
    .control-group label { font-size: 0.62rem; }
    .value-display { font-size: 0.56rem; }
    .control-section h3 { font-size: 0.55rem; }
    .control-button { font-size: 0.52rem; padding: 8px 10px; }
    .panel-header h2 { font-size: 0.72rem; }
}

/* Medium screens (768px - 1199px) */
@media (min-width: 768px) and (max-width: 1199px) {
    #controls-panel { width: 200px; padding: 10px; }
    #particle-panel { width: 185px; padding: 10px; }
    .telemetry-item { min-width: 62px; }
    .control-group label { font-size: 0.52rem; }
    .value-display { font-size: 0.48rem; }
}

/* ========== MOBILE (< 768px) ========== */
@media (max-width: 767px) {
    .title-overlay { 
        top: 10px;
        left: 50%;
        transform: translateX(-50%);
        width: auto;
        max-width: 60%;
        z-index: 200;
    }
    .title-overlay h1 { 
        font-size: 1.2rem;
        letter-spacing: 0.1em;
    }
    .title-overlay p { 
        font-size: 0.5rem;
        margin-top: 1px;
    }
    
    /* Collapsible panels for mobile */
    .panel {
        transition: all 0.3s ease;
    }
    
    .panel-header {
        cursor: pointer;
        user-select: none;
        position: relative;
        padding-right: 25px !important;
        margin-bottom: 0 !important;
        display: flex !important;
    }
    
    .panel-header::after {
        content: '▼';
        position: absolute;
        right: 5px;
        top: 50%;
        transform: translateY(-50%);
        font-size: 0.7rem;
        color: #ff6633;
        transition: transform 0.3s ease;
    }
    
    .panel.collapsed .panel-header::after {
        transform: translateY(-50%) rotate(-90deg);
    }
    
    .panel.collapsed .panel-header {
        border-bottom: none;
        margin-bottom: 0;
        padding-bottom: 0;
    }
    
    .panel-content {
        max-height: 80vh;
        overflow-y: auto;
        transition: max-height 0.3s ease, opacity 0.3s ease, padding 0.3s ease;
        opacity: 1;
        padding-top: 10px;
    }
    
    .panel.collapsed .panel-content {
        max-height: 0;
        opacity: 0;
        padding-top: 0;
        padding-bottom: 0;
    }
    
    /* ===== PANELS EXPANDED: BIG & PROPORTIONAL ===== */
    #controls-panel:not(.collapsed), #particle-panel:not(.collapsed) {
        width: clamp(200px, 75vw, 320px) !important;
        max-height: 85vh !important;
        padding: 12px !important;
        z-index: 150 !important;
    }
    
    #controls-panel.collapsed, #particle-panel.collapsed {
        width: auto !important;
        min-width: 100px;
        padding: 8px 10px !important;
    }
    
    /* Larger text when expanded - READABLE */
    .panel:not(.collapsed) .control-group label {
        font-size: 0.65rem !important;
    }
    
    .panel:not(.collapsed) .value-display {
        font-size: 0.6rem !important;
        min-width: 35px !important;
    }
    
    .panel:not(.collapsed) .control-section h3 {
        font-size: 0.6rem !important;
        margin-bottom: 6px !important;
    }
    
    .panel:not(.collapsed) .control-button {
        font-size: 0.6rem !important;
        padding: 10px 14px !important;
    }
    
    .panel:not(.collapsed) .control-group {
        margin-bottom: 8px !important;
    }
    
    .panel:not(.collapsed) input[type="range"] {
        height: 6px !important;
    }
    
    .panel:not(.collapsed) .panel-header h2 {
        font-size: 0.7rem !important;
    }
    
    .panel-header h2 {
        font-size: 0.55rem !important;
    }
    
    /* ===== ZOOM SLIDER: HORIZONTAL, CENTERED ABOVE TELEMETRY ===== */
    #zoom-panel {
        display: flex;
        flex-direction: row !important;
        position: fixed;
        bottom: 85px; /* Default: when telemetry collapsed - raised for iPhone home bar */
        left: 50%;
        transform: translateX(-50%);
        right: auto !important;
        width: clamp(150px, 50vw, 220px);
        height: auto;
        padding: 8px 12px;
        gap: 8px;
        justify-content: center;
        align-items: center;
        z-index: 95;
        transition: bottom 0.3s ease;
    }
    
    /* Zoom moves up when telemetry is expanded */
    #zoom-panel.telemetry-expanded {
        bottom: 160px;
    }
    
    #zoom-panel .zoom-label {
        font-size: 0.9rem;
        color: #00ffff;
    }
    
    #zoom-panel #zoomSlider {
        -webkit-appearance: none !important;
        appearance: none !important;
        writing-mode: horizontal-tb !important;
        width: 100%;
        height: 6px;
        background: rgba(0, 255, 255, 0.25);
        border-radius: 3px;
        margin: 0;
        padding: 0;
    }
    
    #zoom-panel #zoomSlider::-webkit-slider-runnable-track {
        height: 6px;
        background: rgba(0, 255, 255, 0.25);
        border-radius: 3px;
    }
    
    #zoom-panel #zoomSlider::-webkit-slider-thumb {
        -webkit-appearance: none;
        appearance: none;
        width: 20px;
        height: 20px;
        background: linear-gradient(135deg, #00ffff, #0099cc);
        border-radius: 50%;
        cursor: pointer;
        box-shadow: 0 0 10px rgba(0, 255, 255, 0.7);
        margin-top: -7px; /* Center thumb on track */
        border: 2px solid rgba(255, 255, 255, 0.5);
    }
    
    #zoom-panel #zoomSlider::-moz-range-track {
        height: 6px;
        background: rgba(0, 255, 255, 0.25);
        border-radius: 3px;
    }
    
    #zoom-panel #zoomSlider::-moz-range-thumb {
        width: 20px;
        height: 20px;
        background: linear-gradient(135deg, #00ffff, #0099cc);
        border-radius: 50%;
        cursor: pointer;
        box-shadow: 0 0 10px rgba(0, 255, 255, 0.7);
        border: 2px solid rgba(255, 255, 255, 0.5);
    }
    
    /* ===== TELEMETRY: DROP-UP COLLAPSIBLE ===== */
    #telemetry-panel {
        bottom: 25px; /* Raised for iPhone home indicator bar */
        left: 4px;
        right: 4px;
        transform: none;
        width: auto;
        max-width: none;
        padding: 6px 8px;
        transition: all 0.3s ease;
    }
    
    .telemetry-header {
        cursor: pointer;
        user-select: none;
        flex-wrap: nowrap;
        gap: 6px;
        position: relative;
        padding-left: 20px;
    }
    
    .telemetry-header::before {
        content: '▲';
        position: absolute;
        left: 0;
        top: 50%;
        transform: translateY(-50%);
        font-size: 0.7rem;
        color: #00ffff;
        transition: transform 0.3s ease;
    }
    
    #telemetry-panel.collapsed .telemetry-header::before {
        transform: translateY(-50%) rotate(180deg);
    }
    
    .telemetry-content {
        max-height: 300px;
        overflow: hidden;
        transition: max-height 0.3s ease, opacity 0.3s ease, padding 0.3s ease;
        opacity: 1;
        padding-top: 8px;
    }
    
    #telemetry-panel.collapsed .telemetry-content {
        max-height: 0;
        opacity: 0;
        padding-top: 0;
    }
    
    .telemetry-header h3 {
        font-size: 0.5rem;
    }
    
    .telemetry-grid {
        display: grid;
        grid-template-columns: repeat(4, 1fr);
        gap: 4px;
    }
    
    .telemetry-item {
        min-width: auto;
        padding: 4px 5px;
    }
    
    .telemetry-label { font-size: 0.35rem; }
    .telemetry-value { font-size: 0.48rem; }
    
    /* ===== NAV ARROWS: BIGGER ===== */
    .nav-btn {
        padding: 6px 12px !important;
        font-size: 0.9rem !important;
        min-width: 36px;
    }
    
    .telemetry-nav span {
        font-size: 0.55rem;
        min-width: 40px;
    }
    
    .panel-header {
        margin-bottom: 3px;
        padding-bottom: 2px;
    }
    
    .panel-icon { font-size: 0.6rem; }
    
    /* Mobile: panels at top corners - below title */
    #controls-panel {
        top: 52px;
        right: 4px;
        width: 115px;
        max-height: calc(50vh - 60px);
        padding: 6px;
    }
    
    #particle-panel {
        top: 52px;
        left: 4px;
        width: 115px;
        max-height: calc(50vh - 60px);
        padding: 6px;
    }
    
    .control-section { margin-bottom: 4px; }
    .control-section h3 { 
        font-size: 0.36rem; 
        margin-bottom: 2px; 
    }
    
    .control-group { 
        gap: 2px; 
        margin-bottom: 3px; 
    }
    .control-group label { font-size: 0.36rem; }
    .value-display { font-size: 0.36rem; min-width: 18px; }
    
    .control-button { 
        font-size: 0.36rem; 
        padding: 4px;
    }
    
    .button-group {
        flex-direction: column;
        gap: 2px;
    }
    
    .particle-status {
        padding: 2px 3px;
    }
    
    .status-label, .status-value { font-size: 0.36rem; }
    
    .control-group input[type="range"]::-webkit-slider-thumb { 
        width: 14px; 
        height: 14px; 
    }
}

/* Very small phones (< 400px) */
@media (max-width: 399px) {
    .title-overlay h1 { font-size: 0.7rem; }
    .title-overlay p { display: none; }
    
    #controls-panel { width: 100px; padding: 4px; }
    #particle-panel { width: 95px; padding: 4px; }
    
    .panel-header { display: none; }
    
    .telemetry-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .telemetry-header h3 { font-size: 0.32rem; }
    .control-section h3 { font-size: 0.32rem; }
    .control-group label { font-size: 0.32rem; }
    .value-display { font-size: 0.32rem; min-width: 15px; }
    .control-button { font-size: 0.32rem; padding: 3px; }
}

/* Landscape mobile */
@media (max-height: 500px) and (orientation: landscape) {
    .title-overlay { display: none; }
    
    #controls-panel {
        top: 48px;
        right: 5px;
        max-height: calc(100vh - 100px);
    }
    
    #particle-panel {
        top: 48px;
        left: 5px;
        max-height: calc(100vh - 100px);
    }
    
    #telemetry-panel {
        bottom: 22px; /* Raised for iPhone home indicator */
    }
    
    .telemetry-grid {
        display: flex;
        flex-wrap: nowrap;
        overflow-x: auto;
        gap: 4px;
        -webkit-overflow-scrolling: touch;
    }
    
    .telemetry-item {
        flex-shrink: 0;
        min-width: 55px;
    }
}

/* Very short screens */
@media (max-height: 400px) {
    #controls-panel, #particle-panel { 
        max-height: calc(100vh - 45px); 
    }
    .control-section { margin-bottom: 2px; }
    #telemetry-panel { 
        display: none; 
    }
}
