
:root{
  --bg:#0b0f17;
  --panel:#111827;
  --panel2:#0f172a;
  --text:#e5e7eb;
  --muted:#9ca3af;
  --accent:#38bdf8;
  --border: rgba(255,255,255,.10);
  --shadow: 0 12px 38px rgba(0,0,0,.40);
  --radius: 20px;
  --font: system-ui, -apple-system, Segoe UI, Roboto, Helvetica, Arial, "Apple Color Emoji","Segoe UI Emoji";
}

*{box-sizing:border-box;}
html,body{height:100%;}
body{
  margin:0;
  font-family:var(--font);
  background: radial-gradient(1200px 800px at 20% 10%, rgba(56,189,248,.14), transparent 60%),
              radial-gradient(900px 700px at 85% 40%, rgba(52,211,153,.10), transparent 55%),
              var(--bg);
  color:var(--text);
}
a{color:var(--accent); text-decoration:none;}

.container{
  min-height:100vh;
  max-width: 1400px;
  margin:0 auto;
  padding:18px 18px 28px;
  display:flex;
  flex-direction:column;
}
.header{
  display:flex;
  gap:14px;
  align-items:center;
  justify-content:space-between;
  margin:8px 0 14px;
}
.brand{display:flex; gap:12px; align-items:center;}
.logo{
  width:42px; height:42px; border-radius:14px;
  background: linear-gradient(135deg, rgba(56,189,248,.95), rgba(52,211,153,.85));
  box-shadow: var(--shadow);
}
h1{font-size:22px; margin:0;}
.small{font-size:13px; color:var(--muted); margin-top:3px; line-height:1.25;}

/* Motor task (drawing) instructions: make them much more readable */
#taskName{font-size:22px; line-height:1.2; color:rgba(255,255,255,.92); margin-top:0;}
#taskHint{font-size:18px; line-height:1.25; color:rgba(255,255,255,.78); margin-top:6px; max-width: 900px;}
/* Keep scroll target nicely positioned when using scrollIntoView() */
#taskName{scroll-margin-top: 110px;}

@media (max-width: 520px){
  #taskName{font-size:19px;}
  #taskHint{font-size:16px;}
}

.panel{
  flex: 1;
  display:flex;
  align-items:center;
  justify-content:center;
}
.shell{
  width:100%;
  max-width: 1280px;
  background: linear-gradient(180deg, rgba(255,255,255,.055), rgba(255,255,255,.025));
  border:1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow:hidden;
}
.shell-inner{padding:20px;}

.row{display:flex; gap:12px; flex-wrap:wrap; align-items:center;}
select, input, button{font: inherit;}
select, input{
  background: rgba(15,23,42,.78);
  border:1px solid var(--border);
  color:var(--text);
  padding:10px 12px;
  border-radius: 12px;
  outline:none;
  min-width: 160px;
}
select:focus, input:focus{
  border-color: rgba(56,189,248,.55);
  box-shadow: 0 0 0 4px rgba(56,189,248,.15);
}
.btn{
  padding:10px 14px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: rgba(17,24,39,.68);
  color: var(--text);
  cursor:pointer;
  transition: transform .05s ease, background .15s ease, border-color .15s ease;
}
.btn:hover{background: rgba(17,24,39,.95); border-color: rgba(255,255,255,.18);}
.btn:active{transform: translateY(1px);}
.btn.primary{
  background: linear-gradient(135deg, rgba(56,189,248,.90), rgba(52,211,153,.86));
  border-color: transparent;
  color:#06101a;
  font-weight:700;
}
.btn.primary:disabled{opacity:.55; cursor:not-allowed;}
.btn.ghost{background: transparent;}

.grid{
  display:grid;
  grid-template-columns: 1fr;
  gap:14px;
}
@media (min-width:900px){
  .grid{grid-template-columns: 1.25fr .75fr;}
}

.card{
  background: rgba(15,23,42,.58);
  border: 1px solid var(--border);
  border-radius: 18px;
  padding:16px;
}
.card h2{margin:0 0 8px 0; font-size:17px;}
.card p{margin:0 0 10px 0; color:var(--muted); line-height:1.4;}

.hr{height:1px; background: var(--border); margin:14px 0;}

