button:focus,
button:active,
input:focus,
input:active,
.tab-item:focus,
.tab-item:active {
    outline: none;
    -webkit-tap-highlight-color: transparent;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent;
    -webkit-touch-callout: none;
    -webkit-user-select: none;
    user-select: none;
}

input,
textarea {
    -webkit-user-select: text;
    user-select: text;
}

.order-hash,
.transaction-details,
.recipient-username,
.recipient-name,
.order-info-row span:last-child,
.price-row span:last-child {
    -webkit-user-select: text;
    user-select: text;
}

:root {
    --tg-bg-color: #0a0e14;
    --tg-text-color: #f0f2f5;
    --tg-hint-color: #7a8599;
    --tg-link-color: #6c9eff;
    --tg-button-color: #6c9eff;
    --tg-button-text-color: #ffffff;
    --tg-secondary-bg-color: rgba(255, 255, 255, 0.06);
    --glass-bg: rgba(255, 255, 255, 0.05);
    --glass-border: rgba(255, 255, 255, 0.08);
    --glass-highlight: rgba(255, 255, 255, 0.12);
    --accent-gradient: linear-gradient(135deg, #6c9eff 0%, #a855f7 50%, #f472b6 100%);
    --accent-glow: rgba(108, 158, 255, 0.25);
    --surface-blur: 20px;
}

body {
    background: var(--tg-bg-color);
    min-height: 100vh;
    font-family: -apple-system, BlinkMacSystemFont, 'SF Pro Display', 'Segoe UI', Roboto, sans-serif;
    color: var(--tg-text-color);
    padding-bottom: 90px;
    overflow-x: hidden;
}

/* ─── Animated Background ─── */
body::before {
    content: '';
    position: fixed;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background:
        radial-gradient(ellipse at 20% 50%, rgba(108, 158, 255, 0.08) 0%, transparent 50%),
        radial-gradient(ellipse at 80% 20%, rgba(168, 85, 247, 0.06) 0%, transparent 50%),
        radial-gradient(ellipse at 50% 80%, rgba(244, 114, 182, 0.05) 0%, transparent 50%);
    animation: bgShift 20s ease-in-out infinite alternate;
    z-index: -1;
    pointer-events: none;
}

@keyframes bgShift {
    0%   { transform: translate(0, 0) rotate(0deg); }
    33%  { transform: translate(-2%, 1%) rotate(1deg); }
    66%  { transform: translate(1%, -2%) rotate(-1deg); }
    100% { transform: translate(-1%, 2%) rotate(0.5deg); }
}

/* ─── Glass Mixin ─── */
.glass {
    background: var(--glass-bg);
    backdrop-filter: blur(var(--surface-blur));
    -webkit-backdrop-filter: blur(var(--surface-blur));
    border: 1px solid var(--glass-border);
    border-radius: 16px;
    position: relative;
    overflow: hidden;
}

.glass::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 1px;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.15), transparent);
    pointer-events: none;
}

