/* Design System & Custom Tokens */
:root {
  /* Backgrounds */
  --bg-base:        #f8fafc;
  --bg-surface:     #ffffff;
  --bg-card:        #ffffff;
  --bg-card-hover:  #f1f5f9;
  --bg-input:       #ffffff;

  /* Accent system */
  --accent-primary:  #2563eb;
  --accent-glow:     rgba(37, 99, 235, 0.08);
  --accent-cyan:     #0891b2;
  --accent-success:  #10b981;
  --accent-warning:  #d97706;
  --accent-danger:   #ef4444;
  --accent-purple:   #7c3aed;

  /* Text */
  --text-primary:    #0f172a;
  --text-secondary:  #475569;
  --text-muted:      #64748b;
  --text-code:       #0f766e;

  /* Borders */
  --border-subtle:   #e2e8f0;
  --border-accent:   rgba(37, 99, 235, 0.2);
  --border-accent-cyan: rgba(8, 145, 178, 0.2);

  /* Spacing & Radius */
  --radius-sm:  4px;
  --radius-md:  8px;
  --radius-lg:  12px;
  --radius-xl:  20px;

  /* Typography */
  --font-ui:   'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --font-code: 'JetBrains Mono', monospace;

  /* Score colors */
  --score-exceptional: #10b981;
  --score-strong:      #2563eb;
  --score-ready:       #0891b2;
  --score-approaching: #d97706;
  --score-developing:  #f97316;
  --score-notready:    #ef4444;

  /* Layout */
  --sidebar-width:     240px;
}

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

html, body {
  height: 100%;
  overflow: hidden;
}

/* Allow full-page scroll on report screen */
html.report-active,
body.report-active {
    height: auto;
    overflow-y: auto;
}

body {
  background-color: var(--bg-base);
  color: var(--text-primary);
  font-family: var(--font-ui);
  line-height: 1.5;
  overflow-x: hidden;
}

/* Custom Scrollbar */
::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}
::-webkit-scrollbar-track {
  background: var(--bg-base);
}
::-webkit-scrollbar-thumb {
  background: var(--bg-card);
  border-radius: var(--radius-sm);
}
::-webkit-scrollbar-thumb:hover {
  background: var(--bg-card-hover);
}

/* Common Components */
h1, h2, h3, h4, h5, h6 {
  font-weight: 600;
  letter-spacing: -0.02em;
}

button {
  font-family: var(--font-ui);
  font-size: 14px;
  font-weight: 500;
  padding: 10px 20px;
  border-radius: var(--radius-md);
  border: none;
  cursor: pointer;
  transition: all 0.2s ease;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

.btn-primary {
  background-color: var(--accent-primary);
  color: #fff;
  box-shadow: 0 4px 12px rgba(59, 130, 246, 0.25);
}
.btn-primary:hover:not(:disabled) {
  background-color: #2563eb;
  transform: translateY(-1px);
}
.btn-primary:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.btn-secondary {
  background-color: var(--bg-card);
  border: 1px solid var(--border-subtle);
  color: var(--text-primary);
}
.btn-secondary:hover {
  background-color: var(--bg-card-hover);
  border-color: var(--text-secondary);
}

.btn-ghost {
  background-color: transparent;
  color: var(--text-secondary);
}
.btn-ghost:hover:not(:disabled) {
  color: var(--text-primary);
  background-color: rgba(0, 0, 0, 0.05);
}
.btn-ghost:disabled {
  opacity: 0.3;
  cursor: not-allowed;
}

input[type="text"] {
  background-color: var(--bg-input);
  border: 1px solid var(--border-subtle);
  color: var(--text-primary);
  padding: 12px 16px;
  border-radius: var(--radius-md);
  font-family: var(--font-ui);
  font-size: 15px;
  transition: all 0.2s ease;
}
input[type="text"]:focus {
  outline: none;
  border-color: var(--accent-primary);
  box-shadow: 0 0 0 3px var(--accent-glow);
}

.screen {
  display: none;
  height: 100vh;
  width: 100%;
  overflow: hidden;
}
.screen.active {
  display: flex;
}

/* Report screen overrides: full natural height, scrollable */
#screen-report.screen {
  height: auto;
  min-height: 100vh;
  overflow: visible;
}

