:root {
    --bg: #060512;
    --surface: #151820;
    --surface-hover: #1c2030;
    --border: rgba(255, 255, 255, 0.1);
    --border-focus: rgba(94, 234, 212, 0.55);
    --text: #e8eaed;
    --text-muted: #8b929e;
    --accent: #5eead4;
    --accent-dim: rgba(94, 234, 212, 0.12);
    --highlight: #2dd4bf;
    --radius: 12px;
    --input-h: 44px;
}

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

html {
    min-height: 100%;
    min-height: -webkit-fill-available;
    background-color: var(--bg);
}

html,
body {
    margin: 0;
    padding: 0;
    min-height: 100%;
    min-height: -webkit-fill-available;
}

body {
    min-height: 100vh;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, sans-serif;
    font-size: 15px;
    color: var(--text);
    background-color: var(--bg);
}

.page-bg {
    position: fixed;
    top: 0;
    right: 0;
    bottom: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    z-index: 0;
    pointer-events: none;
    background-color: #060512;
    background-image:
        radial-gradient(ellipse 80% 50% at 50% 0%, rgba(94, 234, 212, 0.07), transparent 70%),
        url('../img/metaverse-04.svg');
    background-repeat: no-repeat, no-repeat;
    background-position: center top, center calc(50vh);
    background-size: auto, 4000px auto;
}

.page {
    position: relative;
    z-index: 1;
    min-height: 100vh;
    min-height: 100dvh;
}

.page-header,
.page-footer {
    position: fixed;
    left: 0;
    right: 0;
    z-index: 2;
    padding-left: 16px;
    padding-right: 16px;
    text-align: center;
    pointer-events: none;
}

.page-header {
    top: 0;
    padding-top: max(12px, env(safe-area-inset-top, 0px));
    padding-bottom: 12px;
}

.page-footer {
    bottom: 0;
    padding-top: 12px;
    padding-bottom: max(12px, env(safe-area-inset-bottom, 0px));
}

.page-header h1 {
    margin: 0;
    font-family: 'IBM Plex Sans', 'Helvetica Neue', Helvetica, Arial, sans-serif;
    font-size: 1.125rem;
    font-weight: 500;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: #8b929e;
}

.page-intro {
    margin: 0 auto;
    max-width: 480px;
    font-size: 14px;
    line-height: 1.5;
    color: var(--text-muted);
}

.page-center {
    min-height: 100vh;
    min-height: 100dvh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 16px;
}

.noscript-notice {
    width: 100%;
    max-width: 380px;
    margin: 16px 0 0;
    padding: 12px 14px;
    font-size: 14px;
    line-height: 1.5;
    color: var(--text-muted);
    text-align: center;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--surface);
    pointer-events: auto;
}

#app {
    width: 100%;
    max-width: 380px;
}

.widget {
    width: 100%;
    max-width: 380px;
    padding: 20px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: 0 16px 48px rgba(0, 0, 0, 0.45);
}

.converter-row {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1.35fr);
    gap: 10px;
    align-items: start;
}

.converter-row + .converter-row {
    margin-top: 10px;
}

.field-input {
    width: 100%;
    height: var(--input-h);
    padding: 0 12px;
    font: inherit;
    font-variant-numeric: tabular-nums;
    color: var(--text);
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: 8px;
    outline: none;
    appearance: none;
    -webkit-appearance: none;
    overflow: hidden;
    resize: none;
    box-shadow: none;
}

.field-input:hover {
    border-color: rgba(255, 255, 255, 0.16);
}

.field-input:focus {
    border-color: var(--border-focus);
    box-shadow: 0 0 0 3px var(--accent-dim);
}

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

.field-input::-webkit-scrollbar {
    display: none;
}

.loading-spinner {
    display: flex;
    justify-content: center;
    align-items: center;
    height: 108px;
}

.loading-spinner::after {
    content: '';
    width: 28px;
    height: 28px;
    border-radius: 50%;
    border: 2px solid rgba(255, 255, 255, 0.08);
    border-top-color: var(--accent);
    animation: spin 0.7s linear infinite;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

/* Coin select */

.coin-select {
    position: relative;
    width: 100%;
    min-width: 0;
}

.coin-select-trigger {
    box-sizing: border-box;
    position: relative;
    width: 100%;
    height: var(--input-h);
    margin: 0;
    padding: 0 36px 0 12px;
    overflow: hidden;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: var(--bg);
    color: var(--text);
    cursor: pointer;
    font: inherit;
    line-height: var(--input-h);
    text-align: left;
    outline: none;
}

.coin-select-trigger:hover,
.coin-select-trigger:focus,
.coin-select-open {
    border-color: var(--border-focus);
    box-shadow: 0 0 0 3px var(--accent-dim);
}

.coin-select-label {
    display: block;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.coin-select-arrow {
    position: absolute;
    top: 50%;
    right: 14px;
    width: 0;
    height: 0;
    transform: translateY(-30%);
    border-color: var(--text-muted) transparent transparent transparent;
    border-style: solid;
    border-width: 5px 4px 0 4px;
    pointer-events: none;
}

.coin-select-open .coin-select-arrow {
    transform: translateY(-70%);
    border-color: transparent transparent var(--text-muted) transparent;
    border-width: 0 4px 5px 4px;
}

.coin-select-dropdown {
    position: absolute;
    top: calc(var(--input-h) + 4px);
    left: 0;
    z-index: 100;
    width: 100%;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: var(--surface);
    box-shadow: 0 12px 32px rgba(0, 0, 0, 0.5);
    overflow: hidden;
}

.coin-select-search {
    box-sizing: border-box;
    display: block;
    width: calc(100% - 16px);
    height: 40px;
    margin: 8px;
    padding: 0 10px;
    border: 1px solid var(--border);
    border-radius: 6px;
    background: var(--bg);
    color: var(--text);
    font: inherit;
    outline: none;
}

.coin-select-search:focus {
    border-color: var(--border-focus);
}

.coin-select-results {
    max-height: min(240px, 45vh);
    overflow-y: auto;
}

.coin-select-option {
    padding: 10px 12px;
    cursor: pointer;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    color: var(--text);
}

.coin-select-option:hover,
.coin-select-option-highlighted {
    background: var(--surface-hover);
    color: var(--accent);
}

.coin-select-option-selected:not(.coin-select-option-highlighted) {
    background: var(--accent-dim);
}

.coin-select-empty,
.coin-select-loading {
    padding: 12px;
    color: var(--text-muted);
    font-size: 14px;
    text-align: center;
}

.coin-select-loading {
    padding: 8px 12px;
    font-size: 13px;
}

.coin-select-results::-webkit-scrollbar {
    width: 6px;
}

.coin-select-results::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.15);
    border-radius: 3px;
}

@media (max-width: 768px) {
    .page-bg {
        height: 100dvh;
        background-position: center top, center 50vh;
        background-size: auto, 3200px auto;
    }
}

@media (max-width: 400px) {
    .widget {
        padding: 16px;
    }

    .converter-row {
        grid-template-columns: minmax(88px, 110px) minmax(0, 1fr);
        gap: 8px;
    }

    .field-input {
        padding: 0 8px;
    }

    .coin-select-trigger {
        padding: 0 28px 0 8px;
        font-size: 14px;
    }

    .field-input,
    .coin-select-trigger {
        height: 48px;
    }

    .field-input {
        font-size: 16px;
    }

    :root {
        --input-h: 48px;
    }
}
