:root {
  color-scheme: dark;
  --bg: #0f1112;
  --surface: #171a1d;
  --surface-2: #202429;
  --line: #31373d;
  --text: #eef2f1;
  --muted: #9aa4a6;
  --accent: #60d2ad;
  --accent-2: #e7b45c;
  --bad: #df6b72;
  --heart: #ff6b91;
  --heart-soft: #ffd1dc;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--text);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

button,
select,
input {
  font: inherit;
}

a {
  color: inherit;
}

.nav-link {
  display: inline-flex;
  align-items: center;
  text-decoration: none;
}

button {
  min-height: 36px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--surface-2);
  color: var(--text);
  cursor: pointer;
}

button:hover {
  border-color: var(--accent);
}

button.active,
.tab.active {
  border-color: var(--accent);
  background: var(--accent);
  color: #07120f;
}

button:disabled {
  cursor: default;
  opacity: 0.45;
}

.shell {
  width: min(1580px, calc(100vw - 32px));
  margin: 0 auto;
  padding: 22px 0 42px;
}

.hero {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 24px;
}

h1,
h2,
p {
  margin: 0;
}

h1 {
  font-size: clamp(2rem, 4vw, 4.8rem);
  line-height: 0.95;
  letter-spacing: 0;
}

.hero p,
.section-head p {
  margin-top: 8px;
  color: var(--muted);
}

.stats {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  flex-wrap: wrap;
}

.stats span {
  min-width: 128px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--surface);
  color: var(--muted);
  text-align: right;
}

.stats b {
  color: var(--text);
}

.navrow {
  display: flex;
  justify-content: space-between;
  gap: 14px;
  margin-top: 22px;
  padding: 12px 0;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}

.tabs,
.actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.actions {
  justify-content: flex-end;
  color: var(--muted);
  font-size: 0.88rem;
}

.tab,
.actions button {
  min-height: 32px;
  padding: 0 10px;
}

.category-strip {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 16px 0;
}

.category-chip {
  min-height: 30px;
  padding: 0 10px;
  border-radius: 6px;
  color: var(--muted);
  font-size: 0.82rem;
}

.category-chip.active {
  color: #07120f;
  background: var(--accent);
  border-color: var(--accent);
}

.lab {
  display: block;
  gap: 16px;
  margin-top: 18px;
}

body:not([data-view="gallery"]) .category-strip,
body:not([data-view="gallery"]) .lab {
  display: none;
}

body:not([data-view="gallery"]) .view {
  margin-top: 18px;
}

.viewer {
  min-width: 0;
}

canvas {
  width: 100%;
  aspect-ratio: 16 / 9;
  display: block;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #050607;
}

.viewer-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 12px 0 0;
}

.viewer-footer div {
  min-width: 0;
  display: grid;
  gap: 4px;
}

.viewer-footer strong {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.viewer-footer span {
  overflow: hidden;
  color: var(--muted);
  font-size: 0.86rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.control-panel {
  display: flex;
  flex-direction: column;
  gap: 14px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
}

.info-panel .field + .field,
.info-panel .field + .buttons,
.info-panel .buttons + .metrics {
  margin-top: 12px;
}

.field {
  display: grid;
  gap: 8px;
}

label {
  color: var(--muted);
  font-size: 0.8rem;
}

select,
input[type="range"] {
  width: 100%;
}

input,
textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--surface-2);
  color: var(--text);
}

input {
  min-height: 38px;
  padding: 0 10px;
}

input[type="number"] {
  min-height: 36px;
}

textarea {
  min-height: 86px;
  padding: 10px;
  resize: vertical;
}

select {
  height: 38px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--surface-2);
  color: var(--text);
}

.buttons {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.metrics {
  display: grid;
  gap: 9px;
  margin: auto 0 0;
}

.metrics div {
  display: flex;
  justify-content: space-between;
  gap: 14px;
  padding-top: 9px;
  border-top: 1px solid var(--line);
}

dt {
  color: var(--muted);
}

dd {
  margin: 0;
  text-align: right;
}

.view {
  display: none;
  margin-top: 28px;
}

.view.active {
  display: block;
}

.section-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 14px;
}

.section-tools {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 14px;
  width: 100%;
}

.section-tools label {
  display: grid;
  gap: 5px;
  min-width: 160px;
  color: var(--muted);
  font-size: 0.78rem;
}

.pager {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  color: var(--muted);
  font-size: 0.82rem;
  white-space: nowrap;
}

