/* ui.css: the Sophai design system. One section per piece, each opened by a "== <piece> ==" comment; the list of
   pieces is the index of these sections. Rules (test/ui-css-check.mjs): colours only in the token blocks (:root), weights at most 500
   (600 only on the citation chip), no !important, font-family only through the tokens, no font in data:.
   Read docs/UI.md before adding a piece. Today it holds what the sign-in page (/login) needs and the window "Antes de
   começar" of the student app (/). */

/* == tokens == */
/* Light by default; dark when the system is dark and no light choice is saved, or when dark is saved. */
:root {
  color-scheme: light dark;
  --bg-page: #FAFAFB; --bg-primary: #FFFFFF; --bg-muted: #F2F2F4;
  --text-primary: #111113; --text-body: #3C3C43; --text-secondary: #646470; --text-faint: #9C9CA6;
  --accent: #7B6CF0; --link: #6A5BE0; --link-hover: #5F50D9; --on-accent: #FFFFFF;
  --soft-red-text: #C2413A;
  --hairline: rgba(17,17,19,.08); --edge-raised: rgba(17,17,19,.05);
  --font-body: 'DM Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --font-serif: 'Source Serif 4', Georgia, serif;
  --text-xs: 12px; --text-sm: 13px; --text-md: 14px; --text-base: 15px; --text-input: 16px;
  --r-sm: 8px; --r: 12px; --r-lg: 16px;
  /* glass */
  --gl-read: rgba(255,255,255,.56); --gl-edge-a: rgba(255,255,255,.70); --gl-edge-b: rgba(255,255,255,.15);
  --gl-card: rgba(255,255,255,.5); --gl-card-edge: rgba(255,255,255,.8); --gl-hover: rgba(255,255,255,.6); --gl-press: rgba(255,255,255,.85);
  --isl-sheen: rgba(255,255,255,.9); --ctl-sheen: rgba(255,255,255,.18);
  --card-shadow: inset 0 1px 0 var(--isl-sheen), inset 0 -1px 2px rgba(0,0,0,.04), 0 1px 2px rgba(17,17,19,.05), 0 12px 32px rgba(70,50,160,.12), 0 18px 44px rgba(70,50,160,.16);
  --shadow-raised: 0 1px 2px rgba(17,17,19,.06), 0 4px 12px rgba(17,17,19,.04);
  --mask: #000;
  /* field */
  --field-bg: var(--bg-primary); --field-edge: var(--edge-raised);
  /* the accent's glow on the primary button */
  --accent-glow: 0 6px 18px rgba(123,108,240,.25), 0 1px 2px rgba(123,108,240,.2);
  --accent-glow-hi: 0 8px 22px rgba(123,108,240,.30), 0 1px 2px rgba(123,108,240,.2);
  /* the sign-in page's links: the darker violet keeps 4.5:1 on the glass over the aurora */
  --action-link: var(--link-hover);
  /* errors: the edge, the text (15-20 % of --text-primary keeps 4.5:1 on the glass) and the disc */
  --err-edge: var(--soft-red-text);
  --err-text: color-mix(in srgb, var(--soft-red-text) 80%, var(--text-primary));
  --err-bg: color-mix(in srgb, var(--soft-red-text) 12%, transparent);
  /* aurora (the sign-in page's strength) */
  --aurora-opacity: .52; --aur-blend: normal; --grain-opacity: .08; --dither-opacity: 0;
  --aur-1: radial-gradient(circle, rgba(124,94,232,.55) 0%, rgba(124,94,232,.36) 30%, rgba(124,94,232,.14) 55%, transparent 70%);
  --aur-2: radial-gradient(circle, rgba(128,90,178,.30) 0%, rgba(128,90,178,.2) 30%, rgba(128,90,178,.08) 55%, transparent 70%);
  --aur-3: radial-gradient(circle, rgba(80,92,190,.45) 0%, rgba(80,92,190,.3) 30%, rgba(80,92,190,.12) 55%, transparent 70%);
  --aur-dur: 90s; --aur-travel: 92vh; --br-a: 3.5; --br-t: 1.8;
  --ax: -34.6vw; --ay: 26.4vh;
  /* the dialog: its raised surface, the scrim (solid when transparency is reduced) and its shadows */
  --surface-raised: var(--bg-primary); --surface-raised-edge: var(--edge-raised);
  --scrim: rgba(17,17,19,.32); --scrim-solid: rgba(17,17,19,.5);
  --shadow-soft-lg: 0 18px 44px rgba(17,17,19,.09), 0 2px 4px rgba(17,17,19,.04);
  --shadow-sheet: 0 -12px 40px rgba(17,17,19,.12);
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg-page: #0C0C0F; --bg-primary: #141417; --bg-muted: #202026;
    --text-primary: #F5F5F7; --text-body: #CDCDD5; --text-secondary: #A4A4B0; --text-faint: #5A5A64;
    --accent: #8B7CF6; --link: #8B7CF6; --link-hover: #9D90FF; --on-accent: #111113;
    --soft-red-text: #F08A84;
    --hairline: rgba(255,255,255,.08); --edge-raised: rgba(255,255,255,.07);
    --gl-read: rgba(20,20,24,.56); --gl-edge-a: rgba(255,255,255,.22); --gl-edge-b: rgba(255,255,255,.06);
    --gl-card: rgba(255,255,255,.06); --gl-card-edge: rgba(255,255,255,.1); --gl-hover: rgba(255,255,255,.08); --gl-press: rgba(255,255,255,.13);
    --isl-sheen: rgba(255,255,255,.12); --ctl-sheen: rgba(255,255,255,.14);
    --card-shadow: inset 0 1px 0 var(--isl-sheen), inset 0 -1px 2px rgba(0,0,0,.04), 0 1px 2px rgba(0,0,0,.4), 0 12px 32px rgba(0,0,0,.45);
    --shadow-raised: 0 1px 2px rgba(0,0,0,.45), 0 4px 12px rgba(0,0,0,.28);
    --field-bg: rgba(255,255,255,.06); --field-edge: rgba(255,255,255,.10);
    --accent-glow: 0 6px 20px rgba(139,124,246,.35), 0 1px 2px rgba(0,0,0,.4);
    --accent-glow-hi: 0 8px 22px rgba(139,124,246,.40), 0 1px 2px rgba(0,0,0,.4);
    --action-link: var(--link);
    --err-bg: color-mix(in srgb, var(--soft-red-text) 16%, transparent);
    --aurora-opacity: .85; --aur-blend: screen; --grain-opacity: .10; --dither-opacity: .09;
    --surface-raised: rgba(255,255,255,.10); --surface-raised-edge: rgba(255,255,255,.14);
    --scrim: rgba(0,0,0,.55); --scrim-solid: rgba(0,0,0,.7);
    --shadow-soft-lg: 0 18px 48px rgba(0,0,0,.55), 0 2px 4px rgba(0,0,0,.4);
    --shadow-sheet: 0 -12px 40px rgba(0,0,0,.6);
  }
}
:root[data-theme="light"] { color-scheme: light; }
:root[data-theme="dark"] {
  color-scheme: dark;
  --bg-page: #0C0C0F; --bg-primary: #141417; --bg-muted: #202026;
  --text-primary: #F5F5F7; --text-body: #CDCDD5; --text-secondary: #A4A4B0; --text-faint: #5A5A64;
  --accent: #8B7CF6; --link: #8B7CF6; --link-hover: #9D90FF; --on-accent: #111113;
  --soft-red-text: #F08A84;
  --hairline: rgba(255,255,255,.08); --edge-raised: rgba(255,255,255,.07);
  --gl-read: rgba(20,20,24,.56); --gl-edge-a: rgba(255,255,255,.22); --gl-edge-b: rgba(255,255,255,.06);
  --gl-card: rgba(255,255,255,.06); --gl-card-edge: rgba(255,255,255,.1); --gl-hover: rgba(255,255,255,.08); --gl-press: rgba(255,255,255,.13);
  --isl-sheen: rgba(255,255,255,.12); --ctl-sheen: rgba(255,255,255,.14);
  --card-shadow: inset 0 1px 0 var(--isl-sheen), inset 0 -1px 2px rgba(0,0,0,.04), 0 1px 2px rgba(0,0,0,.4), 0 12px 32px rgba(0,0,0,.45);
  --shadow-raised: 0 1px 2px rgba(0,0,0,.45), 0 4px 12px rgba(0,0,0,.28);
  --field-bg: rgba(255,255,255,.06); --field-edge: rgba(255,255,255,.10);
  --accent-glow: 0 6px 20px rgba(139,124,246,.35), 0 1px 2px rgba(0,0,0,.4);
  --accent-glow-hi: 0 8px 22px rgba(139,124,246,.40), 0 1px 2px rgba(0,0,0,.4);
  --action-link: var(--link);
  --err-bg: color-mix(in srgb, var(--soft-red-text) 16%, transparent);
  --aurora-opacity: .85; --aur-blend: screen; --grain-opacity: .10; --dither-opacity: .09;
  --surface-raised: rgba(255,255,255,.10); --surface-raised-edge: rgba(255,255,255,.14);
  --scrim: rgba(0,0,0,.55); --scrim-solid: rgba(0,0,0,.7);
  --shadow-soft-lg: 0 18px 48px rgba(0,0,0,.55), 0 2px 4px rgba(0,0,0,.4);
  --shadow-sheet: 0 -12px 40px rgba(0,0,0,.6);
}
@media (max-width: 639px) { :root { --ax: -33.5vw; --ay: 10.8vh; } }

