@layer base, components, utilities;

@layer base {
    :root {
        --bg-color: oklch(0.15 0.02 240);
        --card-bg: oklch(0.25 0.03 240 / 0.7);
        --text-primary: oklch(0.95 0.01 240);
        --text-secondary: oklch(0.75 0.02 240);
        --accent-color: oklch(0.7 0.15 150);
        
        /* Ball Colors */
        --ball-1-10: oklch(0.8 0.15 85);   /* Yellow */
        --ball-11-20: oklch(0.6 0.15 240);  /* Blue */
        --ball-21-30: oklch(0.6 0.15 20);   /* Red */
        --ball-31-40: oklch(0.5 0.02 240);  /* Gray */
        --ball-41-45: oklch(0.6 0.15 150);  /* Green */
    }

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

    body {
        font-family: 'Pretendard', sans-serif;
        background-color: var(--bg-color);
        background-image: 
            radial-gradient(at 0% 0%, oklch(0.2 0.05 260 / 0.5) 0px, transparent 50%),
            radial-gradient(at 100% 100%, oklch(0.2 0.05 300 / 0.5) 0px, transparent 50%),
            url("https://www.transparenttextures.com/patterns/carbon-fibre.png");
        color: var(--text-primary);
        min-height: 100vh;
        display: flex;
        justify-content: center;
        align-items: center;
        padding: 20px;
        line-height: 1.6;
    }
}

@layer components {
    .app-container {
        width: 100%;
        max-width: 600px;
        background: var(--card-bg);
        backdrop-filter: blur(12px);
        border: 1px solid oklch(1 0 0 / 0.1);
        border-radius: 24px;
        padding: 40px;
        box-shadow: 
            0 20px 40px oklch(0 0 0 / 0.4),
            inset 0 0 20px oklch(1 0 0 / 0.05);
        text-align: center;
    }

    header h1 {
        font-size: 2.5rem;
        font-weight: 700;
        letter-spacing: -0.02em;
        margin-bottom: 8px;
        background: linear-gradient(135deg, #fff, oklch(0.7 0.15 150));
        -webkit-background-clip: text;
        -webkit-text-fill-color: transparent;
    }

    .subtitle {
        color: var(--text-secondary);
        font-size: 1rem;
        margin-bottom: 40px;
    }

    .ball-container {
        display: flex;
        justify-content: center;
        gap: 12px;
        margin: 40px 0;
        min-height: 60px;
        flex-wrap: wrap;
    }

    .placeholder-text {
        color: var(--text-secondary);
        font-style: italic;
        opacity: 0.6;
    }

    .controls {
        display: flex;
        flex-direction: column;
        gap: 12px;
        margin-bottom: 40px;
    }

    .primary-btn {
        background: var(--accent-color);
        color: oklch(0.1 0.02 240);
        border: none;
        padding: 16px 32px;
        font-size: 1.1rem;
        font-weight: 700;
        border-radius: 12px;
        cursor: pointer;
        transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
        box-shadow: 0 4px 15px oklch(0.7 0.15 150 / 0.3);
    }

    .primary-btn:hover {
        transform: translateY(-2px);
        box-shadow: 0 8px 25px oklch(0.7 0.15 150 / 0.4);
        filter: brightness(1.1);
    }

    .primary-btn:active {
        transform: translateY(0);
    }

    .secondary-btn {
        background: transparent;
        color: var(--text-secondary);
        border: 1px solid oklch(1 0 0 / 0.2);
        padding: 12px 24px;
        border-radius: 12px;
        cursor: pointer;
        transition: all 0.2s;
    }

    .secondary-btn:hover {
        background: oklch(1 0 0 / 0.05);
        color: var(--text-primary);
    }

    .history-section {
        border-top: 1px solid oklch(1 0 0 / 0.1);
        padding-top: 30px;
        text-align: left;
    }

    .history-section h2 {
        font-size: 1.2rem;
        margin-bottom: 20px;
        color: var(--text-secondary);
    }

    .history-list {
        display: flex;
        flex-direction: column;
        gap: 12px;
        max-height: 200px;
        overflow-y: auto;
        padding-right: 8px;
    }

    .history-item {
        background: oklch(1 0 0 / 0.03);
        padding: 12px;
        border-radius: 12px;
        display: flex;
        justify-content: space-between;
        align-items: center;
        animation: slideIn 0.3s ease-out;
    }

    .history-balls {
        display: flex;
        gap: 6px;
    }

    .timestamp {
        font-size: 0.8rem;
        color: var(--text-secondary);
    }

    /* Scrollbar Styling */
    .history-list::-webkit-scrollbar {
        width: 4px;
    }
    .history-list::-webkit-scrollbar-thumb {
        background: oklch(1 0 0 / 0.1);
        border-radius: 10px;
    }
}

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

@keyframes ballPop {
    0% { transform: scale(0); opacity: 0; }
    70% { transform: scale(1.1); }
    100% { transform: scale(1); opacity: 1; }
}