/* SCREEN 1: Intro Screen */
#screen-intro {
  flex-direction: row;
  height: 100vh;
  width: 100%;
  max-width: none;
  margin: 0;
  padding: 0;
  overflow: hidden;
  text-align: left;
}

.intro-left {
  flex: 1.2;
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 48px 64px;
  overflow-y: auto;
  background: radial-gradient(circle at 10% 20%, rgba(248, 250, 252, 1) 0%, rgba(241, 245, 249, 0.4) 100%);
  border-right: 1px solid var(--border-subtle);
}

.intro-right {
  flex: 0.8;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 48px;
  background-color: var(--bg-base);
  overflow-y: auto;
}

.intro-brand {
  margin-bottom: 32px;
}

.intro-brand-badge {
  display: inline-flex;
  align-items: center;
  background-color: var(--accent-glow);
  color: var(--accent-primary);
  border: 1px solid var(--border-accent);
  border-radius: 20px;
  padding: 4px 12px;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 24px;
}

.intro-brand h1 {
  font-size: 44px;
  line-height: 1.15;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 16px;
  letter-spacing: -0.03em;
}

.intro-brand-accent {
  background: linear-gradient(135deg, var(--accent-primary) 30%, var(--accent-cyan));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.intro-brand p {
  font-size: 16px;
  color: var(--text-secondary);
  max-width: 500px;
  line-height: 1.6;
}

.intro-stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
  width: 100%;
  margin-bottom: 40px;
}

.stat-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 18px;
  box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.02), 0 2px 4px -1px rgba(0, 0, 0, 0.02);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.stat-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.04);
}

.stat-card .value {
  font-size: 28px;
  font-weight: 700;
  color: var(--accent-primary);
  margin-bottom: 4px;
}

.stat-card .label {
  font-size: 13px;
  color: var(--text-secondary);
}

.intro-rules {
  display: flex;
  flex-direction: column;
  gap: 16px;
  border-top: 1px dashed var(--border-subtle);
  padding-top: 32px;
}

.intro-rule-item {
  display: flex;
  gap: 12px;
  font-size: 14px;
  color: var(--text-secondary);
  align-items: flex-start;
}

.intro-rule-item .rule-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  background-color: var(--accent-glow);
  border-radius: 50%;
  color: var(--accent-primary);
  font-size: 12px;
  flex-shrink: 0;
  font-weight: 600;
}

.intro-form-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-xl);
  padding: 40px;
  width: 100%;
  max-width: 440px;
  box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.05), 0 8px 10px -6px rgba(0, 0, 0, 0.05);
}

.intro-form-card h2 {
  font-size: 24px;
  font-weight: 700;
  margin-bottom: 8px;
  color: var(--text-primary);
}

.intro-form-sub {
  font-size: 13px;
  color: var(--text-muted);
  margin-bottom: 32px;
  line-height: 1.5;
}

.intro-form-group {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 24px;
  text-align: left;
}

.intro-form-group label {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

#candidate-name {
  width: 100%;
  max-width: none;
  text-align: left;
  margin-bottom: 0;
}

.intro-start-btn {
  width: 100%;
  padding: 14px 20px;
  font-size: 15px;
  font-weight: 600;
  justify-content: center;
  margin-bottom: 24px;
}

.intro-divider {
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 24px;
}

.intro-divider::before,
.intro-divider::after {
  content: "";
  flex: 1;
  border-bottom: 1px dashed var(--border-subtle);
}

