/* ── 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-y:scroll;
min-height:0;
scrollbar-width:thin;
scrollbar-color:#3b5b7a var(--ld-panel);
}

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

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

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

.side-column::-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;
width:auto;
max-width:520px;
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-y:visible;
max-height:none;
}

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

/* ── metric definition popup ── */

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

.metric-label:hover{
color:#60a5fa;
}

.def-overlay{
position:fixed;
inset:0;
background:rgba(2,6,23,0.75);
display:none;
align-items:center;
justify-content:center;
z-index:10000;
padding:20px;
}

.def-overlay.open{
display:flex;
}

.def-modal{
position:relative;
max-width:420px;
width:100%;
border-radius:10px;
padding:18px;
background:var(--ld-panel);
border:1px solid var(--ld-border2);
box-shadow:0 24px 60px rgba(0,0,0,0.7);
}

.def-modal h3{
margin:0 0 10px;
font-size:14px;
color:#fff;
padding-right:24px;
}

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

.def-close{
position:absolute;
top:14px;
right:14px;
width:26px;
height:26px;
border-radius:999px;
background:var(--ld-panel2);
border:1px solid var(--ld-border);
color:var(--text);
font-size:13px;
line-height:1;
cursor:pointer;
display:flex;
align-items:center;
justify-content:center;
padding:0;
}

.def-close:hover{
filter:brightness(1.2);
}
