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

:root {
    --bg: #0A0A0F;
    --bg-gradient: linear-gradient(135deg, #0A0A0F 0%, #111015 50%, #14121B 100%);
    --surface: #1D1C21;
    --surface-elevated: #25232A;
    --text: #FFFFFF;
    --text-secondary: #B8B7BB;
    --text-dim: #8E8D90;
    --blue: #1858E4;
    --blue-bright: #2968FF;
    --purple: #8B5CF6;
    --purple-bright: #A78BFA;
    --border: #28272C;
    --white: #FFFFFF;
    --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.3);
    --shadow-md: 0 4px 16px rgba(0, 0, 0, 0.4);
    --shadow-lg: 0 8px 32px rgba(0, 0, 0, 0.5);
    --shadow-glow: 0 0 20px rgba(24, 88, 228, 0.15);
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes pulse {
    0%, 100% {
        opacity: 1;
    }
    50% {
        opacity: 0.8;
    }
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Inter', sans-serif;
    background: var(--bg);
    background-image: var(--bg-gradient);
    background-attachment: fixed;
    color: var(--text);
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    position: relative;
    overflow-x: hidden;
}

body::before {
    content: '';
    position: fixed;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: radial-gradient(circle at 50% 50%, rgba(24, 88, 228, 0.03) 0%, transparent 50%);
    animation: pulse 8s ease-in-out infinite;
    pointer-events: none;
    z-index: 0;
}

.container {
    width: 100%;
    max-width: 500px;
    margin: 0 auto;
    position: relative;
    z-index: 1;
    animation: fadeIn 0.6s ease-out;
}

/* Header */
.page-header {
    text-align: center;
    margin-bottom: 48px;
    margin-top: 10vh;
    animation: fadeIn 0.6s ease-out;
}

.page-title {
    font-size: 40px;
    font-weight: 800;
    margin-bottom: 8px;
    background: linear-gradient(135deg, var(--text) 0%, var(--text-secondary) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    letter-spacing: -0.5px;
}

.page-subtitle {
    font-size: 16px;
    color: var(--text-dim);
    font-weight: 500;
    letter-spacing: 0.3px;
}

/* QR Code */
.qr-wrapper {
    margin-bottom: 32px;
    position: relative;
}

.claim-btn {
    width: 100%;
    margin-top: 20px;
    padding: 16px 24px;
    background: linear-gradient(135deg, var(--blue) 0%, var(--blue-bright) 100%);
    color: var(--white);
    border: none;
    border-radius: 16px;
    font-size: 16px;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 4px 16px rgba(24, 88, 228, 0.4);
    position: relative;
    overflow: hidden;
    z-index: 1;
}

.claim-btn > * {
    position: relative;
    z-index: 2;
}

.claim-btn::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, var(--purple) 0%, var(--purple-bright) 100%);
    opacity: 0;
    transition: opacity 0.3s ease;
}

.claim-btn:hover::before {
    opacity: 1;
}

.claim-btn:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 24px rgba(24, 88, 228, 0.5);
}

.claim-btn:active {
    transform: translateY(0);
    box-shadow: 0 4px 12px rgba(24, 88, 228, 0.4);
}

#qr-container {
    background: transparent;
    border-radius: 28px;
    padding: 0;
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 340px;
    position: relative;
    overflow: hidden;
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}


#qrcode {
    display: flex;
    justify-content: center;
    align-items: center;
    position: relative;
    z-index: 1;
    width: 100%;
}

#qrcode img,
#qrcode canvas {
    border-radius: 16px;
    transition: transform 0.3s ease;
    width: 100% !important;
    height: auto !important;
}

#qrcode:hover img,
#qrcode:hover canvas {
    transform: scale(1.02);
}

#animated-qr {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0;
    position: relative;
    z-index: 1;
    width: 100%;
}

#qr-canvas {
    border-radius: 16px;
    margin-bottom: 12px;
    width: 100% !important;
    height: auto !important;
}

.qr-progress {
    background: rgba(10, 10, 15, 0.85);
    padding: 6px 14px;
    border-radius: 12px;
    font-size: 11px;
    color: var(--text-secondary);
    font-weight: 600;
    box-shadow: var(--shadow-sm);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.08);
}