/* ─── Container ─── */
.container {
    max-width: 480px;
    margin: 0 auto;
    padding: 16px;
    animation: pageIn 0.5s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes pageIn {
    from { opacity: 0; transform: translateY(12px); }
    to   { opacity: 1; transform: translateY(0); }
}

h1 {
    text-align: center;
    color: var(--tg-text-color);
    margin-bottom: 20px;
    font-size: 22px;
    font-weight: 600;
    letter-spacing: -0.3px;
}

button {
    -webkit-user-select: none;
    user-select: none;
}

/* ─── Input Group ─── */
.input-group {
    margin-bottom: 14px;
}

label {
    display: block;
    margin-bottom: 8px;
    color: var(--tg-hint-color);
    font-weight: 500;
    font-size: 13px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

input {
    width: 100%;
    padding: 14px 42px 14px 16px;
    border: 1px solid var(--glass-border);
    border-radius: 14px;
    font-size: 15px;
    outline: none;
    background: var(--glass-bg);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    color: var(--tg-text-color);
    transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
}

input:focus {
    background: rgba(255, 255, 255, 0.08);
    border-color: var(--tg-button-color);
    box-shadow: 0 0 0 3px var(--accent-glow), 0 4px 20px rgba(108, 158, 255, 0.1);
}

input::placeholder {
    color: rgba(122, 133, 153, 0.6);
}

.input-wrapper {
    position: relative;
    width: 100%;
}

/* ─── Clear Button ─── */
.clear-btn {
    position: absolute;
    right: 8px;
    top: 50%;
    transform: translateY(-50%);
    background: rgba(255, 255, 255, 0.06);
    border: none;
    color: var(--tg-hint-color);
    cursor: pointer;
    padding: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: all 0.2s;
    opacity: 0;
    pointer-events: none;
}

.clear-btn:hover {
    background: rgba(255, 255, 255, 0.12);
    color: var(--tg-text-color);
}

.clear-btn:active {
    transform: translateY(-50%) scale(0.85);
}

.clear-btn.visible {
    opacity: 1;
    pointer-events: auto;
}

input[type="number"]::-webkit-inner-spin-button,
input[type="number"]::-webkit-outer-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

input[type="number"] {
    -moz-appearance: textfield;
}

/* ─── Recipient Preview ─── */
.recipient-preview {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 14px;
    background: var(--glass-bg);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid var(--glass-border);
    border-radius: 14px;
    margin-top: 10px;
    animation: slideUp 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes slideUp {
    from { opacity: 0; transform: translateY(8px); }
    to   { opacity: 1; transform: translateY(0); }
}

.recipient-avatar {
    width: 42px;
    height: 42px;
    border-radius: 50%;
    background: linear-gradient(135deg, rgba(108, 158, 255, 0.2), rgba(168, 85, 247, 0.2));
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--tg-hint-color);
    overflow: hidden;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.recipient-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.recipient-info {
    flex: 1;
}

.recipient-name {
    color: var(--tg-text-color);
    font-weight: 600;
    font-size: 15px;
}

.recipient-username {
    color: var(--tg-hint-color);
    font-size: 13px;
    margin-top: 2px;
}

/* ─── Myself Button ─── */
.myself-btn {
    width: 100%;
    padding: 11px;
    margin-top: 8px;
    background: var(--glass-bg);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid var(--glass-border);
    border-radius: 12px;
    color: var(--tg-button-color);
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

.myself-btn:hover {
    background: rgba(108, 158, 255, 0.1);
    border-color: rgba(108, 158, 255, 0.3);
    transform: translateY(-1px);
    box-shadow: 0 4px 16px rgba(108, 158, 255, 0.1);
}

.myself-btn:active {
    transform: scale(0.97);
}

/* ─── Promo Section ─── */
.promo-toggle {
    width: 100%;
    padding: 12px;
    background: transparent;
    border: 1px dashed rgba(255, 255, 255, 0.1);
    border-radius: 12px;
    color: var(--tg-hint-color);
    font-size: 14px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 8px;
    justify-content: center;
    transition: all 0.3s;
}

.promo-toggle:hover {
    border-color: rgba(108, 158, 255, 0.3);
    color: var(--tg-button-color);
    background: rgba(108, 158, 255, 0.04);
}

.promo-row {
    display: flex;
    gap: 8px;
    align-items: center;
}

.promo-row .input-wrapper {
    flex: 1;
}

.promo-btn, .check-btn {
    padding: 14px 18px;
    background: var(--glass-bg);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid var(--glass-border);
    color: var(--tg-button-color);
    border-radius: 14px;
    cursor: pointer;
    font-weight: 600;
    font-size: 14px;
    transition: all 0.3s;
    white-space: nowrap;
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 100px;
}

.promo-btn:hover, .check-btn:hover {
    background: rgba(108, 158, 255, 0.12);
    border-color: rgba(108, 158, 255, 0.3);
}

.promo-btn:active, .check-btn:active {
    transform: scale(0.95);
}

.promo-btn:disabled, .check-btn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

/* ─── Payment Button ─── */
.payment-btn {
    width: 100%;
    padding: 14px;
    margin-bottom: 10px;
    border: 1px solid var(--glass-border);
    background: var(--glass-bg);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    color: var(--tg-hint-color);
    border-radius: 14px;
    font-size: 15px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    flex: 1;
}

.payment-btn:hover {
    border-color: rgba(108, 158, 255, 0.3);
    background: rgba(108, 158, 255, 0.08);
    color: var(--tg-text-color);
}

.payment-btn.active {
    border-color: rgba(108, 158, 255, 0.4);
    background: linear-gradient(135deg, rgba(108, 158, 255, 0.15), rgba(168, 85, 247, 0.1));
    color: var(--tg-text-color);
    box-shadow: 0 0 24px rgba(108, 158, 255, 0.08), inset 0 1px 0 rgba(255, 255, 255, 0.08);
}

/* ─── Price Info (Glass Card) ─── */
.price-info {
    background: var(--glass-bg);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid var(--glass-border);
    padding: 18px;
    border-radius: 16px;
    margin-bottom: 16px;
    position: relative;
    overflow: hidden;
}

.price-info::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 1px;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.12), transparent);
}

.price-row {
    display: flex;
    justify-content: space-between;
    margin-bottom: 8px;
    font-size: 15px;
    color: var(--tg-hint-color);
}

.price-row.total {
    font-size: 20px;
    font-weight: 700;
    color: var(--tg-text-color);
    padding-top: 12px;
    border-top: 1px solid rgba(255, 255, 255, 0.06);
    margin-top: 10px;
    margin-bottom: 0;
    background: var(--accent-gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.price-row.total span:first-child {
    background: none;
    -webkit-text-fill-color: var(--tg-text-color);
    color: var(--tg-text-color);
}

/* ─── Buy Button (Hero CTA) ─── */
.buy-btn {
    width: 100%;
    padding: 16px;
    background: var(--accent-gradient);
    color: white;
    border: none;
    border-radius: 16px;
    font-size: 16px;
    font-weight: 700;
    cursor: pointer;
    margin-bottom: 10px;
    transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    position: relative;
    overflow: hidden;
    letter-spacing: 0.3px;
    box-shadow: 0 4px 24px rgba(108, 158, 255, 0.2), 0 1px 3px rgba(0, 0, 0, 0.3);
}

.buy-btn::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.15), transparent);
    transition: left 0.5s;
}

