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

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: linear-gradient(135deg, #0f0f3d 0%, #1a1a5e 30%, #2d1b69 60%, #4a2c7e 100%);
    min-height: 100vh;
    padding: 20px;
    overflow-x: hidden;
    position: relative;
    will-change: scroll-position;
    contain: layout style paint;
}

body::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: 
        radial-gradient(circle at 20% 80%, rgba(102, 126, 234, 0.1) 0%, transparent 50%),
        radial-gradient(circle at 80% 20%, rgba(255, 107, 107, 0.1) 0%, transparent 50%),
        radial-gradient(circle at 50% 50%, rgba(76, 175, 80, 0.05) 0%, transparent 50%);
    pointer-events: none;
    z-index: -1;
}

.container {
    max-width: 1400px;
    margin: 0 auto;
}

/* Corner Navigation Styling */
.corner-nav {
    position: fixed;
    top: 20px;
    right: 20px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    z-index: 1000;
    background: rgba(255, 255, 255, 0.08);
    padding: 18px;
    border-radius: 20px;
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.2);
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.4);
    animation: slideIn 0.5s ease;
    will-change: transform;
    contain: paint;
}

.corner-nav-btn {
    width: 52px;
    height: 52px;
    border: none;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border-radius: 14px;
    font-size: 24px;
    cursor: pointer;
    transition: transform 0.25s ease, box-shadow 0.25s ease, background 0.25s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    overflow: hidden;
    box-shadow: 0 8px 25px rgba(102, 126, 234, 0.35);
    will-change: transform, box-shadow;
    contain: paint;
}

.corner-nav-btn::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.4);
    transform: translate(-50%, -50%);
    transition: width 0.4s, height 0.4s;
}

.corner-nav-btn:hover::before {
    width: 160px;
    height: 160px;
}

.corner-nav-btn span {
    position: relative;
    z-index: 1;
    display: block;
    transition: transform 0.3s ease;
}

.corner-nav-btn:hover span {
    transform: scale(1.2) rotate(10deg);
}

.corner-nav-btn:hover {
    transform: scale(1.15) translateX(-5px);
    box-shadow: 0 15px 40px rgba(102, 126, 234, 0.6);
}

.corner-nav-btn.active {
    background: linear-gradient(135deg, #4caf50 0%, #66bb6a 100%);
    box-shadow: 0 15px 40px rgba(76, 175, 80, 0.6);
    transform: scale(1.15) translateX(-8px);
}

.corner-nav-btn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
    transform: scale(1);
}

.corner-nav-btn:disabled:hover {
    box-shadow: 0 8px 20px rgba(102, 126, 234, 0.2);
}

@media (max-width: 768px) {
    .corner-nav {
        top: 10px;
        right: 10px;
        padding: 10px;
        gap: 8px;
    }

    .corner-nav-btn {
        width: 40px;
        height: 40px;
        font-size: 18px;
        border-radius: 10px;
    }

    .header.hero-section {
        padding: 50px 25px;
        margin-bottom: 30px;
    }

    .header h1 {
        font-size: 2.3em;
        margin-bottom: 10px;
    }

    .hero-subtitle {
        font-size: 1.15em;
    }

    .hero-description {
        font-size: 0.95em;
        margin-bottom: 20px;
    }

    .hero-buttons {
        flex-direction: column;
        align-items: center;
    }

    .btn-hero {
        width: 100%;
        max-width: 280px;
    }

    .features-grid {
        grid-template-columns: 1fr;
        gap: 18px;
        margin-bottom: 30px;
    }

    .feature-card {
        padding: 24px;
    }

    .feature-icon {
        font-size: 2.5em;
    }

    .feature-card h3 {
        font-size: 1.2em;
    }

    .feature-card p {
        font-size: 0.9em;
    }

    .complexity-box {
        grid-template-columns: 1fr;
    }
}

.header {
    text-align: center;
    color: white;
    margin-bottom: 40px;
    animation: fadeInDown 0.8s cubic-bezier(0.34, 1.56, 0.64, 1);
    position: relative;
}

.header.hero-section {
    background: linear-gradient(135deg, rgba(102, 126, 234, 0.15) 0%, rgba(118, 75, 162, 0.15) 100%);
    padding: 80px 40px;
    border-radius: 25px;
    margin-bottom: 50px;
    backdrop-filter: blur(10px);
    border: 1px solid rgba(102, 126, 234, 0.3);
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.2);
}

