:root {
    --bg-color: #030303;
    --text-color: #ffffff;
    --text-muted: #888888;
    --accent-color: #ffffff;
    --border-color: rgba(255, 255, 255, 0.15);
    --border-hover: rgba(255, 255, 255, 0.4);
    --bg-surface: rgba(255, 255, 255, 0.04);
    --bg-surface-hover: rgba(255, 255, 255, 0.08);
    --error-color: #ff5555;
    --transition-curve: cubic-bezier(0.16, 1, 0.3, 1);
}

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

body {
    background-color: var(--bg-color);
    color: var(--text-color);
    font-family: 'Inter', system-ui, -apple-system, sans-serif;
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    overflow: hidden;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

.app-container {
    width: 100%;
    max-width: 440px;
    height: 100vh;
    height: 100dvh;
    position: relative;
    display: flex;
    flex-direction: column;
}

/* Top right Telegram link container */
.top-links {
    position: absolute;
    top: 24px;
    right: 24px;
    display: flex;
    align-items: center;
    gap: 16px;
    z-index: 100;
}

/* Telegram Link */
.tg-link {
    color: var(--text-color);
    transition: transform 0.3s ease, text-shadow 0.3s ease;
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 1rem;
    font-weight: 500;
    text-decoration: none;
    letter-spacing: 1px;
}

.tg-link:hover {
    transform: translate(2px, -2px) scale(1.05);
    text-shadow: 0 0 10px rgba(255, 255, 255, 0.3);
}

.tg-icon {
    width: 24px;
    height: 24px;
}

/* Top left MAX Support Link */
.support-max-link {
    position: absolute;
    top: 28px;
    /* Slightly lower than 24px to vertically align with tg icon */
    left: 24px;
    color: var(--text-color);
    /* Bright text color like SETI logo */
    font-size: 1rem;
    font-weight: 500;
    letter-spacing: 1px;
    text-decoration: none;
    transition: transform 0.3s ease, text-shadow 0.3s ease;
    z-index: 100;
}

.support-max-link:hover {
    transform: scale(1.05);
    text-shadow: 0 0 10px rgba(255, 255, 255, 0.3);
}

/* Views */
.view {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    padding: 40px 24px;
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transition: opacity 0.6s var(--transition-curve), transform 0.5s var(--transition-curve);
    transform: translateY(20px);
}

.view.active {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
    transform: translateY(0);
}

.view.fade-up {
    transform: translateY(-20px);
}

/* Intro Animations */
@keyframes fadeIn {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

.intro-logo {
    opacity: 0;
    animation: fadeIn 1s ease-out forwards;
}

.intro-form {
    opacity: 0;
    animation: slideUp 0.8s ease-out forwards 1s;
}

.intro-delayed {
    opacity: 0;
    animation: fadeIn 1s ease-out forwards 4s;
}

/* --- Code View --- */
#codeView {
    justify-content: flex-start;
    /* Change from space-between to allow pulling form up */
}

/* Logo */
.logo-container {
    flex: 0 0 auto;
    display: flex;
    justify-content: center;
    align-items: center;
    margin-top: 15vh;
    /* Push logo down from top */
    padding-bottom: 8vh;
    /* Space between logo and form */
}

.logo-circle {
    width: 220px;
    height: 220px;
    border: 1px solid var(--border-hover);
    border-radius: 50%;
    display: flex;
    justify-content: center;
    align-items: center;
    box-shadow: 0 0 40px rgba(255, 255, 255, 0.05);
    animation: pulseCircle 5s infinite alternate ease-in-out;
}

@keyframes pulseCircle {
    0% {
        box-shadow: 0 0 20px rgba(255, 255, 255, 0.02);
    }

    100% {
        box-shadow: 0 0 50px rgba(255, 255, 255, 0.08);
    }
}

.logo-text {
    font-size: 2.5rem;
    font-weight: 300;
    letter-spacing: 0.5em;
    /* thin elegant spaced out text */
    margin-right: -0.5em;
    /* visual balance for letter spacing */
    color: var(--text-color);
}

/* Form */
.form-container {
    width: 100%;
    display: flex;
    flex-direction: column;
    gap: 16px;
    flex: 1;
    /* Allow form container to flexibly fill space */
}

.code-form {
    display: flex;
    flex-direction: column;
    gap: 16px;
    height: 100%;
}

.trial-btn-container {
    margin-top: auto;
    /* Push the trial button to the very bottom */
    padding-bottom: 24px;
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.input-group {
    position: relative;
    width: 100%;
    display: flex;
    align-items: center;
}

input[type="text"] {
    width: 100%;
    padding: 18px 24px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.25);
    border-radius: 30px;
    color: var(--text-color);
    font-size: 1rem;
    font-weight: 400;
    outline: none;
    transition: all 0.3s ease;
    font-family: inherit;
    text-align: center;
    letter-spacing: 2px;
}

input[type="text"]::placeholder {
    color: rgba(255, 255, 255, 0.3);
    font-weight: 300;
    letter-spacing: normal;
}

input[type="text"]:focus {
    border-color: var(--border-hover);
    background: rgba(255, 255, 255, 0.02);
    box-shadow: 0 0 15px rgba(255, 255, 255, 0.08);
}

.paste-btn {
    height: 48px;
    padding: 0 24px;
    background: rgba(255, 255, 255, 0.08);
    /* slightly darker than input */
    border: 1px solid rgba(255, 255, 255, 0.15);
    color: var(--text-color);
    border-radius: 24px;
    /* Pill shape */
    cursor: pointer;
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 8px;
    transition: all 0.3s ease;
    font-family: inherit;
    font-size: 0.9rem;
    font-weight: 500;
    margin: 0 auto;
    /* Center it horizontally */
    width: fit-content;
    /* Only take up as much space as the text/icon */
}

.paste-btn:hover {
    color: var(--text-color);
    background: var(--bg-surface);
}

.paste-btn:active {
    transform: scale(0.95);
}

.paste-btn svg {
    width: 20px;
    height: 20px;
}

.error-msg {
    color: var(--error-color);
    font-size: 0.85rem;
    text-align: center;
    min-height: 20px;
    opacity: 0;
    transition: opacity 0.3s ease;
    margin-top: -8px;
}

.error-msg.visible {
    opacity: 1;
}

.referral-state {
    min-height: 20px;
    margin-top: -6px;
    color: rgba(255, 255, 255, 0.72);
    font-size: 0.82rem;
    text-align: center;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.referral-state.visible {
    opacity: 1;
}

/* Buttons */
.primary-btn,
.secondary-btn {
    width: 100%;
    padding: 18px 20px;
    border-radius: 30px;
    font-size: 1rem;
    font-weight: 500;
    cursor: pointer;
    font-family: inherit;
    transition: all 0.3s ease;
    border: none;
    outline: none;
}

.primary-btn {
    background: var(--accent-color);
    color: var(--bg-color);
    border: 1px solid var(--accent-color);
}

.primary-btn:hover:not(:disabled) {
    background: transparent;
    color: var(--accent-color);
    box-shadow: 0 0 20px rgba(255, 255, 255, 0.2);
}

.primary-btn:disabled {
    cursor: not-allowed;
}

/* Initially hidden state for continue button */
.submit-btn {
    opacity: 0;
    visibility: hidden;
    transform: translateY(10px);
    transition: opacity 0.4s ease, transform 0.4s ease, visibility 0.4s;
    position: absolute;
    /* Take out of flow to not take up space */
    bottom: -60px;
    /* Position it below the form */
}

/* State when code is valid and it should be visible */
.submit-btn.is-active {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
    position: relative;
    /* Put back into flow */
    bottom: 0;
}

.secondary-btn {
    background: rgba(255, 255, 255, 0.06);
    color: var(--text-color);
    border: 1px solid rgba(255, 255, 255, 0.2);
    font-weight: 500;
}

.secondary-btn:hover {
    border-color: var(--border-hover);
    background: rgba(255, 255, 255, 0.12);
}

/* --- Payment View --- */
#paymentView {
    justify-content: center;
    padding-top: 80px;
}

.payment-header {
    text-align: center;
    margin-bottom: 40px;
}

.payment-header h2 {
    font-size: 1.8rem;
    font-weight: 300;
    margin-bottom: 12px;
    letter-spacing: 0.5px;
}

.payment-header p {
    color: var(--text-muted);
    font-size: 0.95rem;
    font-weight: 300;
}

.payment-code {
    margin-top: 12px;
    color: rgba(255, 255, 255, 0.8);
    letter-spacing: 0.18em;
    text-transform: uppercase;
    font-size: 0.8rem;
}

.payment-referral {
    min-height: 20px;
    margin-top: 8px;
    color: rgba(255, 255, 255, 0.72);
    font-size: 0.82rem;
}

.payment-status {
    min-height: 22px;
    margin-top: 12px;
    font-size: 0.9rem;
    color: var(--text-muted);
    opacity: 0;
    transition: opacity 0.3s ease;
}

.payment-status.visible {
    opacity: 1;
}

.payment-status.is-error {
    color: var(--error-color);
}

.payment-status.is-success {
    color: rgba(255, 255, 255, 0.88);
}

.plans-container {
    display: flex;
    flex-direction: column;
    gap: 16px;
    width: 100%;
}

.plan-card {
    background: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: 20px;
    padding: 24px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    cursor: pointer;
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
    color: var(--text-color);
    outline: none;
    font-family: inherit;
    text-decoration: none;
}

.plan-card:hover {
    background: var(--bg-surface-hover);
    border-color: var(--border-hover);
    transform: translateY(-2px);
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.3);
}

