@import url('https://fonts.googleapis.com/css2?family=Bree+Serif&family=Caveat:wght@400;700&family=Lobster&family=Monoton&family=Open+Sans:ital,wght@0,400;0,700;1,400;1,700&family=Playfair+Display+SC:ital,wght@0,400;0,700;1,700&family=Playfair+Display:ital,wght@0,400;0,700;1,700&family=Roboto:ital,wght@0,400;0,700;1,400;1,700&family=Source+Sans+Pro:ital,wght@0,400;0,700;1,700&family=Work+Sans:ital,wght@0,400;0,700;1,700&display=swap');

/* ══════════════════════════════════════════
   KVLab — styles.css
   ══════════════════════════════════════════ */

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

html {
    font-size: 16px;
}

body {
    background: #0e0e0e;
    font-family: 'JetBrains Mono', monospace;
    min-height: 100vh;
    -webkit-text-size-adjust: 100%;
}

/* ── ROOT ── */
.kv-root {
    min-height: 100vh;
    background: #0e0e0e;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-start;
    padding: 24px 16px 40px;
    position: relative;
    overflow-x: hidden;
}

/* ── AMBIENT GLOWS ── */
.glow {
    position: fixed;
    border-radius: 70%;
    pointer-events: none;
    z-index: 0;
}

.glow-tl {
    width: 500px;
    height: 500px;
    top: -150px;
    left: -150px;
    background: radial-gradient(circle, rgba(245, 158, 11, 0.08) 0%, transparent 70%);
}

.glow-br {
    width: 400px;
    height: 400px;
    bottom: -100px;
    right: -100px;
    background: radial-gradient(circle, rgba(16, 185, 129, 0.07) 0%, transparent 70%);
}

/* ── TOP BAR ── */
.top-bar {
    width: 100%;
    max-width: 1100px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 24px;
    flex-wrap: wrap;
    gap: 10px;
    position: relative;
    z-index: 1;
}

.brand {
    font-family: 'Syne', sans-serif;
    font-size: clamp(20px, 4vw, 28px);
    font-weight: 800;
    color: #fff;
    letter-spacing: -1px;
}

.brand em {
    color: #f59e0b;
    font-style: normal;
}

.badge {
    font-size: clamp(12px, 1.5vw, 10px);
    letter-spacing: 2px;
    text-transform: uppercase;
    color: White;
    border: 2px solid rgba(245, 158, 11, 0.2);
    padding: 5px 12px;
    border-radius: 100px;
    background: rgba(245, 158, 11, 0.04);
    white-space: nowrap;
}

/* ── LAYOUT ── */
.layout {
    width: 100%;
    max-width: 1100px;
    display: grid;
    grid-template-columns: 1fr;
    background: #161616;
    border: 1px solid #242424;
    border-radius: 14px;
    overflow: hidden;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.6), 0 0 0 1px rgba(255, 255, 255, 0.03);
    position: relative;
    z-index: 1;
}

/* ── PANELS ── */
.panel-left {
    padding: clamp(24px, 4vw, 52px) clamp(20px, 4vw, 48px);
    border-bottom: 1px solid #242424;
    background: #161616;
}

.panel-right {
    padding: clamp(24px, 4vw, 52px) clamp(20px, 4vw, 48px);
    background: #111;
    display: flex;
    flex-direction: column;
}

.panel-title {
    font-family: 'Syne', sans-serif;
    font-size: 15px;
    font-weight: 700;
    letter-spacing: 4px;
    text-transform: uppercase;
    color: green;
    margin-bottom: clamp(20px, 3vw, 36px);
}

/* ── INPUTS ── */
.input-stack {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: clamp(14px, 2vw, 26px);
}

.input-group {
    display: flex;
    flex-direction: column;
    gap: 7px;
}

.input-label {
    font-size: clamp(12px, 1.5vw, 10px);
    letter-spacing: 2px;
    text-transform: uppercase;
    color: orange;
}

.input-wrap {
    position: relative;
    display: flex;
    align-items: center;
}

.input-field {
    width: 100%;
    background: #1e1e1e;
    border: 1px solid #2e2e2e;
    border-radius: 10px;
    padding: clamp(12px, 2vw, 16px) 52px clamp(12px, 2vw, 16px) clamp(12px, 2vw, 20px);
    font-family: 'JetBrains Mono', monospace;
    font-size: clamp(16px, 3vw, 22px);
    font-weight: 500;
    color: white;
    outline: none;
    transition: border-color 0.25s, box-shadow 0.25s;
    -moz-appearance: textfield;
}

.input-field::-webkit-outer-spin-button,
.input-field::-webkit-inner-spin-button {
    -webkit-appearance: none;
}

.input-field:focus {
    border-color: #f59e0b;
    box-shadow: 0 0 0 3px rgba(245, 158, 11, 0.1);
}

.input-unit {
    position: absolute;
    right: 14px;
    font-size: 10px;
    font-weight: 600;
    letter-spacing: 1px;
    color: rgba(245, 158, 11, 0.5);
    pointer-events: none;
}

/* ── RESULTS ── */
.results-stack {
    display: flex;
    flex-direction: column;
    gap: clamp(8px, 1.5vw, 12px);
    flex: 1;
}