.hero-content {
    max-width: 800px;
    margin: 0 auto;
}

.header h1 {
    font-size: 3.5em;
    margin-bottom: 15px;
    text-shadow: 0 4px 20px rgba(0, 0, 0, 0.5);
    font-weight: 900;
    letter-spacing: 1px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 60%, #ff6b6b 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    animation: slideInDown 0.8s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.hero-subtitle {
    font-size: 1.4em;
    opacity: 0.95;
    font-weight: 600;
    letter-spacing: 0.8px;
    margin-bottom: 12px;
    animation: slideInUp 0.8s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.hero-description {
    font-size: 1.1em;
    opacity: 0.85;
    margin-bottom: 30px;
    line-height: 1.8;
    letter-spacing: 0.3px;
    animation: fadeInUp 0.8s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.hero-buttons {
    display: flex;
    gap: 15px;
    justify-content: center;
    flex-wrap: wrap;
    animation: slideInUp 0.9s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.btn-hero {
    padding: 18px 40px;
    font-size: 1.1em;
    font-weight: 700;
    border: 2px solid transparent;
    transition: all 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.btn-hero:hover {
    transform: translateY(-5px) scale(1.05);
    box-shadow: 0 20px 60px rgba(102, 126, 234, 0.5);
}

.header p {
    font-size: 1.05em;
    opacity: 0.9;
    font-weight: 300;
    letter-spacing: 0.5px;
}

.features-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 24px;
    margin-bottom: 40px;
    animation: fadeInUp 0.9s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.feature-card {
    background: rgba(255, 255, 255, 0.95);
    border-radius: 18px;
    padding: 32px;
    text-align: center;
    box-shadow: 0 15px 40px rgba(0, 0, 0, 0.15);
    transition: transform 0.25s ease, box-shadow 0.25s ease, border-color 0.25s ease;
    border: 1px solid rgba(255, 255, 255, 0.5);
    position: relative;
    overflow: hidden;
    will-change: transform, box-shadow;
    contain: paint;
}

.feature-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(102, 126, 234, 0.1), transparent);
    transition: left 0.6s ease;
}

.feature-card:hover::before {
    left: 100%;
}

.feature-card:hover {
    transform: translateY(-8px);
    box-shadow: 0 25px 60px rgba(0, 0, 0, 0.2);
    border: 1px solid rgba(102, 126, 234, 0.3);
}

.feature-icon {
    font-size: 3em;
    margin-bottom: 15px;
}

.feature-card h3 {
    font-size: 1.4em;
    color: #333;
    margin-bottom: 12px;
    font-weight: 700;
    position: relative;
    z-index: 1;
}

.feature-card p {
    color: #666;
    line-height: 1.7;
    font-size: 0.95em;
    position: relative;
    z-index: 1;
    letter-spacing: 0.3px;
}

.card {
    background: rgba(255, 255, 255, 0.95);
    border-radius: 20px;
    padding: 35px;
    margin-bottom: 30px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.25);
    transition: transform 0.25s ease, box-shadow 0.25s ease, border-color 0.25s ease;
    position: relative;
    border: 1px solid rgba(255, 255, 255, 0.5);
    overflow: hidden;
    will-change: transform, box-shadow;
    contain: paint;
}

#homeSection .card {
    background: rgba(20, 20, 50, 0.85);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(102, 126, 234, 0.3);
    color: white;
}

#homeSection .card h2 {
    color: #667eea;
}

#homeSection .card h3 {
    color: #88d0ff;
}

#homeSection .card p {
    color: #e0e0e0;
}

#homeSection .card strong {
    color: #ffd700;
}

#homeSection .card ul {
    color: #d0d0d0;
}

.card::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.2), transparent);
    transition: left 0.5s ease;
}

.card:hover::before {
    left: 100%;
}

.card:hover {
    transform: translateY(-6px);
    box-shadow: 0 30px 80px rgba(0, 0, 0, 0.35);
    border: 1px solid rgba(102, 126, 234, 0.3);
}

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

