:root {
    --bg-color: #0A0A0A;
    --text-primary: #f8f8f8;
    --text-secondary: #b0b0b0;
    --accent: #C4A173; /* Muted champagne gold */
    --accent-subtle: rgba(196, 161, 115, 0.4);
    --border: rgba(255, 255, 255, 0.05);
    --card-bg: rgba(15, 15, 15, 0.4);
    --hover-bg: rgba(30, 30, 30, 0.6);
    --selected-bg: rgba(196, 161, 115, 0.08);
    --gradient-glow: none;
    --color-tritium: #b3ffb3;
    --color-patina: #e88d67;
    --color-rhodium: #a9a9a9;
    --space-sm: 8px;
    --space-md: 16px;
    --space-lg: 24px;
    --space-xl: 32px;
    --space-2xl: 64px;
    --physics-spring: cubic-bezier(0.2, 0.8, 0.2, 1);
}

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

body {
    font-family: 'Inter', -apple-system, sans-serif;
    background-color: var(--bg-color);
    background-image: linear-gradient(rgba(10, 10, 10, 0.90), rgba(10, 10, 10, 0.95)), url('../assets/mechanical_master.png');
    background-size: cover;
    background-position: center;
    background-attachment: fixed;
    color: var(--text-primary);
    line-height: 1.6;
    display: flex;
    justify-content: center;
    align-items: flex-start;
    min-height: 100vh;
    overflow-x: hidden;
}

.background-overlay {
    position: fixed;
    top: 0; left: 0; width: 100%; height: 100%;
    background: rgba(5, 5, 5, 0.88);
    backdrop-filter: blur(12px);
    z-index: -2;
}

.vignette-overlay {
    position: fixed;
    top: 0; left: 0; width: 100%; height: 100%;
    background: radial-gradient(circle, transparent 40%, rgba(0,0,0,0.7) 100%);
    pointer-events: none;
    z-index: -1;
}

#app-container {
    width: 100%;
    max-width: 1100px;
    padding: 2rem 2rem 4rem 2rem;
    position: relative;
    z-index: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
}

/* Animations */
@keyframes fadeUp {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}

.screen {
    display: none;
    opacity: 0;
    width: 100%;
}

.screen.active {
    display: block;
    animation: fadeUp 0.6s var(--physics-spring) forwards;
}

.glass-panel {
    background: var(--card-bg);
    background-image: var(--gradient-glow);
    backdrop-filter: blur(10px);
    border: 1px solid var(--border);
    padding: 3.5rem;
    border-radius: 12px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.5);
    width: 100%;
    position: relative;
    overflow: hidden;
}

.content-wrapper {
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    text-align: center;
    min-height: 60vh;
}

.form-wrapper {
    min-height: 700px;
    height: auto;
    width: 100%;
    max-width: 800px;
    margin: 0 auto;
    display: grid;
    grid-template-rows: auto auto 1fr auto;
    gap: var(--space-lg);
    justify-content: stretch;
}

@media (max-width: 600px) {
    .form-wrapper {
        min-height: 85vh;
        padding: 2.5rem 1.5rem;
    }
}

#global-header {
    width: 100%;
    display: flex;
    justify-content: center;
    margin-bottom: 2rem;
    margin-top: 2rem;
}

.logo-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1.5rem;
}

/* logo-text-row removed as layout is now monolithic */

.logo-icon {
    width: 80px;
    height: 80px;
    color: var(--accent);
    margin: 0;
}

@keyframes rotateAxis {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.kinetic-group {
    transform-origin: 50px 50px;
    animation: rotateAxis 60s linear infinite;
}

.logo-text-group {
    display: flex;
    flex-direction: column;
    align-items: center;
}

.logo-text-part {
    font-family: 'Playfair Display', serif;
    font-size: clamp(2rem, 4.5vw, 3.2rem);
    letter-spacing: 16px;
    text-transform: uppercase;
    color: #ffffff;
    margin-right: -16px;
    line-height: 1;
}

.logo-subtext {
    font-family: 'Inter', sans-serif;
    font-size: 0.9rem;
    letter-spacing: 24px;
    text-transform: uppercase;
    color: var(--accent);
    margin-top: 0.5rem;
    margin-right: -24px;
}

h1 {
    font-family: 'Playfair Display', serif;
    font-size: clamp(2rem, 5vw, 3.2rem);
    font-weight: 400;
    margin-bottom: 1.2rem;
    line-height: 1.2;
    letter-spacing: -0.5px;
}

h2 {
    font-family: 'Playfair Display', serif;
    font-size: clamp(1.5rem, 4vw, 2.2rem);
    font-weight: 400;
    margin-bottom: 0;
    align-self: flex-start;
    text-align: left;
    color: var(--text-primary);
    line-height: 1.4;
    text-shadow: 0 4px 12px rgba(0,0,0,0.5);
}

h3 {
    font-size: clamp(1.2rem, 3vw, 1.4rem);
    font-weight: 300;
    color: var(--accent);
    margin-bottom: 1.5rem;
    letter-spacing: 0.1em;
    text-transform: uppercase;
}

p {
    font-size: clamp(1rem, 2vw, 1.15rem);
    color: var(--text-secondary);
    max-width: 700px;
    margin-bottom: 2.5rem;
    font-weight: 300;
}

.header-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100%;
    margin-bottom: 1.5rem;
}

