* { margin: 0; padding: 0; box-sizing: border-box; }

:root {
    --bg-primary: #0d1329;
    --bg-secondary: #1a2140;
    --bg-card: #252b4a;
    --accent-pink: #ff3b6f;
    --accent-pink-dark: #cc2f59;
    --accent-blue: #4a6cf7;
    --text-primary: #ffffff;
    --text-secondary: #8892b0;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, sans-serif;
    background: linear-gradient(180deg, var(--bg-primary) 0%, #0a0f1f 100%);
    min-height: 100vh;
    min-height: var(--app-height, 100dvh);
    color: var(--text-primary);
    -webkit-font-smoothing: antialiased;
}

.app {
    max-width: 430px;
    margin: 0 auto;
    min-height: 100vh;
    min-height: var(--app-height, 100dvh);
}

.screen {
    display: none;
    flex-direction: column;
    min-height: 100vh;
    min-height: var(--app-height, 100dvh);
    padding: 28px 20px;
    padding-top: calc(34px + env(safe-area-inset-top, 0px));
    padding-bottom: calc(24px + env(safe-area-inset-bottom, 0px));
}

.screen.active {
    display: flex;
}

.btn-back {
    position: absolute;
    top: calc(16px + env(safe-area-inset-top, 0px));
    left: 16px;
    background: none;
    border: none;
    color: var(--text-primary);
    font-size: 24px;
    cursor: pointer;
    padding: 8px;
    text-decoration: none;
    z-index: 10;
}

.btn-back.btn-close-delayed {
    left: auto;
    right: 16px;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.08);
    font-size: 28px;
    line-height: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    pointer-events: none;
    transform: scale(0.92);
    transition: opacity 0.25s ease, transform 0.25s ease;
}

.btn-back.btn-close-delayed.visible {
    opacity: 1;
    pointer-events: auto;
    transform: scale(1);
}

.payment-header {
    text-align: center;
    margin-bottom: 16px;
    padding-top: 18px;
}

.payment-icon {
    font-size: 42px;
    margin-bottom: 10px;
}

.payment-title {
    font-size: 27px;
    font-weight: 800;
    margin-bottom: 8px;
    line-height: 1.15;
}

.payment-subtitle {
    font-size: 15px;
    color: var(--text-secondary);
    line-height: 1.4;
}

.features-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-bottom: 24px;
    padding: 0 4px;
}

.paywall-games {
    position: relative;
    height: 196px;
    overflow: hidden;
    border-radius: 8px;
    margin-bottom: 14px;
}

.paywall-games::before,
.paywall-games::after {
    content: "";
    position: absolute;
    left: 0;
    right: 0;
    z-index: 2;
    pointer-events: none;
}

.paywall-games::before {
    top: 0;
    height: 58px;
    background: linear-gradient(180deg, rgba(13, 19, 41, 0.98) 0%, rgba(13, 19, 41, 0.68) 48%, rgba(13, 19, 41, 0) 100%);
}

.paywall-games::after {
    bottom: 0;
    height: 38px;
    background: linear-gradient(0deg, rgba(13, 19, 41, 0.92) 0%, rgba(13, 19, 41, 0) 100%);
}

.paywall-games-track {
    display: flex;
    flex-wrap: wrap;
    align-content: flex-start;
    align-items: flex-start;
    gap: 4px;
    padding: 4px 0;
    will-change: transform;
}

.paywall-games-track.can-scroll {
    animation: paywallGamesFloat var(--paywall-games-duration, 12000ms) ease-in-out infinite;
}

.paywall-game-chip {
    max-width: 100%;
    min-height: 22px;
    padding: 3px 6px;
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.07);
    display: flex;
    align-items: center;
    gap: 5px;
    opacity: 0;
    transform: translateY(14px) scale(0.98);
    animation: paywallGameIn 0.28s cubic-bezier(0.18, 0.86, 0.25, 1) forwards;
    animation-delay: var(--delay);
}

.paywall-game-chip img {
    width: 14px;
    height: 14px;
    object-fit: contain;
    flex-shrink: 0;
}

.game-icon-fallback {
    width: 14px;
    height: 14px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    font-size: 12px;
    line-height: 1;
}

.paywall-game-chip span {
    max-width: none;
    min-width: 0;
    color: #ffffff;
    font-size: 10px;
    font-weight: 800;
    line-height: 1.15;
    white-space: nowrap;
    overflow: visible;
    text-overflow: clip;
}

