@import url('https://fonts.googleapis.com/css2?family=DM+Serif+Display:ital@0;1&family=JetBrains+Mono:wght@300;400;600&family=Instrument+Sans:wght@300;400;500;600&display=swap');

/* ── Variables ── */
:root {
    --bg:        #0c0e13;
    --bg2:       #111318;
    --bg3:       #161a22;
    --surface:   #1a1f2b;
    --border:    rgba(99, 210, 255, 0.12);
    --border2:   rgba(99, 210, 255, 0.25);
    --cyan:      #63d2ff;
    --cyan-dim:  rgba(99, 210, 255, 0.08);
    --cyan-glow: rgba(99, 210, 255, 0.35);
    --gold:      #f0c040;
    --gold-dim:  rgba(240, 192, 64, 0.08);
    --text:      #d4dce8;
    --text-dim:  #7a8899;
    --text-mute: #3d4a5a;
    --green:     #4ade80;
    --red:       #f87171;
    --orange:    #fb923c;
    --radius:    6px;
    --font-display: 'DM Serif Display', Georgia, serif;
    --font-mono:    'JetBrains Mono', 'Courier New', monospace;
    --font-body:    'Instrument Sans', system-ui, sans-serif;
}

/* ── Reset ── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html { scroll-behavior: smooth; }

body {
    font-family: var(--font-body);
    background: var(--bg);
    color: var(--text);
    min-height: 100vh;
    font-size: 15px;
    line-height: 1.6;
    overflow-x: hidden;
}

/* ── Background grid ── */
body::before {
    content: '';
    position: fixed;
    inset: 0;
    background-image:
        linear-gradient(rgba(99,210,255,0.03) 1px, transparent 1px),
        linear-gradient(90deg, rgba(99,210,255,0.03) 1px, transparent 1px);
    background-size: 48px 48px;
    pointer-events: none;
    z-index: 0;
}

body::after {
    content: '';
    position: fixed;
    inset: 0;
    background:
        radial-gradient(ellipse 80% 60% at 10% 0%, rgba(99,210,255,0.05) 0%, transparent 60%),
        radial-gradient(ellipse 60% 40% at 90% 100%, rgba(240,192,64,0.04) 0%, transparent 60%);
    pointer-events: none;
    z-index: 0;
}

/* ── Nav ── */
nav {
    position: sticky;
    top: 0;
    z-index: 100;
    background: rgba(12, 14, 19, 0.85);
    backdrop-filter: blur(16px);
    border-bottom: 1px solid var(--border);
    padding: 0 2rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 60px;
}

