:root {
    color-scheme: light;
}

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

html {
    font-size: 16px;
}

body {
    margin: 0;
    min-height: 100vh;
    background: linear-gradient(180deg, #eff4fb 0%, #e7edf6 100%);
    color: #1f2937;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

a,
button,
input,
textarea,
select {
    font: inherit;
}

a {
    color: inherit;
}

img {
    max-width: 100%;
}

.pay-topbar {
    background: rgba(255, 255, 255, 0.9);
    backdrop-filter: blur(10px);
    border-bottom: 1px solid rgba(148, 163, 184, 0.25);
}

.pay-topbar-inner {
    max-width: 960px;
    margin: 0 auto;
    padding: 14px 16px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
}

.pay-back {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 14px;
    border: 1px solid rgba(148, 163, 184, 0.3);
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.92);
    color: #0f172a;
    font-size: 0.98rem;
    font-weight: 700;
    text-decoration: none;
    white-space: nowrap;
    cursor: pointer;
    box-shadow: 0 4px 12px rgba(15, 23, 42, 0.05);
}

.pay-back:hover {
    color: #1d4ed8;
    border-color: rgba(59, 130, 246, 0.35);
}

.pay-back-icon {
    font-size: 1rem;
    line-height: 1;
}

.pay-nav {
    display: flex;
    flex-wrap: wrap;
    justify-content: flex-end;
    gap: 12px;
}

.pay-nav a {
    color: #334155;
    font-size: 0.95rem;
    font-weight: 600;
    text-decoration: none;
    white-space: nowrap;
}

.pay-nav a:hover {
    color: #2563eb;
}

.guide-trigger {
    background: none;
    border: 0;
    padding: 0;
    color: #334155;
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
    white-space: nowrap;
}

.guide-trigger:hover {
    color: #2563eb;
}

.pay-main {
    max-width: 960px;
    margin: 0 auto;
    padding: 24px 16px 40px;
}

.pay-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px 18px;
    border: 0;
    border-radius: 14px;
    cursor: pointer;
    text-decoration: none;
    font-weight: 700;
    transition: transform 0.16s ease, box-shadow 0.16s ease, background 0.16s ease;
}

.pay-btn:hover {
    transform: translateY(-1px);
}