.coupon-card {
    position: relative;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 13px 14px;
    border: 0;
    border-radius: 8px;
    background: rgba(129, 199, 132, 0.08);
    margin-bottom: 16px;
    overflow: hidden;
}

.coupon-dash-border {
    position: absolute;
    inset: 0;
    z-index: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    overflow: visible;
}

.coupon-dash-border rect {
    fill: none;
    stroke: rgba(183, 243, 189, 0.82);
    stroke-width: 1.5;
    stroke-linecap: round;
    stroke-dasharray: 4 3;
    vector-effect: non-scaling-stroke;
    animation: couponDashMove 1.1s linear infinite;
}

.coupon-card > :not(.coupon-dash-border) {
    position: relative;
    z-index: 1;
}

@keyframes couponDashMove {
    to {
        stroke-dashoffset: -14;
    }
}

.coupon-kicker {
    display: block;
    margin-bottom: 5px;
    color: #b7f3bd;
    font-size: 11px;
    font-weight: 800;
    text-transform: uppercase;
}

.coupon-code {
    display: block;
    max-width: 230px;
    color: #b7f3bd;
    font-size: 15px;
    font-weight: 900;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.coupon-timer {
    flex-shrink: 0;
    min-width: 92px;
    text-align: right;
}

.coupon-timer span {
    display: block;
    color: var(--text-secondary);
    font-size: 11px;
    font-weight: 700;
    line-height: 1.1;
}

.coupon-timer strong {
    display: block;
    margin-top: 4px;
    color: #ffffff;
    font-size: 20px;
    font-weight: 900;
    line-height: 1;
}

.feature-item {
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 14px;
    color: var(--text-secondary);
}

.feature-icon {
    font-size: 18px;
    flex-shrink: 0;
}

.input-section {
    margin-bottom: 18px;
}

.input-label {
    display: block;
    font-size: 15px;
    font-weight: 600;
    margin-bottom: 8px;
}

.input-field {
    width: 100%;
    padding: 14px 16px;
    font-size: 16px;
    font-family: inherit;
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 12px;
    color: var(--text-primary);
    outline: none;
    transition: border-color 0.2s ease;
}

.input-field::placeholder {
    color: rgba(255, 255, 255, 0.25);
}

.input-field:focus,
.input-field.error {
    border-color: var(--accent-pink);
}

.input-hint {
    margin-top: 8px;
    font-size: 12px;
    color: var(--text-secondary);
    line-height: 1.45;
}

.plans-label,
.method-label {
    font-size: 15px;
    font-weight: 600;
    margin-bottom: 12px;
    display: block;
}

.plans-list {
    display: flex;
    flex-direction: column;
    gap: 9px;
    margin-bottom: 18px;
}

.method-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-bottom: 24px;
}

.plan-card {
    background: var(--bg-card);
    border-radius: 8px;
    padding: 12px;
    cursor: pointer;
    border: 2px solid transparent;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    gap: 10px;
}

.plan-card:active,
.tier-card:active,
.btn-pay:active,
.btn-secondary:active {
    transform: scale(0.97);
}

.plan-card.selected {
    border-color: var(--accent-pink);
    background: linear-gradient(135deg, rgba(255, 59, 111, 0.12) 0%, rgba(74, 108, 247, 0.08) 100%);
}

.plan-radio,
.method-radio,
.tier-radio {
    width: 22px;
    height: 22px;
    border-radius: 50%;
    flex-shrink: 0;
}

.plan-radio {
    border: 2px solid var(--text-secondary);
    transition: all 0.2s ease;
}

.plan-card.selected .plan-radio {
    border-color: var(--accent-pink);
    background: var(--accent-pink);
    box-shadow: inset 0 0 0 3px var(--bg-card);
}

.plan-info {
    flex: 1;
    min-width: 0;
}

.plan-title-row {
    display: flex;
    align-items: center;
    gap: 8px;
    min-width: 0;
}

.plan-name {
    font-size: 16px;
    font-weight: 700;
}

