/* ============================================================
   matrAIx.ai — Persona Attribute Survey
   ============================================================ */

/* Keep the global site header visually identical to the homepage. */
.play-body .nav {
  padding: 18px clamp(20px, 5vw, 40px);
  gap: 20px;
  background: var(--bg);
}

.play-body .brand {
  flex-shrink: 0;
  gap: 6px;
}

.play-body .brand-name {
  display: inline-block;
  white-space: nowrap;
  word-break: keep-all;
  flex: none;
  font-family: "Orbitron", "Space Grotesk", var(--disp) !important;
  font-weight: 700;
  font-size: 1.92rem;
  letter-spacing: .025em;
  line-height: 1;
  transform: scaleX(1.05) scaleY(.88);
  transform-origin: left center;
}

.play-body .brand-name em {
  display: inline-block;
  margin-right: .09em;
  transform: translateX(.035em);
}

.play-body .nav-links {
  gap: clamp(14px, 1.8vw, 26px);
  justify-content: center;
  margin-top: 0;
  flex: 1;
  max-height: none;
  opacity: 1;
  visibility: visible;
  transition: none;
}

.play-body .nav-links a {
  font-size: .76rem;
}

.play-body .nav-github {
  flex: none;
  color: var(--ink-dim);
  text-decoration: none;
  font-family: var(--disp);
  font-size: .74rem;
  letter-spacing: .06em;
  text-transform: uppercase;
  transition: color .2s;
}

.play-body .nav-github:hover {
  color: var(--phos);
}

.play-body .nav-cta {
  flex-shrink: 0;
  padding: 9px 16px;
  border-radius: 10px;
  font-family: "Space Grotesk", var(--disp);
  font-size: .9rem;
  letter-spacing: -.01em;
  text-transform: none;
  color: #f7fbff;
  background: linear-gradient(135deg, #245d88 0%, #347eae 58%, #3c8cbd 100%);
  border-color: rgba(93, 166, 214, .62);
  box-shadow: 0 10px 28px rgba(8, 38, 61, .32), inset 0 1px 0 rgba(255, 255, 255, .13);
}

.play-body .nav-cta:hover {
  color: #fff;
  background: linear-gradient(135deg, #2b6c9d 0%, #3d8dbc 58%, #48a0ce 100%);
  border-color: rgba(123, 195, 237, .78);
  box-shadow: 0 14px 34px rgba(7, 40, 64, .4), 0 0 0 3px rgba(74, 143, 194, .11), inset 0 1px 0 rgba(255, 255, 255, .17);
  transform: translateY(-2px);
}

.play-main {
  max-width: 1200px;
  margin: 0 auto;
  padding: 112px clamp(20px, 5vw, 64px) 64px;
}

.play-head {
  margin-bottom: 20px;
}

.play-title {
  margin: 12px 0 0;
  font-family: var(--disp);
  font-size: clamp(1.9rem, 4vw, 2.8rem);
}

.play-intro {
  max-width: 76ch;
  margin: 14px 0 0;
  color: var(--ink);
  font-size: 1.05rem;
  line-height: 1.65;
}

.play-sub {
  margin: 8px 0 0;
  color: var(--ink-dim);
  max-width: 80ch;
}

.toolbar {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 14px;
}

.tool-field {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.tool-field.grow {
  flex: 1;
  min-width: 280px;
}

.tool-field > span {
  font-size: var(--text-xs);
  letter-spacing: var(--tracking-widest);
  text-transform: uppercase;
  color: var(--ink);
}

.tool-field input,
.tool-field select,
.dim-field select,
.gauge-row select {
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--bg-2);
  color: var(--ink);
  padding: 10px 12px;
  font-family: var(--disp);
  font-size: var(--text-sm);
  min-height: 44px;
}

/* Native select collapses below the 44px touch minimum without an explicit height. */
.tool-field select,
.dim-field select,
.gauge-row select {
  height: 44px;
  padding-right: 34px;
  cursor: pointer;
  appearance: none;
  -webkit-appearance: none;
  background-image: linear-gradient(45deg, transparent 50%, currentColor 50%),
    linear-gradient(135deg, currentColor 50%, transparent 50%);
  background-position: calc(100% - 18px) calc(50% + 2px), calc(100% - 13px) calc(50% + 2px);
  background-size: 5px 5px, 5px 5px;
  background-repeat: no-repeat;
}

.tool-field select:hover,
.dim-field select:hover,
.gauge-row select:hover {
  border-color: var(--phos);
}

.tool-field input:focus,
.tool-field select:focus,
.dim-field select:focus,
.gauge-row select:focus {
  outline: none;
  border-color: var(--phos);
}

.play-progress {
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 10px 12px;
  background: var(--bg-2);
  margin-bottom: 12px;
}

.summary-line {
  font-size: var(--text-sm);
}

.summary-line b {
  color: var(--phos);
}

.save-hint {
  display: block;
  margin-top: 6px;
  font-size: var(--text-xs);
  color: var(--ink);
}

/* Same trap as .tab-list: an author `display` outranks the UA stylesheet's [hidden] rule. */
.search-summary[hidden] {
  display: none;
}

/* Visibility (not [hidden]) so it can fade, and so it stays out of the tab order while hidden. */
.back-to-top {
  position: fixed;
  right: 24px;
  bottom: 24px;
  z-index: 40;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 44px;
  padding: 10px 16px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--bg-2);
  color: var(--ink);
  font-family: var(--disp);
  font-size: 12px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  cursor: pointer;
  opacity: 0;
  visibility: hidden;
  transform: translateY(8px);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.45);
  transition: opacity 0.2s ease, transform 0.2s ease, visibility 0.2s, border-color 0.2s ease, background 0.2s ease;
}