.pager button {
  min-height: 30px;
  padding: 0 10px;
}

h2 {
  font-size: 1.2rem;
}

.gallery {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 14px;
}

.compact-gallery {
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
}

.shader-card {
  height: 360px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  display: flex;
  flex-direction: column;
}

.shader-card[data-code-url] {
  cursor: pointer;
}

.shader-card[data-code-url]:hover,
.shader-card[data-code-url]:focus-visible {
  border-color: var(--accent);
  outline: none;
}

.shader-card.selected {
  border-color: var(--accent);
  box-shadow: 0 0 0 1px var(--accent);
}

.shader-card.selected .shader-card-body {
  background: #12221d;
}

.shader-card-preview,
.shader-card img,
.shader-preview,
.hover-preview-canvas {
  width: 100%;
  aspect-ratio: 16 / 9;
  display: block;
  background: #050607;
}

.shader-card img,
.hover-preview-canvas {
  object-fit: cover;
}

.shader-card-preview {
  position: relative;
  overflow: hidden;
}

.shader-card-preview > img,
.shader-card-preview > .shader-preview,
.hover-preview-canvas {
  position: absolute;
  inset: 0;
  height: 100%;
}

.hover-preview-canvas {
  z-index: 2;
  pointer-events: none;
}

.shader-card-preview.playing > img,
.shader-card-preview.playing > .shader-preview {
  opacity: 0;
}

.shader-preview {
  position: relative;
  overflow: hidden;
}

.shader-preview::before,
.shader-preview::after {
  content: "";
  position: absolute;
  inset: -20%;
  background: var(--preview-a);
  transform: rotate(var(--preview-rot));
}

.shader-preview::after {
  mix-blend-mode: screen;
  opacity: 0.75;
  background: var(--preview-b);
}

/* Participant study admin */
.compact-hero {
  align-items: center;
  padding: 18px 0 8px;
}

.compact-hero h1 {
  font-size: clamp(2rem, 4vw, 4rem);
}

.eyebrow {
  margin-bottom: 8px;
  color: var(--accent);
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.16em;
}

.header-links,
.panel-actions,
.confirm-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.button-link {
  min-height: 36px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0 13px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--surface-2);
  text-decoration: none;
}

.accent-link,
.primary-action {
  border-color: var(--accent);
  background: var(--accent);
  color: #07120f;
  font-weight: 750;
}

.subtle-link {
  color: var(--muted);
}

.study-tabs {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  gap: 6px;
  margin: 20px 0 16px;
  padding: 8px;
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgb(15 17 18 / 92%);
  backdrop-filter: blur(12px);
}

.study-tabs button {
  min-width: max-content;
  padding: 0 14px;
  border-color: transparent;
  background: transparent;
}

.study-tabs button.active {
  color: #07120f;
  background: var(--accent);
}

.notice {
  margin-bottom: 14px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 6px;
  color: var(--muted);
  background: var(--surface);
}

.notice.ok {
  border-color: #31594b;
}

.notice.error {
  border-color: var(--bad);
  color: #ffc0c4;
}

.study-panel {
  display: none;
}

.study-panel.active {
  display: block;
}

.status-pill,
.test-badge {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  padding: 0 9px;
  border: 1px solid var(--accent);
  border-radius: 999px;
  color: var(--accent);
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.06em;
}

.status-pill[data-status="active"],
.status-pill[data-status="completed"] {
  color: #07120f;
  background: var(--accent);
}

.test-pill,
.test-badge {
  border-color: #8b7bd8;
  color: #bdb1ff;
}

.experiment-config {
  display: grid;
  grid-template-columns: repeat(3, minmax(150px, 1fr));
  gap: 12px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
}

.experiment-config label {
  display: grid;
  gap: 7px;
}

.experiment-config .wide-field {
  grid-column: span 2;
}

.experiment-config button {
  align-self: end;
}

.metric-cards {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
  margin-top: 12px;
}

.metric-cards article {
  display: grid;
  gap: 4px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
}

.metric-cards span,
.metric-cards small {
  color: var(--muted);
}

.metric-cards strong {
  font-size: 1.6rem;
}

.generation-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  margin-top: 12px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: linear-gradient(110deg, #17221f, var(--surface));
}

.generation-bar p {
  margin-top: 5px;
  color: var(--muted);
}

.generation-bar button {
  min-height: 44px;
  padding: 0 18px;
}

.validation-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 8px;
  margin-top: 12px;
}

.validation-grid > div {
  display: flex;
  gap: 9px;
  padding: 11px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--surface);
}

