/* ─── Reset & base ─────────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; }

:root {
  --bg:      #ffffff;
  --surface: #f8f8f8;
  --border:  #e0e0e0;
  --text:    #111111;
  --muted:   #666666;
  --accent:  #1a1a1a;
  --blue:    #2563eb;
  --green:   #16a34a;
  --red:     #dc2626;
  --radius:  6px;
  --shadow:  0 1px 4px rgba(0,0,0,.08);
}

html { font-size: 16px; -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  font-family: system-ui, -apple-system, "Segoe UI", Helvetica, Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
}

h1, h2, h3 { margin: 0 0 .5rem; font-weight: 600; }
p { margin: 0 0 .75rem; }
a { color: var(--blue); }
a:hover { text-decoration: none; }

/* ─── Shell layout ─────────────────────────────────────────────────────────── */
.shell {
  max-width: 760px;
  margin: 0 auto;
  padding: 1.5rem 1rem 4rem;
}

/* ─── Header ───────────────────────────────────────────────────────────────── */
.top {
  text-align: center;
  margin-bottom: 1.5rem;
}
.top h1 { font-size: 1.5rem; }

.desc { color: var(--muted); }
.muted { color: var(--muted); }
.muted-sm { color: var(--muted); font-size: .875rem; }

/* ─── Card ─────────────────────────────────────────────────────────────────── */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.5rem;
  margin-bottom: 1.25rem;
  box-shadow: var(--shadow);
}
.card.center { text-align: center; }

/* ─── Progress bar ─────────────────────────────────────────────────────────── */
.progress-rail {
  height: 4px;
  background: var(--border);
  border-radius: 2px;
  overflow: hidden;
  margin: .5rem 0;
}
.progress-bar {
  height: 100%;
  background: var(--accent);
  width: 0%;
  transition: width .3s ease;
}

/* ─── Separator ────────────────────────────────────────────────────────────── */
.sep { height: 1px; background: var(--border); margin: 1.25rem 0; }

/* ─── Forms ────────────────────────────────────────────────────────────────── */
.form-grid {
  display: grid;
  gap: .75rem;
  grid-template-columns: 1fr;
}
@media (min-width: 600px) {
  .form-grid { grid-template-columns: 1fr 1fr; }
  .form-row.full { grid-column: 1 / -1; }
}

.form-row { display: flex; flex-direction: column; gap: .35rem; }

.input {
  width: 100%;
  padding: .55rem .7rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font: inherit;
  background: var(--bg);
  color: var(--text);
  transition: border-color .15s;
}
.input:focus {
  outline: none;
  border-color: var(--accent);
}
textarea.input { resize: vertical; }

/* ─── Buttons ──────────────────────────────────────────────────────────────── */
.actions { margin-top: 1rem; display: flex; gap: .5rem; flex-wrap: wrap; justify-content: center; }