.back-to-top.is-visible {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

/* Tint via background-image so the opaque background-color survives: this button floats over
   scrolling content, so a translucent `background` would let the page show through it. */
.back-to-top:hover {
  border-color: var(--phos);
  background-image: linear-gradient(rgba(74, 143, 194, 0.16), rgba(74, 143, 194, 0.16));
}

.back-to-top:focus-visible {
  outline: 2px solid var(--phos);
  outline-offset: 2px;
}

.back-to-top-arrow {
  font-size: 14px;
  line-height: 1;
  color: var(--phos);
}

@media (prefers-reduced-motion: reduce) {
  .back-to-top {
    transition: opacity 0.2s ease, visibility 0.2s;
    transform: none;
  }
}

@media (max-width: 720px) {
  .back-to-top {
    right: 16px;
    bottom: 16px;
  }
}

.search-summary {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px;
  margin-bottom: 12px;
  padding: 10px 14px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: rgba(74, 143, 194, 0.06);
  font-size: 13px;
}

.search-summary-text {
  flex: 1;
  min-width: 180px;
  color: var(--ink);
}

.link-btn {
  border: none;
  background: none;
  padding: 6px 2px;
  min-height: 32px;
  color: var(--phos);
  font-size: 13px;
  text-decoration: underline;
  text-underline-offset: 3px;
  cursor: pointer;
}

.link-btn:hover {
  color: var(--cyan);
}

.tab-list-note {
  width: 100%;
  margin: 0 0 4px;
  font-size: 11px;
  color: var(--ink);
  opacity: 0.6;
}

.group-tab .tab-count.is-match {
  background: rgba(74, 143, 194, 0.3);
  color: var(--ink);
}

.tab-wrap {
  margin-bottom: 12px;
}

/* Collapsed group nav: the toggle names the current group, the full list opens on demand. */
.group-nav-toggle {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  width: 100%;
  min-height: 52px;
  padding: 10px 14px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--bg-2);
  color: var(--ink);
  cursor: pointer;
  text-align: left;
  transition: border-color 0.18s ease, background 0.18s ease;
}

.group-nav-toggle:hover {
  border-color: var(--phos);
  background: rgba(74, 143, 194, 0.08);
}

.group-nav-toggle:focus-visible {
  outline: 2px solid var(--phos);
  outline-offset: 2px;
}

.group-nav-current {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.group-nav-current strong {
  font-size: 15px;
  color: var(--ink);
}

.group-nav-step {
  font-size: 10px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  opacity: 0.6;
}

.group-nav-hint {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  flex: none;
  font-size: 12px;
  color: var(--phos);
  white-space: nowrap;
}

.group-nav-caret {
  font-size: 10px;
}

/* An author `display` beats the UA stylesheet's [hidden] rule, so hiding needs to be explicit. */
.tab-list[hidden] {
  display: none;
}

.tab-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 10px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--bg-2);
  max-height: 340px;
  overflow-y: auto;
}

