/* ==========================================================================
   DASHBOARD RESPONSIVE SYSTEM — AURORA DASHBOARD ONLY
   Target: #jlpt180-ag-root dashboard shell
   Do not target: Shadow DOM, learn-app, .ag-app- child popup screens
   ========================================================================== */

/* Scope only the page that contains Aurora. Do not lock vertical scroll. */
html:has(#jlpt180-ag-root),
body:has(#jlpt180-ag-root){
  overflow-x: clip;
}

#jlpt180-ag-root.jlpt180-ag{
  width: 100vw;
  max-width: 100vw;
  min-height: 100dvh;
  height: auto;
  overflow: visible;
  margin-left: calc(50% - 50vw);
  margin-right: calc(50% - 50vw);
  padding: clamp(10px, 1.2vw, 18px);
  font-size: 14px;
  line-height: 1.45;
}

#jlpt180-ag-root,
#jlpt180-ag-root *{
  box-sizing: border-box;
}

#jlpt180-ag-root .ag-shell{
  width: 100%;
  max-width: none;
  min-height: calc(100dvh - clamp(20px, 2.4vw, 36px));
  height: auto;
  display: grid;
  grid-template-columns: clamp(220px, 18vw, 260px) minmax(0, 1fr);
  gap: clamp(12px, 1.4vw, 24px);
  padding: 0;
  margin: 0;
  overflow: visible;
  align-items: start;
}

#jlpt180-ag-root .ag-sidebar{
  position: sticky;
  top: clamp(10px, 1.2vw, 18px);
  max-height: calc(100dvh - clamp(20px, 2.4vw, 36px));
  overflow-y: auto;
  overflow-x: hidden;
  align-self: start;
}

#jlpt180-ag-root .ag-main{
  width: 100%;
  max-width: none;
  min-width: 0;
  overflow: visible;
  padding: 0;
  margin: 0;
}

#jlpt180-ag-root .ag-topbar{
  margin: 0 0 clamp(10px, 1.1vw, 16px);
  padding: 0 clamp(2px, .4vw, 6px);
  min-height: 44px;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

#jlpt180-ag-root .ag-topbar h1{
  margin: 4px 0 0;
  font-size: clamp(26px, 2.25vw, 34px);
  line-height: 1.12;
  letter-spacing: -0.02em;
}

#jlpt180-ag-root .ag-eyebrow{
  margin: 0;
  font-size: clamp(11px, .86vw, 13px);
  line-height: 1.25;
}

#jlpt180-ag-root .ag-hero{
  width: 100%;
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr)) minmax(80px, 120px);
  gap: clamp(10px, 1vw, 14px);
  margin: 0 0 clamp(12px, 1.2vw, 18px);
  align-items: stretch;
}

#jlpt180-ag-root .ag-stat-card{
  min-height: clamp(78px, 8.5vw, 112px);
  padding: clamp(12px, 1.2vw, 18px);
  border-radius: clamp(16px, 1.4vw, 22px);
}

#jlpt180-ag-root .ag-stat-card b{
  font-size: clamp(24px, 2.2vw, 34px);
  line-height: 1.05;
}

#jlpt180-ag-root .ag-stat-card small,
#jlpt180-ag-root .ag-stat-card span{
  line-height: 1.22;
}

#jlpt180-ag-root .ag-hero-mascot{
  width: clamp(76px, 7vw, 112px);
  max-width: 100%;
  justify-self: center;
  align-self: center;
}

#jlpt180-ag-root .ag-route-switcher{
  width: 100%;
  min-height: auto;
  padding: clamp(14px, 1.45vw, 22px);
  margin: 0 0 clamp(12px, 1.25vw, 18px);
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(320px, 520px) auto;
  gap: clamp(12px, 1.2vw, 18px);
  align-items: center;
  overflow: visible;
}

#jlpt180-ag-root .ag-route-current b{
  display: block;
  max-width: 100%;
  white-space: normal;
  overflow: visible;
  text-overflow: clip;
  line-height: 1.12;
  word-break: break-word;
  font-size: clamp(30px, 3vw, 46px);
  letter-spacing: -0.02em;
}

#jlpt180-ag-root .ag-route-current small{
  display: block;
  margin-top: 4px;
  font-size: clamp(12px, .95vw, 14px);
  line-height: 1.35;
}

#jlpt180-ag-root .ag-route-levels{
  display: grid;
  grid-template-columns: repeat(6, minmax(54px, 1fr));
  gap: 6px;
  min-width: 0;
}

