/* ── LD-specific ── */

:root{
--ld-accent:#203fdb;
--ld-accent2:#21c1fb;
--ld-border:#162a38;
--ld-border2:#1e3a50;
--ld-panel:#0b1a24;
--ld-panel2:#071520;
--ld-muted:#6a90a0;
}

.app{
width:100%;
max-width:none;
padding:12px 16px;
border:0;
border-radius:0;
background:transparent;
box-shadow:none;
}

.page-body{
width:100%;
max-width:none;
box-sizing:border-box;
padding:0;
font-family:Inter,system-ui,"Segoe UI",Roboto,Helvetica,Arial,sans-serif;
font-weight:400;
letter-spacing:0.025em;
}

.topbar{
margin-bottom:12px;
align-items:flex-end;
flex-wrap:wrap;
}

.back-link{
align-self:center;
}

.title-block h1{
letter-spacing:0.01em;
}

.title-block .small-muted{
font-weight:400;
letter-spacing:0.02em;
}

.page-body button,
.page-body select,
.page-body input,
.page-body th,
.page-body td,
.page-body label,
.page-body .btn-pill{
font-weight:400;
letter-spacing:0.025em;
}

.test-workspace{
display:grid;
grid-template-columns:minmax(0,7fr) minmax(0,3fr);
gap:0;
align-items:stretch;
overflow:hidden;
border:1px solid rgba(30,64,175,0.25);
border-radius:12px;
background:var(--ld-panel);
height:calc(100vh - 260px);
}

.test-column,
.side-column{
min-width:0;
}

.test-column{
display:flex;
flex-direction:column;
padding:0;
background:#000;
min-height:0;
}

.side-column{
display:flex;
flex-direction:column;
gap:0;
background:var(--ld-panel);
border-left:1px solid var(--ld-border);
overflow:hidden;
min-height:0;
}

/* TEST / RESEARCH tabs (pattern from RT side panel) */
.ld-tab-bar{
display:flex;
height:42px;
flex-shrink:0;
border-bottom:1px solid var(--ld-border);
}

.ld-tab{
flex:1;
border:0;
border-radius:0;
background:transparent;
color:var(--muted);
font-size:11px;
font-weight:700 !important;
letter-spacing:1.5px !important;
cursor:pointer;
}

.ld-tab:hover:enabled{
transform:none;
filter:none;
color:var(--ld-accent2);
}

.ld-tab.active{
color:var(--ld-accent2);
border-bottom:2px solid var(--ld-accent2);
}

.ld-side-panel{
display:none;
flex:1;
min-height:0;
overflow-y:scroll;
overflow-x:hidden;
scrollbar-width:thin;
scrollbar-color:#3b5b7a var(--ld-panel);
}

.ld-side-panel.active{
display:block;
}

.ld-side-panel::-webkit-scrollbar{
width:8px;
}

.ld-side-panel::-webkit-scrollbar-track{
background:var(--ld-panel);
}

.ld-side-panel::-webkit-scrollbar-thumb{
background-color:#3b5b7a;
border-radius:4px;
}

.ld-side-panel::-webkit-scrollbar-button{
display:none;
width:0;
height:0;
}

.canvas-card{
padding:0;
margin:0;
border:0;
border-radius:0;
background:#000;
box-shadow:none;
flex:1;
display:flex;
min-height:0;
}

#canvas-container{
position:relative;
width:100%;
flex:1;
display:flex;
justify-content:center;
align-items:center;
overflow:hidden;
background:#020617;
border-radius:0;
min-height:0;
}

canvas{
display:block;
width:100%;
height:calc(100vh - 260px);
background:#000;
touch-action:none;
}

.test-controls{
justify-content:flex-end;
width:auto;
box-sizing:border-box;
align-self:flex-end;
margin-left:auto;
padding-right:0;
margin-top:0;
margin-bottom:0;
gap:6px;
}

.test-controls select,
.test-controls button{
min-height:auto;
height:32px;
padding:6px 11px;
border-radius:6px;
border:1px solid rgba(148,163,184,0.18);
background:#0a1e2a;
color:var(--text);
font-family:Inter,system-ui,"Segoe UI",Roboto,Helvetica,Arial,sans-serif;
font-size:12px;
font-weight:400;
letter-spacing:0.025em;
box-shadow:none;
}

