/* Reset and base styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html, body {
    height: 100%;
    overflow: hidden;
    font-family: 'Courier New', monospace;
    background: radial-gradient(circle at center, #1a1a2e 0%, #0a0a0a 100%);
    color: #e0e0e0;
    user-select: none;
    -webkit-user-select: none;
    -webkit-touch-callout: none;
    touch-action: manipulation;
    /* Emergency visibility */
    opacity: 1 !important;
    visibility: visible !important;
}

/* Safe area support */
.app-container {
    height: 100vh;
    height: 100svh;
    display: flex;
    flex-direction: column;
    padding: env(safe-area-inset-top, 10px) env(safe-area-inset-right, 10px) env(safe-area-inset-bottom, 10px) env(safe-area-inset-left, 10px);
    gap: 5px;
    overflow: hidden;
    /* Emergency visibility */
    opacity: 1 !important;
    visibility: visible !important;
    position: relative;
    z-index: 1;
}

/* Status message */
.status-message {
    position: fixed;
    top: 20px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(255, 215, 0, 0.9);
    color: #000;
    padding: 10px 20px;
    border-radius: 5px;
    z-index: 1000;
    max-width: 90%;
    text-align: center;
    font-size: 14px;
}

.hidden {
    display: none !important;
}

/* Emergency override for main elements */
.zodiac-section, .fork-section, .scale-section, .navigation-header {
    opacity: 1 !important;
    visibility: visible !important;
    display: flex !important;
}

/* Zodiac wheel section */
.zodiac-section {
    flex: 0 0 35%;
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 180px;
    max-height: 250px;
}

.zodiac-wheel {
    width: 100%;
    max-width: 600px;
    height: auto;
    filter: drop-shadow(0 0 20px rgba(255, 215, 0, 0.3));
    transition: transform 0.6s cubic-bezier(0.34, 1.56, 0.64, 1), filter 0.3s ease;
    animation: zodiacBreathe 8s ease-in-out infinite;
}

/* Breathing animation for mystical effect */
@keyframes zodiacBreathe {
    0%, 100% {
        transform: scale(1);
        filter: drop-shadow(0 0 20px rgba(255, 215, 0, 0.3));
    }
    50% {
        transform: scale(1.02);
        filter: drop-shadow(0 0 25px rgba(255, 215, 0, 0.4));
    }
}

/* Pulse effect when tonic changes */
.zodiac-wheel.tonic-change {
    animation: zodiacPulse 0.8s ease-out;
}

@keyframes zodiacPulse {
    0% {
        transform: scale(1);
    }
    30% {
        transform: scale(1.08);
        filter: drop-shadow(0 0 35px rgba(255, 215, 0, 0.7));
    }
    100% {
        transform: scale(1);
        filter: drop-shadow(0 0 20px rgba(255, 215, 0, 0.3));
    }
}

/* Initial load animation */
.zodiac-wheel.loading {
    opacity: 0;
    transform: scale(0.5);
    animation: zodiacLoad 1.5s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
}

@keyframes zodiacLoad {
    0% {
        opacity: 0;
        transform: scale(0.5) rotate(-180deg);
    }
    70% {
        opacity: 1;
        transform: scale(1.05) rotate(0deg);
    }
    100% {
        opacity: 1;
        transform: scale(1) rotate(0deg);
    }
}

.zodiac-segment {
    cursor: pointer;
    transition: all 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
    transform-origin: 200px 200px;
}

/* Enhanced segment scaling */
.zodiac-segment:hover {
    transform: scale(1.1);
    filter: brightness(1.3) drop-shadow(0 0 15px rgba(255, 215, 0, 0.6));
}

.zodiac-segment.active {
    transform: scale(1.15);
    filter: brightness(1.6) drop-shadow(0 0 20px rgba(255, 215, 0, 1));
    animation: activeSegmentPulse 2s ease-in-out infinite;
}

