/* Copeak responsive home + focused learner analytics, Nov 2026.
   Loaded last to resolve older desktop-only and cramped-phone rules. */

/* 1. A wider, taller wave, with individual ribbons moving at different phases. */
#homeScreen.cp-dashboard-mode.active #cpVoiceAtmosphere .cp-fx-waves {
  top:9%;
  left:-4%;
  width:108%;
  height:47%;
  opacity:.98;
  mix-blend-mode:screen;
}
#homeScreen.cp-dashboard-mode.active #cpVoiceAtmosphere .cp-fx-wave-canvas {
  filter:drop-shadow(0 0 9px rgba(40,205,255,.48))
         drop-shadow(0 0 8px rgba(255,198,95,.2));
}
#homeScreen.cp-dashboard-mode.active #cpVoiceAtmosphere .cp-fx-meteor {
  width:clamp(90px,9vw,155px);
}
#homeScreen.cp-dashboard-mode.active #cpVoiceAtmosphere .cp-fx-star:nth-child(7n) {
  filter:drop-shadow(0 0 5px rgba(178,239,255,.75));
}

/* 2. Give the learning ring the space available without duplicating statistics. */
#copeakHomeHub .cp-extra.cp-activity-premium {
  overflow:hidden;
}
#copeakHomeHub .cp-activity-premium .cp-record-header {
  min-height:24px;
}
#copeakHomeHub .cp-activity-premium .cp-record-content {
  display:grid;
  grid-template-columns:clamp(116px,11.5vw,158px) minmax(0,1fr);
  align-items:center;
  gap:clamp(12px,1.5vw,25px);
  min-width:0;
  height:calc(100% - 28px);
  margin-top:4px;
}
#copeakHomeHub .cp-activity-premium .cp-ring-stack {
  min-width:0;
  width:100%;
}
#copeakHomeHub .cp-activity-premium .cp-progress-ring {
  width:100%;
  height:auto;
  aspect-ratio:1;
  max-width:158px;
  max-height:158px;
  filter:drop-shadow(0 0 15px rgba(49,206,255,.11));
}
#copeakHomeHub .cp-activity-premium .cp-ring-track {
  stroke-width:12px;
}
#copeakHomeHub .cp-activity-premium .cp-ring-progress {
  stroke-width:12px;
}
#copeakHomeHub .cp-activity-premium .cp-ring-halo {
  stroke-width:17px;
}
#copeakHomeHub .cp-activity-premium .cp-progress-core strong {
  font-size:clamp(20px,2.05vw,30px);
  letter-spacing:-.045em;
}
#copeakHomeHub .cp-activity-premium .cp-progress-core small {
  font-size:clamp(9px,.78vw,11px);
}
#copeakHomeHub .cp-activity-premium .cp-record-metrics {
  display:grid;
  grid-template-columns:minmax(0,.86fr) minmax(0,1.14fr);
  grid-template-rows:minmax(0,1fr) minmax(0,1fr);
  align-items:center;
  row-gap:clamp(10px,1.4vh,18px);
  column-gap:clamp(12px,1.7vw,25px);
  min-width:0;
  height:100%;
}
#copeakHomeHub .cp-activity-premium .cp-record-stat {
  min-width:0;
  min-height:0;
  gap:3px;
}
#copeakHomeHub .cp-activity-premium .cp-record-streak {
  grid-column:1;grid-row:1;
}
#copeakHomeHub .cp-activity-premium .cp-record-stat-total {
  grid-column:1;grid-row:2;
}
#copeakHomeHub .cp-activity-premium .cp-record-average {
  grid-column:2;grid-row:1;
}
#copeakHomeHub .cp-activity-premium .cp-record-last {
  grid-column:2;grid-row:2;
}
#copeakHomeHub .cp-activity-premium .cp-record-stat strong {
  font-size:clamp(19px,2.05vw,30px);
  line-height:1.04;
}
#copeakHomeHub .cp-activity-premium .cp-record-last strong {
  color:#a6eaff;
  font-weight:840;
}
#copeakHomeHub .cp-activity-premium .cp-record-stat-label {
  color:#c6deef;
  font-size:clamp(10px,.82vw,12px);
  line-height:1.32;
}
#copeakHomeHub .cp-activity-premium .cp-average-meter {
  max-width:165px;
  width:100%;
}
#copeakHomeHub .cp-home-extras {
  min-height:0;
}
#copeakHomeHub .cp-home-extras .cp-extra {
  min-width:0;
}