.group-tab {
  border: 1px solid var(--line);
  background: var(--bg-3);
  color: var(--ink);
  border-radius: 999px;
  padding: 8px 14px;
  min-height: 44px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  max-width: 100%;
  transition: border-color 0.18s ease, background 0.18s ease, transform 0.18s ease;
}

/* Without these the pills read as inert labels rather than choices. */
.group-tab:hover {
  border-color: var(--phos);
  background: rgba(74, 143, 194, 0.12);
  transform: translateY(-1px);
}

.group-tab:focus-visible {
  outline: 2px solid var(--phos);
  outline-offset: 2px;
}

.group-tab .tab-name {
  font-size: 13px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 220px;
}

.group-tab .tab-count {
  font-size: 11px;
  padding: 2px 7px;
  border-radius: 999px;
  background: rgba(127, 127, 127, 0.18);
  opacity: 0.9;
}

.group-tab.is-active {
  border-color: var(--phos);
  background: rgba(74, 143, 194, 0.18);
  box-shadow: var(--glow);
  font-weight: 600;
}

.group-tab.is-done {
  border-color: #2fa56f;
}

.group-tab.is-done .tab-count {
  background: rgba(47, 165, 111, 0.22);
  color: #3fbf7f;
}

.group-tab.is-done .tab-name::before {
  content: "✓";
  margin-right: 6px;
  color: #3fbf7f;
}

.group-tab.is-skipped {
  border-style: dashed;
  opacity: 0.75;
}

.play-step {
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 16px;
  background: var(--bg-2);
  min-height: 320px;
}

.gauge-card {
  border: 1px dashed var(--line);
  border-radius: 12px;
  padding: 12px;
  margin-bottom: 14px;
}

.smart-card {
  border: 1px dashed #2f86c1;
  border-radius: 12px;
  padding: 12px;
  margin-bottom: 14px;
  background: rgba(47, 134, 193, 0.05);
}

.smart-card h3 {
  margin: 0 0 8px;
  font-size: var(--text-base);
  color: #77c2f0;
}

.smart-card p {
  margin: 0 0 10px;
  color: var(--ink);
  font-size: var(--text-sm);
}

.smart-box,
.interactive-box {
  border: 1px dashed #2f86c1;
  border-radius: 12px;
  padding: 14px;
  margin-bottom: 14px;
  background: rgba(47, 134, 193, 0.05);
}

.interactive-box {
  border-color: #6b8cff;
  background: rgba(107, 140, 255, 0.06);
}

.smart-box h3,
.interactive-box h3 {
  margin: 0 0 8px;
  font-size: var(--text-base);
  color: #77c2f0;
}

.smart-box p,
.interactive-box p {
  margin: 0 0 12px;
  color: var(--ink);
  font-size: var(--text-sm);
}

.skip-bar,
.skip-banner {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 10px 12px;
  margin-bottom: 12px;
  background: rgba(255, 255, 255, 0.02);
}

.skip-banner {
  border-color: #8a6d3b;
  background: rgba(240, 174, 58, 0.08);
}

.skip-bar p,
.skip-banner p {
  margin: 0;
  flex: 1;
  min-width: 200px;
}

.interactive-question {
  margin-bottom: 16px;
}

.interactive-question h4 {
  margin: 0 0 10px;
  font-size: 15px;
  color: var(--ink);
}

.example-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 10px;
}

