:root {
    --primary-50: #eef2ff;
    --primary-100: #e0e7ff;
    --primary-200: #c7d2fe;
    --primary-300: #a5b4fc;
    --primary-400: #818cf8;
    --primary-500: #6366f1;
    --primary-600: #4f46e5;
    --primary-700: #4338ca;
    --primary-800: #3730a3;
    --primary-900: #312e81;
    
    --accent-gradient: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    --hero-gradient: linear-gradient(135deg, #667eea 0%, #764ba2 50%, #f093fb 100%);
    --success-gradient: linear-gradient(135deg, #11998e 0%, #38ef7d 100%);
    --warm-gradient: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
    
    --glass-bg: rgba(255, 255, 255, 0.85);
    --glass-border: rgba(255, 255, 255, 0.3);
    --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
    --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
    --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);
    --shadow-xl: 0 20px 25px -5px rgb(0 0 0 / 0.1), 0 8px 10px -6px rgb(0 0 0 / 0.1);
    --shadow-glow: 0 0 40px rgba(99, 102, 241, 0.3);
}

* {
    box-sizing: border-box;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    background: linear-gradient(135deg, #f5f7fa 0%, #e4e8ec 50%, #f0f2f5 100%);
    min-height: 100vh;
    margin: 0;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

.hidden {
    display: none !important;
}

#authLoadingScreen {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100vh;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    position: relative;
    overflow: hidden;
}

#authLoadingScreen::before {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: radial-gradient(circle, rgba(255,255,255,0.1) 0%, transparent 50%);
    animation: shimmer 3s ease-in-out infinite;
}

@keyframes shimmer {
    0%, 100% { transform: translateX(-10%) translateY(-10%); }
    50% { transform: translateX(10%) translateY(10%); }
}

#authLoadingScreen .loading-content {
    position: relative;
    z-index: 1;
    text-align: center;
}

#authLoadingScreen h1 {
    color: white !important;
    text-shadow: 0 2px 20px rgba(0, 0, 0, 0.2);
}

#authLoadingScreen p {
    color: rgba(255, 255, 255, 0.85) !important;
}

#authLoadingScreen i {
    color: white !important;
    filter: drop-shadow(0 0 20px rgba(255, 255, 255, 0.5));
}

#appContainer {
    background: var(--glass-bg);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid var(--glass-border);
    box-shadow: var(--shadow-xl), var(--shadow-glow);
}

.progress-bar-inner {
    transition: width 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    background: var(--accent-gradient);
}

.fade-in {
    animation: fadeIn 0.5s cubic-bezier(0.4, 0, 0.2, 1);
}

.slide-up {
    animation: slideUp 0.5s cubic-bezier(0.4, 0, 0.2, 1);
}

.scale-in {
    animation: scaleIn 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.spin {
    animation: spin 1.5s cubic-bezier(0.4, 0, 0.6, 1) infinite;
}

.pulse-glow {
    animation: pulseGlow 2s ease-in-out infinite;
}

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

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

@keyframes scaleIn {
    from { opacity: 0; transform: scale(0.95); }
    to { opacity: 1; transform: scale(1); }
}

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

@keyframes pulseGlow {
    0%, 100% { box-shadow: 0 0 20px rgba(99, 102, 241, 0.4); }
    50% { box-shadow: 0 0 40px rgba(99, 102, 241, 0.6); }
}

@keyframes float {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-10px); }
}

.modal-backdrop {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 50;
    animation: fadeIn 0.3s ease;
}

.modal-backdrop > div {
    animation: scaleIn 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.btn-primary {
    background: var(--accent-gradient);
    color: white;
    font-weight: 600;
    padding: 0.875rem 1.5rem;
    border-radius: 0.75rem;
    border: none;
    box-shadow: var(--shadow-lg), 0 0 20px rgba(99, 102, 241, 0.3);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    cursor: pointer;
    position: relative;
    overflow: hidden;
}

.btn-primary::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;
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-xl), 0 0 30px rgba(99, 102, 241, 0.5);
}

.btn-primary:hover::before {
    left: 100%;
}

.btn-primary:active {
    transform: translateY(0);
}

.btn-secondary {
    background: white;
    color: #374151;
    font-weight: 600;
    padding: 0.875rem 1.5rem;
    border-radius: 0.75rem;
    border: 1px solid #e5e7eb;
    box-shadow: var(--shadow-sm);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    cursor: pointer;
}

.btn-secondary:hover {
    background: #f9fafb;
    border-color: var(--primary-300);
    box-shadow: var(--shadow-md);
    transform: translateY(-1px);
}