/* 3. Desktop: keep the entire dashboard in view and avoid stretched analytics. */
@media (min-width:1191px) and (min-height:736px) {
  #copeakHomeHub {
    grid-template-rows:
      clamp(200px,30dvh,300px)
      clamp(158px,24dvh,222px)
      minmax(160px,1fr)
      clamp(52px,7dvh,68px)!important;
    gap:clamp(8px,1.3dvh,16px);
  }
}
@media (min-width:1191px) and (max-height:735px) {
  #copeakHomeHub {
    grid-template-rows:clamp(155px,27dvh,213px)
      clamp(128px,23dvh,170px)
      minmax(120px,1fr)
      50px!important;
    gap:clamp(6px,1.1dvh,10px);
  }
  #copeakHomeHub .cp-activity-premium .cp-record-content {
    grid-template-columns:clamp(89px,8vw,114px) minmax(0,1fr);
  }
  #copeakHomeHub .cp-activity-premium .cp-progress-core strong {
    font-size:clamp(16px,1.5vw,24px);
  }
  #copeakHomeHub .cp-activity-premium .cp-record-metrics {
    row-gap:3px;
  }
}

/* 4. iPad, Android tablets, and small laptops. Never crop a learning metric. */
@media (min-width:701px) and (max-width:1190px) {
  body.copeak-home-mode #homeScreen.cp-dashboard-mode.active {
    padding:
      max(10px,env(safe-area-inset-top))
      max(12px,env(safe-area-inset-right))
      max(9px,env(safe-area-inset-bottom))
      max(12px,env(safe-area-inset-left))!important;
    overflow-y:auto!important;
    overscroll-behavior:contain;
  }
  #copeakHomeHub {
    height:auto;
    min-height:100%;
    grid-template-rows:clamp(155px,22dvh,235px)
      minmax(225px,1fr)
      clamp(168px,24dvh,220px)
      clamp(51px,7dvh,62px)!important;
    gap:clamp(8px,1.25dvh,14px);
  }
  #copeakHomeHub .cp-home-header {min-height:0}
  #copeakHomeHub .cp-home-cards {
    grid-template-columns:repeat(2,minmax(0,1fr))!important;
    grid-template-rows:repeat(2,minmax(0,1fr))!important;
  }
  #copeakHomeHub .cp-activity-premium .cp-record-content {
    grid-template-columns:clamp(94px,12vw,125px) minmax(0,1fr);
    gap:clamp(7px,1vw,13px);
  }
  #copeakHomeHub .cp-activity-premium .cp-record-metrics {
    gap:clamp(6px,.8vw,10px);
  }
  #copeakHomeHub .cp-activity-premium .cp-record-stat strong {
    font-size:clamp(16px,2.3vw,22px);
  }
  #copeakHomeHub .cp-activity-premium .cp-progress-core strong {
    font-size:clamp(17px,2.35vw,25px);
  }
}

/* 5. iPhone / Android: keep all sections reachable. The nav stays visible
   during short-screen scrolling instead of hiding stats or truncating content. */