.example-option {
  display: flex;
  flex-direction: column;
  gap: 8px;
  text-align: left;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 10px;
  background: var(--bg-2);
  color: var(--ink);
  cursor: pointer;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.example-option:hover {
  border-color: var(--phos);
}

.example-option.is-active {
  border-color: #6b8cff;
  box-shadow: 0 0 0 1px rgba(107, 140, 255, 0.35);
}

.example-option strong {
  font-size: 13px;
}

.example-code {
  margin: 0;
  padding: 10px;
  border-radius: 8px;
  background: rgba(0, 0, 0, 0.35);
  overflow-x: auto;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-size: 11px;
  line-height: 1.45;
  color: #d6e4ff;
  white-space: pre;
}

.smart-question h4 {
  margin: 0 0 8px;
  font-size: 14px;
}

.smart-options {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 10px;
}

.smart-option {
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 8px 12px;
  background: var(--bg-2);
  color: var(--ink);
  cursor: pointer;
}

.smart-option.is-active {
  border-color: var(--phos);
  box-shadow: var(--glow);
}

.smart-options-rich {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 10px;
}

.smart-option-rich {
  border-radius: 12px;
  padding: 10px 12px;
  text-align: left;
  display: flex;
  flex-direction: column;
  gap: 6px;
  width: 100%;
  align-items: stretch;
}

.smart-option-rich strong {
  font-size: 13px;
}

.smart-example {
  font-size: 12px;
  line-height: 1.45;
  color: var(--muted, #9aa4b2);
  font-style: italic;
  white-space: pre-wrap;
}

.smart-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 8px;
}

.dimension-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 12px;
}

.value-choice {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 10px 6px 6px;
  border: 1px solid transparent;
  border-radius: 10px;
  min-height: 44px;
  font-size: 13px;
  line-height: 1.35;
  cursor: pointer;
  max-width: 100%;
}

.value-choice:hover {
  border-color: var(--line);
  background: rgba(107, 192, 232, 0.06);
}

.value-choice span {
  word-break: break-word;
}

.value-choice input[type="radio"],
.matrix-choice input[type="radio"] {
  flex: none;
  width: 22px;
  height: 22px;
  margin: 0;
  accent-color: var(--cyan);
  cursor: pointer;
}

.value-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 2px;
}

/* Shared-option groups render as a matrix: dimensions down, options across. */
/* No scrolling ancestor here: it would trap the sticky header and make it move out of view with
   the table. Narrow screens use labeled answer cards instead of horizontal panning. */
.matrix-wrap {
  overflow: visible;
  margin-bottom: 12px;
}

.matrix-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

.matrix-table th,
.matrix-table td {
  text-align: center;
  vertical-align: middle;
  border-bottom: 1px solid var(--line-soft);
}

.matrix-table thead th {
  position: sticky;
  top: 80px;
  z-index: 2;
  padding: 10px 8px;
  background: var(--bg-3);
  color: var(--ink);
  font-size: 12px;
  font-weight: 600;
  line-height: 1.25;
  border-bottom: 1px solid var(--line);
  box-shadow: 0 10px 18px -16px rgba(0, 0, 0, 0.9);
}

.matrix-option-head {
  min-width: 76px;
}

.matrix-row-head {
  position: sticky;
  left: 0;
  z-index: 1;
  display: table-cell;
  min-width: 180px;
  max-width: 280px;
  padding: 8px 12px;
  text-align: left;
  background: var(--bg-2);
  font-weight: 500;
}

.matrix-corner {
  z-index: 3;
  background: var(--bg-3);
}

.matrix-row-label {
  display: block;
  color: var(--ink);
  font-size: 13px;
  line-height: 1.35;
  font-weight: 600;
}

.matrix-row-desc {
  display: block;
  margin-top: 2px;
  color: var(--ink);
  opacity: 0.75;
  font-size: 11px;
  line-height: 1.4;
}

/* The row head is the sticky column, so tint it with a background-image and leave its opaque
   background-color intact — a translucent `background` lets scrolled cells show through it. */
.matrix-row:hover .matrix-row-head {
  background-image: linear-gradient(rgba(107, 192, 232, 0.07), rgba(107, 192, 232, 0.07));
}

.matrix-row:hover .matrix-cell {
  background: rgba(107, 192, 232, 0.07);
}

.matrix-cell {
  padding: 0;
}

/* The label fills the cell so the whole column-width box is a tap target. */
.matrix-choice {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 48px;
  padding: 4px;
  cursor: pointer;
}

.matrix-choice-label {
  display: none;
}

/* Tailwind's `sm` boundary and above keep the matrix. Compress its columns between phone and
   desktop widths so the table still fits without horizontal page overflow. */
@media (min-width: 640px) and (max-width: 900px) {
  .matrix-table {
    table-layout: fixed;
    font-size: 12px;
  }

  .matrix-row-head {
    width: 28%;
    min-width: 0;
    max-width: none;
    padding: 8px;
  }

  .matrix-option-head {
    min-width: 0;
    padding: 9px 3px !important;
    font-size: 10px !important;
    overflow-wrap: anywhere;
  }

  .matrix-row-desc {
    display: none;
  }
}