.btn-primary, .btn-ghost, .btn-sm {
  display: inline-block;
  padding: .55rem 1.25rem;
  border-radius: var(--radius);
  font: inherit;
  font-size: .95rem;
  cursor: pointer;
  text-decoration: none;
  border: 1px solid;
  transition: background .15s, color .15s;
  line-height: 1.4;
}
.btn-primary {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
}
.btn-primary:hover { background: #333; }
.btn-ghost {
  background: transparent;
  color: var(--text);
  border-color: var(--border);
}
.btn-ghost:hover { background: var(--border); }
.btn-sm { padding: .3rem .75rem; font-size: .85rem; }
button:disabled, .btn-primary:disabled, .btn-ghost:disabled {
  opacity: .4;
  cursor: not-allowed;
}

/* active state for lang buttons */
.btn-ghost.active { border-color: var(--accent); background: var(--accent); color: #fff; }

/* ─── Hagentest ────────────────────────────────────────────────────────────── */
.title-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: .75rem;
}
.timer {
  font-size: 1.1rem;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  padding: .2rem .5rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

.grid-wrap { display: flex; flex-direction: column; align-items: center; }

.stimulus-wrap { margin-bottom: 1rem; }
.stimulus {
  width: 420px;
  max-width: 100%;
  height: auto;
  aspect-ratio: 1;
  object-fit: contain;
  border: 2px solid #000;
  background: #fff;
  display: block;
}

.choices {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 16px;
  max-width: 700px;
  margin: 0 auto;
}
.choice { cursor: pointer; }
.choice img {
  width: 120px;
  height: 120px;
  object-fit: contain;
  border: 2px solid var(--border);
  padding: 2px;
  background: #fff;
  transition: border-color .15s;
  display: block;
}
.choice:hover img { border-color: var(--accent); }
.choice.selected img { border-color: var(--accent); border-width: 3px; }

.feedback {
  margin: .75rem 0;
  font-weight: 600;
  text-align: center;
  min-height: 1.5rem;
}

.gauss-wrap {
  width: 100%;
  overflow: hidden;
  margin: 1rem 0;
}
#gauss { display: block; width: 100%; height: auto; }

#iqHeadline { font-size: 2rem; margin: .75rem 0 .25rem; }
#iqSub { font-size: 1.1rem; color: var(--muted); line-height: 1.5; }

.help { text-align: left; }
.help p { margin-bottom: .75rem; }

label.inline { display: flex; align-items: center; gap: .4rem; justify-content: center; margin: .5rem 0; cursor: pointer; }

/* ─── RAADS-R ──────────────────────────────────────────────────────────────── */
.raads-shell .top { margin-bottom: 1rem; }
.lang-toggle { display: flex; gap: .5rem; justify-content: center; margin-top: .5rem; }

.raads-item-text {
  font-size: 1.1rem;
  font-weight: 500;
  margin: 1rem 0 1.25rem;
  line-height: 1.55;
}

.raads-options {
  display: flex;
  flex-direction: column;
  gap: .5rem;
}
.raads-opt {
  display: block;
  width: 100%;
  text-align: left;
  padding: .65rem 1rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg);
  font: inherit;
  cursor: pointer;
  transition: background .12s, border-color .12s;
}
.raads-opt:hover { background: #f0f0f0; }
.raads-opt-selected {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
}

/* Score table */
.score-table {
  width: 100%;
  border-collapse: collapse;
  margin: 1rem 0;
  font-size: .95rem;
}
.score-table th, .score-table td {
  padding: .5rem .75rem;
  border: 1px solid var(--border);
  text-align: left;
}
.score-table thead { background: var(--surface); font-weight: 600; }
.row-above { background: #fff3f3; }
.row-above td { color: var(--red); }

/* ─── Sizdengelenler ───────────────────────────────────────────────────────── */
.sdg-shell .top { margin-bottom: 1.25rem; }

.qa-card {
  padding: 1rem 1.25rem;
  border-left: 3px solid var(--accent);
  margin-bottom: 1rem;
  background: var(--bg);
  border-radius: 0 var(--radius) var(--radius) 0;
  border: 1px solid var(--border);
  border-left: 3px solid var(--accent);
}
.qa-question {
  font-weight: 600;
  margin-bottom: .5rem;
}
.qa-answer { margin: .5rem 0; }
.qa-img { max-width: 100%; border-radius: var(--radius); margin-top: .5rem; }
.qa-meta { font-size: .8rem; color: var(--muted); margin-top: .5rem; margin-bottom: 0; }

.msg { font-size: .9rem; margin-top: .5rem; }
.msg-ok  { color: var(--green); }
.msg-err { color: var(--red); }

/* ─── Admin dashboard ──────────────────────────────────────────────────────── */
.tab-bar { display: flex; gap: .5rem; margin-bottom: 1rem; }
.tab-btn {
  padding: .4rem 1rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: transparent;
  font: inherit;
  cursor: pointer;
  transition: background .12s;
}
.tab-btn.active { background: var(--accent); color: #fff; border-color: var(--accent); }

.admin-card {
  padding: 1rem 1.25rem;
  border-bottom: 1px solid var(--border);
}
.admin-card:last-child { border-bottom: none; }
.card-actions { margin-top: .5rem; display: flex; gap: .5rem; }

.badge { display: inline-block; padding: .15rem .5rem; border-radius: 3px; font-size: .8rem; }
.badge-pending { background: #fff3cd; color: #856404; border: 1px solid #ffc107; }

/* ─── Modal ────────────────────────────────────────────────────────────────── */
.modal-overlay {
  position: fixed; inset: 0;
  background: rgba(0,0,0,.45);
  display: flex; align-items: center; justify-content: center;
  z-index: 1000;
  padding: 1rem;
}
.modal-box {
  background: var(--bg);
  border-radius: var(--radius);
  padding: 1.5rem;
  max-width: 540px;
  width: 100%;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: 0 8px 32px rgba(0,0,0,.2);
}
.modal-q {
  font-size: 1rem;
  font-weight: 600;
  margin-bottom: 1rem;
  padding-bottom: .75rem;
  border-bottom: 1px solid var(--border);
}

/* ─── Home page ────────────────────────────────────────────────────────────── */
.home-shell { max-width: 860px; }

.home-header {
  text-align: center;
  padding: 3rem 0 2rem;
}
.home-header h1 { font-size: 2rem; letter-spacing: -.5px; }

.home-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 1.25rem;
}

.home-card {
  display: flex;
  flex-direction: column;
  padding: 1.5rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  text-decoration: none;
  color: var(--text);
  transition: border-color .15s, box-shadow .15s;
}
.home-card:hover {
  border-color: var(--accent);
  box-shadow: 0 4px 16px rgba(0,0,0,.08);
}
.home-card-icon { font-size: 1.75rem; margin-bottom: .75rem; }
.home-card h2 { font-size: 1.1rem; margin-bottom: .5rem; }
.home-card p { font-size: .9rem; color: var(--muted); flex: 1; margin-bottom: 1rem; }
.home-card-cta { font-size: .9rem; font-weight: 600; color: var(--accent); }

/* ─── Home nav ─────────────────────────────────────────────────────────────── */
.home-nav {
  position: fixed;
  top: 10px;
  left: 12px;
  z-index: 200;
}
.home-nav a {
  display: flex;
  align-items: center;
  gap: 5px;
  text-decoration: none;
  color: var(--muted);
  font-size: .8rem;
  font-weight: 600;
  padding: 5px 9px;
  border-radius: var(--radius);
  border: 1px solid transparent;
  transition: color .15s, background .15s, border-color .15s;
  line-height: 1;
}
.home-nav a:hover {
  color: var(--text);
  background: var(--surface);
  border-color: var(--border);
}

/* ─── Footer ───────────────────────────────────────────────────────────────── */
.site-footer {
  text-align: center;
  padding: 2rem 1rem;
  font-size: .85rem;
  color: var(--muted);
}
.site-footer a { color: var(--muted); text-decoration: none; }
.site-footer a:hover { color: var(--text); }
.site-footer-sep { margin: 0 .5rem; }

/* ─── Responsive ───────────────────────────────────────────────────────────── */
@media (max-width: 480px) {
  .stimulus { width: 100%; }
  .choice img { width: 90px; height: 90px; }
  #iqHeadline { font-size: 1.5rem; }
  .shell { padding: 1rem .75rem 3rem; }
}
