:root {
    --primary: #0088cc;
    --primary-dark: #006699;
    --primary-light: #00a8ff;
    --background: #0a0a0f;
    --surface: rgba(255, 255, 255, 0.08);
    --surface-light: rgba(255, 255, 255, 0.12);
    --surface-dark: rgba(0, 0, 0, 0.3);
    --text-primary: #ffffff;
    --text-secondary: rgba(255, 255, 255, 0.7);
    --text-tertiary: rgba(255, 255, 255, 0.5);
    --success: #00d4aa;
    --warning: #ffb800;
    --error: #ff4757;
    --border: rgba(255, 255, 255, 0.1);
    --border-light: rgba(255, 255, 255, 0.05);
    --gradient: linear-gradient(135deg, #0088cc 0%, #00d4aa 100%);
    --glass: rgba(255, 255, 255, 0.1);
    --glass-border: rgba(255, 255, 255, 0.2);
    --shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
    --shadow-small: 0 4px 16px rgba(0, 0, 0, 0.2);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent;
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
    user-select: none;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background: var(--background);
    color: var(--text-primary);
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
    -webkit-tap-highlight-color: transparent;
    overflow-x: hidden;
    min-height: 100vh;
}

/* Liquid Background */
.liquid-background {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: -1;
    overflow: hidden;
}

.liquid-blob {
    position: absolute;
    border-radius: 50%;
    filter: blur(40px);
    opacity: 0.1;
    animation: float 20s infinite ease-in-out;
}

.blob-1 {
    width: 300px;
    height: 300px;
    background: var(--primary);
    top: -100px;
    left: -100px;
    animation-delay: 0s;
}

.blob-2 {
    width: 400px;
    height: 400px;
    background: var(--success);
    bottom: -150px;
    right: -100px;
    animation-delay: -5s;
}

.blob-3 {
    width: 250px;
    height: 250px;
    background: var(--primary-light);
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    animation-delay: -10s;
}

/* Animations */
@keyframes float {
    0%, 100% { transform: translate(0, 0) scale(1); }
    25% { transform: translate(20px, 20px) scale(1.1); }
    50% { transform: translate(-15px, 15px) scale(0.9); }
    75% { transform: translate(10px, -10px) scale(1.05); }
}

@keyframes glow {
    from { box-shadow: 0 0 20px rgba(0, 136, 204, 0.3); }
    to { box-shadow: 0 0 30px rgba(0, 212, 170, 0.4); }
}

@keyframes pulse {
    0% { box-shadow: 0 0 0 0 rgba(0, 136, 204, 0.4); }
    70% { box-shadow: 0 0 0 10px rgba(0, 136, 204, 0); }
    100% { box-shadow: 0 0 0 0 rgba(0, 136, 204, 0); }
}

@keyframes bounce {
    0%, 20%, 50%, 80%, 100% { transform: translateY(0); }
    40% { transform: translateY(-10px); }
    60% { transform: translateY(-5px); }
}

@keyframes slideInUp {
    from { opacity: 0; transform: translateY(30px); }
    to { opacity: 1; transform: translateY(0); }
}

@keyframes slideDown {
    from { opacity: 0; max-height: 0; }
    to { opacity: 1; max-height: 100px; }
}

@keyframes errorShake {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-5px); }
    75% { transform: translateX(5px); }
}

@keyframes loading {
    0% { left: -100%; }
    100% { left: 100%; }
}

@keyframes avatarGlow {
    0%, 100% { box-shadow: 0 0 20px rgba(0, 136, 204, 0.3); }
    50% { box-shadow: 0 0 30px rgba(0, 212, 170, 0.5); }
}

@keyframes itemAppear {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}

/* Glass Morphism Components */
.glass-card {
    background: var(--glass);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid var(--glass-border);
    border-radius: 24px;
    box-shadow: var(--shadow);
    position: relative;
    overflow: hidden;
}

.glass-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 1px;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.3), transparent);
}

/* Header */
.header {
    position: sticky;
    top: 0;
    z-index: 1000;
    padding: 8px;
    margin: 8px 8px 0;
    border-radius: 16px;
    background: rgba(10, 10, 15, 0.9);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-bottom: 1px solid var(--border);
}

.header-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
}

.logo {
    display: flex;
    align-items: center;
    gap: 12px;
    flex: 1;
}

.logo-icon {
    width: 40px;
    height: 40px;
    background: var(--gradient);
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2em;
    animation: glow 2s ease-in-out infinite alternate;
}