.pay-btn-primary {
    background: linear-gradient(135deg, #2f81f7 0%, #1d68f2 100%);
    color: #fff;
    box-shadow: 0 10px 22px rgba(37, 99, 235, 0.22);
}

.pay-btn-primary:hover {
    color: #fff;
    box-shadow: 0 14px 26px rgba(37, 99, 235, 0.28);
}

.pay-btn-secondary {
    background: rgba(255, 255, 255, 0.92);
    color: #0f172a;
    border: 1px solid rgba(148, 163, 184, 0.3);
}

.pay-empty {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: calc(100vh - 180px);
    text-align: center;
}

.pay-empty h1 {
    margin: 0;
    color: #0f172a;
    font-size: clamp(1.8rem, 5vw, 2.7rem);
    font-weight: 800;
}

.pay-page {
    max-width: 800px;
    margin: 0 auto;
}

.pay-card {
    overflow: hidden;
    border-radius: 22px;
    background: rgba(255, 255, 255, 0.97);
    box-shadow: 0 20px 48px rgba(15, 23, 42, 0.12);
}

.pay-card-header {
    padding: 26px 28px 24px;
    text-align: center;
    color: #fff;
    background: linear-gradient(135deg, #2492e5 0%, #133a7d 100%);
}

.pay-brand {
    margin-bottom: 6px;
    color: #79d3ec;
    font-size: 1.2rem;
    font-weight: 700;
    letter-spacing: 1px;
}

.pay-card-title {
    margin: 0;
    font-size: 1.42rem;
    font-weight: 800;
    line-height: 1.4;
}

.pay-card-highlight {
    color: #fde68a;
    font-weight: 700;
}

.pay-countdown {
    margin-top: 10px;
    font-size: 1.25rem;
    font-weight: 700;
}

.time {
    font-family: Consolas, Menlo, Courier, monospace;
}

.pay-panel {
    padding: 28px;
    border-top: 1px solid #edf2f7;
}

.pay-panel:first-of-type {
    border-top: 0;
}

.pay-panel-center {
    text-align: center;
}

.pay-input-group {
    display: flex;
    width: min(640px, 100%);
    margin: 0 auto;
    border: 1px solid #d6deea;
    border-radius: 16px;
    overflow: hidden;
    background: #fff;
}

.pay-input {
    width: 100%;
    min-width: 0;
    padding: 0.72rem 0.9rem;
    border: 0;
    color: #0f172a;
    font-size: 1.05rem;
    background: transparent;
}

.pay-input:focus {
    outline: none;
}

.pay-copy-btn {
    padding: 0 1rem;
    border-radius: 0;
    box-shadow: none;
    flex: 0 0 auto;
    min-width: 84px;
    white-space: nowrap;
}

.payment-notice {
    margin: 14px 0 10px;
    color: #2563eb;
    font-size: 1rem;
    font-weight: 700;
    text-align: center;
}

.qr-section {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
}

.pay-network-row {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-wrap: wrap;
    gap: 10px 16px;
    font-weight: 700;
    text-align: center;
}

.pay-network-item {
    display: inline-flex;
    align-items: center;
    gap: 2px;
    white-space: nowrap;
}

.chain-label {
    color: #2563eb;
}

.amount-label {
    color: #ef4444;
}

.chain-name,
.currency-name,
.amount-value,
.address-text {
    color: #2563eb;
}

.qr-code {
    width: 220px;
    height: 220px;
    border: 1px solid #d2d9e5;
    object-fit: contain;
    background: #fff;
}

.address {
    width: min(100%, 680px);
    text-align: center;
    word-break: break-all;
}

.address-ton {
    font-size: 0.95rem;
}

.address-default {
    font-size: 0.84rem;
}

.payment-amount {
    display: inline-flex;
    align-items: center;
    flex-wrap: wrap;
    justify-content: center;
    gap: 10px;
    margin: 0;
    font-size: 1.1rem;
    font-weight: 700;
}

.pay-inline-btn {
    padding: 7px 14px;
    border-radius: 14px;
    font-size: 0.92rem;
}

.pay-meta {
    display: grid;
    gap: 10px;
    margin-top: 18px;
}

.pay-meta-item {
    color: #475569;
    font-size: 0.98rem;
}

.pay-meta-label {
    font-weight: 700;
}

.pay-meta-value {
    color: #0f172a;
}

.pay-section-title {
    margin: 0 0 14px;
    color: #0f172a;
    font-size: 1.08rem;
    font-weight: 700;
}

.platform-links {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
}

.platform-button {
    display: inline-flex;
    align-items: center;
    padding: 10px 18px;
    border-radius: 14px;
    background: #f8fafc;
    border: 1px solid #d8e1ec;
    text-decoration: none;
    color: #334155;
    transition: background 0.2s ease, border-color 0.2s ease;
}

.platform-button:hover {
    background: #eef4ff;
    border-color: #bfdbfe;
    color: #1d4ed8;
}

.platform-button img {
    width: 24px;
    height: 24px;
    margin-right: 10px;
}

.footer-section {
    margin-top: 28px;
    padding: 24px 28px;
    background: linear-gradient(180deg, #f4f7fb 0%, #eef2f7 100%);
    border: 1px solid #e6ecf3;
    border-radius: 18px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.06);
}

.footer-cards {
    display: flex;
    gap: 24px;
    align-items: flex-start;
    justify-content: space-between;
}

.footer-card {
    flex: 1 1 0;
    min-width: 0;
}

.footer-card h5 {
    margin: 0 0 12px;
    color: #243b53;
    font-size: 1.05rem;
    font-weight: 600;
}

.footer-card p {
    margin: 0 0 6px;
    color: #52657a;
    font-size: 0.95rem;
}

.footer-card a {
    color: #3b82f6;
    text-decoration: none;
    font-size: 0.95rem;
}

.footer-card a:hover {
    color: #1d4ed8;
    text-decoration: underline;
}

.copyright {
    margin-top: 12px;
    padding-top: 12px;
    border-top: 1px dashed #e6ecf3;
    color: #6b778d;
    font-size: 0.95rem;
    text-align: center;
}

.expired-card,
.status-card {
    width: min(100%, 560px);
    margin: 40px auto 0;
    padding: 36px 32px;
    text-align: center;
    background: rgba(255, 255, 255, 0.96);
    border-radius: 24px;
    box-shadow: 0 20px 48px rgba(15, 23, 42, 0.12);
}

.expired-card h1,
.expired-card h4,
.status-card h1 {
    margin: 0 0 16px;
    color: #0f172a;
}

.expired-card h1,
.status-card h1 {
    font-size: clamp(1.8rem, 4vw, 2.5rem);
    font-weight: 800;
}

.expired-card h4 {
    font-size: clamp(1.5rem, 4vw, 2.1rem);
    font-weight: 800;
}

.expired-actions,
.status-actions {
    margin-top: 24px;
}

.status-shell {
    min-height: calc(100vh - 170px);
    display: flex;
    align-items: center;
    justify-content: center;
}

.status-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 16px;
    padding: 7px 14px;
    border-radius: 999px;
    background: rgba(37, 99, 235, 0.1);
    color: #2563eb;
    font-size: 0.9rem;
    font-weight: 700;
}

.status-card h1 {
    color: #16a34a;
}

.status-card p {
    margin: 0;
    color: #475569;
    font-size: 1rem;
    line-height: 1.7;
}

.guide-modal {
    position: fixed;
    inset: 0;
    z-index: 1050;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 20px;
    background: rgba(15, 23, 42, 0.42);
}

.guide-modal.is-open {
    display: flex;
}

.guide-dialog {
    width: min(760px, 100%);
    max-height: calc(100vh - 40px);
    overflow: auto;
    border-radius: 18px;
    background: #fff;
    box-shadow: 0 24px 56px rgba(15, 23, 42, 0.24);
}

.guide-header {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 20px 24px;
    color: #fff;
    background: linear-gradient(90deg, #2e7cf6 0%, #36c3f6 100%);
}

.guide-close {
    margin-left: auto;
    border: 0;
    background: transparent;
    color: #fff;
    font-size: 1.6rem;
    line-height: 1;
    cursor: pointer;
}

.guide-body {
    padding: 24px;
    background: #f8fafc;
}

.guide-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 16px;
}

.guide-card {
    height: 100%;
    padding: 20px;
    border-radius: 14px;
    background: #fff;
    box-shadow: 0 2px 10px rgba(15, 23, 42, 0.06);
}

.guide-step {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 30px;
    height: 30px;
    margin-right: 10px;
    border-radius: 999px;
    background: #2e7cf6;
    color: #fff;
    font-weight: 700;
}

.guide-card h3 {
    display: flex;
    align-items: center;
    margin: 0 0 12px;
    color: #0f172a;
    font-size: 1rem;
    font-weight: 700;
}

.guide-card p,
.guide-card li {
    color: #334155;
    font-size: 0.95rem;
}

.guide-card ul {
    margin: 0;
    padding-left: 18px;
}

.guide-link {
    display: inline-flex;
    align-items: center;
    margin-bottom: 8px;
    padding: 6px 12px;
    border-radius: 8px;
    border: 1px solid #dbeafe;
    color: #2563eb;
    font-weight: 600;
    text-decoration: none;
}

.guide-link img {
    width: 20px;
    height: 20px;
    margin-right: 8px;
}

.pay-toast-stack {
    position: fixed;
    top: 18px;
    left: 50%;
    z-index: 1200;
    display: flex;
    flex-direction: column;
    gap: 10px;
    width: min(94vw, 460px);
    transform: translateX(-50%);
    pointer-events: none;
}

.pay-toast {
    position: relative;
    display: flex;
    align-items: flex-start;
    gap: 10px;
    padding: 12px 16px;
    border-radius: 14px;
    border: 1px solid rgba(96, 165, 250, 0.2);
    background: linear-gradient(135deg, rgba(240, 248, 255, 0.97) 0%, rgba(222, 238, 255, 0.95) 100%);
    color: #133a7d;
    box-shadow: 0 12px 26px rgba(59, 130, 246, 0.14);
    overflow: hidden;
    opacity: 0;
    transform: translateY(-8px) scale(0.98);
    transition: opacity 0.18s ease, transform 0.18s ease;
}

.pay-toast.is-visible {
    opacity: 1;
    transform: translateY(0) scale(1);
}

.pay-toast-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 24px;
    height: 24px;
    margin-top: 2px;
    border-radius: 999px;
    background: rgba(59, 130, 246, 0.14);
    color: #2563eb;
    font-size: 0.95rem;
    font-weight: 700;
    flex: 0 0 auto;
}