.qr-info {
    display: none;
}

/* Info Grid */
.info-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 14px;
    margin-bottom: 14px;
}

.info-item {
    background: var(--surface);
    padding: 24px;
    border-radius: 20px;
    border: 1px solid rgba(255, 255, 255, 0.03);
    box-shadow: var(--shadow-md);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    overflow: hidden;
}

.info-item::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 2px;
    background: linear-gradient(90deg, var(--blue), var(--purple));
    opacity: 0;
    transition: opacity 0.3s ease;
}

.info-item:hover {
    transform: translateY(-2px);
    background: var(--surface-elevated);
    box-shadow: var(--shadow-lg);
    border-color: rgba(255, 255, 255, 0.06);
}

.info-item:hover::before {
    opacity: 1;
}

.info-item.full {
    margin-bottom: 14px;
}

.info-label {
    display: block;
    font-size: 13px;
    color: var(--text-dim);
    margin-bottom: 8px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.info-value {
    display: block;
    font-size: 28px;
    color: var(--text);
    font-weight: 700;
    background: linear-gradient(135deg, var(--text) 0%, var(--text-secondary) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.info-value.small {
    font-size: 14px;
    word-break: break-all;
    line-height: 1.6;
    color: var(--text-secondary);
    -webkit-text-fill-color: var(--text-secondary);
    font-weight: 500;
}

/* Advanced Section */
.advanced-section {
    margin-top: 14px;
}

.advanced-toggle {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: var(--surface);
    padding: 18px 24px;
    border-radius: 16px;
    border: 1px solid rgba(255, 255, 255, 0.03);
    color: var(--text);
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: var(--shadow-sm);
}

.advanced-toggle:hover {
    background: var(--surface-elevated);
    border-color: rgba(255, 255, 255, 0.06);
    box-shadow: var(--shadow-md);
}

.advanced-toggle .chevron {
    transition: transform 0.3s ease;
}

.advanced-toggle.open .chevron {
    transform: rotate(180deg);
}

.advanced-content {
    margin-top: 14px;
    overflow: hidden;
    transition: all 0.3s ease;
}

/* Token Section */
.token-section {
    background: var(--surface);
    border-radius: 20px;
    padding: 24px;
    border: 1px solid rgba(255, 255, 255, 0.03);
    box-shadow: var(--shadow-md);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.token-section:hover {
    background: var(--surface-elevated);
    box-shadow: var(--shadow-lg);
    border-color: rgba(255, 255, 255, 0.06);
}

.token-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
}

.token-label {
    font-size: 13px;
    color: var(--text-dim);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.copy-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 20px;
    background: linear-gradient(135deg, var(--blue) 0%, var(--blue-bright) 100%);
    color: var(--white);
    border: none;
    border-radius: 12px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 4px 12px rgba(24, 88, 228, 0.3);
    position: relative;
    overflow: hidden;
}

.copy-btn::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, var(--purple) 0%, var(--purple-bright) 100%);
    opacity: 0;
    transition: opacity 0.3s ease;
}

.copy-btn:hover::before {
    opacity: 1;
}

.copy-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(24, 88, 228, 0.4);
}

.copy-btn:active {
    transform: translateY(0);
    box-shadow: 0 2px 8px rgba(24, 88, 228, 0.3);
}

.copy-btn svg,
.copy-btn span {
    position: relative;
    z-index: 1;
}

#decoded-token {
    font-family: 'SF Mono', 'JetBrains Mono', Monaco, monospace;
    font-size: 13px;
    color: var(--text-secondary);
    background: var(--bg);
    padding: 20px;
    border-radius: 12px;
    overflow-x: auto;
    white-space: pre-wrap;
    word-break: break-all;
    max-height: 320px;
    overflow-y: auto;
    line-height: 1.7;
    border: 1px solid rgba(255, 255, 255, 0.05);
    box-shadow: inset 0 2px 8px rgba(0, 0, 0, 0.3);
    transition: all 0.3s ease;
}

#decoded-token:hover {
    background: #0D0D12;
    border-color: rgba(255, 255, 255, 0.08);
}

#decoded-token::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

#decoded-token::-webkit-scrollbar-track {
    background: transparent;
    border-radius: 4px;
}