.buy-btn:hover::before {
    left: 100%;
}

.buy-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 32px rgba(108, 158, 255, 0.3), 0 2px 8px rgba(0, 0, 0, 0.3);
}

.buy-btn:active {
    transform: translateY(0) scale(0.98);
    box-shadow: 0 2px 12px rgba(108, 158, 255, 0.2);
}

.buy-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

/* ─── Tab Bar (Glass) ─── */
.tab-bar {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: rgba(10, 14, 20, 0.75);
    backdrop-filter: blur(24px) saturate(180%);
    -webkit-backdrop-filter: blur(24px) saturate(180%);
    border-top: 1px solid rgba(255, 255, 255, 0.06);
    display: flex;
    justify-content: space-around;
    padding: 6px 0 env(safe-area-inset-bottom, 8px);
    z-index: 1000;
}

.tab-item {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 8px 6px 4px;
    cursor: pointer;
    color: var(--tg-hint-color);
    transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
    border: none;
    background: transparent;
    font-size: 11px;
    font-weight: 500;
    letter-spacing: 0.2px;
    position: relative;
}

.tab-item.active {
    color: var(--tg-button-color);
}

.tab-item.active .tab-icon {
    transform: scale(1.05);
    filter: drop-shadow(0 0 8px var(--accent-glow));
}

.tab-icon {
    font-size: 24px;
    margin-bottom: 3px;
    transition: all 0.3s;
}

/* ─── Transactions ─── */
.transactions-list {
    margin-top: 16px;
}

.transaction-item {
    background: var(--glass-bg);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid var(--glass-border);
    padding: 16px;
    border-radius: 16px;
    margin-bottom: 10px;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
    animation: fadeIn 0.4s cubic-bezier(0.16, 1, 0.3, 1) backwards;
    position: relative;
    overflow: hidden;
}

.transaction-item::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 1px;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.08), transparent);
}

.transaction-item:hover {
    transform: translateY(-2px);
    border-color: rgba(108, 158, 255, 0.2);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.2);
}

.transaction-item:active {
    transform: scale(0.98);
}

.transaction-item:nth-child(1) { animation-delay: 0.05s; }
.transaction-item:nth-child(2) { animation-delay: 0.1s; }
.transaction-item:nth-child(3) { animation-delay: 0.15s; }
.transaction-item:nth-child(4) { animation-delay: 0.2s; }
.transaction-item:nth-child(5) { animation-delay: 0.25s; }

.transaction-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
}

.transaction-status {
    font-size: 12px;
    padding: 4px 10px;
    border-radius: 20px;
    font-weight: 600;
    letter-spacing: 0.3px;
}

