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

:root {
    --primary: #6366f1;
    --primary-dark: #4f46e5;
    --primary-light: #818cf8;
    --bg-dark: #0f0f23;
    --bg-card: #1a1a2e;
    --bg-input: #16213e;
    --text-primary: #ffffff;
    --text-secondary: #a0a0b0;
    --accent-gradient: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    --glow: 0 0 40px rgba(99, 102, 241, 0.4);
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    background: var(--bg-dark);
    color: var(--text-primary);
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 1rem;
    background-image:
        radial-gradient(ellipse at top, rgba(99, 102, 241, 0.15) 0%, transparent 50%),
        radial-gradient(ellipse at bottom, rgba(118, 75, 162, 0.1) 0%, transparent 50%);
}

.container {
    width: 100%;
    max-width: 420px;
    background: var(--bg-card);
    border-radius: 24px;
    padding: 2rem;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
    border: 1px solid rgba(255, 255, 255, 0.05);
}

header {
    text-align: center;
    margin-bottom: 2rem;
}

header h1 {
    font-size: 2rem;
    font-weight: 700;
    background: var(--accent-gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin-bottom: 0.5rem;
}

.subtitle {
    color: var(--text-secondary);
    font-size: 0.9rem;
}

.number-display {
    background: var(--bg-input);
    border-radius: 20px;
    padding: 2.5rem 1rem;
    text-align: center;
    margin-bottom: 1.5rem;
    border: 2px solid rgba(99, 102, 241, 0.2);
    transition: all 0.3s ease;
}

.number-display.animate {
    transform: scale(1.02);
    border-color: var(--primary);
    box-shadow: var(--glow);
}

.number {
    font-size: 4rem;
    font-weight: 700;
    background: var(--accent-gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    display: block;
    line-height: 1;
}

.range-controls {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.input-group {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    width: 100%;
}

.input-group label {
    font-size: 0.85rem;
    color: var(--text-secondary);
    font-weight: 500;
    text-align: left;
}

.input-group input {
    background: var(--bg-input);
    border: 2px solid rgba(255, 255, 255, 0.1);
    border-radius: 12px;
    padding: 0.75rem 1rem;
    color: var(--text-primary);
    font-size: 1.1rem;
    font-weight: 600;
    text-align: center;
    transition: all 0.2s ease;
    width: 100%;
    min-width: 0;
}

.input-group input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.2);
}

.generate-btn {
    width: 100%;
    background: var(--accent-gradient);
    border: none;
    border-radius: 14px;
    padding: 1rem 1.5rem;
    color: white;
    font-size: 1.1rem;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.75rem;
    transition: all 0.2s ease;
    box-shadow: 0 4px 15px rgba(99, 102, 241, 0.4);
}

.generate-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(99, 102, 241, 0.5);
}

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

.btn-icon {
    font-size: 1.3rem;
}

.history-section {
    margin-top: 2rem;
    padding-top: 1.5rem;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.history-section h3 {
    font-size: 0.9rem;
    color: var(--text-secondary);
    margin-bottom: 1rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.history-list {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-bottom: 1rem;
    min-height: 40px;
}

.history-item {
    background: var(--bg-input);
    padding: 0.5rem 1rem;
    border-radius: 20px;
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--primary-light);
    border: 1px solid rgba(99, 102, 241, 0.2);
    animation: pop-in 0.3s ease;
}

@keyframes pop-in {
    0% {
        opacity: 0;
        transform: scale(0.8);
    }

    100% {
        opacity: 1;
        transform: scale(1);
    }
}

.empty-history {
    color: var(--text-secondary);
    font-size: 0.85rem;
    font-style: italic;
}

.clear-btn {
    background: transparent;
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: var(--text-secondary);
    padding: 0.5rem 1rem;
    border-radius: 8px;
    font-size: 0.8rem;
    cursor: pointer;
    transition: all 0.2s ease;
}

.clear-btn:hover {
    border-color: rgba(255, 255, 255, 0.3);
    color: var(--text-primary);
}

footer {
    text-align: center;
    margin-top: 2rem;
    padding-top: 1rem;
    border-top: 1px solid rgba(255, 255, 255, 0.05);
}

footer p {
    color: var(--text-secondary);
    font-size: 0.8rem;
}

/* PWA Install Prompt */
.install-prompt {
    position: fixed;
    bottom: 1rem;
    left: 50%;
    transform: translateX(-50%);
    background: var(--bg-card);
    padding: 1rem 1.5rem;
    border-radius: 12px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.5);
    border: 1px solid rgba(99, 102, 241, 0.3);
    display: none;
    gap: 1rem;
    align-items: center;
    z-index: 1000;
}

.install-prompt.show {
    display: flex;
}

.install-prompt button {
    background: var(--primary);
    border: none;
    padding: 0.5rem 1rem;
    border-radius: 8px;
    color: white;
    font-weight: 600;
    cursor: pointer;
}

@media (max-width: 480px) {
    .container {
        padding: 1.5rem;
    }

    .number {
        font-size: 3rem;
    }
}