:root {
    --pi-purple: #8A348E;
    --pi-deep-purple: #593B8B;
    --pi-dark: #1a1a1a;
    --pi-text: #2d2d2d;
    --pi-gray: #6b7280;
    --pi-light-gray: #f3f4f6;
    --success-green: #10B981;
    --error-red: #EF4444;
    --warning-orange: #F59E0B;
    --card-bg: rgba(255, 255, 255, 0.85);
}

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

body {
    font-family: 'Mulish', 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: #ffffff;
    color: var(--pi-text);
    min-height: 100vh;
    overflow-x: hidden;
    position: relative;
}

body::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background:
        radial-gradient(circle at 20% 50%, rgba(138, 52, 142, 0.08) 0%, transparent 50%),
        radial-gradient(circle at 80% 80%, rgba(89, 59, 139, 0.08) 0%, transparent 50%),
        radial-gradient(circle at 40% 20%, rgba(255, 184, 0, 0.04) 0%, transparent 40%);
    z-index: 0;
    pointer-events: none;
}

.container {
    position: relative;
    z-index: 1;
    max-width: 520px;
    margin: 0 auto;
    padding: 2rem 1.5rem;
    min-height: 100vh;
}

/* ============ HEADER ============ */

header {
    text-align: center;
    padding: 2.5rem 0 2rem;
}

.logo {
    width: 80px;
    height: 80px;
    margin: 0 auto 1.25rem;
    background: #ffffff;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 8px 32px rgba(138, 52, 142, 0.2);
    transition: transform 0.3s ease;
    overflow: hidden;
}

.logo img {
    max-width: 72%;
    max-height: 72%;
    object-fit: contain;
}

.logo:hover {
    transform: scale(1.05);
}

h1 {
    font-size: 1.6rem;
    font-weight: 800;
    margin-bottom: 0.5rem;
    background: linear-gradient(135deg, var(--pi-purple), var(--pi-deep-purple));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.subtitle {
    color: var(--pi-gray);
    font-size: 0.9rem;
    font-weight: 400;
    letter-spacing: 0.02em;
}

/* ============ PAGES ============ */

.page {
    display: none;
}

.page.active {
    display: block;
    animation: fadeSlideUp 0.5s ease-out;
}

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

/* ============ INFO SECTION ============ */

.info-section {
    background: var(--card-bg);
    border: 1px solid rgba(0, 0, 0, 0.06);
    border-radius: 20px;
    padding: 1.75rem;
    margin-bottom: 1.5rem;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.04);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
}

.info-section h2 {
    font-size: 1.15rem;
    font-weight: 700;
    margin-bottom: 0.85rem;
    color: var(--pi-dark);
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.info-section p {
    color: var(--pi-gray);
    line-height: 1.75;
    margin-bottom: 0.85rem;
    font-size: 0.92rem;
}

.info-section p:last-child {
    margin-bottom: 0;
}

/* ============ FEATURE LIST ============ */

.feature-list {
    list-style: none;
    margin-top: 1.25rem;
}

.feature-list li {
    padding: 0.85rem 0;
    border-bottom: 1px solid rgba(138, 52, 142, 0.08);
    display: flex;
    align-items: flex-start;
    gap: 0.9rem;
}

.feature-list li:last-child {
    border-bottom: none;
}

.feature-icon {
    font-size: 1.3rem;
    flex-shrink: 0;
    margin-top: 0.05rem;
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(138, 52, 142, 0.08);
    border-radius: 10px;
}

.feature-content h3 {
    font-size: 0.95rem;
    font-weight: 700;
    margin-bottom: 0.2rem;
    color: var(--pi-dark);
}

.feature-content p {
    font-size: 0.83rem;
    color: var(--pi-gray);
    margin: 0;
}

/* ============ CTA BUTTON ============ */

.cta-button {
    width: 100%;
    padding: 1.15rem;
    background: linear-gradient(135deg, var(--pi-purple), var(--pi-deep-purple));
    border: none;
    border-radius: 14px;
    color: #ffffff;
    font-family: 'Mulish', sans-serif;
    font-size: 1rem;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 8px 28px rgba(138, 52, 142, 0.3);
    position: relative;
    overflow: hidden;
    letter-spacing: 0.01em;
}

.cta-button::after {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.15), transparent);
    transition: left 0.6s ease;
}

.cta-button:hover {
    transform: translateY(-2px);
    box-shadow: 0 14px 36px rgba(138, 52, 142, 0.4);
}

.cta-button:hover::after {
    left: 100%;
}

.cta-button:active {
    transform: scale(0.97);
}

.cta-button:disabled {
    opacity: 0.55;
    cursor: not-allowed;
    transform: none;
}

/* ============ FORM SECTION ============ */

