:root {
    --bg-base: #f8fafc;
    --text-main: #0f172a;
    --text-muted: #64748b;
    --border-light: #e2e8f0;

    /* Semantic Categories */
    --c-grammar: #8b5cf6; /* Violet */
    --c-vocab: #d97706;   /* Amber */
    --c-cohesion: #059669; /* Emerald */

    --font-sans: 'Inter', sans-serif;
    --font-mono: 'JetBrains Mono', monospace;
}

* { margin: 0; padding: 0; box-sizing: border-box; }
body { background-color: var(--bg-base); color: var(--text-main); font-family: var(--font-sans); -webkit-font-smoothing: antialiased; }
a { text-decoration: none; }
.fw-light { font-weight: 400; color: var(--text-muted); }

/* Nav & Basic Setup */
.navbar { display: flex; justify-content: space-between; align-items: center; padding: 24px 64px; max-width: 1440px; margin: 0 auto; }
.logo-text { font-size: 1.25rem; font-weight: 700; letter-spacing: -0.02em; }
.nav-links { display: flex; gap: 40px; }
.nav-links a { color: var(--text-muted); font-size: 0.95rem; font-weight: 500; transition: color 0.2s; }
.nav-links a:hover { color: var(--text-main); }
.nav-actions { display: flex; gap: 16px; align-items: center; }