.nav-btn {
    background: white;
    color: #667eea;
    padding: 15px 30px;
    border: 3px solid white;
    border-radius: 30px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.4s cubic-bezier(0.68, -0.55, 0.265, 1.55);
    position: relative;
    overflow: hidden;
}

.nav-btn::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    border-radius: 50%;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    transform: translate(-50%, -50%);
    transition: width 0.6s, height 0.6s;
    z-index: 0;
}

.nav-btn:hover::before {
    width: 300px;
    height: 300px;
}

.nav-btn span {
    position: relative;
    z-index: 1;
}

.nav-btn:hover {
    color: white;
    transform: translateY(-3px) scale(1.05);
    box-shadow: 0 10px 25px rgba(102, 126, 234, 0.4);
}

.nav-btn.active {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    transform: scale(1.1);
    box-shadow: 0 10px 30px rgba(102, 126, 234, 0.5);
}

.nav-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
}

.nav-btn:disabled:hover {
    box-shadow: 0 5px 15px rgba(102, 126, 234, 0.2);
    transform: none;
}

.section {
    display: none;
    contain: content;
}

.section.active {
    display: block;
    animation: fadeIn 0.3s ease;
    will-change: opacity;
}

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

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes slideInLeft {
    from {
        opacity: 0;
        transform: translateX(-40px);
    }

    to {
        opacity: 1;
        transform: translateX(0);
    }
}

@keyframes slideInRight {
    from {
        opacity: 0;
        transform: translateX(40px);
    }

    to {
        opacity: 1;
        transform: translateX(0);
    }
}