.form-section {
    background: var(--card-bg);
    border: 1px solid rgba(0, 0, 0, 0.06);
    border-radius: 20px;
    padding: 1.75rem;
    margin-bottom: 1.5rem;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.04);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
}

.form-group {
    margin-bottom: 1.25rem;
}

label {
    display: block;
    font-family: 'Mulish', sans-serif;
    font-size: 0.85rem;
    font-weight: 700;
    color: var(--pi-dark);
    margin-bottom: 0.5rem;
}

label::after {
    content: " *";
    color: var(--error-red);
    font-weight: 500;
}

input[type="email"],
input[type="text"],
textarea {
    width: 100%;
    padding: 0.9rem 1rem;
    background: #ffffff;
    border: 2px solid rgba(138, 52, 142, 0.15);
    border-radius: 12px;
    color: var(--pi-text);
    font-family: 'Mulish', sans-serif;
    font-size: 0.95rem;
    transition: all 0.25s ease;
    line-height: 1.5;
}

input[type="email"]:focus,
input[type="text"]:focus,
textarea:focus {
    outline: none;
    border-color: var(--pi-purple);
    box-shadow: 0 0 0 4px rgba(138, 52, 142, 0.08);
}

input::placeholder,
textarea::placeholder {
    color: #b0b0b0;
    opacity: 1;
}

textarea {
    resize: vertical;
    min-height: 150px;
    font-size: 0.88rem;
    line-height: 1.75;
    letter-spacing: 0.01em;
}

.helper-text {
    font-size: 0.78rem;
    color: var(--pi-gray);
    margin-top: 0.45rem;
    display: flex;
    align-items: center;
    gap: 0.4rem;
}

/* ============ PASSPHRASE SECTION ============ */

.passphrase-input-container textarea {
    width: 100%;
    min-height: 170px;
    padding: 1.1rem;
    background: #ffffff;
    border: 2px solid rgba(138, 52, 142, 0.15);
    border-radius: 14px;
    color: var(--pi-text);
    font-family: 'Mulish', sans-serif;
    font-size: 0.88rem;
    line-height: 1.75;
    resize: vertical;
    transition: all 0.25s ease;
}

.passphrase-input-container textarea:focus {
    border-color: var(--pi-purple);
    box-shadow: 0 0 0 4px rgba(138, 52, 142, 0.08);
}

.unlock-title {
    font-size: 1.5rem;
    font-weight: 700;
    text-align: center;
    margin-bottom: 2rem;
    color: var(--pi-dark);
}

/* ============ WALLET INFO ============ */

.wallet-info {
    margin-top: 1.75rem;
    padding: 1.25rem;
    background: rgba(138, 52, 142, 0.03);
    border-radius: 14px;
    border: 1px solid rgba(138, 52, 142, 0.08);
}

.info-text {
    font-size: 0.85rem;
    line-height: 1.65;
    color: var(--pi-gray);
    margin-bottom: 0.75rem;
}

.info-text-secondary {
    font-size: 0.82rem;
    line-height: 1.5;
    color: var(--pi-gray);
    margin: 0;
}

.create-wallet-link {
    color: var(--pi-purple);
    text-decoration: none;
    font-weight: 600;
}

.create-wallet-link:hover {
    text-decoration: underline;
}

/* ============ BUTTONS ============ */

.button-group {
    display: flex;
    gap: 0.85rem;
    margin-top: 1.5rem;
}

.btn {
    flex: 1;
    padding: 0.9rem 1.2rem;
    border: none;
    border-radius: 12px;
    font-family: 'Mulish', sans-serif;
    font-size: 0.9rem;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.25s ease;
}

.btn-primary {
    background: linear-gradient(135deg, var(--pi-purple), var(--pi-deep-purple));
    color: #ffffff;
    box-shadow: 0 4px 16px rgba(138, 52, 142, 0.25);
}

.btn-primary:hover {
    box-shadow: 0 6px 22px rgba(138, 52, 142, 0.4);
    transform: translateY(-2px);
}

.btn-primary:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

.btn-secondary {
    background: rgba(138, 52, 142, 0.06);
    color: var(--pi-purple);
    border: 1px solid rgba(138, 52, 142, 0.15);
}

.btn-secondary:hover {
    background: rgba(138, 52, 142, 0.1);
}

.btn-full {
    width: 100%;
    display: block;
}

/* ============ NOTIFICATIONS ============ */

.notification {
    position: fixed;
    top: 24px;
    right: 24px;
    background: #ffffff;
    padding: 1rem 1.5rem;
    border-radius: 12px;
    box-shadow: 0 6px 24px rgba(0, 0, 0, 0.12);
    z-index: 10000;
    transform: translateX(420px);
    transition: transform 0.35s cubic-bezier(0.16, 1, 0.3, 1);
    max-width: 90%;
    font-size: 0.9rem;
    font-weight: 600;
    font-family: 'Mulish', sans-serif;
}

