:root {
    --bg-dark: #0f0c29;
    --bg-mid: #302b63;
    --bg-light: #24243e;
    
    --c-mult: #ff007f; /* Pink for multiplier (5) */
    --c-tick: #00f2fe; /* Cyan for ticket (8) */
    --c-pop:  #fed700; /* Yellow for popcorn (4) */
    --c-result: #00ff87; /* Green for result (60) */

    --glass-bg: rgba(255, 255, 255, 0.07);
    --glass-border: rgba(255, 255, 255, 0.15);
    
    --text-main: #ffffff;
    --text-muted: #b0b0b0;
}

body {
    margin: 0;
    font-family: 'Outfit', sans-serif;
    background: linear-gradient(135deg, var(--bg-dark), var(--bg-mid), var(--bg-light));
    color: var(--text-main);
    min-height: 100vh;
    overflow-x: hidden;
    padding: 2rem;
    box-sizing: border-box;
    display: flex;
    justify-content: center;
}

.background-globes {
    position: fixed;
    top: 0; left: 0; width: 100%; height: 100%;
    z-index: -1;
    overflow: hidden;
}

.globe {
    position: absolute;
    border-radius: 50%;
    filter: blur(100px);
    opacity: 0.5;
    animation: float 12s infinite ease-in-out;
}

.g1 { width: 500px; height: 500px; background: var(--c-mult); top: -200px; left: -100px; }
.g2 { width: 400px; height: 400px; background: var(--c-tick); bottom: -100px; right: -50px; animation-delay: -4s; }
.g3 { width: 300px; height: 300px; background: var(--c-pop); top: 50%; left: 50%; animation-delay: -8s; transform: translate(-50%, -50%); }

@keyframes float {
    0%, 100% { transform: translate(0, 0); }
    50% { transform: translate(30px, -30px); }
}

.container {
    width: 100%;
    max-width: 1100px;
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

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

.glass-panel {
    background: var(--glass-bg);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid var(--glass-border);
    border-radius: 24px;
    padding: 2rem;
    box-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.3);
}