@media (max-width: 639px) {
  .matrix-table,
  .matrix-table tbody {
    display: block;
    width: 100%;
  }

  .matrix-table thead {
    display: none;
  }

  .matrix-table tbody {
    display: grid;
    gap: 12px;
  }

  .matrix-row,
  .dimension-grid .dimension-card {
    padding: 0;
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    overflow: hidden;
    border: 0;
    border-radius: 12px;
    background: var(--bg-2);
    box-shadow: 0 0 0 1px var(--line-soft);
  }

  .matrix-table .matrix-row-head,
  .dimension-card .dim-card-head {
    position: static;
    grid-column: 1 / -1;
    display: block;
    min-width: 0;
    max-width: none;
    padding: 12px;
    margin: 0;
    text-align: left;
    border-bottom: 1px solid var(--line-soft);
    background: var(--bg-3);
  }

  .matrix-table .matrix-row-label,
  .dimension-card .dim-card-title {
    font-size: 13px;
    line-height: 1.35;
    font-weight: 600;
  }

  .matrix-table .matrix-row-desc,
  .dimension-card .dim-card-desc {
    display: block;
    margin-top: 4px;
    margin-bottom: 0;
    font-size: 11px;
    line-height: 1.4;
    opacity: 0.75;
  }

  .dimension-card .value-grid {
    grid-column: 1 / -1;
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0;
  }

  .matrix-cell,
  .value-choice {
    display: block;
    min-width: 0;
    max-width: none;
    margin: 0;
    border: 0;
    border-radius: 0;
    border-bottom: 1px solid var(--line-soft);
  }

  .matrix-cell:nth-of-type(odd),
  .value-choice:nth-child(odd) {
    border-right: 1px solid var(--line-soft);
  }

  .matrix-choice,
  .value-choice {
    display: flex;
    align-items: center;
    justify-content: flex-start;
    gap: 9px;
    min-height: 48px;
    padding: 8px 10px;
    background: transparent;
  }

  .matrix-cell.is-synthetic-opt-out,
  .value-choice.is-synthetic-opt-out {
    grid-column: 1 / -1;
    border-right: 0;
  }

  .matrix-choice-label,
  .value-choice span {
    display: block;
    min-width: 0;
    color: var(--ink);
    font-size: 12px;
    line-height: 1.25;
    overflow-wrap: anywhere;
  }

  .value-choice:hover {
    border-color: var(--line-soft);
  }

  .value-choice input[type="radio"],
  .matrix-choice input[type="radio"] {
    width: 24px;
    height: 24px;
  }
}

/* TIPI (Big Five) personality gauge — Likert scale + sliders */
.tipi-grid {
  display: flex;
  flex-direction: column;
  gap: 16px;
  margin-top: 10px;
}

