/* Scoped integration controls; the Team F questionnaire retains its existing UI.
 * Hallmark pre-emit critique: P4 H4 E4 S4 R5 V4. */
:root { --local-ink: #202020; --local-muted: #555; --local-paper: #fff;
  --local-line: #c8c8c8; --local-focus: #8b1232; --local-error: #9b1533;
  --local-sans: ui-sans-serif, system-ui, sans-serif; --local-serif: Georgia, serif; }
.local-shell { margin: 0; color: var(--local-ink); background: var(--local-paper); font-family: var(--local-sans); font-size: 16px; line-height: 1.6; }
.local-shell main { max-width: 42rem; margin: 3rem auto; padding: 0 1.25rem; }
.local-shell h1 { font-family: var(--local-serif); font-size: clamp(1.8rem, 5vw, 2.6rem); line-height: 1.15; margin: 2.5rem 0 1rem; text-wrap: balance; }
.local-shell p { max-width: 65ch; margin: 1rem 0; }
.upf-brand { display: block; width: 140px; height: auto; margin-bottom: 2rem; }
.local-shell a, .local-bar a { color: inherit; text-underline-offset: .22em; }
.local-shell nav { display: flex; gap: .75rem; flex-wrap: wrap; }
.local-shell button { border: 1px solid var(--local-ink); border-radius: 6px; padding: .75rem 1rem; min-height: 44px; font: inherit; color: var(--local-paper); background: var(--local-ink); cursor: pointer; }
.local-shell button:hover:not(:disabled) { background: var(--local-muted); }
.local-shell button:active:not(:disabled) { transform: translateY(1px); }
.local-shell button:disabled { opacity: .55; cursor: default; }
.local-shell :focus-visible, .local-bar a:focus-visible { outline: 3px solid var(--local-focus); outline-offset: 3px; }
.local-shell .check { display: flex; align-items: start; gap: .75rem; margin: 2rem 0 1rem; }
.local-shell input[type=checkbox] { margin-top: .35rem; width: 1.2rem; height: 1.2rem; accent-color: var(--local-ink); flex: 0 0 auto; }
.actions { display: flex; flex-wrap: wrap; gap: .75rem; margin: 1.5rem 0; }
.local-shell [data-state=error] { color: var(--local-error); }
.local-bar { display: flex; justify-content: space-between; gap: .75rem; flex-wrap: wrap; padding: .75rem max(1rem, calc((100% - 42rem) / 2)); color: var(--local-ink); background: var(--local-paper); border-bottom: 1px solid var(--local-line); font: 14px/1.5 var(--local-sans); }
.local-bar a { min-height: 24px; }
@media (max-width: 414px) { .local-shell main { margin-top: 1.5rem; } .actions button { width: 100%; } }
@media (prefers-reduced-motion: reduce) { .local-shell button:active { transform: none; } }

/* Private scroll integration: one question per viewport; UPF identity retained.
 * Scoped refinement: P4 H4 E4 S4 R5 V4; no new visual theme or scientific copy. */
