/* desktop/css/desktop.css */

:root{
  --blue: rgb(48,148,172);
  --text: rgb(0,0,0);
  --bg: rgb(255,255,255);
  --ok: #128a12;
  --warn: #cc8a00;
  --err: #b00020;

  --fs-h1: clamp(22px, 3.6vw, 32px);
  --fs-btn: clamp(18px, 3vw, 26px);
  --fs-body: clamp(16px, 2.4vw, 20px);
  --radius: 12px;
}

* { box-sizing: border-box; }

body, button, input, select, textarea {
  font-family: 'Roboto', -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Helvetica Neue', Arial, sans-serif;
}

html, body {
  height: 100%;
  margin: 0;
  background: var(--bg);
  color: var(--text);
}

/* Prevent layout jitter when scrollbar appears/disappears */
html {
  scrollbar-gutter: stable; /* modern browsers */
}

/* If you only want it on calibration page: */
body.eqPage {
  overflow-y: auto;
}

/* Calibration page has 4 sections: top, calib, audio, bottom */
body.eqPage .page{
  grid-template-rows: auto 1fr auto auto; /* top, calib-area, audio, bottom */
  min-height: 100vh; /* use full viewport height */
}

/* Keep the calib-area able to shrink within the 1fr row (prevents overflow bugs) */
body.eqPage .calib-area{
  min-height: 0;
}


/* Page scaffold */
.page {
  min-height: 100%;
  display: grid;
  grid-template-rows: auto 1fr auto;
  padding: 16px;
  gap: 16px;
  margin-top: 12px;
}

/* Typography */
h1 {
  font-size: clamp(34px, 5vw, 64px);   /* match test title */
  font-weight: 900;
  margin: 0;
  text-align: center;
  line-height: 1.05;
}

.subtitle {
  font-size: clamp(20px, 3vw, 34px);   /* match test instructions */
  font-weight: 650;
  margin: 0;
  text-align: center;
  opacity: 0.9;
  line-height: 1.25;
}

body.eqPage {
  background: #fff;
}

/* Center page content more like test page */
body.eqPage .page {
  max-width: 1100px;
  margin: 0 auto;
}


/* Calibration area */
/* Top and bottom sections centered like your current style */
.top, .bottom{
  display: grid;
  gap: 12px;
  place-items: center;
}

.controls{
  display: grid;
  gap: 10px;
  place-items: center;
  width: 100%;
}

/* Middle area fills remaining space and centers the card */
.calib-area{
  width: 100%;
  border-radius: var(--radius);
  background: rgba(0,0,0,0);
  display: grid;
  place-items: center;
  overflow: visible;      
  min-height: 0;         
}


.card-img{
  display: block;
  height: auto;
  user-select: none;
  -webkit-user-drag: none;
  pointer-events: none;
}


input[type="range"] {
  width: min(480px, 86vw);
}

/* Button */
.primary {
  width: min(480px, 86vw);
  font-size: var(--fs-btn);
  font-weight: 900;           /* ✅ ADD THIS */
  padding: 18px 20px;
  border-radius: var(--radius);
  border: none;
  cursor: pointer;
  background: var(--blue);
  color: #fff;
}

.primary:hover { filter: brightness(0.96); }
.primary:disabled { opacity: 0.6; cursor: not-allowed; }

/* Status line */
.status {
  min-height: 28px;
  font-size: var(--fs-body);
  text-align: center;
}
.status.ok { color: var(--ok); }
.status.warn { color: var(--warn); }
.status.err { color: var(--err); }




/* ===== Test page canvas + debug panel (temporary) ===== */

.va-test-page {
  margin: 0;
  height: 100%;
  background: #fff; /* force white overall */
}

#vaCanvas {
  display: block;
  width: 100vw;
  height: 100vh;
}