.btn { padding: 12px 28px; border-radius: 6px; font-size: 0.95rem; font-weight: 600; cursor: pointer; transition: all 0.2s; display: inline-flex; border: 1px solid transparent; }
.btn-ghost { color: var(--text-muted); padding: 12px 16px; }
.btn-ghost:hover { color: var(--text-main); }
.btn-primary { background: var(--text-main); color: #fff; box-shadow: 0 4px 10px rgba(0,0,0,0.1); }
.btn-primary:hover { transform: translateY(-1px); box-shadow: 0 6px 15px rgba(0,0,0,0.15); border: 1px solid transparent;}

/* Layout */
.hero { display: flex; align-items: center; min-height: calc(100vh - 80px); padding: 20px 0; }
.container { max-width: 1300px; margin: 0 auto; padding: 0 64px; width: 100%; }
.hero-grid { display: grid; grid-template-columns: 40% 60%; gap: 60px; align-items: center; }

.hero-content { padding-right: 20px; }
.badges-row { display: flex; flex-wrap: wrap; gap: 12px; margin-bottom: 24px; }
.badge { display: inline-flex; align-items: center; gap: 8px; font-size: 0.75rem; font-weight: 600; text-transform: uppercase; letter-spacing: 0.05em; color: var(--text-main); border: 1px solid var(--border-light); padding: 6px 14px; border-radius: 100px; background: #fff; font-family: var(--font-sans); box-shadow: 0 2px 4px rgba(0,0,0,0.02);}
.system-status-badge { border-color: #bfdbfe; background: #eff6ff; color: #1e3a8a; }
.dot-radiate { width: 8px; height: 8px; background-color: #94a3b8; border-radius: 50%; transition: background-color 0.3s; }
.dot-radiate.processing { background-color: #3b82f6; box-shadow: 0 0 0 4px rgba(59, 130, 246, 0.2); animation: pulseDot 1s infinite alternate;}
@keyframes pulseDot { to { transform: scale(1.3); box-shadow: 0 0 0 6px rgba(59, 130, 246, 0.3); } }

.text-gradient { background: linear-gradient(135deg, #2563eb, #7c3aed); -webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: transparent; }

.hero-title { font-size: 3rem; line-height: 1.15; font-weight: 700; margin-bottom: 20px; color: var(--text-main); letter-spacing: -0.03em;}
.hero-subtitle { font-size: 1.15rem; color: var(--text-muted); line-height: 1.6; margin-bottom: 40px; }
.trust-marks { margin-top: 24px; padding-top: 24px; border-top: 1px solid var(--border-light); }
.trust-marks p { font-size: 0.9rem; font-weight: 500; color: #64748b; line-height: 1.5; }

/* The Pipeline Architecture */
.experience-pipeline { position: relative; padding-left: 48px; display: flex; flex-direction: column; gap: 20px; }
.pipeline-track { position: absolute; top: 20px; left: 16px; width: 2px; height: calc(100% - 40px); background: #e2e8f0; z-index: 1; }
.pipeline-progress { position: absolute; top: 20px; left: 16px; width: 2px; height: 0%; background: #3b82f6; z-index: 2; transition: height 0.3s linear; }

/* Panel States (Hidden / Dimmed / Active) */
.pipeline-step { position: relative; opacity: 0; transform: translateY(15px); transition: all 0.6s ease; pointer-events: none;}
.pipeline-step.state-visible { opacity: 0.4; transform: translateY(0); filter: grayscale(1); pointer-events: auto;}
.pipeline-step.state-active { opacity: 1; transform: translateY(0); filter: grayscale(0); pointer-events: auto;}
.pipeline-step.state-past { opacity: 0.5; filter: grayscale(0.5); pointer-events: auto;}

.step-bullet {
    position: absolute; top: 16px; left: -44px; width: 26px; height: 26px; border-radius: 50%;
    background: #fff; border: 2px solid #cbd5e1; display: flex; align-items: center; justify-content: center;
    font-size: 0.75rem; font-weight: 700; color: #94a3b8; z-index: 3; transition: all 0.4s;
}
.state-active .step-bullet { border-color: #3b82f6; color: #3b82f6; box-shadow: 0 0 0 4px rgba(59, 130, 246, 0.15); animation: pulseRing 2s infinite; }
@keyframes pulseRing {
    0% { box-shadow: 0 0 0 0 rgba(59, 130, 246, 0.4); }
    70% { box-shadow: 0 0 0 10px rgba(59, 130, 246, 0); }
    100% { box-shadow: 0 0 0 0 rgba(59, 130, 246, 0); }
}
.state-past .step-bullet { border-color: #10b981; color: #fff; background: #10b981; box-shadow: 0 0 0 4px rgba(16, 185, 129, 0.15); transition: background-color 0.4s ease, border-color 0.4s ease; }

/* Internal Panels */
.panel { background: #fff; border: 1px solid var(--border-light); border-radius: 8px; padding: 20px; transition: box-shadow 0.4s; }
.step-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 12px; }
.step-title { font-size: 0.8rem; font-weight: 600; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.05em; }
.status-badge { font-family: var(--font-mono); font-size: 0.7rem; color: #94a3b8; font-weight: 600; background: #f1f5f9; padding: 4px 8px; border-radius: 4px; transition: all 0.3s;}
.status-badge.highlight { background: #eff6ff; color: #1d4ed8; animation: pulseFade 1.5s infinite; }
.status-badge.success-highlight { background: #d1fae5; color: #047857; }
@keyframes pulseFade { 0% { opacity: 0.7; } 50% { opacity: 1; } 100% { opacity: 0.7; } }

.essay-box { font-size: 1rem; color: #334155; line-height: 1.8; background: #f8fafc; padding: 16px; border-radius: 6px; border: 1px solid #f1f5f9; }
.text-muted { color: #64748b; }

/* The Inline Text Swap Engine (Grid Hack for width stabilization) */
.correction-node {
    display: inline-grid; grid-template-columns: 1fr; align-items: end; position: relative;
    cursor: pointer;
}
.orig, .new { grid-row: 1; grid-column: 1; transition: all 0.4s ease; padding: 0 4px; border-radius: 4px;}

/* Default state before animation */
.orig { opacity: 1; transform: translateY(0); border-bottom: 2px dotted #94a3b8; background: #f1f5f9;}
.new { opacity: 0; transform: translateY(8px); pointer-events: none;}

/* Applied state after animation */
.correction-node.applied .orig { opacity: 0; transform: translateY(-8px); pointer-events: none; }
.correction-node.applied .new { 
    opacity: 1; 
    transform: translateY(0); 
    pointer-events: auto; 
    animation: popInText 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275); 
}
@keyframes popInText {
    0% { transform: translateY(8px) scale(0.9); opacity: 0; }
    100% { transform: translateY(0) scale(1); opacity: 1; }
}

/* Semantic Category Styling */
.type-grammar.applied .new { color: var(--c-grammar); background: rgba(139, 92, 246, 0.1); border-bottom: 2px solid var(--c-grammar); }
.type-vocab.applied .new { color: var(--c-vocab); background: rgba(217, 119, 6, 0.1); border-bottom: 2px solid var(--c-vocab); }
.type-cohesion.applied .new { color: var(--c-cohesion); background: rgba(5, 150, 105, 0.1); border-bottom: 2px solid var(--c-cohesion); }

/* Tooltips */
.correction-node::before {
    content: ''; position: absolute; top: -4px; right: -4px; width: 8px; height: 8px;
    background: #3b82f6; border-radius: 50%; z-index: 10;
    opacity: 0; transform: scale(0.8); transition: all 0.3s;
    box-shadow: 0 0 0 2px #fff;
}
.type-grammar::before { background: var(--c-grammar); }
.type-vocab::before { background: var(--c-vocab); }
.type-cohesion::before { background: var(--c-cohesion); }

.correction-node.applied::before { opacity: 1; transform: scale(1); animation: popDot 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275); }

@keyframes popDot { 0% { transform: scale(0); } 100% { transform: scale(1); } }

.correction-node::after {
    content: attr(data-tooltip); position: absolute; bottom: calc(100% + 8px); left: 50%; transform: translate(-50%, 4px) scale(0.95);
    background: #0f172a; color: #f8fafc; padding: 10px 14px; border-radius: 8px; font-size: 0.8rem; white-space: nowrap;
    opacity: 0; pointer-events: none; transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1); z-index: 20; font-family: var(--font-sans); 
    box-shadow: 0 10px 25px -5px rgba(0,0,0,0.2), 0 8px 10px -6px rgba(0,0,0,0.1);
    font-weight: 500; border: 1px solid rgba(255,255,255,0.1);
}
.correction-node.applied:hover::after { opacity: 1; transform: translate(-50%, 0) scale(1); }

/* Legend */
.legend { display: flex; gap: 16px; margin-top: 16px; font-size: 0.75rem; font-family: var(--font-mono); color: var(--text-muted); }
.leg-item { display: flex; align-items: center; gap: 6px; }
.swatch { width: 8px; height: 8px; border-radius: 2px; }
.bg-grammar { background-color: var(--c-grammar); }
.bg-cohesion { background-color: var(--c-cohesion); }
.bg-vocab { background-color: var(--c-vocab); }

/* Step 3: Analysis */
.inline-panel { padding: 20px; }
.score-bars { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.bar-row { display: flex; flex-direction: column; gap: 6px; }
.bar-label { font-size: 0.8rem; color: var(--text-muted); display: flex; justify-content: space-between; font-weight: 500;}
.bar-label b { color: var(--text-main); font-family: var(--font-mono); font-weight: 600;}
.track { width: 100%; height: 6px; background: #f1f5f9; border-radius: 3px; overflow: hidden; }
.fill { height: 100%; border-radius: 3px; transition: width 1.2s cubic-bezier(0.2, 0.8, 0.2, 1); }

/* Step 4: Final Score */
.score-card { display: flex; align-items: center; gap: 24px; padding: 20px; }
.score-main { display: flex; flex-direction: column; align-items: center; min-width: 80px;}
.the-score { font-size: 3.5rem; font-weight: 700; line-height: 1; color: var(--text-main); font-family: var(--font-mono); }
.the-score.pop { animation: popScale 0.4s ease forwards; }
@keyframes popScale { 0% { transform: scale(0.8); opacity: 0; } 50% { transform: scale(1.1); } 100% { transform: scale(1); opacity: 1; } }

.score-lbl { font-size: 0.7rem; font-weight: 600; text-transform: uppercase; color: var(--text-muted); margin-top: 8px; }
.score-divider { width: 1px; height: 50px; background: var(--border-light); }
.improvement-action { display: flex; flex-direction: column; gap: 12px; width: 100%; }
.target-header { display: flex; justify-content: space-between; align-items: center; }
.imp-tag { font-size: 0.75rem; font-weight: 600; background: #f8fafc; border: 1px solid #e2e8f0; color: var(--text-main); padding: 4px 12px; border-radius: 100px; font-family: var(--font-sans); display: flex; align-items: center; gap: 6px;}
.track-tag::before { content: ''; display: inline-block; width: 8px; height: 8px; background: #10b981; border-radius: 50%; box-shadow: 0 0 0 2px rgba(16,185,129,0.2); }
.distance-text { font-size: 0.85rem; font-weight: 600; color: #059669; }

.target-track-bg { width: 100%; height: 8px; background: #e2e8f0; border-radius: 10px; overflow: hidden; }
.target-track-fill { width: 0%; height: 100%; background: linear-gradient(90deg, #34d399, #059669); border-radius: 10px; transition: width 1.5s cubic-bezier(0.2, 0.8, 0.2, 1); }

.imp-text { font-size: 0.9rem; color: var(--text-muted); line-height: 1.5; background: #f8fafc; padding: 12px; border-radius: 6px; border: 1px dashed #cbd5e1; }
.imp-text b { color: var(--text-main); }

@media (max-width: 1024px) {
    .hero-grid { grid-template-columns: 1fr; }
    .hero-content { padding-right: 0; text-align: center; }
    .score-bars { grid-template-columns: 1fr; }
}