@keyframes activeSegmentPulse {
    0%, 100% {
        transform: scale(1.15);
        filter: brightness(1.6) drop-shadow(0 0 20px rgba(255, 215, 0, 1));
    }
    50% {
        transform: scale(1.2);
        filter: brightness(1.8) drop-shadow(0 0 25px rgba(255, 215, 0, 1));
    }
}

.zodiac-segment:active {
    transform: scale(1.25);
    filter: brightness(2) drop-shadow(0 0 30px rgba(255, 215, 0, 1));
}


.zodiac-center-text {
    font-size: 14px;
    fill: #ffd700;
    font-weight: bold;
    transition: all 0.3s ease;
}

.zodiac-wheel.tonic-change .zodiac-center-text {
    animation: centerTextPulse 0.8s ease-out;
}

@keyframes centerTextPulse {
    0% {
        font-size: 14px;
        fill: #ffd700;
    }
    50% {
        font-size: 18px;
        fill: #fff;
    }
    100% {
        font-size: 14px;
        fill: #ffd700;
    }
}

/* Fork section */
.fork-section {
    flex: 0 0 20%;
    display: flex;
    justify-content: center;
    align-items: center;
    position: relative;
    min-height: 60px;
    max-height: 80px;
}

.fork-container {
    position: relative;
    width: 100%;
    max-width: 120px;
    height: 100%;
    display: flex;
    justify-content: center;
    align-items: center;
}

.fork-image, .fork-fallback {
    width: 100%;
    height: auto;
    max-height: 100%;
    object-fit: contain;
    filter: drop-shadow(0 0 20px rgba(0, 255, 255, 0.3));
}

.visualizer-canvas {
    position: absolute;
    top: 33%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 70px;
    height: 70px;
    border-radius: 50%;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.12s ease-in;
    z-index: 10;
}

.visualizer-canvas.active {
    opacity: 1;
    transition: opacity 0.18s ease-out;
}

.fork-viz-circle {
    opacity: 0;
    transition: opacity 0.12s ease-in;
}

.fork-viz-circle.active {
    opacity: 1;
    transition: opacity 0.18s ease-out;
}

/* Scale section */
.scale-section {
    flex: 0 0 15%;
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 60px;
    max-height: 100px;
}

.scale-bar {
    width: 100%;
    max-width: 500px;
    height: auto;
    touch-action: none;
}