.intro-divider span {
  padding: 0 12px;
  font-size: 11px;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.intro-resume-section {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.intro-resume-row {
  display: flex;
  gap: 12px;
}

.resume-code-input {
  flex: 1;
  text-transform: uppercase;
  font-family: var(--font-code);
  font-weight: 600;
  font-size: 15px;
  text-align: center;
}

.resume-error {
  color: var(--accent-danger);
  font-size: 12px;
  font-weight: 500;
  text-align: center;
  margin-top: 4px;
}

/* Name input shake animation on error */
.shake {
  animation: shake 0.4s ease;
  border-color: var(--accent-danger) !important;
}
@keyframes shake {
  0%, 100% { transform: translateX(0); }
  25% { transform: translateX(-8px); }
  75% { transform: translateX(8px); }
}

/* SCREEN 2: Section Transition Screen */
#screen-section-intro {
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  max-width: 700px;
  margin: 0 auto;
  padding: 40px 24px;
  overflow-y: auto;
}
.section-badge {
  background-color: var(--accent-glow);
  color: var(--accent-primary);
  padding: 6px 14px;
  border-radius: 20px;
  font-size: 13px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 24px;
  border: 1px solid var(--border-accent);
}
#si-title {
  font-size: 32px;
  margin-bottom: 16px;
}
#si-description {
  color: var(--text-secondary);
  font-size: 16px;
  margin-bottom: 32px;
}
.si-meta-container {
  display: flex;
  gap: 24px;
  margin-bottom: 40px;
  color: var(--text-muted);
  font-size: 14px;
}
.si-meta-item {
  display: flex;
  align-items: center;
  gap: 6px;
}
.countdown {
  font-size: 80px;
  font-weight: 700;
  color: var(--accent-cyan);
  width: 120px;
  height: 120px;
  border-radius: 50%;
  border: 4px solid var(--border-accent-cyan);
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto;
  box-shadow: 0 0 20px rgba(6, 182, 212, 0.15);
  animation: pulse-glow 1s infinite alternate;
}
@keyframes pulse-glow {
  from { transform: scale(1); box-shadow: 0 0 10px rgba(6, 182, 212, 0.15); }
  to { transform: scale(1.05); box-shadow: 0 0 25px rgba(6, 182, 212, 0.3); }
}

/* SCREEN 3: Question Screen Layout */
#screen-question.screen.active {
  display: grid;
  grid-template-columns: 1fr var(--sidebar-width);
  grid-template-rows: auto 1fr auto;
  grid-template-areas:
    "header sidebar"
    "main sidebar"
    "footer sidebar";
  height: 100vh;
  overflow: hidden;
}

.q-header {
  grid-area: header;
  background-color: var(--bg-surface);
  border-bottom: 1px solid var(--border-subtle);
  padding: 16px 32px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.progress-bar-wrap {
  width: 100%;
  height: 6px;
  background-color: var(--bg-base);
  border-radius: 3px;
  overflow: hidden;
}
.progress-bar-fill {
  height: 100%;
  width: 0;
  background: linear-gradient(90deg, var(--accent-primary), var(--accent-cyan));
  border-radius: 3px;
  transition: width 0.3s ease;
}
.q-meta {
  display: flex;
  justify-content: space-between;
  align-items: center;
}
#q-section-label {
  font-weight: 600;
  color: var(--text-primary);
  font-size: 14px;
}
#q-counter {
  color: var(--text-secondary);
  font-size: 13px;
}
.difficulty-badge {
  padding: 3px 8px;
  border-radius: 4px;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
}
.difficulty-badge.easy { background: rgba(16, 185, 129, 0.1); color: var(--accent-success); }
.difficulty-badge.medium { background: rgba(245, 158, 11, 0.1); color: var(--accent-warning); }
.difficulty-badge.hard { background: rgba(239, 68, 68, 0.1); color: var(--accent-danger); }

.timer {
  font-family: var(--font-code);
  font-size: 15px;
  color: var(--accent-cyan);
  font-weight: 600;
}

.q-body {
  grid-area: main;
  padding: 32px;
  overflow-y: auto;
  display: grid;
  grid-template-columns: 1fr;
  gap: 24px;
  align-content: start;
}
.q-body.has-context {
  grid-template-columns: 1fr 1fr;
}

.context-panel {
  background-color: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 24px;
  overflow-y: auto;
  max-height: 60vh;
  font-size: 14px;
}
.context-panel h3 {
  margin-bottom: 12px;
  font-size: 16px;
  color: var(--accent-cyan);
}
.context-panel p {
  color: var(--text-secondary);
  white-space: pre-wrap;
}

.q-text {
  font-size: 18px;
  font-weight: 500;
  color: var(--text-primary);
  margin-bottom: 8px;
  white-space: pre-wrap;
}

#q-answer-area {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