/* == fonts == */
/* Self-hosted (OFL, from sophai-brand): no request leaves the app. A changed file gets a new -vN name.
   Declared for 400 to 600, the weights the rules allow: the same faces the student app (/) still declares itself, so
   linking ui.css there never changes how a heavier weight of that page is drawn. */
@font-face { font-family: 'DM Sans'; font-style: normal; font-weight: 400 600; font-display: swap; src: url(/assets/fonts/dmsans-v1.woff2) format('woff2'); }
@font-face { font-family: 'Source Serif 4'; font-style: normal; font-weight: 400 600; font-display: swap; src: url(/assets/fonts/sourceserif4-opsz-v1.woff2) format('woff2'); }

/* == base == */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; min-height: 100vh; background: var(--bg-page); color: var(--text-body); font: 400 var(--text-base)/1.55 var(--font-body); -webkit-font-smoothing: antialiased; }
button, input { font: inherit; color: inherit; }
button { cursor: pointer; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
svg.i { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.5; stroke-linecap: round; stroke-linejoin: round; flex: none; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
[hidden] { display: none; }

/* == aurora == */
/* Three colour blobs behind the content, fixed to the window, with a grain (and, in dark, a fine dither against
   banding). It drifts slowly and breathes; with prefers-reduced-motion it stands still. */
.sky-wrap { position: fixed; inset: 0; z-index: 0; overflow: hidden; pointer-events: none; }
.sky { position: absolute; inset: -10%; opacity: var(--aurora-opacity); filter: blur(46px) saturate(1.15);
  transform: translate3d(var(--ax), var(--ay), 0); animation: aur-drift var(--aur-dur) ease-in-out infinite alternate; will-change: transform; }
.sky i { position: absolute; display: block; border-radius: 50%; mix-blend-mode: var(--aur-blend); }
.sky .b1 { width: 50%; height: 62%; left: 54%; top: -14%; background: var(--aur-1); animation: br1 calc(16s * var(--br-t)) ease-in-out infinite alternate; }
.sky .b2 { width: 40%; height: 50%; left: 68%; top: 8%; background: var(--aur-2); animation: br2 calc(19s * var(--br-t)) ease-in-out infinite alternate; }
.sky .b3 { width: 46%; height: 56%; left: 44%; top: -22%; background: var(--aur-3); animation: br3 calc(17s * var(--br-t)) ease-in-out infinite alternate; }
@keyframes aur-drift { from { transform: translate3d(var(--ax), var(--ay), 0); } to { transform: translate3d(var(--ax), calc(var(--ay) + var(--aur-travel)), 0); } }
@keyframes br1 { 0% { transform: none; } 50% { transform: translate3d(calc(-6% * var(--br-a)), calc(6% * var(--br-a)), 0) scale(calc(1 + .1 * var(--br-a))); } 100% { transform: translate3d(calc(4% * var(--br-a)), calc(8% * var(--br-a)), 0) scale(calc(1 + .04 * var(--br-a))); } }
@keyframes br2 { 0% { transform: none; } 50% { transform: translate3d(calc(-8% * var(--br-a)), calc(-4% * var(--br-a)), 0) scale(calc(1 + .1 * var(--br-a))); } 100% { transform: translate3d(calc(4% * var(--br-a)), calc(-6% * var(--br-a)), 0) scale(calc(1 + .02 * var(--br-a))); } }
@keyframes br3 { 0% { transform: none; } 50% { transform: translate3d(calc(6% * var(--br-a)), calc(5% * var(--br-a)), 0) scale(calc(1 - .05 * var(--br-a))); } 100% { transform: translate3d(calc(-5% * var(--br-a)), calc(3% * var(--br-a)), 0) scale(calc(1 + .08 * var(--br-a))); } }
.sky-wrap::before { content: ""; position: absolute; inset: 0; z-index: 1; pointer-events: none; opacity: var(--dither-opacity); background-size: 96px 96px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='96' height='96'%3E%3Cfilter id='d' color-interpolation-filters='sRGB'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='1.6' numOctaves='1' stitchTiles='stitch'/%3E%3CfeColorMatrix values='.33 .33 .33 0 0  .33 .33 .33 0 0  .33 .33 .33 0 0  0 0 0 0 1'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23d)'/%3E%3C/svg%3E"); }
.sky-wrap::after { content: ""; position: absolute; inset: 0; opacity: var(--grain-opacity); background-size: 200px 200px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='200' height='200'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E"); }
/* the blobs are named as specifically as their own animation rules above, or those would win */
@media (prefers-reduced-motion: reduce) { .sky, .sky .b1, .sky .b2, .sky .b3 { animation: none; } }

/* == glass card == */
/* The glass island over the aurora: a translucent fill, blur 16 with saturate 180 %, a 1 px edge fading from the
   top left, the top sheen and the island's shadow. Without transparency it turns solid. */
.glass-card { position: relative; border-radius: var(--r-lg); background: var(--gl-read);
  -webkit-backdrop-filter: blur(16px) saturate(180%); backdrop-filter: blur(16px) saturate(180%); box-shadow: var(--card-shadow); }
.glass-card::after { content: ""; position: absolute; inset: 0; border-radius: inherit; padding: 1px; pointer-events: none; background: linear-gradient(135deg, var(--gl-edge-a), var(--gl-edge-b));
  -webkit-mask: linear-gradient(var(--mask) 0 0) content-box, linear-gradient(var(--mask) 0 0); -webkit-mask-composite: xor;
  mask: linear-gradient(var(--mask) 0 0) content-box exclude, linear-gradient(var(--mask) 0 0); }
@media (prefers-reduced-transparency: reduce) { .glass-card { background: var(--bg-primary); -webkit-backdrop-filter: none; backdrop-filter: none; box-shadow: inset 0 0 0 1px var(--edge-raised); } .glass-card::after { display: none; } }
@supports not ((backdrop-filter: blur(1px)) or (-webkit-backdrop-filter: blur(1px))) { .glass-card { background: var(--bg-primary); box-shadow: inset 0 0 0 1px var(--edge-raised); } .glass-card::after { display: none; } }

/* == field == */
/* A label of 13/500 above a 48 px box with the field's surface; .error gives a 2 px edge in the error colour. */
.fld { display: flex; flex-direction: column; gap: 8px; }
.fld-l { font: 500 var(--text-sm)/1.3 var(--font-body); color: var(--text-secondary); transition: color .12s ease-out; }
.fld:focus-within .fld-l { color: var(--text-primary); }
.fld-i { width: 100%; height: 48px; padding: 0 16px; border: 0; border-radius: var(--r); background: var(--field-bg); box-shadow: inset 0 0 0 1px var(--field-edge);
  font: 400 var(--text-input)/1.4 var(--font-body); color: var(--text-primary); outline: none; transition: box-shadow .12s ease-out, background-color .12s ease-out; }
.fld-i::placeholder { color: var(--text-body); opacity: .7; }
.fld-i:focus, .fld-i:focus-visible { outline: 2px solid var(--accent); outline-offset: 0; }
@media (hover: hover) { .fld-i:not(.error):hover:not(:disabled) { box-shadow: inset 0 0 0 1px var(--hairline); } }
.fld-i:disabled { opacity: .6; cursor: default; }
.fld-i.error { box-shadow: inset 0 0 0 2px var(--err-edge); }
.fld-i.error:focus, .fld-i.error:focus-visible { outline: 2px solid var(--err-edge); box-shadow: inset 0 0 0 1px var(--field-edge); }
.fld-i.code { font: 500 20px/1.2 var(--font-body); letter-spacing: .1em; font-variant-numeric: tabular-nums; }
.fld-i.code::selection { background: color-mix(in srgb, var(--accent) 25%, transparent); }

/* == buttons == */
/* Primary: 48 px, the link violet with a sheen and a glow. Secondary: the glass key. Action link: text only, a 44 px
   target on touch screens. */
.btn-pri, .btn-sec { display: flex; align-items: center; justify-content: center; width: 100%; height: 48px; margin: 0; padding: 0 16px; border: 0; border-radius: var(--r);
  font: 500 var(--text-base)/1 var(--font-body); }
.btn-pri { background: var(--link); color: var(--on-accent); box-shadow: inset 0 1px 0 var(--ctl-sheen), var(--accent-glow); transition: background-color .15s, box-shadow .15s, transform .1s; }
.btn-pri:hover:not(:disabled) { background: var(--link-hover); box-shadow: inset 0 1px 0 var(--ctl-sheen), var(--accent-glow-hi); }
.btn-pri:active:not(:disabled) { transform: translateY(1px); box-shadow: inset 0 1px 0 var(--ctl-sheen), var(--accent-glow); }
.btn-pri:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; box-shadow: 0 0 0 2px var(--bg-primary), inset 0 1px 0 var(--ctl-sheen), var(--accent-glow); }
.btn-pri:disabled { opacity: .7; cursor: default; }
.btn-sec { background: var(--gl-card); color: var(--text-body); box-shadow: inset 0 0 0 1px var(--gl-card-edge), inset 0 1px 0 var(--ctl-sheen); transition: background-color .15s, box-shadow .15s, color .15s; }
.btn-sec:hover:not(:disabled) { background: var(--gl-hover); box-shadow: inset 0 0 0 1px var(--gl-card-edge), inset 0 1px 0 var(--ctl-sheen), var(--shadow-raised); }
.btn-sec:active:not(:disabled) { background: var(--gl-press); }
.btn-sec:disabled { color: var(--text-secondary); cursor: default; }
.btn-link { align-self: center; min-height: 32px; margin: 0; padding: 0 8px; border: 0; border-radius: var(--r-sm); background: none;
  font: 500 var(--text-md)/1.3 var(--font-body); color: var(--action-link); text-decoration: none; text-underline-offset: 3px; text-decoration-thickness: 1px; transition: color .12s; }
.btn-link:hover:not(:disabled), .btn-link:focus-visible { text-decoration: underline; }
.btn-link:disabled { opacity: .5; cursor: default; }
@media (max-width: 1024px), (pointer: coarse) { .btn-link { min-height: 44px; min-width: 44px; } }

/* == error notice == */
/* A disc with the icon, the first sentence at 500 in the error colour, the rest in --text-body. Empty, it keeps no
   height but stays in the page (role="alert" must be there before the message arrives). */
.err-note { display: grid; grid-template-columns: 28px minmax(0, 1fr); align-items: center; gap: 10px; padding: 10px 14px 10px 10px; border-radius: 14px;
  background: var(--err-bg); box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--err-text) 22%, transparent); }
