/* Evaluate.MyTherapist — mobile-first stylesheet */
:root {
  --brand:      #0d7c8a;   /* SPARRC teal */
  --brand-dark: #095c66;
  --accent:     #f4a340;
  --ok:         #1e9e5a;
  --bad:        #d64545;
  --ink:        #1c2733;
  --muted:      #64748b;
  --line:       #e2e8f0;
  --bg:         #f4f7f9;
  --card:       #ffffff;
  --radius:     14px;
  --shadow:     0 2px 10px rgba(16,42,67,.08);
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  color: var(--ink);
  background: var(--bg);
  line-height: 1.5;
  font-size: 16px;
}
a { color: var(--brand); }

/* layout ------------------------------------------------------------------ */
.wrap { width: 100%; max-width: 760px; margin: 0 auto; padding: 16px; }
.wrap-wide { max-width: 1040px; }
header.top {
  background: var(--brand);
  color: #fff;
  padding: 14px 16px;
  display: flex;
  align-items: center;
  gap: 12px;
  position: sticky;
  top: 0;
  z-index: 20;
}
header.top .brand { font-weight: 700; font-size: 1.05rem; letter-spacing: .2px; }
header.top .brand small { display: block; font-weight: 400; opacity: .85; font-size: .72rem; }
header.top .spacer { flex: 1; }
header.top a { color: #fff; text-decoration: none; font-size: .9rem; opacity: .9; }

.card {
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 20px;
  margin-bottom: 16px;
}
h1 { font-size: 1.5rem; margin: .2em 0 .4em; }
h2 { font-size: 1.15rem; margin: 0 0 .6em; }
.muted { color: var(--muted); }
.center { text-align: center; }

/* forms ------------------------------------------------------------------- */
label { display: block; font-weight: 600; margin: 14px 0 6px; font-size: .92rem; }
input[type=text], input[type=password], input[type=number], select, textarea {
  width: 100%;
  padding: 13px 14px;
  border: 1px solid var(--line);
  border-radius: 10px;
  font-size: 1rem;
  font-family: inherit;
  background: #fff;
}
textarea { min-height: 90px; resize: vertical; }
input:focus, select:focus, textarea:focus {
  outline: none; border-color: var(--brand); box-shadow: 0 0 0 3px rgba(13,124,138,.15);
}
.btn {
  display: inline-block;
  width: 100%;
  padding: 15px 18px;
  background: var(--brand);
  color: #fff;
  border: none;
  border-radius: 12px;
  font-size: 1.05rem;
  font-weight: 700;
  cursor: pointer;
  text-align: center;
  text-decoration: none;
  -webkit-tap-highlight-color: transparent;
}
.btn:active { background: var(--brand-dark); }
.btn.secondary { background: #eef2f5; color: var(--ink); }
.btn.small { width: auto; padding: 9px 14px; font-size: .9rem; border-radius: 9px; }
.btn.danger { background: var(--bad); }
.btn.ghost { background: transparent; color: var(--brand); border: 1px solid var(--brand); }
.row { display: flex; gap: 10px; flex-wrap: wrap; }
.row > * { flex: 1; min-width: 0; }

/* level cards (home) ------------------------------------------------------ */
.levels { display: grid; grid-template-columns: 1fr; gap: 12px; }
.level-opt {
  display: block;
  border: 2px solid var(--line);
  border-radius: var(--radius);
  padding: 16px;
  cursor: pointer;
  transition: border-color .15s, background .15s;
  background: #fff;
}
.level-opt input { position: absolute; opacity: 0; }
.level-opt .lv-title { font-weight: 700; font-size: 1.1rem; }
.level-opt .lv-sub { color: var(--muted); font-size: .9rem; }
.level-opt.sel, .level-opt:has(input:checked) {
  border-color: var(--brand); background: #ecf7f8;
}

/* exam -------------------------------------------------------------------- */
.timerbar {
  position: sticky; top: 52px; z-index: 15;
  background: #fff; border: 1px solid var(--line); border-radius: 12px;
  padding: 10px 14px; margin-bottom: 14px;
  display: flex; align-items: center; gap: 10px;
  box-shadow: var(--shadow); font-weight: 700;
}
.timerbar .t { margin-left: auto; font-variant-numeric: tabular-nums; }
.timerbar.warn { color: var(--bad); }
.qcard { background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow);
  padding: 18px; margin-bottom: 14px; }
.qcard .qnum { color: var(--brand); font-weight: 700; font-size: .82rem; text-transform: uppercase; letter-spacing: .5px; }
.qcard .topic-tag { display: inline-block; background: #eef2f5; color: var(--muted);
  border-radius: 999px; padding: 2px 10px; font-size: .72rem; margin-left: 8px; }
.qcard .stem { font-size: 1.05rem; font-weight: 600; margin: 8px 0 14px; }
.qcard img.qimg { width: 100%; max-width: 460px; border-radius: 10px; border: 1px solid var(--line); margin-bottom: 12px; display: block; }
.opts { display: grid; gap: 10px; }
.opt {
  display: flex; align-items: flex-start; gap: 12px;
  border: 1.5px solid var(--line); border-radius: 12px; padding: 13px 14px;
  cursor: pointer; -webkit-tap-highlight-color: transparent; background: #fff;
}
.opt input { margin-top: 3px; transform: scale(1.25); accent-color: var(--brand); flex: none; }
.opt .key { font-weight: 700; color: var(--brand); flex: none; }
.opt:has(input:checked) { border-color: var(--brand); background: #ecf7f8; }

/* result / certificate ---------------------------------------------------- */
.scorebig { font-size: 3rem; font-weight: 800; line-height: 1; }
.badge { display: inline-block; padding: 6px 16px; border-radius: 999px; font-weight: 700; }
.badge.pass { background: #e3f6ec; color: var(--ok); }
.badge.fail { background: #fbe6e6; color: var(--bad); }
.cert {
  border: 3px double var(--brand); border-radius: 16px; padding: 28px; text-align: center;
  background: linear-gradient(180deg,#fff, #f4fbfc);
}
.cert .seal { font-size: 2.4rem; }
.bar { height: 10px; border-radius: 999px; background: #eef2f5; overflow: hidden; }
.bar > span { display: block; height: 100%; background: var(--brand); }
.bar.lo > span { background: var(--bad); }
.bar.mid > span { background: var(--accent); }
.bar.hi > span { background: var(--ok); }

/* tables ------------------------------------------------------------------ */
.tablewrap { overflow-x: auto; -webkit-overflow-scrolling: touch; border-radius: 12px; }
table { width: 100%; border-collapse: collapse; font-size: .9rem; background: #fff; }
th, td { text-align: left; padding: 10px 12px; border-bottom: 1px solid var(--line); white-space: nowrap; }
th { background: #f1f5f8; font-size: .78rem; text-transform: uppercase; letter-spacing: .4px; color: var(--muted); }
tr:last-child td { border-bottom: none; }
.pill { padding: 2px 9px; border-radius: 999px; font-size: .78rem; font-weight: 700; }
.pill.pass { background: #e3f6ec; color: var(--ok); }
.pill.fail { background: #fbe6e6; color: var(--bad); }
.pill.pend { background: #fdf3e2; color: #b7791f; }

/* stat tiles -------------------------------------------------------------- */
.tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(130px,1fr)); gap: 12px; }
.tile { background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); padding: 16px; }
.tile .n { font-size: 1.8rem; font-weight: 800; color: var(--brand); }
.tile .l { color: var(--muted); font-size: .82rem; }

/* 3D viewer -------------------------------------------------------------- */
.viewer3d {
  position: relative;
  width: 100%;
  height: 62vh; max-height: 460px; min-height: 300px;
  border: 1.5px solid var(--line);
  border-radius: 12px;
  background: radial-gradient(circle at 50% 40%, #f7fbfc, #e8eef2);
  overflow: hidden;
  touch-action: none;              /* let OrbitControls own touch gestures */
}
.viewer3d canvas { display: block; }
.viewer3d-status {
  position: absolute; inset: 0; display: flex; align-items: center; justify-content: center;
  color: var(--muted); font-size: .9rem; pointer-events: none;
}
.viewer3d-hint { font-size: .8rem; color: var(--muted); margin: 6px 2px 0; }
.picked-name {
  display: inline-block; margin-top: 8px; padding: 6px 14px; border-radius: 999px;
  background: #ecf7f8; color: var(--brand-dark); font-weight: 700; min-width: 120px; text-align: center;
}
.picked-name:empty::before { content: "— tap a muscle —"; color: var(--muted); font-weight: 400; }

.notice { background: #fdf3e2; border: 1px solid #f0d9a8; color: #8a6218; padding: 12px 14px; border-radius: 10px; font-size: .9rem; }
.error { background: #fbe6e6; border: 1px solid #f0bcbc; color: #a12b2b; padding: 12px 14px; border-radius: 10px; }

/* wider screens ----------------------------------------------------------- */
@media (min-width: 620px) {
  .levels { grid-template-columns: 1fr; }
  .btn.auto { width: auto; }
}

/* print (certificate) ----------------------------------------------------- */
@media print {
  header.top, .noprint { display: none !important; }
  body { background: #fff; }
  .card { box-shadow: none; }
}