.transaction-status.pending {
    background: rgba(255, 165, 0, 0.12);
    color: #ffb347;
}

.transaction-status.completed {
    background: rgba(76, 175, 80, 0.12);
    color: #69f0ae;
}

.transaction-status.failed {
    background: rgba(244, 67, 54, 0.12);
    color: #ff7961;
}

.transaction-details {
    color: var(--tg-hint-color);
    font-size: 13px;
    line-height: 1.6;
}

.transaction-details div {
    padding: 1px 0;
    cursor: text;
}

/* ─── Empty State ─── */
.empty-state {
    text-align: center;
    padding: 60px 20px;
    color: var(--tg-hint-color);
}

.empty-state-icon {
    margin-bottom: 16px;
    opacity: 0.3;
    display: flex;
    align-items: center;
    justify-content: center;
}

.empty-state-icon svg {
    opacity: 0.5;
}

/* ─── Order Card ─── */
.order-card {
    background: var(--glass-bg);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid var(--glass-border);
    border-radius: 20px;
    padding: 24px;
    margin-bottom: 20px;
    position: relative;
    overflow: hidden;
}

.order-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 1px;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.1), transparent);
}

.order-status {
    padding: 8px 16px;
    border-radius: 24px;
    text-align: center;
    font-weight: 600;
    font-size: 14px;
    margin-bottom: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.order-status.pending {
    background: rgba(255, 165, 0, 0.1);
    color: #ffb347;
    border: 1px solid rgba(255, 165, 0, 0.15);
}

.order-status.completed {
    background: rgba(76, 175, 80, 0.1);
    color: #69f0ae;
    border: 1px solid rgba(76, 175, 80, 0.15);
}

.order-info-row {
    display: flex;
    justify-content: space-between;
    padding: 14px 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.04);
    font-size: 14px;
}

.order-info-row:last-child {
    border-bottom: none;
}

.order-info-row span:first-child {
    color: var(--tg-hint-color);
}

.order-hash {
    font-family: 'SF Mono', 'Fira Code', monospace;
    font-size: 11px;
    color: var(--tg-button-color);
    user-select: all;
    cursor: text;
    padding: 4px 10px;
    background: rgba(108, 158, 255, 0.08);
    border-radius: 8px;
    border: 1px solid rgba(108, 158, 255, 0.1);
    transition: all 0.2s;
}

.order-hash:hover {
    background: rgba(108, 158, 255, 0.15);
}

/* ─── Icon Button ─── */
.icon-btn {
    padding: 10px;
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    border-radius: 12px;
    color: var(--tg-text-color);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}

.icon-btn:hover {
    background: rgba(255, 255, 255, 0.1);
    border-color: rgba(108, 158, 255, 0.3);
}

/* ─── Wallet ─── */
.wallet-btn {
    width: 100%;
    padding: 14px;
    background: transparent;
    color: var(--tg-button-color);
    border: 1px solid rgba(108, 158, 255, 0.2);
    border-radius: 14px;
    font-size: 15px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s;
}

.wallet-btn:hover {
    background: rgba(108, 158, 255, 0.08);
}

.wallet-check {
    margin-top: 12px;
    padding: 14px;
    background: var(--glass-bg);
    border-radius: 14px;
}

.wallet-info {
    margin-top: 12px;
    padding: 14px;
    background: var(--glass-bg);
    border-radius: 14px;
}

/* ─── Order Info ─── */
.order-info {
    text-align: center;
    padding: 20px;
}

.order-info h2 {
    color: var(--tg-text-color);
    margin-bottom: 15px;
}

.hash {
    background: var(--glass-bg);
    padding: 12px;
    border-radius: 10px;
    word-break: break-all;
    font-family: 'SF Mono', 'Fira Code', monospace;
    font-size: 12px;
    margin: 15px 0;
    color: var(--tg-hint-color);
}

.subtitle {
    text-align: center;
    margin-bottom: 20px;
    color: var(--tg-text-color);
    font-size: 20px;
    font-weight: 600;
}

/* ─── Animations ─── */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* ─── Loading Spinner ─── */
.loading {
    display: inline-block;
    width: 16px;
    height: 16px;
    border: 2px solid rgba(255, 255, 255, 0.08);
    border-top-color: var(--tg-button-color);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

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

/* ─── Scrollbar ─── */
::-webkit-scrollbar {
    width: 4px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.2);
}