/* Debug overlay */
.va-debug {
  position: fixed;
  top: 12px;
  left: 12px;
  z-index: 9999;
  width: min(520px, 92vw);
  background: rgba(255,255,255,0.95);
  border: 1px solid rgba(0,0,0,0.10);
  border-radius: 12px;
  box-shadow: 0 8px 24px rgba(0,0,0,0.12);
  padding: 12px;
  font-family: 'Roboto', -apple-system, BlinkMacSystemFont, 'Segoe UI', Arial, sans-serif;
}

.va-debug h2 {
  margin: 0 0 8px 0;
  font-size: 18px;
}

.va-debug .row {
  display: grid;
  grid-template-columns: 140px 1fr;
  gap: 10px;
  align-items: center;
  margin: 6px 0;
}

.va-debug label {
  font-weight: 700;
  font-size: 14px;
}

.va-debug input,
.va-debug select,
.va-debug textarea {
  font-size: 14px;
  padding: 8px 10px;
  border-radius: 10px;
  border: 1px solid rgba(0,0,0,0.18);
  width: 100%;
  box-sizing: border-box;
}

.va-debug textarea {
  resize: vertical;
  min-height: 44px;
}

.va-debug .btnrow {
  display: flex;
  gap: 10px;
  margin-top: 10px;
  flex-wrap: wrap;
}

.va-debug button {
  padding: 10px 12px;
  border-radius: 10px;
  border: none;
  cursor: pointer;
  background: rgb(48,148,172);
  color: #fff;
  font-weight: 700;
}

.va-debug button.secondary {
  background: rgba(0,0,0,0.10);
  color: #111;
}

.va-debug .meta {
  margin-top: 8px;
  font-size: 13px;
  opacity: 0.85;
  line-height: 1.35;
}

.va-debug .hint {
  font-size: 12px;
  opacity: 0.75;
}

.lineOverlay{
  position: fixed;
  top: 10px;
  right: 10px;
  z-index: 9999;
  padding: 8px 12px;
  border-radius: 999px;
  background: rgba(0,0,0,0.55);
  color: #fff;
  font-weight: 800;
  font-size: 18px;
  letter-spacing: 0.5px;
  pointer-events: none;
}

/* =========================================================
   VA TEST PAGE OVERRIDES (ONLY affects test.html)
   Implements:
   1) Title larger + centered
   2) Instructions larger + centered
   3) Letters vertically centered (canvas centered in remaining space)
   4) Hide status/debug (meta)
   5) No scrolling
   6) Break overlay stopwatch with smooth arc
   ========================================================= */

html, body {
  height: 100%;
}

body.vaPage {
  margin: 0 !important;
  height: 100vh !important;
  overflow: hidden !important;     /* no scrolling */
  background: #fff !important;
}

/* Layout: header on top, stage fills remainder */
body.vaPage .vaWrap {
  height: 100vh !important;
  display: grid !important;
  grid-template-rows: auto 1fr !important;
}

/* Title + instructions */
body.vaPage .vaHeader {
  text-align: center !important;
  padding: 18px 16px 12px !important;
}

body.vaPage #partTitle {
  text-align: center !important;
  font-size: clamp(34px, 5vw, 64px) !important;
  font-weight: 900 !important;
  line-height: 1.05 !important;
  margin: 0 !important;
}

body.vaPage #partInstr {
  text-align: center !important;
  font-size: clamp(20px, 3vw, 34px) !important;
  font-weight: 650 !important;
  line-height: 1.25 !important;
  margin-top: 10px !important;
  opacity: 0.9 !important;
}

/* Stage centers content; canvas fills ONLY stage */
body.vaPage .vaStage {
  position: relative !important;
  min-height: 0 !important;
  height: 100% !important;
  display: grid !important;
  place-items: center !important;
  overflow: hidden !important;
}

/* CRITICAL override: prevent 100vw/100vh breaking header/layout */
body.vaPage #vaCanvas {
  width: 100% !important;
  height: 100% !important;
  display: block !important;
}

/* Hide debug/meta */
body.vaPage #meta {
  display: none !important;
}

/* ===================== Break overlay (30s) ===================== */

body.vaPage .breakOverlay {
  position: fixed !important;
  inset: 0 !important;
  z-index: 10000 !important;
  background: rgba(255,255,255,0.92) !important;
  display: grid !important;
  place-items: center !important;
}

