:root {
    --bg: #0d0d12;
    --bg2: #16161f;
    --glass: rgba(22, 22, 31, .85);
    --text: #fff;
    --text2: #888;
    --accent: #7c3aed;
    --accent2: #a78bfa;
    --gradient: linear-gradient(135deg, #7c3aed, #a78bfa);
    --border: rgba(255, 255, 255, .08);
    --radius: 16px
}

[data-theme=light] {
    --bg: #f8fafc;
    --bg2: #fff;
    --glass: rgba(255, 255, 255, .9);
    --text: #1e1e2e;
    --text2: #64748b;
    --border: rgba(0, 0, 0, .1)
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box
}

body {
    font-family: 'Inter', sans-serif;
    background: var(--bg);
    color: var(--text);
    min-height: 100vh
}

.app {
    position: relative;
    min-height: 100vh;
    padding: 24px;
    max-width: 700px;
    margin: 0 auto
}

.bg {
    position: fixed;
    inset: 0;
    pointer-events: none;
    overflow: hidden;
    z-index: 0
}

.orb {
    position: absolute;
    border-radius: 50%;
    filter: blur(80px);
    opacity: .4;
    animation: float 20s ease-in-out infinite
}

.o1 {
    width: 400px;
    height: 400px;
    background: var(--accent);
    top: -100px;
    right: -100px
}

.o2 {
    width: 300px;
    height: 300px;
    background: #ec4899;
    bottom: -50px;
    left: -50px;
    animation-delay: -10s
}

@keyframes float {

    0%,
    100% {
        transform: translate(0, 0)
    }

    50% {
        transform: translate(20px, 20px)
    }
}

.glass {
    background: var(--glass);
    backdrop-filter: blur(20px);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 24px;
    margin-bottom: 20px
}

.header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 24px;
    position: relative;
    z-index: 1
}

.logo {
    display: flex;
    align-items: center;
    gap: 10px
}

.logo span {
    font-size: 1.8rem
}

.logo h1 {
    font-size: 1.5rem;
    font-weight: 400;
    background: var(--gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent
}

.logo h1 b {
    font-weight: 700
}

#theme-btn {
    width: 44px;
    height: 44px;
    background: var(--bg2);
    border: 1px solid var(--border);
    border-radius: 12px;
    font-size: 1.2rem;
    cursor: pointer;
    transition: .2s
}

#theme-btn:hover {
    transform: scale(1.1)
}

main {
    position: relative;
    z-index: 1
}

.category-tabs {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    margin-bottom: 20px
}

.tab {
    padding: 10px 16px;
    background: var(--bg2);
    border: 1px solid var(--border);
    border-radius: 10px;
    font-size: .85rem;
    cursor: pointer;
    transition: .2s;
    white-space: nowrap
}

.tab:hover {
    border-color: var(--accent)
}

.tab.active {
    background: var(--gradient);
    color: #fff;
    border-color: transparent
}

.conversion-area {
    display: flex;
    align-items: center;
    gap: 16px;
    flex-wrap: wrap
}

.input-group {
    flex: 1;
    min-width: 200px
}

.input-group select {
    width: 100%;
    padding: 12px;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: 10px;
    color: var(--text);
    font-family: inherit;
    margin-bottom: 10px;
    cursor: pointer
}

.input-group select:focus {
    outline: none;
    border-color: var(--accent)
}

.input-group input {
    width: 100%;
    padding: 16px;
    background: var(--bg);
    border: 2px solid var(--border);
    border-radius: 12px;
    font-size: 1.5rem;
    font-weight: 600;
    color: var(--text);
    font-family: inherit;
    text-align: center
}

.input-group input:focus {
    outline: none;
    border-color: var(--accent)
}

#to-value {
    background: rgba(124, 58, 237, .1);
    border-color: var(--accent)
}

.swap-btn {
    width: 50px;
    height: 50px;
    background: var(--gradient);
    border: none;
    border-radius: 50%;
    font-size: 1.5rem;
    cursor: pointer;
    transition: .3s;
    flex-shrink: 0
}

.swap-btn:hover {
    transform: rotate(180deg)
}

.formula-display {
    text-align: center;
    padding: 16px;
    background: var(--bg);
    border-radius: 10px;
    margin-top: 20px;
    font-size: .9rem;
    color: var(--text2)
}

.formula-display span {
    color: var(--accent2);
    font-weight: 600
}

.copy-btn {
    width: 100%;
    padding: 14px;
    margin-top: 16px;
    background: var(--gradient);
    border: none;
    border-radius: 12px;
    color: #fff;
    font-weight: 600;
    cursor: pointer;
    transition: .2s
}

.copy-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(124, 58, 237, .3)
}

.quick-convert h3,
.history h3 {
    font-size: 1rem;
    margin-bottom: 16px;
    display: flex;
    align-items: center;
    gap: 8px
}

.quick-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    gap: 10px
}

.quick-item {
    padding: 12px;
    background: var(--bg);
    border-radius: 10px;
    text-align: center;
    cursor: pointer;
    transition: .2s;
    border: 1px solid transparent
}

.quick-item:hover {
    border-color: var(--accent);
    transform: translateY(-2px)
}

.quick-item .value {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--accent2)
}

.quick-item .label {
    font-size: .75rem;
    color: var(--text2);
    margin-top: 4px
}

.history-list {
    max-height: 200px;
    overflow-y: auto
}

.history-item {
    display: flex;
    justify-content: space-between;
    padding: 12px;
    background: var(--bg);
    border-radius: 8px;
    margin-bottom: 8px;
    font-size: .85rem
}

.fab {
    position: fixed;
    bottom: 24px;
    right: 24px;
    width: 56px;
    height: 56px;
    background: var(--gradient);
    border: none;
    border-radius: 50%;
    font-size: 1.5rem;
    cursor: pointer;
    box-shadow: 0 8px 20px rgba(124, 58, 237, .4);
    z-index: 10;
    transition: .2s
}

.fab:hover {
    transform: scale(1.1)
}

.toast {
    position: fixed;
    bottom: 100px;
    left: 50%;
    transform: translateX(-50%) translateY(20px);
    background: var(--bg2);
    border: 1px solid var(--accent);
    padding: 12px 24px;
    border-radius: 12px;
    opacity: 0;
    transition: .3s;
    z-index: 100
}

.toast.show {
    opacity: 1;
    transform: translateX(-50%) translateY(0)
}

@media(max-width:500px) {
    .conversion-area {
        flex-direction: column
    }

    .swap-btn {
        transform: rotate(90deg)
    }

    .swap-btn:hover {
        transform: rotate(270deg)
    }
}