.err-note:empty { padding: 0; background: none; box-shadow: none; }
.err-note > svg.i { box-sizing: border-box; width: 28px; height: 28px; padding: 6px; border-radius: 50%; stroke-width: 2.5; background: var(--err-bg); color: var(--err-text); }
.err-note > span { font: 400 var(--text-md)/1.4 var(--font-body); color: var(--text-body); overflow-wrap: anywhere; }
.err-note b { font-weight: 500; color: var(--err-text); }

/* == login == */
/* The sign-in page: the glass card centred over the aurora, the wordmark, the two steps (email, then code). */
.lg-wrap { position: relative; z-index: 1; min-height: 100vh; min-height: 100dvh; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 24px; padding: 32px 16px; }
.lg-card { width: min(360px, 100%); padding: 32px; display: flex; flex-direction: column; gap: 32px; overflow-wrap: anywhere; animation: lg-rise .15s ease-out both; }
.lg-card > * { position: relative; z-index: 1; }
@keyframes lg-rise { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
.lg-brand { display: flex; flex-direction: column; align-items: center; text-align: center; }
.lg-wm-h { margin: 4px 0 0; line-height: 0; }
.lg-wm { display: block; width: 160px; height: auto; }
/* the wordmark follows the theme: the light file, or the night one in dark (a saved choice wins over the system) */
.lg-wm-dark { display: none; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .lg-wm-light { display: none; } :root:not([data-theme="light"]) .lg-wm-dark { display: block; } }
:root[data-theme="dark"] .lg-wm-light { display: none; }
:root[data-theme="dark"] .lg-wm-dark { display: block; }
.lg-sub { margin: 19px 0 0; font: 400 var(--text-base)/1.4 var(--font-body); color: var(--text-secondary); }
.err-note:not(:empty) { margin-bottom: 16px; }
.lg-step { display: flex; flex-direction: column; margin: 0; }
.lg-step[hidden] { display: none; }
.lg-step > * + * { margin-top: 16px; }
.lg-step > .btn-pri + .resend-row, .lg-step > .btn-link + .lg-note { margin-top: 8px; }
/* the card that says where the code went */
.lg-sent { display: grid; grid-template-columns: 18px minmax(0, 1fr); column-gap: 12px; align-items: start; padding: 12px 14px; border-radius: var(--r);
  background: color-mix(in srgb, var(--accent) 7%, transparent); }
.lg-sent > svg.i { margin-top: 2px; color: var(--accent); }
.lg-sent-txt { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.lg-to { margin: 0; font: 400 var(--text-base)/1.4 var(--font-body); color: var(--text-primary); overflow-wrap: anywhere; }
.lg-to strong { font-weight: 500; }
.lg-msg { margin: 0; font: 400 var(--text-sm)/1.4 var(--font-body); color: var(--text-body); }
/* Send a new code, with the wait's clock inside the key */
.resend-row { position: relative; }
.resend-wait { position: absolute; right: 16px; top: 50%; transform: translateY(-50%); pointer-events: none; font: 400 var(--text-base)/1 var(--font-body); font-variant-numeric: tabular-nums; color: var(--text-secondary); }
.lg-note { align-self: center; max-width: 296px; margin: 0; font: 400 var(--text-sm)/1.45 var(--font-body); color: var(--text-secondary); text-align: center; }
/* the legal line, under the card over the aurora: 12/400, links underlined lightly in the text's colour (legal links
   are exempt from the 44 px touch rule). --text-body, not --text-secondary: on the light aurora's violet the
   secondary grey gave 4.1:1, under the 4.5:1 the line needs. */
.lg-legal { max-width: 480px; margin: 0; font: 400 var(--text-xs)/1.5 var(--font-body); color: var(--text-body); text-align: center; animation: lg-rise .15s ease-out .06s both; }
.lg-legal a { color: inherit; text-decoration: underline; text-decoration-thickness: 1px; text-underline-offset: 2px; }
@media (max-width: 639px) {
  .lg-wrap { padding: 12vh 16px 32px; justify-content: flex-start; }
  .lg-card { padding: 24px; gap: 24px; }
  .lg-wm { width: 128px; }
  .lg-sub { margin-top: 13px; }
}
@media (prefers-reduced-motion: reduce) { .lg-card, .lg-legal { animation: none; } .lg-card *, .lg-card *::before, .lg-card *::after { transition: none; } }

/* == dialog == */
/* A modal that asks before going on: a scrim (blurred 12) under a solid raised panel, radius 16, padding 24; the glyph
   disc of 40, the title 18/500, the text 15/1.5 in --text-secondary, then the actions on the right: 44 high, radius 10,
   the cancel outlined, the main one filled (grey while disabled). Measures in px, never the size tokens a page may
   redefine. The page makes the rest inert and decides what Escape does. On the phone (< 640) it is a sheet against the
   bottom, the disc and the texts centred, the buttons stacked at 48 with the main one on top. Opening: the scrim fades in
   and the panel rises 8 (24 on the phone); the panel itself never starts transparent, so what it says is legible from
   the first frame.
   .dlg-terms: the Terms window ("Antes de começar"), 440 wide, with no grabber (it cannot be closed); the boxes
   (checkbox) sit between the text and the actions; an error notice (error notice) goes above the boxes, at 14 px. */
.dlg-scrim { position: fixed; inset: 0; z-index: 4500; background: var(--scrim); -webkit-backdrop-filter: blur(12px) saturate(120%); backdrop-filter: blur(12px) saturate(120%);
  animation: dlg-fade .15s ease-out both; }
@media (prefers-reduced-transparency: reduce) { .dlg-scrim { background: var(--scrim-solid); -webkit-backdrop-filter: none; backdrop-filter: none; } }
@supports not ((backdrop-filter: blur(1px)) or (-webkit-backdrop-filter: blur(1px))) { .dlg-scrim { background: var(--scrim-solid); } }
.dlg { position: fixed; inset: 0; z-index: 4600; display: grid; place-items: center; padding: 16px; pointer-events: none; }
.dlg-scrim[hidden], .dlg[hidden] { display: none; }
.dlg-panel { pointer-events: auto; display: flex; flex-direction: column; width: min(400px, 100%); max-height: calc(100vh - 32px); overflow: auto; padding: 24px; border-radius: 16px;
  background: linear-gradient(var(--surface-raised), var(--surface-raised)), var(--bg-primary); box-shadow: var(--shadow-soft-lg), inset 0 0 0 1px var(--surface-raised-edge);
  font: 400 15px/1.5 var(--font-body); color: var(--text-body); overflow-wrap: anywhere; animation: dlg-in .15s ease-out both; }
.dlg-terms { width: min(440px, 100%); }
.dlg-panel > * { margin: 0; }
.dlg-g { display: grid; place-items: center; flex: none; width: 40px; height: 40px; margin: 0 0 16px; border-radius: 50%; background: color-mix(in srgb, var(--accent) 12%, transparent); color: var(--link-hover); }
.dlg-g > svg.i { width: 20px; height: 20px; }
.dlg-panel > .dlg-t { font: 500 18px/1.3 var(--font-body); letter-spacing: -.01em; color: var(--text-primary); text-align: left; }
.dlg-panel > .dlg-d { margin-top: 8px; font: 400 15px/1.5 var(--font-body); color: var(--text-secondary); text-align: left; }
.dlg-d a { color: var(--link); text-decoration: underline; text-underline-offset: 2px; }
.dlg-panel > .cb-row { margin-top: 24px; }
.dlg-panel > .cb-row + .cb-row { margin-top: 8px; }
/* the error notice inside the panel: 14 px (the page may redefine --text-md), and its action, a raised button of 32 */
.dlg-panel > .err-note { margin: 24px 0 0; }
.dlg-panel > .err-note:empty { margin: 0; }
.dlg-panel > .err-note > span { font-size: 14px; }
.dlg-panel .err-act { grid-column: 2; justify-self: start; position: relative; display: inline-flex; align-items: center; height: 32px; margin-top: 6px; padding: 0 12px; border: 0; border-radius: 10px;
  background: var(--surface-raised); box-shadow: inset 0 0 0 1px var(--hairline), var(--shadow-raised); font: 500 14px/1.3 var(--font-body); color: var(--text-primary); transition: background-color .15s; }
.dlg-panel .err-act:hover { background: linear-gradient(color-mix(in srgb, var(--text-primary) 5%, transparent), color-mix(in srgb, var(--text-primary) 5%, transparent)), var(--surface-raised); }
.dlg-panel .err-act::after { content: ""; position: absolute; left: 0; right: 0; top: 50%; height: 44px; transform: translateY(-50%); }
.dlg-acts { margin-top: 24px; display: flex; justify-content: flex-end; gap: 8px; }
.dlg-btn { position: relative; height: 44px; padding: 0 18px; border: 0; border-radius: 10px; font: 500 15px/1.2 var(--font-body); text-align: center;
  transition: background-color .15s, box-shadow .15s, transform .1s; }
.dlg-btn::after { content: ""; position: absolute; left: 50%; top: 50%; width: max(100%, 44px); height: 44px; transform: translate(-50%, -50%); }
.dlg-btn:active:not(:disabled) { transform: translateY(1px); }
.dlg-btn:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.dlg-cancel { background: transparent; box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--text-primary) 16%, transparent); color: var(--text-primary); }
.dlg-cancel:hover { background: color-mix(in srgb, var(--text-primary) 5%, transparent); }
.dlg-ok { background: var(--link); color: var(--on-accent); box-shadow: inset 0 1px 0 var(--ctl-sheen), var(--accent-glow); }
.dlg-ok:hover:not(:disabled) { background: var(--link-hover); }
/* disabled: grey, its text a little darker than --text-secondary so it keeps 4.5:1 on --bg-muted */
.dlg-ok:disabled { background: var(--bg-muted); color: color-mix(in srgb, var(--text-secondary) 80%, var(--text-primary)); box-shadow: none; cursor: default; }
/* dark: the raised surface is lighter, so its links take the lighter violet */
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .dlg-d a { color: var(--link-hover); } }
:root[data-theme="dark"] .dlg-d a { color: var(--link-hover); }
@keyframes dlg-fade { from { opacity: 0; } }
@keyframes dlg-in { from { transform: translateY(8px); } }
@keyframes dlg-up { from { transform: translateY(24px); } }
@media (max-width: 639px) {
  .dlg { place-items: end stretch; padding: 0; }
  .dlg-panel { width: 100%; max-height: 86vh; border-radius: 16px 16px 0 0; padding: 24px 24px max(24px, calc(env(safe-area-inset-bottom) + 16px));
    box-shadow: var(--shadow-sheet), inset 0 1px 0 var(--hairline); animation: dlg-up .2s ease-out both; }
  .dlg-g { margin: 0 auto 16px; }
  .dlg-panel > .dlg-t, .dlg-panel > .dlg-d { text-align: center; }
  .dlg-acts { flex-direction: column-reverse; }
  .dlg-btn { width: 100%; height: 48px; border-radius: 12px; }
}
@media (prefers-reduced-motion: reduce) { .dlg-scrim, .dlg-panel { animation: none; } .dlg-panel *, .dlg-panel *::before, .dlg-panel *::after { transition: none; } }

