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

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    background: #0d1117;
    color: #e6edf3;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.container {
    max-width: 900px;
    width: 100%;
    padding: 40px 20px;
}

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

.subtitle {
    text-align: center;
    color: #8b949e;
    margin-bottom: 40px;
    font-size: 1.1rem;
}

/* Period groups (collapsible) */
.period-group {
    margin-bottom: 24px;
    border: 1px solid #30363d;
    border-radius: 12px;
    background: #0d1117;
    overflow: hidden;
}

.period-title {
    font-size: 1.3rem;
    font-weight: 600;
    padding: 16px 24px;
    color: #e6edf3;
    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: #8b949e;
    transition: transform 0.2s;
}

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

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

.period-group > .plans {
    padding: 0 24px 24px;
}

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

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

.plan-card {
    background: #161b22;
    border: 1px solid #30363d;
    border-radius: 12px;
    padding: 28px 24px;
    display: flex;
    flex-direction: column;
    align-items: center;
    transition: border-color 0.2s;
}

.plan-card:hover {
    border-color: #58a6ff;
}

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

.plan-price {
    font-size: 2rem;
    font-weight: 700;
    color: #58a6ff;
    margin-bottom: 16px;
}

.plan-details {
    display: flex;
    flex-direction: column;
    gap: 6px;
    align-items: center;
    color: #8b949e;
    font-size: 0.95rem;
    margin-bottom: 16px;
}

.plan-desc {
    color: #8b949e;
    font-size: 0.85rem;
    text-align: center;
    margin-bottom: 16px;
}

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

.btn-buy {
    display: inline-block;
    width: 100%;
    max-width: 220px;
    padding: 12px 24px;
    background: #238636;
    color: #fff;
    border: none;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    text-align: center;
    text-decoration: none;
    transition: background 0.2s;
}

.btn-buy:hover {
    background: #2ea043;
}

.empty {
    text-align: center;
    color: #8b949e;
    font-size: 1.1rem;
    margin-top: 60px;
}

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

.order-result h1 {
    margin-bottom: 16px;
}

.order-result p {
    color: #8b949e;
    margin-bottom: 20px;
    line-height: 1.5;
}

.vpn-link-box {
    margin: 30px auto;
    max-width: 600px;
    text-align: left;
}

.vpn-link-box label {
    display: block;
    font-size: 0.9rem;
    color: #8b949e;
    margin-bottom: 8px;
}

.vpn-link-row {
    display: flex;
    gap: 8px;
}

.vpn-link-row input {
    flex: 1;
    padding: 12px 14px;
    background: #161b22;
    border: 1px solid #30363d;
    border-radius: 8px;
    color: #e6edf3;
    font-family: monospace;
    font-size: 0.85rem;
}

.btn-copy {
    padding: 12px 20px;
    background: #58a6ff;
    color: #0d1117;
    border: none;
    border-radius: 8px;
    font-weight: 600;
    cursor: pointer;
    white-space: nowrap;
    transition: background 0.2s;
}

.btn-copy:hover {
    background: #79c0ff;
}

.btn-open-link {
    display: block;
    margin-top: 12px;
    text-align: center;
    color: #58a6ff;
    text-decoration: none;
    font-size: 0.95rem;
}

.btn-open-link:hover {
    text-decoration: underline;
    color: #79c0ff;
}

.instructions {
    margin: 30px auto;
    max-width: 500px;
    text-align: left;
    background: #161b22;
    border: 1px solid #30363d;
    border-radius: 12px;
    padding: 24px;
}

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

.instructions ol {
    padding-left: 20px;
    line-height: 1.8;
    color: #8b949e;
}

.instructions strong {
    color: #e6edf3;
}

.warning {
    color: #d29922 !important;
    font-weight: 500;
    margin-top: 24px;
}

.error-msg {
    color: #f85149 !important;
}

/* Spinner */
.spinner {
    width: 40px;
    height: 40px;
    border: 4px solid #30363d;
    border-top-color: #58a6ff;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    margin: 24px auto;
}

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

/* Footer */
footer {
    margin-top: auto;
    padding: 20px;
    text-align: center;
}

footer a {
    color: #8b949e;
    text-decoration: none;
    font-size: 0.9rem;
}

footer a:hover {
    color: #58a6ff;
}

/* 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: 20px;
    margin-top: 30px;
}

.captcha-form .btn-buy:disabled {
    background: #30363d;
    color: #8b949e;
    cursor: not-allowed;
}

.cf-turnstile {
    margin: 0;
}

/* Terms checkbox */
.terms-label {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    font-size: 0.9rem;
    color: #8b949e;
    cursor: pointer;
    line-height: 1.5;
}

.terms-cb {
    width: 20px;
    height: 20px;
    accent-color: #238636;
    cursor: pointer;
    flex-shrink: 0;
    margin-top: 2px;
}

.terms-link {
    color: #58a6ff;
    text-decoration: none;
}

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

/* Terms modal */
.terms-modal {
    background: #161b22;
    color: #e6edf3;
    border: 1px solid #30363d;
    border-radius: 12px;
    padding: 32px;
    max-width: 480px;
    width: 90%;
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    margin: 0;
}

.terms-modal::backdrop {
    background: rgba(0, 0, 0, 0.7);
}

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

.terms-text {
    color: #8b949e;
    margin-bottom: 20px;
    line-height: 1.5;
}

.modal-actions {
    display: flex;
    gap: 12px;
    margin-top: 24px;
    justify-content: center;
}

.btn-confirm:disabled {
    background: #30363d;
    color: #8b949e;
    cursor: not-allowed;
}

.btn-cancel {
    padding: 12px 24px;
    background: transparent;
    color: #8b949e;
    border: 1px solid #30363d;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: border-color 0.2s, color 0.2s;
}

.btn-cancel:hover {
    border-color: #8b949e;
    color: #e6edf3;
}

