.safe-bottom {
    padding-bottom: env(safe-area-inset-bottom, 0px);
}

.btn-primary {
    display: block;
    width: 100%;
    border-radius: 0.75rem;
    background-color: #f7a600;
    padding: 0.875rem;
    text-align: center;
    font-weight: 600;
    color: #000;
    transition: background-color 0.2s;
}

.btn-primary:hover {
    background-color: #ffb820;
}

.register-page {
    --register-field-height: 2.75rem;
}

.register-form > div > label,
.register-form label {
    margin-bottom: 0.375rem;
    font-size: 0.8125rem;
    line-height: 1.125rem;
}

.register-form input:not([type="checkbox"]),
.register-form .password-field input {
    height: var(--register-field-height);
    min-height: var(--register-field-height);
    padding-top: 0;
    padding-bottom: 0;
    padding-left: 0.875rem;
    padding-right: 0.875rem;
    font-size: 0.875rem;
    line-height: 1.25rem;
}

.register-form .password-field input {
    padding-right: 2.75rem;
}

.register-form #send-code-btn {
    height: var(--register-field-height);
    min-height: var(--register-field-height);
    padding: 0 0.875rem;
    font-size: 0.8125rem;
    line-height: 1;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    white-space: nowrap;
}

.register-form .btn-primary {
    min-height: var(--register-field-height);
    padding: 0.625rem 0.875rem;
    font-size: 0.9375rem;
}

.register-form #password-fields > div + div {
    margin-top: 0.75rem;
}

.btn-outline {
    display: block;
    width: 100%;
    border-radius: 0.75rem;
    border: 1px solid #2e3648;
    background-color: transparent;
    padding: 0.875rem;
    text-align: center;
    font-weight: 600;
    color: #fff;
    transition: background-color 0.2s;
}

.btn-outline:hover {
    background-color: #242b36;
}

.card {
    border-radius: 1rem;
    background-color: #242b36;
    border: 1px solid #2e3648;
}

.text-up {
    color: #16c784;
}

.text-down {
    color: #ea3943;
}

.pill-up {
    border-radius: 0.375rem;
    background-color: rgba(22, 199, 132, 0.15);
    padding: 0.125rem 0.5rem;
    font-size: 0.75rem;
    font-weight: 500;
    color: #16c784;
}

.pill-down {
    border-radius: 0.375rem;
    background-color: rgba(234, 57, 67, 0.15);
    padding: 0.125rem 0.5rem;
    font-size: 0.75rem;
    font-weight: 500;
    color: #ea3943;
}

input, select, textarea {
    outline: none;
}

.password-field {
    position: relative;
}

.password-toggle {
    position: absolute;
    top: 50%;
    right: 0.75rem;
    display: flex;
    align-items: center;
    justify-content: center;
    transform: translateY(-50%);
    padding: 0.25rem;
    color: #808bc5;
    background: transparent;
    border: 0;
    cursor: pointer;
    transition: color 0.15s ease;
}

.password-toggle:hover {
    color: #ffffff;
}

.password-toggle:focus-visible {
    outline: 2px solid #f7a600;
    outline-offset: 2px;
    border-radius: 0.375rem;
}

.app-toast {
    position: fixed;
    top: calc(1rem + env(safe-area-inset-top, 0));
    left: 50%;
    z-index: 200;
    width: calc(100% - 2rem);
    max-width: 22rem;
    transform: translateX(-50%) translateY(0);
    border-radius: 0.875rem;
    background: rgba(36, 43, 54, 0.98);
    border: 1px solid #2e3648;
    padding: 0.875rem 1rem;
    font-size: 0.875rem;
    line-height: 1.5;
    color: #ffffff;
    text-align: center;
    box-shadow: 0 12px 32px rgba(0, 0, 0, 0.35);
    transition: opacity 0.25s ease, transform 0.25s ease;
}

.app-toast.hidden {
    opacity: 0;
    pointer-events: none;
    transform: translateX(-50%) translateY(-0.75rem);
}

.app-toast--success {
    border-color: rgba(22, 199, 132, 0.45);
    box-shadow: 0 12px 32px rgba(0, 0, 0, 0.35), inset 0 1px 0 rgba(22, 199, 132, 0.15);
}

.app-toast--error {
    border-color: rgba(234, 57, 67, 0.45);
    box-shadow: 0 12px 32px rgba(0, 0, 0, 0.35), inset 0 1px 0 rgba(234, 57, 67, 0.15);
}

/* Mobile-safe custom select (replaces native dropdown overflow) */
.form-select-wrap {
    position: relative;
    width: 100%;
    min-width: 0;
}