#decoded-token::-webkit-scrollbar-thumb {
    background: var(--border);
    border-radius: 4px;
    transition: background 0.2s ease;
}

#decoded-token::-webkit-scrollbar-thumb:hover {
    background: #3A383F;
}

/* No Token State */
.no-token {
    text-align: center;
    padding: 80px 30px;
    animation: fadeIn 0.6s ease-out;
}

.no-token-icon {
    font-size: 80px;
    margin-bottom: 24px;
    opacity: 0.5;
    filter: grayscale(0.3);
    transition: all 0.3s ease;
    display: inline-block;
}

.no-token:hover .no-token-icon {
    opacity: 0.8;
    transform: scale(1.1) rotate(5deg);
    filter: grayscale(0);
}

.no-token h2 {
    font-size: 28px;
    color: var(--text);
    margin-bottom: 16px;
    font-weight: 700;
}

.no-token p {
    color: var(--text-dim);
    margin-bottom: 24px;
    font-size: 16px;
    line-height: 1.6;
}

.no-token code {
    display: inline-block;
    background: var(--surface);
    padding: 16px 24px;
    border-radius: 12px;
    font-family: 'SF Mono', 'JetBrains Mono', Monaco, monospace;
    color: var(--blue);
    font-size: 14px;
    border: 1px solid rgba(255, 255, 255, 0.05);
    box-shadow: var(--shadow-md);
    transition: all 0.3s ease;
}

.no-token code:hover {
    background: var(--surface-elevated);
    border-color: rgba(24, 88, 228, 0.3);
    box-shadow: var(--shadow-lg), 0 0 20px rgba(24, 88, 228, 0.15);
    transform: translateY(-2px);
}

/* Error */
.error {
    background: linear-gradient(135deg, #D04C68 0%, #B83B55 100%);
    color: white;
    padding: 18px 24px;
    border-radius: 16px;
    margin-bottom: 24px;
    font-size: 14px;
    font-weight: 600;
    box-shadow: var(--shadow-md), 0 0 20px rgba(208, 76, 104, 0.3);
    border: 1px solid rgba(255, 255, 255, 0.1);
    animation: fadeIn 0.4s ease-out;
    backdrop-filter: blur(10px);
}

/* Utility */
.hidden {
    display: none !important;
}

/* Token Display Animation */
#token-display {
    animation: fadeIn 0.6s ease-out;
}

/* Stagger animations for info items */
.info-grid .info-item:nth-child(1) {
    animation: fadeIn 0.6s ease-out 0.1s backwards;
}

.info-grid .info-item:nth-child(2) {
    animation: fadeIn 0.6s ease-out 0.15s backwards;
}

.info-grid .info-item:nth-child(3) {
    animation: fadeIn 0.6s ease-out 0.2s backwards;
}

.info-item.full {
    animation: fadeIn 0.6s ease-out 0.3s backwards;
}

.token-section {
    animation: fadeIn 0.6s ease-out 0.4s backwards;
}

/* Responsive */
@media (max-width: 600px) {
    body {
        padding: 16px;
    }

    .page-header {
        margin-top: 10vh;
        margin-bottom: 36px;
    }

    .page-title {
        font-size: 32px;
    }

    .page-subtitle {
        font-size: 14px;
    }

    #qr-container {
        padding: 28px;
        min-height: 300px;
        border-radius: 24px;
    }

    .info-grid {
        gap: 12px;
        margin-bottom: 12px;
    }

    .info-item {
        padding: 20px;
    }

    .info-item.full {
        margin-bottom: 12px;
    }

    .info-value {
        font-size: 24px;
    }

    .no-token {
        padding: 60px 20px;
    }

    .no-token-icon {
        font-size: 64px;
    }

    .no-token h2 {
        font-size: 24px;
    }

    .no-token code {
        padding: 14px 20px;
        font-size: 12px;
    }


    .token-section {
        padding: 20px;
    }

    #decoded-token {
        padding: 16px;
        font-size: 12px;
        max-height: 250px;
    }

    .copy-btn {
        padding: 8px 16px;
        font-size: 13px;
        gap: 6px;
    }
}

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

    .page-header {
        margin-top: 10vh;
    }
}

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

    .qr-wrapper {
        margin-bottom: 24px;
    }
}