/* Question formats: Card selection */
.option-card {
  padding: 16px 20px;
  border-radius: var(--radius-lg);
  border: 2px solid var(--border-subtle);
  background: var(--bg-card);
  cursor: pointer;
  transition: all 0.15s ease;
  font-size: 14px;
  display: flex;
  align-items: center;
  gap: 12px;
}
.option-card:hover {
  border-color: var(--accent-primary);
  background: var(--bg-card-hover);
}
.option-card.selected {
  border-color: var(--accent-primary);
  background: var(--accent-glow);
}
.option-card.correct {
  border-color: var(--accent-success);
  background: rgba(16, 185, 129, 0.1);
}
.option-card.incorrect {
  border-color: var(--accent-danger);
  background: rgba(239, 68, 68, 0.1);
}

/* True / False layout */
.tf-container {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}
.tf-btn {
  height: 100px;
  font-size: 18px;
  font-weight: 600;
}

/* Draggable ordering list */
.sortable-item {
  padding: 14px 20px;
  background-color: var(--bg-card);
  border: 1px dashed var(--border-accent);
  border-radius: var(--radius-md);
  margin-bottom: 8px;
  cursor: grab;
  display: flex;
  align-items: center;
  gap: 12px;
  user-select: none;
}
.sortable-item:active {
  cursor: grabbing;
  background-color: var(--bg-card-hover);
}
.sortable-handle {
  color: var(--text-muted);
}

/* Slider input custom style */
.slider-container {
  background-color: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 24px;
}
.slider-val-display {
  font-size: 32px;
  font-weight: 700;
  text-align: center;
  color: var(--accent-cyan);
  margin-bottom: 16px;
}
.slider-input {
  width: 100%;
  height: 6px;
  border-radius: 3px;
  background: var(--bg-base);
  outline: none;
  -webkit-appearance: none;
}
.slider-input::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: var(--accent-cyan);
  cursor: pointer;
  box-shadow: 0 0 10px var(--accent-cyan);
}
.slider-labels {
  display: flex;
  justify-content: space-between;
  margin-top: 10px;
  color: var(--text-secondary);
  font-size: 12px;
}

/* Code Completion editor style */
.code-editor-wrap {
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.code-input {
  font-family: var(--font-code);
  font-size: 14px;
  background: #f8fafc;
  border: 1px solid var(--border-subtle);
  color: var(--text-primary);
  border-radius: var(--radius-md);
  padding: 16px;
  width: 100%;
  min-height: 160px;
  resize: vertical;
  line-height: 1.5;
  outline: none;
}
.code-input:focus {
  border-color: var(--accent-primary);
}
.model-answer-box {
  background: rgba(16, 185, 129, 0.05);
  border: 1px solid rgba(16, 185, 129, 0.2);
  border-radius: var(--radius-md);
  padding: 16px;
  font-family: var(--font-code);
  font-size: 13px;
}
.model-answer-box h4 {
  color: var(--accent-success);
  margin-bottom: 8px;
  font-family: var(--font-ui);
}

/* Matching columns */
.matching-pair {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  align-items: center;
  background-color: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  padding: 12px 20px;
  border-radius: var(--radius-md);
  margin-bottom: 8px;
}
.matching-pair select {
  background: var(--bg-card);
  color: var(--text-primary);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  padding: 8px;
  outline: none;
}

/* Priority Ranking */
.rank-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px;
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  margin-bottom: 8px;
}
.rank-badge {
  background: var(--bg-base);
  border: 1px solid var(--border-subtle);
  width: 28px;
  height: 28px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 600;
  font-size: 12px;
}

/* Chart read canvas area */
#q-chart-area {
  background-color: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 16px;
  margin-bottom: 16px;
  max-height: 250px;
  display: flex;
  align-items: center;
  justify-content: center;
}
#q-chart-area.hidden {
  display: none;
}

