/* v1.3 learning progress */

.progress-v13 {
  background:
    radial-gradient(circle at 50% -8%, rgba(37, 99, 235, 0.08), transparent 30rem),
    var(--bg);
}

.progress-shell {
  padding-top: 0;
  padding-bottom: calc(7rem + env(safe-area-inset-bottom));
}

.progress-hero {
  margin: 0 -1rem 1rem;
  padding: calc(0.55rem + env(safe-area-inset-top)) 1rem 1rem;
  border-bottom-left-radius: 28px;
  border-bottom-right-radius: 28px;
  background: linear-gradient(160deg, var(--card), color-mix(in srgb, var(--primary) 7%, var(--card)));
  box-shadow: 0 10px 28px rgba(15, 23, 42, 0.06);
}

.progress-topline {
  min-height: 44px;
  display: grid;
  grid-template-columns: 44px 1fr 44px;
  align-items: center;
}

.progress-back {
  min-width: 44px;
  min-height: 44px;
  display: grid;
  place-items: center;
  border: 1px solid var(--border);
  border-radius: 14px;
  color: var(--text);
  background: var(--card);
  text-decoration: none;
  font-size: 1.7rem;
  line-height: 1;
}

.progress-brand {
  justify-self: center;
  min-height: 44px;
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  color: var(--text);
  text-decoration: none;
  font-size: 0.78rem;
}

.progress-brand span {
  font-size: 1.3rem;
}

.progress-spacer {
  width: 44px;
  height: 44px;
}

.progress-page-kicker {
  margin: 0.8rem 0 0;
  color: var(--primary);
  font-size: 0.68rem;
  font-weight: 800;
  letter-spacing: 0.09em;
}

.progress-hero h1 {
  margin: 0.12rem 0 0;
  font-size: 1.45rem;
}

.progress-hero > p:last-child {
  margin: 0.4rem 0 0;
  color: var(--muted);
  font-size: 0.82rem;
}

.progress-section {
  margin-bottom: 1rem;
  padding: 1rem;
  border: 1px solid color-mix(in srgb, var(--border) 78%, transparent);
  border-radius: 20px;
  background: var(--card);
  box-shadow: 0 6px 20px rgba(15, 23, 42, 0.045);
}

.progress-overview-section {
  border-color: color-mix(in srgb, var(--primary) 24%, var(--border));
}

.progress-improved-section {
  border-color: color-mix(in srgb, var(--correct) 24%, var(--border));
}

.progress-section-heading {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 0.8rem;
  margin-bottom: 0.8rem;
}

.progress-section-heading p {
  margin: 0;
  color: var(--primary);
  font-size: 0.66rem;
  font-weight: 800;
  letter-spacing: 0.08em;
}

.progress-section-heading h2 {
  margin: 0.12rem 0 0;
  font-size: 1.05rem;
}

.progress-metric-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.55rem;
}

.progress-metric {
  min-height: 92px;
  padding: 0.72rem 0.45rem;
  border-radius: 15px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  background: var(--bg);
  border: 1px solid var(--border);
}

.progress-metric-primary {
  background: color-mix(in srgb, var(--primary) 8%, var(--card));
  border-color: color-mix(in srgb, var(--primary) 20%, var(--border));
}

.progress-metric strong {
  font-size: 1.35rem;
  line-height: 1.1;
}

.progress-metric strong small {
  font-size: 0.68rem;
  margin-left: 0.1rem;
}

.progress-metric span {
  margin-top: 0.25rem;
  color: var(--muted);
  font-size: 0.64rem;
}

.progress-note {
  margin: 0.75rem 0 0;
  color: var(--muted);
  font-size: 0.72rem;
  line-height: 1.6;
}

.progress-week-summary {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.55rem;
}

.progress-week-summary > div {
  min-height: 88px;
  padding: 0.7rem 0.45rem;
  border-radius: 14px;
  text-align: center;
  background: var(--bg);
  border: 1px solid var(--border);
}

.progress-week-summary small,
.progress-week-summary strong,
.progress-week-summary span {
  display: block;
}

.progress-week-summary small {
  color: var(--muted);
  font-size: 0.62rem;
}

.progress-week-summary strong {
  margin-top: 0.18rem;
  font-size: 1.25rem;
}

.progress-week-summary strong span {
  display: inline;
  margin-left: 0.1rem;
  font-size: 0.66rem;
}