.subtitle {
    text-transform: uppercase;
    letter-spacing: 0.1em;
    font-size: clamp(0.7rem, 1.5vw, 0.8rem);
    color: var(--accent);
    margin-bottom: 0;
    font-weight: 500;
}

.step-counter {
    color: var(--text-secondary);
    font-weight: 400;
}

.btn {
    padding: 1.1rem 2.8rem;
    font-size: 1.05rem;
    letter-spacing: 1.5px;
    text-transform: uppercase;
    background: transparent;
    color: var(--text-primary);
    border: 1px solid var(--border);
    cursor: pointer;
    transition: all 0.4s var(--physics-spring);
    border-radius: 6px;
}

.btn:focus-visible {
    outline: none;
    box-shadow: 0 0 0 2px var(--bg-color), 0 0 0 4px var(--accent);
}

.btn:disabled {
    opacity: 0.2;
    cursor: not-allowed;
}

.btn:not(:disabled):hover {
    background: var(--hover-bg);
    border-color: var(--accent-subtle);
    transform: translateY(-2px);
    box-shadow: 0 10px 20px rgba(0,0,0,0.3);
}

.btn.primary {
    background: transparent;
    color: var(--accent);
    border: 1px solid var(--accent);
    font-weight: 500;
    position: relative;
    overflow: hidden;
}

.btn.primary::before {
    content: '';
    position: absolute;
    top: 0; left: -100%;
    width: 100%; height: 100%;
    background: linear-gradient(90deg, transparent, rgba(196, 161, 115, 0.2), transparent);
    transition: left 0.6s ease;
}

.btn.primary:not(:disabled):hover::before {
    left: 100%;
}

.btn.primary:not(:disabled):hover {
    background: rgba(196, 161, 115, 0.1);
    box-shadow: 0 0 20px rgba(196, 161, 115, 0.15);
    border-color: var(--accent);
}

/* Options */
#options-container, #s2-options-container {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    max-width: 600px;
    margin: 0 auto;
    gap: 1.2rem;
    width: 100%;
}

.option-btn {
    text-align: left;
    padding: 1.5rem 2rem;
    background: rgba(15, 15, 15, 0.6);
    border: 1px solid rgba(255, 255, 255, 0.05);
    color: var(--text-primary);
    cursor: pointer;
    border-radius: 8px;
    font-size: 1.15rem;
    font-weight: 300;
    transition: all 0.4s var(--physics-spring);
    display: flex;
    flex-direction: column;
    justify-content: center;
    width: 100%;
}

.option-btn:focus-visible {
    outline: none;
    box-shadow: 0 0 0 2px var(--bg-color), 0 0 0 4px var(--accent);
}

@media (max-width: 600px) {
    .option-btn {
        padding: 1.2rem 1.5rem;
        font-size: 1.05rem;
    }
}

.option-btn:hover {
    background: var(--hover-bg);
    transform: translateY(-4px);
    border-color: #E5E4E2;
    box-shadow: 0 10px 20px rgba(0,0,0,0.4);
}

.option-btn.selected {
    border-color: var(--accent);
    background: var(--selected-bg);
    box-shadow: inset 0 0 20px rgba(196, 161, 115, 0.1);
}

.option-btn:active {
    transform: scale(0.98);
}

/* Nav Buttons */
.nav-buttons {
    display: flex;
    justify-content: space-between;
    width: 100%;
    margin-top: 3rem;
}

.nav-buttons .btn.secondary {
    border-color: transparent;
    padding-left: 0;
}