/* Fill in the blanks */
.fillblank-inputs-wrap {
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.blank-field {
  display: flex;
  align-items: center;
  gap: 12px;
}
.blank-field label {
  font-size: 14px;
  color: var(--text-secondary);
}

.q-footer {
  grid-area: footer;
  background-color: var(--bg-surface);
  border-top: 1px solid var(--border-subtle);
  padding: 16px 32px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.hint {
  background-color: rgba(245, 158, 11, 0.05);
  border: 1px solid rgba(245, 158, 11, 0.2);
  border-radius: var(--radius-md);
  padding: 12px 16px;
  font-size: 13px;
  color: var(--accent-warning);
  max-width: 400px;
}
.hidden {
  display: none !important;
}

/* Neural Map Sidebar */
.neural-map {
  grid-area: sidebar;
  background-color: var(--bg-surface);
  border-left: 1px solid var(--border-subtle);
  padding: 24px;
  display: flex;
  flex-direction: column;
  align-items: center;
  overflow-y: auto;
}
#neural-map-svg {
  margin-bottom: 24px;
  width: 160px;
}
.neural-legend {
  font-size: 12px;
  color: var(--text-secondary);
  display: flex;
  flex-direction: column;
  gap: 8px;
  width: 100%;
}
.neural-legend .dot {
  display: inline-block;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  margin-right: 6px;
}
.neural-legend .dot.done { background-color: var(--accent-primary); }
.neural-legend .dot.current { background-color: var(--accent-cyan); box-shadow: 0 0 8px var(--accent-cyan); }
.neural-legend .dot.pending { background-color: #cbd5e1; }

/* SCREEN 4: Checkpoint Break */
#screen-break {
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  max-width: 600px;
  margin: 0 auto;
  padding: 40px 24px;
}
#screen-break h2 {
  font-size: 28px;
  margin-bottom: 16px;
}
#break-partial-score {
  font-size: 22px;
  font-weight: 700;
  color: var(--accent-cyan);
  margin-bottom: 20px;
}

/* SCREEN 5: Results Loading Screen */
#screen-loading {
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 40px 24px;
}
.loading-animation {
  margin-bottom: 32px;
}
.loading-ring {
  width: 80px;
  height: 80px;
  border: 4px solid var(--border-subtle);
  border-top-color: var(--accent-primary);
  border-radius: 50%;
  animation: spin 1s linear infinite;
  margin: 0 auto 20px;
}
@keyframes spin {
  to { transform: rotate(360deg); }
}
#loading-message {
  font-size: 18px;
  color: var(--text-secondary);
}
#loading-progress-bar {
  width: 100%;
  max-width: 400px;
  height: 4px;
  background-color: var(--bg-card);
  border-radius: 2px;
  overflow: hidden;
  position: relative;
}
#loading-progress-bar::after {
  content: "";
  position: absolute;
  left: 0;
  top: 0;
  height: 100%;
  width: 0;
  background-color: var(--accent-primary);
  animation: load 3.5s linear forwards;
}
@keyframes load {
  to { width: 100%; }
}

/* SCREEN 6: Report Screen */
#screen-report {
  padding: 48px 24px;
  max-width: 1000px;
  margin: 0 auto;
  flex-direction: column;
  gap: 40px;
  height: auto;
  overflow: visible;
}

.report {
  display: flex;
  flex-direction: column;
  gap: 40px;
}

.report-hero {
  background-color: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-xl);
  padding: 40px;
  text-align: center;
  position: relative;
  overflow: hidden;
}
.report-hero::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 4px;
  background: linear-gradient(90deg, var(--accent-primary), var(--accent-purple));
}
.report-meta {
  display: flex;
  justify-content: center;
  gap: 24px;
  color: var(--text-secondary);
  font-size: 13px;
  margin-bottom: 24px;
}
.score-display {
  display: flex;
  flex-direction: column;
  align-items: center;
  margin-bottom: 20px;
}
.score-number {
  font-size: clamp(72px, 10vw, 120px);
  font-weight: 700;
  line-height: 1;
  letter-spacing: -4px;
}
.score-label {
  font-size: 20px;
  font-weight: 600;
  margin-top: 8px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}
.company-badge {
  background-color: rgba(0, 0, 0, 0.02);
  border: 1px solid var(--border-subtle);
  padding: 8px 16px;
  border-radius: 20px;
  font-size: 14px;
  font-weight: 500;
  display: inline-block;
  margin-bottom: 24px;
}
.score-narrative {
  color: var(--text-secondary);
  font-size: 15px;
  line-height: 1.6;
  max-width: 800px;
  margin: 0 auto;
}

.report-section {
  display: flex;
  flex-direction: column;
  gap: 20px;
}
.report-section h2 {
  font-size: 22px;
  border-bottom: 1px solid var(--border-subtle);
  padding-bottom: 10px;
  color: var(--text-primary);
}