body.vaPage .breakOverlay[hidden] {
  display: none !important;
}

body.vaPage .breakCard {
  display: grid !important;
  place-items: center !important;
  gap: 14px !important;
  padding: 22px 24px !important;
  border-radius: 18px !important;
}

body.vaPage .ringWrap {
  position: relative !important;
  width: min(320px, 70vw) !important;
  height: min(320px, 70vw) !important;
  display: grid !important;
  place-items: center !important;
}

body.vaPage .ring {
  width: 100% !important;
  height: 100% !important;
  display: block !important;
}

/* Stroke styles */
body.vaPage .ringTrack,
body.vaPage .ringProg {
  fill: none !important;
  stroke-width: 12 !important;
}

body.vaPage .ringTrack {
  stroke: rgba(48,148,172,0.18) !important;
}

body.vaPage .ringProg {
  stroke: var(--blue) !important;
  stroke-linecap: round !important;

  /* Start arc at top */
  transform: rotate(-90deg) !important;
  transform-origin: 60px 60px !important;

  /* Allow JS to animate */
  stroke-dasharray: none;     /* ✅ no !important */
  stroke-dashoffset: 0;       /* ✅ no !important */
}


body.vaPage .ringText {
  position: absolute !important;
  inset: 0 !important;
  display: grid !important;
  place-items: center !important;
  font-size: clamp(44px, 7vw, 74px) !important;
  font-weight: 900 !important;
  color: #111 !important;
}

body.vaPage .breakLabel {
  font-size: clamp(20px, 3vw, 34px) !important;
  font-weight: 800 !important;
  color: #111 !important;
  opacity: 0.85 !important;
}

/* ===================== Results overlay (end of test) ===================== */
body.vaPage .resultsOverlay{
  position: fixed !important;
  inset: 0 !important;
  z-index: 11000 !important;
  background: rgba(255,255,255,0.95) !important;
  display: grid !important;
  place-items: center !important;
}

body.vaPage .resultsOverlay[hidden]{
  display: none !important;
}

body.vaPage .resultsCard{
  width: min(780px, 92vw) !important;
  border-radius: 20px !important;
  padding: 26px 22px !important;
  background: #fff !important;
  box-shadow: 0 18px 60px rgba(0,0,0,0.12) !important;
  border: 1px solid rgba(0,0,0,0.10) !important;
  display: grid !important;
  gap: 16px !important;
}

body.vaPage .resultsTitle{
  text-align: center !important;
  font-size: clamp(34px, 5vw, 64px) !important;
  font-weight: 900 !important;
  line-height: 1.05 !important;
  margin: 0 !important;
}

body.vaPage .resultsUnitLabel{
  font-size: clamp(16px, 2.2vw, 20px) !important;
  font-weight: 800 !important;
  text-align: center !important;
  opacity: 0.85 !important;
}

body.vaPage .resultsUnitSelect{
  width: min(420px, 92vw) !important;
  justify-self: center !important;
  font-size: clamp(18px, 2.6vw, 22px) !important;
  padding: 12px 14px !important;
  border-radius: 14px !important;
  border: 1px solid rgba(0,0,0,0.20) !important;
  outline: none !important;
}

body.vaPage .resultsGrid{
  display: grid !important;
  grid-template-columns: 1fr auto !important;
  gap: 14px 24px !important;
  align-items: baseline !important;
  padding-top: 8px !important;
}

body.vaPage .resultsLabel{
  font-size: clamp(20px, 3vw, 30px) !important;
  font-weight: 900 !important;
  letter-spacing: 0.2px !important;
}

body.vaPage .resultsValue{
  font-size: clamp(20px, 3vw, 30px) !important;
  font-weight: 800 !important;
  text-align: right !important;
  font-variant-numeric: tabular-nums !important; /* keeps numbers aligned */
  min-width: 9ch !important; /* tab-like alignment */
}