@media (max-width:700px) {
  body.copeak-home-mode #homeScreen.cp-dashboard-mode.active {
    display:block!important;
    width:100%!important;
    height:100dvh!important;
    max-width:none!important;
    min-height:0!important;
    overflow-y:auto!important;
    overflow-x:hidden!important;
    overscroll-behavior:contain;
    padding:
      max(8px,env(safe-area-inset-top))
      max(9px,env(safe-area-inset-right))
      max(8px,env(safe-area-inset-bottom))
      max(9px,env(safe-area-inset-left))!important;
  }
  #copeakHomeHub {
    box-sizing:border-box;
    height:auto!important;
    min-height:100%;
    width:100%!important;
    grid-template-rows:
      clamp(109px,16dvh,150px)
      minmax(265px,36dvh)
      auto
      54px!important;
    gap:clamp(7px,1.1dvh,11px)!important;
  }
  #copeakHomeHub .cp-home-header {
    height:100%!important;
    min-height:0!important;
  }
  #copeakHomeHub .cp-home-cards {
    grid-template-columns:repeat(2,minmax(0,1fr))!important;
    grid-template-rows:repeat(2,minmax(0,1fr))!important;
    gap:clamp(7px,1.5vw,10px)!important;
    min-height:0!important;
  }
  #copeakHomeHub .cp-home-extras {
    display:grid!important;
    grid-template-columns:minmax(0,1fr)!important;
    grid-auto-rows:auto;
    gap:8px!important;
    min-height:0!important;
  }
  #copeakHomeHub .cp-home-extras > .cp-extra,
  #copeakHomeHub .cp-home-extras > .cp-extra.cp-activity-premium {
    display:flex!important;
    height:auto!important;
    min-height:101px!important;
    padding:10px 12px!important;
    border-radius:16px!important;
  }
  #copeakHomeHub .cp-home-extras > .cp-extra:first-child {
    flex-direction:column!important;
    align-items:stretch!important;
    justify-content:flex-start!important;
    gap:3px!important;
    min-height:125px!important;
  }
  #copeakHomeHub .cp-home-extras > .cp-extra:first-child h3 {
    font-size:12px!important;
  }
  #copeakHomeHub .cp-home-extras > .cp-extra:first-child p {
    font-size:10px!important;
  }
  #copeakHomeHub .cp-home-extras > .cp-extra:first-child .cp-recent-list {
    margin-top:2px!important;
    width:100%;
    gap:1px!important;
  }
  #copeakHomeHub .cp-home-extras > .cp-extra:first-child .cp-recent-row {
    display:flex!important;
    font-size:clamp(10px,2.65vw,12px)!important;
    padding:4px 0!important;
    color:#e7f6ff;
  }
  #copeakHomeHub .cp-home-extras > .cp-extra:first-child .cp-recent-row small {
    color:#aaccf1;
  }
  #copeakHomeHub .cp-home-extras > .cp-extra.cp-activity-premium {
    flex-direction:column;
    justify-content:space-between;
    min-height:168px!important;
  }
  #copeakHomeHub .cp-activity-premium .cp-record-header {
    min-height:22px;
  }
  #copeakHomeHub .cp-activity-premium .cp-record-header h3 {
    font-size:12px;
  }
  #copeakHomeHub .cp-activity-premium .cp-record-content {
    display:grid!important;
    grid-template-columns:clamp(88px,24vw,119px) minmax(0,1fr)!important;
    align-items:center;
    height:auto!important;
    min-height:117px;
    gap:clamp(9px,2.4vw,17px)!important;
    margin-top:5px!important;
  }
  #copeakHomeHub .cp-activity-premium .cp-ring-stack {width:100%}
  #copeakHomeHub .cp-activity-premium .cp-progress-ring {
    width:100%!important;
    height:auto!important;
    aspect-ratio:1;
    max-width:119px!important;
    max-height:119px!important;
  }
  #copeakHomeHub .cp-activity-premium .cp-progress-core strong {
    font-size:clamp(16px,4.2vw,22px)!important;
  }
  #copeakHomeHub .cp-activity-premium .cp-progress-core small {
    font-size:clamp(8px,2vw,10px)!important;
  }
  #copeakHomeHub .cp-activity-premium .cp-record-metrics {
    display:grid!important;
    grid-template-columns:minmax(0,1fr) minmax(0,1.1fr)!important;
    grid-template-rows:repeat(2,minmax(0,1fr))!important;
    height:100%!important;
    gap:7px 9px!important;
  }
  #copeakHomeHub .cp-activity-premium .cp-record-stat-label {
    font-size:clamp(9px,2.2vw,11px)!important;
  }
  #copeakHomeHub .cp-activity-premium .cp-record-stat-label small {
    display:none!important;
  }
  #copeakHomeHub .cp-activity-premium .cp-record-stat strong {
    font-size:clamp(15px,3.85vw,20px)!important;
  }
  #copeakHomeHub .cp-activity-premium .cp-average-meter {
    height:5px!important;
    margin-top:3px!important;
    width:100%!important;
    max-width:110px!important;
  }
  #copeakHomeHub .cp-home-bottom {
    position:sticky!important;
    bottom:0;
    z-index:10;
    width:100%!important;
    min-height:54px!important;
    margin-top:0;
    padding:4px!important;
    background:rgba(2,33,77,.95)!important;
    backdrop-filter:blur(15px);
    -webkit-backdrop-filter:blur(15px);
  }
  #copeakHomeHub .cp-nav {
    min-height:41px;
    padding:4px 2px;
  }
  #cpVoiceAtmosphere .cp-fx-stars .cp-fx-star:nth-child(2n) {
    display:none;
  }
  #homeScreen.cp-dashboard-mode.active #cpVoiceAtmosphere .cp-fx-waves {
    left:-4%;width:108%;top:15%;height:32%;opacity:.72;
  }
  #cpVoiceAtmosphere .cp-fx-meteor:nth-child(n+6) {
    display:none;
  }
}
/* Compact smartphones: no horizontal overflow even at 320px. */
@media (max-width:375px) {
  #copeakHomeHub .cp-activity-premium .cp-record-content {
    grid-template-columns:86px minmax(0,1fr)!important;
    gap:8px!important;
  }
  #copeakHomeHub .cp-activity-premium .cp-record-metrics {
    column-gap:6px!important;
  }
  #copeakHomeHub .cp-activity-premium .cp-record-stat strong {
    font-size:14px!important;
  }
  #copeakHomeHub .cp-activity-premium .cp-record-stat-label {
    font-size:9px!important;
  }
  #copeakHomeHub .cp-home-cards > .cp-action {
    min-width:0!important;
  }
  #copeakHomeHub .cp-home-cards > .cp-action .cp-action-title {
    font-size:clamp(11px,3.3vw,13px)!important;
  }
}
/* Phone landscape: do not hide the learning panel solely due to low height. */
@media (max-height:620px) and (min-width:701px) and (max-width:1190px) {
  #copeakHomeHub {
    grid-template-rows:112px minmax(205px,auto) minmax(148px,auto) 50px!important;
    min-height:100%;
    height:auto!important;
  }
  #copeakHomeHub .cp-home-extras {
    display:grid!important;
    grid-template-columns:1fr 1fr!important;
  }
  #copeakHomeHub .cp-home-bottom {
    position:sticky;
    bottom:0;
    z-index:8;
  }
}
@media (prefers-reduced-motion:reduce) {
  #homeScreen.cp-dashboard-mode.active #cpVoiceAtmosphere .cp-fx-waves {
    opacity:.56;
  }
}