body.scroll-mode{--study-paper:#fff;--study-ink:#242831;--study-muted:#555b65;--study-line:#b7bbc2;--study-subtle:#f5f5f4;--study-accent:#9d1838;--study-sans:ui-sans-serif,system-ui,sans-serif;--study-display:Georgia,serif;height:100dvh;min-height:0;margin:0;display:flex;flex-direction:column;overflow-y:hidden;overflow-x:clip;background:var(--study-paper)}
html:has(body.scroll-mode){overflow-x:clip}
.scroll-mode .local-bar{flex:none;padding:6px 16px;font-size:12px;gap:4px 12px}
.scroll-mode #root{flex:1;min-height:0;min-width:0}
.scroll-study{height:100%;max-width:800px;margin:0 auto;display:grid;grid-template-rows:auto minmax(0,1fr) auto;color:var(--study-ink);font:16px/1.5 var(--study-sans);background:var(--study-paper)}
.scroll-study *{box-sizing:border-box}.scroll-study ::selection{background:var(--study-accent);color:var(--study-paper)}
.study-intro{display:flex;align-items:center;gap:20px;padding:14px 24px;border-bottom:1px solid var(--study-line)}
.study-intro img{width:100px;height:auto;flex:none}.study-intro div{min-width:0}
.study-intro h1{font:600 1rem/1.3 var(--study-sans);margin:0;overflow-wrap:anywhere}
.study-intro p{font-size:.75rem;color:var(--study-muted);margin:4px 0 0}
.question-feed{height:100%;min-height:0;overflow-y:auto;overflow-x:clip;scroll-snap-type:y mandatory;overscroll-behavior-y:contain;scrollbar-width:thin;scrollbar-color:var(--study-line) var(--study-paper)}
.scroll-question{height:100%;min-height:100%;overflow-y:auto;scrollbar-width:thin;padding:clamp(24px,4vh,48px) 32px;scroll-snap-align:start;scroll-snap-stop:always;display:flex;flex-direction:column;justify-content:safe center}
.scroll-question>*{flex-shrink:0}
.scroll-study h2{font:600 clamp(1.6rem,3.2vw,2.3rem)/1.16 var(--study-display);margin:12px 0 16px;max-width:26ch;overflow-wrap:anywhere;text-wrap:balance}
.scroll-question p{margin:0 0 12px;max-width:65ch}.question-meta{font-size:.8rem;color:var(--study-muted);font-variant-numeric:tabular-nums}.question-direction{font-weight:600}
.scroll-study fieldset{border:0;margin:12px 0 0;padding:0;min-width:0}
.scroll-study button,.scroll-study textarea,.answer-options label,.scale-options label{font:inherit;border:1px solid var(--study-line);border-radius:6px;background:var(--study-paper);color:var(--study-ink);padding:10px 14px;min-height:44px}
.scroll-study button{cursor:pointer;touch-action:manipulation}.scroll-study button:hover:not(:disabled){border-color:var(--study-ink);background:var(--study-subtle)}.scroll-study button:active:not(:disabled){transform:translateY(1px)}
.scroll-study button:disabled{cursor:default;opacity:.5}.scroll-study button[aria-pressed=true]{background:var(--study-ink);color:var(--study-paper);border-color:var(--study-ink)}
.scroll-study :focus-visible{outline:3px solid var(--study-accent);outline-offset:3px}.question-feed:focus-visible{outline-offset:-3px}
.scroll-study textarea{width:100%;resize:vertical;caret-color:var(--study-accent)}.scroll-study input{accent-color:var(--study-accent);width:18px;height:18px;margin:0 10px 0 0;flex:none}
.rank-choices,.answer-options,.scale-options{display:flex;flex-wrap:wrap;gap:10px;margin:14px 0}
.rank-choices{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));max-width:420px}.rank-choices button{min-height:64px;font-size:1.3rem}.rank-choices button:disabled{opacity:1;background:var(--study-subtle);border-color:var(--study-ink)}
.scroll-study output{display:block;min-height:28px;font-weight:600;font-variant-numeric:tabular-nums}
.answer-options label{display:flex;align-items:center;flex:1 1 220px}.scale-options label{display:flex;align-items:center;padding:10px}.scale-options input{margin-right:6px}
.study-controls{padding:12px 24px max(10px,env(safe-area-inset-bottom));background:var(--study-paper);border-top:1px solid var(--study-line)}
.audio-controls{display:flex;gap:8px;align-items:center;flex-wrap:wrap}.audio-label{font-weight:600;margin-right:auto}.audio-controls>small{flex-basis:100%;font-size:.75rem;color:var(--study-muted)}
.audio-controls button{padding:7px 12px;min-width:48px}.audio-controls button small{display:block;font-size:.7rem;font-variant-numeric:tabular-nums}.audio-controls .play-button{display:grid;place-items:center;min-height:48px;background:var(--study-ink);color:var(--study-paper)}.audio-controls .play-button:hover:not(:disabled){background:var(--study-accent);color:var(--study-paper)}
.study-controls nav{display:flex;justify-content:space-between;align-items:center;margin-top:8px}.study-controls nav button{display:grid;place-items:center}.study-controls nav span{font-size:.875rem;font-variant-numeric:tabular-nums}
.swipe-hint,.listening-hint{font-size:.75rem;color:var(--study-muted);margin:6px 0 0}.listening-hint{font-size:.7rem}
.review-list{display:grid;gap:8px;margin:8px 0 20px}.review-list button{display:flex;align-items:center;justify-content:space-between;gap:12px;text-align:left}.review-list small{flex:none;font-size:.75rem}.study-submit .save-button{background:var(--study-ink);color:var(--study-paper)}.study-submit .save-button:hover:not(:disabled),.scroll-study button[aria-pressed=true]:hover:not(:disabled){background:var(--study-accent);color:var(--study-paper)}.study-submit [role=alert]{color:var(--study-accent)}
.study-message{display:flex;flex-direction:column;justify-content:center;align-items:flex-start;padding:32px;gap:24px;height:auto;min-height:100%}
@media(max-width:480px){.study-intro{padding:10px 16px;gap:12px}.study-intro img{width:76px}.study-intro h1{font-size:.875rem}.study-intro p{font-size:.65rem}.scroll-question{padding:20px 18px}.scroll-study h2{font-size:1.6rem}.scroll-question p{margin-bottom:8px}.scroll-study fieldset{margin-top:8px}.rank-choices button{min-height:52px}.rank-choices,.answer-options{margin:10px 0}.study-controls{padding:8px 16px max(8px,env(safe-area-inset-bottom))}.audio-label{position:absolute;width:1px;height:1px;padding:0;margin:-1px;overflow:hidden;clip-path:inset(50%);white-space:nowrap}.audio-controls{gap:6px}.audio-controls button{flex:1}.answer-options{gap:8px}.answer-options button{font-size:.875rem;padding:10px}.review-list button{align-items:flex-start}.review-list small{max-width:80px}.swipe-hint{font-size:.7rem}}
@media(max-height:700px){.study-intro{padding-block:8px}.scroll-question{justify-content:flex-start;padding-block:20px}.scroll-study h2{font-size:1.6rem}.study-controls nav{margin-top:4px}.study-controls{padding-top:8px}.listening-hint{margin-top:3px}}
@media(prefers-reduced-motion:reduce){.question-feed{scroll-behavior:auto}.scroll-study button:active:not(:disabled){transform:none}}