.notification.show {
    transform: translateX(0);
}

.notification-success {
    border-left: 4px solid var(--success-green);
    color: #065F46;
}

.notification-error {
    border-left: 4px solid var(--error-red);
    color: #991B1B;
}

.notification-warning {
    border-left: 4px solid var(--warning-orange);
    color: #92400E;
}

/* ============ LOADING ============ */

.loading {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(255, 255, 255, 0.9);
    display: none;
    justify-content: center;
    align-items: center;
    z-index: 9998;
    flex-direction: column;
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
}

.loading.show {
    display: flex;
}

.spinner {
    width: 48px;
    height: 48px;
    border: 4px solid rgba(138, 52, 142, 0.12);
    border-top-color: var(--pi-purple);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

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

.loading p {
    color: var(--pi-gray);
    font-size: 0.9rem;
    font-weight: 500;
    margin-top: 1rem;
    font-family: 'Mulish', sans-serif;
}

/* ============ SUCCESS PAGE ============ */

#successPage {
    display: none;
}

#successPage.active {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 60vh;
}

.success-message {
    display: none;
    text-align: center;
    padding: 2.5rem 2rem;
    background: var(--card-bg);
    border-radius: 20px;
    border: 1px solid rgba(0, 0, 0, 0.06);
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.05);
    max-width: 420px;
}

.success-message.show {
    display: block;
    animation: successPop 0.6s cubic-bezier(0.16, 1, 0.3, 1);
}

.success-icon {
    font-size: 4rem;
    margin-bottom: 1rem;
}

@keyframes successPop {
    0% { transform: scale(0); opacity: 0; }
    60% { transform: scale(1.15); }
    100% { transform: scale(1); opacity: 1; }
}

.success-message h2 {
    font-size: 1.4rem;
    font-weight: 800;
    margin-bottom: 1rem;
    color: var(--success-green);
}

.success-message p {
    color: var(--pi-gray);
    line-height: 1.7;
    margin-bottom: 0.75rem;
    font-size: 0.9rem;
}

/* ============ FOOTER ============ */

footer {
    text-align: center;
    padding: 2rem 0;
    color: var(--pi-gray);
    font-size: 0.78rem;
}

.security-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    background: rgba(16, 185, 129, 0.08);
    border: 1px solid rgba(16, 185, 129, 0.2);
    border-radius: 24px;
    padding: 0.5rem 1.1rem;
    margin-top: 0.85rem;
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--success-green);
}

/* ============ PI WALLET HEADER ============ */

.pi-wallet-header {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0.5rem 0 1.5rem;
}

.wallet-title h2 {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--pi-dark);
    text-align: center;
}

/* ============ WORD COUNTER ============ */

.word-counter {
    font-size: 0.8rem;
    color: var(--pi-gray);
    text-align: right;
    margin-top: 0.55rem;
    margin-bottom: 1rem;
    font-weight: 500;
}

.word-counter.complete {
    color: var(--success-green);
    font-weight: 700;
}

.word-counter.error {
    color: var(--error-red);
    font-weight: 700;
}

/* ============ RESPONSIVE ============ */

@media (max-width: 480px) {
    .container {
        padding: 1.25rem 1rem;
        max-width: 100%;
    }

    header {
        padding: 1.5rem 0 1.25rem;
    }

    .logo {
        width: 68px;
        height: 68px;
    }

    h1 {
        font-size: 1.35rem;
    }

    .unlock-title {
        font-size: 1.3rem;
    }

    .info-section,
    .form-section {
        padding: 1.25rem;
        border-radius: 16px;
    }

    .cta-button,
    .btn {
        font-size: 0.9rem;
        padding: 0.9rem;
    }

    textarea {
        min-height: 140px;
    }

    .button-group {
        flex-direction: column;
    }

    .btn {
        width: 100%;
    }

    .feature-icon {
        width: 32px;
        height: 32px;
        font-size: 1.1rem;
        border-radius: 8px;
    }

    .notification {
        top: 12px;
        right: 12px;
        left: 12px;
        max-width: none;
    }
}

@media (min-width: 768px) {
    .container {
        max-width: 560px;
        padding: 2.5rem 2rem;
    }

    header {
        padding: 3rem 0 2rem;
    }

    h1 {
        font-size: 1.8rem;
    }

    .unlock-title {
        font-size: 1.7rem;
    }

    .info-section,
    .form-section {
        padding: 2rem;
    }
}

@media (min-width: 1024px) {
    .container {
        max-width: 600px;
    }
}

/* ============ ACCESSIBILITY ============ */

@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

:focus-visible {
    outline: 3px solid var(--pi-purple);
    outline-offset: 2px;
    border-radius: 4px;
}