/*
 * iPad / full-size tablet: preserve the desktop four-across learning menu.
 * Loaded after both old 2x2 tablet media rules. Do not affect smartphones,
 * including landscape phones with a very short content viewport.
 */
@media (min-width:740px) and (max-width:1190px) and (min-height:540px) {
  body.copeak-home-mode #homeScreen.cp-dashboard-mode.active {
    overflow-x:hidden!important;
    overflow-y:auto!important;
  }
  #copeakHomeHub {
    grid-template-rows:
      clamp(152px,30dvh,315px)
      clamp(158px,25dvh,255px)
      clamp(160px,27dvh,280px)
      clamp(52px,7dvh,70px)!important;
    gap:clamp(7px,1.1dvh,13px)!important;
    height:auto!important;
    min-height:100%!important;
    width:min(1560px,100%)!important;
  }
  #copeakHomeHub .cp-home-cards {
    display:grid!important;
    grid-template-columns:repeat(4,minmax(0,1fr))!important;
    grid-template-rows:minmax(0,1fr)!important;
    gap:clamp(7px,1.15vw,14px)!important;
    align-items:stretch!important;
    min-height:0!important;
  }
  #copeakHomeHub .cp-home-cards > .cp-action {
    display:flex!important;
    flex-direction:column!important;
    align-items:flex-start!important;
    justify-content:flex-end!important;
    text-align:left!important;
    gap:0!important;
    height:100%!important;
    min-width:0!important;
    min-height:0!important;
    padding:clamp(10px,1.25vw,18px)!important;
  }
  #copeakHomeHub .cp-home-cards > .cp-action .cp-action-icon {
    flex:0 0 auto!important;
    width:clamp(45px,5.9vw,66px)!important;
    height:clamp(45px,5.9vw,66px)!important;
    margin:0 0 auto!important;
  }
  #copeakHomeHub .cp-home-cards > .cp-action .cp-action-copy {
    flex:0 0 auto!important;
    width:100%!important;
    align-items:flex-start!important;
    justify-content:flex-end!important;
    text-align:left!important;
    gap:3px!important;
    margin:5px 0 0!important;
    padding:0 clamp(21px,2.45vw,32px) 0 0!important;
  }
  #copeakHomeHub .cp-home-cards > .cp-action .cp-action-title {
    font-size:clamp(12px,1.56vw,18px)!important;
    line-height:1.29!important;
    white-space:normal!important;
    overflow-wrap:anywhere!important;
  }
  #copeakHomeHub .cp-home-cards > .cp-action .cp-action-sub {
    font-size:clamp(9px,.98vw,12px)!important;
    line-height:1.26!important;
    white-space:normal!important;
  }
  #copeakHomeHub .cp-home-cards > .cp-action .cp-action-arrow {
    display:grid!important;
    width:clamp(27px,3vw,36px)!important;
    height:clamp(27px,3vw,36px)!important;
    right:clamp(7px,.9vw,13px)!important;
    bottom:clamp(9px,1.05vw,15px)!important;
  }
  #copeakHomeHub .cp-home-cards > .cp-action::before {
    background-size:410% auto!important;
  }
  #copeakHomeHub .cp-home-extras {
    grid-template-columns:minmax(0,1fr) minmax(0,1fr)!important;
  }
  #copeakHomeHub .cp-home-bottom {
    width:min(800px,94%)!important;
    min-height:50px!important;
  }
}
/* On narrow iPads the cards still remain four across, with smaller text
 * instead of forcing a second card row. */
@media (min-width:740px) and (max-width:850px) and (min-height:540px) {
  #copeakHomeHub {
    grid-template-rows:
      clamp(140px,27dvh,265px)
      clamp(150px,21dvh,196px)
      clamp(170px,27dvh,260px)
      clamp(50px,7dvh,62px)!important;
  }
  #copeakHomeHub .cp-home-cards > .cp-action {
    padding:9px!important;
    border-radius:15px!important;
  }
  #copeakHomeHub .cp-home-cards > .cp-action .cp-action-icon {
    width:clamp(39px,5.6vw,49px)!important;
    height:clamp(39px,5.6vw,49px)!important;
  }
  #copeakHomeHub .cp-home-cards > .cp-action .cp-action-title {
    font-size:clamp(11px,1.55vw,13px)!important;
  }
  #copeakHomeHub .cp-home-cards > .cp-action .cp-action-sub {
    font-size:9px!important;
  }
  #copeakHomeHub .cp-home-cards > .cp-action .cp-action-copy {
    padding-right:18px!important;
  }
  #copeakHomeHub .cp-home-cards > .cp-action .cp-action-arrow {
    width:25px!important;height:25px!important;right:6px!important;bottom:8px!important;
  }
}