nav .nav-brand {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

nav .nav-logo {
    width: 28px;
    height: 28px;
    border: 2px solid var(--cyan);
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    flex-shrink: 0;
}

nav .nav-logo::before {
    content: '';
    width: 10px;
    height: 10px;
    background: var(--cyan);
    border-radius: 2px;
    animation: logoPulse 2.5s ease-in-out infinite;
}

@keyframes logoPulse {
    0%, 100% { opacity: 1; transform: scale(1); }
    50%       { opacity: 0.5; transform: scale(0.8); }
}

nav h1 {
    font-family: var(--font-mono);
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--cyan);
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

nav .nav-status {
    font-family: var(--font-mono);
    font-size: 0.7rem;
    color: var(--text-dim);
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

nav .nav-status::before {
    content: '';
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--green);
    box-shadow: 0 0 8px var(--green);
    animation: statusBlink 3s ease-in-out infinite;
}

@keyframes statusBlink {
    0%, 80%, 100% { opacity: 1; }
    40%            { opacity: 0.3; }
}

/* ── Layout ── */
.container {
    position: relative;
    z-index: 1;
    max-width: 900px;
    margin: 0 auto;
    padding: 3rem 2rem;
}

.container-wide {
    position: relative;
    z-index: 1;
    max-width: 1200px;
    margin: 0 auto;
    padding: 3rem 2rem;
}

/* ── Page header ── */
.page-header {
    margin-bottom: 3rem;
    padding-bottom: 2rem;
    border-bottom: 1px solid var(--border);
}

.page-header .eyebrow {
    font-family: var(--font-mono);
    font-size: 0.7rem;
    font-weight: 600;
    color: var(--cyan);
    letter-spacing: 0.15em;
    text-transform: uppercase;
    margin-bottom: 0.75rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.page-header .eyebrow::before {
    content: '';
    width: 20px;
    height: 1px;
    background: var(--cyan);
}

.page-header h2 {
    font-family: var(--font-display);
    font-size: 2.6rem;
    font-weight: 400;
    color: #eef2f7;
    line-height: 1.15;
    margin-bottom: 0.75rem;
}

.page-header p {
    color: var(--text-dim);
    font-size: 0.95rem;
    max-width: 520px;
}

/* ── Cards / Surfaces ── */
.card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 2rem;
    position: relative;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.card:hover {
    border-color: var(--border2);
    box-shadow: 0 0 0 1px var(--border), 0 8px 32px rgba(0,0,0,0.4);
}

.card::before {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0;
    height: 1px;
    background: linear-gradient(90deg, transparent, var(--cyan-dim), transparent);
    border-radius: var(--radius) var(--radius) 0 0;
}

/* ── Form elements ── */
.form-group {
    margin-bottom: 1.5rem;
}

.form-group label {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    font-family: var(--font-mono);
    font-size: 0.72rem;
    font-weight: 600;
    color: var(--cyan);
    letter-spacing: 0.1em;
    text-transform: uppercase;
    margin-bottom: 0.6rem;
}

.form-group label .label-hint {
    font-weight: 300;
    color: var(--text-dim);
    text-transform: none;
    letter-spacing: 0;
    font-size: 0.72rem;
}

textarea, input[type="text"], input[type="file"] {
    width: 100%;
    background: rgba(12, 14, 19, 0.8);
    border: 1px solid var(--border2);
    border-radius: var(--radius);
    color: var(--text);
    font-family: var(--font-body);
    font-size: 0.9rem;
    padding: 0.85rem 1rem;
    transition: border-color 0.2s, box-shadow 0.2s, background 0.2s;
    outline: none;
    -webkit-appearance: none;
}

textarea {
    resize: vertical;
    min-height: 180px;
    font-family: var(--font-body);
    line-height: 1.6;
}

textarea:focus, input[type="text"]:focus {
    border-color: var(--cyan);
    background: rgba(99, 210, 255, 0.03);
    box-shadow: 0 0 0 3px rgba(99, 210, 255, 0.08);
}

textarea::placeholder, input::placeholder {
    color: var(--text-mute);
}

/* ── File input ── */
.file-drop {
    border: 1px dashed var(--border2);
    border-radius: var(--radius);
    padding: 2rem;
    text-align: center;
    cursor: pointer;
    transition: all 0.2s;
    background: rgba(12,14,19,0.5);
    position: relative;
}

.file-drop:hover {
    border-color: var(--cyan);
    background: var(--cyan-dim);
}

.file-drop input[type="file"] {
    position: absolute;
    inset: 0;
    opacity: 0;
    cursor: pointer;
    width: 100%;
    height: 100%;
    padding: 0;
    border: none;
}

.file-drop .drop-icon {
    font-size: 2rem;
    margin-bottom: 0.5rem;
    display: block;
}

.file-drop .drop-text {
    font-family: var(--font-mono);
    font-size: 0.75rem;
    color: var(--text-dim);
}

.file-drop .drop-sub {
    font-size: 0.72rem;
    color: var(--text-mute);
    margin-top: 0.25rem;
}

/* ── Buttons ── */
.btn-primary {
    display: inline-flex;
    align-items: center;
    gap: 0.6rem;
    padding: 0.85rem 2rem;
    background: var(--cyan);
    color: #060810;
    border: none;
    border-radius: var(--radius);
    font-family: var(--font-mono);
    font-size: 0.78rem;
    font-weight: 600;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    cursor: pointer;
    transition: all 0.2s;
    text-decoration: none;
}

.btn-primary:hover {
    background: #8de0ff;
    box-shadow: 0 0 24px var(--cyan-glow);
    transform: translateY(-1px);
}

.btn-primary:active {
    transform: translateY(0);
}

.btn-secondary {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.65rem 1.25rem;
    background: transparent;
    color: var(--cyan);
    border: 1px solid var(--border2);
    border-radius: var(--radius);
    font-family: var(--font-mono);
    font-size: 0.72rem;
    font-weight: 600;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    cursor: pointer;
    transition: all 0.2s;
    text-decoration: none;
}

.btn-secondary:hover {
    border-color: var(--cyan);
    background: var(--cyan-dim);
    box-shadow: 0 0 12px rgba(99,210,255,0.15);
}

.btn-back {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    color: var(--text-dim);
    text-decoration: none;
    font-family: var(--font-mono);
    font-size: 0.72rem;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    transition: color 0.2s;
    margin-top: 2.5rem;
}

.btn-back:hover { color: var(--cyan); }

/* ── Error box ── */
.error-box {
    background: rgba(248, 113, 113, 0.08);
    border: 1px solid rgba(248, 113, 113, 0.3);
    border-radius: var(--radius);
    padding: 0.85rem 1.1rem;
    color: var(--red);
    font-family: var(--font-mono);
    font-size: 0.8rem;
    margin-bottom: 1.5rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.error-box::before { content: '⚠'; }

/* ── Results page ── */
.results-meta {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-bottom: 2rem;
    padding: 0.85rem 1.1rem;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    font-family: var(--font-mono);
    font-size: 0.72rem;
    color: var(--text-dim);
}

.results-meta .meta-badge {
    background: var(--cyan-dim);
    color: var(--cyan);
    border: 1px solid rgba(99,210,255,0.2);
    border-radius: 3px;
    padding: 0.2rem 0.5rem;
    font-size: 0.68rem;
    font-weight: 600;
    letter-spacing: 0.06em;
    text-transform: uppercase;
}

.jd-preview {
    flex: 1;
    overflow: hidden;
    white-space: nowrap;
    text-overflow: ellipsis;
    color: var(--text-mute);
}

/* ── Candidate card ── */
.candidate-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1.75rem;
    margin-bottom: 1.25rem;
    position: relative;
    overflow: hidden;
    transition: border-color 0.2s, transform 0.2s;
    animation: cardSlide 0.4s cubic-bezier(.22,1,.36,1) both;
}

.candidate-card:nth-child(1) { animation-delay: 0s; }
.candidate-card:nth-child(2) { animation-delay: 0.06s; }
.candidate-card:nth-child(3) { animation-delay: 0.12s; }
.candidate-card:nth-child(4) { animation-delay: 0.18s; }
.candidate-card:nth-child(5) { animation-delay: 0.24s; }

@keyframes cardSlide {
    from { opacity: 0; transform: translateY(16px); }
    to   { opacity: 1; transform: translateY(0); }
}

.candidate-card:hover {
    border-color: var(--border2);
    transform: translateX(3px);
}

.candidate-card.rank-1 {
    border-color: rgba(240,192,64,0.3);
}

.candidate-card.rank-1::after {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0;
    height: 2px;
    background: linear-gradient(90deg, transparent, var(--gold), transparent);
}

/* rank badge */
.rank-badge {
    position: absolute;
    top: 1.25rem;
    right: 1.25rem;
    font-family: var(--font-mono);
    font-size: 0.65rem;
    font-weight: 600;
    color: var(--text-mute);
    letter-spacing: 0.06em;
}

.rank-1 .rank-badge { color: var(--gold); }

.card-top {
    display: flex;
    align-items: flex-start;
    gap: 1rem;
    margin-bottom: 1.25rem;
}

.candidate-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: var(--cyan-dim);
    border: 1px solid var(--border2);
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: var(--font-mono);
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--cyan);
    flex-shrink: 0;
}