.listening-lock{color:var(--study-accent);font-weight:600}.scroll-study fieldset:disabled{opacity:.55}

/* Locale names remain whole; all thirteen wrap across rows on small screens. */
.language-links{display:flex;flex-wrap:wrap;gap:4px 12px;align-items:center}
.language-links a{display:inline-flex;align-items:center;min-height:44px;white-space:nowrap}

.question-help{margin:0 0 8px;max-width:65ch}
.question-help summary{display:flex;align-items:center;gap:8px;min-height:44px;cursor:pointer;font-size:.875rem;color:var(--study-ink);list-style:none;text-decoration:underline;text-underline-offset:3px}
.question-help summary::-webkit-details-marker{display:none}.question-help summary svg{flex:none}
.question-help summary:hover{color:var(--study-accent)}.question-help summary:active{opacity:.8}
.question-help[open]>div{padding:8px 0}.question-help p{font-size:.875rem}
.flow-notice{font-size:.8rem;margin:4px 0;color:var(--study-accent)}

.study-heading{flex:1}.study-toolbar{position:relative;display:flex;gap:8px;margin-left:auto;flex:none;z-index:5}.study-preferences{position:static;flex:none}
.study-preferences>summary{display:grid;place-items:center;width:44px;height:44px;cursor:pointer;border:1px solid var(--study-line);border-radius:6px;list-style:none}
.study-preferences>summary::-webkit-details-marker{display:none}
.study-preferences>summary:hover{background:var(--study-subtle)}
.preferences-panel{position:absolute;right:0;top:calc(100% + 6px);width:min(260px,calc(100vw - 40px));padding:16px;border:1px solid var(--study-line);border-radius:8px;background:var(--study-paper);display:grid;gap:16px}
.preferences-panel label{display:grid;gap:6px;font-size:.875rem}
.preferences-panel select{width:100%;min-width:0;min-height:44px;font:inherit;padding:8px;color:var(--study-ink);background:var(--study-paper);border:1px solid var(--study-line);border-radius:4px}
.key-terms{overflow-y:auto;padding:24px 32px 40px}.key-terms h2{margin-top:0}.key-terms dl{margin:20px 0 28px;max-width:65ch}.key-terms dl>div+div{margin-top:24px}.key-terms dt{font-weight:650;margin-bottom:6px}.key-terms dd{margin:0;line-height:1.55}
.scroll-mode .local-bar{color:var(--study-ink);background:var(--study-paper);border-color:var(--study-line)}
html[data-study-theme="dark"] body.scroll-mode{--study-paper:#191c23;--study-ink:#f1f0ed;--study-muted:#b9bdc7;--study-line:#737b8c;--study-subtle:#292e39;--study-accent:#ff9bb4;color-scheme:dark}
@media(prefers-color-scheme:dark){html[data-study-theme="system"] body.scroll-mode{--study-paper:#191c23;--study-ink:#f1f0ed;--study-muted:#b9bdc7;--study-line:#737b8c;--study-subtle:#292e39;--study-accent:#ff9bb4;color-scheme:dark}}
html[data-study-theme="light"] body.scroll-mode{color-scheme:light}
.study-intro img{background:#fff;padding:4px;border-radius:2px}
@media(max-width:480px){.study-intro{gap:8px}.study-intro>div{flex:1}.study-intro img{width:66px}.key-terms{padding:20px 18px 32px}}

.local-preferences{margin-bottom:20px}.local-preferences summary{display:flex;align-items:center;gap:8px;min-height:44px;cursor:pointer;list-style:none;font-weight:600}.local-preferences summary::-webkit-details-marker{display:none}.local-preferences nav{margin:12px 0}.local-preferences label{display:flex;align-items:center;gap:16px}.local-preferences select{min-height:44px;font:inherit;background:var(--local-paper);color:var(--local-ink);border:1px solid var(--local-line);padding:8px}
html[data-study-theme="dark"]{--local-paper:#191c23;--local-ink:#f1f0ed;--local-muted:#b9bdc7;--local-line:#737b8c;--local-focus:#ff9bb4;--local-error:#ff9bb4;color-scheme:dark}
@media(prefers-color-scheme:dark){html[data-study-theme="system"]{--local-paper:#191c23;--local-ink:#f1f0ed;--local-muted:#b9bdc7;--local-line:#737b8c;--local-focus:#ff9bb4;--local-error:#ff9bb4;color-scheme:dark}}
html[data-study-theme="light"]{color-scheme:light}.upf-brand{background:#fff;padding:4px;border-radius:2px}

.local-toolbar{position:relative;display:flex;gap:8px;justify-content:flex-end;margin-bottom:20px}.local-toolbar .local-preferences{margin:0}.local-toolbar summary{display:grid;place-items:center;width:44px;border:1px solid var(--local-line);border-radius:6px}.local-toolbar nav,.local-toolbar .local-preferences>label{position:absolute;right:0;top:50px;z-index:5;width:min(300px,calc(100vw - 64px));padding:16px;background:var(--local-paper);border:1px solid var(--local-line);border-radius:8px;margin:0}.local-toolbar .local-preferences>label{display:grid;gap:8px}.local-toolbar select{width:100%}
@media(max-width:600px){.study-intro{flex-wrap:wrap}.study-intro .study-heading{flex:1;min-width:140px}.study-intro .study-toolbar{flex:none;width:100%;justify-content:flex-end}.study-toolbar .preferences-panel{max-height:60dvh;overflow-y:auto}}

/* Keep the listening instruction aligned with the three versions, not the label. */
.audio-controls{display:grid;grid-template-columns:minmax(0,1fr) 64px repeat(3,minmax(72px,104px));gap:8px;align-items:center}
.audio-controls .audio-label{grid-column:1;grid-row:1;margin-right:0}
.audio-controls .play-button{grid-column:2;grid-row:1;width:64px;height:64px;min-height:64px;padding:12px}
.audio-controls .play-button svg{width:30px;height:30px}
.audio-controls>button:nth-of-type(2){grid-column:3;grid-row:1}
.audio-controls>button:nth-of-type(3){grid-column:4;grid-row:1}
.audio-controls>button:nth-of-type(4){grid-column:5;grid-row:1}
.audio-controls>small{grid-column:3 / -1;text-align:center;line-height:1.45;min-width:0}
@media(max-width:600px){.audio-controls{grid-template-columns:56px repeat(3,minmax(0,1fr));gap:6px}.audio-controls .audio-label{position:absolute;width:1px;height:1px;padding:0;margin:-1px;overflow:hidden;clip-path:inset(50%);white-space:nowrap}.audio-controls .play-button{grid-column:1;width:56px;height:64px}.audio-controls>button:nth-of-type(2){grid-column:2}.audio-controls>button:nth-of-type(3){grid-column:3}.audio-controls>button:nth-of-type(4){grid-column:4}.audio-controls>small{grid-column:2 / -1}.audio-controls button{min-width:0;padding-inline:4px}.audio-controls button small{overflow-wrap:anywhere}}

.audio-controls .audio-complete{display:inline-grid;place-items:center;width:20px;height:20px;border-radius:50%;background:#e5f6eb;color:#16723b;vertical-align:middle}

/* One click opens the language list; theme choices remain compact and explicit. */
.local-toolbar,.study-toolbar{align-items:center}
.theme-choices{display:flex;gap:2px;padding:3px;border:1px solid var(--local-line);border-radius:8px}
.theme-choices button,.scroll-study .theme-choices button{display:grid;place-items:center;width:40px;min-height:38px;padding:6px;border:0;background:transparent;color:inherit;border-radius:5px}
.theme-choices button[aria-pressed=true]{background:var(--local-ink);color:var(--local-paper)}
.theme-choices button:hover:not([aria-pressed=true]){background:var(--local-line);color:var(--local-ink)}
.study-toolbar .theme-choices{border-color:var(--study-line)}
.study-toolbar .theme-choices button[aria-pressed=true]{background:var(--study-ink);color:var(--study-paper)}
.local-toolbar nav.locale-list,.preferences-panel.locale-list{display:flex;flex-direction:column;flex-wrap:nowrap;align-items:stretch;gap:2px;width:min(240px,calc(100vw - 40px));max-height:min(60dvh,440px);overflow-y:auto;padding:8px;box-sizing:border-box}
.locale-list a,.scroll-study .locale-list button{display:flex;align-items:center;gap:10px;flex:none;box-sizing:border-box;min-height:44px;padding:8px 12px;border:0;border-radius:4px;text-align:left;text-decoration:none;line-height:1.3;background:transparent;color:inherit}
.locale-list a::before,.locale-list button::before{content:'';width:6px;height:6px;border-radius:50%;flex:none;background:transparent}
.locale-list a[aria-current=page]::before,.locale-list button[aria-pressed=true]::before{background:currentColor}
.locale-list a[aria-current=page],.locale-list a:hover{background:var(--local-ink);color:var(--local-paper)}
.scroll-study .locale-list button[aria-pressed=true]{background:var(--study-subtle);color:var(--study-ink)}
.question-help>button{display:inline-flex;align-items:center;gap:8px;padding:0;min-height:44px;border:0;background:transparent;text-decoration:underline;text-underline-offset:3px;font-size:.875rem}
.question-help>button svg{flex:none}.question-help>button:hover{background:transparent!important}
.question-popover{position:fixed;inset:auto;margin:0;box-sizing:border-box;max-height:45dvh;overflow-y:auto;padding:16px;border:1px solid var(--study-line);border-radius:8px;background:var(--study-paper);color:var(--study-ink);font:14px/1.5 var(--study-sans)}
.question-popover p{margin:0}.question-popover p+p{margin-top:10px}
.audio-controls{grid-template-columns:minmax(0,1fr) 80px repeat(3,minmax(72px,104px))}
.audio-controls .play-button{justify-self:start}
.audio-controls>button.audio-ready{background:#e4f3e8;color:#175c31;border-color:#38834f}
.audio-controls>button.audio-ready[aria-pressed=true]{background:#175c31;color:#fff;border:2px solid #175c31;box-shadow:inset 0 0 0 2px var(--study-paper)}
.audio-controls>button.audio-ready:hover:not(:disabled){background:#cce8d5;color:#175c31}
.visually-hidden{position:absolute;width:1px;height:1px;padding:0;margin:-1px;overflow:hidden;clip-path:inset(50%);white-space:nowrap}
@media(max-width:600px){.audio-controls{grid-template-columns:66px repeat(3,minmax(0,1fr))}.theme-choices button,.scroll-study .theme-choices button{width:38px;min-height:38px}}
