/* NeuroHaven Age (formerly Brain Score): app mode for the test (Raphael 2026-11-09, "first step before an app").
   A dark immersive shell around the same light task cards, so every task keeps the colors and contrast
   it was built and checked with (the Stroop colors in particular). */

body.app-mode {
  background: #1B1B1A;
  color: var(--cream);
  min-height: 100vh;
  min-height: 100dvh;
  overflow-x: hidden;
}

/* Slow moving glow behind everything */
.am-bg { position: fixed; inset: 0; z-index: 0; pointer-events: none; overflow: hidden;
  background: radial-gradient(120% 80% at 50% -10%, #41412E 0%, #1B1B1A 55%, #1B1B1A 100%); }
.am-bg i { position: absolute; border-radius: 50%; filter: blur(40px); opacity: 0.55; }
.am-bg i:nth-child(1) { width: 620px; height: 620px; left: -180px; top: -160px;
  background: radial-gradient(circle, rgba(158,158,125,0.45), transparent 65%); animation: amDrift 18s ease-in-out infinite alternate; }
.am-bg i:nth-child(2) { width: 560px; height: 560px; right: -200px; bottom: -180px;
  background: radial-gradient(circle, rgba(170,148,118,0.38), transparent 65%); animation: amDrift 22s ease-in-out infinite alternate-reverse; }
@keyframes amDrift { to { transform: translate(90px, 70px) scale(1.12); } }

/* Top bar */
.am-top { position: sticky; top: 0; z-index: 5; width: 100%; display: grid; grid-template-columns: 1fr auto 1fr; align-items: center;
  gap: 12px; padding: 14px 20px; background: rgba(27,27,26,0.55); backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px);
  border-bottom: 1px solid rgba(240,232,217,0.08); }
.am-brand { display: flex; align-items: center; gap: 10px; text-decoration: none; color: var(--cream); justify-self: start; }
.am-brand img { width: 28px; height: 28px; filter: brightness(0) invert(0.93); }
.am-brand span { font-family: var(--font-headline); font-size: 12px; letter-spacing: 0.04em; }
.am-step { font-family: var(--font-body); font-size: 13px; color: rgba(240,232,217,0.75); text-align: center; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 46vw; }
.am-ring { justify-self: end; position: relative; width: 38px; height: 38px; opacity: 0; transition: opacity .4s; }
.am-ring.on { opacity: 1; }
.am-ring svg { width: 100%; height: 100%; transform: rotate(-90deg); }
.am-ring circle { fill: none; stroke-width: 3.2; }
.am-ring-bg { stroke: rgba(240,232,217,0.14); }
.am-ring-fg { stroke: #AA9476; stroke-linecap: round; stroke-dasharray: 100 100; stroke-dashoffset: 100; transition: stroke-dashoffset .8s cubic-bezier(.2,.8,.2,1); }
.am-ring span { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; font-family: var(--font-body); font-size: 11px; color: var(--cream); }
@media (max-width: 520px) { .am-brand span { display: none; } }

body.app-mode .app { position: relative; z-index: 1; max-width: 760px; padding: 28px 16px 64px; }

/* Cards stay light so tasks look exactly as designed */
body.app-mode .card { background: #F0E8D9; color: var(--ink); border-radius: 26px; border: 1px solid rgba(240,232,217,0.25);
  box-shadow: 0 40px 90px -40px rgba(27,27,26,0.75), 0 0 0 1px rgba(27,27,26,0.04); }
body.app-mode .card:not(.hidden) { animation: amIn .5s cubic-bezier(.2,.8,.2,1) both; }
@keyframes amIn { from { opacity: 0; transform: translateY(18px) scale(0.985); } }

.am-kicker { font-family: var(--font-body); font-size: 11px; letter-spacing: 0.22em; text-transform: uppercase; color: var(--tan); margin: 0 0 10px; }
.team-banner { background: rgba(158,158,125,0.16); border: 1px solid rgba(65,65,46,0.15); border-radius: 14px; padding: 12px 14px; font-size: 14px; line-height: 1.5; }

/* The card between steps */
.am-intro { position: relative; z-index: 1; min-height: calc(100vh - 140px); min-height: calc(100dvh - 140px); width: 100%;
  display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; color: var(--cream); padding: 24px 8px; }
.am-intro:not(.hidden) > * { animation: amUp .6s cubic-bezier(.2,.8,.2,1) both; }
.am-intro:not(.hidden) > *:nth-child(2) { animation-delay: .08s; }
.am-intro:not(.hidden) > *:nth-child(3) { animation-delay: .16s; }
.am-intro:not(.hidden) > *:nth-child(4) { animation-delay: .24s; }
.am-intro:not(.hidden) > *:nth-child(5) { animation-delay: .4s; }
@keyframes amUp { from { opacity: 0; transform: translateY(22px); } }
.am-intro-n { font-family: var(--font-headline); font-size: clamp(64px, 16vw, 120px); line-height: 1; margin: 0;
  background: linear-gradient(135deg, #D7C7A9, #9E9E7D 60%, #AA9476); -webkit-background-clip: text; background-clip: text; color: transparent; }
.am-intro-title { font-family: var(--font-headline); font-weight: 500; font-size: clamp(26px, 5vw, 40px); letter-spacing: -0.02em; margin: 14px 0 6px; color: var(--cream); }
.am-intro-skill { font-family: var(--font-body); font-size: 12px; letter-spacing: 0.22em; text-transform: uppercase; color: #AA9476; margin: 0 0 18px; }
.am-intro-desc { font-family: var(--font-body); font-size: 16px; line-height: 1.6; color: rgba(240,232,217,0.78); max-width: 440px; margin: 0 0 30px; }
.am-intro-go { background: var(--cream) !important; color: var(--ink) !important; min-width: 180px; }
.am-intro-go:hover { background: #D7C7A9 !important; }

/* Results reveal */
.am-reveal { text-align: center; padding: 6px 0 22px; margin-bottom: 18px; border-bottom: 1px solid rgba(65,65,46,0.12); }
.am-reveal-ring { position: relative; width: min(240px, 64vw); aspect-ratio: 1; margin: 6px auto 8px; }
.am-reveal-ring svg { width: 100%; height: 100%; transform: rotate(-90deg); }
.am-reveal-ring circle { fill: none; stroke-width: 9; }
.am-rv-bg { stroke: rgba(65,65,46,0.1); }
.am-rv-fg { stroke: url(#amGrad); stroke-linecap: round; stroke-dasharray: 326.7; stroke-dashoffset: 326.7; transition: stroke-dashoffset 1.8s cubic-bezier(.2,.8,.2,1); }
.am-rv-center { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; }
.am-rv-score { font-family: var(--font-headline); font-size: clamp(48px, 13vw, 68px); line-height: 1; color: var(--ink); letter-spacing: -0.03em; }
.am-rv-of { font-family: var(--font-body); font-size: 12px; color: rgba(65,65,46,0.82); margin-top: 6px; letter-spacing: 0.08em; text-transform: uppercase; }
.am-rv-band { font-family: var(--font-headline); font-size: 18px; color: var(--accent); margin: 4px 0 18px; opacity: 0; transition: opacity .6s .9s; }
.am-rv-age-k { font-family: var(--font-body); font-size: 11px; letter-spacing: 0.22em; text-transform: uppercase; color: var(--tan); margin: 0 0 4px; opacity: 0; transition: opacity .6s 1.3s; }
.am-rv-age { font-family: var(--font-headline); font-size: clamp(22px, 5.5vw, 30px); color: var(--ink); margin: 0; letter-spacing: -0.02em; opacity: 0; transform: translateY(10px); transition: opacity .7s 1.5s, transform .7s 1.5s; }
.am-reveal.on .am-rv-band, .am-reveal.on .am-rv-age-k { opacity: 1; }
.am-reveal.on .am-rv-age { opacity: 1; transform: none; }
/* The reveal shows the big numbers, so the cards below keep only their explanations */
body.app-mode #age-range, body.app-mode #score-card > .result-big { display: none; }
body.app-mode #results-summary .res-left > *:not(.am-reveal):not(.nha-card), body.app-mode #results-summary .res-right { animation: amUp .6s cubic-bezier(.2,.8,.2,1) both; animation-delay: 1.9s; }

@media (prefers-reduced-motion: reduce) {
  .am-bg i, body.app-mode .card:not(.hidden), .am-intro:not(.hidden) > *, body.app-mode #results-summary .res-col > * { animation: none !important; }
  .am-rv-fg, .am-ring-fg, .am-rv-band, .am-rv-age, .am-rv-age-k { transition: none !important; }
}

/* Results on a computer: two columns instead of one long phone column. Phones keep the single column. */
@media (min-width: 980px) {
  body.app-mode .app { max-width: 1120px; }
  body.app-mode .card:not(#screen-results):not(.me-card) { max-width: 760px; margin-left: auto; margin-right: auto; }
  body.app-mode #screen-results { padding: 40px 48px 36px; }
  body.app-mode #results-summary { display: grid; grid-template-columns: minmax(0, 5fr) minmax(0, 6fr); gap: 0 48px; align-items: start; }
  body.app-mode .res-right > .results-heading:first-child { margin-top: 0; padding-top: 0; border-top: 0; }
  /* Raphael 2026-11-12: text felt too small on a computer. The reading screens (welcome and About you) scale up as a whole.
     Task screens are left alone on purpose, so the timed tasks keep the same size as before and sittings stay comparable. */
  body.app-mode #screen-welcome, body.app-mode #screen-about { zoom: 1.1; }
}
@media (min-width: 980px) and (min-height: 820px) {
  body.app-mode #screen-welcome, body.app-mode #screen-about { zoom: 1.2; }
}

/* Share my score (share.js) */
.am-share { display: inline-flex; align-items: center; gap: 10px; margin-top: 18px; padding: 12px 22px; border-radius: 999px; background: #41412E; color: #F0E8D9; opacity: 0; transition: opacity .7s 2.1s; }
.am-share:hover { background: #1B1B1A; }
.am-share:disabled { opacity: .7; }
.am-reveal.on .am-share { opacity: 1; }

/* Text alignment, one rule for every reading screen (Raphael 2026-11-12: "no harmony").
   Centered: only the kicker and the screen title at the top, the buttons, and short one line links and notes under them.
   Left aligned: everything that is read as text (the intro paragraph, list headings and lists, field labels, fields,
   consent rows, result cards), all inside one centered reading column so every block shares the same left edge.
   The timed task screens (#screen-task) are not touched. */
body.app-mode #screen-welcome > *, body.app-mode #screen-about > * { max-width: 600px; margin-left: auto; margin-right: auto; }
body.app-mode #screen-welcome > p:not(.am-kicker):not(.results-sub), body.app-mode #screen-about > p:not(.am-kicker):not(.results-sub) { text-align: left; }
body.app-mode #screen-welcome .results-sub, body.app-mode #screen-about .results-sub { text-align: center; }
/* About you: the age field reads like the email field, and each consent row is a checkbox with left aligned text
   on the same left edge as the labels and fields, the box level with the first line. */
body.app-mode #about-age { font-family: var(--font-body); font-size: 18px; letter-spacing: normal; text-align: left; }
body.app-mode #screen-about .consent { text-align: left; align-items: flex-start; }
body.app-mode #screen-about .consent input { margin: 2px 0 0; }
body.app-mode #save-status { text-align: center; }

/* Partial result note (norms prov-2): under the band in the reveal and in the score card. */
.am-rv-partial { font-family: var(--font-body); font-size: 14px; line-height: 1.5; color: var(--accent); max-width: 420px; margin: -8px auto 16px; opacity: 0; transition: opacity .6s 1s; }
.am-reveal.on .am-rv-partial { opacity: 1; }
/* NeuroHaven Age result card (Raphael 2026-11-17 mockup). Brand colors and fonts only. Shown for a full sitting;
   the score ring reveal above stays for a partial sitting. */
.nha-card { position: relative; background: radial-gradient(120% 90% at 70% 0%, #41412E 0%, #1B1B1A 72%); color: var(--cream);
  border-radius: 24px; padding: 28px 24px 22px; margin: 0 0 18px; text-align: left; box-shadow: 0 30px 60px -30px rgba(27,27,26,0.55); }
.nha-card:not(.hidden) { animation: amUp .7s cubic-bezier(.2,.8,.2,1) both; }
.nha-card p { margin: 0; }
.nha-eyebrow { font-family: var(--font-body); font-size: 11px; letter-spacing: 0.22em; text-transform: uppercase; color: var(--sand); }
.nha-age { font-family: var(--font-headline); font-size: clamp(84px, 24vw, 128px); line-height: 1; letter-spacing: -0.02em; margin: 14px 0 8px !important; color: var(--cream); }
.nha-age sup { font-size: 0.32em; vertical-align: top; position: relative; top: 0.3em; margin-left: 4px; color: var(--sage); }
.nha-range { font-family: var(--font-subtitle); font-size: 15px; line-height: 1.45; color: rgba(240,232,217,0.82); }
.nha-range b { color: var(--cream); font-weight: 500; }
.nha-pill { display: inline-block; margin-top: 14px; font-family: var(--font-body); font-size: 11px; letter-spacing: 0.12em; text-transform: uppercase;
  border: 1px solid rgba(240,232,217,0.35); border-radius: 999px; padding: 6px 12px; color: var(--cream); }
.nha-vs { display: flex; gap: 12px; margin: 22px 0 18px; }
.nha-vs > div { flex: 1; min-width: 0; background: rgba(240,232,217,0.07); border: 1px solid rgba(240,232,217,0.12); border-radius: 16px; padding: 12px 14px; }
.nha-vs small { display: block; font-family: var(--font-body); font-size: 10px; letter-spacing: 0.16em; text-transform: uppercase; color: var(--sand); margin-bottom: 4px; }
.nha-vs strong { font-family: var(--font-body); font-weight: 500; font-size: 19px; line-height: 1.25; color: var(--cream); }
.nha-skills { border-top: 1px solid rgba(240,232,217,0.14); padding-top: 12px; }
.nha-sk { display: grid; grid-template-columns: minmax(0, 9fr) minmax(0, 7fr) auto; align-items: center; gap: 12px; margin: 10px 0; }
.nha-sk-name { font-family: var(--font-subtitle); font-size: 14px; color: var(--cream); }
.nha-bar { position: relative; height: 6px; border-radius: 9px; background: rgba(240,232,217,0.14); }
.nha-bar i { position: absolute; left: 0; top: 0; bottom: 0; border-radius: 9px; background: var(--sage); }
.nha-sk em { font-style: normal; font-family: var(--font-body); font-size: 10px; letter-spacing: 0.1em; text-transform: uppercase; color: var(--sand); text-align: right; min-width: 74px; }
.nha-score { display: flex; flex-wrap: wrap; align-items: baseline; gap: 6px 12px; margin-top: 14px; padding-top: 12px; border-top: 1px solid rgba(240,232,217,0.14); }
.nha-score-k { font-family: var(--font-body); font-size: 10px; letter-spacing: 0.16em; text-transform: uppercase; color: var(--sand); }
.nha-score-v { font-family: var(--font-subtitle); font-size: 13px; color: rgba(240,232,217,0.75); }
.nha-score-v b { font-family: var(--font-body); font-weight: 500; font-size: 17px; color: var(--cream); }
.nha-score-band { font-family: var(--font-subtitle); font-size: 13px; color: var(--sage); }
.nha-skills-note { margin: 2px 0 0 !important; font-family: var(--font-subtitle); font-size: 12px; line-height: 1.45; color: rgba(240,232,217,0.68); }
.nha-actions:empty { display: none; }
.nha-card .am-share { opacity: 1; transition: none; background: transparent; border: 1px solid rgba(240,232,217,0.4); color: var(--cream); }
.nha-card .am-share:hover { background: rgba(240,232,217,0.08); }
.nha-foot { margin-top: 18px !important; font-family: var(--font-subtitle); font-size: 11.5px; line-height: 1.5; color: rgba(240,232,217,0.68); }
/* Phones: name and level on one line, the bar full width under them */
@media (max-width: 560px) {
  .nha-sk { grid-template-columns: minmax(0, 1fr) auto; grid-template-areas: "n l" "b b"; gap: 6px 10px; margin: 12px 0; }
  .nha-sk-name { grid-area: n; } .nha-sk em { grid-area: l; min-width: 0; } .nha-bar { grid-area: b; }
  .nha-card { padding: 24px 20px 20px; }
}

/* NeuroHaven Age FAQ: open by default, under the results */
.nha-faq { margin: 30px 0 6px; text-align: left; }
.nha-faq-title { font-family: var(--font-headline); font-weight: 500; font-size: clamp(22px, 5.5vw, 30px); line-height: 1.2; letter-spacing: 0.01em; color: var(--accent); margin: 0 0 18px; text-transform: none; }
.nha-faq details { border: 1px solid var(--sand); border-radius: 18px; padding: 16px 20px; margin: 0 0 12px; background: rgba(215,199,169,0.18); }
.nha-faq summary { font-family: var(--font-body); font-weight: 500; font-size: 16px; line-height: 1.4; color: var(--ink); cursor: pointer; list-style: none; display: flex; flex-wrap: wrap; align-items: center; gap: 6px 8px; padding-right: 22px; position: relative; }
.nha-faq summary::-webkit-details-marker { display: none; }
.nha-faq summary::after { content: "+"; position: absolute; right: 0; top: 0; color: var(--sage); }
.nha-faq details[open] summary::after { content: "\2212"; }
.nha-faq details p, .nha-faq details li { font-family: var(--font-subtitle); font-size: 15px; line-height: 1.6; color: var(--accent); }
.nha-faq details p { margin: 12px 0 0; }
.nha-faq details ul { padding-left: 18px; margin: 10px 0 0; }
.nha-faq details li { margin: 0 0 6px; }
.nha-faq b { color: var(--ink); font-weight: 600; }
.nha-faq .nha-prec { background: var(--accent); border-color: var(--accent); }
.nha-faq .nha-prec summary, .nha-faq .nha-prec b { color: var(--cream); }
.nha-faq .nha-prec p { color: rgba(240,232,217,0.85); }
.nha-tag { font-family: var(--font-body); font-weight: 400; font-size: 10px; letter-spacing: 0.16em; text-transform: uppercase; background: var(--sage); color: var(--ink); border-radius: 999px; padding: 3px 9px; white-space: nowrap; }
.nha-prec-btn { display: inline-block; margin-top: 16px; background: var(--cream) !important; color: var(--ink) !important; text-decoration: none; }
.nha-prec-btn:hover { background: var(--sand) !important; }
@media (min-width: 980px) {
  body.app-mode .nha-faq { max-width: 760px; margin: 40px auto 6px; }
}

@media (prefers-reduced-motion: reduce) { .nha-card:not(.hidden) { animation: none !important; } }

/* Share my NeuroHaven Age™ picker (share.js, Raphael 2026-11-17): a sheet from the bottom on phones, a centred panel on
   computers. Two image previews to pick from, the real age box (off by default), one Share button. */
.share-sheet { padding: 0; border: 0; background: transparent; max-width: 100vw; max-height: 100dvh; width: 100%; margin: auto auto 0; color: var(--ink); }
.share-sheet::backdrop { background: rgba(27,27,26,0.62); backdrop-filter: blur(4px); -webkit-backdrop-filter: blur(4px); }
.share-sheet[open] .share-panel { animation: shareUp .35s cubic-bezier(.2,.8,.2,1) both; }
@keyframes shareUp { from { transform: translateY(40px); opacity: 0; } }
.share-panel { background: #F0E8D9; border-radius: 26px 26px 0 0; padding: 18px 18px calc(18px + env(safe-area-inset-bottom)); max-width: 520px; margin: 0 auto;
  box-shadow: 0 -20px 60px -30px rgba(27,27,26,0.7); }
.share-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 14px; }
.share-title { font-family: var(--font-headline); font-weight: 500; font-size: 18px; letter-spacing: 0.01em; text-transform: none; color: var(--accent); margin: 0; }
.share-x { display: inline-flex; align-items: center; justify-content: center; width: 44px; height: 44px; border-radius: 50%; border: 0; background: rgba(65,65,46,0.08); color: var(--accent); cursor: pointer; }
.share-x:hover { background: rgba(65,65,46,0.15); }
.share-x:focus-visible, .share-go:focus-visible, .share-real input:focus-visible { outline: 3px solid var(--tan); outline-offset: 2px; }
.share-styles { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; border: 0; margin: 0; padding: 0; min-width: 0; }
.share-sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.share-opt { position: relative; display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 10px 10px 12px; border-radius: 18px;
  border: 2px solid rgba(65,65,46,0.15); background: rgba(215,199,169,0.25); cursor: pointer; text-align: center; }
.share-opt input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.share-opt:has(input:checked) { border-color: var(--accent); background: rgba(215,199,169,0.55); }
.share-opt:has(input:focus-visible) { outline: 3px solid var(--tan); outline-offset: 2px; }
.share-thumb { display: flex; align-items: center; justify-content: center; width: 100%; height: 210px; margin-bottom: 8px; }
.share-thumb img { display: block; max-width: 100%; max-height: 100%; width: auto; height: auto; border-radius: 10px; box-shadow: 0 10px 24px -14px rgba(27,27,26,0.6); background: rgba(65,65,46,0.12); }
.share-thumb-story img { aspect-ratio: 1080 / 1920; height: 100%; }
.share-thumb-post img { aspect-ratio: 1080 / 1350; height: 100%; }
.share-sheet.is-loading .share-thumb img { opacity: 0.35; }
.share-opt-name { font-family: var(--font-body); font-weight: 500; font-size: 15px; color: var(--ink); }
.share-opt-sub { font-family: var(--font-subtitle); font-size: 12.5px; color: rgba(27,27,26,0.65); }
.share-real { display: flex; align-items: center; gap: 10px; margin: 16px 2px 14px; font-family: var(--font-subtitle); font-size: 15px; color: var(--ink); cursor: pointer; min-height: 44px; }
.share-real input { width: 20px; height: 20px; accent-color: #41412E; margin: 0; }
.share-go { display: block; width: 100%; border-radius: 999px; background: #41412E; color: #F0E8D9; padding: 14px 22px; }
.share-go:hover { background: #1B1B1A; }
.share-go:disabled { opacity: .6; }
@media (min-width: 640px) {
  .share-sheet { margin: auto; }
  .share-panel { border-radius: 26px; padding: 22px 22px 22px; }
  .share-thumb { height: 260px; }
}
@media (prefers-reduced-motion: reduce) { .share-sheet[open] .share-panel { animation: none; } }
/* Learn more link in the asterisk note (Raphael 2026-11-17) */
#nha-card .nha-foot a.nha-learn, .me-nha-card .nha-foot a.nha-learn { color: var(--cream) !important; text-decoration: underline; text-underline-offset: 2px; white-space: nowrap; }