#jlpt180-ag-root .ag-route-levels button{
  min-height: 38px;
  padding: 0 10px;
  border-radius: 999px;
  font-size: clamp(12px, .9vw, 14px);
}

#jlpt180-ag-root .ag-route-change{
  min-height: 40px;
  padding: 0 clamp(16px, 1.5vw, 22px);
  border-radius: 16px;
  white-space: nowrap;
}

#jlpt180-ag-root .ag-board{
  width: 100%;
  margin: 0;
  padding: clamp(14px, 1.4vw, 22px);
  border-radius: clamp(18px, 1.6vw, 24px);
  overflow: visible;
}

#jlpt180-ag-root .ag-section-head{
  margin-bottom: clamp(10px, 1vw, 16px);
  min-height: 38px;
}

#jlpt180-ag-root .ag-section-head h2{
  margin: 0;
  font-size: clamp(21px, 1.7vw, 28px);
  line-height: 1.15;
}

#jlpt180-ag-root .ag-section-head p{
  margin: 3px 0 0;
  font-size: clamp(12px, .95vw, 14px);
  line-height: 1.32;
}

#jlpt180-ag-root .ag-steps{
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: clamp(10px, 1vw, 14px);
  align-items: stretch;
}

#jlpt180-ag-root .ag-step{
  min-height: clamp(155px, 14.2vw, 224px);
  padding: clamp(12px, 1.2vw, 18px);
  border-radius: clamp(16px, 1.4vw, 22px);
  overflow: hidden;
}

#jlpt180-ag-root .ag-step img{
  width: clamp(36px, 3.6vw, 56px);
  height: clamp(36px, 3.6vw, 56px);
  object-fit: contain;
}

#jlpt180-ag-root .ag-step h3{
  font-size: clamp(17px, 1.35vw, 22px);
  line-height: 1.15;
  margin: 6px 0 4px;
}

#jlpt180-ag-root .ag-step p{
  font-size: clamp(12px, .95vw, 14px);
  line-height: 1.32;
  margin: 0;
}

#jlpt180-ag-root .ag-step a{
  min-height: clamp(34px, 3vw, 44px);
  border-radius: 14px;
}

/* Width breakpoints */
@media (max-width: 1439px) and (min-width: 1024px){
  #jlpt180-ag-root .ag-shell{
    grid-template-columns: 220px minmax(0, 1fr);
    gap: 14px;
  }

  #jlpt180-ag-root .ag-route-switcher{
    grid-template-columns: minmax(0, 1fr) minmax(280px, 420px) auto;
  }

  #jlpt180-ag-root .ag-step{
    min-height: 155px;
  }
}

@media (max-width: 1023px) and (min-width: 768px){
  #jlpt180-ag-root .ag-shell{
    grid-template-columns: 86px minmax(0,1fr);
  }

  #jlpt180-ag-root .ag-sidebar .ag-brand div,
  #jlpt180-ag-root .ag-sidebar .ag-menu a:not(.is-active) span + *{
    display: none;
  }

  #jlpt180-ag-root .ag-route-switcher{
    grid-template-columns: 1fr;
  }

  #jlpt180-ag-root .ag-steps{
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 767px){
  #jlpt180-ag-root.jlpt180-ag{
    width: 100%;
    max-width: 100%;
    margin: 0;
    padding: 12px;
  }

  #jlpt180-ag-root .ag-shell{
    grid-template-columns: 1fr;
    min-height: auto;
  }

  #jlpt180-ag-root .ag-sidebar{
    display: none;
  }

  #jlpt180-ag-root .ag-hero,
  #jlpt180-ag-root .ag-steps{
    grid-template-columns: 1fr;
  }

  #jlpt180-ag-root .ag-route-switcher{
    grid-template-columns: 1fr;
  }
}

/* Height breakpoint: compress, never clip */
@media (max-height: 760px) and (min-width: 901px){
  #jlpt180-ag-root.jlpt180-ag{
    padding: 8px 10px;
  }

  #jlpt180-ag-root .ag-shell{
    gap: 12px;
  }

  #jlpt180-ag-root .ag-stat-card{
    min-height: 70px;
    padding: 10px 12px;
  }

  #jlpt180-ag-root .ag-stat-card b{
    font-size: 24px;
  }

  #jlpt180-ag-root .ag-route-switcher{
    padding: 12px 16px;
  }

  #jlpt180-ag-root .ag-step{
    min-height: 145px;
    padding: 11px 10px;
  }

  #jlpt180-ag-root .ag-step img{
    width: 34px;
    height: 34px;
  }
}