.activity-chart {
  height: 190px;
  display: grid;
  grid-template-columns: repeat(14, minmax(0, 1fr));
  gap: 0.25rem;
  align-items: end;
  padding: 0.4rem 0 0;
}

.activity-day {
  min-width: 0;
  height: 100%;
  display: grid;
  grid-template-rows: 20px 1fr 18px;
  align-items: end;
  text-align: center;
}

.activity-count {
  min-height: 20px;
  overflow: hidden;
  color: var(--muted);
  font-size: 0.56rem;
  line-height: 20px;
}

.activity-bar-track {
  position: relative;
  height: 100%;
  min-height: 110px;
  overflow: hidden;
  border-radius: 7px 7px 4px 4px;
  background: color-mix(in srgb, var(--track) 72%, transparent);
}

.activity-bar-track span {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  min-height: 3px;
  border-radius: 6px 6px 3px 3px;
  background: var(--primary);
}

.activity-day small {
  overflow: hidden;
  color: var(--muted);
  font-size: 0.5rem;
  white-space: nowrap;
}

.improved-card {
  display: grid;
  grid-template-columns: 48px minmax(0, 1fr);
  gap: 0.75rem;
  align-items: center;
  padding: 0.85rem;
  border-radius: 15px;
  background: color-mix(in srgb, var(--correct-bg) 68%, var(--card));
  border: 1px solid color-mix(in srgb, var(--correct) 22%, var(--border));
}

.improved-icon {
  width: 48px;
  height: 48px;
  display: grid;
  place-items: center;
  border-radius: 14px;
  color: var(--correct);
  background: var(--card);
  font-size: 1.25rem;
  font-weight: 900;
}

.improved-card small,
.improved-card strong,
.improved-card span {
  display: block;
}

.improved-card small {
  color: var(--correct);
  font-size: 0.64rem;
  font-weight: 800;
}

.improved-card strong {
  margin-top: 0.08rem;
  font-size: 0.86rem;
  line-height: 1.45;
}

.improved-card span {
  margin-top: 0.15rem;
  color: var(--muted);
  font-size: 0.7rem;
}

.progress-help {
  margin: -0.15rem 0 0.8rem;
  color: var(--muted);
  font-size: 0.7rem;
  line-height: 1.55;
}

.chapter-trend-card {
  margin-top: 0.6rem;
  padding: 0.8rem;
  border: 1px solid var(--border);
  border-radius: 15px;
  background: var(--bg);
}

.chapter-trend-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.7rem;
}

.chapter-trend-head > div {
  min-width: 0;
}

.chapter-trend-head > div > span {
  display: block;
  color: var(--primary);
  font-size: 0.66rem;
  font-weight: 800;
}

.chapter-trend-head strong {
  display: block;
  margin-top: 0.08rem;
  overflow: hidden;
  font-size: 0.8rem;
  line-height: 1.4;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.trend-chip {
  flex: 0 0 auto;
  padding: 0.2rem 0.55rem;
  border-radius: 999px;
  font-size: 0.64rem;
  font-weight: 800;
  border: 1px solid var(--border);
}

.trend-chip.is-up {
  color: var(--correct);
  background: var(--correct-bg);
  border-color: color-mix(in srgb, var(--correct) 24%, var(--border));
}

.trend-chip.is-down {
  color: var(--wrong);
  background: var(--wrong-bg);
  border-color: color-mix(in srgb, var(--wrong) 24%, var(--border));
}

.trend-chip.is-neutral {
  color: var(--muted);
  background: var(--card);
}

.chapter-trend-metrics {
  margin-top: 0.7rem;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.55rem;
}

.chapter-trend-metrics > div {
  padding: 0.6rem;
  border-radius: 12px;
  background: var(--card);
  border: 1px solid var(--border);
}

.chapter-trend-metrics small,
.chapter-trend-metrics strong,
.chapter-trend-metrics span {
  display: block;
}

.chapter-trend-metrics small {
  color: var(--muted);
  font-size: 0.6rem;
}

.chapter-trend-metrics strong {
  margin-top: 0.1rem;
  font-size: 1rem;
}

.chapter-trend-metrics span {
  color: var(--muted);
  font-size: 0.62rem;
}

.lifetime-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.55rem;
}

.lifetime-grid > div {
  min-height: 94px;
  padding: 0.7rem 0.4rem;
  border-radius: 14px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  background: var(--bg);
  border: 1px solid var(--border);
}

