/* ── Legacy design tokens (used by scorer.css + ideation.css) ────── */
:root {
  --primary:     #0a1628;
  --bg:          #f7fafc;
  --surface:     #ffffff;
  --border:      #e2e8f0;
  --muted:       #64748b;
  --accent-blue: #2563EB;
  --accent:      #F59E0B;
  --shadow:      0 2px 12px rgba(10,22,40,0.07);
  --shadow-md:   0 4px 24px rgba(10,22,40,0.10);
  --radius:      16px;
}

/* SCORER PAGE */
.scorer-page { background: var(--bg); min-height: 100vh; }

.scorer-header { text-align: center; padding: 60px 40px 48px; }
.scorer-header .badge { margin-bottom: 16px; }
.scorer-header h1 { font-size: clamp(2rem, 4vw, 3rem); color: var(--primary); margin-bottom: 12px; }
.scorer-header p { color: var(--muted); font-size: 1rem; max-width: 540px; margin: 0 auto; }

.scorer-form-wrap { max-width: 860px; margin: 0 auto; padding: 0 24px 80px; }

.form-card { background: var(--surface); border: 1px solid var(--border); border-radius: 20px; overflow: hidden; margin-bottom: 24px; box-shadow: var(--shadow); }

.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 0; border-bottom: 1px solid var(--border); }
.form-field { padding: 20px 24px; }
.form-field:first-child { border-right: 1px solid var(--border); }
.form-field label { display: block; font-size: 0.7rem; font-weight: 700; letter-spacing: 0.1em; text-transform: uppercase; color: var(--muted); margin-bottom: 10px; }

