:root {
  --primary: #2C5282;
  --primary-light: #3B82C4;
  --primary-dark: #1A365D;
  --accent: #38A169;
  --accent-light: #48BB78;
  --bg: #F0F4F8;
  --card: #FFFFFF;
  --text: #2D3748;
  --muted: #718096;
  --border: #E2E8F0;
  --danger: #E53E3E;
  --warning: #D69E2E;
  --success: #38A169;
  --radius: 12px;
  --shadow: 0 2px 12px rgba(0,0,0,0.08);
  --shadow-lg: 0 8px 32px rgba(0,0,0,0.12);
}

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

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  min-height: 100vh;
}

/* ─── HEADER ─── */
header {
  background: linear-gradient(135deg, var(--primary-dark) 0%, var(--primary) 60%, var(--primary-light) 100%);
  color: white;
  padding: 2.5rem 1.5rem 3rem;
  text-align: center;
  position: relative;
}
header .back {
  position: absolute;
  left: 1.5rem;
  top: 1.5rem;
  color: rgba(255,255,255,0.8);
  text-decoration: none;
  font-size: 0.9rem;
  display: flex;
  align-items: center;
  gap: 0.3rem;
  transition: color 0.2s;
}
header .back:hover { color: white; }
header .logo { font-size: 2.5rem; margin-bottom: 0.3rem; }
header h1 { font-size: 1.8rem; font-weight: 700; margin-bottom: 0.4rem; }
header p { font-size: 1rem; opacity: 0.85; max-width: 540px; margin: 0 auto; }

/* ─── MAIN ─── */
main { max-width: 960px; margin: 0 auto; padding: 2rem 1.2rem 4rem; }

/* ─── DISCLAIMER ─── */
.disclaimer {
  background: #EBF8FF;
  border-left: 4px solid var(--primary);
  border-radius: 0 var(--radius) var(--radius) 0;
  padding: 1rem 1.2rem;
  margin-bottom: 2rem;
  font-size: 0.88rem;
  color: #2B6CB0;
}
.disclaimer strong { display: block; margin-bottom: 0.25rem; }

/* ─── TEST GRID ─── */
.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(270px, 1fr));
  gap: 1.2rem;
}
.card {
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 1.5rem;
  display: flex;
  flex-direction: column;
  transition: transform 0.15s, box-shadow 0.15s;
  text-decoration: none;
  color: inherit;
  border: 1px solid var(--border);
}
.card:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow-lg);
}
.card-icon { font-size: 2rem; margin-bottom: 0.8rem; }
.card h2 { font-size: 1.1rem; font-weight: 700; color: var(--primary); margin-bottom: 0.4rem; }
.card p { font-size: 0.87rem; color: var(--muted); flex: 1; margin-bottom: 1rem; }
.card-meta {
  display: flex;
  gap: 1rem;
  font-size: 0.8rem;
  color: var(--muted);
  margin-bottom: 1rem;
}
.card-meta span { display: flex; align-items: center; gap: 0.25rem; }
.btn {
  display: inline-block;
  background: var(--primary);
  color: white;
  border: none;
  border-radius: 8px;
  padding: 0.6rem 1.2rem;
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
  text-align: center;
  transition: background 0.2s, transform 0.1s;
  width: 100%;
}
.btn:hover { background: var(--primary-dark); transform: translateY(-1px); }
.btn-accent { background: var(--accent); }
.btn-accent:hover { background: #2F855A; }

/* ─── TEST FORM ─── */
.test-wrapper { max-width: 680px; margin: 0 auto; }

.progress-bar-outer {
  background: var(--border);
  border-radius: 99px;
  height: 6px;
  margin-bottom: 2rem;
  overflow: hidden;
}
.progress-bar-inner {
  background: linear-gradient(90deg, var(--primary), var(--accent-light));
  height: 100%;
  border-radius: 99px;
  transition: width 0.4s ease;
}

.question-block {
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 1.5rem;
  margin-bottom: 1.2rem;
  border: 1px solid var(--border);
}
.question-block .q-num {
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--primary);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 0.5rem;
}
.question-block .q-text { font-size: 1rem; font-weight: 600; margin-bottom: 1rem; }

.options { display: flex; flex-direction: column; gap: 0.5rem; }
.opt {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.6rem 0.8rem;
  border-radius: 8px;
  border: 2px solid var(--border);
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s;
  font-size: 0.9rem;
}
.opt:hover { border-color: var(--primary-light); background: #EBF8FF; }
.opt input[type=radio] { accent-color: var(--primary); width: 18px; height: 18px; cursor: pointer; }
.opt.selected { border-color: var(--primary); background: #EBF8FF; font-weight: 600; }

/* Likert row (horizontal) */
.likert {
  display: flex;
  gap: 0.4rem;
  flex-wrap: wrap;
}
.likert .opt {
  flex: 1;
  flex-direction: column;
  text-align: center;
  padding: 0.5rem 0.3rem;
  font-size: 0.78rem;
  min-width: 60px;
}
.likert .opt input { margin: 0 auto 0.25rem; }

.submit-area { text-align: center; margin-top: 2rem; }

/* ─── RESULTS ─── */
.results-box {
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  padding: 2rem;
  margin-top: 2rem;
  display: none;
  border: 1px solid var(--border);
}
.results-box.visible { display: block; }

.score-circle {
  width: 120px;
  height: 120px;
  border-radius: 50%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  margin: 0 auto 1.5rem;
  font-size: 2rem;
  font-weight: 700;
  color: white;
  box-shadow: 0 4px 16px rgba(0,0,0,0.15);
}
.score-label { font-size: 0.85rem; font-weight: 400; margin-top: 0.15rem; }

.result-title { font-size: 1.3rem; font-weight: 700; text-align: center; margin-bottom: 0.5rem; }
.result-desc { color: var(--muted); text-align: center; margin-bottom: 1.5rem; font-size: 0.95rem; }

.score-range-bar { margin: 1.5rem 0; }
.score-range-bar label { font-size: 0.82rem; color: var(--muted); margin-bottom: 0.4rem; display: block; }
.bar-track {
  height: 12px;
  border-radius: 99px;
  background: linear-gradient(90deg, #48BB78, #F6AD55, #FC8181);
  position: relative;
  margin-bottom: 0.3rem;
}
.bar-marker {
  position: absolute;
  top: -4px;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: var(--primary-dark);
  border: 3px solid white;
  box-shadow: 0 2px 6px rgba(0,0,0,0.3);
  transform: translateX(-50%);
  transition: left 0.6s ease;
}
.bar-labels {
  display: flex;
  justify-content: space-between;
  font-size: 0.75rem;
  color: var(--muted);
}

.supabase-hint {
  background: #F0FFF4;
  border: 1px dashed #9AE6B4;
  border-radius: 8px;
  padding: 0.9rem 1rem;
  margin-top: 1.5rem;
  font-size: 0.83rem;
  color: #276749;
  text-align: center;
}

/* ─── FOOTER ─── */
footer {
  text-align: center;
  padding: 2rem;
  color: var(--muted);
  font-size: 0.83rem;
  border-top: 1px solid var(--border);
  margin-top: 3rem;
}
footer a { color: var(--primary); text-decoration: none; }

@media (max-width: 600px) {
  header h1 { font-size: 1.4rem; }
  .likert { flex-direction: column; }
  .likert .opt { flex-direction: row; text-align: left; }
}