.scale-node {
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.scale-node:hover {
    filter: brightness(1.3) drop-shadow(0 0 12px rgba(255, 215, 0, 0.8));
    transform: scale(1.05);
}

.scale-node:active,
.scale-node.playing {
    filter: brightness(1.6) drop-shadow(0 0 20px rgba(255, 215, 0, 1));
    transform: scale(1.15);
}

.scale-node.dimmed {
    opacity: 0.3;
    filter: grayscale(0.7);
    pointer-events: none;
}

.scale-node.audio-disabled {
    opacity: 0.5;
    filter: grayscale(0.8) brightness(0.7);
    pointer-events: none;
    cursor: not-allowed;
}

.scale-node.audio-disabled::before {
    content: '';
    position: absolute;
    top: -5px;
    left: -5px;
    right: -5px;
    bottom: -5px;
    border: 2px dashed rgba(255, 165, 0, 0.6);
    border-radius: 50%;
    animation: audioDisabledBorder 2s linear infinite;
}

@keyframes audioDisabledBorder {
    0% { transform: rotate(0deg); opacity: 0.6; }
    50% { opacity: 0.3; }
    100% { transform: rotate(360deg); opacity: 0.6; }
}

.scale-node-circle {
    transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.scale-node-glow {
    transition: all 0.3s ease;
}

.scale-node.playing .scale-node-circle {
    animation: planetPulse 0.8s ease-in-out infinite alternate;
}

.scale-node.playing .scale-node-glow {
    animation: glowPulse 0.8s ease-in-out infinite alternate;
}

.octave-threads {
    pointer-events: none;
    z-index: 1;
}

@keyframes planetPulse {
    from { r: 24; }
    to { r: 28; }
}

@keyframes glowPulse {
    from { 
        r: 28; 
        opacity: 0.3;
    }
    to { 
        r: 35; 
        opacity: 0.6;
    }
}

/* Controls section */
.controls-section {
    flex: 0 0 32%;
    min-height: 130px;
    max-height: 190px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding: 8px 0 15px 0;
    justify-content: space-between;
}

.control-row-top, .control-row-middle, .control-row-bottom {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 10px;
}

.control-row-middle {
    justify-content: center;
    padding: 5px 0;
}

.control-row-bottom {
    justify-content: center;
    /* Move recording buttons completely out of view */
    position: relative;
    top: 200px;
    visibility: hidden;
    pointer-events: none;
}

.control-button {
    background: linear-gradient(145deg, #2a2a3e, #1a1a2e);
    border: 2px solid #ffd700;
    color: #ffd700;
    padding: 8px 12px;
    border-radius: 6px;
    font-family: inherit;
    font-size: 12px;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.2s ease;
    min-width: 50px;
    min-height: 50px;
    text-transform: uppercase;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
}

.control-button:hover:not(:disabled) {
    background: linear-gradient(145deg, #3a3a4e, #2a2a3e);
    box-shadow: 0 6px 20px rgba(255, 215, 0, 0.3);
    transform: translateY(-2px);
}

.control-button:active:not(:disabled) {
    transform: translateY(0);
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.3);
}

.control-button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    filter: grayscale(0.7);
}

/* Audio Notice */
.audio-notice {
    position: fixed;
    top: 20px;
    left: 20px;
    background: rgba(255, 215, 0, 0.9);
    color: #000;
    padding: 8px 12px;
    border-radius: 20px;
    font-size: 14px;
    font-weight: bold;
    display: flex;
    align-items: center;
    gap: 6px;
    z-index: 1000;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
    animation: audioNoticeSlide 0.3s ease-out;
    pointer-events: auto;
}

.audio-notice.hidden {
    display: none !important;
    pointer-events: none;
}

.audio-icon {
    font-size: 16px;
}

@keyframes audioNoticeSlide {
    from {
        transform: translateX(-100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

/* Loading Sound Animation */
.loading-sound-container {
    position: fixed;
    top: 50%;
    left: 15px;
    transform: translateY(-50%);
    z-index: 1000;
    pointer-events: auto;
    display: none !important;
}

.loading-sound-indicator {
    background: linear-gradient(135deg, #4fc3f7, #29b6f6);
    color: #000;
    padding: 12px 18px;
    border-radius: 25px;
    font-weight: bold;
    font-size: 12px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    box-shadow: 0 4px 15px rgba(79, 195, 247, 0.4);
    border: 2px solid rgba(255, 255, 255, 0.3);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    animation: loadingSoundPulse 1.5s ease-in-out infinite alternate;
}

@keyframes loadingSoundPulse {
    from {
        transform: scale(1);
        box-shadow: 0 4px 15px rgba(79, 195, 247, 0.4);
    }
    to {
        transform: scale(1.05);
        box-shadow: 0 8px 25px rgba(79, 195, 247, 0.7);
    }
}

.sound-icon {
    font-size: 16px;
    animation: soundIconBounce 0.8s ease-in-out infinite alternate;
}

@keyframes soundIconBounce {
    from { transform: translateY(0); }
    to { transform: translateY(-3px); }
}

.loading-text {
    font-size: 10px;
    font-weight: 900;
    background: linear-gradient(45deg, #000, #333);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.loading-dots {
    display: flex;
    gap: 4px;
}

.loading-dots span {
    width: 6px;
    height: 6px;
    background: #000;
    border-radius: 50%;
    animation: loadingDotsBounce 1.2s ease-in-out infinite;
}

.loading-dots span:nth-child(1) { animation-delay: 0s; }
.loading-dots span:nth-child(2) { animation-delay: 0.2s; }
.loading-dots span:nth-child(3) { animation-delay: 0.4s; }

@keyframes loadingDotsBounce {
    0%, 60%, 100% { transform: translateY(0); }
    30% { transform: translateY(-8px); }
}

.loading-sound-container.hidden {
    opacity: 0;
    transform: translateY(-50%) translateX(-100%);
    transition: all 0.5s ease-in;
    pointer-events: none;
    display: none !important;
}

/* ===== NAVIGATION HEADER ===== */
.navigation-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 15px 20px;
    background: rgba(10, 10, 10, 0.9);
    border-bottom: 1px solid rgba(255, 215, 0, 0.2);
    margin-bottom: 20px;
}

.app-title {
    color: #ffd700;
    font-size: 1.2rem;
    font-weight: 300;
    margin: 0;
    text-align: center;
    flex: 1;
}

.nav-button {
    background: rgba(255, 215, 0, 0.15);
    border: 2px solid rgba(255, 215, 0, 0.4);
    color: #ffd700;
    padding: 10px 18px;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: 0.9rem;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 8px;
    min-height: 44px;
    touch-action: manipulation;
    white-space: nowrap;
    z-index: 10;
    position: relative;
}

.nav-button:hover {
    background: rgba(255, 215, 0, 0.2);
    border-color: rgba(255, 215, 0, 0.5);
    transform: translateY(-1px);
}

.bridge-symbol {
    font-size: 1.2rem;
    font-weight: bold;
}

.bridge-label {
    font-size: 0.85rem;
}

.close-button {
    font-size: 1.5rem;
    padding: 4px 12px;
    min-width: 44px;
    justify-content: center;
}

/* ===== BRIDGE SCREEN ===== */
/* Bridge tonic display */
.tonic-display {
    text-align: center;
    padding: 20px;
    margin: 15px 0;
    border: 1px solid rgba(255, 215, 0, 0.3);
    border-radius: 8px;
    background: rgba(255, 215, 0, 0.05);
}

.tonic-info {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 20px;
    margin-top: 10px;
}

.tonic-note {
    font-size: 2.5rem;
    font-weight: bold;
    color: #ffd700;
    text-shadow: 0 0 10px rgba(255, 215, 0, 0.5);
}

.tonic-ratio {
    font-size: 1.2rem;
    color: #e0e0e0;
    font-family: 'Courier New', monospace;
}

.bridge-screen {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: radial-gradient(circle at center, #1a1a2e 0%, #0a0a0a 100%);
    z-index: 2000;
    overflow-y: auto;
    padding: env(safe-area-inset-top, 0) env(safe-area-inset-right, 0) env(safe-area-inset-bottom, 0) env(safe-area-inset-left, 0);
}

.bridge-container {
    padding: 20px;
    max-width: 1200px;
    margin: 0 auto;
}

.bridge-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 30px;
    padding-bottom: 15px;
    border-bottom: 1px solid rgba(255, 215, 0, 0.2);
}

.bridge-title {
    color: #ffd700;
    font-size: 1.5rem;
    font-weight: 300;
    margin: 0;
    text-align: center;
    flex: 1;
}

.bridge-tonic-section {
    display: flex;
    justify-content: center;
    align-items: center;
    margin-bottom: 30px;
}

.bridge-zodiac-wheel {
    width: 250px;
    height: 250px;
    filter: drop-shadow(0 0 15px rgba(255, 215, 0, 0.3));
}

.pulse-ring {
    animation: bridgePulse 2s ease-in-out infinite;
}

@keyframes bridgePulse {
    0%, 100% {
        opacity: 0.1;
        r: 80;
    }
    50% {
        opacity: 0.4;
        r: 85;
    }
}

.bridge-inputs {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 30px;
    margin-bottom: 30px;
}

.input-section {
    background: rgba(255, 215, 0, 0.05);
    border: 1px solid rgba(255, 215, 0, 0.2);
    border-radius: 12px;
    padding: 20px;
}

.input-section h3 {
    color: #ffd700;
    font-size: 1.1rem;
    margin-bottom: 15px;
    text-align: center;
}

.input-type-tabs {
    display: flex;
    margin-bottom: 15px;
    border-radius: 8px;
    overflow: hidden;
    border: 1px solid rgba(255, 215, 0, 0.3);
}

.input-tab {
    flex: 1;
    padding: 8px 12px;
    background: rgba(255, 215, 0, 0.1);
    border: none;
    color: #ffd700;
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: 0.85rem;
}

.input-tab.active {
    background: rgba(255, 215, 0, 0.2);
    color: #fff;
}

.input-tab:hover {
    background: rgba(255, 215, 0, 0.15);
}

.bridge-input {
    width: 100%;
    padding: 12px;
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid rgba(255, 215, 0, 0.3);
    border-radius: 6px;
    color: #ffd700;
    font-size: 0.9rem;
    margin-bottom: 15px;
}

.bridge-input:focus {
    outline: none;
    border-color: rgba(255, 215, 0, 0.6);
    box-shadow: 0 0 8px rgba(255, 215, 0, 0.3);
}

.input-results {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.result-line {
    display: flex;
    justify-content: space-between;
    align-items: center;
    color: #e0e0e0;
    font-size: 0.85rem;
}

.quad-symbol {
    font-size: 1.1rem;
    color: #ffd700;
}

.resonance-compass {
    margin-bottom: 30px;
    text-align: center;
}

.resonance-compass h3 {
    color: #ffd700;
    font-size: 1.1rem;
    margin-bottom: 15px;
}

.compass-plot {
    width: 250px;
    height: 250px;
    margin: 0 auto;
    filter: drop-shadow(0 0 10px rgba(255, 215, 0, 0.2));
}

.quad-label {
    fill: #ffd700;
    font-size: 16px;
    font-weight: bold;
}

.bridge-controls {
    text-align: center;
}

.play-buttons {
    display: flex;
    gap: 15px;
    justify-content: center;
    margin-bottom: 25px;
    flex-wrap: wrap;
}

.bridge-play-button {
    background: rgba(255, 215, 0, 0.1);
    border: 1px solid rgba(255, 215, 0, 0.3);
    color: #ffd700;
    padding: 12px 20px;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: 0.9rem;
    display: flex;
    align-items: center;
    gap: 8px;
    min-height: 48px;
    touch-action: manipulation;
}

.bridge-play-button:hover {
    background: rgba(255, 215, 0, 0.2);
    border-color: rgba(255, 215, 0, 0.5);
    transform: translateY(-2px);
}

.bridge-play-button:active {
    transform: translateY(0);
}

.play-a-button {
    border-color: rgba(255, 107, 107, 0.5);
    color: #ff6b6b;
}

.play-a-button:hover {
    background: rgba(255, 107, 107, 0.2);
    border-color: rgba(255, 107, 107, 0.7);
}

.play-b-button {
    border-color: rgba(78, 205, 196, 0.5);
    color: #4ecdc4;
}

.play-b-button:hover {
    background: rgba(78, 205, 196, 0.2);
    border-color: rgba(78, 205, 196, 0.7);
}

.bridge-shared-controls {
    display: flex;
    justify-content: center;
}

.bridge-vibrato-control {
    display: flex;
    align-items: center;
    gap: 15px;
    background: rgba(255, 215, 0, 0.05);
    padding: 15px 25px;
    border-radius: 8px;
    border: 1px solid rgba(255, 215, 0, 0.2);
}


/* Mobile responsiveness for Bridge */
@media (max-width: 768px) {
    .bridge-inputs {
        grid-template-columns: 1fr;
        gap: 20px;
    }
    
    .play-buttons {
        flex-direction: column;
        align-items: center;
    }
    
    .bridge-vibrato-control {
        flex-direction: column;
        gap: 10px;
    }
    
    .navigation-header {
        padding: 10px 15px;
    }
    
    .app-title {
        font-size: 1rem;
    }
    
    .bridge-label {
        display: block;
        font-size: 0.7rem;
    }
    
    .nav-button {
        background: rgba(255, 215, 0, 0.25);
        border: 2px solid rgba(255, 215, 0, 0.7);
        font-weight: 600;
    }
    
}


.record-button.recording {
    background: linear-gradient(145deg, #ff4444, #cc2222);
    border-color: #ff6666;
    color: white;
    animation: recording-pulse 1s ease-in-out infinite alternate;
}

@keyframes recording-pulse {
    from { box-shadow: 0 4px 15px rgba(255, 68, 68, 0.3); }
    to { box-shadow: 0 4px 15px rgba(255, 68, 68, 0.7); }
}

@keyframes pulse {
    0% { 
        transform: scale(1); 
        opacity: 1; 
    }
    50% { 
        transform: scale(1.05); 
        opacity: 0.8; 
    }
    100% { 
        transform: scale(1); 
        opacity: 1; 
    }
}

.octave-controls {
    display: flex;
    gap: 5px;
}

.readout {
    background: rgba(255, 215, 0, 0.1);
    border: 1px solid rgba(255, 215, 0, 0.3);
    padding: 8px 12px;
    border-radius: 6px;
    font-size: 14px;
    font-weight: bold;
    color: #ffd700;
    text-align: center;
    min-width: 180px;
    backdrop-filter: blur(10px);
}

/* Vibrato Controls */
.vibrato-control {
    display: flex;
    align-items: center;
    gap: 10px;
    background: rgba(255, 215, 0, 0.1);
    border: 1px solid rgba(255, 215, 0, 0.3);
    padding: 8px 15px;
    border-radius: 6px;
    backdrop-filter: blur(10px);
}

.vibrato-label {
    color: #ffd700;
    font-size: 14px;
    font-weight: bold;
    min-width: 60px;
}

.vibrato-slider {
    -webkit-appearance: none;
    appearance: none;
    width: 120px;
    height: 6px;
    border-radius: 3px;
    background: linear-gradient(to right, #333 0%, #ffd700 100%);
    outline: none;
    cursor: pointer;
}

.vibrato-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: #ffd700;
    border: 2px solid #1a1a2e;
    cursor: pointer;
    box-shadow: 0 0 8px rgba(255, 215, 0, 0.5);
    transition: all 0.2s ease;
}

.vibrato-slider::-webkit-slider-thumb:hover {
    transform: scale(1.1);
    box-shadow: 0 0 12px rgba(255, 215, 0, 0.8);
}

.vibrato-slider::-moz-range-thumb {
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: #ffd700;
    border: 2px solid #1a1a2e;
    cursor: pointer;
    box-shadow: 0 0 8px rgba(255, 215, 0, 0.5);
}

.vibrato-display {
    color: #ffd700;
    font-size: 14px;
    font-weight: bold;
    min-width: 35px;
    text-align: right;
}

/* Black Hole Portal Easter Egg */
.black-hole-portal {
    position: fixed;
    left: 5%;
    top: 50%;
    transform: translateY(-50%);
    width: 200px;
    height: 200px;
    z-index: 100;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.5s ease-in-out;
}

.black-hole-portal.active {
    opacity: 1;
}

.portal-container {
    position: relative;
    width: 100%;
    height: 100%;
    border-radius: 50%;
    overflow: hidden;
}

.event-horizon {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 60px;
    height: 60px;
    background: radial-gradient(circle, #000000 0%, #1a0033 60%, transparent 100%);
    border-radius: 50%;
    animation: eventHorizonPulse 2s ease-in-out infinite alternate;
}

.accretion-disk {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 180px;
    height: 180px;
    background: conic-gradient(
        from 0deg,
        transparent 0deg,
        rgba(255, 100, 0, 0.3) 45deg,
        rgba(255, 215, 0, 0.6) 90deg,
        rgba(255, 0, 100, 0.4) 135deg,
        rgba(100, 0, 255, 0.3) 180deg,
        transparent 225deg,
        rgba(255, 100, 0, 0.2) 270deg,
        transparent 315deg,
        transparent 360deg
    );
    border-radius: 50%;
    animation: accretionSpin 3s linear infinite;
    mask: radial-gradient(circle, transparent 35%, black 45%, black 85%, transparent 95%);
}

.gravitational-lensing {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 160px;
    height: 160px;
    border: 2px solid rgba(255, 215, 0, 0.3);
    border-radius: 50%;
    animation: lensingRing 4s ease-in-out infinite;
}

.hawking-radiation {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 220px;
    height: 220px;
    background: radial-gradient(
        circle,
        transparent 70%,
        rgba(0, 255, 255, 0.1) 75%,
        rgba(255, 255, 255, 0.2) 85%,
        transparent 95%
    );
    border-radius: 50%;
    animation: hawkingGlow 1.5s ease-in-out infinite alternate;
}

@keyframes eventHorizonPulse {
    0% {
        width: 60px;
        height: 60px;
        box-shadow: 0 0 20px rgba(0, 0, 0, 0.8), inset 0 0 20px rgba(26, 0, 51, 0.6);
    }
    100% {
        width: 70px;
        height: 70px;
        box-shadow: 0 0 30px rgba(0, 0, 0, 1), inset 0 0 30px rgba(26, 0, 51, 0.8);
    }
}

@keyframes accretionSpin {
    0% { transform: translate(-50%, -50%) rotate(0deg); }
    100% { transform: translate(-50%, -50%) rotate(360deg); }
}

@keyframes lensingRing {
    0% {
        width: 160px;
        height: 160px;
        opacity: 0.3;
        border-width: 2px;
    }
    50% {
        width: 180px;
        height: 180px;
        opacity: 0.6;
        border-width: 3px;
    }
    100% {
        width: 160px;
        height: 160px;
        opacity: 0.3;
        border-width: 2px;
    }
}

@keyframes hawkingGlow {
    0% {
        filter: brightness(0.8) blur(2px);
        transform: translate(-50%, -50%) scale(1);
    }
    100% {
        filter: brightness(1.2) blur(4px);
        transform: translate(-50%, -50%) scale(1.1);
    }
}

/* Responsive adjustments */
@media (max-width: 768px) {
    .app-container {
        gap: 3px;
        padding: env(safe-area-inset-top, 60px) env(safe-area-inset-right, 5px) env(safe-area-inset-bottom, 5px) env(safe-area-inset-left, 5px);
    }
    
    .zodiac-section {
        flex: 0 0 35%;
        min-height: 200px;
        max-height: 280px;
    }
    
    .zodiac-wheel {
        max-width: 650px;
    }
    
    .fork-section {
        flex: 0 0 28%;
        min-height: 120px;
        max-height: 180px;
    }
    
    .visualizer-canvas {
        top: 30%;
        width: 80px;
        height: 80px;
    }
    
    .scale-section {
        flex: 0 0 16%;
        min-height: 70px;
        max-height: 90px;
    }
    
    .controls-section {
        flex: 0 0 20%;
        min-height: 80px;
        max-height: 120px;
        gap: 5px;
    }
    
    /* Enhanced mobile touch targets */
    .scale-node-circle {
        r: 28 !important;
    }
    
    .scale-node text {
        font-size: 22px !important;
    }
    
    .scale-node:active {
        transform: scale(1.2) !important;
    }
    
    /* Mobile audio notice positioning */
    .audio-notice {
        top: 70px;
        left: 10px;
        font-size: 12px;
        padding: 6px 10px;
    }
    
    .loading-sound-container {
        top: 40%;
        left: 5px;
    }
    
    .loading-sound-indicator {
        font-size: 10px;
        padding: 8px 10px;
    }
    
    .sound-icon {
        font-size: 14px;
    }
    
    .loading-text {
        font-size: 8px;
    }
    
    .loading-dots span {
        width: 4px;
        height: 4px;
    }

    .patreon-container {
        top: 40%;
        right: 5px;
    }
    
    .patreon-button {
        font-size: 10px;
        padding: 8px 10px;
        writing-mode: horizontal-tb;
        text-orientation: initial;
    }
}
    
    .control-row-top {
        flex-wrap: nowrap;
        justify-content: space-between;
        align-items: center;
    }
    
    .control-row-bottom {
        flex-wrap: wrap;
        gap: 5px;
        justify-content: center;
    }
    
    .control-button {
        font-size: 10px;
        padding: 6px 8px;
        min-width: 44px;
        min-height: 44px;
        border-radius: 4px;
    }
    
    .readout {
        font-size: 11px;
        min-width: 140px;
        padding: 6px 8px;
        border-radius: 4px;
    }
    
    .zodiac-wheel {
        max-width: 200px;
    }
    
    .octave-controls {
        gap: 3px;
    }
}

@media (max-height: 600px) {
    .zodiac-section {
        flex: 0 0 40%;
        min-height: 180px;
    }
    
    .zodiac-wheel {
        max-width: 600px;
    }
    
    .fork-section {
        flex: 0 0 20%;
        min-height: 80px;
    }
    
    .visualizer-canvas {
        top: 27%;
        width: 60px;
        height: 60px;
    }
    
    .scale-section {
        flex: 0 0 18%;
        min-height: 60px;
    }
    
    .controls-section {
        flex: 0 0 15%;
        gap: 3px;
        min-height: 60px;
        max-height: 80px;
    }
    
    .control-button {
        min-width: 40px;
        min-height: 40px;
        font-size: 9px;
        padding: 4px 6px;
    }
    
    .readout {
        font-size: 10px;
        padding: 4px 6px;
    }
}

/* Accessibility */
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
    
    .visualizer-canvas.active {
        transition: none;
        opacity: 0.5;
    }
    
    .fork-viz-circle.active {
        transition: none;
        opacity: 0.5;
    }
}

@media (prefers-contrast: high) {
    .control-button {
        border-width: 3px;
    }
    
    .readout {
        border-width: 2px;
    }
}

/* Touch improvements */
@media (pointer: coarse) {
    .control-button {
        min-width: 64px;
        min-height: 64px;
        padding: 16px 20px;
        font-size: 16px;
    }
    
    .zodiac-segment {
        stroke-width: 10;
    }
    
    .scale-node circle {
        r: 25;
    }
    
    .scale-bar {
        touch-action: none;
        -webkit-touch-callout: none;
        -webkit-user-select: none;
        user-select: none;
    }
    
    .zodiac-wheel {
        touch-action: none;
        -webkit-touch-callout: none;
        -webkit-user-select: none;
        user-select: none;
    }
}


.install-button-container {
    margin: 20px 0;
    display: flex;
    justify-content: center;
}

.install-button-container.hidden {
    display: none;
}

.pwa-install-button {
    background: linear-gradient(45deg, #00d4ff, #0099cc);
    color: #000;
    border: none;
    border-radius: 8px;
    padding: 12px 20px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 8px;
    box-shadow: 0 4px 15px rgba(0, 212, 255, 0.3);
    transition: all 0.3s ease;
}

.pwa-install-button:hover {
    transform: translateY(-1px);
    box-shadow: 0 6px 20px rgba(0, 212, 255, 0.4);
}

.install-icon {
    font-size: 16px;
}