.plan-card:active {
    transform: translateY(0);
}

.plan-card:disabled {
    opacity: 0.55;
    cursor: wait;
    transform: none;
    box-shadow: none;
}

.plan-duration {
    font-size: 1.1rem;
    font-weight: 400;
    z-index: 1;
}

.plan-price {
    font-size: 1.4rem;
    font-weight: 500;
    z-index: 1;
}

.currency {
    font-weight: 300;
    font-size: 1rem;
    color: var(--text-muted);
}

.plan-badge {
    position: absolute;
    top: 0;
    left: 50%;
    transform: translateX(-50%);
    background: var(--text-color);
    color: var(--bg-color);
    font-size: 0.7rem;
    font-weight: 600;
    padding: 3px 14px;
    border-bottom-left-radius: 10px;
    border-bottom-right-radius: 10px;
    text-transform: uppercase;
    letter-spacing: 1px;
}

/* Back button */
.back-btn {
    margin-top: 40px;
    background: transparent;
    border: none;
    color: var(--text-muted);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    font-size: 0.95rem;
    font-family: inherit;
    cursor: pointer;
    transition: color 0.3s ease;
    padding: 16px;
}

.back-btn:hover {
    color: var(--text-color);
}

.back-btn svg {
    width: 18px;
    height: 18px;
}