.q{
  padding:12px 10px;
  border-radius: 14px;
  border: 1px solid transparent;
}
.q:hover{background: rgba(255,255,255,.03); border-color: rgba(255,255,255,.07);}
.q-title{font-size:14px; margin-bottom:8px;}
.likert{
  display:grid;
  grid-template-columns: repeat(5, 1fr);
  gap:8px;
}
.likert button{
  width:100%;
  padding:10px 8px;
  border-radius: 12px;
  background: rgba(17,24,39,.65);
  border:1px solid var(--border);
  color: var(--text);
}
.likert button[data-selected="1"]{
  background: rgba(56,189,248,.18);
  border-color: rgba(56,189,248,.40);
}

.notice{font-size:13px; color: var(--muted);}

.videoWrap{
  position:relative;
  border-radius: 18px;
  overflow:hidden;
  border:1px solid var(--border);
  background:black;
}
#introVideo{width:100%; display:block; background:black;}
.videoOverlay{
  position:absolute; inset:0;
  display:flex; align-items:flex-end; justify-content:space-between;
  padding:12px;
  background: linear-gradient(180deg, transparent, rgba(0,0,0,.60));
  gap:10px;
}
.badge{
  font-size:12px; color:#c7f9ff;
  background: rgba(56,189,248,.14);
  border:1px solid rgba(56,189,248,.22);
  padding:6px 10px; border-radius:999px;
}

.moodIcon{
  /* doubled for better visibility */
  width:126px;
  height:126px;
  object-fit:contain;
  border-radius:16px;
  background: rgba(56,189,248,.08);
  border:1px solid rgba(56,189,248,.18);
}
.toggle{
  display:flex; gap:8px; align-items:center; user-select:none;
  padding:8px 10px; border-radius: 12px;
  background: rgba(0,0,0,.25);
  border: 1px solid rgba(255,255,255,.12);
  color: rgba(255,255,255,.88);
  font-size: 12px;
}
.toggle input{min-width:auto;}
.videoActions{display:flex; gap:10px; align-items:center;}

.canvasWrap{
  border-radius: 18px;
  overflow:hidden;
  border:1px solid var(--border);
  background: rgba(0,0,0,.35);
}
canvas{display:block; width:100%; height:auto; }

.kpi{
  display:grid; grid-template-columns: repeat(2, minmax(0,1fr));
  gap:10px;
}
.kpi .k{
  background: rgba(255,255,255,.03);
  border:1px solid var(--border);
  border-radius: 14px;
  padding:10px;
}
.k strong{display:block; font-size:14px;}
.k span{color:var(--muted); font-size:12px;}

.footer{margin-top:10px; font-size:12px; color:var(--muted);}

/* Pointer device cards */
.deviceGrid{
  display:grid;
  grid-template-columns: repeat(2, minmax(0,1fr));
  gap:10px;
  margin-top:10px;
}
@media (min-width:900px){
  .deviceGrid{grid-template-columns: repeat(2, minmax(0,1fr));}
}
.deviceCard{
  display:flex;
  gap:10px;
  align-items:center;
  padding:10px;
  border-radius: 16px;
  background: rgba(255,255,255,.02);
  border: 1px solid rgba(255,255,255,.10);
  cursor:pointer;
  transition: transform .05s ease, background .15s ease, border-color .15s ease;
}
.deviceCard:hover{background: rgba(255,255,255,.04); border-color: rgba(255,255,255,.16);}
.deviceCard[data-selected="1"]{border-color: rgba(56,189,248,.50); background: rgba(56,189,248,.10);}
.deviceCard img{
  width:74px; height:48px;
  object-fit:cover;
  border-radius: 12px;
  border: 1px solid rgba(255,255,255,.12);
}
.deviceCard .dTitle{font-weight:700; font-size:13px;}
.deviceCard .dSub{font-size:12px; color:var(--muted);}