/* ===================== Calibration: Audio row ===================== */
body.eqPage .audio-check{
  width: min(720px, 92vw);
  margin: 0 auto;
  display: grid;
  grid-template-columns: 1fr auto; /* text left, button right */
  gap: 14px;
  align-items: center;
}

body.eqPage .audio-check__text{
  text-align: left;
}

body.eqPage .audio-check__title{
  font-size: var(--fs-body);
  font-weight: 900;
  margin-bottom: 4px;
}

body.eqPage .audio-check__instr{
  font-size: var(--fs-body);
  opacity: 0.85;
  line-height: 1.25;
}

body.eqPage .audio-check__btn{
  width: 64px;
  height: 64px;
  border-radius: 999px;
  border: none;
  background: var(--blue);
  color: #fff;
  cursor: pointer;
  display: grid;
  place-items: center;
  padding: 0;
}

body.eqPage .audio-check__btn:hover{ filter: brightness(0.96); }
body.eqPage .audio-check__btn:active{ transform: scale(0.98); }

body.eqPage .audioIcon{
  width: 30px;
  height: 30px;
  fill: currentColor;
  display: none;
}

body.eqPage .audio-check__btn .audioIcon--play{
  display: block;
}

body.eqPage .audio-check__btn.is-playing .audioIcon--play{
  display: none;
}

body.eqPage .audio-check__btn.is-playing .audioIcon--pause{
  display: block;
}

/* =========================================================
   PRACTICE PAGE
   ========================================================= */

body.practicePage{
  margin: 0;
  background: #fff;
  color: #111;
  overflow: hidden;
}

body.practicePage .practiceWrap{
  height: 100vh;
  display: grid;
  grid-template-rows: auto 1fr;
}

body.practicePage .practiceHeader{
  text-align: center;
  padding: 18px 16px 10px;
}

body.practicePage .practiceTitle{
  font-size: clamp(34px, 5vw, 64px);
  font-weight: 900;
  line-height: 1.05;
}

body.practicePage .practiceSubtitle{
  margin-top: 10px;
  text-align: center;
  font-size: clamp(20px, 3vw, 34px);
  font-weight: 650;
  line-height: 1.25;
  opacity: 0.9;
}

body.practicePage .practiceStage{
  min-height: 0;
  height: 100%;
  display: grid;
  grid-template-rows: 1fr auto;
  justify-items: center;
  align-items: center;
  padding: 10px 12px 22px;
  gap: 18px;
}

body.practicePage .practiceCanvasBox{
  width: 100%;
  display: grid;
  place-items: center;
}

/* Important: the canvas itself gets a real visible size */
body.practicePage #practiceCanvas{
  display: block;
  width: 100%;
  height: 52vh;
  
  background: #fff;
}

body.practicePage .practiceHint{
  display: grid;
  gap: 10px;
  place-items: center;
  text-align: center;
}

body.practicePage .practiceHintLabel{
  font-size: clamp(18px, 2.4vw, 26px);
  font-weight: 800;
  opacity: 0.9;
}

body.practicePage .practiceArrow{
  width: min(320px, 78vw);
  height: min(220px, 54vw);
  border-radius: 28px;
  border: 4px solid rgba(48,148,172,0.40);
  background: rgba(48,148,172,0.10);
  display: grid;
  place-items: center;
  overflow: hidden;
  position: relative;
  --arrowScale: 0.70;
}

body.practicePage .practiceArrowImg{
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%) scale(var(--arrowScale));
  transform-origin: center center;
  max-width: 100%;
  max-height: 100%;
  width: auto;
  height: auto;
  display: block;
  pointer-events: none;
  user-select: none;
}


/* =========================================================
   PAIRING PAGE - Redo Calibration Button
   ========================================================= */

body.eqPage .redoCalBtn{
  position: fixed;
  top: 14px;
  left: 14px;
  z-index: 20000;

  display: inline-flex;
  align-items: center;
  gap: 10px;

  background: rgba(255,255,255,0.92);
  border: 1px solid rgba(0,0,0,0.10);
  border-radius: 999px;
  box-shadow: 0 10px 28px rgba(0,0,0,0.10);

  padding: 10px 14px;
  cursor: pointer;

  color: rgb(48,148,172);
  font-size: clamp(16px, 2.2vw, 20px);
  font-weight: 900;
}