.candidate-name {
    font-family: var(--font-display);
    font-size: 1.3rem;
    color: #eef2f7;
    line-height: 1.2;
}

.match-label {
    font-family: var(--font-mono);
    font-size: 0.68rem;
    color: var(--text-dim);
    letter-spacing: 0.06em;
    margin-top: 0.2rem;
}

/* score bar */
.score-row {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-bottom: 1.25rem;
}

.score-bar {
    flex: 1;
    height: 4px;
    background: var(--bg3);
    border-radius: 2px;
    overflow: hidden;
}

.score-fill {
    height: 100%;
    border-radius: 2px;
    background: linear-gradient(90deg, var(--cyan), #a78bfa);
    transition: width 1s cubic-bezier(.22,1,.36,1);
    position: relative;
}

.score-fill::after {
    content: '';
    position: absolute;
    right: 0; top: 0; bottom: 0;
    width: 20px;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.3));
    animation: shimmerBar 2s ease-in-out infinite;
}

@keyframes shimmerBar {
    0%   { opacity: 0; }
    50%  { opacity: 1; }
    100% { opacity: 0; }
}

.rank-1 .score-fill {
    background: linear-gradient(90deg, var(--gold), #fde68a);
}

.score-num {
    font-family: var(--font-mono);
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--cyan);
    white-space: nowrap;
    min-width: 45px;
    text-align: right;
}