.charts-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 24px;
}
.chart-box {
  background-color: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 24px;
}
.chart-box h3 {
  font-size: 16px;
  margin-bottom: 20px;
  color: var(--text-secondary);
  text-align: center;
}

.section-breakdown-card {
  background-color: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 24px;
  margin-bottom: 16px;
}
.sbc-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
}
.sbc-header h3 {
  font-size: 16px;
}
.sbc-score {
  font-weight: 700;
  font-size: 18px;
}
.score-bar-wrap {
  width: 100%;
  height: 8px;
  background-color: var(--bg-base);
  border-radius: 4px;
  margin-bottom: 16px;
}
.score-bar-fill {
  height: 100%;
  border-radius: 4px;
}
.sbc-stats {
  display: flex;
  gap: 16px;
  font-size: 12px;
  margin-bottom: 16px;
}
.stat-good { color: var(--accent-success); }
.stat-partial { color: var(--accent-warning); }
.stat-bad { color: var(--accent-danger); }

.sbc-mistakes {
  background-color: rgba(239, 68, 68, 0.03);
  border-left: 3px solid var(--accent-danger);
  padding: 12px 16px;
  margin-bottom: 16px;
  border-radius: 0 var(--radius-md) var(--radius-md) 0;
}
.sbc-mistakes h4, .sbc-resources h4 {
  font-size: 12px;
  text-transform: uppercase;
  color: var(--text-secondary);
  margin-bottom: 6px;
  letter-spacing: 0.05em;
}
.sbc-mistakes ul, .sbc-resources ul {
  list-style-type: none;
  font-size: 13px;
  padding-left: 4px;
}
.sbc-mistakes li, .sbc-resources li {
  margin-bottom: 6px;
  color: var(--text-secondary);
}
.sbc-resources li a {
  color: var(--accent-primary);
  text-decoration: none;
  font-weight: 500;
}
.sbc-resources li a:hover {
  text-decoration: underline;
}
.perfect-score {
  color: var(--accent-success);
  font-size: 13px;
  margin-bottom: 16px;
  font-weight: 500;
}

/* Accordion */
.accordion {
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  overflow: hidden;
  background-color: var(--bg-surface);
}
.accordion-item {
  border-bottom: 1px solid var(--border-subtle);
}
.accordion-item:last-child {
  border-bottom: none;
}
.accordion-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px 24px;
  cursor: pointer;
  transition: background-color 0.2s ease;
  user-select: none;
}
.accordion-header:hover {
  background-color: var(--bg-card-hover);
}
.accordion-header h3 {
  font-size: 15px;
}
.accordion-icon {
  transition: transform 0.2s ease;
}
.accordion-body {
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.3s cubic-bezier(0, 1, 0, 1);
  background-color: var(--bg-base);
}
.accordion-body.open {
  max-height: 2000px;
  transition: max-height 0.3s ease-in-out;
}
.accordion-content {
  padding: 24px;
}

.review-q-card {
  border-bottom: 1px solid var(--border-subtle);
  padding-bottom: 20px;
  margin-bottom: 20px;
}
.review-q-card:last-child {
  border-bottom: none;
  padding-bottom: 0;
  margin-bottom: 0;
}
.review-q-header {
  display: flex;
  justify-content: space-between;
  margin-bottom: 10px;
  font-size: 12px;
}
.review-q-text {
  font-size: 14px;
  font-weight: 500;
  margin-bottom: 12px;
  color: var(--text-primary);
  white-space: pre-wrap;
}
.review-answer-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  margin-bottom: 12px;
  font-size: 13px;
}
.answer-box {
  padding: 12px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-subtle);
}
.answer-box.user-incorrect {
  border-color: rgba(239, 68, 68, 0.3);
  background-color: rgba(239, 68, 68, 0.05);
}
.answer-box.user-correct {
  border-color: rgba(16, 185, 129, 0.3);
  background-color: rgba(16, 185, 129, 0.05);
}
.answer-box.correct-box {
  border-color: rgba(16, 185, 129, 0.3);
  background-color: rgba(16, 185, 129, 0.05);
}
.review-explanation {
  background-color: var(--bg-surface);
  padding: 12px;
  border-radius: var(--radius-md);
  font-size: 13px;
  color: var(--text-secondary);
}

