/* Bouncing Balls - Full Screen UI Styles */

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

body {
    font-family: 'Open Sans', sans-serif;
    overflow: hidden;
    height: 100vh;
    width: 100vw;
    margin: 0;
    padding: 0;
    position: relative;
    background-color: black;
}

/* Background image */
body::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: url('assets/background.jpg') center center no-repeat;
    background-size: contain;
    opacity: 0.3;
    z-index: -1;
}

/* Top Navigation Bar */
.top-nav {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: 70px;
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 20px;
    z-index: 1000;
    gap: 20px;
}

.nav-left {
    flex: 0 0 auto;
}

.nav-title {
    font-size: 1.5em;
    font-weight: 700;
    color: #333;
    margin: 0;
    white-space: nowrap;
}

.nav-center {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 20px;
    flex-wrap: wrap;
}

.nav-control {
    display: flex;
    align-items: center;
    gap: 8px;
}

.nav-control label {
    font-size: 14px;
    font-weight: 600;
    color: #555;
    white-space: nowrap;
}

.nav-control input[type="number"],
.nav-control select {
    padding: 8px 12px;
    border: 2px solid #ddd;
    border-radius: 6px;
    font-size: 14px;
    font-family: 'Open Sans', sans-serif;
    background: white;
    color: #333;
    transition: border-color 0.3s ease;
    min-width: 80px;
}

.nav-control input[type="number"]:focus,
.nav-control select:focus {
    outline: none;
    border-color: #667eea;
}

.nav-right {
    flex: 0 0 auto;
    display: flex;
    gap: 0;
}

.nav-btn {
    padding: 10px 20px;
    border: none;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    text-decoration: none;
    white-space: nowrap;
}

.nav-btn-primary {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    box-shadow: 0 2px 8px rgba(102, 126, 234, 0.3);
    gap: 8px;
}

.nav-btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.4);
}

.nav-btn-primary:active {
    transform: translateY(0);
}

.nav-btn-icon {
    width: 50px;
    height: 50px;
    padding: 10px;
    background: #f0f0f0;
    color: #333;
    font-size: 24px;
}

.nav-btn-icon:hover {
    background: #e0e0e0;
    transform: scale(1.05);
}

.nav-btn-icon svg {
    display: block;
}

/* Canvas Arena - Full Screen */
#canvas {
    position: fixed;
    top: 70px;
    left: 0;
    right: 0;
    bottom: 0;
    width: 100%;
    height: calc(100vh - 70px);
    display: block;
}

/* Modal Styles */
.modal {
    display: none;
    position: fixed;
    z-index: 2000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(5px);
    overflow-y: auto;
}

.modal.active {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.modal-content {
    background: white;
    border-radius: 12px;
    max-width: 800px;
    width: 100%;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
    animation: modalSlideIn 0.3s ease;
}

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

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 25px 30px;
    border-bottom: 2px solid #f0f0f0;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border-radius: 12px 12px 0 0;
}

.modal-header h2 {
    margin: 0;
    font-size: 1.8em;
}

.modal-close {
    background: rgba(255, 255, 255, 0.2);
    border: none;
    font-size: 32px;
    color: white;
    cursor: pointer;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    line-height: 1;
}

.modal-close:hover {
    background: rgba(255, 255, 255, 0.3);
    transform: rotate(90deg);
}

.modal-body {
    padding: 30px;
    color: #333;
}

.modal-section {
    margin-bottom: 30px;
}

.modal-section:last-child {
    margin-bottom: 0;
}

.modal-section h3 {
    color: #667eea;
    font-size: 1.4em;
    margin-bottom: 15px;
}

.modal-section p {
    line-height: 1.8;
    margin-bottom: 15px;
    color: #555;
}

.modal-section ul {
    list-style: none;
    padding-left: 0;
}

.modal-section ul li {
    padding: 8px 0;
    padding-left: 25px;
    position: relative;
    line-height: 1.6;
    color: #555;
}

.modal-section ul li::before {
    content: "•";
    color: #667eea;
    font-weight: bold;
    position: absolute;
    left: 5px;
    font-size: 1.2em;
}

/* Math notation styling */
.modal-section math {
    font-family: 'Latin Modern Math', 'STIX Two Math', 'Cambria Math', 'Times New Roman', serif;
    font-size: 1.1em;
    display: inline-block;
    vertical-align: middle;
    margin: 0 2px;
}

/* Block-level math equations */
.modal-section math[display="block"] {
    display: block;
    margin: 15px auto;
    text-align: center;
    font-size: 1.2em;
    padding: 10px 0;
}

.modal-section a {
    color: #667eea;
    text-decoration: none;
    border-bottom: 1px solid transparent;
    transition: all 0.3s ease;
}

.modal-section a:hover {
    border-bottom-color: #667eea;
    color: #764ba2;
}

