:root {
    --primary: #4f46e5;
    --primary-hover: #4338ca;
    --bg-gradient: linear-gradient(135deg, #f8fafc 0%, #e2e8f0 100%);
    --card-bg: rgba(255, 255, 255, 0.8);
    --text-main: #1e293b;
    --text-muted: #64748b;
    --input-border: #cbd5e1;
    --input-focus: #4f46e5;
    --shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.1), 0 8px 10px -6px rgba(0, 0, 0, 0.1);
    --radius: 16px;
}

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

body {
    font-family: 'Inter', sans-serif;
    color: var(--text-main);
    background: var(--bg-gradient);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* Navbar */
.navbar {
    padding: 20px 5%;
    display: flex;
    justify-content: flex-start;
}

.back-button {
    text-decoration: none;
    color: var(--text-main);
    font-weight: 600;
    font-size: 0.95rem;
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 10px 18px;
    background: white;
    border-radius: 50px;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
    transition: all 0.2s ease;
}

.back-button:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 12px -2px rgba(0, 0, 0, 0.15);
    background: #fdfdfd;
}

/* Container */
.container {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.card {
    background: var(--card-bg);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid rgba(255, 255, 255, 0.3);
    width: 100%;
    max-width: 450px;
    padding: 40px;
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    text-align: center;
    animation: fadeIn 0.6s ease-out;
}

h1 {
    font-size: 1.75rem;
    font-weight: 700;
    margin-bottom: 8px;
    letter-spacing: -0.025em;
}

.subtitle {
    color: var(--text-muted);
    font-size: 0.95rem;
    margin-bottom: 32px;
}

/* Result Area */
.result-display {
    background: white;
    height: 140px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 12px;
    margin-bottom: 32px;
    border: 1px solid rgba(0, 0, 0, 0.05);
}

#result-number {
    font-size: 5rem;
    font-weight: 800;
    color: var(--primary);
    transition: transform 0.2s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.number-animate {
    transform: scale(1.2);
}

/* Inputs */
.inputs-row {
    display: flex;
    gap: 16px;
    margin-bottom: 24px;
}

.input-group {
    flex: 1;
    text-align: left;
}

.input-group label {
    display: block;
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-muted);
    margin-bottom: 6px;
}

.input-group input {
    width: 100%;
    padding: 12px 16px;
    border: 1px solid var(--input-border);
    border-radius: 8px;
    font-size: 1rem;
    font-family: inherit;
    font-weight: 500;
    transition: all 0.2s ease;
}

.input-group input:focus {
    outline: none;
    border-color: var(--input-focus);
    box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.1);
}

/* Button */
.primary-btn {
    width: 100%;
    padding: 16px;
    background: var(--primary);
    color: white;
    border: none;
    border-radius: 12px;
    font-size: 1rem;
    font-weight: 700;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    transition: all 0.2s ease;
}

.primary-btn:hover {
    background: var(--primary-hover);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(79, 70, 229, 0.3);
}

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

/* Footer */
.footer {
    padding: 20px;
    text-align: center;
    color: var(--text-muted);
    font-size: 0.85rem;
}

/* Animations */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.hidden {
    display: none !important;
}

/* History Section */
.history-container {
    width: 100%;
    margin-top: 32px;
    padding-top: 24px;
    border-top: 1px solid var(--input-border);
    animation: fadeIn 0.4s ease-out;
}

.history-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
}

.history-header h2 {
    font-size: 1rem;
    font-weight: 700;
    color: var(--text-main);
}

.text-btn {
    background: none;
    border: none;
    color: var(--primary);
    font-weight: 600;
    font-size: 0.85rem;
    cursor: pointer;
    padding: 4px 8px;
    border-radius: 4px;
    transition: background 0.2s;
}

.text-btn:hover {
    background: rgba(79, 70, 229, 0.1);
}

.history-list {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    max-height: 150px;
    overflow-y: auto;
    padding-right: 4px;
}

/* Custom Scrollbar */
.history-list::-webkit-scrollbar {
    width: 4px;
}

.history-list::-webkit-scrollbar-track {
    background: transparent;
}

.history-list::-webkit-scrollbar-thumb {
    background: var(--input-border);
    border-radius: 10px;
}

.history-item {
    background: white;
    color: var(--text-main);
    font-weight: 600;
    font-size: 0.9rem;
    padding: 6px 12px;
    border-radius: 8px;
    border: 1px solid var(--input-border);
    animation: itemPop 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

@keyframes itemPop {
    from {
        transform: scale(0.8);
        opacity: 0;
    }

    to {
        transform: scale(1);
        opacity: 1;
    }
}

/* Responsive */
@media (max-width: 480px) {
    .card {
        padding: 30px 20px;
    }

    h1 {
        font-size: 1.5rem;
    }

    #result-number {
        font-size: 4rem;
    }
}

/* Article Section */
.article-section {
    background: white;
    padding: 80px 20px;
    margin-top: 40px;
    border-top: 1px solid var(--input-border);
}

.article-container {
    max-width: 800px;
    margin: 0 auto;
}

article {
    color: var(--text-main);
    line-height: 1.8;
}

article h2 {
    font-size: 2.25rem;
    margin-bottom: 24px;
    color: var(--text-main);
    text-align: left;
}

article h3 {
    font-size: 1.5rem;
    margin-top: 48px;
    margin-bottom: 16px;
    color: var(--text-main);
    font-weight: 700;
}

article p {
    margin-bottom: 24px;
    font-size: 1.1rem;
    color: var(--text-muted);
}

article strong {
    color: var(--text-main);
}

article ul,
article ol {
    margin-bottom: 32px;
    padding-left: 20px;
}

article li {
    margin-bottom: 12px;
    color: var(--text-muted);
    font-size: 1.1rem;
}

article h1,
article h2 {
    letter-spacing: -0.02em;
}

@media (max-width: 768px) {
    article h2 {
        font-size: 1.75rem;
    }

    article h3 {
        font-size: 1.25rem;
    }

    .article-section {
        padding: 40px 20px;
    }
}