.nav-buttons .btn.secondary:hover {
    color: var(--accent);
    background: transparent;
    box-shadow: none;
    transform: none;
}

/* Progress */
.progress-bar {
    width: 100%;
    height: 6px;
    background: rgba(255,255,255,0.12);
    position: absolute;
    top: 0;
    left: 0;
    z-index: 10;
    border-radius: 12px 12px 0 0;
    overflow: hidden;
}

@keyframes pulseGlow {
    0% { box-shadow: 0 0 5px var(--accent-subtle); }
    50% { box-shadow: 0 0 20px var(--accent); }
    100% { box-shadow: 0 0 5px var(--accent-subtle); }
}

#progress-fill, #s2-progress-fill {
    height: 100%;
    background: var(--accent);
    width: 0%;
    transition: width 0.8s var(--physics-spring);
    animation: pulseGlow 3s infinite;
}

[dir="rtl"] #progress-fill, [dir="rtl"] #s2-progress-fill {
    float: right;
}

/* Editorial Magazine Result Screen Layout */
.editorial-panel {
    padding: 0;
    overflow: hidden;
    max-width: 1200px;
}

.dossier-grid {
    display: grid;
    grid-template-columns: 45% 55%;
    align-items: stretch;
    background: var(--bg-color);
}

.dossier-image-container {
    width: 100%;
    height: 100%;
    min-height: 600px;
    position: relative;
    border-right: 1px solid var(--border);
}

.dossier-image {
    width: 100%;
    height: 100%;
    object-fit: cover;
    position: absolute;
    top: 0;
    left: 0;
}

.dossier-content {
    display: flex;
    flex-direction: column;
    justify-content: center;
    padding: 6rem 4rem;
    text-align: left;
}

.editorial-title {
    font-size: clamp(3rem, 5vw, 4.5rem);
    line-height: 1.1;
    margin-bottom: 1rem;
}

.editorial-trait {
    font-family: 'Inter', sans-serif;
    font-size: 1.2rem;
    color: var(--text-secondary);
    letter-spacing: 0.15em;
    text-transform: uppercase;
    margin-bottom: 2.5rem;
}

.editorial-divider {
    width: 60px;
    height: 2px;
    background: var(--accent);
    margin-bottom: 2.5rem;
}

.editorial-narrative {
    font-size: 1.1rem;
    font-weight: 300;
    line-height: 1.8;
    color: #d0d0d0;
    margin: 0;
}

.vault-section {
    padding: 4rem;
    border-top: 1px solid var(--border);
    background: rgba(10, 10, 10, 0.4);
}

.vault-title {
    text-align: center;
    margin-bottom: 3rem;
}

.vault-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 2rem;
}

.action-threshold {
    padding: 3rem 4rem;
    background: rgba(196, 161, 115, 0.05);
    border-top: 1px solid var(--accent-subtle);
    text-align: center;
}

.action-desc {
    color: var(--text-primary);
    font-size: 1.1rem;
    line-height: 1.6;
    margin: 0;
}

[dir="rtl"] #archetype-narrative {
    border-left: none;
    border-right: 2px solid var(--accent-subtle);
    padding-left: 0;
    padding-right: 1.5rem;
}

/* DNA Manifestations */
.manifestation-container {
    margin-bottom: 3rem;
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 1.5rem;
}

.manifestation-card {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    padding: 1.5rem;
    background: rgba(10,10,10,0.6);
    border: 1px solid var(--border);
    border-radius: 10px;
    align-items: center;
    text-align: center;
    transition: transform 0.4s var(--physics-spring), border-color 0.4s var(--physics-spring), box-shadow 0.4s var(--physics-spring);
    animation: fadeUp 0.5s var(--physics-spring) backwards;
}

.manifestation-card:hover {
    transform: translateY(-8px);
    border-color: var(--color-tritium);
    box-shadow: 0 10px 20px rgba(0,0,0,0.5), 0 0 15px rgba(179, 255, 179, 0.1);
}

.manifestation-image {
    width: 100%;
    height: 140px;
    border-radius: 8px;
    object-fit: cover;
    border: 1px solid rgba(255,255,255,0.1);
}

.manifestation-info h4 {
    color: var(--accent);
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-bottom: 0.5rem;
    margin-top: 0;
}

.manifestation-info h3 {
    color: var(--text-primary);
    font-size: 1.1rem;
    margin-bottom: 0.8rem;
    margin-top: 0;
}

