/* Analysis and report live in task dialogs so the experiment keeps its working space. */
.study-dialog {
  width:min(720px,calc(100vw - 24px));
  max-width:calc(100vw - 24px);
  max-height:calc(100dvh - 24px);
  margin:auto;
  padding:0;
  border:1px solid var(--line,#d8e0ee);
  border-radius:12px;
  color:var(--ink,#192b48);
  background:#fff;
  box-shadow:0 18px 60px #192b4826;
}
.study-dialog[open] { display:flex; flex-direction:column; }
.study-dialog::backdrop { background:#192b4866; }
.study-dialog-header {
  display:flex; align-items:center; justify-content:space-between;
  flex:0 0 auto; gap:12px; padding:12px 18px;
  border-bottom:1px solid var(--line,#d8e0ee);
}
.study-dialog-header h2 { margin:0; font-size:18px; }
.study-dialog-header button,.study-dialog-actions button,.study-action-button {
  min-height:44px; min-width:44px; padding:8px 12px; border-radius:8px;
}
.study-dialog-body { min-height:0; overflow:auto; overscroll-behavior:contain; padding:16px 18px; }
.study-dialog-actions {
  flex:0 0 auto; display:flex; flex-wrap:wrap; align-items:center; justify-content:flex-end;
  gap:8px; padding:10px 18px calc(10px + env(safe-area-inset-bottom,0px));
  border-top:1px solid var(--line,#d8e0ee);
}
#analysis-fields { display:grid; gap:16px; }
.study-field { display:flex; flex-direction:column; gap:6px; font-weight:600; min-width:0; }
.study-field textarea {
  width:100%; box-sizing:border-box; min-height:104px; padding:10px 12px;
  resize:vertical; font-family:inherit; font-size:15px; font-weight:400; line-height:1.65;
  color:inherit; background:#fff; border:1px solid var(--line,#d8e0ee); border-radius:8px;
}
.study-field textarea:focus-visible,.study-dialog button:focus-visible {
  outline:2px solid var(--blue,#2458f5); outline-offset:2px;
}
.study-field-hint,.study-field small,#analysis-task-note,.study-dialog .study-note { margin:0; font-size:13px; line-height:1.65; color:var(--muted,#68778f); font-weight:400; }
.study-teacher-hints,.study-teacher-details { margin-top:16px; border-top:1px solid var(--line,#d8e0ee); }
.study-teacher-hints summary,.study-teacher-details summary { min-height:44px; display:flex; align-items:center; cursor:pointer; color:var(--blue,#2458f5); }
.study-teacher-hints p,#analysis-teacher-hint { margin:0 0 8px; line-height:1.75; font-size:14px; }
.study-status { margin:0; flex:1 1 180px; color:var(--muted,#68778f); font-size:12px; line-height:1.5; }
.report-dialog { width:min(940px,calc(100vw - 24px)); }
.report-body { padding:16px; background:var(--pale,#f6f8fd); }
.study-report {
  padding:28px 32px; background:#fff; color:#192b48;
  font-size:14px; line-height:1.75; overflow-wrap:anywhere;
  border:1px solid #d8e0ee; border-radius:6px;
}
.study-report h1 { margin:6px 0 12px; font-size:24px; line-height:1.4; }
.study-report h2 { margin:18px 0 8px; font-size:16px; line-height:1.5; }
.study-report h3 { margin:12px 0 4px; font-size:14px; }
.study-report p { margin:4px 0 8px; }
.study-report small { margin-left:8px; font-size:12px; font-weight:400; color:#68778f; }
.report-brand { color:#2458f5; font-size:12px; letter-spacing:.08em; }
.report-identity { display:flex; flex-wrap:wrap; align-items:baseline; gap:6px; font-size:13px; }
.report-identity span { display:inline-block; min-width:80px; flex:1; border-bottom:1px solid #68778f; }
.report-note,.report-footnote { font-size:12px; line-height:1.6; color:#68778f; }
.report-table-wrap { max-width:100%; overflow-x:auto; }
.study-report table { width:100%; border-collapse:collapse; font-size:13px; }
.study-report th,.study-report td { height:auto; padding:7px 8px; border:1px solid #c3d2ec; text-align:center; vertical-align:middle; }
.study-report th { color:#192b48; background:#f6f8fd; font-weight:600; white-space:normal; }
.report-empty { color:#68778f; font-weight:400; }
.report-graph-sheet { width:100%; aspect-ratio:5/3; min-height:0; overflow:hidden; border:1px solid #d8e0ee; }
.report-graph-sheet svg { display:block; width:100%!important; height:100%!important; pointer-events:none; }
.report-graph-sheet [data-manual-point-hit],.report-graph-sheet [data-guide-handle] { display:none; }
.report-analysis p { white-space:pre-wrap; }
.report-footnote { margin-top:20px; padding-top:8px; border-top:1px solid #d8e0ee; }
@media(max-width:600px) {
  .study-dialog { width:calc(100vw - 12px); max-width:calc(100vw - 12px); max-height:calc(100dvh - 12px); border-radius:10px; }
  .study-dialog-header { padding:8px 10px; }
  .study-dialog-header h2 { font-size:16px; }
  .study-dialog-body { padding:12px; }
  .study-dialog-actions { padding:8px 10px calc(8px + env(safe-area-inset-bottom,0px)); gap:6px; }
  .study-field textarea { font-size:16px; min-height:112px; }
  .report-body { padding:6px; }
  .study-report { padding:16px 12px; font-size:13px; border-radius:4px; }
  .study-report h1 { font-size:20px; }
  .report-identity span { min-width:44px; }
  .study-report table { min-width:440px; font-size:12px; }
  .study-report th,.study-report td { padding:6px; }
}
@page { size:A4; margin:13mm; }
@media print {
  html:has(#report-dialog[open]) { height:auto!important; min-height:0!important; overflow:visible!important; background:#fff!important; }
  body:has(#report-dialog[open]) {
    display:block!important; width:auto!important; height:auto!important;
    min-height:0!important; margin:0!important; overflow:visible!important; background:#fff!important;
  }
  body:has(#report-dialog[open]) > :not(#report-dialog):not(#study-overlays) { display:none!important; }
  body:has(#report-dialog[open]) > #study-overlays {
    display:block!important; position:static!important; width:auto!important; height:auto!important;
    overflow:visible!important; margin:0!important; padding:0!important;
  }
  body:has(#report-dialog[open]) #study-overlays > :not(#report-dialog) { display:none!important; }
  #report-dialog[open] {
    display:block!important; position:static!important; inset:auto!important;
    width:auto!important; max-width:none!important; height:auto!important; max-height:none!important;
    margin:0!important; padding:0!important; border:0!important; border-radius:0!important;
    overflow:visible!important; box-shadow:none!important; background:#fff!important;
  }
  #report-dialog::backdrop { display:none!important; }
  #report-dialog > .study-dialog-header,#report-dialog > .study-dialog-actions { display:none!important; }
  #report-dialog .report-body { display:block!important; padding:0!important; overflow:visible!important; max-height:none!important; background:#fff!important; }
  #report-dialog .study-report { padding:0; border:0; border-radius:0; font-size:10pt; color:#111; }
  #report-dialog .study-report h1 { font-size:17pt; }
  #report-dialog .study-report h2 { font-size:12pt; break-after:avoid; }
  #report-dialog .study-report h3 { break-after:avoid; }
  #report-dialog .report-heading,#report-dialog .report-graph { break-inside:avoid; }
  #report-dialog .report-table-wrap { overflow:visible; }
  #report-dialog .study-report table { min-width:0; font-size:9pt; }
  #report-dialog .study-report thead { display:table-header-group; }
  #report-dialog .study-report tr { break-inside:avoid; }
  #report-dialog .study-report th,#report-dialog .study-report td { padding:4px 6px; print-color-adjust:exact; -webkit-print-color-adjust:exact; }
  #report-dialog .report-graph-sheet { max-height:none; aspect-ratio:5/3; }
  #report-dialog .report-identity span { min-width:50px; }
}
