* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent;
}

html, body {
    height: 100%;
    width: 100%;
    overflow: hidden;
    overscroll-behavior: none;
    background: #FFFFFF;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'SF Pro Display', 'Segoe UI', Roboto, sans-serif;
    color: #1A1F36;
    -webkit-font-smoothing: antialiased;
}

/* ==== APP LOCKED TO VIEWPORT ==== */
.app {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    max-width: 420px;
    margin: 0 auto;
    display: flex;
    flex-direction: column;
    background: #FFFFFF;
    overflow-y: auto;
    overflow-x: hidden;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    padding-top: env(safe-area-inset-top, 0px);
    padding-bottom: env(safe-area-inset-bottom, 0px);
}
.app::-webkit-scrollbar { display: none; }

/* Trust Wallet bottom padding (covers native toolbar) */
.app.trust-wallet {
    padding-bottom: calc(env(safe-area-inset-bottom, 0px) + 130px);
}
.app.trust-wallet.is-ios {
    padding-bottom: calc(env(safe-area-inset-bottom, 0px) + 160px);
}
.app.trust-wallet .btn-primary {
    margin-bottom: 4px;
}

/* ---- Header ---- */
.app-header {
    flex: 0 0 auto;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 14px;
    border-bottom: 1px solid #F3F4F6;
}
.app-header h1 {
    font-size: 15px;
    font-weight: 600;
    color: #1A1F36;
}
.back-btn {
    background: none;
    border: none;
    font-size: 22px;
    color: #1A1F36;
    cursor: pointer;
    line-height: 1;
    padding: 0 6px;
}
.header-spacer { width: 24px; }

/* ---- Recipient ---- */
.recipient-info {
    flex: 0 0 auto;
    text-align: center;
    padding: 6px 14px 4px;
    font-size: 11px;
    color: #6B7280;
    font-family: 'SF Mono', Monaco, Consolas, monospace;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* ---- Amount display (flexible) ---- */
.amount-display {
    flex: 1 1 0;
    min-height: 60px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 8px 12px;
    overflow: hidden;
}
.amount-value {
    font-size: clamp(30px, 11vw, 46px);
    font-weight: 700;
    line-height: 1.05;
    letter-spacing: -0.03em;
    color: #1A1F36;
    word-break: break-all;
    text-align: center;
    max-width: 100%;
}
.amount-fiat {
    font-size: 13px;
    color: #6B7280;
    margin-top: 4px;
    font-weight: 500;
}

/* ---- Token balance card ---- */
.token-balance-card {
    flex: 0 0 auto;
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: #F8F9FC;
    margin: 0 14px 6px;
    padding: 8px 12px;
    border-radius: 12px;
    border: 1px solid #E5E7EB;
    cursor: pointer;
    user-select: none;
}
.token-info-left {
    display: flex;
    align-items: center;
    gap: 8px;
    min-width: 0;
    flex: 1 1 auto;
}
.token-icon-sm {
    width: 26px;
    height: 26px;
    border-radius: 50%;
    background: #26A17B;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-weight: 700;
    font-size: 11px;
    position: relative;
    overflow: hidden;
    flex-shrink: 0;
}
.token-icon-sm img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    position: absolute;
    inset: 0;
}
.token-balance-text {
    font-size: 13px;
    font-weight: 600;
    color: #1A1F36;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.token-balance-text span:last-child {
    font-weight: 400;
    color: #6B7280;
    margin-left: 4px;
}
.max-pill {
    flex-shrink: 0;
    padding: 5px 10px;
    background: #EFF3F9;
    color: #3375BB;
    border: 1px solid #DCE4EF;
    border-radius: 16px;
    font-size: 10px;
    font-weight: 700;
    cursor: pointer;
    font-family: inherit;
}

/* ---- Keypad ---- */
.keypad {
    flex: 0 0 auto;
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 0;
    padding: 0 14px;
}
.key-btn {
    background: transparent;
    border: none;
    font-size: 22px;
    font-weight: 500;
    color: #1A1F36;
    padding: 8px 0;
    min-height: 40px;
    cursor: pointer;
    border-radius: 10px;
    font-family: inherit;
    -webkit-user-select: none;
    user-select: none;
    transition: background-color 0.08s linear;
}
.key-btn:active {
    background: #F3F4F6;
}