.validation-grid .valid b {
  color: var(--accent);
}

.validation-grid .invalid b {
  color: var(--bad);
}

.empty-state {
  grid-column: 1 / -1;
  padding: 18px;
  border: 1px dashed var(--line);
  border-radius: 8px;
  color: var(--muted);
}

.selection-toolbar {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 14px;
}

.selection-toolbar input {
  max-width: 540px;
}

.selection-warning {
  color: var(--accent-2);
}

.selection-ok {
  color: var(--accent);
}

.experiment-gallery {
  grid-template-columns: repeat(auto-fill, minmax(210px, 1fr));
}

.experiment-gallery .shader-card {
  position: relative;
  height: 280px;
  cursor: pointer;
}

.selection-card input {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
}

.selection-check {
  position: absolute;
  top: 9px;
  right: 9px;
  z-index: 3;
  padding: 5px 8px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgb(15 17 18 / 82%);
  font-size: 0.72rem;
  font-weight: 700;
}

.selection-card.selected-for-study {
  border-color: var(--accent);
  box-shadow: 0 0 0 2px var(--accent);
}

.selection-card.selected-for-study .selection-check {
  border-color: var(--accent);
  color: #07120f;
  background: var(--accent);
}

.selection-card .shader-card-body {
  display: grid;
  gap: 6px;
}

.selection-card small {
  overflow-wrap: anywhere;
  color: var(--muted);
}