/* Larger drawing area */
#taskCanvas{height: 520px;}
@media (min-width: 900px){ #taskCanvas{height: 620px;} }

/* Autocomplete */
.autocomplete{ position: relative; }
.suggest{
  position:absolute; top: 100%; left:0; right:0;
  z-index: 50;
  background: rgba(15,23,42,.98);
  border:1px solid rgba(255,255,255,.16);
  border-radius: 14px;
  box-shadow: 0 18px 40px rgba(0,0,0,.45);
  overflow:hidden;
  margin-top:6px;
  max-height: 220px;
  overflow-y: auto;
  display:none;
}
.suggest button{
  width:100%;
  text-align:left;
  padding:10px 12px;
  background: transparent;
  border: 0;
  border-bottom: 1px solid rgba(255,255,255,.07);
  color: rgba(255,255,255,.92);
  cursor:pointer;
}
.suggest button:hover{background: rgba(56,189,248,.10);}
.suggest button:last-child{border-bottom:0;}

.confBox{
  margin-top:12px;
  border-radius: 18px;
  border:1px dashed rgba(251,191,36,.35);
  background: rgba(251,191,36,.06);
  padding:14px;
}
.confHeader{
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:10px;
  cursor:pointer;
}
.confHeader strong{font-size:14px;}
.confNote{font-size:12px; color: rgba(255,255,255,.80); margin-top:6px; line-height:1.3;}
.confContent{display:none; margin-top:12px;}


/* Larger countdown for motor task */
#taskTimer{font-size:22px; padding:10px 14px; border-radius:999px; font-weight:800; letter-spacing:.5px;}


/* Ensure survey-only controls never appear in the motor-task (drawing) section */
[data-section="task"] #coffeeLabel,
[data-section="task"] #metaCoffee,
[data-section="task"] #confBox,
[data-section="task"] #confToggle,
[data-section="task"] #confBody,
[data-section="task"] .confBox,
[data-section="task"] .confToggle,
[data-section="task"] .confBody{
  display:none !important;
}
/* Bigger countdown badge */
#taskTimer{font-size:26px; padding:12px 16px; border-radius:999px; font-weight:900; letter-spacing:.5px;}



/* Bigger + positioned countdown near the drawing area */
#taskTimer{
  font-size:40px !important;
  padding:16px 20px !important;
  font-weight:1000 !important;
}
/* Place timer at top-right of the drawing canvas area (inside task card) */
[data-section="task"]{
  position:relative;
}
[data-section="task"] #taskTimer{
  position:sticky;
  top:14px;
  float:right;
  margin-top:6px;
  z-index:50;
  box-shadow: 0 8px 30px rgba(0,0,0,.35);
}



/* Make START dot pop a bit more */
canvas + .startDot, .startDot { filter: drop-shadow(0 0 10px rgba(0,255,255,.35)); }



/* Keep drawing area comfortably visible without manual scrolling */
#taskCanvasWrap, .taskCanvasWrap, #motorCanvasWrap, .motorCanvasWrap{
  min-height: min(70vh, 620px);
  display:flex;
  align-items:center;
  justify-content:center;
  /* Helps scrollIntoView("center") land nicely under sticky header on some browsers */
  scroll-margin-top: 120px;
}
#motorCanvas, canvas#motorCanvas{
  max-height: min(62vh, 560px);
  width: 100%;
}



/* Disease selector layout */
.disease-grid{ display:flex; gap:14px; align-items:flex-start; flex-wrap:wrap; }
.disease-left{ flex:1; min-width:240px; }
.disease-right{ flex:1; min-width:240px; }
/* Disease inputs */
.disease-grid input[type="text"], .disease-grid textarea{
  width:100%;
  background: rgba(15,23,42,.75);
  color: rgba(255,255,255,.92);
  border:1px solid rgba(255,255,255,.14);
  border-radius: 14px;
  padding: 10px 12px;
  outline: none;
}
.disease-grid input[type="text"]::placeholder, .disease-grid textarea::placeholder{
  color: rgba(255,255,255,.45);
}
.disease-grid input[type="text"]:focus, .disease-grid textarea:focus{
  border-color: rgba(56,189,248,.55);
  box-shadow: 0 0 0 3px rgba(56,189,248,.15);
}
.chips{ display:flex; flex-wrap:wrap; gap:8px; margin:8px 0; }
.chip{ display:inline-flex; align-items:center; gap:8px; padding:6px 10px; border-radius:999px; border:1px solid rgba(255,255,255,.16); background: rgba(255,255,255,.06); }
.chip button{ border:none; background: transparent; color: rgba(255,255,255,.8); cursor:pointer; font-size:16px; line-height:1; padding:0 2px; }
#metaDiseasesEditor{ width:100%; min-height:126px; background: rgba(15,23,42,.35); border:1px solid rgba(255,255,255,.14); color: rgba(255,255,255,.92); border-radius: 14px; padding: 10px 12px; outline: none; }
#metaDiseasesEditor:focus{ border-color: rgba(96,165,250,.7); box-shadow: 0 0 0 3px rgba(96,165,250,.15); }
.muted{ color: rgba(255,255,255,.68); }