.test-controls button:hover:enabled{
transform:none;
filter:none;
border-color:var(--ld-accent);
color:var(--ld-accent2);
}

#startSequenceBtn{
background:linear-gradient(135deg,var(--ld-accent),var(--ld-accent2));
border-color:var(--ld-accent);
color:#052012;
font-weight:400;
}

.test-controls button[onclick="stopTest()"]{
border-color:#9f3340;
color:#e85b6b;
}

.test-controls button[onclick="resetTest()"]{
color:#a8c5d0;
}

#exportTrialBtn:hover,
#exportCsvBtn:hover{
filter:none;
}

.notice{
font-size:11px;
color:var(--muted);
line-height:1.6;
}

.status-good{
color:var(--ok);
font-weight:400;
}

.status-bad{
color:var(--danger);
font-weight:400;
}

.test-guidance{
min-height:30px;
/* Fixed width: guidance text length must never re-flow the top bar and
   move the canvas mid-stroke. */
width:300px;
max-width:300px;
box-sizing:border-box;
overflow:hidden;
text-overflow:ellipsis;
margin:0;
align-self:center;
display:flex;
align-items:center;
justify-content:center;
padding:6px 16px;
border:1.5px solid #1e3a8a;
outline:0;
box-shadow:none;
border-radius:8px;
background:transparent;
color:#fff;
font-size:12px;
font-weight:400;
letter-spacing:0.03em;
line-height:1.4;
text-align:center;
white-space:nowrap;
opacity:1;
visibility:visible;
transition:opacity 0.25s ease;
}

.test-guidance.guidance-hidden{
opacity:0;
visibility:hidden;
}

.test-guidance.complete{
border-color:rgba(34,197,94,0.55);
background:rgba(22,163,74,0.14);
color:#bbf7d0;
}

.test-guidance.countdown{
border-color:rgba(96,165,250,0.8);
background:rgba(37,99,235,0.3);
color:#ffffff;
}

.cal-bar{
position:relative;
width:100%;
box-sizing:border-box;
height:15px;
background:#ff6600;
border-radius:0;
display:flex;
align-items:center;
justify-content:center;
margin:2px 0 10px;
}

.cal-bar-label{
color:#020617;
font-size:9px;
font-weight:600;
letter-spacing:2px;
text-align:center;
white-space:nowrap;
}

.calibration-panel,
.results-panel{
margin:0;
padding:11px 16px;
border:0;
border-radius:0;
background:transparent;
box-shadow:none;
overflow:visible;
flex-shrink:0;
}

.calibration-panel{
border-bottom:1px solid var(--ld-border);
}

.results-panel h2{
margin-bottom:7px;
font-size:11px;
font-weight:400;
letter-spacing:2px;
text-transform:uppercase;
color:var(--ld-accent2);
}

.calibration-panel .panel-header{
display:flex;
align-items:center;
justify-content:space-between;
gap:8px;
margin-bottom:7px;
}

.calibration-panel .header-actions{
display:flex;
align-items:center;
gap:10px;
}

.calibration-panel h2{
margin:0;
font-size:11px;
font-weight:400;
letter-spacing:2px;
text-transform:uppercase;
color:var(--ld-accent2);
}

.calibration-fields{
display:grid;
grid-template-columns:1fr 1fr;
gap:8px;
margin-top:8px;
}

.calibration-fields input{
width:100%;
min-width:0;
min-height:auto;
padding:4px 8px;
border:1px solid var(--ld-border);
border-radius:6px;
background:var(--ld-panel2);
color:var(--text);
font-family:Inter,system-ui,"Segoe UI",Roboto,Helvetica,Arial,sans-serif;
font-size:12px;
}

.calibration-fields label{
font-size:11px;
color:var(--muted);
}

.verify-button{
width:auto;
min-height:auto;
height:30px;
margin-top:0;
padding:5px 14px;
border:1px solid #ff8a1f;
border-radius:6px;
background:linear-gradient(135deg,#ffb020,#ff5e1a);
color:#3a1600;
box-shadow:0 0 12px rgba(255,102,0,0.35);
font-family:Inter,system-ui,"Segoe UI",Roboto,Helvetica,Arial,sans-serif;
font-size:11px;
font-weight:600;
letter-spacing:0.025em;
box-shadow:none;
white-space:nowrap;
flex-shrink:0;
}

#calibrationStatus{
margin-top:0;
font-size:12px;
font-weight:600;
white-space:nowrap;
}