/* Personality block styling */
.personality-card {
  display: grid;
  grid-template-columns: 1fr 1.2fr;
  gap: 24px;
  background-color: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 28px;
}
.personality-info {
  display: flex;
  flex-direction: column;
  gap: 16px;
}
.archetype-title-wrap {
  display: flex;
  align-items: center;
  gap: 12px;
}
.archetype-emoji {
  font-size: 32px;
}
.archetype-name {
  font-size: 24px;
  color: var(--accent-purple);
}
.personality-points h4 {
  font-size: 13px;
  text-transform: uppercase;
  color: var(--text-muted);
  margin-bottom: 6px;
}
.personality-points ul {
  list-style: none;
  padding-left: 0;
}
.personality-points li {
  margin-bottom: 8px;
  font-size: 13px;
  color: var(--text-secondary);
  display: flex;
  align-items: flex-start;
  gap: 6px;
}
.personality-points.strengths li::before { content: "✓"; color: var(--accent-success); }
.personality-points.blindspots li::before { content: "⚠"; color: var(--accent-warning); }

/* Gaps Table styling */
.gaps-table-wrap {
  background-color: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  overflow: hidden;
}
.gaps-table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
  font-size: 14px;
}
.gaps-table th, .gaps-table td {
  padding: 16px 20px;
  border-bottom: 1px solid var(--border-subtle);
}
.gaps-table th {
  background-color: rgba(0, 0, 0, 0.02);
  font-weight: 600;
  color: var(--text-secondary);
}
.gaps-table tr:last-child td {
  border-bottom: none;
}
.severity-badge {
  padding: 4px 8px;
  border-radius: 4px;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
}
.severity-badge.critical { background-color: rgba(239, 68, 68, 0.1); color: var(--accent-danger); }
.severity-badge.important { background-color: rgba(245, 158, 11, 0.1); color: var(--accent-warning); }
.severity-badge.minor { background-color: rgba(6, 182, 212, 0.1); color: var(--accent-cyan); }
.severity-badge.strength { background-color: rgba(16, 185, 129, 0.1); color: var(--accent-success); }

/* Study Plan Grid styling */
.plan-subtitle {
  color: var(--text-secondary);
  font-size: 14px;
}
.plan-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 20px;
}
.plan-week {
  background-color: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 24px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}
.week-badge {
  background-color: var(--accent-glow);
  color: var(--accent-primary);
  padding: 4px 10px;
  border-radius: 12px;
  font-size: 11px;
  font-weight: 600;
  align-self: flex-start;
}
.plan-item {
  border-left: 2px solid var(--border-subtle);
  padding-left: 12px;
  margin-bottom: 8px;
  font-size: 13px;
}
.plan-item strong {
  display: block;
  margin-bottom: 4px;
  color: var(--text-primary);
}
.plan-item p {
  color: var(--text-secondary);
}

.report-actions {
  display: flex;
  justify-content: center;
  gap: 16px;
  margin-top: 20px;
}

/* Responsive styles */
@media (max-width: 1024px) {
  #screen-question.screen.active {
    display: flex;
    flex-direction: column;
    height: 100vh;
    height: 100dvh;
    overflow: hidden;
  }
  .q-header {
    flex-shrink: 0;
  }
  .q-body {
    flex-grow: 1;
    overflow-y: auto;
    padding: 24px 20px;
    display: flex;
    flex-direction: column;
    gap: 20px;
    align-content: stretch;
  }
  .q-footer {
    flex-shrink: 0;
    padding: 16px 20px;
    border-top: 1px solid var(--border-subtle);
    background-color: var(--bg-surface);
  }
  .neural-map {
    display: none !important;
  }
  .charts-row {
    grid-template-columns: 1fr;
  }
  .personality-card {
    grid-template-columns: 1fr;
  }
  .plan-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 991px) {
  #screen-intro.screen.active {
    flex-direction: column;
    height: 100vh;
    height: 100dvh;
    overflow-y: auto;
    overflow-x: hidden;
  }
  .intro-left {
    flex: none;
    padding: 40px 24px 32px;
    border-right: none;
    border-bottom: 1px solid var(--border-subtle);
  }
  .intro-right {
    flex: none;
    padding: 32px 24px 48px;
  }
  .intro-form-card {
    max-width: 100%;
    box-shadow: none;
    border: none;
    padding: 0;
    background: transparent;
  }
  .intro-brand h1 {
    font-size: 32px;
  }
}