.logo-text {
    font-weight: 700;
    font-size: 1.3em;
    background: var(--gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

/* Main Content */
.main-content {
    padding: 20px 16px 80px;
    max-width: 500px;
    margin: 0 auto;
    width: 100%;
}

/* Sections */
.section {
    display: none;
}

.section.active {
    display: block;
    animation: slideInUp 0.3s ease-out;
}

/* Hero Section */
.hero-section {
    text-align: center;
    padding: 40px 0 30px;
    margin-bottom: 20px;
}

.hero-icon {
    font-size: 4em;
    margin-bottom: 16px;
    background: var(--gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    animation: bounce 2s infinite;
}

.hero-title {
    font-size: 2.5em;
    font-weight: 800;
    margin-bottom: 8px;
    background: var(--gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.hero-subtitle {
    color: var(--text-secondary);
    font-size: 1.1em;
}

/* Cards */
.purchase-card {
    padding: 24px;
    margin-bottom: 20px;
}

.card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 24px;
}

.card-header h2 {
    font-size: 1.4em;
    font-weight: 700;
}

.card-badge {
    background: var(--gradient);
    color: white;
    padding: 6px 12px;
    border-radius: 12px;
    font-size: 0.8em;
    font-weight: 600;
    animation: pulse 2s infinite;
}

/* Form Elements */
.form-group {
    margin-bottom: 24px;
}

.form-label {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
    font-weight: 600;
    color: var(--text-primary);
}

.text-button {
    background: none;
    border: none;
    color: var(--primary);
    font-size: 0.9em;
    cursor: pointer;
    font-weight: 600;
    transition: all 0.3s ease;
}

.text-button:hover {
    color: var(--primary-light);
    transform: translateY(-1px);
}

.glass-input {
    width: 100%;
    padding: 16px;
    background: var(--surface-dark);
    border: 1px solid var(--border);
    border-radius: 16px;
    font-size: 16px;
    color: var(--text-primary);
    transition: all 0.3s ease;
    backdrop-filter: blur(10px);
}

.glass-input:focus {
    outline: none;
    border-color: var(--primary);
    background: var(--surface-light);
    box-shadow: 0 0 0 3px rgba(0, 136, 204, 0.1);
}

.glass-input::placeholder {
    color: var(--text-tertiary);
}

/* Stars Grid */
.stars-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
    margin-bottom: 16px;
}

.star-option {
    background: var(--surface-dark);
    border: 1px solid var(--border);
    border-radius: 16px;
    padding: 12px 6px;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    min-height: 60px;
    position: relative;
    overflow: hidden;
}

.star-option::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.1), transparent);
    transition: left 0.5s;
}

.star-option:hover::before {
    left: 100%;
}

.star-option:hover {
    border-color: var(--primary-light);
    transform: translateY(-2px);
}

.star-option.active {
    background: var(--primary);
    border-color: var(--primary);
    transform: scale(1.05);
    box-shadow: 0 8px 25px rgba(0, 136, 204, 0.3);
}

.star-count {
    font-weight: 700;
    font-size: 0.9em;
    text-align: center;
    width: 100%;
    z-index: 1;
}

.star-icon {
    font-size: 1.3em;
    z-index: 1;
}

/* Payment Select */
.custom-select {
    position: relative;
    width: 100%;
}

.select-header {
    background: var(--surface-dark);
    border: 1px solid var(--border);
    border-radius: 16px;
    padding: 16px;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.select-header:hover {
    border-color: var(--primary-light);
}

.selected-option {
    display: flex;
    align-items: center;
    gap: 12px;
}

.method-icon {
    font-size: 1.2em;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--surface);
    border-radius: 8px;
}

.select-arrow {
    transition: transform 0.3s ease;
}

.select-header.active .select-arrow {
    transform: rotate(180deg);
}

.select-options {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: var(--surface-dark);
    border: 1px solid var(--border);
    border-radius: 16px;
    margin-top: 8px;
    overflow: hidden;
    z-index: 1000;
    backdrop-filter: blur(20px);
    transform: translateY(-10px);
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
}

.select-options.active {
    transform: translateY(0);
    opacity: 1;
    visibility: visible;
}

.select-option {
    padding: 16px;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-bottom: 1px solid var(--border-light);
}

.select-option:last-child {
    border-bottom: none;
}

.select-option:hover {
    background: var(--surface-light);
}

.select-option.active {
    background: var(--primary);
}

.option-content {
    display: flex;
    align-items: center;
    gap: 12px;
}

.option-check {
    opacity: 0;
    transition: opacity 0.3s ease;
}

.select-option.active .option-check {
    opacity: 1;
}

/* Price Card */
.price-card {
    background: var(--surface-dark);
    border-radius: 16px;
    padding: 16px;
    margin: 16px 0;
    border: 1px solid var(--border);
    transition: all 0.3s ease;
}

.price-line {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 1.1em;
    font-weight: 600;
    width: 100%;
}

.price-line:last-child {
    margin-bottom: 0;
}

.price-amount {
    color: var(--primary);
    font-weight: 700;
}

.bonus-info {
    border-top: 1px solid var(--border);
    padding-top: 12px;
    margin-top: 12px;
    animation: slideDown 0.3s ease-out;
    display: none;
}

.bonus-info.active {
    display: flex;
}

/* Buttons */
.liquid-button {
    width: 100%;
    padding: 18px 24px;
    background: var(--gradient);
    color: white;
    border: none;
    border-radius: 16px;
    font-size: 1.1em;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 8px;
    position: relative;
    overflow: hidden;
}