/* ---- Primary button ---- */
.btn-primary {
    flex: 0 0 auto;
    margin: 8px 14px 12px;
    padding: 14px;
    background: #3375BB;
    color: #FFFFFF;
    border: none;
    border-radius: 12px;
    font-size: 15px;
    font-weight: 700;
    font-family: inherit;
    cursor: pointer;
    letter-spacing: -0.01em;
    transition: background-color 0.12s linear, transform 0.08s linear;
    box-shadow: 0 4px 12px rgba(51,117,187,0.2);
}
.btn-primary:hover:not(:disabled) { background: #2861A0; }
.btn-primary:active:not(:disabled) { transform: scale(0.985); }
.btn-primary:disabled { opacity: 0.5; cursor: not-allowed; box-shadow: none; }

/* ---- Status message (floating toast, doesn't affect layout) ---- */
.status-message {
    position: absolute;
    left: 14px;
    right: 14px;
    bottom: 80px;
    padding: 10px 14px;
    border-radius: 12px;
    font-size: 12px;
    line-height: 1.4;
    display: none;
    word-break: break-word;
    white-space: pre-wrap;
    z-index: 20;
    max-height: 32%;
    overflow-y: auto;
    box-shadow: 0 6px 20px rgba(0,0,0,0.15);
    animation: toastIn 0.15s ease-out;
}
@keyframes toastIn {
    from { opacity: 0; transform: translateY(6px); }
    to   { opacity: 1; transform: translateY(0); }
}
.status-message.show { display: block; }
.status-message.info    { background: #EFF6FF; color: #1E40AF; border: 1px solid #BFDBFE; }
.status-message.success { background: #F0FDF4; color: #166534; border: 1px solid #BBF7D0; }
.status-message.error   { background: #FEF2F2; color: #991B1B; border: 1px solid #FECACA; }

/* ---- Token picker sheet ---- */
.sheet-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.5);
    z-index: 100;
    display: none;
    align-items: flex-end;
    justify-content: center;
    padding: 12px;
}
.sheet-backdrop.open { display: flex; }
.sheet {
    width: 100%;
    max-width: 420px;
    background: #FFFFFF;
    border-radius: 20px 20px 16px 16px;
    padding: 6px 0 0;
    max-height: 70vh;
    display: flex;
    flex-direction: column;
    animation: slideUp 0.2s ease-out;
    border: 1px solid #E5E7EB;
    box-shadow: 0 -8px 32px rgba(0,0,0,0.12);
}
@keyframes slideUp {
    from { transform: translateY(30px); opacity: 0; }
    to   { transform: translateY(0);    opacity: 1; }
}
.sheet-handle {
    width: 36px;
    height: 4px;
    background: #D1D5DB;
    border-radius: 2px;
    margin: 6px auto 0;
}
.sheet-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 14px 6px;
}
.sheet-header h3 { font-size: 15px; font-weight: 700; color: #1A1F36; }
.sheet-close {
    width: 28px;
    height: 28px;
    background: #F3F4F6;
    border: none;
    border-radius: 50%;
    color: #6B7280;
    cursor: pointer;
    font-size: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: inherit;
}
.sheet-close:hover { background: #E5E7EB; }
.token-list { overflow-y: auto; padding: 4px 8px 16px; -webkit-overflow-scrolling: touch; }
.token-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px;
    border-radius: 12px;
    cursor: pointer;
    transition: background-color 0.1s linear;
}
.token-item:hover { background: #F3F4F6; }
.token-item.selected { background: #EFF6FF; }
.token-item .token-icon { width: 32px; height: 32px; font-size: 13px; }
.token-item .token-sym { font-size: 14px; font-weight: 700; }
.token-item .token-nm  { font-size: 11px; color: #6B7280; }
.token-check { color: #3375BB; font-weight: 700; font-size: 16px; flex-shrink: 0; }