/* --- Download View --- */
#downloadView {
    justify-content: center;
    padding-top: 60px;
}

.download-header {
    text-align: center;
    margin-bottom: 30px;
}

.download-header h2 {
    font-size: 1.8rem;
    font-weight: 300;
    margin-bottom: 12px;
    letter-spacing: 0.5px;
}

.download-header p {
    color: var(--text-muted);
    font-size: 0.95rem;
    font-weight: 300;
}

.download-links {
    display: flex;
    flex-direction: column;
    gap: 16px;
    margin-bottom: 32px;
}

.download-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    text-decoration: none;
    padding: 18px 20px;
    border-radius: 30px;
    font-size: 1rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
}

.download-btn.active-btn {
    background: var(--text-color);
    color: var(--bg-color);
    border: 1px solid var(--text-color);
}

.download-btn.active-btn:hover {
    background: transparent;
    color: var(--text-color);
    box-shadow: 0 0 20px rgba(255, 255, 255, 0.2);
}

.download-btn svg {
    width: 20px;
    height: 20px;
}

.payment-result-card {
    margin-bottom: 24px;
}

.result-line {
    min-height: 22px;
    font-size: 0.95rem;
    line-height: 1.5;
    color: rgba(255, 255, 255, 0.9);
}

.result-line + .result-line {
    margin-top: 10px;
}

.result-actions {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.hidden {
    display: none;
}

.instructions-block {
    background: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: 20px;
    padding: 24px;
    color: var(--text-color);
}

.instructions-block h3 {
    font-size: 1.1rem;
    font-weight: 500;
    margin-bottom: 16px;
    color: var(--text-muted);
}

.instructions-block ol {
    margin: 0;
    padding-left: 20px;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.instructions-block li {
    font-size: 0.95rem;
    font-weight: 300;
    line-height: 1.4;
    color: rgba(255, 255, 255, 0.9);
}

.instructions-block li b {
    font-weight: 500;
    color: var(--text-color);
}
