/* Shared app finish: one typeface, shallow glass, stable touch targets. */
@font-face {
  font-family: 'TildaSans';
  src: url('../assets/fonts/TildaSans-VF.woff2') format('woff2');
  font-style: normal;
  font-weight: 250 1000;
  font-display: swap;
}

:root {
  --app-font: 'TildaSans', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --polish-glass: linear-gradient(140deg, rgba(255,255,255,.085), rgba(255,255,255,.025));
  --polish-selected: linear-gradient(140deg, rgba(255,255,255,.2), rgba(255,255,255,.08));
  --polish-border: rgba(255,255,255,.2);
  --polish-shadow: inset 0 1px rgba(255,255,255,.12), 0 10px 30px rgba(0,0,0,.22);
}

html { scroll-padding-block: 24px 104px; }
body, button, input, select, textarea { font-family: var(--app-font); }
button, a, input, select, textarea { -webkit-tap-highlight-color: transparent; touch-action: manipulation; }
[hidden] { display: none !important; }
button:disabled { opacity: .42; cursor: not-allowed; }
button:focus-visible, a:focus-visible, input:focus-visible, select:focus-visible {
  outline: 2px solid #f8f6f0 !important;
  outline-offset: 4px;
}
.launch-tool { text-decoration: none; }
body:has(#app .back-btn) .suite-home { display: none !important; }
.launch-tool:focus-visible { outline-offset: 5px; }
.launch-screen--staggered .launch-tool {
  background: linear-gradient(140deg, rgba(255,255,255,.07), rgba(255,255,255,.015));
  -webkit-backdrop-filter: blur(6px);
  backdrop-filter: blur(6px);
}
.launch-screen--staggered .launch-tool > span:last-child { color: rgba(255,255,255,.78); }
@media (min-width: 721px) and (orientation: portrait) {
  .launch-screen--staggered .launch-tool:last-child {
    top: min(64svh, calc(100svh - 360px));
  }
}

body:not(.has-launch-screen) .sec { padding-block: clamp(32px, 5vw, 68px); }
body:not(.has-launch-screen) .tests-section { min-height: 0; }
body:not(.has-launch-screen) :is(.sec,.sec-w)::before,
body:not(.has-launch-screen) :is(.sec,.sec-w)::after { display: none !important; }
body:not(.has-launch-screen) .sec-hd-row { gap: 20px; margin-bottom: 24px; }
body:not(.has-launch-screen) .sec-title { font-size: clamp(32px, 4.5vw, 56px); line-height: 1.05; }
body:not(.has-launch-screen) .sec-tag { margin-bottom: 10px; }
body:not(.has-launch-screen) .sec-desc { font-size: 17px; line-height: 1.45; }
.calculator-promise ul { gap: 7px; }
body:not(.has-launch-screen) .calculator-promise li { color: rgba(248,246,240,.76); font-weight: 450; }
body:not(.has-launch-screen) .ecosystem-tools--single { grid-template-columns: 1fr; }
body:not(.has-launch-screen) .ecosystem-tool-card { min-height: 0; padding: clamp(20px,3vw,32px); }
body:not(.has-launch-screen) .ecosystem-tool-card p { min-height: 0; margin-bottom: 20px; }
body:not(.has-launch-screen) .ecosystem-tool-card,
body:not(.has-launch-screen) .games-focus .app-card {
  background: var(--polish-glass) !important;
  border-color: var(--polish-border) !important;
  box-shadow: var(--polish-shadow) !important;
  -webkit-backdrop-filter: blur(8px);
  backdrop-filter: blur(8px);
}
body:not(.has-launch-screen) .ecosystem-tool-action {
  min-height: 58px;
  font-size: 18px;
  background: var(--polish-selected) !important;
  border-color: rgba(255,255,255,.36) !important;
  box-shadow: var(--polish-shadow) !important;
}
body:not(.has-launch-screen) .ecosystem-tool-action span:last-child {
  width: 34px; height: 34px; flex-basis: 34px; font-size: 26px;
  background: rgba(255,255,255,.12) !important; color: #fff !important;
}
body:not(.has-launch-screen) .app-dock :is(button,a) {
  border: 1px solid transparent !important;
  color: rgba(250,250,250,.72) !important;
  background: transparent !important;
  box-shadow: none !important;
  -webkit-backdrop-filter: none; backdrop-filter: none;
  text-decoration: none;
}
body:not(.has-launch-screen) .app-dock :is(button,a)[aria-current='page'] {
  color: #fff !important; border-color: rgba(255,255,255,.26) !important;
  background: var(--polish-selected) !important;
}
.app-dock :is(button,a) img { filter: brightness(0) invert(1) !important; }
@media (min-width: 721px) and (orientation: portrait) {
  body:not(.has-launch-screen) .app-dock { width: min(calc(100% - 48px), 760px); padding: 10px; }
  body:not(.has-launch-screen) .app-dock :is(button,a) { min-height: 80px; font-size: 18px; }
  .app-dock :is(button,a) :is(svg,img) { width: 30px; height: 30px; }
}
body:not(.has-launch-screen) .trainer-filter {
  display: flex !important; flex-wrap: wrap; gap: 6px !important;
  padding: 6px; border-radius: 22px !important;
  -webkit-backdrop-filter: blur(10px); backdrop-filter: blur(10px);
}
body:not(.has-launch-screen) .trainer-filter__button {
  flex: 1 1 auto; width: auto; min-height: 44px;
  padding: 9px 12px !important; border-radius: 16px;
  font-size: 14px; gap: 7px;
  background: transparent !important; box-shadow: none !important;
  border-color: transparent !important;
  -webkit-backdrop-filter: none; backdrop-filter: none;
}
body:not(.has-launch-screen) .trainer-filter__button[aria-selected='true'] {
  background: var(--polish-selected) !important;
  border-color: var(--polish-border) !important;
}
.trainer-filter__button svg { width: 19px; height: 19px; }

html[data-trainer-theme] .word-display {
  box-shadow: var(--polish-shadow);
}
html[data-trainer-theme] .word-display:not(.flash-correct):not(.flash-wrong):not(.flash-timeout) {
  border-color: var(--polish-border);
  background: var(--polish-glass);
}
html[data-trainer-theme] .level-card.active-level {
  border-color: rgba(255,255,255,.4);
  box-shadow: var(--polish-shadow);
  background: var(--polish-selected);
}
html[data-trainer-theme] .text-box {
  border-color: var(--polish-border);
  background: var(--polish-glass);
  box-shadow: var(--polish-shadow);
}
html[data-trainer-theme] .text-box:is(:focus,.focused) {
  border-color: rgba(255,255,255,.5);
  box-shadow: 0 0 0 2px rgba(255,255,255,.1), var(--polish-shadow);
}
html[data-trainer-theme] .text-box .ch:not(.correct):not(.wrong) { color: rgba(248,246,240,.8); }
html[data-trainer-theme] .text-box .ch.current-word { background: rgba(255,255,255,.07); }
html[data-trainer-theme] .session-screen {
  background: radial-gradient(ellipse at 50% 40%, rgba(255,255,255,.055), transparent 65%);
}
html[data-trainer-theme] :is(.sess-btn,.start-btn) {
  color: #f8f6f0;
  background: var(--polish-glass);
  border: 1px solid var(--polish-border);
  box-shadow: var(--polish-shadow);
}
html[data-trainer-theme] :is(.sess-btn.primary,.start-btn) {
  background: var(--polish-selected);
  border-color: rgba(255,255,255,.35);
}
html[data-trainer-theme] .sess-btn.exit { color: rgba(248,246,240,.8); }
html[data-trainer-theme] :is(.session-roundinfo,.cycles-duration,.cycles-label) { color: rgba(248,246,240,.7); }
html[data-trainer-theme] .session-phase { color: #f8f6f0; }
.training-brain-visual { content-visibility: auto; }

/* Blur belongs to the outer surface, not each button nested inside it. */
.cognitive-dialog--glass :is(.cognitive-answer,.cognitive-mode-grid button,.cognitive-back,
  .cognitive-restart,.cognitive-close-result,.cognitive-explanation-open,.cognitive-formula-metric,
  .cognitive-zone,.cognitive-guidance-card,.cognitive-practical-answers article) {
  -webkit-backdrop-filter: none !important; backdrop-filter: none !important;
  box-shadow: var(--polish-shadow) !important;
}
.cognitive-dialog--glass .cognitive-panel { -webkit-backdrop-filter: blur(8px); backdrop-filter: blur(8px); }
.cognitive-dialog--glass .cognitive-mode-grid button { min-height: 68px; }
.cognitive-dialog--glass .cognitive-rhomb { width: min(700px, 86%); }
.cognitive-dialog--glass .cognitive-rhomb-node small { font-size: 10px; }
.cognitive-dialog--glass .cognitive-map { -webkit-backdrop-filter: blur(8px); backdrop-filter: blur(8px); }

html[data-trainer-theme] body { font-family: var(--app-font); }
html[data-trainer-theme] :is(h1,h2,h3,.hero__title,.home-title,.metric__value,.stat-card__value,
  .game__stat-value,.result__big,.maze-bar__label,.maze-bar__num) {
  font-family: var(--app-font) !important;
  font-variant-numeric: tabular-nums;
}
html[data-trainer-theme] :is(.hero__title,.home-title,.intro-copy h1,.result__title) {
  color: #faf9f6 !important; background: none !important;
  -webkit-text-fill-color: currentColor !important; text-shadow: none !important;
  letter-spacing: -.04em; line-height: 1.07;
}
html[data-trainer-theme] :is(.hero__subtitle,.intro-copy > p,.home-quote,.card__text) {
  color: rgba(245,243,237,.76) !important;
}
html[data-trainer-theme] :is(.suite-header,.trainer-header) {
  min-height: 64px; padding-block: 6px; margin-top: max(10px,env(safe-area-inset-top));
  background: var(--polish-glass) !important;
  box-shadow: var(--polish-shadow) !important;
  -webkit-backdrop-filter: blur(10px) !important; backdrop-filter: blur(10px) !important;
}
html[data-trainer-theme] :is(.card,.glass-panel,.setup-panel,.reading-card,.result__card,.stat-card,.how-panel) {
  background: var(--polish-glass) !important;
  border-color: var(--polish-border) !important;
  box-shadow: var(--polish-shadow) !important;
  -webkit-backdrop-filter: blur(8px) !important; backdrop-filter: blur(8px) !important;
}
html[data-trainer-theme] :is(.btn,.button,.dur-btn,.btn-answer,.diff-opt > span,.level-card,
  .icon-button,.joy-btn,.number-pad button,.pace-selector label,.suite-home,.header__back,input,select,textarea) {
  -webkit-backdrop-filter: none !important; backdrop-filter: none !important;
  box-shadow: inset 0 1px rgba(255,255,255,.1), 0 4px 14px rgba(0,0,0,.16) !important;
}
html[data-trainer-theme] :is(.btn.primary,.btn--primary,.button--primary,.button.primary,.start-btn,.cta-button) {
  min-height: 52px; color: #fff !important;
  border: 1px solid rgba(255,255,255,.36) !important;
  background: var(--polish-selected) !important;
}
html[data-trainer-theme] :is(.btn,.button,.dur-btn,.btn-answer,.level-card) { border-radius: 18px; }
html[data-trainer-theme] :is(.btn,.button,.dur-btn,.btn-answer,.icon-button):disabled { opacity: .42; }
html[data-trainer-theme] :is(.header__back,.suite-home) { border-radius: 50%; flex-shrink: 0; }
.ecosystem-icon { fill: none !important; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.motion-mode-static .motion-background__aurora { animation: none !important; filter: none !important; }
.motion-mode-static .motion-background__fallback-stars { transition: none; opacity: .38; }
.number-display,.number-pad,.maze-bar__num,.game__stat-value { font-variant-numeric: tabular-nums; }

@media (max-width: 720px) {
  body:not(.has-launch-screen) .wrap { width: calc(100% - 32px); padding-inline: 0; }
  body:not(.has-launch-screen) :is(.sec,.sec-w) { padding-inline: 0; }
  body:not(.has-launch-screen) .sec { padding-block: 28px; }
  body:not(.has-launch-screen) .sec-hd-row { gap: 14px; margin-bottom: 20px; }
  body:not(.has-launch-screen) .sec-title { font-size: clamp(30px,8.2vw,38px); }
  body:not(.has-launch-screen) .calculator-promise { font-size: 15px; line-height: 1.35; }
  .calculator-promise p { margin-bottom: 6px; }
  .calculator-promise ul { gap: 4px; }
  body:not(.has-launch-screen) .ecosystem-tool-card { padding: 18px; gap: 16px; }
  body:not(.has-launch-screen) .ecosystem-tool-card h3 { font-size: 25px; margin-block: 8px 10px; }
  body:not(.has-launch-screen) .ecosystem-tool-card p { font-size: 15px; margin-bottom: 16px; }
  .tool-calculator-media { max-height: 170px; }
  body:not(.has-launch-screen) .ecosystem-tool-action { font-size: 16px; gap: 8px; padding: 10px 12px 10px 16px; }
  body:not(.has-launch-screen) .app-dock { bottom: max(10px, env(safe-area-inset-bottom)); }
  body:not(.has-launch-screen) .trainer-filter__button { flex-basis: calc(33% - 6px); font-size: 13px; padding-inline: 8px !important; }
  .cognitive-dialog--glass .cognitive-rhomb,
  .cognitive-dialog--glass[data-cognitive-view='question'] .cognitive-rhomb { width: min(340px, 84vw); }
  .cognitive-dialog--glass[data-cognitive-view='question'] .cognitive-workspace {
    grid-template-rows: minmax(218px, 26svh) minmax(0, 1fr);
  }
  .cognitive-dialog--glass[data-cognitive-view='question'] .cognitive-rhomb-node small { font-size: 9px; }
  html[data-trainer-theme] :is(.hero__title,.intro-copy h1) { font-size: clamp(32px,9vw,42px) !important; }
  html[data-trainer-theme] .hero { margin-top: 24px; }
  html[data-trainer-theme] .home { padding-top: 28px; }
  html[data-trainer-theme] .home-hero { margin-bottom: 24px; }
  html[data-trainer-theme] .suite-header .suite-brand { height: 44px; }
  html[data-trainer-theme] :is(input,textarea,select) { font-size: 16px !important; }
}
@media (hover: none) {
  html[data-trainer-theme] :is(.btn,.button,.joy-btn,.number-pad button):hover { transform: none; }
  html[data-trainer-theme] :is(.joy-up,.joy-down):hover { transform: translateX(-50%); }
  html[data-trainer-theme] :is(.joy-left,.joy-right):hover { transform: translateY(-50%); }
  .ecosystem-tool-card:hover,.games-focus .app-card:hover { transform: none; }
}
@media (prefers-reduced-motion: reduce) {
  *,*::before,*::after { scroll-behavior: auto !important; }
  .launch-screen { transition: none; }
}