.plan-badge {
    padding: 3px 8px;
    border-radius: 8px;
    background: linear-gradient(135deg, #ff3b6f, #ff6b35);
    color: #ffffff;
    font-size: 10px;
    font-weight: 900;
    text-transform: uppercase;
    white-space: nowrap;
}

.plan-desc {
    display: block;
    margin-top: 4px;
    color: var(--text-secondary);
    font-size: 12px;
    font-weight: 600;
    line-height: 1.25;
}

.plan-price-col {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 5px;
    flex-shrink: 0;
    text-align: right;
}

.plan-weekly {
    color: var(--text-secondary);
    font-size: 11px;
    font-weight: 800;
    line-height: 1.1;
    white-space: nowrap;
}

.plan-price-row {
    display: flex;
    align-items: baseline;
    justify-content: flex-end;
    gap: 7px;
    white-space: nowrap;
}

.plan-old-price {
    color: rgba(255, 255, 255, 0.48);
    font-size: 12px;
    font-weight: 800;
    text-decoration-color: rgba(255, 59, 111, 0.95);
    text-decoration-thickness: 2px;
}

.plan-price {
    font-size: 16px;
    font-weight: 900;
    color: var(--accent-pink);
}

.method-card {
    background: var(--bg-card);
    border-radius: 16px;
    padding: 16px 20px;
    display: flex;
    align-items: center;
    gap: 14px;
    border: 2px solid transparent;
    transition: all 0.2s ease;
}

.method-list .method-card {
    cursor: pointer;
}

.method-list .method-card:active {
    transform: scale(0.97);
}

.method-card.selected {
    border-color: var(--accent-pink);
    background: linear-gradient(135deg, rgba(255, 59, 111, 0.12) 0%, rgba(74, 108, 247, 0.08) 100%);
}

.method-radio {
    border: 2px solid var(--text-secondary);
    transition: all 0.2s ease;
}

.method-card.selected .method-radio {
    border-color: var(--accent-pink);
    background: var(--accent-pink);
    box-shadow: inset 0 0 0 3px var(--bg-card);
}

.method-name {
    font-size: 15px;
    font-weight: 600;
}

.tiers-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
    flex: 1;
}

.tier-card {
    background: var(--bg-card);
    border-radius: 20px;
    padding: 20px;
    cursor: pointer;
    border: 2px solid transparent;
    transition: all 0.2s ease;
    position: relative;
}

.tier-card.selected {
    border-color: var(--accent-pink);
    background: linear-gradient(135deg, rgba(255, 59, 111, 0.15) 0%, rgba(74, 108, 247, 0.10) 100%);
}