#metaDiseasesSearch{ width:100%; background: rgba(15,23,42,.35); border:1px solid rgba(255,255,255,.14); color: rgba(255,255,255,.92); border-radius: 14px; padding: 10px 12px; outline:none; }
#metaDiseasesSearch:focus{ border-color: rgba(96,165,250,.7); box-shadow: 0 0 0 3px rgba(96,165,250,.15); }


/* Confidential block layout: medications + diagnoses side-by-side */
.confGrid{
  display:grid;
  grid-template-columns: 1fr 1fr;
  gap: 18px;
  align-items:start;
}
.confBlock{
  padding: 14px 14px;
  border: 1px solid rgba(255,255,255,.12);
  border-radius: 18px;
  background: rgba(255,255,255,.04);
}

.confBlockTitle{
  display:flex;
  gap: 10px;
  align-items:center;
  margin-bottom: 10px;
}
.confIcon{
  width: 28px;
  height: 28px;
  object-fit: contain;
  filter: drop-shadow(0 4px 12px rgba(0,0,0,.25));
}
.confBlockName{
  font-weight: 800;
  font-size: 15px;
  letter-spacing: .2px;
}
.confBlockSub{
  font-size: 12.5px;
  color: rgba(255,255,255,.7);
}
@media (max-width: 920px){
  .confGrid{ grid-template-columns: 1fr; }
}

/* Medications multi-select (same look as diseases) */
.med-grid{ display:flex; gap:14px; align-items:flex-start; flex-wrap:wrap; }
.med-left{ flex:1; min-width:240px; }
.med-right{ flex:1; min-width:240px; }

.med-grid input[type="text"], .med-grid textarea{
  width:100%;
  background: rgba(15,23,42,.75);
  color: rgba(255,255,255,.92);
  border:1px solid rgba(255,255,255,.14);
  border-radius: 14px;
  padding: 10px 12px;
  outline: none;
}
.med-grid input[type="text"]::placeholder, .med-grid textarea::placeholder{
  color: rgba(255,255,255,.45);
}
.med-grid input[type="text"]:focus, .med-grid textarea:focus{
  border-color: rgba(99,102,241,.55);
  box-shadow: 0 0 0 4px rgba(99,102,241,.18);
}

/* Consent modal */
.modalOverlay{
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.55);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 18px;
  z-index: 9999;
}
.modal{
  width: min(760px, 100%);
  background: #0b1521;
  border: 1px solid rgba(255,255,255,.08);
  border-radius: 16px;
  box-shadow: 0 20px 60px rgba(0,0,0,.55);
  padding: 18px;
}
.modalHead{ display:flex; align-items:baseline; justify-content:space-between; gap:12px; }
.modalHead h2{ margin:0; font-size: 18px; }
.modalBody{ margin-top: 10px; color: rgba(255,255,255,.9); font-size: 14px; line-height: 1.45; max-height: 55vh; overflow: auto; padding-right: 6px; }
.modalBody ul{ margin: 10px 0 0 18px; }
.consentCheck{ display:flex; gap:10px; align-items:flex-start; margin-top: 14px; padding: 10px 12px; border-radius: 12px; background: rgba(255,255,255,.04); border: 1px solid rgba(255,255,255,.06); }
.consentCheck input{ margin-top: 3px; }
.modalActions{ display:flex; gap:10px; justify-content:flex-end; margin-top: 12px; }


/* Meta options (age/gender/coffee/relationship) in a neat grid */
.metaGrid{
  display:grid;
  grid-template-columns: repeat(4, minmax(160px, 1fr));
  gap:12px;
}
@media (max-width: 860px){
  .metaGrid{ grid-template-columns: repeat(2, minmax(160px, 1fr)); }
}
@media (max-width: 460px){
  .metaGrid{ grid-template-columns: 1fr; }
}
.sliderRow{ gap:10px; align-items:center; }

/* Task header readability */
#taskText{ white-space: pre-line; font-size: 15px; line-height: 1.35; }
#taskName{ font-size: 15px; }
#taskHint{ font-size: 14px; line-height: 1.35; }