select, textarea {
  width: 100%; background: var(--bg); border: 1.5px solid var(--border);
  border-radius: 10px; padding: 12px 16px; font-size: 0.9rem;
  font-family: 'Inter', sans-serif; color: var(--primary);
  outline: none; transition: border-color 0.2s, box-shadow 0.2s;
  appearance: none; -webkit-appearance: none;
}
select { background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%236B7A99' stroke-width='1.5' fill='none' stroke-linecap='round'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 14px center; padding-right: 40px; cursor: pointer; }
select:focus, textarea:focus { border-color: var(--accent-blue); box-shadow: 0 0 0 3px rgba(79,123,232,0.12); }

.prompt-preview {
  margin: 0 24px 0; padding: 16px 18px;
  background: #F6F8FC; border-radius: 10px;
  font-size: 0.875rem; color: var(--muted); line-height: 1.7;
  border-left: 3px solid var(--accent-blue);
  margin-bottom: 0;
}

.form-field.essay-field { padding: 20px 24px; }
.form-field.essay-field .field-top { display: flex; justify-content: space-between; align-items: center; margin-bottom: 10px; }
.word-count { font-size: 0.8rem; color: var(--muted); }
.word-count.warn { color: #D97706; }
.word-count.ok { color: #16A34A; }
textarea { resize: vertical; min-height: 260px; }

.scorer-submit { text-align: center; margin-top: 24px; }
.scorer-submit .btn { padding: 18px 48px; font-size: 1rem; }

/* RESULTS */
.results-wrap { max-width: 860px; margin: 0 auto; padding: 0 24px 80px; display: none; }
.results-wrap.visible { display: block; }

.results-top { display: grid; grid-template-columns: auto 1fr; gap: 32px; align-items: center; background: var(--surface); border: 1px solid var(--border); border-radius: 20px; padding: 36px; margin-bottom: 24px; box-shadow: var(--shadow); }

/* Score ring */
.score-ring-container { position: relative; width: 140px; height: 140px; flex-shrink: 0; }
.score-ring-container svg { transform: rotate(-90deg); }
.score-ring-bg { fill: none; stroke: var(--border); stroke-width: 10; }
.score-ring-fill { fill: none; stroke-width: 10; stroke-linecap: round; transition: stroke-dashoffset 1.2s cubic-bezier(0.4,0,0.2,1); }
.score-ring-fill.green  { stroke: #16A34A; }
.score-ring-fill.blue   { stroke: #2563EB; }
.score-ring-fill.amber  { stroke: #D97706; }
.score-ring-fill.red    { stroke: #DC2626; }
.score-number {
  position: absolute; inset: 0;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
}
.score-number .num { font-size: 2.4rem; font-weight: 800; font-family: 'Playfair Display', serif; color: var(--primary); line-height: 1; }
.score-number .label { font-size: 0.7rem; color: var(--muted); font-weight: 600; letter-spacing: 0.08em; text-transform: uppercase; margin-top: 4px; }
.score-number .grade { font-size: 1rem; font-weight: 700; margin-top: 2px; }
.grade-green { color: #16A34A; } .grade-blue { color: #2563EB; } .grade-amber { color: #D97706; } .grade-red { color: #DC2626; }

.results-meta h2 { font-size: 1.4rem; color: var(--primary); margin-bottom: 8px; font-family: 'Inter', sans-serif; font-weight: 700; }
.results-meta .headline { font-size: 0.95rem; color: var(--muted); line-height: 1.7; margin-bottom: 16px; }
.results-meta .admissions-ctx {
  background: #EBF1FF; border-radius: 10px; padding: 12px 16px;
  font-size: 0.85rem; color: var(--accent-blue); line-height: 1.6;
}

/* Dimensions */
.dims-card { background: var(--surface); border: 1px solid var(--border); border-radius: 20px; padding: 32px; margin-bottom: 24px; box-shadow: var(--shadow); }
.dims-card h3 { font-size: 1.1rem; color: var(--primary); font-family: 'Inter', sans-serif; font-weight: 700; margin-bottom: 24px; }
.dim-row { margin-bottom: 24px; }
.dim-row:last-child { margin-bottom: 0; }
.dim-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 8px; }
.dim-name { font-size: 0.875rem; font-weight: 600; color: var(--primary); }
.dim-score { font-size: 0.875rem; font-weight: 700; color: var(--primary); }
.dim-bar { height: 8px; background: var(--border); border-radius: 4px; overflow: hidden; margin-bottom: 10px; }
.dim-bar-fill { height: 100%; border-radius: 4px; transition: width 1s ease 0.3s; }
.dim-feedback { font-size: 0.84rem; color: var(--muted); line-height: 1.7; }
.dim-improvement { margin-top: 6px; font-size: 0.82rem; color: var(--accent-blue); display: flex; align-items: flex-start; gap: 6px; }
.dim-improvement::before { content: '→'; flex-shrink: 0; }

/* ── ANNOTATED ESSAY ─────────────────────────────────── */
.annotated-essay-card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 20px; overflow: hidden; margin-bottom: 24px;
  box-shadow: 0 4px 24px rgba(0,0,0,0.07);
}
.annotated-essay-header {
  display: flex; justify-content: space-between; align-items: center;
  padding: 22px 32px; border-bottom: 1px solid var(--border);
  background: #f8faff;
  position: sticky; top: 0; z-index: 10;
}
.annotated-essay-title h3 {
  font-size: 1.05rem; color: var(--primary); font-family: 'Inter', sans-serif;
  font-weight: 700; margin: 0 0 3px;
}
.annotated-essay-subtitle {
  font-size: 0.75rem; color: var(--muted); margin: 0;
}
.annotation-legend { display: flex; gap: 10px; flex-shrink: 0; align-items: center; }
.legend-item {
  font-size: 0.72rem; font-weight: 700; letter-spacing: 0.04em;
  padding: 5px 12px; border-radius: 20px; display: flex; align-items: center; gap: 5px;
}
.legend-strength { color: #14532D; background: #BBFBD0; border: 1.5px solid #4ADE80; }
.legend-improve  { color: #78350F; background: #FEF08A; border: 1.5px solid #FACC15; }

/* Two-column layout */
.annotated-essay-layout {
  display: grid; grid-template-columns: 1fr 380px; min-height: 500px;
}

/* Left: essay */
.annotated-essay-body {
  padding: 36px 40px;
  font-size: 0.97rem; line-height: 2.15; color: var(--primary);
  white-space: pre-wrap; word-break: break-word;
  font-family: 'Georgia', serif;
  border-right: 1px solid var(--border);
  overflow-y: auto;
}

/* ── Inline highlight spans ────────────────────────────── */
.ann {
  border-radius: 4px;
  padding: 1px 3px;
  cursor: pointer;
  transition: filter 0.15s, box-shadow 0.15s;
  position: relative;
  display: inline;
}

/* GREEN — strengths */
.ann-strength {
  background: #BBFBD0;
  border-bottom: 2.5px solid #16A34A;
  color: #14532D;
}
.ann-strength:hover {
  background: #86EFAC;
  box-shadow: 0 0 0 2px rgba(22,163,74,0.25);
}
.ann-strength.active {
  background: #4ADE80;
  box-shadow: 0 0 0 3px rgba(22,163,74,0.4);
  color: #052e16;
}

/* YELLOW — needs improvement */
.ann-improve {
  background: #FEF08A;
  border-bottom: 2.5px solid #CA8A04;
  color: #78350F;
}
.ann-improve:hover {
  background: #FDE047;
  box-shadow: 0 0 0 2px rgba(202,138,4,0.3);
}
.ann-improve.active {
  background: #FACC15;
  box-shadow: 0 0 0 3px rgba(202,138,4,0.45);
  color: #451a03;
}

/* Annotation number badge in essay */
.ann-num {
  display: inline-flex; align-items: center; justify-content: center;
  width: 17px; height: 17px; border-radius: 50%;
  font-size: 0.6rem; font-weight: 900; line-height: 1;
  margin-left: 3px; vertical-align: middle;
  position: relative; top: -1px;
  font-family: 'Inter', sans-serif;
}
.ann-strength .ann-num { background: #16A34A; color: #fff; }
.ann-improve  .ann-num { background: #CA8A04; color: #fff; }

/* Right: sidebar */
.annotation-sidebar {
  background: #F8FAFC;
  border-left: 1px solid var(--border);
  overflow-y: auto;
  max-height: 720px;
  padding: 20px 16px;
}
.annotation-sidebar-inner {
  display: flex; flex-direction: column; gap: 10px;
}

/* Individual sidebar cards */
.ann-card {
  background: white;
  border: 1.5px solid var(--border);
  border-radius: 12px;
  padding: 13px 14px;
  cursor: pointer;
  transition: box-shadow 0.15s, border-color 0.15s, transform 0.12s;
  display: flex; gap: 10px; align-items: flex-start;
}
.ann-card:hover {
  box-shadow: 0 4px 16px rgba(0,0,0,0.09);
  transform: translateY(-1px);
}

/* Active state */
.ann-card.active.type-strength {
  border-color: #16A34A;
  background: #F0FDF4;
  box-shadow: 0 0 0 3px rgba(22,163,74,0.15);
}
.ann-card.active.type-improve {
  border-color: #CA8A04;
  background: #FEFCE8;
  box-shadow: 0 0 0 3px rgba(202,138,4,0.15);
}

/* Number bubble */
.ann-card-num {
  width: 24px; height: 24px; border-radius: 50%;
  font-size: 0.65rem; font-weight: 900;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0; margin-top: 1px;
  font-family: 'Inter', sans-serif;
}
.type-strength .ann-card-num { background: #BBFBD0; color: #14532D; border: 1.5px solid #4ADE80; }
.type-improve  .ann-card-num { background: #FEF08A; color: #78350F; border: 1.5px solid #FACC15; }

.ann-card.active.type-strength .ann-card-num { background: #16A34A; color: #fff; border-color: #16A34A; }
.ann-card.active.type-improve  .ann-card-num { background: #CA8A04; color: #fff; border-color: #CA8A04; }

.ann-card-content { flex: 1; min-width: 0; }

/* Type badge */
.ann-card-badge {
  display: inline-block; font-size: 0.58rem; font-weight: 800;
  letter-spacing: 0.09em; text-transform: uppercase;
  padding: 2px 8px; border-radius: 4px; margin-bottom: 5px;
}
.type-strength .ann-card-badge { background: #BBFBD0; color: #14532D; }
.type-improve  .ann-card-badge { background: #FEF08A; color: #78350F; }

/* Label */
.ann-card-label {
  font-size: 0.8rem; font-weight: 700; color: var(--primary);
  margin-bottom: 5px;
  line-height: 1.3;
}

/* Quoted passage — always visible, 2 lines */
.ann-card-quote {
  font-size: 0.72rem; color: var(--muted); line-height: 1.5;
  font-style: italic; margin-bottom: 7px;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical;
  overflow: hidden;
  border-left: 2px solid var(--border); padding-left: 7px;
}
.ann-card.active .ann-card-quote { -webkit-line-clamp: unset; }

/* Note — ALWAYS visible (not just on click) */
.ann-card-note {
  font-size: 0.78rem; line-height: 1.65;
  color: #374151;
  margin-top: 0;
  display: block;
}
.type-strength .ann-card-note { color: #166534; }
.type-improve  .ann-card-note { color: #92400E; }

@media (max-width: 900px) {
  .annotated-essay-layout { grid-template-columns: 1fr; }
  .annotated-essay-body { border-right: none; border-bottom: 1px solid var(--border); max-height: none; }
  .annotation-sidebar { max-height: 480px; border-left: none; }
}


/* JHU expanded dimension sections */
.dim-section-label {
  display: block; font-size: 0.68rem; font-weight: 700;
  letter-spacing: 0.1em; text-transform: uppercase; margin-bottom: 4px;
}
.dim-what-works {
  font-size: 0.84rem; line-height: 1.7; color: var(--muted);
  margin-top: 10px;
}
.dim-what-works .dim-section-label { color: #16A34A; }
.dim-gap {
  font-size: 0.84rem; line-height: 1.7; color: var(--muted);
  margin-top: 10px;
}
.dim-gap .dim-section-label { color: #6B7A99; }
.dim-to90 {
  margin-top: 10px; padding: 10px 14px;
  background: #EBF1FF; border-radius: 8px;
  font-size: 0.84rem; line-height: 1.7; color: #1e3a8a;
}
.dim-to90 .dim-section-label { color: var(--accent-blue); }

/* Top 3 improvements */
.improvements-card { background: var(--primary); border-radius: 20px; padding: 32px; margin-bottom: 24px; color: white; }
.improvements-card h3 { font-size: 1.1rem; color: white; font-family: 'Inter', sans-serif; font-weight: 700; margin-bottom: 24px; }
.improvement-item { display: flex; gap: 16px; margin-bottom: 20px; align-items: flex-start; }
.improvement-item:last-child { margin-bottom: 0; }
.imp-num { width: 32px; height: 32px; border-radius: 50%; background: var(--accent); color: var(--primary); display: flex; align-items: center; justify-content: center; font-weight: 700; font-size: 0.85rem; flex-shrink: 0; }
.imp-text { font-size: 0.9rem; line-height: 1.7; color: rgba(255,255,255,0.85); padding-top: 4px; }

/* Overall feedback */
.overall-card { background: var(--surface); border: 1px solid var(--border); border-radius: 20px; padding: 32px; box-shadow: var(--shadow); }
.overall-card h3 { font-size: 1.1rem; color: var(--primary); font-family: 'Inter', sans-serif; font-weight: 700; margin-bottom: 16px; }
.overall-card p { font-size: 0.9rem; color: var(--muted); line-height: 1.8; }
.score-again-btn { text-align: center; margin-top: 32px; }

/* Loading state */
.scoring-loader { text-align: center; padding: 60px 24px; display: none; }
.scoring-loader.visible { display: block; }
.loader-ring {
  width: 56px; height: 56px; border: 5px solid var(--border);
  border-top-color: var(--accent-blue); border-radius: 50%;
  animation: spin 0.8s linear infinite; margin: 0 auto 20px;
}
@keyframes spin { to { transform: rotate(360deg); } }
.scoring-loader p { color: var(--muted); font-size: 0.9rem; }

@media (max-width: 640px) {
  .form-row { grid-template-columns: 1fr; }
  .form-field:first-child { border-right: none; border-bottom: 1px solid var(--border); }
  .results-top { grid-template-columns: 1fr; text-align: center; }
  .score-ring-container { margin: 0 auto; }
}

/* ── JHU-SPECIFIC RESULTS ───────────────────────────── */
.jhu-results { margin-top: 0; }

/* Hopkins Scorecard — 3-column meta scores */
.jhu-meta-card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 20px; padding: 32px; margin-bottom: 24px;
  box-shadow: var(--shadow);
}
.jhu-meta-card h3 {
  font-size: 1.1rem; color: var(--primary); font-family: 'Inter', sans-serif;
  font-weight: 700; margin-bottom: 24px;
}
.jhu-meta-grid {
  display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px;
}
.jhu-meta-item {
  text-align: center; background: var(--bg);
  border: 1px solid var(--border); border-radius: 14px; padding: 20px 12px;
}
.jhu-meta-score {
  font-size: 2rem; font-weight: 800; font-family: 'Playfair Display', serif;
  color: var(--primary); line-height: 1; margin-bottom: 6px;
}
.jhu-meta-label {
  font-size: 0.7rem; font-weight: 700; letter-spacing: 0.1em;
  text-transform: uppercase; color: var(--muted);
}

/* Signals */
.jhu-signals-card {
  background: #0E1A2B; border-radius: 20px; padding: 32px;
  margin-bottom: 24px; color: white;
}
.jhu-signals-card h3 {
  font-size: 1.1rem; color: #7EB8F7; font-family: 'Inter', sans-serif;
  font-weight: 700; margin-bottom: 20px;
}
.jhu-signals-card ul { list-style: none; margin: 0; padding: 0; }
.jhu-signals-card li {
  display: flex; align-items: flex-start; gap: 12px;
  font-size: 0.9rem; line-height: 1.7; color: rgba(255,255,255,0.85);
  margin-bottom: 12px;
}
.jhu-signals-card li:last-child { margin-bottom: 0; }
.jhu-signals-card li::before {
  content: '✓'; color: #7EB8F7; font-weight: 700; flex-shrink: 0;
  margin-top: 2px;
}

/* Risks */
.jhu-risks-card {
  background: #FFF8ED; border: 1.5px solid #F59E0B;
  border-radius: 20px; padding: 32px; margin-bottom: 24px;
}
.jhu-risks-card h3 {
  font-size: 1.1rem; color: #92400E; font-family: 'Inter', sans-serif;
  font-weight: 700; margin-bottom: 20px;
}
.jhu-risks-card ul { list-style: none; margin: 0; padding: 0; }
.jhu-risks-card li {
  display: flex; align-items: flex-start; gap: 12px;
  font-size: 0.875rem; line-height: 1.7; color: #78350F; margin-bottom: 10px;
}
.jhu-risks-card li:last-child { margin-bottom: 0; }
.jhu-risks-card li::before { content: '⚠'; flex-shrink: 0; }

/* Edits */
.jhu-edits-card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 20px; padding: 32px; margin-bottom: 24px;
  box-shadow: var(--shadow);
}
.jhu-edits-card h3 {
  font-size: 1.1rem; color: var(--primary); font-family: 'Inter', sans-serif;
  font-weight: 700; margin-bottom: 24px;
}
.jhu-edit-row {
  border-left: 3px solid var(--accent-blue); padding: 14px 18px;
  background: var(--bg); border-radius: 0 10px 10px 0;
  margin-bottom: 16px;
}
.jhu-edit-row:last-child { margin-bottom: 0; }
.jhu-edit-issue {
  font-size: 0.75rem; font-weight: 700; letter-spacing: 0.08em;
  text-transform: uppercase; color: var(--accent-blue); margin-bottom: 6px;
}
.jhu-edit-suggestion {
  font-size: 0.875rem; line-height: 1.7; color: var(--muted);
}

/* AI Reader Perspective */
.jhu-impression-card {
  background: linear-gradient(135deg, #1a1f2e 0%, #0f1623 100%);
  border-radius: 20px; padding: 36px; margin-bottom: 24px;
  position: relative; overflow: hidden;
}
.jhu-impression-card::before {
  content: '\201C'; position: absolute; top: -10px; left: 24px;
  font-size: 8rem; line-height: 1; color: rgba(126,184,247,0.12);
  font-family: 'Playfair Display', serif; pointer-events: none;
}
.jhu-impression-label {
  font-size: 0.7rem; font-weight: 700; letter-spacing: 0.12em;
  text-transform: uppercase; color: #7EB8F7; margin-bottom: 16px;
}
.jhu-impression-card p {
  font-size: 1rem; line-height: 1.85; color: rgba(255,255,255,0.88);
  font-style: italic; position: relative;
}

@media (max-width: 640px) {
  .jhu-meta-grid { grid-template-columns: 1fr; }
}


/* AI Disclaimer Banner */
.ai-disclaimer {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  max-width: 760px;
  margin: 16px auto 8px;
  padding: 14px 18px;
  background: #F0F9FF;
  border: 1.5px solid #BAE6FD;
  border-radius: 10px;
  font-size: 0.8rem;
  color: #0C4A6E;
  line-height: 1.55;
}
.ai-disclaimer svg {
  flex-shrink: 0;
  margin-top: 2px;
  color: #0284C7;
}
.ai-disclaimer a {
  color: #0284C7;
  text-decoration: underline;
  font-weight: 500;
}
.ai-disclaimer a:hover { color: #0369A1; }