@keyframes slideInUp {
    from {
        opacity: 0;
        transform: translateY(40px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes fadeInDown {
    from {
        opacity: 0;
        transform: translateY(-30px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateX(50px) scale(0.9);
    }

    to {
        opacity: 1;
        transform: translateX(0) scale(1);
    }
}

@keyframes pulse {
    0%, 100% {
        box-shadow: 0 15px 40px rgba(76, 175, 80, 0.6);
    }

    50% {
        box-shadow: 0 20px 60px rgba(76, 175, 80, 0.8);
    }
}

@keyframes float {
    0%, 100% {
        transform: translateY(0px);
    }

    50% {
        transform: translateY(-12px);
    }
}

@keyframes scaleIn {
    from {
        opacity: 0;
        transform: scale(0.8);
    }

    to {
        opacity: 1;
        transform: scale(1);
    }
}

@keyframes rotate {
    from {
        transform: rotate(0deg);
    }

    to {
        transform: rotate(360deg);
    }
}

.intro-content {
    line-height: 1.9;
}

.intro-content h2 {
    color: white;
    margin: 30px 0 18px 0;
    font-size: 2em;
    animation: slideInLeft 0.6s cubic-bezier(0.34, 1.56, 0.64, 1);
    font-weight: 700;
    position: relative;
    padding-bottom: 10px;
}

.intro-content h2::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    width: 60px;
    height: 4px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-radius: 2px;
}

.intro-content h3 {
    color: #e0e0e0;
    margin: 24px 0 12px 0;
    font-size: 1.5em;
    animation: slideInRight 0.6s cubic-bezier(0.34, 1.56, 0.64, 1);
    font-weight: 600;
    letter-spacing: 0.3px;
}

.intro-content p {
    color: #d0d0d0;
    margin-bottom: 18px;
    text-align: justify;
    animation: fadeInUp 0.7s cubic-bezier(0.34, 1.56, 0.64, 1);
    line-height: 1.9;
    letter-spacing: 0.3px;
}

.intro-content ul {
    margin-left: 35px;
    margin-bottom: 18px;
}

.intro-content li {
    margin-bottom: 12px;
    color: #d0d0d0;
    animation: slideInLeft 0.5s cubic-bezier(0.34, 1.56, 0.64, 1);
    line-height: 1.8;
    letter-spacing: 0.2px;
}

.complexity-box {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 24px;
    margin-top: 25px;
}

.complexity-card {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 32px;
    border-radius: 18px;
    text-align: center;
    animation: scaleIn 0.6s cubic-bezier(0.34, 1.56, 0.64, 1);
    transition: all 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
    position: relative;
    overflow: hidden;
    box-shadow: 0 15px 40px rgba(102, 126, 234, 0.35);
    border: 1px solid rgba(255, 255, 255, 0.2);
}

.complexity-card::before {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: radial-gradient(circle, rgba(255, 255, 255, 0.15) 0%, transparent 70%);
    animation: rotate 10s linear infinite;
}

.complexity-card::after {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.2), transparent);
    transition: left 0.6s ease;
}

.complexity-card:hover::after {
    left: 100%;
}

.complexity-card:hover {
    transform: scale(1.08) translateY(-8px);
    box-shadow: 0 25px 60px rgba(102, 126, 234, 0.5);
    border: 1px solid rgba(255, 255, 255, 0.4);
}

.complexity-card h3 {
    font-size: 2.2em;
    margin-bottom: 18px;
    position: relative;
    z-index: 1;
    font-weight: 700;
    letter-spacing: 0.5px;
}

.complexity-card .formula {
    font-size: 2.8em;
    font-weight: 900;
    margin: 18px 0;
    font-family: 'Courier New', monospace;
    position: relative;
    z-index: 1;
    animation: pulse 2s ease-in-out infinite;
    letter-spacing: -1px;
}

.complexity-card p {
    font-size: 1.05em;
    opacity: 0.95;
    line-height: 1.7;
    position: relative;
    z-index: 1;
    letter-spacing: 0.3px;
}

.algorithm-steps {
    background: linear-gradient(135deg, rgba(102, 126, 234, 0.1) 0%, rgba(118, 75, 162, 0.08) 100%);
    padding: 24px;
    border-radius: 12px;
    margin: 18px 0;
    border-left: 5px solid #667eea;
    animation: slideInLeft 0.6s cubic-bezier(0.34, 1.56, 0.64, 1);
    transition: all 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
    color: #d0d0d0;
    backdrop-filter: blur(10px);
    border: 1px solid rgba(102, 126, 234, 0.2);
}

.algorithm-steps:hover {
    transform: translateX(12px);
    box-shadow: 0 10px 30px rgba(102, 126, 234, 0.25);
    border-left-color: #764ba2;
    background: linear-gradient(135deg, rgba(102, 126, 234, 0.15) 0%, rgba(118, 75, 162, 0.12) 100%);
}

.algorithm-steps h4 {
    color: #667eea;
    margin-bottom: 12px;
    font-weight: 700;
    letter-spacing: 0.5px;
}

.algorithm-steps ol {
    margin-left: 25px;
}

.algorithm-steps li {
    margin-bottom: 10px;
    color: #e0e0e0;
    line-height: 1.7;
    letter-spacing: 0.3px;
}

.code-section {
    background: #0d1117;
    color: #d4d4d4;
    padding: 30px;
    border-radius: 15px;
    margin: 25px 0;
    overflow-x: auto;
    position: relative;
    animation: fadeInUp 0.6s cubic-bezier(0.34, 1.56, 0.64, 1);
    box-shadow: 0 15px 40px rgba(0, 0, 0, 0.4);
    border: 1px solid rgba(102, 126, 234, 0.2);
}

.code-section::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 30px;
    background: #323233;
    border-radius: 15px 15px 0 0;
}

.code-section::after {
    content: '● ● ●';
    position: absolute;
    top: 8px;
    left: 15px;
    color: #ff5f56;
    font-size: 12px;
    letter-spacing: 5px;
}

.code-header {
    color: #4ec9b0;
    font-weight: bold;
    margin-bottom: 15px;
    margin-top: 20px;
    font-size: 1.2em;
    animation: slideInRight 0.6s ease;
}

.code-block {
    font-family: 'Courier New', monospace;
    font-size: 14px;
    line-height: 1.6;
    white-space: pre-wrap;
    animation: fadeIn 0.8s ease;
}

.keyword {
    color: #c586c0;
    font-weight: bold;
}

.function {
    color: #dcdcaa;
}

.string {
    color: #ce9178;
}

.comment {
    color: #6a9955;
    font-style: italic;
}

.number {
    color: #b5cea8;
}

.operator {
    color: #d4d4d4;
}

.copy-btn {
    position: absolute;
    top: 40px;
    right: 15px;
    background: #667eea;
    color: white;
    border: none;
    padding: 8px 15px;
    border-radius: 5px;
    cursor: pointer;
    font-size: 12px;
    transition: all 0.3s ease;
    z-index: 10;
}