/* Responsive Design */
@media (max-width: 1024px) {
    .nav-center {
        gap: 15px;
    }
}

@media (max-width: 768px) {
    .top-nav {
        height: auto;
        min-height: 60px;
        flex-wrap: wrap;
        padding: 12px 15px;
        gap: 12px;
    }
    
    .nav-left {
        flex: 1 1 auto;
        margin-bottom: 8px;
    }
    
    .nav-title {
        font-size: 1.2em;
        text-align: left;
    }
    
    .nav-center {
        flex: 1 1 100%;
        gap: 12px;
        justify-content: flex-start;
    }
    
    .nav-control {
        gap: 6px;
    }
    
    .nav-control label {
        font-size: 13px;
    }
    
    .nav-control input[type="number"],
    .nav-control select {
        padding: 8px 12px;
        font-size: 14px;
        min-width: 80px;
    }
    
    .nav-btn {
        padding: 10px 18px;
        font-size: 14px;
    }
    
    .nav-btn-icon {
        width: 46px;
        height: 46px;
        font-size: 20px;
    }
    
    .nav-right {
        flex: 0 0 auto;
        gap: 8px;
    }
    
    .modal-content {
        max-height: 85vh;
        margin: 10px;
    }
    
    .modal-header {
        padding: 20px;
    }
    
    .modal-header h2 {
        font-size: 1.4em;
    }
    
    .modal-body {
        padding: 20px;
    }
    
    .modal-section h3 {
        font-size: 1.2em;
    }
    
    .modal-section p {
        font-size: 15px;
        line-height: 1.7;
    }
}

@media (max-width: 600px) {
    .top-nav {
        padding: 10px;
        gap: 10px;
    }
    
    .nav-left {
        flex: 1 1 auto;
    }
    
    .nav-title {
        font-size: 1.1em;
        line-height: 1.2;
    }
    
    .nav-center {
        flex: 1 1 100%;
        flex-wrap: wrap;
        gap: 10px;
    }
    
    .nav-control {
        flex: 1 1 auto;
        min-width: 120px;
    }
    
    .nav-btn {
        flex: 1 1 100%;
        padding: 12px 20px;
    }
    
    .nav-btn-icon {
        width: 44px;
        height: 44px;
        font-size: 20px;
    }
    
    .modal-header {
        padding: 18px;
        flex-wrap: nowrap;
    }
    
    .modal-header h2 {
        font-size: 1.3em;
        flex: 1 1 auto;
        margin-bottom: 0;
    }
    
    .modal-close {
        width: 36px;
        height: 36px;
        font-size: 26px;
        flex-shrink: 0;
    }
    
    .modal-body {
        padding: 18px;
    }
    
    .modal-section {
        margin-bottom: 25px;
    }
    
    .modal-section h3 {
        font-size: 1.15em;
    }
    
    .modal-section p {
        font-size: 14px;
        line-height: 1.6;
    }
}

@media (max-width: 480px) {
    body {
        font-size: 14px;
    }
    
    .top-nav {
        padding: 8px;
        gap: 8px;
        min-height: 50px;
    }
    
    .nav-left {
        flex: 1 1 auto;
        margin-bottom: 6px;
    }
    
    .nav-title {
        font-size: 1em;
    }
    
    .nav-center {
        flex: 1 1 100%;
        gap: 8px;
    }
    
    .nav-control {
        min-width: 100px;
    }
    
    .nav-control label {
        font-size: 12px;
    }
    
    .nav-control input[type="number"],
    .nav-control select {
        padding: 6px 10px;
        font-size: 13px;
        min-width: 70px;
    }
    
    .nav-btn {
        padding: 10px 16px;
        font-size: 13px;
    }
    
    .nav-right {
        gap: 4px;
    }
    
    .nav-btn-icon {
        width: 40px;
        height: 40px;
        font-size: 18px;
        padding: 8px;
    }
    
    .modal.active {
        padding: 10px;
    }
    
    .modal-content {
        margin: 0;
    }
    
    .modal-header {
        padding: 15px;
    }
    
    .modal-header h2 {
        font-size: 1.1em;
    }
    
    .modal-close {
        width: 32px;
        height: 32px;
        font-size: 24px;
    }
    
    .modal-body {
        padding: 15px;
    }
    
    .modal-section {
        margin-bottom: 20px;
    }
    
    .modal-section h3 {
        font-size: 1.05em;
        margin-bottom: 12px;
    }
    
    .modal-section p {
        font-size: 13px;
        line-height: 1.5;
        margin-bottom: 12px;
    }
    
    .modal-section ul li {
        font-size: 13px;
        padding: 6px 0;
        padding-left: 20px;
    }
    
    .modal-section ul li::before {
        font-size: 1em;
        left: 3px;
    }
}

/* Utility Classes */
.pulse {
    animation: pulse 1s infinite;
}

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