/* Basic Reset and Global Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background: var(--dark);
    min-height: 100vh;
    display: flex;
    /* Column: calculator on top, footer below. Row layout squeezed the
       calculator into a sliver on narrow screens — footer and the toast
       container are body-level siblings and were stealing the row's width. */
    flex-direction: column;
    justify-content: flex-start;
    align-items: center;
    padding: 15px;
    color: var(--text);
    position: relative;
    overflow-x: hidden;
    overflow-y: auto;
}

/* Direct flex children must not be squashed vertically when content overflows */
body > .calculator-container,
body > footer {
    flex-shrink: 0;
    width: 100%;
    max-width: 820px;
}

/* Toasts live outside the flow — otherwise they become body flex items
   and steal layout space from the calculator. */
.notification-container {
    position: fixed;
    top: 16px;
    right: 16px;
    z-index: 10000;
    display: flex;
    flex-direction: column;
    gap: 8px;
    pointer-events: none;
    max-width: min(320px, calc(100vw - 32px));
}

.notification-container .notification {
    pointer-events: auto;
    background: var(--dark-lighter, #1a1a2e);
    border: 1px solid var(--border, rgba(255, 255, 255, 0.12));
    border-radius: 12px;
    padding: 10px 14px;
    font-size: 14px;
    color: var(--text, #fff);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.45);
    opacity: 0;
    transform: translateX(20px);
    transition: opacity 0.3s ease, transform 0.3s ease;
}

.notification-container .notification.show {
    opacity: 1;
    transform: translateX(0);
}

body::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background:
        radial-gradient(circle at 20% 80%, rgba(79, 70, 229, 0.25) 0%, transparent 50%),
        radial-gradient(circle at 80% 20%, rgba(6, 182, 212, 0.25) 0%, transparent 50%),
        radial-gradient(circle at 50% 50%, rgba(236, 72, 153, 0.15) 0%, transparent 60%),
        radial-gradient(circle at 40% 40%, rgba(245, 158, 11, 0.15) 0%, transparent 50%);
    pointer-events: none;
    z-index: 0;
    animation: float 20s ease-in-out infinite;
}

body::after {
    content: '';
    position: fixed;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background:
        repeating-linear-gradient(
            0deg,
            transparent,
            transparent 2px,
            rgba(79, 70, 229, 0.03) 2px,
            rgba(79, 70, 229, 0.03) 4px
        );
    pointer-events: none;
    z-index: 0;
    animation: shimmer 20s linear infinite;
}

/* Custom Scrollbar */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: var(--dark);
}

::-webkit-scrollbar-thumb {
    background: var(--dark-light);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--primary);
}