.copy-btn:hover {
    background: #764ba2;
    transform: scale(1.05);
}

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

.input-group {
    margin-bottom: 20px;
    animation: slideInUp 0.5s ease;
}

label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
    color: #333;
}

input,
select {
    width: 100%;
    padding: 14px 18px;
    border: 2px solid #e0e0e0;
    border-radius: 12px;
    font-size: 16px;
    transition: all 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
    background: white;
}

input:focus,
select:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 4px rgba(102, 126, 234, 0.15);
    transform: scale(1.02);
    background: rgba(102, 126, 234, 0.02);
}

input::placeholder {
    color: #999;
    font-weight: 500;
}

.btn {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 16px 32px;
    border: none;
    border-radius: 12px;
    font-size: 16px;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
    box-shadow: 0 10px 30px rgba(102, 126, 234, 0.4);
    position: relative;
    overflow: hidden;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.btn::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.4);
    transform: translate(-50%, -50%);
    transition: width 0.6s, height 0.6s;
}

.btn::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(135deg, transparent 0%, rgba(255, 255, 255, 0.2) 100%);
    border-radius: 12px;
}

.btn:hover::before {
    width: 350px;
    height: 350px;
}

.btn span,
.btn {
    position: relative;
    z-index: 1;
}

.btn:hover {
    transform: translateY(-4px) scale(1.03);
    box-shadow: 0 15px 50px rgba(102, 126, 234, 0.5);
    letter-spacing: 1.5px;
}

.btn:active {
    transform: translateY(-1px);
}

.btn-secondary {
    background: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
    box-shadow: 0 10px 30px rgba(245, 87, 108, 0.4);
    margin-left: 10px;
}

.btn-secondary:hover {
    box-shadow: 0 15px 50px rgba(245, 87, 108, 0.5);
}

.btn-success {
    background: linear-gradient(135deg, #4caf50 0%, #66bb6a 100%);
    box-shadow: 0 10px 30px rgba(76, 175, 80, 0.4);
}

.btn-success:hover {
    box-shadow: 0 15px 50px rgba(76, 175, 80, 0.5);
}

.btn-visualize {
    background: linear-gradient(135deg, #ff6b6b 0%, #feca57 100%);
    font-size: 18px;
    padding: 18px 40px;
    margin-top: 20px;
    box-shadow: 0 10px 30px rgba(255, 107, 107, 0.4);
    animation: float 3s ease-in-out infinite;
}

.btn-visualize:hover {
    box-shadow: 0 15px 50px rgba(255, 107, 107, 0.6);
    animation: none;
}

.participants-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 15px;
    margin-top: 20px;
}

.participant-chip {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 14px 22px;
    border-radius: 30px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    animation: slideIn 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
    transition: all 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
    box-shadow: 0 8px 20px rgba(102, 126, 234, 0.3);
    position: relative;
    overflow: hidden;
    font-weight: 600;
}

.participant-chip::before {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: radial-gradient(circle, rgba(255, 255, 255, 0.1) 0%, transparent 70%);
    animation: shimmer 3s ease-in-out infinite;
}

.participant-chip:hover {
    transform: scale(1.08) rotate(-2deg);
    box-shadow: 0 12px 30px rgba(102, 126, 234, 0.5);
}

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

    50% {
        transform: translate(-50%, -50%) rotate(180deg);
    }
}

.participant-chip .remove-btn {
    background: rgba(255, 255, 255, 0.3);
    border: none;
    color: white;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    cursor: pointer;
    font-size: 18px;
    line-height: 1;
    transition: all 0.3s ease;
}

.participant-chip .remove-btn:hover {
    background: rgba(255, 255, 255, 0.5);
    transform: rotate(90deg) scale(1.2);
}

.transactions-grid {
    display: grid;
    gap: 15px;
    margin-top: 20px;
}

.transaction-item {
    background: linear-gradient(to right, #f8f9fa, #ffffff);
    padding: 15px 20px;
    border-radius: 10px;
    border-left: 4px solid #667eea;
    display: flex;
    justify-content: space-between;
    align-items: center;
    animation: slideIn 0.4s ease;
    transition: all 0.3s ease;
}

.transaction-item:hover {
    transform: translateX(10px);
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
    border-left-width: 8px;
}

.balance-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: 22px;
    margin-top: 20px;
}