body.eqPage .redoCalBtn:hover{
  filter: brightness(0.98);
}

body.eqPage .redoChevron{
  font-size: 30px;
  line-height: 1;
  font-weight: 900;
  margin-top: -2px; /* optically center the chevron */
}

body.eqPage .redoText{
  font-weight: 900;
}



/* =========================================================
   INSTRUCTIONS PAGE
   Standalone page version (not overlay)
   ========================================================= */

body.instructionsPage{
  margin: 0;
  background: #fff;
  color: #111;
  min-height: 100vh;
  overflow-y: auto;
}

body.instructionsPage .instructionsPageWrap{
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 18px 12px;
}

body.instructionsPage .instrCard{
  width: min(2000px, 94vw);
  background: #fff;
  border: 1px solid rgba(0,0,0,0.10);
  border-radius: 22px;
  box-shadow: 0 18px 60px rgba(0,0,0,0.12);
  display: grid;
  grid-template-rows: auto 1fr auto;
  gap: 16px;
  padding: 22px 18px;
}

body.instructionsPage .instrTitle{
  text-align: center;
  font-size: clamp(34px, 5vw, 64px);
  font-weight: 900;
  line-height: 1.05;
}

body.instructionsPage .instrList{
  display: grid;
  gap: 14px;
}

body.instructionsPage .instrItem{
  display: grid;
  grid-template-columns: 44px 1fr;
  gap: 12px;
  align-items: start;
}

body.instructionsPage .instrNum{
  width: 44px;
  height: 44px;
  border-radius: 999px;
  background: rgba(48,148,172,0.12);
  color: rgb(48,148,172);
  display: grid;
  place-items: center;
  font-weight: 900;
  font-size: 20px;
}

body.instructionsPage .instrContent{
  display: grid;
  gap: 10px;
}

body.instructionsPage .instrText{
  font-size: clamp(18px, 2.4vw, 26px);
  font-weight: 650;
  line-height: 1.25;
  color: #111;
  opacity: 0.92;
}

body.instructionsPage .instrImg{
  width: 100%;
  max-height: 220px;
  object-fit: contain;
  border-radius: 14px;
  border: 1px solid rgba(0,0,0,0.10);
  background: rgba(0,0,0,0.03);
  padding: 8px;
}

body.instructionsPage .instrBtn{
  justify-self: center;
  width: min(640px, 92vw);
  font-weight: 900 !important;
  border-radius: 18px;
}

/* =========================================================
   RESULTS PAGE
   ========================================================= */

body.resultsPage{
  margin: 0;
  min-height: 100vh;
  background: #fff;
  color: #111;
  overflow-y: auto;
}

body.resultsPage .resultsPageWrap{
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 18px 12px;
}

body.resultsPage .resultsPageCard{
  width: min(780px, 92vw);
  border-radius: 20px;
  padding: 26px 22px;
  background: #fff;
  box-shadow: 0 18px 60px rgba(0,0,0,0.12);
  border: 1px solid rgba(0,0,0,0.10);
  display: grid;
  gap: 16px;
}

body.resultsPage .resultsTitle{
  text-align: center;
  font-size: clamp(34px, 5vw, 64px);
  font-weight: 900;
  line-height: 1.05;
  margin: 0;
}

body.resultsPage .resultsUnitLabel{
  font-size: clamp(16px, 2.2vw, 20px);
  font-weight: 800;
  text-align: center;
  opacity: 0.85;
}

body.resultsPage .resultsUnitSelect{
  width: min(420px, 92vw);
  justify-self: center;
  font-size: clamp(18px, 2.6vw, 22px);
  padding: 12px 14px;
  border-radius: 14px;
  border: 1px solid rgba(0,0,0,0.20);
  outline: none;
}

body.resultsPage .resultsGrid{
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 14px 24px;
  align-items: baseline;
  padding-top: 8px;
}