.results-heading{
display:flex;
align-items:center;
justify-content:space-between;
gap:12px;
}

.results-heading span{
font-size:11px;
font-weight:400;
color:var(--muted);
white-space:nowrap;
}

.results-heading strong{
color:var(--text);
font-weight:400;
}

.results-table{
width:100%;
table-layout:fixed;
font-size:11px;
font-variant-numeric:tabular-nums;
font-family:Inter,system-ui,"Segoe UI",Roboto,Helvetica,Arial,sans-serif;
}

.results-table th{
padding:4px 8px;
font-size:9px;
font-weight:400;
letter-spacing:1.4px;
text-transform:uppercase;
color:var(--muted);
background:var(--ld-panel2);
border-bottom:1px solid var(--ld-border2);
}

.results-table td{
padding:4px 8px;
border-bottom:1px solid var(--ld-border);
color:#b9d0d9;
overflow-wrap:anywhere;
}

.results-table th:first-child,
.results-table td:first-child{
width:48%;
}

.results-table td.score-value{
font-weight:400;
color:#ffe600 !important;
}

.metric-label.sara-label{
color:#ffe600 !important;
}

@media (max-width:900px){
.test-controls{
width:100%;
padding-right:0;
margin-top:8px;
}

.test-workspace{
grid-template-columns:1fr;
height:auto;
overflow:visible;
}

.test-column{
height:55vh;
min-height:340px;
}

.side-column{
border-left:0;
border-top:1px solid var(--ld-border);
overflow:visible;
max-height:none;
}

.ld-side-panel{
overflow-y:visible;
}

.test-guidance{
font-size:12px;
min-height:30px;
padding:6px 10px;
}
}

/* ── metric definition hover tooltip (same as RT) ── */

.metric-label{
cursor:help;
border-bottom:1px dotted rgba(148,163,184,0.5);
}

.metric-label:hover,
.metric-label:focus{
color:#60a5fa;
outline:none;
}

.def-tip{
position:fixed;
z-index:10000;
width:340px;
max-width:calc(100vw - 16px);
padding:14px 16px;
box-sizing:border-box;
border-radius:10px;
background:var(--ld-panel);
border:1px solid var(--ld-border2);
box-shadow:0 24px 60px rgba(0,0,0,0.7);
pointer-events:none;
}

.def-tip[hidden]{
display:none;
}

.def-tip h3{
margin:0 0 8px;
font-size:14px;
color:#fff;
}

.def-tip p{
margin:0;
font-size:12px;
color:var(--muted);
line-height:1.55;
}

/* ── RESEARCH tab: clinical reference, weight bar, log ──
   Visual pattern reused from RT's RESEARCH tab (itself from SD), per the
   CeMoQu design principle (2026-09-08): every module gets a clinician
   direct-input section + a user-adjustable scoring weight bar. */

.research-card{
display:block;
min-height:0;
margin:0;
padding:11px 16px 18px;
border:0;
border-bottom:1px solid var(--ld-border);
border-radius:0;
background:transparent;
box-shadow:none;
overflow:visible;
}

.research-card::before{
display:none;
}

.research-card .panel-header{
display:flex;
align-items:center;
justify-content:space-between;
gap:8px;
margin-bottom:4px;
}

.research-card h2{
margin:0;
font-size:11px;
font-weight:600;
letter-spacing:2px;
text-transform:uppercase;
color:var(--ld-accent2);
}

.research-card label{
display:block;
color:#a8c5d0;
font-size:11px;
margin:10px 0 5px;
}

#clinicalPanel select,
#clinicalPanel textarea{
width:100%;
box-sizing:border-box;
font-size:12px;
padding:8px;
background:var(--ld-panel2);
border:1px solid var(--ld-border);
border-radius:6px;
color:#e5e7eb;
font-family:inherit;
}

#clinicalPanel textarea{
resize:vertical;
}

.clinician-score-grid{
display:grid;
grid-template-columns:1fr 1fr;
gap:10px;
}

.clinician-score-grid>div{
min-width:0;
}

.clinician-score-grid.single{
grid-template-columns:1fr;
}