h1 { margin-top: 0; font-weight: 800; font-size: 2.2rem; }
.subtitle { font-size: 1.2rem; color: var(--text-muted); margin-bottom: 0; }
.highlight { 
    background: linear-gradient(to right, #ff007f, #00f2fe); 
    -webkit-background-clip: text; 
    -webkit-text-fill-color: transparent; 
}

.term-container {
    font-size: 3.5rem;
    font-weight: 800;
    margin-bottom: 2rem;
    padding-bottom: 1.5rem;
    border-bottom: 2px dashed var(--glass-border);
    letter-spacing: 1px;
    transition: all 0.5s ease;
}

.c-mult { color: var(--c-mult); font-weight: bold; }
.c-tick { color: var(--c-tick); font-weight: bold; }
.c-pop { color: var(--c-pop); font-weight: bold; }
.c-result { color: var(--c-result); font-weight: bold; font-size: 1.2em; }

.controls {
    display: flex;
    justify-content: center;
    gap: 1.5rem;
    margin: 1rem 0;
}

.btn {
    background: rgba(255,255,255,0.1);
    border: 2px solid transparent;
    color: white;
    padding: 1rem 2rem;
    font-size: 1.2rem;
    font-family: inherit;
    border-radius: 50px;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
    font-weight: 600;
    flex: 1;
    max-width: 400px;
}

.btn:hover {
    background: rgba(255,255,255,0.2);
    transform: translateY(-2px);
}

.btn.active {
    background: linear-gradient(45deg, rgba(255,0,127,0.3), rgba(0,242,254,0.3));
    border-color: rgba(255,255,255,0.5);
    box-shadow: 0 0 20px rgba(255, 255, 255, 0.1);
}

/* Nav Buttons */
.nav-btn {
    background: rgba(0,0,0,0.3);
    border: 2px solid var(--glass-border);
    color: var(--text-muted);
    padding: 0.8rem 1.5rem;
    font-size: 1.1rem;
    font-family: inherit;
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.3s ease;
    font-weight: 600;
}
.nav-btn:hover {
    background: rgba(255,255,255,0.1);
    color: white;
}
.nav-btn.active {
    background: rgba(255,255,255,0.15);
    color: white;
    border-color: rgba(255,255,255,0.8);
    box-shadow: 0 0 15px rgba(255,255,255,0.1);
}

.law-section { display: none; }
.law-section.active-law { display: block; animation: fadeIn 0.5s ease; }
.hidden-law { display: none !important; }

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

.btn-small {
    background: rgba(0,0,0,0.4);
    border: 1px solid var(--glass-border);
    color: var(--text-muted);
    padding: 0.5rem 1.5rem;
    font-size: 0.95rem;
    font-family: inherit;
    border-radius: 50px;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-small:hover {
    background: rgba(255,255,255,0.1);
    color: white;
}

/* Stage */
.stage {
    position: relative;
    min-height: 250px;
    margin-bottom: 2rem;
}

.layout-grid {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 1.5rem;
    transition: opacity 0.3s;
}

.layout-separated {
    display: flex;
    flex-direction: column;
    gap: 2rem;
    transition: opacity 0.3s;
}

.hidden {
    display: none !important;
}

/* Items */
.item {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    font-size: 2.8rem;
    width: 85px;
    height: 85px;
    border-radius: 12px;
    background: rgba(0,0,0,0.5);
    border: 1px solid rgba(255,255,255,0.1);
    z-index: 10;
    will-change: transform, left, top;
}

.item.ticket { border-color: rgba(0, 242, 254, 0.6); box-shadow: inset 0 0 12px rgba(0, 242, 254, 0.3); }
.item.popcorn { border-color: rgba(254, 215, 0, 0.6); box-shadow: inset 0 0 12px rgba(254, 215, 0, 0.3); }

/* New item colors */
.item.waffle { border-color: #ff9a9e; box-shadow: inset 0 0 12px rgba(255, 154, 158, 0.3); }
.item.icecream { border-color: #a18cd1; box-shadow: inset 0 0 12px rgba(161, 140, 209, 0.3); }
.item.apple { border-color: #ff0844; box-shadow: inset 0 0 12px rgba(255, 8, 68, 0.3); }
.item.banana { border-color: #f6d365; box-shadow: inset 0 0 12px rgba(246, 211, 101, 0.3); }
.item.choco { border-color: #8b4513; box-shadow: inset 0 0 12px rgba(139, 69, 19, 0.3); }

.item-price { font-size: 1.2rem; font-weight: bold; margin-top: 4px; text-shadow: 1px 1px 2px rgba(0,0,0,0.8); }

.item-slot {
    width: 85px;
    height: 85px;
    border-radius: 12px;
    background: rgba(255,255,255,0.05);
    border: 2px dashed rgba(255,255,255,0.2);
    display: flex;
    justify-content: center;
    align-items: center;
}

.result-box {
    display: flex;
    align-items: center;
}

/* Assoziativ Bags */
.bag {
    display: flex;
    align-items: center;
    padding: 1rem;
    border-radius: 16px;
    background: rgba(255,255,255,0.02);
    border: 2px solid transparent;
    transition: all 0.5s ease;
}

.bag.highlighted-bag {
    background: rgba(255, 255, 255, 0.1);
    border-color: rgba(255, 255, 255, 0.4);
    box-shadow: 0 0 20px rgba(255, 255, 255, 0.15);
}

.bag-bracket {
    font-size: 6rem;
    font-weight: 300;
    color: rgba(255, 255, 255, 0.2);
    transition: color 0.5s ease;
    line-height: 1;
    margin: 0 5px;
}
.bag.highlighted-bag .bag-bracket {
    color: rgba(255, 255, 255, 0.9);
}

/* Method 1: Packages */
.package {
    background: rgba(255, 0, 127, 0.05);
    border: 2px dashed rgba(255, 0, 127, 0.4);
    border-radius: 16px;
    padding: 1.2rem;
    display: flex;
    gap: 0.8rem;
    align-items: center;
    position: relative;
    min-width: 150px;
    min-height: 70px;
}

.package-label {
    position: absolute;
    top: -12px;
    left: 50%;
    transform: translateX(-50%);
    background: var(--c-mult);
    color: white;
    font-weight: bold;
    font-size: 0.9rem;
    padding: 3px 12px;
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.5);
}

/* Method 2: Separated */
.item-group {
    background: rgba(0, 0, 0, 0.2);
    border-radius: 16px;
    padding: 1.5rem;
    border: 1px solid rgba(255,255,255,0.05);
    min-height: 80px;
}

.group-title {
    font-size: 1.3rem;
    margin-bottom: 1rem;
    font-weight: bold;
    color: white;
}

.items-row {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
    align-items: center;
}

.math-steps {
    margin-top: 1rem;
    background: rgba(255,255,255,0.05);
    padding: 1.5rem;
    border-radius: 12px;
    font-size: 1.4rem;
    border: 1px solid var(--glass-border);
}
.math-steps p { margin: 0.5rem 0; }

/* Theory Section / Arrows */
.hidden-theory {
    display: none;
}

.theory-grid {
    display: flex;
    justify-content: center;
    align-items: flex-end;
    gap: 2rem;
    flex-wrap: wrap;
}

.term-large {
    font-size: 3.5rem;
    font-weight: 800;
    letter-spacing: 2px;
}

.dist-container {
    position: relative;
    display: inline-block;
    padding-top: 40px; /* Space for arrow arches */
    width: 280px;
}

.svg-overlay {
    position: absolute;
    top: 0; left: 0;
    width: 100%; height: 100%;
    pointer-events: none;
    z-index: 5;
}

.arrow-p {
    fill: none;
    stroke: var(--c-mult);
    stroke-width: 4;
    stroke-linecap: round;
    opacity: 0;
    transform: translateY(-10px);
    transition: all 0.4s ease-out;
}

.arrow-p.draw {
    opacity: 1;
    transform: translateY(0);
}

/* Delay the second arrow to make it sequential! */
.arrow-p.a2.draw {
    transition-delay: 0.3s;
}
