:root {
    --primary-color: #4f46e5;
    --primary-hover: #4338ca;
    --secondary-color: #ef4444;
    --secondary-hover: #dc2626;
    --bg-color: #f3f4f6;
    --card-bg: #ffffff;
    --text-main: #1f2937;
    --text-muted: #6b7280;
    --border-color: #e5e7eb;
    --focus-ring: rgba(79, 70, 229, 0.4);
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
    --radius: 12px;
}

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

body {
    font-family: 'Outfit', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    background-color: var(--bg-color);
    color: var(--text-main);
    min-height: 100vh;
    padding: 20px;
    line-height: 1.5;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-start;
}

.container {
    width: 100%;
    max-width: 1200px;
    text-align: center;
    margin: 0 auto;
    padding-top: 20px;
    padding-bottom: 60px;
    animation: fadeIn 0.5s ease-out;
}

.top-bar {
    display: flex;
    justify-content: flex-start;
    margin-bottom: 32px;
}

header {
    margin-bottom: 24px;
    max-width: 800px;
    margin-left: auto;
    margin-right: auto;
}

.converter-card {
    background: var(--card-bg);
    border-radius: var(--radius);
    padding: 32px;
    box-shadow: var(--shadow-lg);
    display: flex;
    flex-direction: column;
    gap: 24px;
    margin-bottom: 32px;
    transition: transform 0.2s ease;
    max-width: 480px;
    margin-left: auto;
    margin-right: auto;
    border: 1px solid var(--border-color);
}

.article-content {
    text-align: left;
    max-width: 900px;
    margin: 48px auto;
    background: #fff;
    padding: 40px;
    border-radius: var(--radius);
    box-shadow: var(--shadow-sm);
}

.article-content h1,
.article-content h2,
.article-content h3 {
    color: var(--text-main);
    margin-top: 32px;
    margin-bottom: 16px;
    line-height: 1.3;
}

.article-content h1 {
    font-size: 2.25rem;
}

.article-content h2 {
    font-size: 1.75rem;
    border-bottom: 2px solid var(--border-color);
    padding-bottom: 12px;
}

.article-content h3 {
    font-size: 1.25rem;
    font-weight: 600;
}

.article-content p {
    margin-bottom: 20px;
    line-height: 1.7;
    color: #374151;
}

.article-content table {
    width: 100%;
    border-collapse: collapse;
    margin: 24px 0;
    font-size: 1rem;
}

.article-content th,
.article-content td {
    border: 1px solid var(--border-color);
    padding: 12px 16px;
    text-align: left;
}

.article-content th {
    background-color: #f9fafb;
    font-weight: 600;
}

.article-content tr:nth-child(even) {
    background-color: #f8fafc;
}

.article-content a {
    color: var(--primary-color);
    text-decoration: none;
    font-weight: 500;
}

.article-content a:hover {
    text-decoration: underline;
}

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

.input-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 500;
    font-size: 0.95rem;
    color: var(--text-main);
}

.input-group input {
    width: 100%;
    padding: 12px 16px;
    font-size: 1.1rem;
    border: 2px solid var(--border-color);
    border-radius: 8px;
    font-family: inherit;
    transition: all 0.2s;
    background-color: #f9fafb;
}

.input-group input:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 4px var(--focus-ring);
    background-color: #fff;
}

.result-group input {
    background-color: #f0fdf4;
    border-color: #86efac;
    font-weight: 600;
    color: #166534;
}

.result-group input:focus {
    border-color: #22c55e;
    box-shadow: 0 0 0 4px rgba(34, 197, 94, 0.2);
}

/* Remove Arrows from Number Input */
.input-group input[type=number]::-webkit-inner-spin-button,
.input-group input[type=number]::-webkit-outer-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

.input-group input[type=number] {
    -moz-appearance: textfield;
    appearance: textfield;
}

.arrow-divider {
    color: var(--text-muted);
    font-size: 1.5rem;
    font-weight: 300;
    user-select: none;
    display: flex;
    justify-content: center;
    align-items: center;
}

