/* Researcher pages: study builder and results. */
html { overflow: auto; height: auto; }
body.tool { overflow: auto; height: auto; -webkit-user-select: auto; user-select: auto; font-size: 15px; }
.topnav { display: flex; gap: 4px; padding: 10px 20px; border-bottom: 1px solid var(--line); background: #fff; position: sticky; top: 0; z-index: 5; }
.topnav a { padding: 6px 14px; border-radius: 6px; color: var(--muted); text-decoration: none; font-weight: 600; }
.topnav a.on { background: var(--paper); color: var(--ink); }
.topnav a:hover { color: var(--ink); }
#builder { display: grid; grid-template-columns: 300px minmax(0, 1fr); gap: 0; min-height: calc(100vh - 50px); }
#builder aside { padding: 20px; border-right: 1px solid var(--line); background: #fff; position: sticky; top: 50px; align-self: start; max-height: calc(100vh - 50px); overflow: auto; }
#builder aside h1 { font-size: 20px; margin: 0 0 2px; }
#builder aside .btn { width: 100%; margin-top: 8px; }
#builder main { padding: 20px 24px 80px; min-width: 0; }
.stims { list-style: none; padding: 0; margin: 14px 0; display: grid; gap: 6px; }
.stims li { display: grid; grid-template-columns: 56px 1fr auto; gap: 8px; align-items: center; padding: 6px; border: 1.5px solid var(--line); border-radius: 8px; cursor: pointer; }
.stims li.on { border-color: var(--accent); background: #eef5fa; }
.stims img { width: 56px; height: 40px; object-fit: cover; border-radius: 4px; background: #ddd; }
.stims input { width: 100%; border: 0; background: transparent; font-weight: 600; padding: 2px 0; }
.stims small { color: var(--muted); font-size: 12px; }
.stims .btn { width: auto !important; margin: 0 !important; }
.export { margin-top: 18px; padding-top: 14px; border-top: 1px solid var(--line); }
.export ul { padding-left: 18px; margin: 8px 0 0; font-size: 13px; }
.empty { border: 2px dashed var(--line); border-radius: 10px; padding: 80px 20px; text-align: center; color: var(--muted); }
.canvas-wrap { position: relative; display: inline-block; max-width: 100%; line-height: 0; border: 1px solid var(--line); border-radius: 6px; overflow: hidden; background: #fff; }
.canvas-wrap img { max-width: 100%; max-height: 62vh; display: block; -webkit-user-drag: none; user-select: none; }
.canvas-wrap .layer { position: absolute; inset: 0; cursor: crosshair; touch-action: none; }
.box { position: absolute; border: 2px solid #1f5f8b; background: rgba(31, 95, 139, .14); line-height: 1.2; cursor: pointer; }
.box span { position: absolute; left: 0; top: 0; background: #1f5f8b; color: #fff; font-size: 12px; padding: 1px 6px; white-space: nowrap; max-width: 100%; overflow: hidden; text-overflow: ellipsis; }
.box.sel { border-width: 3px; background: rgba(31, 95, 139, .28); }
.box.ghost { border-style: dashed; pointer-events: none; }
.box.c1 { border-color: #a8321f; background: rgba(168, 50, 31, .14); } .box.c1 span { background: #a8321f; }
.box.c2 { border-color: #1d6b46; background: rgba(29, 107, 70, .14); } .box.c2 span { background: #1d6b46; }
.box.c3 { border-color: #8a5a00; background: rgba(138, 90, 0, .14); } .box.c3 span { background: #8a5a00; }
.box.c4 { border-color: #6b3fa0; background: rgba(107, 63, 160, .14); } .box.c4 span { background: #6b3fa0; }
.box.c5 { border-color: #0f6f78; background: rgba(15, 111, 120, .14); } .box.c5 span { background: #0f6f78; }
.box.c6 { border-color: #9c2f6b; background: rgba(156, 47, 107, .14); } .box.c6 span { background: #9c2f6b; }
.box.c7 { border-color: #555; background: rgba(85, 85, 85, .14); } .box.c7 span { background: #555; }
.panel { background: #fff; border: 1px solid var(--line); border-radius: 10px; padding: 16px 20px; margin-top: 16px; }
.panel h3 { margin: 0 0 4px; font-size: 16px; }
.panel h4 { margin: 14px 0 6px; font-size: 14px; color: var(--muted); }
.tbl { border-collapse: collapse; width: 100%; margin: 8px 0; font-size: 14px; }
.tbl th { text-align: left; font-weight: 600; color: var(--muted); padding: 4px 8px 4px 0; font-size: 13px; }
.tbl td { padding: 3px 8px 3px 0; }
.tbl tr.sel td { background: #eef5fa; }
.tbl input, .tbl select, .grid2 input, .grid2 select, .qitem input, .qitem select, .qitem textarea { padding: 6px 8px; border: 1px solid var(--line); border-radius: 6px; background: #fff; width: 100%; }
.grid2 { display: grid; grid-template-columns: 170px minmax(0, 360px); gap: 8px 14px; align-items: center; margin-top: 8px; }
.grid2 label { color: var(--muted); }
.qitem { display: grid; grid-template-columns: minmax(0, 1fr) 190px auto; gap: 8px; align-items: start; margin: 6px 0; }
.qitem .ends, .qitem textarea { grid-column: 1 / 3; }
.qitem .ends { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
#results { max-width: 1100px; margin: 0 auto; padding: 24px 20px 80px; }
#results h1 { font-size: 22px; margin: 0 0 4px; }
.sec-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.scroll { overflow: auto; max-height: 420px; }
.tbl.data th, .tbl.data td { padding: 4px 12px 4px 0; white-space: nowrap; font-variant-numeric: tabular-nums; border-bottom: 1px solid #eeece6; }
.tbl.data th { position: sticky; top: 0; background: #fff; }
.bars { margin: 12px 0 6px; display: grid; gap: 8px; }
.bar-row { display: grid; grid-template-columns: 200px 1fr 150px; gap: 12px; align-items: center; font-size: 14px; }
.bar-track { display: grid; gap: 3px; }
.bar { height: 12px; border-radius: 3px; min-width: 2px; }
.bar.gaze { background: var(--accent); }
.bar.ref { background: #b9c9d6; }
.bar-num { font-variant-numeric: tabular-nums; color: var(--muted); }
@media (max-width: 800px) { #builder { grid-template-columns: 1fr; } #builder aside { position: static; max-height: none; border-right: 0; border-bottom: 1px solid var(--line); } .bar-row { grid-template-columns: 1fr; } }

.row-inline { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin: 6px 0; font-size: 14px; }
.row-inline input, .row-inline select { padding: 6px 8px; border: 1px solid var(--line); border-radius: 6px; background: #fff; width: auto; min-width: 110px; }
.step { border: 1px solid var(--line); border-radius: 8px; padding: 10px 12px; margin: 8px 0; background: #fcfbf8; }
.step-head { display: flex; justify-content: space-between; align-items: center; }
.step textarea { width: 100%; padding: 6px 8px; border: 1px solid var(--line); border-radius: 6px; margin-top: 6px; }
.tbl.assign select { min-width: 150px; }

.grid2.wide { grid-template-columns: 220px minmax(0, 1fr); align-items: start; }
.grid2 textarea { padding: 6px 8px; border: 1px solid var(--line); border-radius: 6px; width: 100%; }
.type-cell { display: grid; gap: 6px; }
.canvas-wrap video { max-width: 100%; max-height: 62vh; display: block; }

.view-canvas { width: 100%; height: auto; border: 1px solid var(--line); border-radius: 6px; margin-top: 8px; }
#results header .btn { margin-top: 6px; }

.study .link { flex: 1; min-width: 260px; font: 13px ui-monospace, Consolas, monospace; }
.study .target { width: 110px; min-width: 0; }
#results .grid2 input { padding: 8px 10px; border: 1px solid var(--line); border-radius: 6px; }
