:root {
    --tgpay-bg: #f4f7fb;
    --tgpay-card: #ffffff;
    --tgpay-text: #575757;
    --tgpay-muted: #707070;
    --tgpay-border: #e5e7eb;
    --tgpay-primary: #2563eb;
    --tgpay-primary-dark: #1d4ed8;
    --tgpay-success: #047857;
    --tgpay-success-bg: #d1fae5;
    --tgpay-error: #b91c1c;
    --tgpay-error-bg: #FEE7E2;
    --tgpay-wait: #4e4137;
    --tgpay-wait-bg: #fef3c7;
    --tgpay-neutral-bg: #e5e7eb;
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    min-height: 100vh;
    font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    color: var(--tgpay-text);
    background: radial-gradient(circle at top, #e0ecff 0, var(--tgpay-bg) 42%);
}

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

.tgpay-card {
    width: 100%;
    max-width: 680px;
    background: var(--tgpay-card);
    border: 1px solid rgba(17, 24, 39, 0.08);
    border-radius: 24px;
    box-shadow: 0 24px 70px rgba(15, 23, 42, 0.12);
    padding: 28px;
}

.tgpay-brand {
    display: flex;
    gap: 14px;
    align-items: center;
    margin-bottom: 24px;
}

.tgpay-logo {
    width: 48px;
    height: 48px;
    border-radius: 16px;
    display: grid;
    place-items: center;
    font-weight: 800;
    color: #ffffff;
    background: linear-gradient(135deg, #769be5, #daaedb);
}

.tgpay-brand-name {
    font-weight: 800;
    font-size: 18px;
}

.tgpay-brand-subtitle {
    color: var(--tgpay-muted);
    font-size: 13px;
    margin-top: 2px;
}

h1 {
    font-size: clamp(26px, 5vw, 40px);
    line-height: 1.1;
    margin: 16px 0 18px;
    letter-spacing: -0.04em;
}

.tgpay-description {
    color: var(--tgpay-muted);
    line-height: 1.55;
    margin: 18px 0;
}

.tgpay-status {
    display: inline-flex;
    align-items: center;
    border-radius: 999px;
    padding: 7px 12px;
    font-size: 13px;
    font-weight: 700;
}

.tgpay-status-wait {
    color: var(--tgpay-wait);
    background: var(--tgpay-wait-bg);
}

.tgpay-status-success {
    color: var(--tgpay-success);
    background: var(--tgpay-success-bg);
}

.tgpay-status-error {
    color: var(--tgpay-error);
    background: var(--tgpay-error-bg);
}

.tgpay-status-neutral {
    color: #5e5e5e;
    background: var(--tgpay-neutral-bg);
}

.tgpay-amount {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    border: 1px solid var(--tgpay-border);
    border-radius: 18px;
    padding: 16px;
    background: #f9fafb;
}

.tgpay-amount span {
    color: var(--tgpay-muted);
}

.tgpay-amount strong {
    font-size: 26px;
    letter-spacing: -0.03em;
}

.tgpay-loader {
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--tgpay-muted);
    margin: 22px 0;
    padding: 30px 0;
    border-top: 1px solid var(--tgpay-border);
    border-bottom: 1px solid var(--tgpay-border);
}

.tgpay-loader[hidden],
.tgpay-instructions[hidden] {
    display: none;
}

.tgpay-loader span {
    width: 56px;
    height: 56px;
    border: 6px solid #edf0f2;
    border-bottom-color: #22c55e;
    border-radius: 999px;
    animation: tgpay-spin 0.8s linear infinite;
}

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

.tgpay-alert {
    margin: 18px 0;
    padding: 14px;
    border-radius: 14px;
    line-height: 1.5;
}

.tgpay-alert-error {
    color: var(--tgpay-error);
    background: var(--tgpay-error-bg);
}

.tgpay-instructions {
    margin-top: 18px;
}

.tgpay-instructions h2 {
    font-size: 18px;
    margin: 0 0 12px;
}

.tgpay-instruction {
    border: 1px solid var(--tgpay-border);
    border-radius: 18px;
    padding: 16px;
    margin: 12px 0;
    background: #ffffff;
    overflow: hidden;
}

.tgpay-instruction img {
    width: 100%;
    max-height: 520px;
    object-fit: contain;
    display: block;
    border-radius: 12px;
    background: #f9fafb;
}

.tgpay-instruction-text {
    white-space: pre-wrap;
    line-height: 1.55;
}

.tgpay-payment-link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 14px;
    padding: 12px 16px;
    background: var(--tgpay-primary);
    color: #ffffff;
    font-weight: 700;
    text-decoration: none;
}

.tgpay-payment-link:hover {
    background: var(--tgpay-primary-dark);
}

.tgpay-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    margin-top: 24px;
}

.tgpay-button {
    appearance: none;
    border: 0;
    border-radius: 14px;
    padding: 12px 16px;
    background: var(--tgpay-primary);
    color: #ffffff;
    font: inherit;
    font-weight: 700;
    cursor: pointer;
    text-decoration: none;
}

.tgpay-button:hover {
    background: var(--tgpay-primary-dark);
}

.tgpay-button-secondary {
    color: var(--tgpay-text);
    background: #eef2ff;
}

.tgpay-button-secondary:hover {
    background: #e0e7ff;
}

code {
    padding: 2px 5px;
    border-radius: 6px;
    background: rgba(0, 0, 0, 0.06);
}

@media (max-width: 520px) {
    .tgpay-card {
        padding: 20px;
        border-radius: 20px;
    }

    .tgpay-amount {
        align-items: flex-start;
        flex-direction: column;
    }

    .tgpay-actions,
    .tgpay-button,
    .tgpay-payment-link {
        width: 100%;
    }
}