body.resultsPage .resultsLabel{
  font-size: clamp(20px, 3vw, 30px);
  font-weight: 900;
  letter-spacing: 0.2px;
}

body.resultsPage .resultsValue{
  font-size: clamp(20px, 3vw, 30px);
  font-weight: 800;
  text-align: right;
  font-variant-numeric: tabular-nums;
  min-width: 9ch;
}

body.resultsPage .resultsPlaceholder{
  min-height: 120px;
}

/* =========================================================
   RESULTS PAGE - EMAIL FORM MODE
============================================================ */

body.resultsPage.resultsEmailOnly .resultsPageWrap {
  min-height: auto;
  display: block;
  padding: 16px 0;
}

body.resultsPage.resultsEmailOnly .resultsPageCard,
body.resultsPage .resultsPageCard.resultsPagePlain {
  width: min(520px, 92vw);
  margin: 0 auto;
  border: none;
  box-shadow: none;
  background: transparent;
  padding: 0;
  border-radius: 0;
  display: block;
}

body.resultsPage.resultsEmailOnly .result-form {
  max-width: 520px;
  margin: 0 auto;
}

body.resultsPage.resultsEmailOnly .result-title {
  font-size: 34px;
  font-weight: 800;
  margin: 0 0 12px;
  text-align: center;
  line-height: 1.15;
}

body.resultsPage.resultsEmailOnly .result-form-fields label {
  display: block;
  font-size: 18px;
  font-weight: 600;
  margin: 12px 0 6px;
}

body.resultsPage.resultsEmailOnly .result-form-fields input {
  width: 100%;
  padding: 12px 12px;
  font-size: 18px;
  border: 1px solid #e6e6e6;
  border-radius: 10px;
  box-sizing: border-box;
}

body.resultsPage.resultsEmailOnly .result-form-fields input:focus {
  outline: none;
  border-color: var(--blue);
}

body.resultsPage.resultsEmailOnly .result-form-fields .consent {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  margin-top: 16px;
  cursor: pointer;
  font-weight: 400;
}

body.resultsPage.resultsEmailOnly .result-form-fields .consent input {
  width: auto;
  margin-top: 4px;
}

body.resultsPage.resultsEmailOnly .msg {
  margin-top: 16px;
  padding: 12px 12px;
  border-radius: 10px;
  border: 1px solid #e6e6e6;
  font-size: 18px;
  line-height: 1.35;
}

body.resultsPage.resultsEmailOnly .msg.ok {
  background: #e7f7ec;
  border-color: #bfe8cc;
}

body.resultsPage.resultsEmailOnly .msg.err {
  background: #fde8e8;
  border-color: #f1bcbc;
}

body.resultsPage.resultsEmailOnly .result-actions {
  margin-top: 22px;
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  justify-content: center;
}

body.resultsPage.resultsEmailOnly .result-actions button {
  display: inline-block;
  appearance: none;
  -webkit-appearance: none;
  border: none;
  border-radius: 8px;
  padding: 16px 28px;
  font-size: 22px;
  font-weight: 700;
  line-height: 1.2;
  text-transform: uppercase;
  text-decoration: none;
  color: #ffffff !important;
  background: var(--blue) !important;
  opacity: 1 !important;
  visibility: visible !important;
  cursor: pointer;
}

body.resultsPage.resultsEmailOnly #sendBtn {
  color: #ffffff !important;
  background-color: var(--blue) !important;
}

body.resultsPage.resultsEmailOnly .result-actions button:disabled {
  opacity: 0.65;
  cursor: not-allowed;
}

body.resultsPage.resultsEmailOnly .success-panel {
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 22px 0;
  box-sizing: border-box;
}

body.resultsPage.resultsEmailOnly .success-main {
  font-size: 24px;
  font-weight: 700;
  line-height: 1.35;
}

body.resultsPage.resultsEmailOnly .success-sub {
  margin-top: 10px;
  font-size: 22px;
  font-weight: 400;
  line-height: 1.4;
}