.pay-toast-body {
    display: flex;
    flex-direction: column;
    min-width: 0;
    gap: 2px;
}

.pay-toast-text {
    font-size: 0.95rem;
    font-weight: 700;
    line-height: 1.35;
}

.pay-toast-detail {
    color: #1e3a8a;
    font-size: 0.92rem;
    font-weight: 600;
    line-height: 1.45;
    word-break: break-all;
}

.pay-toast.is-success .pay-toast-icon {
    background: rgba(34, 197, 94, 0.14);
    color: #16a34a;
}

.pay-toast.is-error {
    border-color: rgba(251, 191, 36, 0.22);
    background: linear-gradient(135deg, rgba(255, 248, 235, 0.97) 0%, rgba(255, 241, 214, 0.95) 100%);
    color: #92400e;
}

.pay-toast.is-error .pay-toast-icon {
    background: rgba(251, 191, 36, 0.16);
    color: #d97706;
}

.pay-toast-progress {
    position: absolute;
    left: 0;
    bottom: 0;
    width: 100%;
    height: 3px;
    background: linear-gradient(90deg, rgba(34, 197, 94, 0.95) 0%, rgba(59, 130, 246, 0.85) 100%);
    transform-origin: left center;
    transform: scaleX(0);
    animation: pay-toast-progress-grow var(--toast-duration, 3200ms) linear forwards;
}

