/* ── Psychtest player — scoped styles (site variables from themes.css) ─────── */

.psychtest-player-page {
  max-width: 860px;
  margin: 0 auto;
  padding: 0 16px 64px;
}

.psychtest-player-topbar {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  padding: 12px 0 8px;
}

.lang-toggle {
  min-width: 76px;
  text-align: center;
}

.player-card,
.summary-card {
  background: var(--paper, #fffdf9);
  border: 1px solid var(--line, #d7cfc0);
  border-radius: 18px;
  box-shadow: 0 18px 45px rgba(31, 37, 48, 0.08);
  padding: 28px;
}

.summary-card {
  margin-top: 22px;
}

.player-card h1 {
  font-size: clamp(1.6rem, 3vw, 2.4rem);
  font-weight: 700;
  line-height: 1.15;
  margin: 0 0 8px;
}

.player-card h2 {
  font-size: 1.35rem;
  font-weight: 700;
  margin: 0;
}

.player-section-title {
  margin: 24px 0 12px;
  line-height: 1.4;
}

.progress {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 22px;
}

.progress-bar {
  flex: 1;
  height: 8px;
  border-radius: 999px;
  background: var(--line, #ebe4d6);
  overflow: hidden;
}

.progress-bar span {
  display: block;
  height: 100%;
  background: var(--accent, #0d6b62);
}

.page-copy {
  margin-bottom: 24px;
  line-height: 1.7;
}

.page-copy p {
  margin: 0 0 0.8em;
}

.field-group {
  border-top: 1px solid var(--line, #d7cfc0);
  padding: 18px 0;
}

.field-group:first-of-type {
  border-top: 0;
  padding-top: 0;
}

.field-label {
  display: block;
  font-weight: 600;
  margin-bottom: 10px;
}

.choice-list {
  display: grid;
  gap: 10px;
}

.choice {
  display: flex;
  gap: 10px;
  align-items: start;
  padding: 10px 12px;
  background: var(--paper, #fbf8f1);
  border: 1px solid var(--line, #d7cfc0);
  border-radius: 12px;
}

input[type="text"],
input[type="number"],
textarea,
select {
  width: 100%;
  border: 1px solid var(--line, #cdbfa8);
  border-radius: 12px;
  padding: 10px 14px;
  background: var(--paper, #fffdfa);
  color: var(--ink, #1e2430);
  font: inherit;
}

textarea {
  min-height: 120px;
  resize: vertical;
}

.validation {
  margin: 0 0 18px;
  color: #9d2f2f;
  font-weight: 600;
  min-height: 1.2em;
}

.card-actions,
.nav-row,
.result-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 22px;
}

button.button-primary,
button.button-secondary,
a.button-link {
  appearance: none;
  border: 0;
  border-radius: 999px;
  padding: 11px 22px;
  font: inherit;
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
  transition: transform 140ms ease, opacity 140ms ease;
  display: inline-block;
}

button.button-primary,
a.button-link.button-primary {
  color: #fff;
  background: var(--accent, #0d6b62);
}

button.button-secondary,
a.button-link.button-secondary {
  color: var(--ink, #1e2430);
  background: var(--line, #ebe4d6);
}

button:hover,
a.button-link:hover {
  transform: translateY(-1px);
}

button:disabled {
  opacity: 0.4;
  cursor: not-allowed;
  transform: none;
}

.summary-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 14px;
  margin-top: 18px;
}

.score-card {
  padding: 16px;
  border-radius: 14px;
  background: var(--paper, #faf4ea);
  border: 1px solid var(--line, #d7cfc0);
}

.score-card strong {
  display: block;
  font-size: 1.6rem;
  font-weight: 700;
}

.score-note {
  color: var(--muted, #5f6675);
  font-size: 0.9rem;
  margin-bottom: 4px;
}

.score-pct {
  display: block;
  font-size: 0.82rem;
  color: var(--accent, #0d6b62);
  margin-top: 2px;
}

.empty {
  padding: 24px;
  text-align: center;
  color: var(--muted, #5f6675);
}

/* ── Likert table ─────────────────────────────────────────────────────────── */

.likert-table-wrap {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  margin: 0.5rem 0;
}

.likert-table {
  width: 100%;
  min-width: 480px;
  border-collapse: collapse;
  font-size: 0.88rem;
}

.likert-table thead th {
  font-weight: 500;
  font-size: 0.75rem;
  text-align: center;
  padding: 0.3rem 0.4rem 0.6rem;
  color: var(--muted, #5f6675);
  vertical-align: bottom;
  line-height: 1.3;
  min-width: 52px;
}

.likert-table thead th:first-child {
  text-align: right;
  min-width: 120px;
  max-width: 200px;
}

.likert-item {
  text-align: right;
  padding: 0.5rem 0.75rem 0.5rem 0;
  color: var(--ink, #1e2430);
  line-height: 1.5;
  vertical-align: middle;
}

.likert-cell {
  text-align: center;
  padding: 0.4rem;
  vertical-align: middle;
}

.likert-table tbody tr:nth-child(even) {
  background: rgba(31, 37, 48, 0.03);
}

.likert-table input[type="radio"] {
  cursor: pointer;
  width: 16px;
  height: 16px;
  accent-color: var(--accent, #0d6b62);
}

/* ── Eyes test / task media ───────────────────────────────────────────────── */

.task-media {
  margin: 18px 0;
}

.task-image,
.task-video {
  display: block;
  max-width: 100%;
  border-radius: 14px;
  border: 1px solid var(--line, #d7cfc0);
}

.image-choice-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 12px;
}

.image-choice {
  display: grid;
  gap: 8px;
  padding: 12px;
  background: var(--paper, #fbf8f1);
  border: 1px solid var(--line, #d7cfc0);
  border-radius: 14px;
  cursor: pointer;
}

.image-choice:hover {
  border-color: var(--accent, #0d6b62);
}

.choice-image {
  width: 100%;
  border-radius: 10px;
}

.task-arena {
  min-height: 140px;
  display: grid;
  place-items: center;
  padding: 20px;
  border: 1px solid var(--line, #d7cfc0);
  border-radius: 16px;
  background: var(--paper, #fffdfa);
  margin-bottom: 18px;
}

/* ── Per-test interpretation ─────────────────────────────────────────────── */

.interp-wrap {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-top: 4px;
}

.interp-banner {
  padding: .7rem 1rem;
  border-radius: 8px;
  font-size: .85rem;
  line-height: 1.55;
  border-left: 4px solid;
  margin: 0;
}
.interp-banner--screener {
  background: color-mix(in srgb, var(--accent, #0d6b62) 8%, var(--paper, #fffdf9));
  border-color: var(--accent, #0d6b62);
}

/* Screener result */
.interp-screener {
  padding: 1.1rem 1.25rem;
  border-radius: 10px;
  border: 1px solid var(--line, #d7cfc0);
}
.interp-screener--positive {
  border-color: #b97c2e;
  background: color-mix(in srgb, #b97c2e 7%, var(--paper, #fffdf9));
}
.interp-screener--negative {
  border-color: var(--accent, #0d6b62);
  background: color-mix(in srgb, var(--accent, #0d6b62) 6%, var(--paper, #fffdf9));
}
.interp-screener-badge {
  display: block;
  font-size: 1.05rem;
  font-weight: 700;
  margin-bottom: .4rem;
}
.interp-screener-explain {
  font-size: .85rem;
  color: var(--muted, #5f6675);
  margin: 0;
  line-height: 1.5;
}

/* Secondary score row (ASRS Part B) */
.interp-secondary {
  display: flex;
  align-items: center;
  gap: .75rem;
  padding-top: .75rem;
  border-top: 1px solid var(--line, #d7cfc0);
}
.interp-secondary-label { font-size: .85rem; color: var(--muted, #5f6675); flex: 1; }
.interp-secondary-value { font-size: 1.4rem; font-weight: 700; }
.interp-secondary-max   { font-size: .9rem; font-weight: 400; color: var(--muted, #5f6675); }

/* Supporting detail grid (MDQ) */
.interp-support-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
  gap: 10px;
}
.interp-support-item {
  padding: .75rem;
  border: 1px solid var(--line, #d7cfc0);
  border-radius: 8px;
  text-align: center;
}
.interp-support-label { font-size: .78rem; color: var(--muted, #5f6675); margin-bottom: .3rem; line-height: 1.3; }
.interp-support-value { font-size: 1.5rem; font-weight: 700; }

/* Severity card (PHQ-9, GAD-7) */
.interp-severity-card {
  padding: 1rem 1.25rem;
  border: 1px solid var(--line, #d7cfc0);
  border-radius: 10px;
}
.interp-severity-label   { font-size: .85rem; color: var(--muted, #5f6675); margin-bottom: .5rem; }
.interp-severity-display { display: flex; align-items: center; gap: 1rem; }
.interp-severity-score   { font-size: 2.8rem; font-weight: 800; line-height: 1; }
.interp-severity-max     { font-size: 1.1rem; font-weight: 400; color: var(--muted, #5f6675); }
.interp-severity-band    { font-size: 1rem; font-weight: 600; padding: .3rem .75rem; border-radius: 20px; }

/* Band scale bar */
.interp-band-scale {
  display: flex;
  gap: .2rem;
  margin-top: .6rem;
  font-size: .72rem;
  text-align: center;
}
.band-step      { flex: 1; padding: .35rem .2rem; border-radius: 4px; line-height: 1.3; }
.band-none      { background: color-mix(in srgb, #4caf50 15%, var(--paper, #fffdf9)); color: #2e7d32; }
.band-mild      { background: color-mix(in srgb, #8bc34a 15%, var(--paper, #fffdf9)); color: #558b2f; }
.band-moderate  { background: color-mix(in srgb, #ff9800 15%, var(--paper, #fffdf9)); color: #e65100; }
.band-severe    { background: color-mix(in srgb, #f44336 15%, var(--paper, #fffdf9)); color: #b71c1c; }

/* DASS-21 subscale grid */
.interp-dass-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 10px;
}
.interp-dass-item  { padding: 1rem; border: 1px solid var(--line, #d7cfc0); border-radius: 10px; text-align: center; }
.interp-dass-label { font-size: .82rem; color: var(--muted, #5f6675); margin-bottom: .35rem; }
.interp-dass-score { font-size: 2rem; font-weight: 800; line-height: 1; }
.interp-dass-band  { font-size: .78rem; font-weight: 600; margin-top: .3rem; padding: .15rem .45rem; border-radius: 10px; display: inline-block; }

/* ── Mobile ───────────────────────────────────────────────────────────────── */

@media (max-width: 720px) {
  .psychtest-player-page {
    padding: 0 8px 40px;
  }

  .player-card,
  .summary-card {
    padding: 18px 16px;
  }

  .likert-table thead { display: none; }
  .likert-table { min-width: unset; }
  .likert-table tbody tr {
    display: block;
    margin-bottom: 1rem;
    border-top: 1px solid var(--line, #d7cfc0);
    padding-top: 0.5rem;
  }
  .likert-table tbody tr:nth-child(even) { background: none; }
  .likert-item {
    display: block;
    text-align: left;
    padding: 0 0 0.5rem 0;
    font-weight: 500;
  }
  .likert-cell { display: inline-block; }
  .likert-cell::before {
    content: attr(data-label);
    display: block;
    font-size: 0.7rem;
    color: var(--muted, #5f6675);
  }
}