.tier-popular {
    position: absolute;
    top: -11px;
    left: 50%;
    transform: translateX(-50%);
    background: linear-gradient(135deg, var(--accent-blue), #7c3aed);
    color: white;
    font-size: 11px;
    font-weight: 800;
    padding: 3px 14px;
    border-radius: 8px;
    letter-spacing: 0.5px;
    text-transform: uppercase;
    white-space: nowrap;
}

.tier-header {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 6px;
}

.tier-label {
    font-size: 17px;
    font-weight: 700;
}

.tier-badge {
    background: linear-gradient(135deg, #ff3b6f, #ff6b35);
    color: white;
    font-size: 12px;
    font-weight: 800;
    padding: 3px 10px;
    border-radius: 8px;
    letter-spacing: 0.5px;
}

.tier-price-row {
    display: flex;
    align-items: baseline;
    gap: 10px;
    margin-bottom: 4px;
}

.tier-old-price {
    font-size: 16px;
    font-weight: 600;
    color: var(--text-secondary);
    text-decoration: line-through;
    opacity: 0.7;
}

.tier-price {
    font-size: 22px;
    font-weight: 800;
    color: var(--accent-pink);
}

.tier-desc {
    font-size: 13px;
    color: var(--text-secondary);
}

.tier-radio {
    position: absolute;
    top: 20px;
    right: 20px;
    border: 2px solid var(--text-secondary);
    transition: all 0.2s ease;
}

.tier-card.selected .tier-radio {
    border-color: var(--accent-pink);
    background: var(--accent-pink);
    box-shadow: inset 0 0 0 3px var(--bg-card);
}

.btn-pay,
.btn-secondary {
    width: 100%;
    border: none;
    border-radius: 30px;
    cursor: pointer;
    text-align: center;
    text-decoration: none;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
}

.btn-pay {
    background: linear-gradient(135deg, var(--accent-pink) 0%, var(--accent-pink-dark) 100%);
    color: white;
    padding: 18px;
    font-size: 18px;
    font-weight: 700;
    box-shadow: 0 4px 20px rgba(255, 59, 111, 0.3);
    margin-top: 18px;
}

.btn-pay:disabled {
    background: var(--bg-card);
    color: var(--text-secondary);
    box-shadow: none;
    cursor: not-allowed;
}

.btn-pay.btn-muted {
    background: linear-gradient(135deg, #3a4167 0%, #252b4a 100%);
    box-shadow: none;
}

.btn-pay.btn-danger {
    background: linear-gradient(135deg, #9c2d3c 0%, #5a1b24 100%);
    box-shadow: none;
}

.btn-secondary {
    background: transparent;
    border: 2px solid #3a4167;
    color: var(--text-secondary);
    padding: 16px;
    font-size: 16px;
    font-weight: 600;
}

.payment-note {
    text-align: center;
    color: var(--text-secondary);
    font-size: 12px;
    line-height: 1.45;
    margin-top: 16px;
}

.guarantee-card {
    margin-top: 12px;
    padding: 13px 14px;
    border: 1px solid rgba(76, 175, 80, 0.22);
    border-radius: 8px;
    background: rgba(76, 175, 80, 0.08);
    text-align: left;
}

.guarantee-card strong {
    display: block;
    margin-bottom: 5px;
    color: #7bd88f;
    font-size: 14px;
    font-weight: 900;
}

.guarantee-card p {
    margin: 0;
    color: rgba(255, 255, 255, 0.74);
    font-size: 12px;
    line-height: 1.45;
}

@keyframes paywallGamesFloat {
    0%, 10% { transform: translateY(0); }
    45%, 55% { transform: translateY(var(--paywall-games-shift, -56px)); }
    90%, 100% { transform: translateY(0); }
}

@keyframes paywallGameIn {
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

.restore-link {
    text-align: center;
    font-size: 13px;
    margin-top: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    flex-wrap: wrap;
}

.restore-link a {
    color: var(--accent-blue);
    text-decoration: none;
}

.restore-divider {
    color: rgba(255, 255, 255, 0.2);
}

.status-box,
.premium-status {
    margin: 16px 0 0;
    padding: 14px 16px;
    border-radius: 14px;
    text-align: center;
}

.status-box {
    background: rgba(255, 255, 255, 0.04);
    color: rgba(255, 255, 255, 0.5);
    font-size: 14px;
}

.premium-status {
    background: rgba(255, 255, 255, 0.04);
}

.premium-status p {
    margin-bottom: 12px;
    font-size: 14px;
    color: rgba(255, 255, 255, 0.85);
}

.manage-summary {
    flex-direction: column;
    align-items: stretch;
    gap: 10px;
}

.manage-row {
    display: flex;
    justify-content: space-between;
    gap: 16px;
    font-size: 14px;
}

.manage-row strong {
    color: rgba(255, 255, 255, 0.75);
}

.manage-row span {
    text-align: right;
}

.manage-card-section {
    margin-top: 24px;
    padding-top: 20px;
    border-top: 1px solid rgba(255, 255, 255, 0.08);
}

.manage-card-section h3 {
    margin: 0 0 12px;
    font-size: 16px;
    font-weight: 600;
}

.manage-card-hint {
    margin: 0 0 12px;
    font-size: 13px;
    color: var(--text-secondary);
    line-height: 1.45;
}

.checkbox-row {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    cursor: pointer;
    margin-bottom: 12px;
}

.checkbox-row input {
    margin-top: 3px;
    flex-shrink: 0;
}

.checkbox-row span {
    font-size: 14px;
    line-height: 1.4;
}

.manage-error {
    color: var(--accent-pink);
}

.result-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    flex: 1;
    text-align: center;
    gap: 16px;
    padding: 0 20px;
}

.result-icon {
    font-size: 64px;
}

.result-title {
    font-size: 26px;
    font-weight: 800;
}

.result-text {
    font-size: 15px;
    color: var(--text-secondary);
    line-height: 1.5;
}

.spinner-small {
    width: 20px;
    height: 20px;
    border: 2px solid rgba(255, 255, 255, 0.2);
    border-top-color: #fff;
    border-radius: 50%;
    animation: spin 0.6s linear infinite;
    margin-right: 8px;
}

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

@media (max-width: 380px) {
    .screen {
        padding: 24px 16px;
        padding-top: calc(24px + env(safe-area-inset-top, 0px));
    }

    .payment-title {
        font-size: 24px;
    }

    .paywall-games {
        height: 172px;
    }

    .paywall-game-chip {
        min-height: 20px;
        padding: 3px 5px;
    }

    .paywall-game-chip img {
        width: 13px;
        height: 13px;
    }

    .paywall-game-chip span {
        max-width: none;
        font-size: 9.5px;
    }

    .tier-card,
    .plan-card,
    .method-card {
        padding: 16px;
        border-radius: 16px;
    }

    .tier-price {
        font-size: 20px;
    }

    .tier-label {
        font-size: 15px;
    }
}