.pay-toast.is-error .pay-toast-progress {
    background: linear-gradient(90deg, rgba(251, 191, 36, 0.95) 0%, rgba(245, 158, 11, 0.8) 100%);
}

@keyframes pay-toast-progress-grow {
    from {
        transform: scaleX(0);
    }

    to {
        transform: scaleX(1);
    }
}

@media (max-width: 640px) {
    .pay-topbar-inner {
        flex-wrap: nowrap;
        align-items: center;
        gap: 10px;
        padding: 12px 12px;
    }

    .pay-nav {
        flex: 1 1 auto;
        flex-wrap: nowrap;
        justify-content: flex-end;
        gap: 8px;
        min-width: 0;
        overflow: hidden;
    }

    .pay-nav a,
    .guide-trigger {
        font-size: 0.78rem;
        letter-spacing: -0.01em;
    }

    .pay-back {
        flex: 0 0 auto;
        gap: 6px;
        padding: 8px 11px;
        font-size: 0.82rem;
    }

    .pay-back-icon {
        font-size: 0.9rem;
    }

    .pay-main {
        padding-top: 16px;
    }

    .pay-card-header,
    .pay-panel,
    .footer-section,
    .expired-card,
    .status-card {
        padding-left: 20px;
        padding-right: 20px;
    }

    .pay-card-title,
    .pay-countdown {
        font-size: 1.1rem;
    }

    .pay-network-row {
        flex-wrap: nowrap;
        gap: 8px 10px;
        font-size: 0.88rem;
    }

    .pay-network-item {
        gap: 1px;
    }

    .pay-input {
        font-size: 0.8rem;
        padding: 0.64rem 0.68rem;
    }

    .pay-btn {
        width: 100%;
    }

    .pay-copy-btn,
    .pay-inline-btn {
        width: auto;
    }

    .pay-copy-btn {
        min-width: 58px;
        padding: 0 0.56rem;
        font-size: 0.8rem;
    }

    .pay-inline-btn {
        padding: 6px 12px;
        border-radius: 12px;
        font-size: 0.78rem;
    }

    .platform-links {
        flex-direction: column;
    }

    .footer-cards {
        flex-direction: row;
        flex-wrap: wrap;
        gap: 16px 12px;
    }

    .footer-card {
        flex: 1 1 calc(50% - 6px);
    }

    .footer-card:first-child {
        flex-basis: 100%;
    }

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