.table-wrap,
.heatmap-wrap {
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.data-table,
.heatmap-table {
  width: 100%;
  border-collapse: collapse;
  background: var(--surface);
  font-size: 0.84rem;
}

.data-table th,
.data-table td,
.heatmap-table th,
.heatmap-table td {
  padding: 10px 11px;
  border-right: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  text-align: left;
  white-space: nowrap;
}

.data-table th,
.heatmap-table th {
  position: sticky;
  top: 0;
  z-index: 1;
  color: var(--muted);
  background: #1d2125;
}

.data-table tr:hover td {
  background: #1b2221;
}

.text-button {
  min-height: 28px;
  padding: 0 8px;
  color: var(--accent);
  background: transparent;
}

.heatmap-table th:first-child {
  position: sticky;
  left: 0;
  z-index: 2;
}

.heatmap-table td {
  min-width: 40px;
  text-align: center;
}

.heatmap-table td[data-count="0"] {
  color: #566064;
  background: #121416;
}

.heatmap-table td[data-count="1"] {
  color: #d8fff2;
  background: #1a493c;
}

.heatmap-table td[data-count="2"] {
  color: #07120f;
  background: var(--accent);
}

.test-cards {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
}

.test-cards article {
  padding: 16px;
  border: 1px solid #494164;
  border-radius: 8px;
  background: #1a1822;
}

.test-cards h3 {
  margin: 8px 0 14px;
  font-size: 1.6rem;
}

.test-cards dl {
  display: grid;
  gap: 8px;
}

.test-cards dl div {
  display: flex;
  justify-content: space-between;
  padding-bottom: 8px;
  border-bottom: 1px solid #383248;
}

.test-cards .panel-actions {
  margin-top: 14px;
}

.result-subhead {
  margin-top: 28px;
}

.study-dialog,
.preview-dialog {
  width: min(900px, calc(100vw - 28px));
  max-height: calc(100vh - 40px);
  padding: 22px;
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 10px;
  color: var(--text);
  background: #111416;
}

.study-dialog::backdrop,
.preview-dialog::backdrop {
  background: rgb(0 0 0 / 78%);
  backdrop-filter: blur(5px);
}

.dialog-close {
  position: sticky;
  top: 0;
  z-index: 4;
  float: right;
  width: 38px;
  padding: 0;
}

.dialog-assignment-list {
  display: grid;
  gap: 7px;
  margin-top: 18px;
}

.dialog-assignment-list > div {
  display: grid;
  grid-template-columns: 34px 90px minmax(0, 1fr) 70px;
  align-items: center;
  gap: 10px;
  padding: 7px;
  border: 1px solid var(--line);
  border-radius: 6px;
}

.dialog-assignment-list img {
  width: 90px;
  aspect-ratio: 16 / 9;
  object-fit: cover;
  background: #050607;
}

.dialog-assignment-list span {
  overflow-wrap: anywhere;
  color: var(--muted);
  font-size: 0.8rem;
}

/* Participant-facing evaluation */
.study-site {
  --study-paper: #f5f2ec;
  --study-ink: #171817;
  color-scheme: light;
  color: var(--study-ink);
  background: var(--study-paper);
}

.study-site button,
.study-site select {
  color: var(--study-ink);
  background: #fff;
  border-color: #d5d1c9;
}

.study-site .primary-action {
  color: #fff;
  border-color: #202523;
  background: #202523;
}

.study-site .eyebrow {
  color: #b34663;
}

.study-shell {
  width: min(1440px, calc(100vw - 40px));
  margin: 0 auto;
  padding: 30px 0 48px;
}

.participant-gate {
  width: min(560px, 100%);
  margin: max(40px, 8vh) auto 0;
  padding: 42px;
  border: 1px solid #d8d3ca;
  border-radius: 18px;
  background: #fff;
  box-shadow: 0 24px 80px rgb(53 45 36 / 8%);
  text-align: center;
}

.participant-gate h1 {
  margin: 4px 0 14px;
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(2rem, 7vw, 4.2rem);
  line-height: 1.04;
}

.gate-mark,
.completion-mark {
  width: 56px;
  height: 56px;
  display: grid;
  place-items: center;
  margin: 0 auto 24px;
  border-radius: 50%;
  color: #fff;
  background: #b34663;
  font-family: Georgia, serif;
  font-weight: 800;
}

.completion-mark {
  color: #fff;
  background: #27785f;
  font-size: 1.5rem;
}

.gate-lead {
  color: #69665f;
  line-height: 1.7;
}

.participant-form {
  display: grid;
  gap: 14px;
  margin-top: 30px;
  text-align: left;
}

.participant-form label {
  display: grid;
  gap: 7px;
  color: #69665f;
}

.participant-form select {
  width: 100%;
  height: 46px;
}

.participant-form button {
  min-height: 48px;
  margin-top: 8px;
}

.confirm-actions {
  justify-content: center;
  margin-top: 28px;
}

.confirm-actions button {
  min-width: 160px;
  min-height: 46px;
}

.form-error {
  min-height: 24px;
  margin-top: 16px;
  color: #b2203d;
}

.evaluation-header {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 20px;
  padding-bottom: 20px;
  border-bottom: 1px solid #d8d3ca;
}

.evaluation-header h1 {
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(2rem, 4vw, 4rem);
}

.session-meta {
  display: grid;
  gap: 4px;
  text-align: right;
}

.session-meta span {
  color: #69665f;
  font-size: 0.85rem;
}

.session-meta strong {
  font-size: 1.4rem;
}

.question-card {
  display: grid;
  grid-template-columns: 1.25fr 0.75fr;
  gap: 34px;
  margin: 22px 0;
  padding: 20px 22px;
  border: 1px solid #d8d3ca;
  border-radius: 12px;
  background: #fff;
}

.question-card h2 {
  margin-top: 7px;
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(1.25rem, 2.2vw, 2rem);
  line-height: 1.35;
}

.question-card > div > span {
  color: #b34663;
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.1em;
}

.scale-key {
  display: grid;
  align-content: center;
  gap: 6px;
  padding-left: 28px;
  border-left: 1px solid #e1ddd6;
  color: #69665f;
  font-size: 0.82rem;
}

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

.rating-card {
  overflow: hidden;
  border: 1px solid #d8d3ca;
  border-radius: 12px;
  background: #fff;
  transition: border-color 160ms ease, box-shadow 160ms ease;
}

.rating-card.rated {
  border-color: #c55a75;
  box-shadow: 0 0 0 1px #c55a75;
}

.stimulus-preview {
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 9;
  display: block;
  overflow: hidden;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: #080908;
}

.stimulus-preview img,
.stimulus-preview video,
.study-live-canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.stimulus-preview video {
  z-index: 1;
}

.study-live-canvas {
  z-index: 2;
}

.play-hint,
.rated-badge {
  position: absolute;
  z-index: 3;
  padding: 5px 8px;
  border-radius: 999px;
  color: #fff;
  background: rgb(0 0 0 / 62%);
  font-size: 0.68rem;
}

.play-hint {
  bottom: 9px;
  left: 9px;
  opacity: 0;
  transition: opacity 160ms ease;
}

.stimulus-preview:hover .play-hint,
.stimulus-preview:focus-visible .play-hint {
  opacity: 1;
}

.rated-badge {
  top: 9px;
  right: 9px;
}

.rated .rated-badge {
  color: #fff;
  background: #b34663;
}

.rating-card-body {
  padding: 17px 16px 15px;
}

.heart-rating {
  display: flex;
  justify-content: center;
  gap: 2px;
}

.heart-rating button {
  width: 38px;
  min-height: 40px;
  padding: 0;
  border-color: transparent;
  color: #b8b2aa;
  background: transparent;
  font-size: 1.75rem;
  line-height: 1;
}

.heart-rating button:hover,
.heart-rating button:focus-visible,
.heart-rating button.filled {
  color: #c43f64;
  border-color: transparent;
  outline: none;
}

.heart-rating button:focus-visible {
  border-radius: 5px;
  box-shadow: inset 0 0 0 2px #c43f64;
}

.rating-scale {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  margin-top: 5px;
  color: #8b877f;
  font-size: 0.62rem;
  line-height: 1.25;
}

.rating-scale span:nth-child(2) {
  text-align: center;
}

.rating-scale span:last-child {
  text-align: right;
}

.evaluation-footer {
  position: sticky;
  bottom: 14px;
  z-index: 12;
  display: grid;
  grid-template-columns: 120px 1fr 120px;
  align-items: center;
  gap: 18px;
  margin-top: 22px;
  padding: 13px;
  border: 1px solid #d0cbc2;
  border-radius: 12px;
  background: rgb(255 255 255 / 94%);
  box-shadow: 0 12px 34px rgb(53 45 36 / 12%);
  backdrop-filter: blur(12px);
}

.evaluation-footer > div {
  display: grid;
  text-align: center;
}

.evaluation-footer span {
  margin-top: 2px;
  color: #77736b;
  font-size: 0.76rem;
}

.preview-dialog {
  width: min(1000px, calc(100vw - 28px));
  padding: 12px;
  color: var(--study-ink);
  background: var(--study-paper);
}

.preview-dialog canvas,
.preview-dialog video {
  width: 100%;
  aspect-ratio: 16 / 9;
  display: block;
  border: 0;
  border-radius: 8px;
  object-fit: contain;
  background: #080908;
}

.preview-dialog [hidden] {
  display: none;
}

#modalRating {
  padding: 18px 8px 8px;
  text-align: center;
}

