/* iPad Mini landscape review layer
   Scope is intentionally exact: 1024x768 landscape only.
   Portrait and every other viewport stay unchanged. */
@media (width:1024px) and (height:768px) and (orientation:landscape){

  /* ---------- Shared shell: all five primary tabs ---------- */
  html,body{overflow-x:hidden!important}
  body{min-width:0!important}

  .learning-sidebar{
    width:184px!important;
    padding:10px 8px!important;
    gap:10px!important
  }
  .learning-brand{
    margin-bottom:10px!important;
    padding:5px 2px!important;
    gap:6px!important
  }
  .learning-brand-icon{width:30px!important;height:32px!important}
  .learning-brand-title{font-size:11.5px!important;line-height:15px!important;white-space:nowrap!important}
  .learning-brand-subtitle{font-size:8px!important;line-height:11px!important}
  .learning-sidebar-nav{gap:3px!important}
  .learning-sidebar .learning-nav-link{
    min-height:38px!important;
    padding:7px 8px!important;
    gap:7px!important;
    border-radius:10px!important;
    font-size:11px!important;
    line-height:15px!important
  }
  .learning-sidebar .learning-nav-icon{
    width:18px!important;
    height:19px!important;
    font-size:16px!important
  }
  .learning-curriculum{
    padding:8px!important;
    border-radius:10px!important
  }
  .learning-curriculum p{font-size:9.5px!important;line-height:13px!important}
  .learning-curriculum small{font-size:8px!important;line-height:11px!important}

  .learning-home-layout{padding-left:184px!important}
  .learning-page-content{padding-left:184px!important}

  .learning-page-header{
    left:184px!important;
    right:0!important;
    height:62px!important;
    min-height:62px!important;
    padding:7px 12px!important;
    gap:8px!important;
    align-items:center!important
  }
  .map-auth-header{
    height:62px!important;
    min-height:62px!important;
    padding:7px 12px!important;
    gap:8px!important
  }

  .learning-page-header .header-learning-summary,
  .map-auth-header .map-header-profile-row{
    flex:1 1 auto!important;
    min-width:0!important;
    display:flex!important;
    align-items:center!important;
    gap:6px!important
  }
  .learning-page-header #header-profile-badge,
  .map-auth-header #header-profile-badge{
    flex:1 1 auto!important;
    min-width:0!important;
    max-width:none!important;
    overflow:hidden!important
  }
  .learning-page-header #profile-switcher-wrapper,
  .map-auth-header #profile-switcher-wrapper{
    width:100%!important;
    min-width:0!important;
    max-width:330px!important
  }
  .learning-page-header #btn-toggle-profile-menu,
  .map-auth-header #btn-toggle-profile-menu{
    width:100%!important;
    min-width:0!important;
    max-width:330px!important;
    min-height:38px!important;
    height:38px!important;
    padding:4px 7px!important;
    gap:5px!important;
    overflow:hidden!important
  }
  .learning-page-header #btn-toggle-profile-menu>span:nth-child(2),
  .map-auth-header #btn-toggle-profile-menu>span:nth-child(2){
    min-width:0!important;
    max-width:44%!important;
    overflow:hidden!important;
    text-overflow:ellipsis!important;
    white-space:nowrap!important;
    font-size:11px!important
  }
  .learning-page-header #btn-toggle-profile-menu>span:nth-child(3),
  .map-auth-header #btn-toggle-profile-menu>span:nth-child(3){
    min-width:0!important;
    overflow:hidden!important;
    text-overflow:ellipsis!important;
    white-space:nowrap!important;
    font-size:9px!important
  }
  .learning-page-header .header-learning-stats,
  .map-auth-header .map-header-profile-row{
    min-width:0!important
  }
  .learning-page-header .header-learning-stats{
    display:flex!important;
    gap:5px!important;
    flex:0 0 auto!important
  }
  .learning-page-header .header-learning-stats>div,
  .map-auth-header .map-header-profile-row>div:not(#header-profile-badge){
    min-width:44px!important;
    height:38px!important;
    padding:0 7px!important;
    gap:3px!important;
    border-radius:10px!important;
    font-size:10px!important;
    display:flex!important;
    align-items:center!important;
    justify-content:center!important
  }
  .learning-page-header .page-login,
  .map-auth-header .page-login{
    flex:0 0 auto!important;
    height:38px!important;
    min-height:38px!important;
    padding:0 10px!important;
    border-radius:10px!important;
    font-size:10px!important;
    gap:5px!important
  }

  .learning-page-header~main{
    padding-top:74px!important;
    padding-left:12px!important;
    padding-right:12px!important;
    padding-bottom:22px!important
  }
  .learning-page-header~main>div{
    width:100%!important;
    max-width:none!important;
    min-width:0!important
  }

  .home-main *,
  #section-catalog *,
  #view-config *,
  .bvt-main-stack *,
  .parent-mobile-stack *{
    box-sizing:border-box
  }
  .home-main p,.home-main span,.home-main h1,.home-main h2,.home-main h3,.home-main h4,
  #section-catalog p,#section-catalog span,#section-catalog h1,#section-catalog h2,#section-catalog h3,#section-catalog h4,
  #view-config p,#view-config span,#view-config h1,#view-config h2,#view-config h3,#view-config h4,
  .bvt-main-stack p,.bvt-main-stack span,.bvt-main-stack h1,.bvt-main-stack h2,.bvt-main-stack h3,.bvt-main-stack h4,.bvt-main-stack h5,
  .parent-mobile-stack p,.parent-mobile-stack span,.parent-mobile-stack h1,.parent-mobile-stack h2,.parent-mobile-stack h3,.parent-mobile-stack h4,.parent-mobile-stack h5{
    word-break:normal!important;
    overflow-wrap:break-word!important;
    hyphens:none!important
  }

  /* ---------- Bản đồ học tập ---------- */
  .home-main{padding:12px 12px 22px!important}
  .home-hero{
    padding:14px!important;
    margin-bottom:10px!important;
    border-radius:14px!important
  }
  .home-hero-grid{
    display:grid!important;
    grid-template-columns:minmax(0,1.45fr) minmax(230px,.75fr)!important;
    gap:10px!important;
    align-items:stretch!important
  }
  .home-recommendation,.home-quick-wrap{
    width:100%!important;
    min-width:0!important;
    max-width:none!important
  }
  .home-quick-wrap{margin-top:0!important}
  #hero-welcome-title{
    font-size:22px!important;
    line-height:27px!important;
    margin-bottom:10px!important
  }
  .home-ai-card{
    padding:12px!important;
    gap:9px!important;
    height:100%!important
  }
  .home-ai-card .w-24{width:68px!important}
  .home-ai-card .h-28{height:82px!important}
  .home-quick-card{
    height:100%!important;
    padding:11px!important
  }
  #home-quick-suggestions{gap:5px!important}
  .home-term-bar{
    display:grid!important;
    grid-template-columns:minmax(0,1fr) auto!important;
    align-items:center!important;
    gap:8px!important;
    margin-bottom:10px!important
  }
  #term-tabs-container{
    width:100%!important;
    min-width:0!important;
    display:grid!important;
    grid-template-columns:repeat(3,minmax(0,1fr))!important;
    gap:5px!important
  }
  #term-tabs-container button{
    width:100%!important;
    min-width:0!important;
    padding:7px 6px!important;
    justify-content:center!important;
    font-size:10px!important
  }
  .home-modules-grid{
    display:grid!important;
    grid-template-columns:minmax(0,1fr) 218px!important;
    gap:10px!important;
    align-items:start!important
  }
  .home-roadmap-column,.home-side-column{
    width:100%!important;
    min-width:0!important;
    max-width:none!important
  }
  .home-module-header{
    padding:12px!important;
    margin-bottom:9px!important
  }
  #learning-map-container{gap:9px!important}
  .map-topic-wrap{width:100%!important;max-width:none!important;min-width:0!important}
  .map-topic-card{width:100%!important;min-width:0!important;padding:12px!important}
  .map-topic-title{font-size:17px!important;line-height:22px!important}
  .home-chest-card,.home-rule-card,.home-books-card{
    width:100%!important;
    min-width:0!important;
    max-width:none!important
  }

  /* ---------- Đấu trường rèn luyện ---------- */
  #section-catalog{
    width:100%!important;
    min-width:0!important;
    gap:10px!important
  }
  #section-catalog .arena-mobile-hero{
    display:grid!important;
    grid-template-columns:minmax(0,1fr) 200px!important;
    align-items:center!important;
    gap:10px!important;
    padding:12px!important;
    border-radius:13px!important
  }
  #section-catalog .arena-mobile-hero-main{min-width:0!important;gap:9px!important}
  #section-catalog .arena-mobile-hero-icon{
    width:48px!important;height:48px!important;border-radius:11px!important;font-size:23px!important
  }
  #section-catalog .arena-mobile-hero-title{font-size:21px!important;line-height:26px!important}
  #section-catalog .arena-mobile-hero-desc{font-size:10.5px!important;line-height:15px!important}
  #section-catalog .arena-progress-card{
    width:100%!important;min-width:0!important;padding:10px!important;gap:8px!important;border-radius:11px!important
  }
  #section-catalog .arena-filter-panel{
    padding:11px!important;
    gap:8px!important;
    border-radius:12px!important
  }
  #section-catalog .arena-filter-main{
    display:grid!important;
    grid-template-columns:minmax(0,1fr) 240px!important;
    grid-template-rows:auto auto!important;
    gap:7px 9px!important
  }
  #section-catalog .arena-book-tabs{
    grid-column:1 / -1!important;
    display:grid!important;
    grid-template-columns:repeat(2,minmax(0,1fr))!important;
    gap:6px!important
  }
  #section-catalog .arena-book-tabs button{
    width:100%!important;min-width:0!important;min-height:36px!important;font-size:10px!important
  }
  #section-catalog .arena-search-wrap{
    grid-column:1!important;
    width:100%!important;
    max-width:none!important
  }
  #section-catalog #catalog-search{height:36px!important;font-size:10px!important}
  #section-catalog .arena-status-filters{
    grid-column:2!important;
    display:grid!important;
    grid-template-columns:repeat(3,minmax(0,1fr))!important;
    gap:4px!important
  }
  #section-catalog .arena-status-filters button{
    width:100%!important;min-width:0!important;min-height:36px!important;
    padding:4px!important;font-size:8.8px!important;line-height:12px!important;white-space:normal!important
  }
  #catalog-topics-container{gap:12px!important}
  #catalog-topics-container .arena-topic-header{padding:10px 12px!important;border-radius:11px!important}
  #catalog-topics-container .arena-topic-title{font-size:14px!important;line-height:18px!important}
  #catalog-topics-container .arena-lessons-grid{
    display:grid!important;
    grid-template-columns:repeat(2,minmax(0,1fr))!important;
    gap:8px!important
  }
  #catalog-topics-container .arena-lesson-card,
  #catalog-topics-container .catalog-card{
    width:100%!important;
    min-width:0!important;
    min-height:118px!important;
    padding:10px!important;
    border-radius:10px!important
  }
  #catalog-topics-container .arena-card-title{
    min-height:0!important;
    font-size:12.5px!important;
    line-height:17px!important;
    white-space:normal!important
  }

  /* ---------- Bài kiểm tra ---------- */
  #view-config{width:100%!important;min-width:0!important;gap:10px!important}
  .exam-mobile-hero{
    display:grid!important;
    grid-template-columns:minmax(0,1fr) auto!important;
    align-items:center!important;
    gap:10px!important;
    padding:12px!important;
    border-radius:13px!important
  }
  .exam-mobile-hero-main{min-width:0!important;gap:9px!important}
  .exam-mobile-hero-icon{
    width:48px!important;height:48px!important;border-radius:11px!important;font-size:23px!important
  }
  .exam-mobile-title{font-size:21px!important;line-height:26px!important}
  .exam-mobile-desc{font-size:10.5px!important;line-height:15px!important;max-width:none!important}
  .exam-history-button{
    min-width:118px!important;height:38px!important;padding:0 10px!important;font-size:9.5px!important
  }
  .exam-config-grid{
    display:grid!important;
    grid-template-columns:minmax(0,1.12fr) minmax(320px,.88fr)!important;
    gap:10px!important;
    align-items:start!important
  }
  .exam-scope-card,.exam-settings-column{
    width:100%!important;min-width:0!important;max-width:none!important
  }
  .exam-scope-card,.exam-settings-card{
    padding:11px!important;border-radius:12px!important;gap:8px!important
  }
  .exam-step-header{padding-bottom:7px!important}
  .exam-step-header h3,.exam-settings-card h3{font-size:14px!important;line-height:19px!important}
  #lessons-scope-container{
    max-height:410px!important;
    gap:6px!important;
    padding-right:2px!important
  }
  #lessons-scope-container>label{
    min-height:48px!important;
    padding:7px 8px!important;
    border-radius:9px!important
  }
  .exam-presets{
    display:grid!important;
    grid-template-columns:repeat(4,minmax(0,1fr))!important;
    gap:5px!important
  }
  .exam-presets button{min-width:0!important;min-height:46px!important;font-size:10px!important}
  #auto-matrix-preview{
    display:grid!important;
    grid-template-columns:repeat(4,minmax(0,1fr))!important;
    gap:5px!important
  }
  #manual-levels-list{
    display:grid!important;
    grid-template-columns:repeat(2,minmax(0,1fr))!important;
    gap:5px!important
  }
  .exam-time-options{
    display:grid!important;
    grid-template-columns:1fr!important;
    gap:6px!important;
    padding-top:7px!important
  }
  .exam-desktop-start-button{
    width:100%!important;
    min-height:42px!important;
    font-size:10.5px!important
  }
  .exam-mobile-start-wrap{display:none!important}

  /* ---------- Bảng vàng thành tích ---------- */
  .bvt-main-stack{
    display:flex!important;
    flex-direction:column!important;
    width:100%!important;
    min-width:0!important;
    max-width:none!important;
    gap:12px!important
  }
  .bvt-profile-card{padding:12px!important;border-radius:12px!important}
  .bvt-profile-inner{
    display:grid!important;
    grid-template-columns:minmax(0,1fr) 228px!important;
    align-items:center!important;
    gap:10px!important
  }
  .bvt-profile-main{
    min-width:0!important;
    flex-direction:row!important;
    align-items:center!important;
    justify-content:flex-start!important;
    text-align:left!important;
    gap:10px!important
  }
  #bvt-avatar-box{width:76px!important;height:76px!important;font-size:42px!important;flex:0 0 76px!important}
  #bvt-child-name{font-size:21px!important;line-height:26px!important}
  .bvt-current-title-row,.bvt-school-row{justify-content:flex-start!important;flex-wrap:wrap!important;gap:5px!important}
  .bvt-star-area{width:100%!important;min-width:0!important;gap:7px!important}
  .bvt-star-vault{width:100%!important;max-width:none!important;padding:9px!important}
  .bvt-reward-button{width:100%!important;max-width:none!important;height:40px!important}

  /* Fix the 12-column Tailwind spans that previously created implicit narrow columns. */
  .bvt-competency-layout{
    display:grid!important;
    grid-template-columns:repeat(2,minmax(0,1fr))!important;
    grid-auto-columns:minmax(0,1fr)!important;
    gap:10px!important;
    align-items:start!important
  }
  .bvt-competency-card{
    display:none!important;
  }
  .bvt-today-leaderboard-card{
    display:flex!important;
    grid-column:2!important;
    grid-row:auto!important;
    width:100%!important;
    min-width:0!important;
    padding:11px!important;
    gap:7px!important;
    border-radius:12px!important
  }
  .bvt-insight-column{
    grid-column:1!important;
    grid-row:auto!important;
    width:100%!important;
    min-width:0!important;
    gap:8px!important
  }
  .bvt-radar-card{
    width:100%!important;
    min-width:0!important;
    padding:11px!important;
    border-radius:12px!important
  }
  .bvt-radar-title{font-size:18px!important;line-height:23px!important}
  .bvt-radar-visual{width:196px!important;height:196px!important;margin:0 auto!important}
  .bvt-radar-visual svg text{font-size:9.5px!important}
  .bvt-daily-tip{margin-top:4px!important;padding:8px!important}
  .bvt-streak-card{width:100%!important;min-width:0!important;margin:0!important;border-radius:12px!important}
  .bvt-today-leaderboard-head{
    display:flex!important;
    align-items:flex-start!important;
    justify-content:space-between!important;
    gap:7px!important
  }
  .bvt-today-leaderboard-head h2{font-size:18px!important;line-height:22px!important}
  .bvt-today-leaderboard-head p{font-size:9px!important;line-height:13px!important}
  .bvt-today-leaderboard-row{
    min-height:42px!important;
    grid-template-columns:24px 30px minmax(0,1fr) auto auto!important;
    gap:4px!important;
    padding:5px!important
  }
  .bvt-today-avatar{width:28px!important;height:28px!important;font-size:17px!important}
  .bvt-today-name strong{font-size:10px!important;line-height:14px!important}
  .bvt-today-grade{font-size:7.8px!important;padding:3px 4px!important}
  .bvt-today-xp{font-size:9.5px!important}

  .bvt-bottom-layout{
    display:grid!important;
    grid-template-columns:repeat(2,minmax(0,1fr))!important;
    grid-auto-columns:minmax(0,1fr)!important;
    gap:10px!important
  }
  .bvt-bottom-layout>.bvt-milestones-card,
  .bvt-bottom-layout>.bvt-history-card{
    grid-column:auto!important;
    grid-row:auto!important;
    width:100%!important;
    min-width:0!important
  }
  .bvt-badges-section,.bvt-thinking-section,.bvt-milestones-card,.bvt-history-card{
    width:100%!important;
    min-width:0!important
  }
  #bvt-badges-container,#bvt-thinking-badges-container{
    grid-template-columns:repeat(3,minmax(0,1fr))!important;
    gap:7px!important
  }

  /* ---------- Góc phụ huynh ---------- */
  .parent-mobile-stack{
    width:100%!important;
    min-width:0!important;
    max-width:none!important;
    gap:10px!important
  }
  .parent-mobile-profile-bar{
    display:grid!important;
    grid-template-columns:minmax(0,1fr) auto!important;
    align-items:center!important;
    gap:8px!important
  }
  .parent-mobile-profile-main{width:100%!important;min-width:0!important}
  .parent-mobile-profile-actions{
    min-width:0!important;
    display:flex!important;
    align-items:center!important;
    justify-content:flex-end!important;
    gap:5px!important;
    flex-wrap:nowrap!important
  }
  #parent-period-tabs{
    min-width:0!important;
    display:grid!important;
    grid-template-columns:repeat(3,minmax(0,1fr))!important;
    gap:4px!important;
    flex-wrap:nowrap!important
  }
  #parent-period-tabs button{min-width:0!important;padding-left:7px!important;padding-right:7px!important}
  #parent-children-cards-container,#parent-rewards-grid{
    grid-template-columns:repeat(2,minmax(0,1fr))!important;
    gap:8px!important
  }
  .parent-tier-grid{
    grid-template-columns:repeat(2,minmax(0,1fr))!important;
    gap:8px!important
  }
  #parent-metrics-grid{
    grid-template-columns:repeat(4,minmax(0,1fr))!important;
    gap:7px!important
  }
  #parent-metrics-grid>div{
    min-width:0!important;
    min-height:112px!important;
    padding:10px!important
  }
  #parent-reinforcement-card{
    padding:12px!important;
    gap:9px!important;
    border-radius:12px!important
  }
  .parent-reinforcement-head{
    gap:8px!important;
    align-items:flex-start!important
  }
  .parent-reinforcement-head h4{font-size:15px!important;line-height:20px!important}
  .parent-reinforcement-head p{font-size:10.5px!important;line-height:15px!important}
  #parent-reinforcement-list{
    display:grid!important;
    grid-template-columns:repeat(2,minmax(0,1fr))!important;
    gap:7px!important
  }
  #parent-reinforcement-list>div{
    width:100%!important;
    min-width:0!important;
    padding:10px!important;
    border-radius:10px!important
  }

  /* Give competency cards enough width; insights move below instead of squeezing text. */
  .parent-analytics-layout{
    display:flex!important;
    flex-direction:column!important;
    gap:10px!important
  }
  .parent-competency-card{
    width:100%!important;
    min-width:0!important;
    padding:12px!important;
    border-radius:12px!important
  }
  .parent-competency-head{
    display:flex!important;
    align-items:flex-start!important;
    justify-content:space-between!important;
    gap:8px!important
  }
  .parent-competency-head .font-headline-md{font-size:18px!important;line-height:23px!important}
  #parent-overall-competency{
    flex:0 0 auto!important;
    max-width:42%!important;
    white-space:normal!important
  }
  #parent-strands-container{
    display:grid!important;
    grid-template-columns:repeat(2,minmax(0,1fr))!important;
    gap:7px!important
  }
  #parent-strands-container>.competency-responsive-card{
    width:100%!important;
    min-width:0!important;
    padding:10px!important;
    border-radius:10px!important
  }
  #parent-strands-container .competency-responsive-title{
    font-size:11.5px!important;
    line-height:16px!important;
    white-space:normal!important
  }
  #parent-strands-container .competency-responsive-evidence{
    padding-left:34px!important;
    font-size:10px!important;
    line-height:14px!important
  }
  #parent-strands-container .competency-responsive-progress{padding-left:34px!important}
  #parent-strands-container .competency-responsive-meta{font-size:9.5px!important;line-height:13px!important}
  .parent-chart-section{
    display:block!important;
    margin-top:10px!important;
    padding-top:10px!important
  }
  #parent-chart-container{
    height:178px!important;
    max-width:620px!important;
    margin-left:auto!important;
    margin-right:auto!important
  }
  .parent-insight-column{
    width:100%!important;
    min-width:0!important;
    display:grid!important;
    grid-template-columns:repeat(2,minmax(0,1fr))!important;
    gap:8px!important
  }
  #parent-diagnostic-container,#parent-accompaniment-container{
    width:100%!important;
    min-width:0!important;
    padding:11px!important;
    border-radius:11px!important
  }
  .parent-backup-card{
    grid-column:1 / -1!important;
    width:100%!important;
    min-width:0!important;
    padding:11px!important;
    border-radius:11px!important
  }
}
