/* Single owner of the responsive examination layout. No pinned inner scrollers. */
.ret-learning-levels { grid-area: level; }
.ret-level-selector { display: inline-flex; gap: 3px; padding: 3px; border-radius: 9px; background: var(--surface-sunken); }
.ret-level-selector button { min-height: 44px; padding: 6px 13px; border: 0; border-radius: 7px; background: transparent; color: var(--text-soft); font-family: inherit; font-size: 13px; font-weight: 600; cursor: pointer; }
.ret-level-selector button[aria-pressed='true'] { background: var(--surface); color: var(--accent-strong); box-shadow: 0 1px 3px #0001; }
.ret-learning-progress { font-size: 12px; line-height: 1.5; color: var(--text-soft); border-top: 1px solid var(--border-soft); padding-top: 8px; }
.ret-learning-progress p { margin: 0 0 6px; }
.ret-learning-progress[data-complete='true'] .ret-learning-status { color: var(--accent-strong); font-weight: 650; }
.ret-learning-next { width: 100%; }
html[data-ret-level='basic'] :is(#slotCyl, #slotAxisWd, #retDetails_scope, #btnOpenTrialRack) { display: none !important; }
html[data-ret-level='basic'] .ret-lens-slot-box { grid-template-columns: 1fr; }
html[data-ret-level='basic'] #slotSphere .ret-lens-value { font-size: 22px; }
html[data-ret-level='basic'] #slotSphere { grid-template-columns: minmax(0, 1fr) 200px; }
.ret-astig-lesson { margin-block: 6px; }
.ret-astig-lesson summary { cursor: pointer; color: var(--accent-strong); }
.ret-astig-lesson p { margin-top: 6px; }
html[data-ret-level='astigmatism'] :is(#retDetails_scope, #btnOpenTrialRack) { display: none !important; }
html[data-ret-level='advanced'] .ret-learning-progress { display: none; }
html[data-ret-level='basic'] .ret-dock__row--tools { display: none; }
html:is([data-ret-level='basic'], [data-ret-level='astigmatism']) .ret-lens-tools > .ret-field:has(#btnOpenTrialRack) { display: none; }
.ret-app { padding: 10px 20px 24px; gap: 10px; flex: 1 0 auto; width: 100%; max-width: 1200px; margin-inline: auto; }
.ret-mode-bar { padding: 0; gap: 8px; border: 0; border-radius: 0; background: none; box-shadow: none; justify-content: flex-start; }
.ret-mode-bar .ret-mode-field { flex: 0 1 auto; }
.ret-mode-bar :is(.ret-mode-hamburger, .ret-tour-btn, .rx-cta) { min-height: 44px; padding: 8px 12px; margin: 0; border-radius: 8px; font-size: 14px; box-shadow: none; }
.ret-mode-bar .rx-cta { margin-inline-start: auto; }
.rx-cta__text small { display: none; }
.ret-mode-bar .ret-explain-btn { display: none; }
.ret-mode-buttons.is-open { max-width: min(360px, calc(100vw - 32px)); max-height: 65dvh; overflow: auto; z-index: 120; }
.ret-workspace { display: block; flex: none; overflow: visible; min-width: 0; }
.ret-viewport-card { display: grid; grid-template-columns: minmax(0, 1fr) 350px; grid-template-areas: 'head head' 'level level' 'eye tools'; align-items: start; gap: 12px 24px; min-height: 0; padding: 12px 16px; overflow: visible; border: 1px solid var(--border-soft); box-shadow: none; border-radius: 14px; }
.ret-viewport-header { grid-area: head; display: flex; gap: 20px; margin: 0; padding-bottom: 12px; border-bottom: 1px solid var(--border-soft); z-index: auto; }
.ret-case-picker { display: flex; flex-direction: row; align-items: center; gap: 10px; flex: 1; min-width: 0; }
.ret-case-picker .ret-field-head { flex: none; margin: 0; }
.ret-case-picker .ret-select { width: min(100%, 420px); min-width: 0; min-height: 44px; font-size: 14px; padding: 8px 12px; }
.ret-eye-field { flex: none; }
.ret-eye-toggle { padding: 2px; border-radius: 8px; }
.ret-eye-btn { min-height: 44px; padding: 8px 12px; border-radius: 6px; font-size: 14px; transition: none; }
.ret-eye-btn[aria-pressed='true'] { box-shadow: inset 0 0 0 1px var(--accent); font-weight: 750; }
.ret-stage { grid-area: eye; display: flex; flex-direction: column; align-items: center; align-self: start; min-width: 0; gap: 8px; }
.ret-canvas-wrap { width: min(100%, 540px); min-width: 0; max-width: 100%; aspect-ratio: 1; margin: 0; border: 0; border-radius: 12px; box-shadow: none; }
.ret-sweep-guide { position: static; inset: auto; transform: none; width: auto; max-width: 100%; padding: 0; border: 0; background: none; box-shadow: none; color: var(--text-soft); font-size: 13px; line-height: 1.4; pointer-events: none; text-align: center; }
.ret-primary-controls { grid-area: tools; display: flex; flex-direction: column; gap: 12px; min-width: 0; }
.ret-lens-slot-box { display: grid; grid-template-columns: 1fr; width: 100%; gap: 6px; margin: 0; }
.ret-lens-slot { display: grid; grid-template-columns: 1fr 176px; align-items: center; gap: 8px; padding: 5px 0; border: 0; border-radius: 0; box-shadow: none; background: none; min-width: 0; }
.ret-lens-slot:is(.plus, .minus, .cyl) { border: 0; }
.ret-lens-slot .ret-field-head { margin: 0; min-width: 0; }
.ret-lens-slot .ret-lens-badge { font-size: 13px; text-transform: none; font-weight: 650; }
.ret-lens-glass-preview { display: none; }
.ret-lens-controls { display: grid; grid-template-columns: 44px minmax(0, 1fr) 44px; gap: 3px; width: 100%; direction: ltr; }
.ret-step-btn { width: 44px; height: 44px; padding: 0; border-radius: 7px; font-size: 22px; box-shadow: none; transition: none; touch-action: manipulation; }
.ret-lens-value { font-size: 14px; min-width: 0; white-space: nowrap; text-align: center; font-variant-numeric: tabular-nums; }
.ret-dock { display: flex; flex-direction: column; gap: 6px; padding-top: 10px; border-top: 1px solid var(--border-soft); }
.ret-dock__caption { display: flex; align-items: baseline; gap: 8px; flex-wrap: wrap; margin: 0; line-height: 1.4; }
.ret-dock__title { font-size: 13px; font-weight: 650; }
.ret-dock__value { font: 650 15px 'IBM Plex Mono', monospace; margin-inline-start: auto; }
.ret-dock__hint { display: none; }
.ret-dock .ret-auto-sweep { flex: none; min-height: 44px; padding: 6px 10px; font-size: 12px; }
.ret-auto-sweep[aria-pressed='true'] { background: var(--accent); color: var(--surface); border-color: var(--accent); }
.ret-dock__row { display: flex; gap: 5px; }
.ret-chip { display: inline-flex; align-items: center; justify-content: center; gap: 6px; flex: 1; min-width: 0; min-height: 44px; padding: 4px; border: 1px solid var(--border); border-radius: 7px; background: var(--surface); color: var(--text); font-family: inherit; font-size: 13px; font-weight: 600; cursor: pointer; touch-action: manipulation; }
.ret-chip.is-active, .ret-chip[aria-pressed='true'] { background: var(--accent-tint); border-color: var(--accent); color: var(--accent-strong); box-shadow: inset 0 -2px var(--accent); }
.ret-chip--step { font-size: 20px; }
.ret-chip__icon { font-size: 11px; }
.ret-dock__row--tools { width: min(100%, 300px); }
@media (min-width: 1100px) {
  .ret-app { max-width: 1600px; padding-inline: clamp(16px, 2vw, 32px); }
  .ret-viewport-card { grid-template-areas: 'head head' 'eye tools'; grid-template-columns: minmax(0, 1.15fr) minmax(350px, 1fr); }
  .ret-viewport-header { gap: 12px; }
  .ret-viewport-header .ret-learning-levels { flex: none; }
  .ret-case-picker .ret-field-head { display: none; }
  .ret-case-picker .ret-select { width: 100%; }
  .ret-canvas-wrap { width: 100%; height: clamp(300px, calc(100dvh - 190px), 540px); aspect-ratio: auto; }
}
@media (min-width: 1100px) and (max-height: 550px) {
  .ret-app { padding-top: 6px; gap: 6px; }
  .ret-viewport-card { row-gap: 6px; padding-block: 8px; }
  .ret-viewport-header { padding-bottom: 0; }
  .ret-lens-slot { padding-block: 0; }
  #retWorkspace .ret-dock, #retWorkspace .ret-working-distance { padding-top: 4px; }
  .ret-dock { gap: 4px; }
  #retWorkspace:not(.has-feedback) .ret-primary-controls { gap: 6px; }
  #retWorkspace .ret-inline-feedback .rsp-direction-box { padding-block: 6px; }
  #retWorkspace .ret-inline-feedback .rsp-direction-hint { font-size: 12px; }
}
.ret-working-distance { display: grid; grid-template-columns: 1fr auto; gap: 5px 8px; padding-top: 10px; border-top: 1px solid var(--border-soft); }
.ret-working-distance > .ret-field-head { grid-column: 1 / -1; margin: 0; }
.ret-working-distance .ret-field-label { font-size: 13px; }
.ret-working-distance .ret-snap-row { display: flex; gap: 4px; }
.ret-working-distance .ret-snap-btn { min-height: 44px; padding: 6px 9px; border-radius: 7px; font-size: 13px; }
.ret-working-distance .ret-snap-btn[aria-pressed='true'] { box-shadow: inset 0 -2px var(--accent); }
#retWorkspace #wdText { display: none; }
.ret-working-distance > .ret-field { display: flex; align-items: center; }
#currentDistanceBadge { padding: 0; background: none; border: 0; font-size: 12px; white-space: normal; }
#currentDistanceBadge > :is([data-i18n], .ret-badge__label) { display: none; }
.ret-lens-tools { display: flex; gap: 8px; grid-column: auto; }
.ret-lens-tools > .ret-field { flex: 1; min-width: 0; }
.ret-lens-tools .ret-hero-btn { width: 100%; min-height: 44px; padding: 6px 8px; border-radius: 7px; font-size: 13px; line-height: 1.4; box-shadow: none; background: var(--surface-sunken); color: var(--accent-strong); }
.ret-lens-tools .ret-hero-btn svg { display: none; }
.ret-lens-tools .ret-hero-btn[aria-pressed='true'] { box-shadow: inset 0 0 0 1px var(--accent); background: var(--accent-tint); }
/* Detailed help stays available in Learning; routine controls have clear labels. */
.ret-viewport-card .ret-explain-btn { display: none; }
.ret-working-distance > .ret-field-head .ret-explain-btn { display: inline-flex; }
.ret-viewport-card .ret-explain-pop { grid-column: 1 / -1; }
.ret-secondary { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; align-items: start; }
.ret-disclosure { min-width: 0; background: var(--surface); border: 1px solid var(--border-soft); border-radius: 8px; }
.ret-disclosure > summary { display: flex; align-items: center; justify-content: space-between; gap: 8px; min-height: 46px; padding: 10px 14px; cursor: pointer; color: var(--accent-strong); font-size: 14px; font-weight: 650; list-style: none; }
.ret-disclosure > summary::-webkit-details-marker { display: none; }
.ret-disclosure > summary::after { content: '+'; font-size: 20px; font-weight: 400; }
.ret-disclosure[open] > summary::after { content: '−'; }
.ret-secondary > .ret-disclosure[open] { grid-column: 1 / -1; }
.ret-disclosure > :not(summary) { margin: 0 14px 14px; }
.ret-disclosure .ret-card { height: auto; max-height: none; overflow: visible; padding: 0; box-shadow: none; border: 0; border-radius: 0; gap: 14px; }
.ret-disclosure .ret-card-title { grid-column: 1 / -1; }
.ret-disclosure .ret-hardware-panel, .ret-disclosure [data-panel='case'] { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 20px; }
.ret-disclosure #assistPanelRoot { width: auto; padding: 0; }
.ret-disclosure .ret-assist-panel { box-shadow: none; }
.ret-verdict { display: none; }
.ret-posture-selects { justify-content: flex-start; margin: 0; }
.ret-bottom-bar { position: static; box-shadow: none; flex: none; }
.ret-rx-inputs { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.ret-app :is(button, a, input, select, summary, [tabindex]):focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }
html[data-ret-exam='on'] :is(.ret-working-distance .ret-snap-row, #retDetails_case, #retDetails_assist) { display: none !important; }
html[data-ret-exam='on'] .ret-secondary { grid-template-columns: repeat(2, minmax(0, 1fr)); }
@media (max-width: 760px) {
  .ret-app { padding: 8px 10px max(20px, env(safe-area-inset-bottom)); gap: 8px; }
  .ret-mode-bar { flex-wrap: nowrap; gap: 6px; }
  .ret-mode-bar :is(.ret-mode-hamburger, .ret-tour-btn, .rx-cta) { padding: 6px 8px; font-size: 13px; }
  .ret-mode-hamburger { gap: 5px; }
  .ret-mode-current-label { max-width: 130px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .ret-tour-btn__label { display: none; }
  .ret-mode-bar .rx-cta { flex: none; }
  .rx-cta__text b { font-size: 13px; }
  .ret-viewport-card { grid-template-columns: minmax(0, 1fr); grid-template-areas: 'head' 'level' 'eye' 'tools'; padding: 10px; gap: 10px; border-radius: 10px; }
  .ret-viewport-header { display: grid; grid-template-columns: minmax(0, 1fr); gap: 8px; padding-bottom: 0; border: 0; }
  .ret-case-picker { gap: 8px; }
  .ret-case-picker .ret-field-head { display: none; }
  .ret-case-picker .ret-select { width: 100%; }
  .ret-eye-toggle { width: 100%; }
  .ret-eye-btn { flex: 1; font-size: 13px; }
  .ret-stage { gap: 5px; }
  .ret-canvas-wrap { width: min(100%, 300px); }
  .ret-stage > .ret-dock__row--tools { display: none; }
  .ret-sweep-guide { font-size: 12px; }
  .ret-primary-controls { gap: 10px; }
  .ret-lens-slot-box { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
  .ret-lens-slot { display: flex; flex-direction: column; gap: 5px; padding: 0; }
  .ret-lens-slot .ret-field-head { width: 100%; justify-content: center; }
  .ret-lens-slot .ret-lens-badge { font-size: 12px; }
  .ret-lens-controls { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 4px; }
  .ret-lens-value { grid-column: 1 / -1; grid-row: 1; font-size: 15px; padding-block: 2px; }
  .ret-step-btn { width: 100%; }
  .ret-working-distance { grid-template-columns: 1fr auto; }
  .ret-secondary { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .ret-disclosure > summary { font-size: 13px; padding: 8px 10px; }
  .ret-disclosure .ret-hardware-panel, .ret-disclosure [data-panel='case'] { grid-template-columns: minmax(0, 1fr); }
  .ret-rx-inputs { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (prefers-reduced-motion: reduce) {
  .ret-app *, .ret-app *::before, .ret-app *::after { animation: none !important; transition: none !important; scroll-behavior: auto !important; }
}
/* Touch phones need a real row for each action; the flexible mode label must
   never paint across the voice launcher or the tour button. */
@media (max-width: 760px) {
  html.ret-compact .ret-mode-bar {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 46px 46px;
    gap: 6px;
    padding: 0;
  }
  html.ret-compact .ret-mode-bar > .ret-mode-field { grid-area: 1 / 1; display: block; min-width: 0; width: 100%; margin: 0; }
  html.ret-compact .ret-mode-hamburger { width: 100%; max-width: 100%; overflow: hidden; }
  html.ret-compact #btnVoiceLesson { grid-area: 1 / 2; min-width: 46px; max-width: 46px; }
  html.ret-compact #btnQuickTour { grid-area: 1 / 3; min-width: 46px; max-width: 46px; }
  html.ret-compact #btnRankedExam { grid-area: 2 / 1 / 3 / 3; width: 100%; margin: 0; }
  html.ret-compact #retFeedbackToggle { grid-area: 2 / 3; width: 46px; min-height: 46px; padding: 6px; }
  html.ret-compact .ret-mode-buttons.is-open { width: min(360px, calc(100vw - 24px)); max-width: none; }
}