.liquid-button::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.2), transparent);
    transition: left 0.5s;
}

.liquid-button:hover::before {
    left: 100%;
}

.liquid-button:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(0, 136, 204, 0.4);
}

.liquid-button:active {
    transform: translateY(0);
}

/* Bottom Navigation */
.bottom-nav {
    position: fixed;
    bottom: 8px;
    left: 8px;
    right: 8px;
    background: rgba(10, 10, 15, 0.9);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid var(--border);
    border-radius: 20px;
    display: flex;
    justify-content: space-around;
    padding: 6px 10px;
    z-index: 1000;
}

.nav-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    padding: 6px 12px;
    border-radius: 16px;
    cursor: pointer;
    transition: all 0.3s ease;
    opacity: 0.6;
    min-width: 60px;
}

.nav-item:hover {
    opacity: 0.8;
    transform: translateY(-2px);
}

.nav-item.active {
    opacity: 1;
    background: var(--surface);
    transform: translateY(-4px);
}

.nav-icon {
    font-size: 1.1em;
    transition: all 0.3s ease;
}

.nav-item.active .nav-icon {
    transform: scale(1.1);
}

.nav-item span {
    font-size: 0.65em;
    font-weight: 600;
}

.nav-item.active span {
    color: var(--primary);
}

/* Profile Section */
.profile-header {
    text-align: center;
    padding: 30px 0;
    margin-bottom: 20px;
}

.avatar {
    width: 100px;
    height: 100px;
    background: var(--gradient);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 16px;
    font-size: 2em;
    animation: avatarGlow 3s ease-in-out infinite;
}

.cards-container {
    width: 100%;
}

/* History Section */
.history-item {
    background: var(--surface);
    border-radius: 16px;
    padding: 16px;
    margin-bottom: 12px;
    border: 1px solid var(--border);
    transition: all 0.3s ease;
}

.history-item:hover {
    transform: translateY(-2px);
    border-color: var(--primary-light);
}

.history-item.minimal {
    opacity: 1 !important;
    transform: none !important;
    animation: none !important;
}

/* Error Messages */
.error-message {
    color: var(--error);
    font-size: 0.8em;
    margin-top: 8px;
    padding: 8px 12px;
    background: rgba(239, 68, 68, 0.1);
    border: 1px solid var(--error);
    border-radius: 8px;
    animation: errorShake 0.3s ease-out;
    display: none;
}

.error-message.show {
    display: block;
}

.error-message.hiding {
    animation: none;
}

/* Loading States */
.loading {
    position: relative;
    overflow: hidden;
}

.loading::after {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.1), transparent);
    animation: loading 1.5s infinite;
}

/* Custom TON Connect button styles */
.tc-btn-container {
    min-width: 120px;
}

.tc-btn {
    background: var(--surface) !important;
    border: 1px solid var(--border) !important;
    border-radius: 12px !important;
    color: var(--text-primary) !important;
    padding: 8px 16px !important;
    font-family: inherit !important;
    cursor: pointer !important;
    font-size: 14px !important;
    transition: all 0.3s ease !important;
}

.tc-btn:hover {
    background: var(--surface-light) !important;
    border-color: var(--primary) !important;
    transform: translateY(-1px) !important;
}

/* Stars balance display */
.stars-balance {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 8px 12px;
    display: flex;
    align-items: center;
    gap: 8px;
    color: var(--text-primary);
    font-weight: 600;
    font-size: 0.9em;
}

.stars-balance-icon {
    color: gold;
    font-size: 1.1em;
}

/* Pagination */
.pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 12px;
    margin: 20px auto 0;
    padding: 0 16px;
    max-width: 100%;
    width: 100%;
}

.pagination button {
    padding: 10px 16px;
    border: none;
    border-radius: 12px;
    cursor: pointer;
    background: var(--surface);
    color: var(--text-primary);
    border: 1px solid var(--border);
    transition: all 0.3s ease;
    font-size: 0.9em;
    font-weight: 600;
    min-width: 80px;
    white-space: nowrap;
    flex-shrink: 0;
}

.pagination button:hover:not(:disabled) {
    background: var(--primary);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 136, 204, 0.3);
}

.pagination button:disabled {
    opacity: 0.4;
    cursor: not-allowed;
    transform: none;
}

.pagination span {
    color: var(--text-secondary);
    font-size: 0.9em;
    font-weight: 500;
    min-width: 120px;
    text-align: center;
    flex-shrink: 0;
}

.selected-option .method-desc {
    display: none;
}

#history {
    padding-bottom: 20px;
}

#historyList {
    width: 100%;
    max-width: 100%;
}
/* Allow text selection for inputs and textareas */
input, textarea, [contenteditable="true"] {
    -webkit-user-select: text;
    -moz-user-select: text;
    -ms-user-select: text;
    user-select: text;
}

.avatar img {
    width: 100%;
    height: 100%;
    border-radius: 50%;
    object-fit: cover;
}

.avatar span {
    font-size: 2em;
}