.manifestation-info p {
    font-size: 0.9rem;
    color: var(--text-secondary);
    line-height: 1.6;
    margin: 0;
}

.cta-box {
    padding: 2.5rem;
    background: rgba(10,10,10,0.6);
    border: 1px solid var(--border);
    border-radius: 10px;
    text-align: center;
}

.cta-box p {
    margin: 0 auto 1.5rem auto;
    font-size: 1rem;
}

/* Roadmap Proposals */
.final-wrapper {
    align-items: flex-start;
    text-align: left;
    padding: 4rem;
}

#proposal-container {
    width: 100%;
    margin-top: 1rem;
}

.roadmap-wrapper {
    animation: fadeUp 0.8s cubic-bezier(0.16, 1, 0.3, 1) both;
    margin-bottom: 3rem !important;
    padding: 2.5rem !important;
    border: 1px solid rgba(255,255,255,0.08) !important;
    border-radius: 14px !important;
    background: linear-gradient(145deg, rgba(20,20,20,0.8) 0%, rgba(10,10,10,0.9) 100%) !important;
    box-shadow: 0 15px 35px rgba(0,0,0,0.5);
    transition: transform 0.3s ease;
}

.roadmap-wrapper:hover {
    transform: translateY(-5px);
    border-color: rgba(255,255,255,0.15) !important;
}

.roadmap-wrapper h2 {
    color: var(--accent) !important;
    font-size: 1.8rem !important;
    margin-bottom: 0.8rem !important;
}

.ai-rationale {
    font-size: 1.05rem;
    color: #a0a0a0 !important;
    margin-bottom: 2.5rem !important;
    line-height: 1.7;
    font-style: normal !important;
}

.roadmap-grid {
    display: grid !important;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)) !important;
    gap: 1.5rem !important;
}

.watch-card {
    background: rgba(5,5,5,0.5) !important;
    border: 1px solid rgba(255,255,255,0.05) !important;
    padding: 2rem !important;
    border-radius: 10px !important;
    transition: all 0.4s var(--physics-spring);
    display: flex;
    flex-direction: column;
}

.watch-card:hover {
    background: rgba(25,25,25,0.8) !important;
    border-color: var(--accent-subtle) !important;
    transform: translateY(-4px);
    box-shadow: 0 10px 20px rgba(0,0,0,0.4);
}

.watch-card h3 {
    color: var(--text-secondary) !important;
    font-size: 0.9rem !important;
    text-transform: uppercase;
    letter-spacing: 2px;
    margin-bottom: 1.5rem !important;
    border-bottom: 1px solid var(--border);
    padding-bottom: 0.8rem;
}

.watch-card strong {
    color: var(--accent);
    font-weight: 500;
    font-size: 1.2rem;
    display: block;
    margin-bottom: 0.2rem;
}

.watch-card p {
    margin-bottom: 0.5rem !important;
    font-size: 1.1rem !important;
    color: var(--text-primary) !important;
    max-width: none;
}

.watch-card .specs {
    font-size: 0.9rem !important;
    color: #888 !important;
    margin-top: auto;
    padding-top: 1.5rem;
}

@media (max-width: 900px) {
    .result-wrapper {
        flex-direction: column;
        text-align: center;
        gap: 2rem;
    }
    .result-image {
        width: 100%;
        max-width: 400px;
    }
    .result-text h1 {
        font-size: 2.4rem;
    }
    #archetype-narrative {
        border-left: none;
        border-top: 2px solid var(--accent-subtle);
        padding-left: 0;
        padding-top: 1.5rem;
        margin-top: 1.5rem;
    }
    .final-wrapper {
        padding: 2rem;
    }
}

/* Debug Panel */
.debug-panel {
    position: fixed;
    top: 20px;
    right: 20px;
    width: 320px;
    background: rgba(10, 10, 10, 0.9);
    backdrop-filter: blur(10px);
    border: 1px solid var(--border);
    color: #00ffcc;
    font-family: 'Courier New', Courier, monospace;
    font-size: 0.85rem;
    padding: 15px;
    border-radius: 8px;
    z-index: 9999;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 5px 20px rgba(0,0,0,0.8);
}

.debug-panel h3 {
    font-size: 1rem;
    color: var(--accent);
    margin-bottom: 10px;
    border-bottom: 1px solid var(--border);
    padding-bottom: 5px;
    font-family: 'Inter', sans-serif;
}

.debug-panel div { margin-bottom: 5px; }

/* Utilities */
.align-start { align-self: flex-start; }