.balance-card {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 28px;
    border-radius: 18px;
    animation: scaleIn 0.5s cubic-bezier(0.34, 1.56, 0.64, 1);
    transition: all 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
    position: relative;
    overflow: hidden;
    box-shadow: 0 12px 30px rgba(102, 126, 234, 0.35);
    border: 1px solid rgba(255, 255, 255, 0.2);
}

.balance-card::before {
    content: '';
    position: absolute;
    top: -50%;
    right: -50%;
    width: 200%;
    height: 200%;
    background: radial-gradient(circle, rgba(255, 255, 255, 0.15) 0%, transparent 70%);
    animation: rotate 8s linear infinite;
}

.balance-card::after {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.2), transparent);
    transition: left 0.5s ease;
}

.balance-card:hover::after {
    left: 100%;
}

.balance-card:hover {
    transform: translateY(-12px) scale(1.06);
    box-shadow: 0 20px 50px rgba(102, 126, 234, 0.5);
    border: 1px solid rgba(255, 255, 255, 0.4);
}

.balance-card.creditor {
    background: linear-gradient(135deg, #4caf50 0%, #66bb6a 100%);
    box-shadow: 0 12px 30px rgba(76, 175, 80, 0.35);
}

.balance-card.creditor:hover {
    box-shadow: 0 20px 50px rgba(76, 175, 80, 0.5);
}

.balance-card.debtor {
    background: linear-gradient(135deg, #f5576c 0%, #f093fb 100%);
    box-shadow: 0 12px 30px rgba(245, 87, 108, 0.35);
}

.balance-card.debtor:hover {
    box-shadow: 0 20px 50px rgba(245, 87, 108, 0.5);
}

.balance-card h3 {
    font-size: 1.4em;
    margin-bottom: 15px;
    position: relative;
    z-index: 1;
    font-weight: 700;
    letter-spacing: 0.5px;
}

.balance-card .amount {
    font-size: 2.4em;
    font-weight: 800;
    margin: 15px 0;
    position: relative;
    z-index: 1;
    letter-spacing: -1px;
}

.balance-card .status {
    font-size: 0.95em;
    opacity: 0.92;
    position: relative;
    z-index: 1;
    font-weight: 500;
}

.minimized-transaction {
    background: linear-gradient(135deg, #ffffff 0%, #f8f9ff 100%);
    border-radius: 15px;
    padding: 28px;
    margin-bottom: 20px;
    border-left: 6px solid #4caf50;
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.12);
    animation: slideInRight 0.6s cubic-bezier(0.34, 1.56, 0.64, 1);
    transition: all 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
    position: relative;
    overflow: hidden;
}

.minimized-transaction::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(76, 175, 80, 0.1), transparent);
    transition: left 0.6s ease;
}

.minimized-transaction:hover::before {
    left: 100%;
}

.minimized-transaction:hover {
    transform: translateX(8px) translateY(-3px);
    box-shadow: 0 12px 35px rgba(0, 0, 0, 0.15);
    border-left-color: #66bb6a;
}

.minimized-transaction:hover {
    transform: scale(1.03);
    box-shadow: 0 10px 35px rgba(0, 0, 0, 0.2);
}

.transaction-flow {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin: 15px 0;
    flex-wrap: wrap;
}

.person-badge {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 12px 24px;
    border-radius: 25px;
    font-weight: 600;
    min-width: 150px;
    text-align: center;
    transition: all 0.3s ease;
    animation: fadeIn 0.5s ease;
}

.person-badge:hover {
    transform: scale(1.1);
}