.tipi-item {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.tipi-prompt {
  font-size: 14px;
  line-height: 1.4;
  color: var(--ink);
}

.tipi-choices {
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
}

.tipi-choice {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  min-width: 34px;
  font-size: 13px;
  cursor: pointer;
}

.gauge-grid {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: 14px;
}

.gauge-item {
  display: grid;
  grid-template-columns: 160px 1fr 44px;
  align-items: center;
  gap: 12px;
  font-size: 13px;
}

.gauge-item input[type="range"] {
  width: 100%;
}

@media (max-width: 560px) {
  .gauge-item {
    grid-template-columns: 100px 1fr 40px;
    gap: 8px;
  }
}

/* .play-step already draws the bordered container this sits in — duplicating it here produced
   two identical rounded boxes 16px apart. */
.group-panel {
  display: block;
}

.muted {
  color: var(--ink);
  opacity: 0.85;
  font-size: var(--text-sm);
}

.manual-toggle-card {
  border: 1px dashed var(--line);
  border-radius: 12px;
  padding: 12px;
  margin-bottom: 14px;
}

.manual-toggle-card p {
  margin: 0 0 10px;
  color: var(--ink);
  font-size: var(--text-sm);
}

.gauge-card h3 {
  margin: 0 0 8px;
  font-size: var(--text-base);
  color: var(--phos);
}

.gauge-card p {
  margin: 0 0 10px;
  color: var(--ink);
  font-size: var(--text-sm);
}

.gauge-list {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 10px;
  margin-bottom: 10px;
}

.gauge-row {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.gauge-row span {
  font-size: 12px;
  color: var(--ink);
}

.dim-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 12px;
}

.dimension-card {
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 12px;
  background: rgba(80, 137, 184, 0.04);
  min-width: 0;
}

.dim-card-head {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 4px;
  margin-bottom: 8px;
}

.dim-card-title {
  margin: 0;
  font-size: 15px;
  line-height: 1.35;
  font-weight: 600;
  color: var(--ink);
  word-break: break-word;
}

.dim-card-desc {
  margin: 0 0 10px;
  font-size: 12px;
  line-height: 1.45;
  color: var(--ink);
  opacity: 0.9;
}

.dim-top {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  align-items: start;
}

.dim-name {
  font-weight: 600;
  color: var(--ink);
  font-size: 15px;
}

.dim-id {
  color: var(--ink);
  opacity: 0.8;
  font-size: 11px;
  white-space: nowrap;
}

.dim-desc {
  margin: 8px 0 10px;
  font-size: 12px;
  color: var(--ink);
  min-height: 34px;
}

.dim-field {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.dim-field > span {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--ink);
}

.empty {
  font-size: var(--text-sm);
  color: var(--ink);
  padding: 12px;
}

.play-controls {
  margin-top: 14px;
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
}

/* Controls are zoned by intent: navigation, then finish, then destructive.
   A flat row of equally-weighted buttons gave Reset the same visual claim as Next. */
.control-zone {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
  margin-top: 14px;
}

.control-flow {
  padding-top: 14px;
  border-top: 1px solid var(--line);
}

/* Pushes Next to the right edge: back-left / forward-right wizard convention. */
.control-next {
  margin-left: auto;
}

.btn-quiet {
  background: none;
  border-color: transparent;
  color: var(--ink);
  opacity: 0.7;
}

.btn-quiet:hover {
  opacity: 1;
  border-color: var(--line);
}

.control-finish,
.control-danger {
  flex-direction: column;
  align-items: stretch;
  gap: 8px;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 12px;
  background: var(--bg-2);
}

.control-danger {
  border-color: rgba(220, 38, 38, 0.35);
  background: rgba(220, 38, 38, 0.04);
}

.control-zone-label {
  margin: 0;
  font-family: var(--disp, inherit);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ink);
  opacity: 0.6;
}

.control-danger .control-zone-label {
  color: var(--rose);
  opacity: 0.9;
}

.control-zone-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.btn-danger {
  background: none;
  color: var(--rose);
  border-color: var(--rose);
}

.btn-danger:hover {
  background: var(--rose);
  color: #fff;
  border-color: var(--rose);
}

/* Progress: a reachable per-group bar, with overall kept deliberately secondary. */
.progress-head {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 8px;
}

.save-indicator {
  font-size: 11px;
  color: var(--ink);
  opacity: 0.55;
  white-space: nowrap;
}

.save-indicator[data-saved="true"]::before {
  content: "●";
  margin-right: 5px;
  color: #3fbf7f;
  font-size: 8px;
  vertical-align: middle;
}

.save-indicator[data-failed="true"] {
  color: var(--rose);
  opacity: 1;
  font-weight: 600;
}

.save-indicator[data-failed="true"]::before {
  content: "●";
  margin-right: 5px;
  color: var(--rose);
  font-size: 8px;
  vertical-align: middle;
}

.progress-track {
  height: 8px;
  border-radius: 999px;
  background: var(--bg-3);
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--phos), var(--cyan));
  transition: width 0.3s ease;
}

.progress-foot {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-top: 6px;
  font-size: 12px;
  color: var(--ink);
}

.progress-group-count {
  font-size: 14px;
  font-weight: 600;
  color: var(--ink);
}

.progress-overall {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  opacity: 0.6;
  font-size: 11px;
}

.progress-overall-bar {
  display: inline-block;
  width: 60px;
  height: 3px;
  border-radius: 999px;
  background: var(--bg-3);
  overflow: hidden;
}

.progress-overall-bar span {
  display: block;
  height: 100%;
  background: var(--ink-dim);
}