.lifetime-grid strong {
  font-size: 1.15rem;
  line-height: 1.15;
}

.lifetime-grid strong small {
  display: block;
  margin-top: 0.1rem;
  color: var(--muted);
  font-size: 0.58rem;
}

.lifetime-grid span {
  margin-top: 0.25rem;
  color: var(--muted);
  font-size: 0.62rem;
}

.progress-actions {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  margin-top: 0.8rem;
}

.progress-actions .btn {
  border-radius: 13px;
}

.progress-empty {
  padding: 1rem;
  border-radius: 14px;
  background: var(--bg);
}

.progress-empty strong,
.progress-empty span {
  display: block;
}

.progress-empty strong {
  font-size: 0.84rem;
}

.progress-empty span {
  margin-top: 0.2rem;
  color: var(--muted);
  font-size: 0.72rem;
  line-height: 1.55;
}

.progress-empty-good {
  border: 1px solid color-mix(in srgb, var(--correct) 20%, var(--border));
  background: color-mix(in srgb, var(--correct-bg) 65%, var(--card));
}

.progress-about p {
  font-size: 0.78rem;
}

.progress-footer {
  margin-bottom: 1rem;
}

.progress-bottom-nav {
  position: fixed;
  z-index: 50;
  left: max(0.65rem, env(safe-area-inset-left));
  right: max(0.65rem, env(safe-area-inset-right));
  bottom: max(0.65rem, env(safe-area-inset-bottom));
  max-width: 460px;
  min-height: 68px;
  margin: 0 auto;
  padding: 0.4rem 0.3rem;
  border: 1px solid var(--border);
  border-radius: 22px;
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  background: color-mix(in srgb, var(--card) 94%, transparent);
  box-shadow: 0 12px 34px rgba(15, 23, 42, 0.18);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
}

.progress-bottom-nav a {
  min-width: 0;
  min-height: 56px;
  border-radius: 17px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.05rem;
  color: var(--muted);
  text-decoration: none;
  font-weight: 800;
}

.progress-bottom-nav a span {
  font-size: 1.1rem;
  line-height: 1;
}

.progress-bottom-nav a small {
  font-size: 0.6rem;
  line-height: 1.2;
}

@media (max-width: 360px) {
  .progress-metric-grid,
  .progress-week-summary,
  .lifetime-grid {
    gap: 0.38rem;
  }

  .chapter-trend-head strong {
    white-space: normal;
  }

  .activity-chart {
    gap: 0.16rem;
  }
}

@media (min-width: 700px) {
  .progress-v13 .progress-shell {
    max-width: 560px;
  }

  .progress-bottom-nav {
    max-width: 540px;
  }
}


/* ===== v1.7 desktop progress layout ===== */
@media (min-width: 900px) {
  .progress-v13 {
    background:
      radial-gradient(circle at 10% 6%, rgba(124, 153, 87, 0.08), transparent 28rem),
      radial-gradient(circle at 90% 8%, rgba(37, 99, 235, 0.07), transparent 24rem),
      #f8f7f3;
  }

  .progress-v13 .progress-shell {
    max-width: 1080px;
    padding-top: 1rem;
    padding-bottom: 4rem;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.1rem 1.2rem;
    align-items: start;
  }

  .progress-hero,
  .progress-section[aria-labelledby="chart-title"],
  .progress-section[aria-labelledby="lifetime-title"],
  .progress-about,
  .progress-footer {
    grid-column: 1 / -1;
  }

  .progress-hero {
    margin: 0 0 0.15rem;
    padding: 1rem 1.2rem 1.2rem;
    border: 1px solid var(--border);
    border-radius: 24px;
    background: linear-gradient(145deg, var(--card), color-mix(in srgb, var(--primary) 5%, var(--card)));
    box-shadow: 0 8px 24px rgba(15, 23, 42, 0.04);
  }

  .progress-section {
    margin-bottom: 0;
    padding: 1.25rem;
    border-radius: 22px;
  }

  .progress-metric-grid,
  .progress-week-summary,
  .lifetime-grid {
    gap: 0.75rem;
  }

  .activity-chart {
    height: 230px;
    gap: 0.4rem;
  }

  .progress-bottom-nav {
    display: none;
  }

  .progress-footer {
    margin: 0;
  }
}