.clinician-mean{
margin:10px 0 2px;
font-size:11px;
color:#a8c5d0;
}

.clinician-mean strong{
color:#ffe600;
font-weight:600;
}

.weight-bar{
position:relative;
height:7px;
border-radius:5px;
background:linear-gradient(90deg,var(--ld-accent) 0%,var(--ld-accent2) 100%);
margin:16px 2px 10px;
}

.weight-handle{
position:absolute;
top:50%;
width:13px;
height:13px;
margin:-7px 0 0 -7px;
background:var(--ld-panel);
border:2px solid #e7f4fa;
border-radius:50%;
cursor:ew-resize;
box-shadow:0 1px 3px rgba(0,0,0,.6);
touch-action:none;
transition:transform .12s ease;
}

.weight-handle:hover,
.weight-handle:active{
transform:scale(1.2);
}

.weight-labels{
display:flex;
justify-content:space-between;
font-size:10px;
color:#a8c5d0;
letter-spacing:.01em;
}

.research-card .scoring-note{
font-size:11px;
line-height:1.6;
margin:10px 0 0;
}

.research-card .pending-note{
font-size:11px;
line-height:1.5;
margin:8px 0 0;
padding:7px 9px;
border:1px solid rgba(245,158,11,0.35);
border-radius:6px;
background:rgba(245,158,11,0.08);
color:#f5c26b;
}

.research-card .text-button{
padding:0;
border-radius:0;
background:transparent;
color:var(--ld-accent2);
font-size:11px;
border:0;
cursor:pointer;
margin-top:10px;
}

.details-box{
margin-top:10px;
padding:10px;
background:var(--ld-panel2);
border:1px solid var(--ld-border);
border-radius:7px;
font-size:10px;
color:#8faebb;
white-space:pre-wrap;
line-height:1.55;
overflow:auto;
max-height:260px;
}

.log-card #clearLogBtn{
height:26px;
padding:4px 10px;
border-radius:6px;
border:1px solid rgba(148,163,184,0.18);
background:#0a1e2a;
color:var(--text);
font-size:11px;
cursor:pointer;
}

.log-subtitle{
font-size:10px;
margin-top:3px;
}

.log{
min-height:220px;
font-size:11px;
color:#a8c5d0;
line-height:1.5;
}

.log>div{
padding:8px 0;
border-bottom:1px solid var(--ld-border);
}

/* ── Hand prompt (on-canvas, examiner confirms each hand block) ── */

.hand-prompt{
position:absolute;
top:50%;
left:50%;
transform:translate(-50%,-50%);
z-index:5;
width:min(360px,86%);
padding:22px 22px 20px;
box-sizing:border-box;
border-radius:12px;
border:1px solid var(--ld-border2);
background:rgba(11,26,36,0.96);
box-shadow:0 18px 50px rgba(0,0,0,0.7);
text-align:center;
}

.screen-gate{
z-index:6;
}

.hand-prompt[hidden]{
display:none;
}

.hand-prompt-kicker{
font-size:10px;
letter-spacing:2px;
color:var(--ld-accent2);
font-weight:600;
}

.hand-prompt-title{
margin:8px 0 8px;
font-size:26px;
font-weight:700;
color:#fff;
letter-spacing:1px;
}

.hand-prompt-body{
font-size:12px;
line-height:1.55;
color:#a8c5d0;
}

.hand-prompt .hand-ready-btn{
margin-top:16px;
min-width:120px;
height:34px;
padding:6px 18px;
border-radius:6px;
border:0;
background:linear-gradient(135deg,var(--ld-accent),var(--ld-accent2));
color:#fff;
font-size:13px;
cursor:pointer;
}

/* ── Per-trial trajectory thumbnail in the Log (pattern from RT) ── */

.trial-log-entry{
display:flex;
align-items:flex-start;
justify-content:space-between;
gap:8px;
}

.trial-log-text{
min-width:0;
flex:1 1 auto;
}

.trajectory-thumb-link{
flex:0 0 150px;
display:block;
width:150px;
height:105px;
background:#04121a;
border:1px solid rgba(79,209,197,.45);
border-radius:6px;
overflow:hidden;
line-height:0;
}

.trajectory-thumb{
display:block;
width:150px;
height:105px;
object-fit:contain;
background:#04121a;
}