/* Submission reminder inside the report — the report is no longer gated behind the export. */
.report-submit {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin: 18px 0 8px;
  padding: 14px 16px;
  border: 1px solid var(--amber);
  border-radius: 12px;
  background: rgba(217, 119, 6, 0.07);
}

.report-submit[data-state="done"] {
  border-color: rgba(63, 191, 127, 0.5);
  background: rgba(63, 191, 127, 0.07);
}

.report-submit-copy {
  flex: 1;
  min-width: 220px;
}

.report-submit h3 {
  margin: 0 0 4px;
  font-size: 15px;
  color: var(--ink);
}

.report-submit p {
  margin: 0;
  font-size: 13px;
  line-height: 1.5;
  color: var(--ink);
  opacity: 0.85;
}

@media (max-width: 720px) {
  .control-next {
    margin-left: 0;
  }

  .control-flow .btn,
  .control-zone-actions .btn {
    flex: 1 1 auto;
    justify-content: center;
  }
}

.play-controls.secondary {
  margin-top: 8px;
}

.play-status {
  font-size: var(--text-sm);
  color: var(--ink);
}

.play-status[data-tone="ok"] {
  color: #3fbf7f;
}

.play-status[data-tone="warn"] {
  color: #f0ae3a;
}

.play-status[data-tone="error"] {
  color: #ff5f5f;
}

/* MatrAIx 36 result report */
.matraix-report {
  position: relative;
  margin-top: 28px;
  border: 1px solid rgba(91, 219, 255, 0.45);
  border-radius: 20px;
  padding: clamp(18px, 4vw, 38px);
  overflow: hidden;
  background:
    radial-gradient(circle at 85% 5%, rgba(99, 102, 241, 0.18), transparent 32%),
    radial-gradient(circle at 8% 22%, rgba(26, 211, 255, 0.11), transparent 30%),
    var(--bg-2);
  box-shadow: 0 24px 80px rgba(0, 0, 0, 0.28);
}

.matraix-report[hidden] {
  display: none;
}

.report-kicker,
.report-section-label,
.report-signature,
.report-match-label {
  font-family: "JetBrains Mono", ui-monospace, monospace;
  text-transform: uppercase;
  letter-spacing: 0.12em;
}

.report-kicker {
  margin: 0 0 14px;
  color: var(--phos);
  font-size: 11px;
}

.report-hero {
  display: grid;
  grid-template-columns: minmax(0, 1.4fr) minmax(280px, 0.6fr);
  gap: 28px;
  align-items: end;
  padding-bottom: 28px;
  border-bottom: 1px solid var(--line);
}

.report-title {
  max-width: 16ch;
  margin: 0;
  font-family: var(--disp);
  font-size: clamp(2.3rem, 7vw, 5.4rem);
  line-height: 0.94;
  letter-spacing: -0.045em;
  color: var(--ink);
}

.report-tagline {
  max-width: 68ch;
  margin: 18px 0 0;
  font-size: clamp(15px, 2vw, 18px);
  line-height: 1.65;
  color: var(--ink);
  opacity: 0.88;
}

.report-identity-card {
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 18px;
  background: rgba(0, 0, 0, 0.12);
}

.report-signature {
  margin-bottom: 16px;
  color: var(--phos);
  font-size: clamp(13px, 2vw, 17px);
  overflow-wrap: anywhere;
}

.report-meta-row {
  display: flex;
  justify-content: space-between;
  gap: 14px;
  padding: 8px 0;
  border-top: 1px solid var(--line);
  font-size: 13px;
}

.report-meta-row span:first-child {
  color: var(--ink);
  opacity: 0.65;
}

.report-meta-row strong {
  text-align: right;
  color: var(--ink);
}

.report-body {
  display: grid;
  grid-template-columns: repeat(12, minmax(0, 1fr));
  gap: 14px;
  margin-top: 18px;
}

.report-card {
  grid-column: span 6;
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 18px;
  background: rgba(80, 137, 184, 0.04);
}

.report-card.wide {
  grid-column: 1 / -1;
}

.report-card.accent {
  border-color: rgba(91, 219, 255, 0.34);
  background: rgba(47, 134, 193, 0.075);
}

.report-section-label {
  margin: 0 0 10px;
  color: var(--phos);
  font-size: 10px;
}