.result-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: clamp(12px, 2vw, 18px) clamp(14px, 2vw, 24px);
    background: #181818;
    border: 1px solid #242424;
    border-radius: 10px;
    animation: slideIn 0.35s ease forwards;
    opacity: 0;
    transition: border-color 0.2s;
    gap: 12px;
}

.result-row:hover {
    border-color: #363636;
}

.result-row.highlight {
    background: linear-gradient(135deg, #1d1500, #181100);
    border-color: rgba(245, 158, 11, 0.3);
    box-shadow: 0 0 40px rgba(245, 158, 11, 0.06), inset 0 1px 0 rgba(245, 158, 11, 0.08);
}

.result-left {
    display: flex;
    flex-direction: column;
    gap: 3px;
    min-width: 0;
}

.result-label {
    font-size: clamp(12px, 1.5vw, 10px);
    letter-spacing: 2px;
    text-transform: uppercase;
    color: Yellow;
    white-space: nowrap;
}

.result-row.highlight .result-label {
    color: white;
    font-size: 15px;
}

.result-formula {
    font-size: clamp(9px, 1.2vw, 10px);
    color: white;
    letter-spacing: 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.result-value {
    font-size: clamp(13px, 2.5vw, 17px);
    font-weight: 500;
    color: white;
    letter-spacing: -0.3px;
    flex-shrink: 0;
}

.result-row.highlight .result-value {
    font-size: clamp(20px, 4vw, 30px);
    font-weight: 600;
    color: green;
    text-shadow: 0 0 30px rgba(245, 158, 11, 0.45);
}

.empty-state {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    color: rgba(255, 255, 255, 0.1);
    font-size: 11px;
    letter-spacing: 3px;
    text-transform: uppercase;
    padding: 40px 0;
}

/* ── ANIMATION DELAY CLASSES ── */
.r0 {
    animation-delay: 0.00s;
}

.r1 {
    animation-delay: 0.07s;
}

.r2 {
    animation-delay: 0.14s;
}

.r3 {
    animation-delay: 0.21s;
}

.r4 {
    animation-delay: 0.28s;
}

/* ── RESET BUTTON ── */
.reset-btn {
    margin-top: 16px;
    width: 100%;
    padding: clamp(12px, 2vw, 14px);
    background: transparent;
    border: 1px solid #242424;
    border-radius: 10px;
    color: yellow;
    font-family: 'JetBrains Mono', monospace;
    font-size: clamp(12px, 1.5vw, 10px);
    letter-spacing: 3px;
    text-transform: uppercase;
    cursor: pointer;
    transition: all 0.2s;
}

.reset-btn:hover {
    border-color: rgba(245, 158, 11, 0.25);
    color: rgba(245, 158, 11, 0.55);
    background: rgba(245, 158, 11, 0.03);
}

/* ── FORMULA STRIP ── */
.formula-strip {
    width: 100%;
    max-width: 1100px;
    margin-top: 14px;
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    border: 1px solid #1e1e1e;
    border-radius: 10px;
    overflow: hidden;
    position: relative;
    z-index: 1;
}

.formula-item {
    padding: 10px 14px;
    background: #0e0e0e;
    border-right: 2px solid #1e1e1e;
    border-bottom: 2px solid #1e1e1e;
    font-size: clamp(9px, 1.2vw, 10px);
    color: white;
    line-height: 1.7;
}

.formula-item:nth-child(2n) {
    border-right: none;
}

.formula-item:nth-last-child(-n+2) {
    border-bottom: none;
}

.formula-item:last-child {
    grid-column: 1 / -1;
    border-right: none;
}

.formula-item strong {
    color: white;
    display: block;
    margin-bottom: 2px;
    font-size: 12px;
    letter-spacing: 1px;
    text-transform: uppercase;
}

/* ── KEYFRAMES ── */
@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateX(10px);
    }

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

/* ── TABLET: 640px+ ── */
@media (min-width: 640px) {
    .kv-root {
        padding: 32px 32px 48px;
    }

    .formula-strip {
        grid-template-columns: repeat(3, 1fr);
    }

    .formula-item:nth-child(2n) {
        border-right: 1px solid #1e1e1e;
    }

    .formula-item:nth-child(3n) {
        border-right: none;
    }

    .formula-item:nth-last-child(-n+2) {
        border-bottom: 1px solid #1e1e1e;
    }

    .formula-item:last-child {
        grid-column: auto;
        border-right: none;
        border-bottom: none;
    }
}

/* ── DESKTOP: 900px+ ── */
@media (min-width: 900px) {
    .kv-root {
        padding: 40px 60px;
        justify-content: center;
    }

    .layout {
        grid-template-columns: 1fr 1fr;
    }

    .panel-left {
        border-bottom: none;
        border-right: 1px solid #242424;
    }

    .input-stack {
        grid-template-columns: 1fr;
    }

    .formula-strip {
        grid-template-columns: repeat(5, 1fr);
    }

    .formula-item {
        border-bottom: none !important;
    }

    .formula-item:nth-child(n) {
        border-right: 1px solid #1e1e1e;
    }

    .formula-item:last-child {
        grid-column: auto;
        border-right: none;
    }
}

/* ── LARGE: 1280px+ ── */
@media (min-width: 1280px) {
    .input-stack {
        gap: 28px;
    }

    .result-row {
        padding: 20px 26px;
    }
}