#modalRating p {
  margin-bottom: 10px;
  font-family: Georgia, serif;
  font-size: 1.2rem;
}

.modal-hearts button {
  width: 50px;
  font-size: 2.25rem;
}

@media (max-width: 900px) {
  .experiment-config,
  .metric-cards {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .experiment-config .wide-field {
    grid-column: span 2;
  }

  .test-cards {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .question-card {
    grid-template-columns: 1fr;
  }

  .scale-key {
    padding: 14px 0 0;
    border-top: 1px solid #e1ddd6;
    border-left: 0;
  }
}

@media (max-width: 620px) {
  .compact-hero,
  .generation-bar,
  .evaluation-header {
    align-items: flex-start;
    flex-direction: column;
  }

  .experiment-config,
  .metric-cards,
  .test-cards,
  .rating-grid {
    grid-template-columns: 1fr;
  }

  .experiment-config .wide-field {
    grid-column: auto;
  }

  .study-shell {
    width: min(100% - 20px, 1440px);
    padding-top: 14px;
  }

  .participant-gate {
    padding: 28px 20px;
  }

  .session-meta {
    text-align: left;
  }

  .evaluation-footer {
    grid-template-columns: 84px 1fr 84px;
    gap: 8px;
  }

  .heart-rating button {
    width: 42px;
  }
}

.shader-card-body {
  min-height: 0;
  flex: 1;
  overflow: auto;
  padding: 12px;
  scrollbar-width: thin;
}

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

.shader-card h3 {
  margin: 0 0 6px;
  font-size: 0.98rem;
}

.shader-card p {
  color: var(--muted);
  font-size: 0.84rem;
  line-height: 1.45;
}

.shader-meta {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 10px;
  color: var(--muted);
  font-size: 0.8rem;
}

.promote-experimental,
.archive-gallery {
  width: 100%;
  margin-top: 12px;
}

.favorite {
  width: 32px;
  min-width: 32px;
  padding: 0;
}

.favorite.saved {
  color: #07120f;
  background: var(--accent-2);
  border-color: var(--accent-2);
}

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

.survey-log li {
  padding: 13px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  color: var(--muted);
  line-height: 1.45;
}

.survey-log strong {
  display: block;
  margin-bottom: 5px;
  color: var(--text);
}

.dashboard-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
  gap: 14px;
}

.info-panel {
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
}

.info-panel h3 {
  margin: 0 0 10px;
  font-size: 0.96rem;
}

.info-panel strong {
  display: block;
  margin-bottom: 6px;
  font-size: 1.45rem;
}

.info-panel p {
  color: var(--muted);
  line-height: 1.45;
  font-size: 0.88rem;
}

.panel-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.research-layout {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 14px;
}

.source-form {
  display: grid;
  gap: 9px;
}

.generate-layout {
  display: grid;
  grid-template-columns: minmax(320px, 0.95fr) minmax(280px, 1fr);
  gap: 14px;
}

.field-row {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
}

.field-row label,
.checkbox-row {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 0.8rem;
}

.checkbox-row {
  display: flex;
  align-items: center;
}

.checkbox-row input {
  width: auto;
  min-height: 0;
}

.compact-list {
  display: grid;
  gap: 8px;
  max-height: 360px;
  overflow: auto;
}

.compact-list-small {
  max-height: 220px;
}

.compact-item {
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #121518;
}

.compact-item strong {
  margin: 0 0 4px;
  font-size: 0.92rem;
}

.compact-item span {
  display: block;
  color: var(--muted);
  font-size: 0.8rem;
  line-height: 1.35;
}

.paper-list {
  max-height: 520px;
  margin-bottom: 18px;
}

.paper-item {
  cursor: default;
}

.paper-item.clickable {
  cursor: pointer;
}

.paper-item small,
.paper-item p {
  display: block;
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 0.8rem;
  line-height: 1.45;
}

.subhead {
  margin-top: 22px;
}

.idea-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 12px;
}