.report-card h3 {
  margin: 0 0 12px;
  font-family: var(--disp);
  font-size: clamp(18px, 2.5vw, 24px);
  color: var(--ink);
}

.report-card p {
  margin: 0;
  color: var(--ink);
  font-size: 14px;
  line-height: 1.7;
  opacity: 0.9;
}

.report-list {
  display: grid;
  gap: 10px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.report-list li {
  position: relative;
  padding-left: 18px;
  color: var(--ink);
  font-size: 14px;
  line-height: 1.55;
}

.report-list li::before {
  content: "↳";
  position: absolute;
  left: 0;
  color: var(--phos);
}

.report-score-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 22px;
}

.report-score-group h4 {
  margin: 0 0 14px;
  color: var(--ink);
  font-size: 13px;
}

.report-score-row {
  display: grid;
  grid-template-columns: 110px 1fr 30px;
  gap: 10px;
  align-items: center;
  margin-top: 9px;
}

.report-match-label {
  color: var(--ink);
  font-size: 9px;
  opacity: 0.78;
  overflow: hidden;
  text-overflow: ellipsis;
}

.report-score-track {
  height: 6px;
  overflow: hidden;
  border-radius: 999px;
  background: rgba(128, 148, 170, 0.18);
}

.report-score-fill {
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, #4ea8ff, var(--phos));
}

.report-score-value {
  font-family: "JetBrains Mono", ui-monospace, monospace;
  color: var(--ink);
  font-size: 10px;
  text-align: right;
}

.report-evidence {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  margin-top: 12px;
}

.report-evidence-chip {
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 6px 9px;
  color: var(--ink);
  background: rgba(255, 255, 255, 0.025);
  font-family: "JetBrains Mono", ui-monospace, monospace;
  font-size: 10px;
}

.report-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 20px;
}

.report-disclaimer {
  margin: 16px 0 0;
  max-width: 100ch;
  color: var(--ink);
  font-size: 11px;
  line-height: 1.55;
  opacity: 0.58;
}

@media (max-width: 760px) {
  .play-main {
    padding: 100px 14px 44px;
  }
  .group-tab .name {
    max-width: 150px;
  }
  .dim-grid,
  .gauge-list,
  .example-grid,
  .dimension-grid {
    grid-template-columns: 1fr;
  }
  .report-hero,
  .report-score-grid {
    grid-template-columns: 1fr;
  }
  .report-card {
    grid-column: 1 / -1;
  }
  .report-score-row {
    grid-template-columns: 88px 1fr 28px;
  }
}

@media (max-width: 1120px) {
  .play-body .nav-github {
    display: none;
  }
}

@media (max-width: 820px) {
  .play-body .nav {
    gap: 0;
    flex-wrap: nowrap;
    justify-content: space-between;
  }

  .play-body .brand {
    flex: 0;
  }

  .play-body .nav-toggle {
    display: flex !important;
    order: 2;
    position: relative;
    z-index: 21;
    pointer-events: auto;
  }

  .play-body .nav-cta,
  .play-body .nav > .nav-github {
    display: none;
  }

  .play-body .nav-links {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    z-index: 20;
    display: flex !important;
    flex-direction: column;
    gap: 0;
    padding: 0;
    margin-top: 0;
    max-height: 0;
    opacity: 0;
    visibility: hidden;
    overflow: hidden;
    transition: none;
    background: #0a0a0a !important;
    border-bottom: 1px solid var(--line-soft);
    box-shadow: 0 18px 36px rgba(0, 0, 0, .45);
    backdrop-filter: blur(14px);
  }

  .play-body .nav-links.active {
    max-height: 500px !important;
    opacity: 1 !important;
    visibility: visible !important;
  }

  .play-body .nav-links a {
    display: block;
    padding: 14px clamp(20px, 5vw, 40px);
    border-bottom: 1px solid var(--line-soft);
    text-align: center;
  }
}

@media print {
  .grain,
  .scanlines,
  .nav,
  .play-head,
  .play-quiz,
  .foot,
  .report-actions {
    display: none !important;
  }
  .play-main {
    max-width: none;
    padding: 0;
  }
  .matraix-report {
    margin: 0;
    border: 0;
    box-shadow: none;
    background: #fff;
    color: #111;
  }
  .report-card,
  .report-identity-card {
    break-inside: avoid;
  }
}