.button-group {
    display: flex;
    justify-content: center;
}

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 10px 24px;
    border-radius: 8px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    border: none;
    text-decoration: none;
    font-family: inherit;
    font-size: 0.95rem;
}

.btn-secondary {
    background-color: #e5e7eb;
    color: var(--text-main);
}

.btn-secondary:hover {
    background: #d1d5db;
}

.btn-primary {
    background-color: var(--primary-color);
    color: white;
    box-shadow: var(--shadow-md);
}

.btn-primary:hover {
    background-color: var(--primary-hover);
    box-shadow: var(--shadow-lg);
    transform: translateY(-1px);
}

.ads-container {
    margin: 32px auto;
    max-width: 900px;
    min-height: 90px;
    display: flex;
    justify-content: center;
    align-items: center;
    background: #ffffff;
    border-radius: var(--radius);
    box-shadow: var(--shadow-sm);
    padding: 20px;
}

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

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

/* Wide screen adjustments for desktop */
@media (min-width: 1024px) {
    .converter-card {
        max-width: 960px;
        flex-direction: row;
        flex-wrap: wrap;
        align-items: flex-end;
        padding: 48px;
    }

    .arrow-divider {
        transform: rotate(-90deg);
        margin: 0 16px 14px 16px;
        font-size: 2rem;
    }

    .button-group {
        flex: 0 0 100%;
        margin-top: 24px;
    }
}

@media (max-width: 480px) {
    .converter-card {
        padding: 24px;
    }

    header h1 {
        font-size: 1.75rem;
    }
}

/* Article Styling Refinements */
.article-content pre {
    background: #f8fafc;
    padding: 20px;
    border-radius: 8px;
    overflow-x: auto;
    margin-bottom: 24px;
    border: 1px solid var(--border-color);
}

.article-content code {
    font-family: 'SFMono-Regular', Consolas, 'Liberation Mono', Menlo, monospace;
    font-weight: 500;
    color: var(--primary-color);
    background: #f1f5f9;
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 0.9em;
}

.article-content pre code {
    background: transparent;
    padding: 0;
    color: var(--text-main);
}

.article-content ol,
.article-content ul {
    margin-bottom: 24px;
    padding-left: 28px;
}

.article-content li {
    margin-bottom: 12px;
    line-height: 1.7;
    color: #374151;
}

.faq-item {
    margin-bottom: 32px;
}

.faq-item h3 {
    font-size: 1.2rem;
    margin-top: 28px;
    margin-bottom: 12px;
    color: var(--text-main);
    font-weight: 600;
}

.faq-item p {
    margin-bottom: 0;
}

hr {
    border: 0;
    border-top: 1px solid var(--border-color);
    margin: 48px 0;
}

/* Flashcards Section */
.flashcards-section {
    margin: 64px auto;
    max-width: 1000px;
    padding: 0 20px;
    animation: fadeIn 0.6s ease-out;
}

.flashcards-section h2 {
    font-size: 2rem;
    margin-bottom: 32px;
    color: var(--text-main);
    text-align: center;
}

.flashcards-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 24px;
}

.flashcard {
    background: var(--card-bg);
    padding: 32px 24px;
    border-radius: var(--radius);
    border: 1px solid var(--border-color);
    text-decoration: none;
    color: var(--text-main);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    box-shadow: var(--shadow-sm);
    min-height: 140px;
}

.flashcard:hover {
    transform: translateY(-8px);
    box-shadow: var(--shadow-lg);
    border-color: var(--primary-color);
    background-color: #f8fafc;
}

.flashcard .card-title {
    font-weight: 600;
    font-size: 1.2rem;
    color: var(--primary-color);
    margin-bottom: 8px;
    display: block;
}

.flashcard .card-label {
    color: var(--text-muted);
    font-size: 0.9rem;
    font-weight: 400;
}

@media (max-width: 640px) {
    .flashcards-grid {
        grid-template-columns: 1fr 1fr;
        gap: 16px;
    }

    .flashcard {
        padding: 24px 16px;
        min-height: 120px;
    }

    .flashcard .card-title {
        font-size: 1rem;
    }
}