@font-face { font-family: 'GaMath Space'; src: url('assets/fonts/space-regular.ttf') format('truetype'); font-weight: 400 500; font-display: swap; }
@font-face { font-family: 'GaMath Space'; src: url('assets/fonts/space-bold.ttf') format('truetype'); font-weight: 600 800; font-display: swap; }
:root {
  --paper: #edf2ff; --surface: #ffffff; --surface-2: #e1e9fc; --ink: #19244a;
  --muted: #53617f; --navy: #19244a; --navy-2: #22335d; --blue: #3155d9; --blue-dark: #2546b8;
  --line: #ccd7ee; --coral: #ff795d; --accent-ink: #a52e1d; --primary-ink: #19244a;
  --portal-header: #f8faff; --portal-focus: #3155d9; --portal-danger: #b7253d;
  --shadow-sm: 0 6px 20px rgba(25,36,74,.07); --shadow: 0 18px 48px rgba(25,36,74,.12);
  --radius-sm: 10px; --radius: 16px; --radius-lg: 20px;
}
:root[data-theme='dark'] {
  --paper: #0d1526; --surface: #162137; --surface-2: #202e47; --ink: #edf2ff;
  --muted: #b3c2df; --navy: #edf2ff; --navy-2: #dae5ff; --blue: #3d61e3; --blue-dark: #b5c8ff;
  --line: #344563; --coral: #ff9b83; --accent-ink: #ffb29e; --primary-ink: #19244a;
  --portal-header: #101a2e; --portal-focus: #a8beff; --portal-danger: #ff9cab;
  --shadow-sm: 0 6px 20px rgba(0,0,0,.15); --shadow: 0 18px 48px rgba(0,0,0,.22);
}
html { scrollbar-color: var(--muted) var(--paper); }
body.portal-ui { background: var(--paper); color: var(--ink); font-family: 'GaMath Space', system-ui, sans-serif; }
.portal-ui .ambient-grid, .portal-ui .ambient-orbs { display: none; }
.portal-ui ::selection { background: var(--coral); color: #19244a; }
.portal-ui :is(button,a,input,select,textarea,summary):focus-visible { outline: 3px solid var(--portal-focus); outline-offset: 4px; }
.portal-ui :is(input,select,textarea) { caret-color: var(--blue-dark); }
.portal-ui .site-header { min-height: 88px; gap: 24px; background: var(--portal-header); backdrop-filter: none; padding-block: 14px; border-color: var(--line); }
.portal-ui .brand { gap: 7px; flex-shrink: 0; min-height: 44px; }
.brand-identity { display: flex; align-items: center; gap: 8px; }
.brand-symbol { width: 52px; height: 52px; object-fit: contain; flex-shrink: 0; }
.brand-wordmark { display: flex; align-items: flex-start; flex-direction: column; color: var(--ink); font-size: 28px; line-height: 1.05; letter-spacing: -.035em; font-weight: 700; }
.brand-name > span { color: #0067d9; }
.brand-wordmark .brand-product { font-size: 12px; letter-spacing: 0; color: #b83930; font-weight: 700; }
:root[data-theme='dark'] .brand-symbol { background: #f1f6ff; border-radius: 10px; }
:root[data-theme='dark'] .brand-name > span { color: #77b9ff; }
:root[data-theme='dark'] .brand-wordmark .brand-product { color: #ff9b83; }
.portal-ui .main-nav { gap: 4px; }
.portal-ui .nav-link { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 46px; padding: 9px 11px; border-radius: 8px; color: var(--muted); font: 700 14px 'GaMath Space',sans-serif; white-space: nowrap; }
.portal-ui .nav-link:is(:hover,.active) { color: var(--ink); background: var(--surface-2); box-shadow: none; }
.portal-ui .nav-link.active { box-shadow: inset 0 -3px var(--coral); }
.portal-icon { display: inline-block; width: 22px; height: 22px; flex-shrink: 0; vertical-align: middle; }
.nav-icon { display: flex; }
.portal-ui .account-area { gap: 8px; }
.portal-ui .account-button { min-height: 46px; padding: 4px 12px 4px 5px; border-color: var(--line); background: var(--surface); color: var(--ink); box-shadow: none; }
.portal-ui .language-switcher { border: 0; background: transparent; padding: 0; gap: 0; }
.portal-ui .language-switcher > span { display: none; }
.portal-ui .language-option { min-height: 44px; min-width: 40px; border-radius: 8px; font: 700 12px 'GaMath Space',sans-serif; color: var(--muted); padding: 8px; }
.portal-ui .language-option[aria-pressed='true'] { color: var(--ink); background: var(--surface-2); }
.portal-ui .language-option b { font: inherit; }
.portal-ui .flag-icon { width: 16px; height: 11px; }
.theme-toggle { display: inline-flex; align-items: center; justify-content: center; gap: 7px; min-height: 44px; padding: 8px 10px; border: 1px solid var(--line); border-radius: 8px; background: var(--surface); color: var(--ink); font: 700 13px 'GaMath Space',sans-serif; cursor: pointer; }
.theme-toggle:hover { background: var(--surface-2); }
.portal-demo-badge { padding: 4px 7px; font-size: 11px; border: 1px solid var(--line); border-radius: 6px; color: var(--muted); }
.demo-short { display: none; }
.portal-demo-badge[hidden], .portal-home-heading[hidden] { display: none; }
.portal-mobile-language { display: none; }
.portal-ui .page-wrap { width: min(1376px, calc(100% - 64px)); padding-top: 30px; }
.portal-ui .view { animation: portal-enter 220ms cubic-bezier(.23,1,.32,1) both; }
@keyframes portal-enter { from { opacity: .7; transform: translateY(5px); } to { opacity: 1; transform: none; } }
.portal-home-heading { margin: 14px 0 30px; }
.portal-home-heading h1 { margin: 0 0 7px; font-size: clamp(40px,5vw,68px); line-height: 1.08; letter-spacing: -.035em; }
.portal-home-heading p { margin: 0; color: var(--muted); font-size: 22px; }
.portal-ui[data-session='member'] :is(.game-hero,.how-it-works,.join-cta,.new-player-banner),
.portal-ui[data-session='demo'] :is(.game-hero,.how-it-works,.join-cta,.new-player-banner) { display: none; }
.portal-ui:is([data-session='member'],[data-session='demo']) .games-section { margin-top: 0; padding-top: 0; }
.portal-ui:is([data-session='member'],[data-session='demo']) .games-section[data-tab='current'] > .section-heading { display: none; }
.portal-ui:is([data-session='member'],[data-session='demo']) .current-course-picker:not(.math2-activity-picker) > .current-course-copy { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }
.portal-ui .current-course-picker { padding: 0; border: 0; background: transparent; box-shadow: none; }
.portal-ui .current-course-copy { margin-bottom: 22px; }
.portal-ui .current-course-copy h2 { color: var(--ink); font-size: 30px; }
.portal-ui .current-course-copy p { color: var(--muted); }
.portal-ui .challenge-tabs { display: flex; width: fit-content; max-width: 100%; margin: 0 0 24px; padding: 0; gap: 22px; border: 0; border-bottom: 1px solid var(--line); border-radius: 0; background: transparent; }
.portal-ui .challenge-tabs button { min-height: 52px; padding: 12px 8px 15px; font-size: 16px; font-weight: 700; color: var(--muted); border: 0; border-bottom: 4px solid transparent; border-radius: 0; background: transparent; box-shadow: none; }
.portal-ui .challenge-tabs [aria-selected='true'] { color: var(--accent-ink); border-bottom-color: var(--coral); background: transparent; }
.portal-ui .current-course-options { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 22px; }
.portal-ui .current-course-options .course-portal { display: block; position: relative; min-width: 0; min-height: clamp(300px,29vw,420px); padding: 0; overflow: hidden; isolation: isolate; text-align: left; border: 1px solid var(--line); border-radius: 16px; background: #101b35; color: white; box-shadow: none; transform: none; }
.portal-ui .course-portal > img { position: absolute; inset: 0; width: 100%; height: 100%; max-width: none; object-fit: cover; object-position: center; z-index: -2; transition: transform 350ms cubic-bezier(.23,1,.32,1); }
.portal-ui .course-portal::before { content: ''; position: absolute; inset: 0; z-index: -1; background: linear-gradient(90deg,rgba(5,14,35,.84),rgba(5,14,35,.16) 95%); }
.portal-ui .current-course-options .course-portal-copy { display: flex; min-height: inherit; padding: clamp(24px,3vw,40px); flex-direction: column; align-items: flex-start; justify-content: center; gap: 14px; color: white; }
.portal-ui .course-portal .course-name { font-size: 17px; line-height: 1.4; font-weight: 700; color: #fff; }
.portal-ui .course-portal strong { max-width: 13ch; font-size: clamp(29px,3.5vw,49px); line-height: 1.13; letter-spacing: -.03em; color: white; text-wrap: balance; }
.portal-ui .course-portal small { font-size: 14px; color: #ecf2ff; font-weight: 400; }
.portal-ui .course-enter { display: inline-flex; justify-content: center; min-width: 150px; padding: 14px 26px; margin-top: 8px; border-radius: 10px; background: var(--coral); color: #19244a; font-size: 19px; font-weight: 700; }
.portal-ui .course-portal[data-current-course='Matemática 4'] .course-enter { background: #3155d9; color: white; }
@media (hover:hover) and (pointer:fine) { .portal-ui .course-portal:hover > img { transform: scale(1.025); } }
.portal-ui .course-portal:active .course-enter { transform: translateY(1px); }
.portal-ui .current-course-return button, .portal-ui .math2-activity-return button { min-height: 44px; background: var(--surface); color: var(--ink); border-color: var(--line); border-radius: 8px; box-shadow: none; }
.portal-ui .current-course-return > span { color: var(--muted); }
.portal-ui .current-challenge { background: var(--surface-2); border-color: var(--line); }
.portal-ui .current-challenge-heading > span { display: none; }
.portal-ui .current-challenge-heading h2 { color: var(--ink); }
.portal-ui .game-card--archipelago .game-card-body { background: var(--surface); }
.portal-ui .math2-activity-picker .current-course-options button { background: var(--surface); color: var(--ink); border: 1px solid var(--line); box-shadow: none; }
.portal-ui .math2-activity-picker { min-height: 0; align-items: stretch; justify-content: flex-start; gap: 20px; margin-block: 16px 24px; }
.portal-ui .math2-activity-picker .current-course-copy { text-align: left; max-width: none; margin-bottom: 0; }
.portal-ui .continue-section { margin-top: 36px; padding-top: 24px; border-top: 1px solid var(--line); }
.portal-ui .continue-section .eyebrow { display: none; }
.portal-ui .continue-section h2 { font-size: 25px; }
.portal-ui .continue-section .section-heading p { display: none; }
.portal-ui .continue-card { background: var(--surface); border-color: var(--line); box-shadow: none; border-radius: 12px; }
.portal-ui .player-page-heading { margin: 12px 0 30px; }
.portal-ui .player-page-heading h1, .portal-ui .social-page-heading h1 { font-size: clamp(32px,4vw,52px); letter-spacing: -.03em; line-height: 1.1; }
.portal-ui .player-page-heading .eyebrow { display: none; }
.portal-ui .player-page-heading p, .portal-ui .social-page-heading p { font-size: 16px; color: var(--muted); max-width: 60ch; }
.portal-ui .appearance-settings { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 14px; padding: 20px 0; margin-bottom: 24px; border-block: 1px solid var(--line); }
.portal-ui .appearance-settings h2 { margin: 0; font-size: 21px; }
.portal-ui .appearance-settings > div { display: flex; flex-wrap: wrap; gap: 10px; }
.portal-ui .appearance-settings .motion-toggle { display: inline-flex; justify-content: center; gap: 8px; width: auto; min-height: 44px; height: auto; padding: 9px 12px; border-radius: 8px; color: var(--ink); background: var(--surface); }
.portal-ui .appearance-settings .motion-toggle[aria-pressed='true'] { background: var(--surface-2); border-color: var(--muted); }
.portal-ui .panel-card, .portal-ui .profile-player-card { background: var(--surface); border: 1px solid var(--line); border-radius: 14px; box-shadow: none; }
.portal-ui .panel-card :is(p,small), .portal-ui .helper-text, .portal-ui .identity-list dt { color: var(--muted); }
.portal-ui .identity-list dd { color: var(--ink); }
.portal-ui :is(.primary-button,.ghost-button,.light-button,.text-button) { min-height: 44px; border-radius: 9px; box-shadow: none; transform: none; transition: background-color 150ms ease-out,transform 120ms ease-out; }
.portal-ui .primary-button, .portal-ui .light-button { color: var(--primary-ink); background: var(--coral); border: 1px solid transparent; }
.portal-ui .primary-button:hover, .portal-ui .light-button:hover { transform: translateY(-1px); box-shadow: none; }
.portal-ui .ghost-button { color: var(--ink); border: 1px solid var(--line); background: var(--surface); }
.portal-ui .ghost-button:hover { background: var(--surface-2); }
.portal-ui .text-button { color: var(--blue-dark); }
.portal-ui .profile-player-stats strong, .portal-ui .profile-player-copy h2 { color: var(--ink); }
.portal-ui .profile-player-stats span, .portal-ui .profile-player-copy p { color: var(--muted); }
.portal-ui .identity-chip { color: var(--blue-dark); background: var(--surface-2); }
.portal-ui .profile-settings-grid { gap: 20px; }
.portal-ui .player-benefits { gap: 14px; }
.portal-ui .privacy-panel { align-self: start; }
.portal-ui .privacy-panel summary { cursor: pointer; min-height: 44px; font-size: 20px; font-weight: 700; }
.portal-ui .privacy-panel > p { margin: 12px 0; color: var(--muted); }
.portal-ui .social-page-heading { margin: 14px 0 20px; }
.portal-ui .social-page-heading h1 { margin-bottom: 10px; }
.portal-ui .social-demo-notice, .portal-ui .social-session { margin-bottom: 16px; }
.portal-ui .social-demo-notice { padding: 10px 0; font-size: 13px; color: var(--muted); }
.portal-ui .social-session { font-size: 14px; gap: 16px; }
.portal-ui :is([data-view='friends'],.social-profile-inbox) { --social-muted-override: var(--muted); }
.portal-ui .gm-social { --social-accent: var(--coral); --social-danger: var(--portal-danger); }
.portal-ui .gm-social .social-action.primary { color: var(--primary-ink); }
.portal-ui .gm-social h2 { font-size: 23px; }
.portal-ui .gm-social .social-section { padding: 22px 0; margin-top: 10px; }
.portal-ui .gm-social .social-row { padding: 16px 0; }
.portal-ui .gm-social .social-search { padding-top: 6px; border-top: 0; }
.portal-ui .gm-social .social-search > .social-note { font-size: 14px; }
.portal-ui .gm-social .social-row strong { font-size: 17px; }
.portal-ui .social-error { color: var(--portal-danger); }
.portal-ui .social-profile-link { color: var(--blue-dark); }
.portal-ui .social-profile-inbox { padding-top: 20px; }
.portal-ui .gm-social .social-form { margin-block: 12px 20px; }
.portal-ui .gm-social .social-options { position: relative; }
.portal-ui .gm-social .social-options > summary { display: flex; align-items: center; gap: 6px; list-style: none; padding: 10px; min-width: 44px; min-height: 44px; border: 1px solid var(--line); border-radius: 8px; color: var(--ink); background: var(--surface); }
.portal-ui .gm-social .social-options > summary::-webkit-details-marker { display: none; }
.portal-ui .gm-social .social-options[open] { z-index: 4; }
.portal-ui .gm-social .social-options[open] > summary { background: var(--surface-2); }
.portal-ui .gm-social .social-menu { box-shadow: var(--shadow-sm); }
.portal-ui .gm-social .social-options-icon { width: 20px; height: 20px; }
.portal-ui :is(.access-window,.game-detail-window,.modal-window,.onboarding-window,.onboarding-card) { background: var(--surface); color: var(--ink); border-color: var(--line); }
.portal-ui :is(input,select,textarea) { color: var(--ink); background: var(--surface); border-color: var(--line); }
.portal-ui :is(input,textarea)::placeholder { color: var(--muted); opacity: 1; }
.portal-ui .game-card { background: var(--surface); border-color: var(--line); box-shadow: none; }
.portal-ui .game-card:is(:hover,:focus-within) { box-shadow: var(--shadow-sm); }
.portal-ui .game-card h3 { color: var(--ink); }
.portal-ui .game-card .game-meta, .portal-ui .game-card p { color: var(--muted); }
.portal-ui .home-section .section-heading .eyebrow { display: none; }
.portal-ui .hero-copy .hero-brandline, .portal-ui .hero-proof { display: none; }
.portal-ui .game-hero { min-height: 490px; padding-top: 24px; background: var(--surface-2); color: var(--ink); }
.portal-ui .game-hero::before, .portal-ui .game-hero::after { display: none; }
.portal-ui .game-hero h1 { color: var(--ink); }
.portal-ui .game-hero .ghost-button { color: var(--ink); background: var(--surface); border-color: var(--line); }
.portal-ui .game-hero h1 { font-size: clamp(46px,6vw,80px); line-height: 1.02; letter-spacing: -.035em; }
.portal-ui .game-hero .hero-lead { font-size: 18px; color: var(--muted); }
.portal-ui .game-hero .eyebrow { display: none; }
.portal-ui .game-launcher { box-shadow: var(--shadow); border-color: var(--line); background: var(--surface); border-radius: 16px; transform: none; }
.portal-ui .launcher-topbar, .portal-ui .launcher-footer { background: var(--surface-2); color: var(--muted); border-color: var(--line); }
.portal-ui .launcher-game { background: var(--surface); color: var(--ink); border-color: var(--line); }
.portal-ui .how-it-works { border-color: var(--line); }
.portal-ui .how-intro > .eyebrow, .portal-ui .how-steps article > :is(span,i) { display: none; }
.portal-ui .how-steps { gap: 24px; }
.portal-ui .how-steps article { display: block; background: transparent; border: 0; border-radius: 0; box-shadow: none; padding: 0; }
.portal-ui .how-steps article h3 { color: var(--ink); }
.portal-ui .how-steps article p { color: var(--muted); font-size: 16px; }
.portal-ui .category-chip { min-height: 44px; }
.portal-ui .category-chip:is(:hover,.active) { color: #fff; border-color: var(--blue); background: var(--blue); }
.portal-ui .join-cta { background: var(--surface-2); color: var(--ink); border-color: var(--line); border-radius: 16px; }
.portal-ui .join-cta .eyebrow { display: none; }
.portal-ui .join-cta p { color: var(--muted); }
@media (max-width: 1180px) {
  .portal-ui .site-header { grid-template-columns: auto 1fr; gap: 12px; }
  .portal-ui .main-nav { grid-column: 1/-1; grid-row: 2; justify-content: flex-start; }
  .portal-ui .account-area { grid-column: 2; grid-row: 1; }
  .portal-ui .language-option b { display: none; }
}
@media (max-width: 680px) {
  .portal-ui .site-header { position: sticky; gap: 8px; padding: 10px 14px 6px; }
  .brand-symbol { width: 40px; height: 40px; }
  .brand-wordmark { font-size: 21px; gap: 1px; line-height: 1; }
  .brand-wordmark .brand-product { font-size: 10px; }
  .portal-ui .brand { gap: 4px; }
  .portal-ui .account-area { gap: 5px; }
  .portal-ui .language-switcher { display: none; }
  .portal-mobile-language { display: block; }
  .portal-ui .portal-mobile-language select { width: 54px; min-height: 44px; margin: 0; padding: 6px; border: 1px solid var(--line); border-radius: 8px; background: var(--surface); color: var(--ink); font-size: 12px; font-weight: 700; }
  .portal-ui .main-nav { gap: 0; justify-content: space-between; }
  .portal-ui .nav-link { min-width: 0; min-height: 52px; padding: 7px 6px; gap: 5px; flex-direction: column; font-size: 11px; }
  .portal-ui .nav-link .portal-icon { width: 19px; height: 19px; }
  .portal-ui .account-button { padding: 3px; width: 44px; height: 44px; }
  .portal-ui #accountLabel { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }
  .portal-ui .theme-toggle { padding: 8px; gap: 5px; font-size: 12px; }
  .portal-ui .theme-toggle .portal-icon { width: 19px; height: 19px; }
  .brand-identity { gap: 5px; }
  .portal-demo-badge { display: inline-flex; padding: 3px 5px; background: var(--surface-2); }
  .portal-demo-badge .demo-long { display: none; }
  .portal-demo-badge .demo-short { display: inline; }
  .portal-ui .page-wrap { width: calc(100% - 28px); padding-top: 22px; }
  .portal-home-heading { margin: 6px 0 24px; }
  .portal-home-heading h1 { font-size: 40px; }
  .portal-home-heading p { font-size: 18px; }
  .portal-ui .challenge-tabs { width: 100%; gap: 8px; justify-content: space-between; margin-bottom: 20px; }
  .portal-ui .challenge-tabs button { font-size: 13px; padding-inline: 3px; min-height: 48px; }
  .portal-ui .current-course-options { grid-template-columns: 1fr; gap: 18px; }
  .portal-ui .current-course-options .course-portal { min-height: 290px; border-radius: 13px; }
  .portal-ui .current-course-options .course-portal-copy { padding: 25px; gap: 12px; }
  .portal-ui .course-portal strong { font-size: 34px; }
  .portal-ui .course-portal .course-name { font-size: 15px; }
  .portal-ui .course-enter { min-width: 124px; padding: 12px 20px; font-size: 16px; }
  .portal-ui .social-page-heading, .portal-ui .player-page-heading { margin-top: 6px; }
  .portal-ui .social-page-heading h1, .portal-ui .player-page-heading h1 { font-size: 34px; }
  .portal-ui .appearance-settings { align-items: flex-start; flex-direction: column; }
  .portal-ui .gm-social .social-menu { inset-inline-start: 0; inset-inline-end: auto; }
  .portal-ui .gm-social .social-search h2 { font-size: 22px; }
  .portal-ui .social-session { gap: 12px; }
  .portal-ui .game-hero { min-height: auto; padding-top: 12px; }
}
@media (prefers-reduced-motion:reduce) {
  .portal-ui .view { animation: none; }
  .portal-ui .course-portal > img, .portal-ui :is(.primary-button,.ghost-button,.light-button) { transition: none; transform: none; }
}
@media (max-width: 420px) {
  .portal-ui #themeToggle { width: 44px; min-width: 44px; }
  .portal-ui #themeToggle > span { display: none; }
}
.portal-ui.reduce-motion .view { animation: none; }
.portal-ui.reduce-motion .course-portal > img { transition: none; transform: none; }

/* Registration, access, and profile dialogs share the approved portal world. */
.portal-ui .onboarding-window { border-radius: 16px; box-shadow: var(--shadow); }
.portal-ui .access-brand { display: flex; align-items: center; gap: 12px; }
.portal-ui .access-window>.overline { display: none; }
.portal-ui .access-brand>img { width: 54px; height: 54px; object-fit: contain; }
:root[data-theme='dark'] .portal-ui .access-brand>img { background: #f1f6ff; border-radius: 10px; }
.portal-ui .onboarding-brand { gap: 14px; margin-bottom: 24px; }
.portal-ui .onboarding-brand>img { width: 54px; height: 54px; object-fit: contain; }
:root[data-theme='dark'] .portal-ui .onboarding-brand>img { background: #f1f6ff; border-radius: 10px; }
.portal-ui .onboarding-brand span { color: var(--ink); font: 700 18px/1.3 'GaMath Space',sans-serif; letter-spacing: -.02em; }
.portal-ui .onboarding-brand small { color: var(--muted); font: 400 13px/1.4 'GaMath Space',sans-serif; margin-top: 4px; }
.portal-ui .onboarding-progress { font: 500 13px/1.4 'GaMath Space',sans-serif; color: var(--muted); }
.portal-ui .onboarding-progress i { background: var(--line); }
.portal-ui .onboarding-progress i.active { background: var(--blue); }
.portal-ui .onboarding-step>.overline { display: none; }
.portal-ui :is(.avatar-fieldset,.locale-fieldset) legend { color: var(--ink); font: 700 14px/1.4 'GaMath Space',sans-serif; }
.portal-ui .profile-field>span, .portal-ui .profile-field>small, .portal-ui .profile-confirm, .portal-ui .helper-text { color: var(--muted); font-family: 'GaMath Space',sans-serif; }
.portal-ui .profile-field>span>b { font-family: inherit; color: var(--muted); }
.portal-ui :is(.avatar-choice,.profile-locale-option) { background: var(--surface); color: var(--ink); border-color: var(--line); min-height: 44px; }
.portal-ui :is(.avatar-choice.active,.profile-locale-option.active) { border-color: var(--blue); background: var(--surface-2); color: var(--ink); }
.portal-ui .verified-account { border-color: var(--line); background: var(--surface-2); }
.portal-ui .verified-account b { color: var(--ink); }
.portal-ui .verified-account span { color: var(--muted); }
.portal-ui .access-points>span { color: var(--muted); }
@media(max-width:680px) { .portal-ui .onboarding-window { padding: 24px 20px; } .portal-ui .onboarding-brand span { font-size: 17px; } }

/* Current M4 practice uses its own game art; prior exams keep their rankings. */
.cover-mate-nave { position: relative; overflow: hidden; background: #080c1a; }
.cover-mate-nave img { width: 100%; height: 100%; position: absolute; inset: 0; object-fit: cover; }
.cover-mate-nave>span { position: relative; z-index: 1; display: block; padding: 24px; color: #f1f6ff; font: 700 clamp(30px,4vw,54px)/1 'GaMath Space',sans-serif; text-shadow: 0 2px 12px #080c1a; background: linear-gradient(90deg,#080c1acc,transparent); }
@media(max-width:680px) {
  .portal-ui .challenge-tabs { overflow-x: auto; justify-content: start; }
  .portal-ui .challenge-tabs button { flex: 0 0 auto; white-space: nowrap; padding-inline: 8px; }
}

.game-player-window.mate-nave-player:fullscreen .modal-header,.game-player-window.mate-nave-player.pseudo-fullscreen .modal-header{position:relative;top:auto;right:auto;display:flex;justify-content:flex-end;flex-shrink:0;min-height:60px;padding:6px 10px;background:#080c1a;pointer-events:auto}.game-player-window.mate-nave-player:fullscreen #gameFullscreenButton span:last-child,.game-player-window.mate-nave-player.pseudo-fullscreen #gameFullscreenButton span:last-child{position:absolute;width:1px;height:1px;overflow:hidden;clip-path:inset(50%)}

/* Portal actions use named controls rather than decorative link arrows. */
.portal-ui .game-card-cta { min-height:44px; padding:10px 16px; border:1px solid var(--line); border-radius:8px; color:var(--ink); background:var(--surface-2); font:700 14px/1.3 'GaMath Space',sans-serif; text-decoration:none; }
.portal-ui .game-card-cta:hover { background:var(--surface); border-color:var(--muted); }
.portal-ui .launcher-game { grid-template-columns:92px minmax(0,1fr); }
.portal-ui .math2-activity-picker .current-course-options button { grid-template-columns:64px minmax(0,1fr); }

@font-face { font-family:MatePixel; src:url('games/mate-nave-m4/vendor/press-start-2p.ttf') format('truetype'); font-display:swap; }
.portal-ui .mate-landing { display:grid; grid-template-columns:minmax(0,1.5fr) minmax(300px,1fr); min-width:0; overflow:hidden; border:1px solid #304462; border-radius:14px; background:#080c1a; color:#f1f6ff; }
.mate-launch-scene { position:relative; isolation:isolate; display:flex; align-items:flex-end; min-width:0; min-height:510px; }
.mate-launch-art { position:absolute; inset:0; width:100%; height:100%; object-fit:cover; object-position:68% center; z-index:-2; }
.mate-launch-scene::before { content:''; position:absolute; inset:0; z-index:-1; background:linear-gradient(0deg,#080c1af5 0%,#080c1ab8 38%,#080c1a10 90%); }
.mate-launch-copy { padding:clamp(24px,3.5vw,44px); width:100%; }
.mate-launch-copy h2 { margin:0 0 14px; color:#f1f6ff; font:400 clamp(25px,3.2vw,43px)/1.45 MatePixel,monospace; letter-spacing:0; }
.mate-launch-copy h2 em { color:#72e4f1; font-style:normal; }
.mate-launch-copy p { margin:0 0 24px; color:#f1f6ff; font-size:18px; }
.mate-launch-actions { display:flex; flex-wrap:wrap; gap:12px; align-items:stretch; }
.mate-launch-actions :is(button,a) { display:inline-flex; align-items:center; justify-content:center; min-height:54px; padding:14px 22px; border:1px solid #72e4f1; border-radius:8px; font:700 16px/1.4 'GaMath Space',sans-serif; text-decoration:none; cursor:pointer; }
.mate-launch-actions .mate-start { background:#8effa6; border-color:#8effa6; color:#08251b; min-width:160px; }
.mate-launch-actions .mate-start:hover { background:#b7ffc6; }
.mate-launch-actions .mate-challenge { background:#111b31; color:#f1f6ff; }
.mate-launch-actions .mate-challenge:hover { background:#20344d; }
.portal-ui .mate-landing :is(button,a,select):focus-visible { outline:3px solid #72e4f1; outline-offset:4px; }
.portal-ui .mate-landing :is(button,a):active { transform:translateY(1px); }
.portal-ui .mate-landing .m4-classroom-leaderboard { margin:0; padding:clamp(22px,3vw,36px); min-width:0; min-height:0; height:auto; border:0; border-left:1px solid #304462; border-radius:0; background:#111b31; color:#f1f6ff; }
.m4-classroom-leaderboard h3 { margin:0 0 22px; color:#72e4f1; font:400 clamp(14px,1.6vw,19px)/1.7 MatePixel,monospace; }
.m4-classroom-leaderboard [data-classroom-leaderboard] { display:flex; flex-direction:column; gap:16px; }
.m4-classroom-leaderboard .classroom-section { display:grid; gap:8px; font-size:14px; color:#b9c9e0; }
.m4-classroom-leaderboard select { width:100%; min-height:44px; padding:10px; border:1px solid #526b8b; border-radius:6px; background:#080c1a; color:#f1f6ff; font:inherit; }
.m4-classroom-leaderboard .classroom-formats { display:flex; gap:8px; }
.m4-classroom-leaderboard button { min-height:44px; padding:10px 14px; border:1px solid #526b8b; border-radius:6px; background:#111b31; color:#f1f6ff; font:600 14px/1.3 'GaMath Space',sans-serif; }
.m4-classroom-leaderboard button:hover { background:#20344d; }
.m4-classroom-leaderboard button[aria-pressed='true'] { background:#72e4f1; border-color:#72e4f1; color:#080c1a; }
.m4-classroom-leaderboard button:disabled, .m4-classroom-leaderboard button[aria-disabled='true'] { opacity:.65; cursor:wait; }
.m4-classroom-leaderboard .classroom-phase { margin:0; color:#b9c9e0; font-size:14px; line-height:1.6; }
.portal-ui .m4-classroom-leaderboard ol { display:grid; gap:10px; margin:0; padding:0; }
.portal-ui .m4-classroom-leaderboard li { min-width:0; padding:12px 0; background:transparent; border:0; border-bottom:1px solid #304462; border-radius:0; color:#f1f6ff; grid-template-columns:24px minmax(0,1fr) auto; }
.portal-ui .m4-classroom-leaderboard li i { color:#72e4f1; font:700 15px/1.4 'GaMath Space',sans-serif; }
.portal-ui .m4-classroom-leaderboard li :is(strong,b) { color:#f1f6ff; font:700 15px/1.4 'GaMath Space',sans-serif; }
.portal-ui .m4-classroom-leaderboard li small { color:#b9c9e0; font:400 12px/1.5 'GaMath Space',sans-serif; white-space:normal; }
.portal-ui .m4-classroom-leaderboard .leaderboard-empty { padding:0; border:0; color:#b9c9e0; font:400 15px/1.6 'GaMath Space',sans-serif; }
.portal-ui .m4-classroom-leaderboard .current-leaderboard-action { display:flex; justify-content:center; margin:0; min-height:46px; padding:12px 16px; border:1px solid #72e4f1; border-radius:8px; color:#f1f6ff; background:#111b31; font:700 14px/1.4 'GaMath Space',sans-serif; text-decoration:none; }
.portal-ui .m4-classroom-leaderboard .current-leaderboard-action:hover { background:#20344d; }
.portal-ui .m4-classroom-leaderboard .classroom-refresh { align-self:flex-start; border-color:#526b8b; }
@media(max-width:1000px) { .portal-ui .mate-landing { grid-template-columns:1fr; } .mate-launch-scene { min-height:460px; } .portal-ui .mate-landing .m4-classroom-leaderboard { border-left:0; border-top:1px solid #304462; } }
@media(max-width:680px) { .portal-ui .launcher-game { grid-template-columns:72px minmax(0,1fr); } .portal-ui .math2-activity-picker .current-course-options button { grid-template-columns:48px minmax(0,1fr); } .mate-launch-scene { min-height:440px; } .mate-launch-art { object-position:72% center; } .mate-launch-copy { padding:24px 20px; } .mate-launch-copy h2 { font-size:27px; } .mate-launch-copy p { font-size:16px; } .mate-launch-actions { flex-direction:column; } .mate-launch-actions :is(button,a) { width:100%; min-width:0; } }
/* The live game remains mounted while the catalog and ranking refresh. */
.mate-portal-panel[hidden]{display:none}
.mate-portal-panel{display:grid;grid-template-columns:minmax(0,1fr) minmax(280px,340px);gap:28px;align-items:start;margin-top:24px}
.mate-inline-shell{min-width:0;background:#0b1427;color:#eef6ff;border-radius:12px;overflow:hidden}
.mate-inline-toolbar{display:flex;align-items:center;flex-wrap:wrap;gap:12px;padding:14px 18px;background:#111f38}
.mate-inline-toolbar [hidden]{display:none}
.mate-inline-toolbar span{font-weight:700;margin-right:auto}
.mate-inline-toolbar :is(a,button){display:inline-flex;align-items:center;justify-content:center;min-height:44px;padding:9px 12px;border:1px solid #7292b5;border-radius:4px;color:#eef6ff;background:#172d49;text-decoration:none;font:inherit;font-weight:600;cursor:pointer}
.mate-inline-toolbar a{background:#9ded9c;color:#102738;border-color:transparent}
.mate-inline-toolbar :is(a,button):focus-visible,.mate-global-ranking button:focus-visible{outline:3px solid #72e4f1;outline-offset:3px}
.mate-inline-frame{display:block;width:100%;border:0;background:#0b1427}
.mate-inline-frame[hidden]{display:none}
.mate-global-ranking{min-width:0;padding:22px;background:#101b30;color:#eef6ff;border-radius:12px}
.mate-global-ranking h2{font-size:23px;color:#72e4f1;margin:0 0 18px}
.mate-global-ranking p{font-size:14px;line-height:1.6;color:#c4d7ed}
.mate-global-ranking button{min-height:44px;padding:10px 14px;border:1px solid #7292b5;border-radius:4px;background:transparent;color:#eef6ff;font:inherit;cursor:pointer}
.mate-board-tabs{display:flex;gap:8px;margin:20px 0}
.mate-board-tabs [aria-pressed=true]{background:#72e4f1;color:#102738;border-color:transparent}
.mate-attempt-list{padding:0;list-style:none;max-height:640px;overflow:auto;scrollbar-color:#7292b5 #101b30;font-variant-numeric:tabular-nums}
.mate-attempt-list li{display:flex;align-items:center;gap:12px;padding:16px 0;border-bottom:1px solid #34506d}
.mate-attempt-list li.leaderboard-self{background:#203c48}
.mate-attempt-list i{font-style:normal;color:#9bc3df;min-width:20px}
.mate-attempt-list span{flex:1;min-width:0;overflow-wrap:anywhere}
.mate-attempt-list small{display:block;color:#c4d7ed;font-size:12px;line-height:1.6}
.mate-attempt-list b{color:#9ded9c;font-size:22px}
.mate-inline-shell:fullscreen,.mate-inline-shell.is-mate-fullscreen{background:#0b1427;overflow:auto;width:100%;height:100%}
.mate-inline-shell.is-mate-fullscreen{position:fixed;inset:0;z-index:1000;border-radius:0}
body.mate-inline-fullscreen{overflow:hidden}
.portal-ui .final-current-card{max-width:850px;margin:24px auto}
.portal-ui .final-game-cover{overflow:hidden;background:#0d1526}
.portal-ui .final-game-cover img{width:100%;height:100%;object-fit:cover;display:block}
.portal-ui .final-current-card .game-card{width:100%}
@media(max-width:1050px){.mate-portal-panel{grid-template-columns:minmax(0,1fr)}.mate-attempt-list{max-height:480px}}
@media(max-width:600px){.mate-portal-panel{gap:18px}.mate-inline-toolbar{padding:12px;gap:8px}.mate-inline-toolbar [hidden]{display:none}
.mate-inline-toolbar span{width:100%}.mate-global-ranking{padding:18px}.mate-inline-toolbar :is(a,button){flex:1;font-size:13px}}

.mate-class-agenda{grid-column:1/-1;min-width:0;padding:clamp(16px,2.6vw,28px);background:#101b30;color:#eef6ff;border-radius:12px}
.mate-agenda-heading{display:flex;align-items:baseline;justify-content:space-between;flex-wrap:wrap;gap:4px 16px;margin-bottom:18px}
.mate-agenda-heading h2,.mate-agenda-heading p{margin:0}
.mate-agenda-heading p{color:#c4d7ed;font-size:14px}
.mate-agenda-grid{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:14px}
.mate-agenda-card{display:flex;flex-direction:column;gap:8px;min-width:0;padding:16px;background:#14233c;border:1px solid #3c5371;border-radius:8px}
.mate-agenda-card h3,.mate-agenda-card p{margin:0}
.mate-agenda-card h3{color:#eef6ff;font-size:25px}
.mate-agenda-meta{display:flex;justify-content:space-between;align-items:center;flex-wrap:wrap;gap:6px 10px;color:#c4d7ed;font-size:13px}
.mate-agenda-meta span{border-radius:100px;background:#223653;color:#e4f0ff;padding:3px 9px}
.mate-agenda-card[data-phase=open]{border-color:#9ded9c}
.mate-agenda-card[data-phase=open] .mate-agenda-meta span{background:#9ded9c;color:#102738}
.mate-agenda-time{font-weight:700;font-variant-numeric:tabular-nums}
.mate-agenda-access{color:#c4d7ed;font-size:13px;padding-bottom:6px}
.mate-agenda-card a{display:grid;place-items:center;min-height:44px;margin-top:auto;border:1px solid #7292b5;border-radius:5px;color:#eef6ff;text-decoration:none;font-weight:700}
.mate-agenda-card[data-phase=open] a{background:#9ded9c;border-color:#9ded9c;color:#102738}
.mate-agenda-card a:hover{text-decoration:underline}
.mate-agenda-card a:focus-visible{outline:3px solid #72e4f1;outline-offset:3px}
@media(max-width:720px){.mate-agenda-grid{grid-template-columns:minmax(0,1fr)}}

.mate-practice-cover{grid-column:1/-1;position:relative;isolation:isolate;overflow:hidden;display:grid;align-items:center;min-height:clamp(156px,20vw,230px);border:1px solid #3c5371;border-radius:12px;background:#101b30;color:#eef6ff}
.mate-practice-cover img,.mate-practice-cover::after{position:absolute;inset:0;width:100%;height:100%;z-index:-2}
.mate-practice-cover img{object-fit:cover;object-position:center 48%}
.mate-practice-cover::after{content:"";z-index:-1;background:linear-gradient(90deg,#080e20 0%,#080e20e8 22%,#080e2040 72%)}
.mate-practice-cover div{padding:clamp(20px,4vw,52px)}
.mate-practice-cover p{margin:0;color:#9bdaff;font-weight:700;font-size:13px;letter-spacing:.09em}
.mate-practice-cover h2{margin:6px 0;color:#eef6ff;font-size:clamp(30px,4vw,56px);line-height:1}
.mate-practice-cover span{color:#e4f0ff}
.mate-agenda-actions{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:8px;margin-top:auto}
.mate-agenda-actions a{text-align:center;padding:6px 4px}
.mate-agenda-card[data-phase=open] a.mate-agenda-ranking{background:transparent;border-color:#7292b5;color:#eef6ff}
@media(min-width:721px) and (max-width:1000px){.mate-agenda-actions{grid-template-columns:1fr}}

.mate-agenda-heading label{display:flex;align-items:center;gap:8px;color:#e4f0ff}
.mate-agenda-heading label[hidden]{display:none}
.mate-agenda-heading select{min-height:44px;color:#eef6ff;background:#14233c;border:1px solid #7292b5;border-radius:5px;padding:4px 8px}
.mate-agenda-standings{font-size:13px;color:#d4e2f5;border-top:1px solid #3c5371;padding:10px 0 4px}
.mate-agenda-standings h4{margin:4px 0;color:#eef6ff}
.mate-agenda-standings ol{margin:0 0 8px;padding-left:24px}
.mate-agenda-standings li{padding:3px 0}
.mate-agenda-standings strong{float:right;margin-left:6px;color:#9ded9c}
.mate-agenda-standings span{overflow-wrap:anywhere}

.mate-agenda-card{--room:#72e4f1;position:relative;background:radial-gradient(ellipse at top right,color-mix(in srgb,var(--room),transparent 84%),transparent 64%),#14233c;border-top:3px solid var(--room)}
.mate-agenda-card:nth-child(2){--room:#bcabff}.mate-agenda-card:nth-child(3){--room:#ffc586}
.mate-agenda-card h3{color:var(--room);letter-spacing:.04em}
.mate-agenda-card:not([data-phase=open]) .mate-agenda-meta span{color:var(--room)}
.mate-agenda-card .mate-agenda-actions a:first-child{border-color:var(--room)}
.mate-agenda-card[data-phase=open] .mate-agenda-actions a:first-child{border-color:#9ded9c}
.mate-board-forms{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));margin:10px 0 14px}

#matePortalPanel > .mate-global-ranking{align-self:stretch}
.mate-agenda-board-title{margin:4px 0 0;color:#eef6ff;font-size:14px}
.mate-agenda-standings{max-height:18rem;overflow:auto;scrollbar-color:#7292b5 #14233c}
.mate-agenda-standings:focus-visible{outline:2px solid #72e4f1;outline-offset:2px}
.mate-agenda-actions{grid-template-columns:1fr}

#finalPortalPanel > .mate-global-ranking{align-self:stretch}
.mate-agenda-single{grid-template-columns:minmax(0,1fr)}
.mate-agenda-single [hidden]{display:none}

.agenda-format-filters{display:flex;gap:6px;flex-wrap:wrap}
.agenda-format-filters[hidden]{display:none}
.agenda-format-filters button{min-height:44px;padding:5px 10px;border:1px solid #7292b5;border-radius:6px;background:#101b30;color:#eef6ff;font:inherit;font-size:13px;cursor:pointer}
.agenda-format-filters button[aria-pressed=true]{border-color:var(--room);background:#20334d;color:#fff;font-weight:700}
.agenda-format-filters button:focus-visible{outline:2px solid #72e4f1;outline-offset:2px}
.agenda-format-badge{display:inline-block;margin-left:6px;color:#bcd0e9}
