        :root {
          --background: #ffffff;
          --card: #ffffff;
          --text: #0f172a;
          --soft: #64748b;
          --muted: #f1f7fb;
          --border: #e2e8f0;
          --primary: #2563eb;
        }

        .dark {
          --background: #0b1020;
          --card: #0e162b;
          --text: #e5e7eb;
          --soft: #94a3b8;
          --muted: #0f172a;
          --border: #1f2937;
          --primary: #60a5fa;
        }

        body {
            font-family: 'Inter', sans-serif;
            background-color: var(--background);
            color: var(--text);
        }
        .converter-container {
            max-width: 860px;
            margin: 2rem auto;
            text-align: center;
        }
        .converter-box {
            margin: 2rem auto;
            padding: 2rem;
            background: var(--card);
            border-radius: 14px;
            box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.07), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
            border: 1px solid var(--border);
            transition: all 0.3s;
        }
        .input-group {
            display: grid;
            grid-template-columns: 1fr;
            gap: 1.5rem;
            margin-bottom: 1.5rem;
        }
        @media (min-width: 768px) {
            .input-group {
                grid-template-columns: 1fr 2fr auto 2fr;
                align-items: end;
            }
        }
        .input-wrapper {
            text-align: left;
        }
        .input-wrapper label {
            display: block;
            font-weight: 600;
            margin-bottom: 0.5rem;
            color: var(--text);
        }
        .input-wrapper input, .currency-select-btn {
            width: 100%;
            padding: 1rem;
            font-size: 1.25rem;
            font-weight: 700;
            border: 1px solid var(--border);
            border-radius: 12px;
            background-color: var(--card);
            color: var(--text);
            transition: border-color 0.2s, box-shadow 0.2s;
        }
         .input-wrapper input:focus, .currency-select-btn:focus {
            outline: none;
            border-color: var(--primary);
            box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.2);
        }
        .currency-select { position: relative; }
        .currency-select-btn {
            display: flex;
            align-items: center;
            justify-content: space-between;
            cursor: pointer;
            font-size: 1.1rem;
        }
        .currency-select-btn .flag {
            font-size: 1.5rem;
        }
        .currency-dropdown {
            position: absolute;
            top: 100%; left: 0; right: 0;
            max-height: 320px; overflow-y: auto;
            background: var(--card);
            border: 1px solid var(--border);
            border-radius: 10px;
            z-index: 100;
            display: none;
            margin-top: 0.5rem;
            box-shadow: 0 4px 12px rgba(0,0,0,0.08);
            text-align: left;
        }
        .currency-dropdown input {
            width: 95%;
            margin: .6rem auto;
            padding: .6rem;
            display: block;
            border: 1px solid var(--border);
            border-radius: 8px;
            font-size: 1rem;
            background-color: var(--background);
            color: var(--text);
        }
        .currency-option {
            padding: .9rem 1rem;
            cursor: pointer;
            display: flex; align-items: center; gap: .6rem;
            font-size: 1.05rem;
        }
        .currency-option:hover { background: var(--muted); }
        #result-display {
            margin-top: 1.5rem;
            padding: 1.5rem;
            background-color: var(--muted);
            border-radius: 12px;
            text-align: left;
        }
        #result-main {
            font-size: 2.25rem;
            font-weight: 700;
            color: var(--primary);
            min-height: 40px;
            word-wrap: break-word;
        }
        #rate-info {
            margin-top: .5rem;
            color: var(--soft);
            min-height: 20px;
        }
        #last-updated {
            font-size: 0.875rem;
            color: var(--soft);
            margin-top: 1rem;
            text-align: right;
        }
        .history { margin-top: 2rem; }
        .history h3 { margin-bottom: .6rem; text-align: center; font-size: 1.25rem; font-weight: 600;}
        .history ul { list-style: none; padding: 0; display: flex; flex-direction: column; gap: .5rem; }
        .history li {
            padding: .7rem 1rem;
            border: 1px solid var(--border);
            border-radius: 10px;
            cursor: pointer;
            background: var(--muted);
            transition: background-color 0.2s;
        }
        .history li:hover { background: var(--card); }
        .history-controls button {
            display: inline-block;
            margin: 1.5rem 0.5rem 0;
            font-weight: 600;
            color: var(--soft);
            padding: 0.5rem 1rem;
            border-radius: 8px;
            transition: background-color 0.2s, color 0.2s;
            border: 1px solid var(--border);
        }
        .history-controls button:hover {
            background-color: var(--muted);
            color: var(--text);
        }
        .swap-btn-container {
            display: flex;
            align-items: flex-end;
            justify-content: center;
        }
        .swap-btn {
            background-color: var(--card);
            border: 1px solid var(--border);
            border-radius: 50%;
            width: 48px;
            height: 48px;
            display: flex;
            align-items: center;
            justify-content: center;
            cursor: pointer;
            transition: all 0.2s ease-in-out;
        }
        .swap-btn:hover {
            transform: rotate(180deg);
            background-color: var(--muted);
        }
        .swap-btn svg { width: 24px; height: 24px; color: var(--soft); }
        .loader {
            font-size: 1.5rem; color: var(--soft); animation: pulse 1.5s infinite ease-in-out;
        }
        @keyframes pulse { 0%, 100% { opacity: 1; } 50% { opacity: 0.4; } }
