@layer reset, base, components, utilities;

@layer reset {
    *, *::before, *::after {
        box-sizing: border-box;
        margin: 0;
        padding: 0;
    }
}

@layer base {
    :root {
        --bg-color: oklch(15% 0.02 250);
        --text-color: oklch(95% 0.01 250);
        --accent-color: oklch(70% 0.15 250);
        --glass-bg: rgba(255, 255, 255, 0.03);
        --glass-border: rgba(255, 255, 255, 0.1);
        --shadow-soft: 0 10px 30px rgba(0, 0, 0, 0.5);
        --sub-text-color: rgba(255, 255, 255, 0.5);
        --placeholder-color: rgba(255, 255, 255, 0.2);
        --mesh-color-1: oklch(40% 0.1 250 / 0.15);
        --mesh-color-2: oklch(40% 0.1 150 / 0.15);
        --history-bg: rgba(255, 255, 255, 0.05);
    }

    [data-theme="light"] {
        --bg-color: oklch(98% 0.01 250);
        --text-color: oklch(20% 0.02 250);
        --accent-color: oklch(60% 0.2 250);
        --glass-bg: rgba(0, 0, 0, 0.03);
        --glass-border: rgba(0, 0, 0, 0.1);
        --shadow-soft: 0 10px 30px rgba(0, 0, 0, 0.1);
        --sub-text-color: rgba(0, 0, 0, 0.5);
        --placeholder-color: rgba(0, 0, 0, 0.2);
        --mesh-color-1: oklch(80% 0.1 250 / 0.15);
        --mesh-color-2: oklch(80% 0.1 150 / 0.15);
        --history-bg: rgba(0, 0, 0, 0.05);
    }

    body {
        background-color: var(--bg-color);
        color: var(--text-color);
        transition: background-color 0.3s, color 0.3s;
        font-family: 'Pretendard', -apple-system, BlinkMacSystemFont, system-ui, Roboto, sans-serif;
        display: flex;
        justify-content: center;
        align-items: center;
        min-height: 100vh;
        overflow-x: hidden;
        line-height: 1.6;
    }

    /* Subtle noise texture */
    body::before {
        content: "";
        position: fixed;
        top: 0; left: 0; width: 100%; height: 100%;
        opacity: 0.03;
        z-index: -1;
        pointer-events: none;
        background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 200 200' xmlns='http://www.w3.org/2000/svg'%3%3Ffilter id='noiseFilter'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.65' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noiseFilter)'/%3E%3C/svg%3E");
    }

    .background-mesh {
        position: fixed;
        top: 0; left: 0; width: 100%; height: 100%;
        background: radial-gradient(circle at 20% 30%, var(--mesh-color-1) 0%, transparent 50%),
                    radial-gradient(circle at 80% 70%, var(--mesh-color-2) 0%, transparent 50%);
        z-index: -1;
        transition: background 0.3s;
    }
}

@layer components {
    .container {
        position: relative;
        width: 90%;
        max-width: 500px;
        padding: 3rem 2rem;
        background: var(--glass-bg);
        backdrop-filter: blur(20px);
        border: 1px solid var(--glass-border);
        border-radius: 24px;
        box-shadow: var(--shadow-soft);
        text-align: center;
        container-type: inline-size;
    }

    .theme-toggle {
        position: absolute;
        top: 1.5rem;
        right: 1.5rem;
        background: none;
        border: 1px solid var(--glass-border);
        color: var(--text-color);
        cursor: pointer;
        padding: 0.5rem;
        border-radius: 50%;
        display: flex;
        align-items: center;
        justify-content: center;
        transition: all 0.3s;
    }

    .theme-toggle:hover {
        background: var(--glass-border);
    }

    header h1 {
        font-size: 2.5rem;
        letter-spacing: -1px;
        margin-bottom: 0.5rem;
    }

    header h1 span {
        color: var(--accent-color);
        font-weight: 300;
    }

    header p {
        color: var(--sub-text-color);
        font-size: 0.9rem;
        margin-bottom: 2.5rem;
    }

    .numbers-container {
        display: flex;
        justify-content: center;
        gap: 12px;
        min-height: 60px;
        margin-bottom: 3rem;
        flex-wrap: wrap;
    }

    .placeholder {
        color: var(--placeholder-color);
        font-style: italic;
        align-self: center;
    }

    .glow-button {
        width: 100%;
        padding: 1rem;
        font-size: 1.1rem;
        font-weight: 600;
        background: var(--accent-color);
        color: white;
        border: none;
        border-radius: 12px;
        cursor: pointer;
        transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
        box-shadow: 0 0 20px oklch(70% 0.15 250 / 0.3);
    }

    .glow-button:hover:not(:disabled) {
        transform: translateY(-2px);
        box-shadow: 0 0 30px oklch(70% 0.15 250 / 0.5);
        filter: brightness(1.1);
    }

    .glow-button:active:not(:disabled) {
        transform: scale(0.98);
    }

    .glow-button:disabled {
        opacity: 0.5;
        cursor: not-allowed;
        box-shadow: none;
    }
}

@layer utilities {
    @container (max-width: 400px) {
        .container {
            padding: 2rem 1.5rem;
        }
        header h1 {
            font-size: 2rem;
        }
    }
}
