:root {
    color-scheme: dark;
    --bg: #05080e;
    --panel: rgba(8, 14, 24, 0.96);
    --panel-soft: rgba(13, 21, 32, 0.9);
    --text: #eef8f2;
    --muted: #98adb0;
    --green: #6fbf72;
    --cyan: #4fbeca;
    --amber: #c9a85e;
    --violet: #8a72c8;
    --border: rgba(111, 191, 114, 0.2);
    --shadow: rgba(0, 0, 0, 0.5);
    --radius: 8px;
    font-family: Inter, Roboto, "Segoe UI", Arial, sans-serif;
}

* {
    box-sizing: border-box;
}

body {
    min-width: 320px;
    min-height: 100vh;
    margin: 0;
    padding-bottom: 78px;
    color: var(--text);
    background:
        linear-gradient(rgba(111, 191, 114, 0.016) 1px, transparent 1px),
        linear-gradient(90deg, rgba(79, 190, 202, 0.014) 1px, transparent 1px),
        linear-gradient(135deg, rgba(111, 191, 114, 0.035), transparent 34%),
        linear-gradient(315deg, rgba(138, 114, 200, 0.03), transparent 38%),
        var(--bg);
    background-size: 34px 34px, 34px 34px, auto, auto, auto;
    line-height: 1.5;
}

button,
input,
select {
    font: inherit;
}

button {
    cursor: pointer;
}

a {
    color: var(--cyan);
    text-decoration: none;
}

a:hover {
    text-decoration: underline;
}

.app-header {
    border-bottom: 1px solid rgba(111, 191, 114, 0.18);
    background: linear-gradient(90deg, rgba(111, 191, 114, 0.052), rgba(138, 114, 200, 0.032)), rgba(5, 8, 14, 0.94);
    box-shadow: 0 12px 30px var(--shadow);
}

h1 {
    margin: 0;
    font-family: "Cascadia Mono", "Segoe UI", monospace;
    font-size: clamp(1.7rem, 4vw, 2.85rem);
    line-height: 1.05;
    text-transform: uppercase;
    text-shadow: 0 0 14px rgba(111, 191, 114, 0.14);
}

h1 a,
h1 a:hover {
    color: inherit;
    text-decoration: none;
}

.header-tagline.is-typing {
    min-width: var(--typing-width, auto);
}

.header-tagline.is-typing::after {
    content: "";
    display: inline-block;
    width: 8px;
    height: 1em;
    margin-left: 4px;
    vertical-align: -2px;
    background: currentColor;
    box-shadow: 0 0 8px currentColor;
    animation: cursor-blink 800ms steps(2, start) infinite;
}

.header-tagline {
    max-width: 620px;
    margin: 8px 0 0;
    color: var(--muted);
    font-weight: 700;
}

.converter-shell {
    width: min(1080px, calc(100% - 32px));
    margin: 30px auto 56px;
}

.converter-panel {
    overflow: hidden;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--panel);
    box-shadow: 0 0 14px rgba(111, 191, 114, 0.035), 0 14px 34px var(--shadow);
}

.info-panel {
    margin-top: 18px;
    padding: clamp(18px, 4vw, 30px);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--panel);
    box-shadow: 0 0 14px rgba(111, 191, 114, 0.035), 0 14px 34px var(--shadow);
}

.info-panel h2 {
    margin: 0 0 12px;
    color: var(--green);
}

.info-panel p {
    margin: 10px 0 0;
    color: var(--muted);
}

.privacy-note {
    padding: 10px 12px;
    border-left: 3px solid var(--cyan);
    background: rgba(79, 190, 202, 0.045);
    border-radius: 6px;
}

.category-tabs {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    background: rgba(0, 0, 0, 0.2);
}

.category-tab {
    min-height: 54px;
    color: var(--muted);
    border: 0;
    border-bottom: 1px solid rgba(111, 191, 114, 0.16);
    background: transparent;
    font-weight: 850;
    text-transform: uppercase;
}