.idea-card {
  display: grid;
  gap: 8px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  cursor: pointer;
}

.idea-card:hover,
.idea-card.active {
  border-color: var(--accent);
}

.idea-card.active {
  background: #12221d;
}

.idea-card strong {
  font-size: 0.98rem;
}

.idea-card p {
  color: var(--muted);
  font-size: 0.84rem;
  line-height: 1.42;
}

.idea-card .shader-meta {
  margin-top: 0;
}

.idea-preview-popover {
  position: fixed;
  z-index: 40;
  overflow: hidden;
  border: 1px solid #51616f;
  border-radius: 8px;
  background: #1c2028;
  box-shadow: 0 18px 48px rgba(0, 0, 0, 0.45);
  pointer-events: none;
}

.idea-preview-canvas {
  width: 100%;
  aspect-ratio: 16 / 9;
  display: block;
  background: #050607;
}

.idea-preview-popover div {
  padding: 10px 12px 12px;
}

.idea-preview-popover strong {
  display: block;
  font-size: 0.92rem;
}

.idea-preview-popover p {
  margin-top: 4px;
  color: var(--muted);
  font-size: 0.78rem;
}

.map-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 320px;
  gap: 14px;
}

.map-stage {
  position: relative;
  min-width: 0;
}

#mapCanvas {
  width: 100%;
  min-height: 520px;
  aspect-ratio: 16 / 9;
  cursor: grab;
  touch-action: none;
  user-select: none;
}

.map-tooltip {
  position: absolute;
  z-index: 5;
  width: min(320px, calc(100% - 24px));
  padding: 14px;
  border: 1px solid #3d4a60;
  border-radius: 8px;
  background: rgba(25, 28, 40, 0.94);
  box-shadow: 0 18px 44px rgba(0, 0, 0, 0.38);
  pointer-events: none;
}

.map-tooltip strong {
  display: block;
  margin-bottom: 5px;
  font-size: 1rem;
}

.map-tooltip span {
  display: inline-block;
  margin: 0 0 8px;
  padding: 3px 8px;
  border-radius: 999px;
  background: rgba(96, 210, 173, 0.18);
  color: var(--accent);
  font-size: 0.72rem;
  text-transform: uppercase;
}

.map-tooltip p {
  color: var(--muted);
  font-size: 0.84rem;
  line-height: 1.45;
}

.map-tooltip img {
  width: 100%;
  aspect-ratio: 16 / 9;
  display: block;
  margin-top: 10px;
  border-radius: 5px;
  object-fit: cover;
  background: #050607;
}

@media (max-width: 980px) {
  .hero,
  .navrow,
  .section-head,
  .viewer-footer {
    align-items: start;
    flex-direction: column;
  }

  .stats,
  .actions {
    justify-content: flex-start;
  }

  .lab {
    grid-template-columns: 1fr;
  }

  .research-layout,
  .generate-layout,
  .map-layout {
    grid-template-columns: 1fr;
  }
}