.person-badge.from {
    background: linear-gradient(135deg, #f5576c 0%, #f093fb 100%);
}

.person-badge.to {
    background: linear-gradient(135deg, #4caf50 0%, #45a049 100%);
}

.flow-arrow {
    font-size: 2em;
    color: #667eea;
    margin: 0 20px;
    animation: pulse 2s infinite;
}

.amount-badge {
    background: linear-gradient(135deg, #ffd700 0%, #ffed4e 100%);
    color: #333;
    padding: 12px 24px;
    border-radius: 25px;
    font-weight: 800;
    font-size: 1.3em;
    animation: float 3s ease-in-out infinite;
    box-shadow: 0 8px 25px rgba(255, 215, 0, 0.4);
    letter-spacing: 0.5px;
}

.stats-container {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 24px;
    margin-top: 20px;
}

.stat-box {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 32px;
    border-radius: 18px;
    text-align: center;
    animation: scaleIn 0.5s cubic-bezier(0.34, 1.56, 0.64, 1);
    transition: all 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
    position: relative;
    overflow: hidden;
    box-shadow: 0 12px 30px rgba(102, 126, 234, 0.35);
    border: 1px solid rgba(255, 255, 255, 0.15);
}

.stat-box::before {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: radial-gradient(circle, rgba(255, 255, 255, 0.15) 0%, transparent 70%);
    animation: rotate 10s linear infinite;
}

.stat-box::after {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.15), transparent);
    transition: left 0.6s ease;
}

.stat-box:hover::after {
    left: 100%;
}

.stat-box:hover {
    transform: scale(1.12) translateY(-8px);
    box-shadow: 0 20px 50px rgba(102, 126, 234, 0.5);
    border: 1px solid rgba(255, 255, 255, 0.3);
}

.stat-box h3 {
    font-size: 2.8em;
    margin-bottom: 12px;
    position: relative;
    z-index: 1;
    animation: countUp 1s ease;
    font-weight: 800;
    letter-spacing: -1px;
}

@keyframes countUp {
    from {
        opacity: 0;
        transform: scale(0.5);
    }

    to {
        opacity: 1;
        transform: scale(1);
    }
}

.stat-box p {
    opacity: 0.92;
    position: relative;
    z-index: 1;
    font-weight: 500;
    letter-spacing: 0.5px;
}

.hidden {
    display: none;
}

.viz-section {
    margin-bottom: 40px;
}

.viz-title {
    text-align: center;
    font-size: 1.8em;
    color: #667eea;
    margin-bottom: 20px;
    font-weight: bold;
    animation: slideInDown 0.6s ease;
}

.chart-container {
    background: white;
    padding: 20px;
    border-radius: 15px;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
    margin-bottom: 20px;
    animation: fadeInUp 0.6s ease;
}

.bar-chart {
    display: flex;
    align-items: flex-end;
    justify-content: space-around;
    height: 300px;
    padding: 20px;
    border-bottom: 3px solid #333;
    position: relative;
}

.bar {
    width: 60px;
    background: linear-gradient(to top, #667eea, #764ba2);
    border-radius: 5px 5px 0 0;
    position: relative;
    transition: all 0.25s ease;
    animation: none;
    will-change: transform, opacity;
}

.bar:hover {
    opacity: 0.8;
    transform: scale(1.1);
}

.bar.positive {
    background: linear-gradient(to top, #4caf50, #45a049);
}

.bar.negative {
    background: linear-gradient(to top, #f5576c, #f093fb);
}

.bar-label {
    position: absolute;
    bottom: -30px;
    left: 50%;
    transform: translateX(-50%);
    font-size: 12px;
    font-weight: bold;
    white-space: nowrap;
}

.bar-value {
    position: absolute;
    top: -25px;
    left: 50%;
    transform: translateX(-50%);
    font-weight: bold;
    color: #333;
    white-space: nowrap;
}

.flow-visualization {
    margin-top: 30px;
}

.flow-step {
    background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
    padding: 20px;
    border-radius: 15px;
    margin-bottom: 15px;
    border-left: 5px solid #667eea;
    transition: all 0.25s ease;
    will-change: transform;
}

.flow-step:hover {
    transform: translateX(10px);
    box-shadow: 0 5px 20px rgba(0, 0, 0, 0.1);
}

.flow-step h4 {
    color: #667eea;
    margin-bottom: 10px;
}

.transaction-number {
    display: inline-block;
    width: 30px;
    height: 30px;
    background: #4caf50;
    color: white;
    border-radius: 50%;
    text-align: center;
    line-height: 30px;
    font-weight: bold;
    margin-right: 10px;
}

@keyframes fadeInDown {
    from {
        opacity: 0;
        transform: translateY(-30px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateX(-30px);
    }

    to {
        opacity: 1;
        transform: translateX(0);
    }
}

@keyframes slideInLeft {
    from {
        opacity: 0;
        transform: translateX(-50px);
    }

    to {
        opacity: 1;
        transform: translateX(0);
    }
}

@keyframes slideInRight {
    from {
        opacity: 0;
        transform: translateX(50px);
    }

    to {
        opacity: 1;
        transform: translateX(0);
    }
}

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

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes slideInUp {
    from {
        opacity: 0;
        transform: translateY(50px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes scaleIn {
    from {
        opacity: 0;
        transform: scale(0.8);
    }

    to {
        opacity: 1;
        transform: scale(1);
    }
}

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

    50% {
        transform: scale(1.2);
    }
}

@keyframes growBar {
    from {
        height: 0;
    }
}

@media (max-width: 768px) {
    .header h1 {
        font-size: 2em;
    }

    .complexity-box {
        grid-template-columns: 1fr;
    }

    .transaction-flow {
        flex-direction: column;
        gap: 10px;
    }

    .flow-arrow {
        transform: rotate(90deg);
        margin: 10px 0;
    }

    .person-badge {
        width: 100%;
    }

    .bar {
        width: 40px;
    }

    .ds-card {
        padding: 18px;
        margin-bottom: 15px;
    }

    .ds-card h3 {
        font-size: 1.2em;
        margin-bottom: 10px;
    }

    .ds-card p {
        font-size: 0.95em;
        margin-bottom: 10px;
    }

    .ds-card ul,
    .ds-card ol {
        margin-left: 20px;
        font-size: 0.9em;
    }

    .nav-buttons {
        flex-wrap: wrap;
    }
}

/* Section-specific text styling for better contrast */
#algorithmSection .card,
#codeSection .card,
#complexitySection .card {
    background: rgba(20, 20, 50, 0.85);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(102, 126, 234, 0.3);
    color: white;
}

#algorithmSection .card h2,
#codeSection .card h2,
#complexitySection .card h2 {
    color: #667eea;
    text-shadow: 0 2px 10px rgba(102, 126, 234, 0.3);
}

#algorithmSection .card p,
#codeSection .card p,
#complexitySection .card p {
    color: #e0e0e0;
}

#algorithmSection .card strong,
#codeSection .card strong,
#complexitySection .card strong {
    color: #ffd700;
    font-weight: 700;
}

#algorithmSection .card ul,
#algorithmSection .card ol,
#codeSection .card ul,
#codeSection .card ol,
#complexitySection .card ul,
#complexitySection .card ol {
    color: #d0d0d0;
}

/* Data Structure Cards Styling */
.ds-card {
    background: linear-gradient(135deg, rgba(102, 126, 234, 0.15) 0%, rgba(118, 75, 162, 0.1) 100%);
    border: 1px solid rgba(102, 126, 234, 0.3);
    border-radius: 15px;
    padding: 28px;
    margin-bottom: 20px;
    transition: transform 0.25s ease, box-shadow 0.25s ease, border-color 0.25s ease, background 0.25s ease;
    position: relative;
    overflow: hidden;
    will-change: transform, box-shadow;
    contain: paint;
}

.ds-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(102, 126, 234, 0.1), transparent);
    transition: left 0.6s ease;
}

.ds-card:hover::before {
    left: 100%;
}

.ds-card:hover {
    transform: translateY(-8px);
    box-shadow: 0 15px 40px rgba(102, 126, 234, 0.25);
    border: 1px solid rgba(102, 126, 234, 0.5);
    background: linear-gradient(135deg, rgba(102, 126, 234, 0.2) 0%, rgba(118, 75, 162, 0.15) 100%);
}

.ds-card h3 {
    color: #667eea;
    font-size: 1.5em;
    margin-bottom: 12px;
    position: relative;
    z-index: 1;
    font-weight: 700;
}

.ds-card p {
    color: #d0d0d0;
    position: relative;
    z-index: 1;
    margin-bottom: 12px;
}

.ds-card ul,
.ds-card ol {
    color: #d0d0d0;
    position: relative;
    z-index: 1;
    margin-left: 25px;
    margin-bottom: 12px;
}

.ds-card li {
    margin-bottom: 10px;
    line-height: 1.7;
}

.ds-card code {
    background: rgba(0, 0, 0, 0.3);
    color: #ffd700;
    padding: 2px 8px;
    border-radius: 4px;
    font-family: 'Courier New', monospace;
    font-weight: 600;
    position: relative;
    z-index: 1;
}