.category-tab.is-active {
    color: var(--text);
    background:
        linear-gradient(90deg, rgba(111, 191, 114, 0.07), rgba(79, 190, 202, 0.04)),
        rgba(111, 191, 114, 0.028);
    box-shadow: inset 0 -2px 0 var(--green), 0 0 10px rgba(111, 191, 114, 0.05);
}

.converter-grid {
    padding: clamp(18px, 4vw, 30px);
    display: grid;
    grid-template-columns: minmax(180px, 1fr) 48px minmax(180px, 1fr);
    align-items: end;
    gap: 16px;
}

.field {
    display: grid;
    gap: 8px;
}

.field span {
    color: var(--green);
    font-size: 0.78rem;
    font-weight: 900;
    letter-spacing: 0.1em;
    text-transform: uppercase;
}

input,
select {
    width: 100%;
    min-height: 48px;
    color: var(--text);
    border: 1px solid rgba(79, 190, 202, 0.22);
    border-radius: 6px;
    background: rgba(0, 0, 0, 0.28);
    outline: none;
}

.field--value {
    grid-column: 1 / -1;
}

input {
    padding: 10px 12px;
}

select {
    padding: 10px;
    background-color: #0b1420;
}

select option {
    color: var(--text);
    background-color: #0b1420;
}

input[type="file"],
select {
    cursor: pointer;
}

input:focus,
select:focus,
.swap-button:focus-visible {
    border-color: var(--green);
    box-shadow: 0 0 0 3px rgba(111, 191, 114, 0.1);
}

.swap-button {
    width: 48px;
    height: 48px;
    display: inline-grid;
    place-items: center;
    color: var(--bg);
    border: 1px solid rgba(201, 168, 94, 0.28);
    border-radius: 6px;
    background: linear-gradient(135deg, var(--amber), var(--green));
    box-shadow: inset 0 -2px 0 rgba(0, 0, 0, 0.25), 0 0 10px rgba(201, 168, 94, 0.12);
}

.swap-button i {
    font-size: 1.25rem;
    line-height: 1;
}

.swap-button:active {
    transform: scale(0.96);
}

.result-panel {
    margin: 0 clamp(18px, 4vw, 30px) clamp(18px, 4vw, 30px);
    padding: 18px;
    display: grid;
    gap: 10px;
    border: 1px solid rgba(79, 190, 202, 0.22);
    border-left: 3px solid var(--cyan);
    border-radius: var(--radius);
    background: var(--panel-soft);
}

.result-panel > span {
    color: var(--cyan);
    font-size: 0.78rem;
    font-weight: 900;
    letter-spacing: 0.12em;
    text-transform: uppercase;
}

.result-panel output {
    color: var(--text);
    font-family: "Cascadia Mono", "Segoe UI", monospace;
    font-size: clamp(1.35rem, 4vw, 2.4rem);
    min-width: 0;
    overflow-wrap: anywhere;
    word-break: break-word;
}

.result-panel output .result-value-group {
    min-width: 0;
    max-width: 100%;
    display: inline;
}

.result-panel output .result-number {
    color: var(--text);
    overflow-wrap: anywhere;
    word-break: break-word;
}

.result-panel output .result-unit {
    margin-left: 0.28em;
    color: #8fd4ff;
    font-weight: 900;
    white-space: nowrap;
}

.result-panel output .result-equals {
    margin: 0 0.44em;
    color: #d8b65f;
    font-weight: 900;
}

.noscript-alert {
    width: min(1080px, calc(100% - 32px));
    margin: 16px auto 0;
    padding: 12px 14px;
    color: #ffe1e8;
    border: 1px solid rgba(255, 116, 137, 0.36);
    border-radius: var(--radius);
    background: rgba(255, 79, 109, 0.12);
}

@keyframes cursor-blink {
    50% {
        opacity: 0;
    }
}

@media (max-width: 760px) {
    .converter-shell {
        width: calc(100% - 20px);
    }

    .category-tabs {
        grid-template-columns: repeat(2, 1fr);
    }

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

    .swap-button {
        justify-self: center;
    }

    body {
        padding-bottom: 0;
    }
}

.result-panel output,
.conversion-meta,
.unit-value {
    font-family: var(--font-data), "Cascadia Mono", "Segoe UI", monospace;
}
