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

/* ── Theme tokens ─────────────────────────────────────────────────────────
   Defaults = dark.
   Override axes (highest priority last):
     1. @media (prefers-color-scheme: light)  — browser / OS
     2. :root[data-theme="light"]            — Telegram.WebApp.colorScheme
*/
:root {
    --c-bg:                var(--tg-theme-bg-color, #0d1117);
    --c-bg-elev:           var(--tg-theme-secondary-bg-color, #161b22);
    --c-bg-elev-2:         #21262d;
    --c-bg-hover:          #484f58;
    --c-text:              var(--tg-theme-text-color, #e6edf3);
    --c-text-muted:        #8b949e;
    --c-text-subtle:       #6e7681;
    --c-border:            var(--tg-theme-section-separator-color, #30363d);
    --c-accent:            #58a6ff;
    --c-accent-hover:      #79c0ff;
    --c-success:           #3fb950;
    --c-success-hover:     #56d364;
    --c-success-btn:       #238636;
    --c-success-btn-hover: #2ea043;
    --c-danger:            #f85149;
    --c-warning:           #d29922;
    --c-overlay:           rgba(0, 0, 0, 0.7);
    --c-success-bg:        rgba(35, 134, 54, 0.2);
    --c-danger-bg:         rgba(248, 81, 73, 0.2);
    --c-warning-bg:        rgba(210, 153, 34, 0.2);
}

@media (prefers-color-scheme: light) {
    :root:not([data-theme="dark"]) {
        --c-bg:                #ffffff;
        --c-bg-elev:           #f6f8fa;
        --c-bg-elev-2:         #eaeef2;
        --c-bg-hover:          #d0d7de;
        --c-text:              #1f2328;
        --c-text-muted:        #656d76;
        --c-text-subtle:       #848d97;
        --c-border:            #d0d7de;
        --c-accent:            #0969da;
        --c-accent-hover:      #0860ca;
        --c-success:           #1a7f37;
        --c-success-hover:     #1f883d;
        --c-success-btn:       #1f883d;
        --c-success-btn-hover: #1a7f37;
        --c-danger:            #cf222e;
        --c-warning:           #9a6700;
        --c-overlay:           rgba(0, 0, 0, 0.4);
        --c-success-bg:        rgba(31, 136, 61, 0.12);
        --c-danger-bg:         rgba(207, 34, 46, 0.10);
        --c-warning-bg:        rgba(154, 103, 0, 0.10);
    }
}

:root[data-theme="light"] {
    --c-bg:                #ffffff;
    --c-bg-elev:           #f6f8fa;
    --c-bg-elev-2:         #eaeef2;
    --c-bg-hover:          #d0d7de;
    --c-text:              #1f2328;
    --c-text-muted:        #656d76;
    --c-text-subtle:       #848d97;
    --c-border:            #d0d7de;
    --c-accent:            #0969da;
    --c-accent-hover:      #0860ca;
    --c-success:           #1a7f37;
    --c-success-hover:     #1f883d;
    --c-success-btn:       #1f883d;
    --c-success-btn-hover: #1a7f37;
    --c-danger:            #cf222e;
    --c-warning:           #9a6700;
    --c-overlay:           rgba(0, 0, 0, 0.4);
    --c-success-bg:        rgba(31, 136, 61, 0.12);
    --c-danger-bg:         rgba(207, 34, 46, 0.10);
    --c-warning-bg:        rgba(154, 103, 0, 0.10);
}

/* Utility text colors (used by inline-style-free templates) */
.text-muted   { color: var(--c-text-muted); }
.text-success { color: var(--c-success); }
.text-accent  { color: var(--c-accent); }
.modal-text   { color: var(--c-text); line-height: 1.5; margin: 0; }

html {
    /* Compact mode: 90% scale via rem */
    font-size: 90%;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    background: var(--c-bg);
    color: var(--c-text);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
}

/* Telegram Mini App — minimal tweaks, let native scroll work */
html.tg-webapp body {
    /* Scroll owned by body naturally; 100vh is fine once tg.expand() ran */
    overscroll-behavior-y: contain;
}

html.tg-webapp a,
html.tg-webapp button,
html.tg-webapp [role="button"],
html.tg-webapp input,
html.tg-webapp label,
html.tg-webapp summary {
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
}

/* Enlarge tap targets for small text links (back buttons etc.) */
html.tg-webapp .renew-back a {
    display: inline-block;
    min-height: 2.75rem;
    line-height: 2.75rem;
    padding: 0 1.25rem;
    font-size: 1rem;
}
html.tg-webapp .period-title {
    padding: 1rem 1.25rem;
}

.container {
    max-width: 56.25rem;
    width: 100%;
    padding: 1.25rem 1.25rem;
    flex: 1 0 auto;
}

.site-logo {
    display: block;
    margin: 0 auto 1rem;
    width: 6.25rem;
    height: 6.25rem;
    border-radius: 50%;
    object-fit: cover;
}

h1 {
    text-align: center;
    font-size: 2.2rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
}

.subtitle {
    text-align: center;
    color: var(--c-text-muted);
    margin-bottom: 1.25rem;
    font-size: 1.1rem;
}

/* Period groups (collapsible) */
.period-group {
    margin-bottom: 1.5rem;
    border: 1px solid var(--c-border);
    border-radius: 0.75rem;
    background: var(--c-bg);
    overflow: hidden;
}

.period-title {
    font-size: 1.3rem;
    font-weight: 600;
    padding: 1rem 1.5rem;
    color: var(--c-text);
    cursor: pointer;
    list-style: none;
    display: flex;
    align-items: center;
    justify-content: space-between;
    transition: background 0.2s;
}

.period-title::-webkit-details-marker {
    display: none;
}

.period-title::after {
    content: "\25BC";
    font-size: 0.8rem;
    color: var(--c-text-muted);
    transition: transform 0.2s;
}

.period-group[open] > .period-title::after {
    transform: rotate(180deg);
}

.period-title:hover {
    background: none;
}

.period-group > .plans {
    padding: 0 1.5rem 1.5rem;
}

/* Plans grid */
.plans {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1.25rem;
}

@media (max-width: 48rem) {
    .plans {
        grid-template-columns: 1fr;
    }
}

.plan-card {
    background: var(--c-bg-elev);
    border: 1px solid var(--c-border);
    border-radius: 0.75rem;
    padding: 1.75rem 1.5rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    transition: border-color 0.2s;
}

.plan-card:hover {
    border-color: var(--c-accent);
}

.plan-name {
    font-size: 1.3rem;
    font-weight: 600;
    margin-bottom: 0.75rem;
}

.plan-price {
    font-size: 2rem;
    font-weight: 700;
    color: var(--c-accent);
    margin-bottom: 1rem;
}

.plan-details {
    display: flex;
    flex-direction: column;
    gap: 0.375rem;
    align-items: center;
    color: var(--c-text-muted);
    font-size: 0.95rem;
    margin-bottom: 1rem;
}

.plan-desc {
    color: var(--c-text-muted);
    font-size: 0.85rem;
    text-align: center;
    margin-bottom: 1rem;
}

.plan-card form {
    width: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.75rem;
    margin-top: auto;
}

.btn-buy {
    display: inline-block;
    width: 100%;
    max-width: 13.75rem;
    padding: 0.75rem 1.5rem;
    background: var(--c-success-btn);
    color: #fff;
    border: none;
    border-radius: 0.5rem;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    text-align: center;
    text-decoration: none;
    transition: background 0.2s;
}

.btn-buy:hover {
    background: var(--c-success-btn-hover);
}

.empty {
    text-align: center;
    color: var(--c-text-muted);
    font-size: 1.1rem;
    margin-top: 3.75rem;
}

/* Order page */
.order-result {
    text-align: center;
    padding: 0;
}

.order-result h1 {
    margin-bottom: 0.5rem;
}

.brand-title {
    background: linear-gradient(135deg, #00b4d8, #0077b6);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.brand-arrow {
    font-size: 0.75em;
}

.order-result p {
    color: var(--c-text-muted);
    margin-bottom: 1.25rem;
    line-height: 1.5;
}

.vpn-link-box {
    margin: 1.875rem auto;
    max-width: 37.5rem;
    text-align: left;
}

.vpn-link-box label {
    display: block;
    font-size: 0.9rem;
    color: var(--c-text-muted);
    margin-bottom: 0.5rem;
}

.vpn-link-row {
    display: flex;
    gap: 0.5rem;
}

.vpn-link-row input {
    flex: 1;
    padding: 0.75rem 0.875rem;
    background: var(--c-bg-elev);
    border: 1px solid var(--c-border);
    border-radius: 0.5rem;
    color: var(--c-text);
    font-family: monospace;
    font-size: 0.85rem;
}

.btn-copy {
    padding: 0.75rem 1.25rem;
    background: var(--c-accent);
    color: var(--c-bg);
    border: none;
    border-radius: 0.5rem;
    font-weight: 600;
    cursor: pointer;
    white-space: nowrap;
    transition: background 0.2s;
}

.btn-copy:hover {
    background: var(--c-accent-hover);
}

.btn-open-link {
    display: block;
    margin-top: 0.75rem;
    text-align: center;
    color: var(--c-accent);
    text-decoration: none;
    font-size: 0.95rem;
}

.btn-open-link:hover {
    text-decoration: underline;
    color: var(--c-accent-hover);
}

.instructions {
    margin: 1.875rem auto;
    max-width: 31.25rem;
    text-align: left;
    background: var(--c-bg-elev);
    border: 1px solid var(--c-border);
    border-radius: 0.75rem;
    padding: 1.5rem;
}

.instructions h3 {
    margin-bottom: 0.75rem;
    font-size: 1rem;
}

.instructions ol {
    padding-left: 1.25rem;
    line-height: 1.8;
    color: var(--c-text-muted);
}

.instructions strong {
    color: var(--c-text);
}

.warning {
    color: var(--c-warning) !important;
    font-weight: 500;
    margin-top: 1.5rem;
}

/* Subscription info block */
.sub-info-box {
    margin: 1.875rem auto;
    max-width: 31.25rem;
    background: var(--c-bg-elev);
    border: 1px solid var(--c-border);
    border-radius: 0.75rem;
    padding: 1.5rem;
}

.sub-info-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
}

.sub-info-box h3 {
    text-align: center;
    margin-bottom: 0;
    font-size: 1rem;
}

.sub-info-box > h3 {
    margin-bottom: 1rem;
}

.sub-status {
    font-size: 0.8rem;
    font-weight: 600;
    padding: 0.1875rem 0.625rem;
    border-radius: 0.75rem;
    white-space: nowrap;
}

.sub-status-active {
    background: var(--c-success-bg);
    color: var(--c-success);
}

.sub-status-expired {
    background: var(--c-danger-bg);
    color: var(--c-danger);
}

.sub-status-queued {
    background: var(--c-warning-bg);
    color: var(--c-warning);
}

.sub-actions {
    margin-top: 1rem;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.empty-text {
    text-align: center;
    color: var(--c-text-muted);
    margin-bottom: 1rem;
}

.sub-info-grid {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.sub-info-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.5rem 0;
    border-bottom: 1px solid var(--c-bg-elev-2);
}

.sub-info-item:last-child {
    border-bottom: none;
}

.sub-info-label {
    color: var(--c-text-muted);
    font-size: 0.95rem;
}

.sub-info-value {
    font-weight: 600;
    font-size: 0.95rem;
    color: var(--c-text);
}

/* Copy icon button inside info box */
.btn-copy-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 1.75rem;
    height: 1.75rem;
    padding: 0;
    background: none;
    border: 1px solid var(--c-border);
    border-radius: 0.375rem;
    color: var(--c-text);
    cursor: pointer;
    transition: border-color 0.2s, color 0.2s;
}

.btn-copy-icon:hover {
    border-color: var(--c-text-muted);
    color: var(--c-text);
}

.copy-wrapper {
    position: relative;
    display: inline-flex;
    align-items: center;
}

.copy-tooltip {
    position: absolute;
    right: calc(100% + 0.5rem);
    top: 50%;
    transform: translateY(-50%);
    background: var(--c-bg);
    color: var(--c-text);
    font-size: 0.75rem;
    font-weight: 600;
    padding: 0.25rem 0.625rem;
    border: 1px solid var(--c-border);
    border-radius: 0.5rem;
    white-space: nowrap;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.15s;
}

.copy-tooltip.show {
    opacity: 1;
}

/* Actions block */
.actions-box {
    margin: 1.25rem auto;
    max-width: 31.25rem;
    background: var(--c-bg-elev);
    border: 1px solid var(--c-border);
    border-radius: 0.75rem;
    padding: 1.5rem;
}

.actions-box h3 {
    text-align: center;
    margin-bottom: 1rem;
    font-size: 1rem;
}

.actions-btn {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    width: 100%;
    padding: 0.875rem 1rem;
    background: var(--c-bg);
    border: 1px solid var(--c-border);
    border-radius: 0.625rem;
    color: var(--c-text);
    text-decoration: none;
    font-size: 0.95rem;
    transition: border-color 0.2s, background 0.2s;
    margin-bottom: 0.5rem;
}

.actions-btn:last-child {
    margin-bottom: 0;
}

.actions-btn:hover {
    border-color: var(--c-accent);
    background: var(--c-bg-elev);
}

.actions-btn-icon {
    font-size: 1.3rem;
    flex-shrink: 0;
    width: 1.75rem;
    height: 1.75rem;
    line-height: 1.75rem;
    text-align: center;
}

.actions-btn-text {
    flex: 1;
    font-weight: 500;
}

.actions-btn-arrow {
    color: var(--c-text-muted);
    font-size: 1.4rem;
    flex-shrink: 0;
}

/* Extra devices modal */
.modal-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: var(--c-overlay);
    z-index: 1000;
    align-items: center;
    justify-content: center;
    padding: 1.25rem;
}

.modal-overlay.show {
    display: flex;
}

.modal-box {
    background: var(--c-bg-elev);
    border: 1px solid var(--c-border);
    border-radius: 0.75rem;
    padding: 1.75rem 1.5rem 1.5rem;
    max-width: 25rem;
    width: 100%;
    position: relative;
}

.modal-close {
    position: absolute;
    top: 0.5rem;
    right: 0.75rem;
    background: transparent;
    border: none;
    color: var(--c-text-muted);
    font-size: 1.8rem;
    line-height: 1;
    cursor: pointer;
    padding: 0.25rem 0.5rem;
}

.modal-close:hover {
    color: var(--c-text);
}

.modal-title {
    margin: 0 0 0.5rem;
    color: var(--c-text);
    font-size: 1.2rem;
}

.modal-subtitle {
    margin: 0 0 1.25rem;
    color: var(--c-text-muted);
    font-size: 0.95rem;
}

.modal-field {
    margin-bottom: 1.25rem;
}

.modal-field label {
    display: block;
    color: var(--c-text);
    margin-bottom: 0.625rem;
    font-size: 0.95rem;
}

.modal-field input[type="range"] {
    width: 100%;
    accent-color: var(--c-success);
}

.modal-total {
    padding: 0.75rem 1rem;
    background: var(--c-bg);
    border-radius: 0.5rem;
    margin-bottom: 1rem;
    color: var(--c-text);
    font-size: 1.05rem;
    text-align: center;
}

.modal-submit {
    width: 100%;
    background: var(--c-success);
    color: var(--c-bg);
    border: none;
    border-radius: 0.5rem;
    padding: 0.75rem;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
}

.modal-submit:hover {
    background: var(--c-success-hover);
}

.bot-link-box {
    margin: 1.875rem auto;
    max-width: 31.25rem;
    text-align: center;
    background: var(--c-bg-elev);
    border: 1px solid var(--c-border);
    border-radius: 0.75rem;
    padding: 1.5rem;
}

.bot-link-box h3 {
    margin-bottom: 0.5rem;
    font-size: 1rem;
}

.bot-link-box p {
    color: var(--c-text-muted);
    font-size: 0.9rem;
    margin-bottom: 1rem;
}

.btn-bot-link {
    background: #2b9fd6;
    max-width: 17.5rem;
}

.btn-bot-link:hover {
    background: #3aafe6;
}

/* History list in dashboard */
.history-group {
    max-width: 31.25rem;
    margin: 1.25rem auto;
}

.history-list {
    padding: 0 1.5rem 1.5rem;
}

.history-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.625rem 0;
    border-bottom: 1px solid var(--c-bg-elev-2);
    font-size: 0.9rem;
}

.history-item:last-child {
    border-bottom: none;
}

.history-plan {
    flex: 1;
    color: var(--c-text);
}

.history-date {
    color: var(--c-text-muted);
    margin-right: 0.75rem;
}

.renew-back {
    margin-top: 1.5rem;
    text-align: center;
}

.renew-back a {
    color: var(--c-text-muted);
    text-decoration: none;
    font-size: 0.9rem;
}

.renew-back a:hover {
    color: var(--c-accent);
}

/* Main menu box */
.main-menu-box {
    margin: 0 auto;
    max-width: 31.25rem;
}

/* Link-Telegram CTA banner: high-visibility, lightly annoying. */
.tg-link-banner {
    display: flex;
    align-items: center;
    gap: 0.875rem;
    max-width: 31.25rem;
    margin: 0 auto 1rem;
    padding: 0.875rem 1rem;
    border-radius: 0.875rem;
    background: linear-gradient(135deg, #229ED9 0%, #2AABEE 100%);
    color: #fff;
    text-decoration: none;
    font-weight: 500;
    box-shadow: 0 0 0 0 rgba(42, 171, 238, 0.6);
    animation: tg-link-pulse 2.2s ease-out infinite;
}
.tg-link-banner:hover,
.tg-link-banner:active {
    filter: brightness(1.05);
}
.tg-link-icon {
    flex: 0 0 auto;
    width: 2.25rem;
    height: 2.25rem;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(255, 255, 255, 0.22);
    border-radius: 50%;
    font-size: 1.1rem;
}
.tg-link-text {
    flex: 1 1 auto;
    display: flex;
    flex-direction: column;
    line-height: 1.25;
}
.tg-link-title {
    font-size: 1rem;
    font-weight: 600;
}
.tg-link-sub {
    font-size: 0.8rem;
    opacity: 0.85;
}
.tg-link-arrow {
    flex: 0 0 auto;
    font-size: 1.5rem;
    opacity: 0.9;
}

@keyframes tg-link-pulse {
    0%   { box-shadow: 0 0 0 0 rgba(42, 171, 238, 0.55); }
    70%  { box-shadow: 0 0 0 0.75rem rgba(42, 171, 238, 0); }
    100% { box-shadow: 0 0 0 0 rgba(42, 171, 238, 0); }
}
/* Respect users who disable motion */
@media (prefers-reduced-motion: reduce) {
    .tg-link-banner { animation: none; }
}

/* Device cards */
.device-card {
    padding: 1.125rem 1.5rem;
}

.device-title {
    text-align: center;
    margin-bottom: 0;
}

.device-name {
    font-weight: 600;
    font-size: 1rem;
    color: var(--c-text);
}

.device-platform {
    font-size: 0.8rem;
    color: var(--c-text-muted);
    margin-top: 2px;
}

.device-details {
    display: flex;
    flex-direction: column;
    gap: 0.375rem;
    margin-top: 0.75rem;
    padding-top: 0.75rem;
    border-top: 1px solid var(--c-bg-elev-2);
}

.device-detail-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.device-detail-label {
    font-size: 0.85rem;
    color: var(--c-text-muted);
}

.device-detail-value {
    font-size: 0.85rem;
    color: var(--c-text);
}

.device-hwid {
    font-family: monospace;
    font-size: 0.8rem;
    color: var(--c-text-muted);
}

.device-delete-form {
    margin-top: 0.75rem;
    text-align: center;
}

.btn-device-delete {
    background: none;
    border: 1px solid var(--c-border);
    border-radius: 0.5rem;
    color: var(--c-danger);
    padding: 0.5rem 1.25rem;
    cursor: pointer;
    font-size: 0.85rem;
    width: 100%;
    transition: border-color 0.2s, background 0.2s;
}

.btn-device-delete:hover {
    border-color: var(--c-danger);
    background: rgba(248, 81, 73, 0.1);
}

/* Promo code input */
.promo-box {
    text-align: left;
}

.promo-input-row {
    display: flex;
    gap: 0.5rem;
}

.promo-input {
    flex: 1;
    min-width: 0;
    padding: 0.625rem 0.875rem;
    background: var(--c-bg);
    border: 1px solid var(--c-border);
    border-radius: 0.5rem;
    color: var(--c-text);
    font-size: 0.9rem;
}

.btn-promo {
    padding: 0.625rem 1rem;
    background: var(--c-border);
    color: var(--c-text);
    border: none;
    border-radius: 0.5rem;
    cursor: pointer;
    font-weight: 600;
    font-size: 0.85rem;
    white-space: nowrap;
    flex-shrink: 0;
    transition: background 0.2s;
}

.btn-promo:hover {
    background: var(--c-bg-hover);
}

@media (max-width: 25rem) {
    .promo-input-row {
        flex-direction: column;
    }
    .btn-promo {
        width: 100%;
    }
}

.promo-result {
    margin-top: 0.5rem;
    font-size: 0.85rem;
}

.promo-ok { color: var(--c-success); }
.promo-error { color: var(--c-danger); }

.price-discounted {
    color: var(--c-success);
    font-weight: 700;
    margin-left: 0.5rem;
}

/* Pagination */
.pagination {
    display: flex;
    justify-content: center;
    gap: 1rem;
    margin: 1.25rem 0;
}

.page-link {
    color: var(--c-accent);
    text-decoration: none;
    font-size: 0.9rem;
}

.page-link:hover {
    text-decoration: underline;
}

/* Pay date in history */
.pay-date {
    color: var(--c-text-muted);
    font-size: 0.8rem;
    margin-left: 0.5rem;
}

/* Settings */
.settings-form {
    width: 100%;
}

.settings-select {
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
    padding: 0.5rem 2rem 0.5rem 0.75rem;
    background-color: var(--tg-theme-secondary-bg-color, var(--c-bg-elev));
    background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='10' height='6' viewBox='0 0 10 6'><path fill='%238b949e' d='M0 0l5 6 5-6z'/></svg>");
    background-repeat: no-repeat;
    background-position: right 0.75rem center;
    background-size: 0.625rem 0.375rem;
    border: 1px solid var(--tg-theme-section-separator-color, var(--c-border));
    border-radius: 0.5rem;
    color: var(--tg-theme-text-color, var(--c-text));
    font-size: 0.9rem;
    line-height: 1.4;
}

.settings-select option {
    background: var(--tg-theme-secondary-bg-color, var(--c-bg-elev));
    color: var(--tg-theme-text-color, var(--c-text));
}

.settings-actions {
    margin-top: 1.25rem;
    text-align: center;
}

/* Rules text */
.rules-text {
    color: var(--c-text-muted);
    font-size: 0.9rem;
    line-height: 1.8;
}

.rules-text p {
    margin-bottom: 0.25rem;
}

.rules-note {
    margin-top: 0.75rem;
    font-size: 0.85rem;
    color: var(--c-text-subtle);
}

/* Referral level */
.ref-level-dots {
    font-size: 1.5rem;
    letter-spacing: 0.25rem;
    margin-bottom: 0.5rem;
}

.ref-progress {
    margin-top: 0.75rem;
}

.ref-progress-bar {
    height: 0.375rem;
    background: var(--c-bg-elev-2);
    border-radius: 0.1875rem;
    overflow: hidden;
    margin-bottom: 0.375rem;
}

.ref-progress-fill {
    height: 100%;
    background: var(--c-accent);
    border-radius: 0.1875rem;
    transition: width 0.3s;
}

.ref-progress-text {
    font-size: 0.8rem;
    color: var(--c-text-muted);
}

.ref-tooltip-trigger {
    cursor: help;
    border-bottom: 1px dotted var(--c-text-muted);
}

.info-btn {
    background: none;
    border: none;
    color: inherit;
    font: inherit;
    padding: 0;
    cursor: pointer;
    text-align: left;
    border-bottom: 1px dotted var(--c-text-muted);
}

.info-btn:hover {
    color: var(--c-accent);
}

.ref-next-level {
    border-color: var(--c-accent)33;
}

.ref-next-hint {
    color: var(--c-text-muted);
    font-size: 0.85rem;
    margin-bottom: 0.75rem;
}

.ref-levels-table {
    padding: 0 1.5rem 1.5rem;
}

.ref-level-row {
    display: grid;
    grid-template-columns: 2fr 1fr 1fr 1.2fr;
    gap: 0.5rem;
    padding: 0.5rem 0;
    border-bottom: 1px solid var(--c-bg-elev-2);
    font-size: 0.85rem;
    color: var(--c-text-muted);
}

.ref-level-row:last-child {
    border-bottom: none;
}

.ref-level-header {
    font-weight: 600;
    color: var(--c-text);
    font-size: 0.8rem;
}

.ref-level-current {
    color: var(--c-text);
    background: var(--c-bg-elev)80;
    border-radius: 0.375rem;
    padding: 0.5rem 0.25rem;
}

.error-msg {
    color: var(--c-danger) !important;
}

/* Spinner */
.spinner {
    width: 2.5rem;
    height: 2.5rem;
    border: 0.25rem solid var(--c-border);
    border-top-color: var(--c-accent);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    margin: 1.5rem auto;
}

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

/* Footer */
footer {
    flex: 0 0 auto;
    padding: 0.75rem 1.25rem;
    text-align: center;
}

footer a {
    color: var(--c-text-muted);
    text-decoration: none;
    font-size: 0.9rem;
}

footer a:hover {
    color: var(--c-accent);
}

/* Captcha gate page */
.captcha-gate {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 80vh;
    text-align: center;
}

.captcha-form {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1.25rem;
    margin-top: 1.875rem;
}

.captcha-form .btn-buy:disabled {
    background: var(--c-border);
    color: var(--c-text-muted);
    cursor: not-allowed;
}

.cf-turnstile {
    margin: 0;
}

/* Terms checkbox */
.terms-label {
    display: flex;
    align-items: flex-start;
    gap: 0.625rem;
    font-size: 0.9rem;
    color: var(--c-text-muted);
    cursor: pointer;
    line-height: 1.5;
}

.terms-cb {
    width: 1.25rem;
    height: 1.25rem;
    accent-color: var(--c-success-btn);
    cursor: pointer;
    flex-shrink: 0;
    margin-top: 2px;
}

.terms-link {
    color: var(--c-accent);
    text-decoration: none;
}

.terms-link:hover {
    text-decoration: underline;
}

/* Terms modal */
.terms-modal {
    background: var(--c-bg-elev);
    color: var(--c-text);
    border: 1px solid var(--c-border);
    border-radius: 0.75rem;
    padding: 2rem;
    max-width: 30rem;
    width: 90%;
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    margin: 0;
}

.terms-modal::backdrop {
    background: var(--c-overlay);
}

.terms-modal h2 {
    margin-bottom: 0.75rem;
    font-size: 1.3rem;
}

.terms-text {
    color: var(--c-text-muted);
    margin-bottom: 1.25rem;
    line-height: 1.5;
}

.modal-actions {
    display: flex;
    gap: 0.75rem;
    margin-top: 1.5rem;
    justify-content: center;
}

.btn-confirm:disabled {
    background: var(--c-border);
    color: var(--c-text-muted);
    cursor: not-allowed;
}

.btn-cancel {
    padding: 0.75rem 1.5rem;
    background: transparent;
    color: var(--c-text-muted);
    border: 1px solid var(--c-border);
    border-radius: 0.5rem;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: border-color 0.2s, color 0.2s;
}

.btn-cancel:hover {
    border-color: var(--c-text-muted);
    color: var(--c-text);
}