/* == checkbox == */
/* A row of 56 with the field's surface: a real checkbox, visually hidden, behind a box of 20 (radius 6) that fills with
   the accent when checked, the check popping in; the text 15/1.4. The whole row is the label and carries the focus
   ring. A link inside the text opens its page and leaves the box as it was. Disabled, the box fades to half. */
.cb-row { position: relative; display: grid; grid-template-columns: 20px minmax(0, 1fr); gap: 12px; align-items: center; min-height: 56px; padding: 0 16px; border-radius: 12px;
  background: var(--field-bg); box-shadow: inset 0 0 0 1px var(--field-edge); cursor: pointer; transition: background-color .12s, box-shadow .12s; }
.cb-i { position: absolute; left: 16px; top: 50%; width: 1px; height: 1px; margin: 0; padding: 0; border: 0; opacity: 0; overflow: hidden; clip: rect(0 0 0 0); clip-path: inset(50%); white-space: nowrap; }
.cb { display: grid; place-items: center; width: 20px; height: 20px; border-radius: 6px; background: var(--bg-primary);
  box-shadow: inset 0 0 0 1.5px color-mix(in srgb, var(--text-secondary) 70%, transparent); transition: background-color .15s, box-shadow .15s; }
.cb > svg.i { width: 14px; height: 14px; stroke-width: 2.5; color: var(--on-accent); opacity: 0; transform: scale(.6); transition: opacity .12s, transform .18s cubic-bezier(.3, .8, .3, 1.4); }
.cb-row:has(.cb-i:checked) { background: color-mix(in srgb, var(--accent) 7%, transparent); box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--accent) 40%, transparent); }
.cb-row:has(.cb-i:checked) .cb { background: var(--accent); box-shadow: inset 0 1px 0 var(--ctl-sheen), 0 1px 2px color-mix(in srgb, var(--accent) 35%, transparent); }
.cb-row:has(.cb-i:checked) .cb > svg.i { opacity: 1; transform: none; }
@media (hover: hover) { .cb-row:not(:has(.cb-i:disabled)):not(:has(.cb-i:checked)):hover { background: linear-gradient(color-mix(in srgb, var(--text-primary) 4%, transparent), color-mix(in srgb, var(--text-primary) 4%, transparent)), var(--field-bg); } }
.cb-row:not(:has(.cb-i:disabled)):active { background: linear-gradient(color-mix(in srgb, var(--text-primary) 8%, transparent), color-mix(in srgb, var(--text-primary) 8%, transparent)), var(--field-bg); transition-duration: .1s; }
.cb-row:has(.cb-i:focus-visible) { outline: 2px solid var(--accent); outline-offset: 0; }
.cb-row:has(.cb-i:disabled) { cursor: default; }
.cb-row:has(.cb-i:disabled) .cb { opacity: .5; }
.cb-t { font: 400 15px/1.4 var(--font-body); color: var(--text-primary); }
.cb-t a { position: relative; color: var(--link); text-decoration: underline; text-underline-offset: 2px; }
.cb-t a::after { content: ""; position: absolute; left: 0; right: 0; top: 50%; height: 44px; transform: translateY(-50%); }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .cb-t a { color: var(--text-primary); text-decoration-color: var(--link-hover); } }
:root[data-theme="dark"] .cb-t a { color: var(--text-primary); text-decoration-color: var(--link-hover); }
@media (prefers-reduced-motion: reduce) { .cb-row, .cb, .cb > svg.i { transition: none; } }
