/*
 * The Teacher V10.46 — mobile parent experience.
 * All layout changes are deliberately scoped to phone/tablet widths so the
 * existing laptop and desktop experience remains unchanged.
 */

.mobile-account-menu-toggle {
  display: none;
}

.account-actions-panel {
  display: flex;
  align-items: center;
  gap: 9px;
}

@media (max-width: 768px) {
  html {
    overflow-x: hidden;
    scroll-behavior: smooth;
  }

  body {
    min-width: 0;
    overflow-x: hidden;
    -webkit-tap-highlight-color: rgba(25, 118, 231, .12);
  }

  button,
  a,
  input,
  select {
    touch-action: manipulation;
  }

  .container {
    width: min(calc(100% - 24px), var(--container, 1180px));
  }

  .portal-primary,
  .portal-secondary,
  .primary-button,
  .secondary-button,
  .header-link,
  .header-family-action,
  .header-logout-action {
    min-height: 48px;
  }

  .portal-header {
    position: sticky;
    z-index: 80;
    top: 0;
  }

  .portal-header-inner {
    min-height: 62px;
  }

  .portal-header .brand-mark {
    width: 44px;
    height: 44px;
  }

  .portal-header .brand-copy strong {
    font-size: .96rem;
  }

  .portal-header .brand-copy small {
    display: none;
  }

  /* Home: login is the primary mobile task. */
  .home-showcase-header {
    position: sticky;
    z-index: 80;
    top: 0;
  }

  .home-header-inner {
    grid-template-columns: 54px minmax(0, 1fr) 54px;
    width: min(calc(100% - 18px), 1480px);
    min-height: 62px;
  }

  .home-logo {
    width: 52px;
    height: 50px;
  }

  .home-header-spacer {
    width: 52px;
  }

  .home-platform-name {
    font-size: clamp(.72rem, 3.7vw, .94rem);
    line-height: 1.45;
  }

  .home-showcase-main {
    width: min(calc(100% - 20px), 1480px);
    padding: 12px 0 16px;
  }

  .home-hero h1 {
    font-size: clamp(1.45rem, 6.8vw, 2rem);
    line-height: 1.25;
  }

  .home-hero p {
    max-width: 340px;
    margin: 4px auto 10px;
    font-size: .86rem;
    line-height: 1.7;
  }

  .home-login-card {
    padding: 15px 14px 14px;
    border-radius: 18px;
    box-shadow: 0 14px 34px rgba(24, 87, 157, .1);
  }

  .home-login-card h2 {
    margin-bottom: 11px;
    font-size: 1.38rem;
  }

  .home-input-shell {
    min-height: 52px;
  }

  .home-input-shell input {
    height: 50px;
    font-size: 16px;
  }

  .home-form-helper {
    align-items: center;
    flex-flow: row wrap;
    margin-bottom: 8px;
    font-size: .69rem;
  }

  .home-login-submit,
  .home-create-account {
    min-height: 50px;
  }

  .home-account-divider {
    margin: 9px 0 7px;
  }

  .home-pricing-button {
    min-height: 42px;
    margin-top: 3px;
  }

  .home-features {
    display: none;
  }

  .home-age-note {
    margin: 11px 0 0;
    font-size: .73rem;
  }

  .home-age-note span {
    width: 32px;
    height: 32px;
  }

  .home-showcase-footer {
    min-height: 42px;
    padding: 8px 12px;
    font-size: .7rem;
  }

  .home-pricing-dialog,
  .registration-pricing-dialog,
  .family-account-dialog {
    width: calc(100% - 16px);
    max-width: none;
    max-height: calc(100dvh - 16px);
    margin: auto 8px 8px;
    border-radius: 22px 22px 16px 16px;
  }

  .home-pricing-dialog-content {
    max-height: calc(100dvh - 24px);
    overflow-y: auto;
    padding: 25px 16px 18px;
  }

  /* Registration and account forms. */
  .form-page,
  .family-main,
  .dashboard-main {
    padding-block: 14px 24px;
  }

  .simple-registration-layout,
  .family-container {
    width: min(calc(100% - 20px), 1120px);
  }

  .portal-form-card,
  .guardian-auth-card,
  .status-card {
    padding: 16px;
    border-radius: 18px;
  }

  .registration-wizard-top {
    gap: 12px;
    margin-bottom: 15px;
  }

  .registration-wizard-top h1 {
    font-size: 1.42rem;
    line-height: 1.45;
  }

  .registration-wizard-top p,
  .wizard-panel-heading p {
    font-size: .8rem;
    line-height: 1.7;
  }

  .registration-pricing-top {
    min-height: 46px;
  }

  .registration-progress {
    margin-bottom: 18px;
  }

  .registration-progress li small {
    max-width: 58px;
    font-size: .56rem;
  }

  .registration-progress li span {
    width: 30px;
    height: 30px;
  }

  .registration-type-grid {
    grid-template-columns: 1fr;
    gap: 12px;
  }

  .registration-type-card,
  .registration-section,
  .registration-child-card {
    padding: 15px;
    border-radius: 16px;
  }

  .registration-type-card {
    grid-template-columns: auto minmax(0, 1fr);
  }

  .registration-type-card > button {
    grid-column: 1 / -1;
  }

  .portal-field input,
  .portal-field select,
  .password-shell {
    min-height: 52px;
    font-size: 16px;
  }

  .registration-wizard-actions {
    position: sticky;
    z-index: 24;
    bottom: max(8px, env(safe-area-inset-bottom));
    gap: 8px;
    margin: 18px -5px 0;
    padding: 8px;
    border: 1px solid #d9e6f3;
    border-radius: 16px;
    background: rgba(255, 255, 255, .96);
    box-shadow: 0 10px 28px rgba(11, 35, 68, .12);
    backdrop-filter: blur(12px);
  }

  .registration-wizard-actions .portal-primary,
  .registration-wizard-actions .portal-secondary {
    min-height: 50px;
  }

  .registration-pricing-dialog-card {
    max-height: calc(100dvh - 24px);
    overflow-y: auto;
  }

  /* Child selector: one clear action per child. */
  .selector-header-actions {
    display: flex;
    align-items: center;
    gap: 6px;
  }

  .selector-header-actions .header-family-action,
  .selector-header-actions .header-link {
    width: 44px;
    min-height: 44px;
    padding: 0;
    overflow: hidden;
    font-size: 0;
  }

  .selector-header-actions .header-family-action .header-action-icon {
    width: 100%;
    height: 100%;
    font-size: 1.05rem;
  }

  .selector-header-actions .header-link::before {
    content: "↪";
    font-size: 1.1rem;
  }

  .family-page-loading {
    position: fixed;
    z-index: 90;
    top: 72px;
    right: 50%;
    left: auto;
    width: max-content;
    max-width: calc(100% - 24px);
    transform: translateX(50%);
    box-shadow: 0 10px 28px rgba(11, 35, 68, .14);
  }

  .family-welcome {
    gap: 14px;
    padding: 17px;
    border-radius: 18px;
  }

  .family-welcome h1 {
    font-size: 1.45rem;
  }

  .family-welcome p {
    font-size: .83rem;
    line-height: 1.75;
  }

  .section-title-row {
    gap: 8px;
    margin-block: 18px 10px;
  }

  .section-title-row h2 {
    font-size: 1.25rem;
  }

  .children-grid {
    grid-template-columns: 1fr;
    gap: 12px;
  }

  .child-card {
    grid-template-columns: 54px minmax(0, 1fr);
    gap: 11px;
    padding: 15px;
    border-radius: 17px;
    text-align: right;
  }

  .child-avatar {
    width: 54px;
    height: 54px;
    margin: 0;
    border-radius: 16px;
  }

  .child-card h3 {
    font-size: 1.02rem;
    line-height: 1.55;
  }

  .child-card p {
    font-size: .76rem;
    line-height: 1.65;
  }

  .child-card .portal-primary {
    grid-column: 1 / -1;
    min-height: 50px;
  }

  /* Student page: compact account menu and parent-first information order. */
  .dashboard-header .portal-header-inner {
    position: relative;
  }

  .student-header-actions {
    position: relative;
  }

  .mobile-account-menu-toggle {
    display: inline-flex;
    min-height: 46px;
    align-items: center;
    justify-content: center;
    gap: 7px;
    padding: 0 12px;
    border: 1px solid #c8d9eb;
    border-radius: 12px;
    color: #0b2344;
    background: #fff;
    font: inherit;
    font-size: .76rem;
    font-weight: 800;
  }

  .account-actions-panel {
    position: absolute;
    z-index: 120;
    top: calc(100% + 9px);
    left: 0;
    display: none;
    width: min(310px, calc(100vw - 24px));
    padding: 10px;
    border: 1px solid #cbdced;
    border-radius: 16px;
    background: #fff;
    box-shadow: 0 18px 44px rgba(11, 35, 68, .18);
  }

  .account-actions-panel.is-open {
    display: grid;
    gap: 8px;
  }

  .account-actions-panel .family-header-actions {
    display: grid;
    gap: 8px;
  }

  .account-actions-panel .header-family-action,
  .account-actions-panel .header-logout-action {
    width: 100%;
    min-height: 48px;
    justify-content: flex-start;
    padding-inline: 12px;
    font-size: .82rem;
  }

  .account-actions-panel .logout-label {
    position: static;
    width: auto;
    height: auto;
    margin: 0;
    overflow: visible;
    clip: auto;
    white-space: normal;
  }

  .account-actions-panel .child-switcher {
    width: 100%;
  }

  .account-actions-panel .child-switch-menu {
    position: static;
    width: 100%;
    max-height: 240px;
    margin-top: 6px;
    overflow-y: auto;
    box-shadow: none;
  }

  #student-content:not([hidden]) {
    display: flex;
    flex-direction: column;
  }

  #student-content .student-hero {
    order: 1;
  }

  #student-content .latest-parent-summary {
    order: 2;
  }

  #student-content .learning-path-card {
    order: 3;
  }

  #student-content .parent-report-launch {
    order: 4;
  }

  .student-page-loading,
  .gate-card,
  .student-suspended-card {
    margin-block: 18px;
    padding: 24px 17px;
    border-radius: 19px;
  }

  .student-welcome {
    gap: 15px;
    padding: 18px;
    border-radius: 19px;
  }

  .student-profile-heading {
    align-items: center;
    gap: 11px;
  }

  .student-profile-heading .student-avatar {
    width: 54px;
    height: 54px;
  }

  .student-profile-heading h1 {
    font-size: 1.38rem;
  }

  .student-access-summary,
  .subscription-pill {
    width: 100%;
  }

  .latest-parent-summary,
  .learning-path-card,
  .parent-report-launch {
    margin: 13px 0 0;
    border-radius: 18px;
  }

  .latest-parent-heading,
  .latest-parent-details,
  .latest-recommendation,
  .learning-path-card {
    padding: 17px;
  }

  .latest-parent-heading {
    gap: 12px;
  }

  .latest-parent-heading h2 {
    font-size: 1.08rem;
    line-height: 1.55;
  }

  #latest-exam-score {
    min-width: 66px;
    font-size: 1.45rem;
  }

  .latest-parent-details {
    grid-template-columns: 1fr;
    gap: 9px;
  }

  .latest-parent-details article {
    padding: 13px;
  }

  .learning-path-heading h2 {
    font-size: 1.35rem;
  }

  .simple-selector-grid {
    grid-template-columns: 1fr;
  }

  .selected-exam-card {
    align-items: stretch;
    flex-direction: column;
    gap: 12px;
  }

  .selected-exam-card .selected-exam-result,
  .selected-exam-card .portal-primary {
    width: 100%;
  }

  .parent-report-toggle {
    min-height: 68px;
    padding: 13px;
  }

  .parent-report-toggle em {
    display: none;
  }

  .parent-report-panel {
    padding: 15px;
  }

  .student-suspended-actions {
    grid-template-columns: 1fr;
  }

  .child-switch-loading-card,
  .exam-launch-card {
    width: calc(100% - 24px);
    padding: 24px 17px;
  }

  /* Exam: readable questions, compact map, and reachable actions. */
  .exam-header {
    position: sticky;
    z-index: 70;
    top: 0;
  }

  .exam-header-content {
    min-height: 60px;
  }

  .exam-overview {
    padding-block: 14px 11px;
  }

  .exam-title-block h1 {
    font-size: 1.3rem;
    line-height: 1.5;
  }

  .exam-title-block p {
    gap: 5px;
    font-size: .7rem;
  }

  .sound-toggle,
  .timer-card {
    min-height: 48px;
  }

  .exam-main {
    padding-block: 12px 26px;
  }

  .exam-layout {
    gap: 12px;
  }

  .question-sidebar {
    padding: 14px;
    border-radius: 17px;
  }

  .question-sidebar .map-legend,
  .question-sidebar .sidebar-summary {
    display: none;
  }

  .sidebar-heading {
    margin-bottom: 10px;
  }

  .question-map {
    display: flex;
    gap: 7px;
    overflow-x: auto;
    padding: 3px 1px 9px;
    overscroll-behavior-inline: contain;
    scroll-snap-type: x proximity;
    scrollbar-width: thin;
  }

  .question-map > button {
    flex: 0 0 44px;
    width: 44px;
    min-height: 44px;
    scroll-snap-align: center;
  }

  .question-sidebar .finish-button {
    width: 100%;
    min-height: 50px;
    margin-top: 6px;
  }

  .question-panel {
    padding: 18px 14px 12px;
    border-radius: 18px;
  }

  .question-prompt h3,
  .question-context p {
    overflow-wrap: anywhere;
  }

  .answer-options {
    gap: 10px;
  }

  .answer-option {
    min-height: 54px;
    padding: 11px 12px;
  }

  .option-label {
    font-size: 17px;
    line-height: 1.7;
  }

  .question-actions {
    position: sticky;
    z-index: 30;
    bottom: max(6px, env(safe-area-inset-bottom));
    gap: 8px;
    margin: 20px -5px -4px;
    padding: 8px 5px;
    border-radius: 15px;
    background: rgba(255, 255, 255, .96);
    box-shadow: 0 -8px 24px rgba(11, 35, 68, .08);
    backdrop-filter: blur(10px);
  }

  .question-actions button {
    min-height: 50px;
  }

  .confirm-modal,
  .exam-submission-card {
    width: calc(100% - 24px);
    max-height: calc(100dvh - 24px);
    overflow-y: auto;
    padding: 26px 17px;
  }

  /* Result: score and recommendation before detailed correction. */
  .result-header-label {
    font-size: .72rem;
  }

  .result-main {
    padding-block: 14px 30px;
  }

  .result-container {
    width: min(calc(100% - 20px), 920px);
  }

  .result-hero {
    padding: 24px 14px;
    border-radius: 20px;
  }

  .result-hero h1 {
    font-size: 1.55rem;
    line-height: 1.45;
  }

  .score-ring {
    width: 128px;
    height: 128px;
  }

  .learning-report {
    padding: 19px 14px;
    border-radius: 18px;
  }

  .parent-result-guidance {
    margin-top: 14px;
    padding: 17px 14px;
  }

  .parent-result-guidance > strong {
    font-size: 1.2rem;
  }

  .parent-result-guidance > p {
    font-size: .85rem;
    line-height: 1.8;
  }

  .result-summary {
    grid-template-columns: 1fr 1fr;
    border-radius: 18px;
  }

  .result-student-card {
    grid-column: 1 / -1;
  }

  .result-actions {
    gap: 9px;
  }

  .result-actions .primary-button,
  .result-actions .home-button,
  .certificate-print-button {
    width: 100%;
    min-height: 50px;
  }

  .review-card,
  .hidden-result-card {
    padding: 17px;
    border-radius: 18px;
  }

  .answer-comparison {
    grid-template-columns: 1fr;
  }

  .answer-comparison strong {
    overflow-wrap: anywhere;
  }
}

@media (max-width: 390px) {
  .home-form-helper > span {
    display: none;
  }

  .mobile-account-menu-toggle {
    padding-inline: 10px;
  }

  .registration-progress li small {
    font-size: .52rem;
  }

  .child-card {
    grid-template-columns: 48px minmax(0, 1fr);
  }

  .child-avatar {
    width: 48px;
    height: 48px;
  }

  .question-actions {
    grid-template-columns: 1fr 1fr;
  }
}

@media (prefers-reduced-motion: reduce) {
  @media (max-width: 768px) {
    html {
      scroll-behavior: auto;
    }
  }
}