@media (max-width: 768px) {
  .tf-container {
    grid-template-columns: 1fr;
  }
  .review-answer-grid {
    grid-template-columns: 1fr;
  }
  .matching-pair {
    grid-template-columns: 1fr;
    gap: 8px;
  }
}

@media (max-width: 480px) {
  .intro-stats {
    grid-template-columns: 1fr;
    gap: 12px;
  }
  .intro-resume-row {
    flex-direction: column;
    gap: 12px;
  }
  .intro-resume-row .btn-secondary {
    width: 100%;
  }
  .intro-resume-row .resume-code-input {
    width: 100%;
  }
}

/* Print Overrides */
@media print {
  html, body {
    background-color: #fff !important;
    color: #000 !important;
    overflow: visible !important;
    height: auto !important;
  }
  .screen {
    display: block !important;
  }
  #screen-intro, #screen-question, #screen-break, #screen-loading {
    display: none !important;
  }
  .report {
    background-color: #fff !important;
    color: #000 !important;
  }
  .report-hero, .chart-box, .section-breakdown-card, .personality-card, .gaps-table-wrap, .plan-week {
    background-color: #fff !important;
    color: #000 !important;
    border: 1px solid #ddd !important;
    box-shadow: none !important;
  }
  .report-hero::before {
    display: none;
  }
  .score-number {
    color: #000 !important;
  }
  .sbc-resources, .report-actions, .accordion-header::after {
    display: none !important;
  }
  .accordion-body {
    max-height: none !important;
    background-color: #fff !important;
  }
  .accordion-content {
    padding: 0 !important;
  }
}

/* Maximum content constraints for clean layout */
.options-container,
.tf-container,
.sortable-list,
.slider-container,
.code-editor-wrap,
.matching-container,
.scenario-questions-wrap,
.likert-container,
.rank-list,
.fillblank-inputs-wrap {
  max-width: 800px;
  width: 100%;
  margin-top: 10px;
}

/* Resume Assessment Section */
.resume-assessment-section {
  width: 100%;
  max-width: 400px;
  margin-top: 32px;
  padding-top: 24px;
  border-top: 1px dashed var(--border-subtle);
}
.resume-divider {
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 16px;
}
.resume-divider::before,
.resume-divider::after {
  content: "";
  flex: 1;
  border-bottom: 1px solid var(--border-subtle);
}
.resume-divider span {
  padding: 0 12px;
  font-size: 11px;
  font-weight: 700;
  color: var(--text-muted);
  letter-spacing: 0.1em;
}

/* Modals & Dialog overlays */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(15, 23, 42, 0.4);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  transition: opacity 0.2s ease;
}
.modal-card {
  background-color: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-xl);
  padding: 32px;
  max-width: 450px;
  width: 90%;
  box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.08), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
  animation: modal-scale 0.25s cubic-bezier(0.16, 1, 0.3, 1);
  text-align: left;
}
@keyframes modal-scale {
  from { transform: scale(0.96); opacity: 0; }
  to { transform: scale(1); opacity: 1; }
}

/* ─── PRINT / SAVE AS PDF ────────────────────────────────── */
@media print {
  html, body {
    height: auto !important;
    overflow: visible !important;
    background: #fff !important;
  }

  /* Hide everything except the report */
  .screen {
    display: none !important;
  }
  #screen-report.screen.active {
    display: block !important;
    height: auto !important;
    overflow: visible !important;
    max-width: 100% !important;
    padding: 24px !important;
    margin: 0 !important;
  }

  /* Remove box shadows for cleaner ink */
  .report-hero,
  .section-breakdown-card,
  .chart-box,
  .personality-card,
  .accordion,
  .gaps-table-wrap,
  .plan-week {
    box-shadow: none !important;
    border: 1px solid #e2e8f0 !important;
    break-inside: avoid;
  }

  /* Hide action buttons when printing */
  .report-actions {
    display: none !important;
  }

  /* Force accordion bodies open so all content prints */
  .accordion-body {
    display: block !important;
    max-height: none !important;
  }

  canvas {
    max-width: 100% !important;
  }
}