/* Language Toggle */
.lang-toggle-container {
    position: fixed;
    top: 20px;
    left: 20px;
    z-index: 10000;
}

[dir="rtl"] .lang-toggle-container {
    left: auto;
    right: 20px;
}

.lang-toggle-btn {
    background: rgba(20, 20, 20, 0.7);
    color: var(--text-primary);
    border: 1px solid var(--border);
    padding: 12px 20px; /* Mathematically ensures 44px min height */
    border-radius: 4px;
    cursor: pointer;
    font-family: 'Inter', sans-serif;
    font-size: 0.9rem;
    font-weight: 500;
    transition: all 0.4s var(--physics-spring);
    backdrop-filter: blur(10px);
}

.lang-toggle-btn:focus-visible {
    outline: none;
    box-shadow: 0 0 0 2px var(--bg-color), 0 0 0 4px var(--accent);
}

.lang-toggle-btn:hover {
    background: rgba(40, 40, 40, 0.8);
    border-color: var(--accent-subtle);
    color: var(--text-primary);
}

/* RTL Support */
[dir="rtl"] body,
[dir="rtl"] .btn {
    font-family: 'Tajawal', -apple-system, sans-serif;
}

[dir="rtl"] .logo {
    font-family: 'Inter', sans-serif;
}

[dir="rtl"] h2,
[dir="rtl"] .result-wrapper,
[dir="rtl"] .final-wrapper,
[dir="rtl"] .option-btn {
    text-align: right;
}

[dir="rtl"] .nav-buttons .btn.secondary {
    padding-left: 2.5rem;
    padding-right: 0;
}

[dir="rtl"] .debug-panel {
    right: auto;
    left: 20px;
    text-align: right;
}

[dir="rtl"] #archetype-narrative {
    border-left: none;
    border-right: 2px solid var(--accent-subtle);
    padding-left: 0;
    padding-right: 1.5rem;
}

@media (max-width: 900px) {
    [dir="rtl"] #archetype-narrative {
        border-right: none;
        border-top: 2px solid var(--accent-subtle);
        padding-right: 0;
    }
}

/* Modal Styles */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.85);
    backdrop-filter: blur(8px);
    z-index: 1000;
    display: flex;
    justify-content: center;
    align-items: center;
}

.modal-content {
    background: var(--card-bg);
    border: 1px solid var(--border);
    padding: 3rem;
    border-radius: 12px;
    max-width: 500px;
    width: 90%;
    text-align: center;
    animation: fadeUp 0.4s ease forwards;
}

.modal-content h2 {
    font-size: 1.8rem;
    font-weight: 400;
    margin-bottom: 1rem;
    letter-spacing: 0.05em;
    color: var(--accent);
}

.modal-content p {
    color: var(--text-secondary);
    margin-bottom: 2rem;
    font-size: 0.95rem;
}

#user-email-input {
    width: 100%;
    padding: 1.2rem 1rem; /* Satisfies Fitts's Law 44px height */
    background: rgba(0, 0, 0, 0.4);
    border: 1px solid var(--border);
    border-radius: 6px;
    color: var(--text-primary);
    font-family: 'Inter', sans-serif;
    font-size: 1rem;
    margin-bottom: 1.5rem;
    outline: none;
    transition: all 0.4s var(--physics-spring);
}

#user-email-input:focus, #user-email-input:focus-visible {
    border-color: var(--accent-subtle);
    background: rgba(10, 10, 10, 0.6);
    outline: none;
    box-shadow: 0 0 0 2px var(--bg-color), 0 0 0 4px var(--accent);
}

[dir="rtl"] #user-email-input {
    text-align: right;
    font-family: 'Tajawal', sans-serif;
}

/* INLINE LOGO LAYOUT (For Admin Headers) */
.logo-container.inline-layout {
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: 1rem;
}

.logo-icon-small {
    width: 45px;
    height: 45px;
    color: var(--accent);
}

.logo-text-group-inline {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
}

.logo-text-part-small {
    font-family: 'Playfair Display', serif;
    font-size: 1.4rem;
    letter-spacing: 8px;
    text-transform: uppercase;
    color: #ffffff;
    line-height: 1;
}

.logo-subtext-small {
    font-family: 'Inter', sans-serif;
    font-size: 0.65rem;
    letter-spacing: 12px;
    text-transform: uppercase;
    color: var(--accent);
    margin-top: 6px;
    margin-right: -12px;
}