.btn-success {
    background: var(--success-gradient);
    color: white;
    font-weight: 600;
    padding: 0.875rem 1.5rem;
    border-radius: 0.75rem;
    border: none;
    box-shadow: var(--shadow-lg), 0 0 20px rgba(56, 239, 125, 0.3);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    cursor: pointer;
}

.btn-success:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-xl), 0 0 30px rgba(56, 239, 125, 0.5);
}

.card {
    background: white;
    border-radius: 1rem;
    border: 1px solid rgba(0, 0, 0, 0.05);
    box-shadow: var(--shadow-md);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.card:hover {
    box-shadow: var(--shadow-lg);
    transform: translateY(-2px);
}

.card-gradient {
    background: linear-gradient(135deg, var(--primary-50) 0%, white 100%);
    border: 1px solid var(--primary-100);
}

.card-success {
    background: linear-gradient(135deg, #ecfdf5 0%, white 100%);
    border: 1px solid #a7f3d0;
}

.gradient-text {
    background: var(--accent-gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.hero-icon {
    width: 80px;
    height: 80px;
    background: var(--accent-gradient);
    border-radius: 1.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 10px 40px rgba(99, 102, 241, 0.4);
    animation: float 3s ease-in-out infinite;
}

.hero-icon i {
    color: white;
    font-size: 2.5rem;
}

.option-button {
    width: 100%;
    text-align: left;
    padding: 1.25rem 1.5rem;
    border: 2px solid #e5e7eb;
    border-radius: 1rem;
    background: white;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    font-weight: 500;
    color: #374151;
    position: relative;
    overflow: hidden;
}

.option-button::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    height: 100%;
    width: 4px;
    background: var(--accent-gradient);
    transform: scaleY(0);
    transition: transform 0.3s ease;
}

.option-button:hover {
    border-color: var(--primary-400);
    background: var(--primary-50);
    transform: translateX(4px);
}

.option-button:hover::before {
    transform: scaleY(1);
}

.deep-dive-option {
    padding: 1.5rem;
    border-radius: 1rem;
    font-weight: 600;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.deep-dive-option.this-is-me {
    background: linear-gradient(135deg, #ecfdf5 0%, #d1fae5 100%);
    border: 2px solid #10b981;
    color: #047857;
}

.deep-dive-option.this-is-me:hover {
    transform: scale(1.02);
    box-shadow: 0 10px 30px rgba(16, 185, 129, 0.3);
}

.deep-dive-option.not-me {
    background: linear-gradient(135deg, #fef2f2 0%, #fecaca 100%);
    border: 2px solid #ef4444;
    color: #b91c1c;
}

.deep-dive-option.not-me:hover {
    transform: scale(1.02);
    box-shadow: 0 10px 30px rgba(239, 68, 68, 0.3);
}

.axis-card {
    display: flex;
    flex-direction: column;
    padding: 1.25rem;
    background: white;
    border: 1px solid #e5e7eb;
    border-radius: 0.75rem;
    margin-bottom: 0.75rem;
    transition: all 0.3s ease;
}

.axis-card:hover {
    box-shadow: var(--shadow-md);
    transform: translateX(4px);
}

.axis-card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.5rem;
}

.axis-card-result {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.axis-poles {
    font-size: 0.75rem;
    color: #6b7280;
}

.axis-result-desc {
    margin-top: 0.25rem;
    line-height: 1.4;
}

.axis-result-name {
    font-size: 1rem;
}

.axis-label { font-weight: 600; color: #4b5563; }
.axis-result { 
    font-weight: 700; 
    font-size: 1rem; 
    padding: 0.375rem 1rem; 
    border-radius: 9999px;
    letter-spacing: 0.05em;
}

.axis-result-a { background: linear-gradient(135deg, #dbeafe, #bfdbfe); color: #1d4ed8; }
.axis-result-n { background: linear-gradient(135deg, #fee2e2, #fecaca); color: #b91c1c; }
.axis-result-r { background: linear-gradient(135deg, #e0e7ff, #c7d2fe); color: #4338ca; }
.axis-result-c { background: linear-gradient(135deg, #fef3c7, #fde68a); color: #b45309; }
.axis-result-i { background: linear-gradient(135deg, #f3e8ff, #e9d5ff); color: #7e22ce; }
.axis-result-e { background: linear-gradient(135deg, #fce7f3, #fbcfe8); color: #db2777; }
.axis-result-d { background: linear-gradient(135deg, #e0f2fe, #bae6fd); color: #0369a1; }
.axis-result-p { background: linear-gradient(135deg, #dcfce7, #bbf7d0); color: #166534; }
.axis-result-s { background: linear-gradient(135deg, #fef9c3, #fef08a); color: #a16207; }
.axis-result-m { background: linear-gradient(135deg, #ffe4e6, #fecdd3); color: #c2410c; }
.axis-result-t { background: linear-gradient(135deg, #f0fdf4, #dcfce7); color: #15803d; }
.axis-result-h { background: linear-gradient(135deg, #ecfdf5, #d1fae5); color: #047857; }
.axis-result-l { background: linear-gradient(135deg, #fff7ed, #fed7aa); color: #ea580c; }
.axis-result-respect { background: linear-gradient(135deg, #f3f4f6, #e5e7eb); color: #374151; }

.ladder-item {
    background: white;
    border: 1px solid #e5e7eb;
    border-radius: 1rem;
    padding: 1.25rem;
    margin-bottom: 1rem;
    transition: all 0.3s ease;
}

.ladder-item:hover {
    box-shadow: var(--shadow-md);
}

.ladder-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.75rem;
}

.ladder-axis-name {
    font-size: 1.125rem;
    font-weight: 700;
    color: #1f2937;
}

.ladder-stage-name {
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--primary-600);
    background: var(--primary-50);
    padding: 0.25rem 0.75rem;
    border-radius: 9999px;
}

.ladder-progress-bar {
    display: flex;
    gap: 0.5rem;
    width: 100%;
}

.ladder-step {
    height: 0.5rem;
    flex: 1;
    border-radius: 9999px;
    background-color: #e5e7eb;
    transition: all 0.3s ease;
}

.step-complete {
    background: var(--accent-gradient);
}

.step-current {
    background: var(--primary-200);
    animation: pulseGlow 2s ease-in-out infinite;
}

.ladder-sub-progress {
    font-size: 0.875rem;
    color: #6b7280;
    margin-top: 0.75rem;
}

.practice-step {
    display: flex;
    align-items: center;
    padding: 1rem;
    border-radius: 0.75rem;
    border: 1px solid transparent;
    transition: all 0.3s ease;
}

.practice-step-current {
    background: linear-gradient(135deg, var(--primary-50), white);
    border-color: var(--primary-200);
    box-shadow: var(--shadow-md);
}

.practice-step-icon {
    flex-shrink: 0;
    width: 3rem;
    height: 3rem;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    margin-right: 1rem;
    transition: all 0.3s ease;
}

.practice-step-icon-complete {
    background: var(--accent-gradient);
    color: white;
    box-shadow: 0 4px 15px rgba(99, 102, 241, 0.4);
}

.practice-step-icon-current {
    background: white;
    color: var(--primary-600);
    border: 2px solid var(--primary-400);
    box-shadow: 0 0 20px rgba(99, 102, 241, 0.3);
}

.practice-step-icon-incomplete {
    background-color: #f3f4f6;
    color: #9ca3af;
}

#journalTextEntry {
    min-height: 200px;
    resize: vertical;
    border-radius: 1rem;
    border: 2px solid #e5e7eb;
    padding: 1rem;
    font-size: 1rem;
    line-height: 1.6;
    transition: all 0.3s ease;
}

#journalTextEntry:focus {
    border-color: var(--primary-400);
    box-shadow: 0 0 0 4px rgba(99, 102, 241, 0.1);
    outline: none;
}

#aiFollowUpBox.fade-in {
    animation: fadeIn 0.5s ease-in-out;
    animation-fill-mode: forwards;
    opacity: 1;
}

#aiFollowUpError {
    color: #b91c1c;
    background: linear-gradient(135deg, #fef2f2, #fee2e2);
    border: 1px solid #fecaca;
    border-radius: 0.75rem;
}

#scenarioChatLog {
    height: 350px;
    background: linear-gradient(180deg, #f9fafb 0%, white 100%);
    border-radius: 1rem;
}

.chat-bubble {
    max-width: 80%;
    padding: 1rem 1.25rem;
    border-radius: 1.5rem;
    margin-bottom: 0.75rem;
    line-height: 1.6;
    box-shadow: var(--shadow-sm);
}

.chat-bubble-ai {
    background: white;
    color: #1f2937;
    border-bottom-left-radius: 0.375rem;
    align-self: flex-start;
    border: 1px solid #e5e7eb;
}

.chat-bubble-user {
    background: var(--accent-gradient);
    color: white;
    border-bottom-right-radius: 0.375rem;
    align-self: flex-end;
    box-shadow: 0 4px 15px rgba(99, 102, 241, 0.3);
}

.chat-bubble-thinking {
    background: #f3f4f6;
    color: #6b7280;
    border-bottom-left-radius: 0.375rem;
    align-self: flex-start;
    font-style: italic;
}

#scenarioInputContainer {
    display: flex;
    margin-top: 1rem;
    gap: 0.5rem;
}

#scenarioTextInput {
    flex-grow: 1;
    border: 2px solid #e5e7eb;
    border-radius: 1rem;
    padding: 1rem;
    font-size: 1rem;
    outline: none;
    transition: all 0.3s ease;
}

#scenarioTextInput:focus {
    border-color: var(--primary-400);
    box-shadow: 0 0 0 4px rgba(99, 102, 241, 0.1);
}

#scenarioSendButton {
    background: var(--accent-gradient);
    color: white;
    border: none;
    padding: 0 1.5rem;
    border-radius: 1rem;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: var(--shadow-md);
}

#scenarioSendButton:hover:not(:disabled) {
    transform: scale(1.05);
    box-shadow: var(--shadow-lg);
}

#scenarioSendButton:disabled {
    background: #d1d5db;
    box-shadow: none;
}

.algorithm-step {
    display: flex;
    flex-direction: column;
    align-items: center;
    flex: 1;
    padding: 0.75rem 0.5rem;
    border-radius: 0.75rem;
    background: white;
    border: 1px solid #e5e7eb;
    color: #9ca3af;
    transition: all 0.3s ease;
}

.algorithm-step.completed {
    background: linear-gradient(135deg, #ecfdf5, #d1fae5);
    border-color: #10b981;
    color: #059669;
    box-shadow: 0 4px 15px rgba(16, 185, 129, 0.2);
}

.algorithm-step i { font-size: 1.25rem; }
.algorithm-step span { font-size: 0.65rem; font-weight: 700; margin-top: 0.25rem; text-align: center; text-transform: uppercase; letter-spacing: 0.05em; }


.journal-entry-card {
    background: white;
    border: 1px solid #e5e7eb;
    border-radius: 1rem;
    padding: 1.25rem;
    margin-bottom: 1rem;
    transition: all 0.3s ease;
}

.journal-entry-card:hover {
    box-shadow: var(--shadow-md);
    transform: translateY(-2px);
}

.journal-entry-card .date {
    font-size: 0.875rem;
    font-weight: 700;
    background: var(--accent-gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    margin-bottom: 0.25rem;
}

.journal-entry-card .axis {
    font-size: 1.125rem;
    font-weight: 700;
    color: #1f2937;
    margin-bottom: 0.5rem;
}

.journal-entry-card .prompt {
    font-size: 0.875rem;
    font-style: italic;
    color: #6b7280;
    margin-bottom: 0.75rem;
    padding-left: 0.75rem;
    border-left: 3px solid var(--primary-300);
}

.journal-entry-card .entry {
    font-size: 1rem;
    color: #374151;
    line-height: 1.6;
    white-space: pre-wrap;
}

#journalHistoryContainer {
    max-height: 60vh;
    overflow-y: auto;
    padding-right: 0.5rem;
}

.axis-select-button {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 1.25rem;
    border: 2px solid #e5e7eb;
    border-radius: 1rem;
    background: white;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    cursor: pointer;
}

.axis-select-button:hover {
    border-color: var(--primary-400);
    background: var(--primary-50);
    transform: translateY(-4px);
    box-shadow: var(--shadow-lg);
}

.axis-select-button i {
    font-size: 2rem;
    background: var(--accent-gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    margin-bottom: 0.5rem;
}

.axis-select-button span {
    font-weight: 700;
    color: #374151;
}

.axis-select-button:hover span {
    color: var(--primary-700);
}

#axisSelectGrid {
    max-height: 60vh;
    overflow-y: auto;
}

.toast {
    position: fixed;
    bottom: 2rem;
    right: 2rem;
    padding: 1rem 1.5rem;
    border-radius: 1rem;
    background: white;
    box-shadow: var(--shadow-xl);
    display: flex;
    align-items: center;
    gap: 0.75rem;
    animation: slideUp 0.3s ease;
    z-index: 100;
}

.toast-success {
    border-left: 4px solid #10b981;
}

.toast-error {
    border-left: 4px solid #ef4444;
}

.skeleton {
    background: linear-gradient(90deg, #f3f4f6 25%, #e5e7eb 50%, #f3f4f6 75%);
    background-size: 200% 100%;
    animation: skeleton 1.5s ease-in-out infinite;
    border-radius: 0.5rem;
}

@keyframes skeleton {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

::-webkit-scrollbar {
    width: 6px;
}

::-webkit-scrollbar-track {
    background: #f1f5f9;
    border-radius: 3px;
}

::-webkit-scrollbar-thumb {
    background: #cbd5e1;
    border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
    background: #94a3b8;
}

@media (max-width: 640px) {
    #appContainer {
        border-radius: 0;
        max-width: 100%;
    }
    
    body {
        padding: 0;
    }
    
    .hero-icon {
        width: 64px;
        height: 64px;
    }
    
    .hero-icon i {
        font-size: 2rem;
    }
}

@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
    
    .spin,
    .pulse-glow,
    .hero-icon {
        animation: none !important;
    }
}