.rank-1 .score-num { color: var(--gold); }

/* recommendation pill */
.recommendation {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    padding: 0.2rem 0.6rem;
    border-radius: 3px;
    font-family: var(--font-mono);
    font-size: 0.65rem;
    font-weight: 600;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    margin-bottom: 1.25rem;
}

.rec-hire    { background: rgba(74,222,128,0.1); color: var(--green); border: 1px solid rgba(74,222,128,0.25); }
.rec-consider{ background: rgba(99,210,255,0.08); color: var(--cyan);  border: 1px solid rgba(99,210,255,0.2); }
.rec-maybe   { background: rgba(251,146,60,0.08); color: var(--orange);border: 1px solid rgba(251,146,60,0.2); }
.rec-pass    { background: rgba(248,113,113,0.08); color: var(--red);  border: 1px solid rgba(248,113,113,0.2); }

/* keyword tags */
.keyword-section {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    margin-bottom: 1.5rem;
}

.keyword-row {
    display: flex;
    align-items: flex-start;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.keyword-label {
    font-family: var(--font-mono);
    font-size: 0.65rem;
    color: var(--text-mute);
    letter-spacing: 0.06em;
    text-transform: uppercase;
    padding-top: 0.15rem;
    white-space: nowrap;
    min-width: 55px;
}

.tag {
    display: inline-block;
    padding: 0.15rem 0.5rem;
    border-radius: 3px;
    font-family: var(--font-mono);
    font-size: 0.65rem;
    font-weight: 500;
    letter-spacing: 0.04em;
}

.tag.green {
    background: rgba(74,222,128,0.08);
    color: var(--green);
    border: 1px solid rgba(74,222,128,0.2);
}

.tag.red {
    background: rgba(248,113,113,0.08);
    color: var(--red);
    border: 1px solid rgba(248,113,113,0.2);
}

/* code review inline form */
.code-form {
    border-top: 1px solid var(--border);
    padding-top: 1.25rem;
    margin-top: 0.5rem;
}

.code-form textarea {
    font-family: var(--font-mono);
    font-size: 0.78rem;
    min-height: 100px;
    margin-bottom: 0.75rem;
    background: rgba(8,10,16,0.8);
}

/* ── Code review page ── */
.review-header {
    display: flex;
    align-items: flex-start;
    gap: 1.5rem;
    margin-bottom: 2.5rem;
    padding: 1.75rem;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
}

.grade {
    font-family: var(--font-mono);
    font-size: 3rem;
    font-weight: 600;
    line-height: 1;
    width: 70px;
    height: 70px;
    border-radius: var(--radius);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.grade-A { background: rgba(74,222,128,0.12); color: var(--green);  border: 2px solid rgba(74,222,128,0.3); }
.grade-B { background: rgba(99,210,255,0.1);  color: var(--cyan);   border: 2px solid rgba(99,210,255,0.25); }
.grade-C { background: rgba(251,146,60,0.1);  color: var(--orange); border: 2px solid rgba(251,146,60,0.25); }
.grade-D { background: rgba(248,113,113,0.1); color: var(--red);    border: 2px solid rgba(248,113,113,0.25); }
.grade-F { background: rgba(248,113,113,0.15);color: var(--red);    border: 2px solid rgba(248,113,113,0.4); }

.review-meta { flex: 1; }

.lang-badge {
    display: inline-block;
    background: var(--cyan-dim);
    color: var(--cyan);
    border: 1px solid rgba(99,210,255,0.2);
    border-radius: 3px;
    padding: 0.2rem 0.6rem;
    font-family: var(--font-mono);
    font-size: 0.7rem;
    font-weight: 600;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    margin-bottom: 0.6rem;
}

.review-meta h3 {
    font-family: var(--font-display);
    font-size: 1.4rem;
    color: #eef2f7;
    margin-bottom: 0.4rem;
}

.review-meta p {
    color: var(--text-dim);
    font-size: 0.88rem;
    line-height: 1.5;
}

/* stats row */
.stats-row {
    display: flex;
    gap: 1rem;
    margin-bottom: 2rem;
    flex-wrap: wrap;
}

.stat-chip {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.5rem 0.85rem;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    font-family: var(--font-mono);
    font-size: 0.72rem;
    color: var(--text-dim);
}

.stat-chip .stat-val {
    font-weight: 600;
    color: var(--text);
}

.stat-chip.critical .stat-val { color: var(--red); }
.stat-chip.ok .stat-val        { color: var(--green); }

/* review grid */
.review-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.25rem;
    margin-bottom: 1.25rem;
}

@media (max-width: 640px) {
    .review-grid { grid-template-columns: 1fr; }
}

.review-section {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1.25rem;
}

.review-section.danger  { border-color: rgba(248,113,113,0.2); }
.review-section.warning { border-color: rgba(251,146,60,0.2); }

.review-section h3 {
    font-family: var(--font-mono);
    font-size: 0.72rem;
    font-weight: 600;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    margin-bottom: 0.85rem;
    color: var(--text-dim);
}

.review-section.danger  h3 { color: var(--red); }
.review-section.warning h3 { color: var(--orange); }

.review-section ul {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.review-section ul li {
    font-size: 0.83rem;
    color: var(--text-dim);
    padding-left: 1rem;
    position: relative;
    line-height: 1.45;
}

.review-section ul li::before {
    content: '–';
    position: absolute;
    left: 0;
    color: var(--text-mute);
}

.review-section.danger  ul li::before { content: '!'; color: var(--red); }
.review-section.warning ul li::before { content: '!'; color: var(--orange); }

.empty-state {
    font-family: var(--font-mono);
    font-size: 0.72rem;
    color: var(--text-mute);
    padding: 0.25rem 0;
}

/* refactor block */
.refactor-block {
    background: rgba(8,10,16,0.9);
    border: 1px solid var(--border2);
    border-radius: var(--radius);
    overflow: hidden;
    margin-bottom: 1.25rem;
}

.refactor-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.65rem 1rem;
    background: rgba(99,210,255,0.04);
    border-bottom: 1px solid var(--border);
    font-family: var(--font-mono);
    font-size: 0.7rem;
    color: var(--cyan);
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.refactor-block pre {
    padding: 1.25rem;
    overflow-x: auto;
}

.refactor-block code {
    font-family: var(--font-mono);
    font-size: 0.78rem;
    color: #c9d5e0;
    line-height: 1.65;
    white-space: pre;
}

/* ── Divider ── */
.divider {
    height: 1px;
    background: var(--border);
    margin: 2rem 0;
}

/* ── Footer ── */
footer {
    position: relative;
    z-index: 1;
    text-align: center;
    padding: 2rem;
    margin-top: 2rem;
    border-top: 1px solid var(--border);
    font-family: var(--font-mono);
    font-size: 0.72rem;
    color: var(--text-mute);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.4rem;
}

footer a {
    color: var(--cyan);
    text-decoration: none;
    font-weight: 600;
    letter-spacing: 0.04em;
    transition: color 0.2s, text-shadow 0.2s;
}

footer a:hover {
    color: #fff;
    text-shadow: 0 0 12px var(--cyan-glow);
}

/* ── Scrollbar ── */
::-webkit-scrollbar       { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: var(--bg); }
::-webkit-scrollbar-thumb { background: var(--surface); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--border2); }

/* ── Animations ── */
@keyframes fadeUp {
    from { opacity: 0; transform: translateY(12px); }
    to   { opacity: 1; transform: translateY(0); }
}

.fade-up {
    animation: fadeUp 0.5s cubic-bezier(.22,1,.36,1) both;
}

/* ── Responsive ── */
@media (max-width: 600px) {
    .container, .container-wide { padding: 2rem 1rem; }
    .page-header h2 { font-size: 2rem; }
    nav { padding: 0 1rem; }
    nav h1 { font-size: 0.75rem; }
    .review-header { flex-direction: column; }
    .card-top { flex-direction: column; }
}