.form-select-native {
    position: absolute;
    width: 1px;
    height: 1px;
    opacity: 0;
    pointer-events: none;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

.form-select-trigger {
    display: flex;
    width: 100%;
    min-width: 0;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
    border-radius: 0.75rem;
    border: 1px solid #2e3648;
    background-color: #15191f;
    padding: 0.75rem 1rem;
    font-size: 0.875rem;
    line-height: 1.25rem;
    color: #fff;
    text-align: left;
    transition: border-color 0.2s;
}

.form-select-trigger span {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.form-select-trigger svg {
    flex-shrink: 0;
    width: 1rem;
    height: 1rem;
    color: #808bc5;
    transition: transform 0.2s;
}

.form-select-wrap.is-open .form-select-trigger {
    border-color: #f7a600;
}

.form-select-wrap.is-open .form-select-trigger svg {
    transform: rotate(180deg);
    color: #f7a600;
}

.form-select-list {
    position: absolute;
    top: calc(100% + 0.25rem);
    left: 0;
    right: 0;
    z-index: 60;
    max-height: min(16rem, 50vh);
    overflow-x: hidden;
    overflow-y: auto;
    overscroll-behavior: contain;
    border-radius: 0.75rem;
    border: 1px solid #2e3648;
    background-color: #15191f;
    box-shadow: 0 12px 32px rgba(0, 0, 0, 0.45);
}

.form-select-list.hidden {
    display: none;
}

.form-select-option {
    display: block;
    width: 100%;
    min-width: 0;
    border: 0;
    background: transparent;
    padding: 0.75rem 1rem;
    font-size: 0.875rem;
    line-height: 1.25rem;
    color: #fff;
    text-align: left;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    cursor: pointer;
}

.form-select-option:hover:not(:disabled) {
    background-color: #242b36;
}

.form-select-option.is-selected {
    background-color: rgba(247, 166, 0, 0.12);
    color: #f7a600;
}

.form-select-option:disabled {
    opacity: 0.35;
    cursor: not-allowed;
}

@media (max-width: 480px) {
    .form-select-option {
        padding: 0.875rem 1rem;
    }
}

input[type="range"] {
    accent-color: #f7a600;
}

/* Splash — blend image bg with page + primary glow */
.splash-page {
    position: relative;
    background-color: #0a0a0a;
    overflow: hidden;
}

.splash-page::before {
    content: '';
    position: absolute;
    inset: 0;
    background:
        radial-gradient(ellipse 90% 60% at 50% 38%, rgba(245, 166, 35, 0.12) 0%, transparent 55%),
        radial-gradient(ellipse 70% 45% at 50% 42%, rgba(255, 140, 0, 0.06) 0%, transparent 50%);
    pointer-events: none;
}

.splash-logo {
    display: block;
    width: min(112px, 30vw);
    max-height: 115px;
    height: auto;
    aspect-ratio: 1090 / 1119;
    object-fit: contain;
    border-radius: 1rem;
    filter: drop-shadow(0 8px 24px rgba(247, 166, 0, 0.22));
}

.splash-hero {
    min-height: 280px;
}

.splash-glow {
    position: absolute;
    inset: -10% 0;
    background: radial-gradient(
        ellipse 75% 55% at 50% 50%,
        rgba(247, 166, 0, 0.18) 0%,
        rgba(255, 140, 0, 0.08) 35%,
        transparent 70%
    );
    pointer-events: none;
}

.splash-image {
    -webkit-mask-image: radial-gradient(ellipse 88% 82% at 50% 48%, #000 52%, transparent 100%);
    mask-image: radial-gradient(ellipse 88% 82% at 50% 48%, #000 52%, transparent 100%);
    filter: drop-shadow(0 0 40px rgba(247, 166, 0, 0.15));
}

.splash-btn-outline {
    border-color: rgba(247, 166, 0, 0.35);
    color: rgba(255, 255, 255, 0.9);
}

.splash-btn-outline:hover {
    background-color: rgba(247, 166, 0, 0.08);
    border-color: rgba(247, 166, 0, 0.5);
}

/* Live quote flash */
.live-price {
    transition: color 0.3s ease, background-color 0.3s ease;
    border-radius: 0.375rem;
    padding: 0 0.125rem;
}

.live-price.flash-up {
    color: #16c784;
    background-color: rgba(22, 199, 132, 0.12);
}

.live-price.flash-down {
    color: #ea3943;
    background-color: rgba(234, 57, 67, 0.12);
}

.quote-closed .live-price {
    color: #808bc5;
}

.quote-closed .live-change {
    opacity: 0.6;
}

/* Home hero — balance over live sparkline */
.home-hero {
    min-height: 132px;
}

.home-hero-chart {
    bottom: -4px;
    top: 28%;
    pointer-events: none;
}

.home-hero-fade {
    pointer-events: none;
}

#home-balance {
    transition: color 0.25s ease;
}

#home-sparkline path {
    transition: d 0.4s ease;
}

.profile-avatar-overlay {
    pointer-events: none;
}

#avatar-spinner.flex {
    display: flex;
}

/* Account & Security */
.security-progress {
    height: 6px;
    border-radius: 999px;
    background: #2e3648;
    overflow: hidden;
}

.security-progress-bar {
    height: 100%;
    border-radius: 999px;
    transition: width 0.4s ease;
}

.security-progress-low { background: #ea3943; }
.security-progress-medium { background: #f7a600; }
.security-progress-high { background: #16c784; }

.security-level-low { color: #ea3943; }
.security-level-medium { color: #f7a600; }
.security-level-high { color: #16c784; }

details > summary::-webkit-details-marker {
    display: none;
}

.kyc-upload-box:has(img:not(.hidden)) svg,
.kyc-upload-box:has(img:not(.hidden)) span {
    display: none;
}
