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

body {
    background: #0f1114;
    overflow: hidden;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif;
}

canvas {
    display: block;
}

/* Add mass button - floating circle */
.add-btn {
    position: fixed;
    bottom: 2rem;
    left: 50%;
    transform: translateX(-50%);
    width: 2.8rem;
    height: 2.8rem;
    border: 1px solid rgba(91, 163, 163, 0.3);
    border-radius: 50%;
    background: rgba(15, 17, 20, 0.8);
    backdrop-filter: blur(8px);
    color: #5ba3a3;
    font-size: 1.3rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.5s ease, border-color 0.15s ease, background 0.15s ease;
    z-index: 10;
}

.add-btn.visible {
    opacity: 1;
    pointer-events: all;
}

.add-btn:hover {
    background: rgba(91, 163, 163, 0.15);
    border-color: rgba(91, 163, 163, 0.6);
}

.add-btn:active {
    transform: translateX(-50%) scale(0.92);
}

.add-btn.pulse {
    animation: pulse-glow 1.5s ease-in-out infinite;
}

.add-btn.cooldown {
    opacity: 0.3;
    pointer-events: none;
}

@keyframes pulse-glow {
    0%, 100% {
        box-shadow: 0 0 0 0 rgba(91, 163, 163, 0);
        border-color: rgba(91, 163, 163, 0.3);
    }
    50% {
        box-shadow: 0 0 14px 3px rgba(91, 163, 163, 0.3);
        border-color: rgba(91, 163, 163, 0.7);
    }
}

/* Camera flash */
.flash {
    position: fixed;
    inset: 0;
    background: white;
    opacity: 0;
    pointer-events: none;
    z-index: 60;
}

/* Finale screen */
.finale {
    position: fixed;
    inset: 0;
    background: #0f1114;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    opacity: 0;
    pointer-events: none;
    transition: opacity 1.5s ease;
    z-index: 50;
}

.finale.visible {
    opacity: 1;
    pointer-events: all;
}

.finale canvas {
    max-width: 90vw;
    max-height: 75vh;
    border-radius: 4px;
}

.finale-footer {
    margin-top: 1.5rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.8rem;
}

.finale-footer .finale-statement {
    font-size: 0.9rem;
    color: rgba(212, 215, 221, 0.7);
    font-style: italic;
    letter-spacing: 0.01em;
    opacity: 0;
    transform: translateY(5px);
    transition: opacity 1.2s ease, transform 1.2s ease;
}

.finale-footer .finale-statement.visible {
    opacity: 1;
    transform: translateY(0);
}

.finale-footer .seed {
    font-family: 'SF Mono', 'Fira Code', monospace;
    font-size: 0.7rem;
    color: rgba(212, 215, 221, 0.25);
    letter-spacing: 0.03em;
    opacity: 0;
    transition: opacity 1.2s ease;
}

.finale-footer .seed.visible {
    opacity: 1;
}

.finale-footer button {
    padding: 0.5rem 1.5rem;
    border: 1px solid rgba(91, 163, 163, 0.4);
    border-radius: 8px;
    background: rgba(91, 163, 163, 0.1);
    color: #5ba3a3;
    font-size: 0.85rem;
    font-weight: 500;
    cursor: pointer;
    opacity: 0;
    transition: opacity 0.8s ease, background 0.15s ease, border-color 0.15s ease;
}

.finale-footer button.visible {
    opacity: 1;
}

.finale-footer button:hover {
    background: rgba(91, 163, 163, 0.25);
    border-color: rgba(91, 163, 163, 0.6);
}

/* Never again link */
.finale-statement a {
    color: rgba(91, 163, 163, 0.8);
    text-decoration: none;
    border-bottom: 1px solid rgba(91, 163, 163, 0.3);
    transition: border-color 0.15s ease, color 0.15s ease;
}

.finale-statement a:hover {
    color: #5ba3a3;
    border-bottom-color: rgba(91, 163, 163, 0.7);
}

/* Math modal */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.7);
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
    z-index: 200;
}

.modal-overlay.visible {
    opacity: 1;
    pointer-events: all;
}

.modal {
    background: #1a1d23;
    border: 1px solid rgba(91, 163, 163, 0.2);
    border-radius: 12px;
    padding: 2rem;
    max-width: 460px;
    width: 90vw;
    position: relative;
}

.modal h3 {
    font-size: 1rem;
    font-weight: 600;
    color: rgba(212, 215, 221, 0.9);
    margin-bottom: 1rem;
}

.modal p {
    font-size: 0.85rem;
    line-height: 1.6;
    color: rgba(212, 215, 221, 0.65);
    margin-bottom: 0.75rem;
}

.modal p.math {
    font-family: 'SF Mono', 'Fira Code', monospace;
    font-size: 0.8rem;
    color: #5ba3a3;
    background: rgba(91, 163, 163, 0.06);
    padding: 0.6rem 0.9rem;
    border-radius: 6px;
    text-align: center;
}

.modal em {
    color: rgba(212, 215, 221, 0.85);
}

.modal .fun-fact {
    margin-top: 0.5rem;
    padding-top: 0.75rem;
    border-top: 1px solid rgba(91, 163, 163, 0.1);
    font-size: 0.8rem;
    color: rgba(91, 163, 163, 0.7);
}

.modal-close {
    position: absolute;
    top: 1rem;
    right: 1rem;
    width: 1.8rem;
    height: 1.8rem;
    border: none;
    background: none;
    color: rgba(212, 215, 221, 0.4);
    font-size: 1.3rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 4px;
    transition: color 0.15s ease, background 0.15s ease;
}

.modal-close:hover {
    color: rgba(212, 215, 221, 0.8);
    background: rgba(255, 255, 255, 0.05);
}
