/**
 * Dory Stats Page Styles
 * Enhanced statistics and insights visualization
 *
 * @package tinywag
 * @since 2.1.0
 */

/* Profile highlight block on the hero section */
.dory-profile-highlight {
  display: grid;
  grid-template-columns: minmax(150px, 0.78fr) minmax(0, 1.22fr);
  gap: 1rem;
  align-items: start;
  margin: 0 0 1.25rem 0;
  text-align: left;
}

.dory-profile-photo {
  margin: 0;
  border-radius: 0.75rem;
  overflow: hidden;
  border: 1px solid #e2e8f0;
  background: #ffffff;
  width: 100%;
  max-width: 230px;
  justify-self: center;
  align-self: start;
}

.dory-profile-photo img {
  display: block;
  width: 100%;
  aspect-ratio: 4 / 3;
  height: auto;
  object-fit: cover;
  object-position: center;
}

.dory-profile-insight {
  padding: 1rem;
  border-radius: 0.75rem;
  border: 1px solid var(--accent-light);
  background: #f8fbff;
  text-align: left;
}

.dory-profile-insight-title {
  margin: 0 0 0.5rem 0;
  font-size: 0.875rem;
  font-weight: 700;
  color: var(--accent-dark);
}

.dory-profile-insight-lead {
  margin: 0 0 0.5rem 0;
  line-height: 1.6;
  color: #334155;
  font-size: 0.9375rem;
  font-weight: 600;
}

.dory-profile-insight-list {
  margin: 0 0 0.6rem 1.15rem;
  padding: 0;
  color: #334155;
  line-height: 1.7;
  font-size: 0.9375rem;
}

.dory-profile-insight-list li {
  margin: 0 0 0.35rem 0;
}

@media (max-width: 768px) {
  .dory-profile-highlight {
    grid-template-columns: 1fr;
  }

  .dory-profile-photo {
    max-width: 200px;
  }
}

/* ==========================================================================
   First 100 Days Timeline
   ========================================================================== */

.stats-first-100-days {
  padding: 2.5rem 0;
  background: var(--bg-body);
}

.stats-first-100-days .section-description {
  text-align: left;
  font-size: 1rem;
  color: var(--text-secondary, #4b5563);
  max-width: none;
  margin: 0.75rem 0 1.5rem;
  line-height: 1.6;
}

.matrix-reading-guide {
  background: #ffffff;
  border: 1px solid var(--accent-light);
  border-radius: var(--radius-lg);
  padding: 1rem 1.25rem;
  margin: 0 0 1.25rem 0;
}

.matrix-reading-guide h3 {
  margin: 0 0 0.75rem 0;
  font-size: 1rem;
  font-weight: 700;
  color: var(--accent-dark);
}

.matrix-reading-items {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 180px), 1fr));
  gap: 0.625rem;
}

.matrix-reading-item {
  display: flex;
  align-items: center;
  gap: 0.625rem;
  border-radius: 10px;
  padding: 0.625rem 0.75rem;
}

.matrix-reading-item--toilet_high {
  background: #dcfce7;
}

.matrix-reading-item--social_high {
  background: #dbeafe;
}

.matrix-reading-item--barking_high {
  background: #fef3c7;
}

.matrix-reading-item--balanced {
  background: #f1f5f9;
}

.matrix-reading-icon {
  font-size: 1.125rem;
  line-height: 1;
}

.matrix-reading-text {
  display: flex;
  flex-direction: column;
  line-height: 1.3;
}

.matrix-reading-text strong {
  font-size: 0.8125rem;
  color: #0f172a;
}

.matrix-reading-text small {
  font-size: 0.75rem;
  color: #475569;
}

.stats-first-100-days .milestone-matrix {
  margin: 1.5rem 0 2.25rem;
}

.stats-first-100-days .matrix-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.25rem;
  min-height: 104px;
  border-width: 1px;
  border-style: solid;
  border-color: transparent;
}

.stats-first-100-days .matrix-item--toilet_high {
  background: #dcfce7;
  color: #166534;
  border-color: #86efac;
}

.stats-first-100-days .matrix-item--social_high {
  background: #dbeafe;
  color: #1d4ed8;
  border-color: #93c5fd;
}

.stats-first-100-days .matrix-item--barking_high {
  background: #fef3c7;
  color: #92400e;
  border-color: #fcd34d;
}

.stats-first-100-days .matrix-item--balanced {
  background: #f1f5f9;
  color: #334155;
  border-color: #cbd5e1;
}

.matrix-focus-label {
  font-size: 0.6875rem;
  font-weight: 700;
  line-height: 1.2;
}

.month-key-logic {
  grid-column: 1 / -1;
  padding: 0.75rem;
  border-radius: 10px;
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  margin-bottom: 0.625rem;
}

.month-key-logic--toilet_high {
  background: #ecfdf5;
  border: 1px solid #a7f3d0;
}

.month-key-logic--social_high {
  background: #eff6ff;
  border: 1px solid #bfdbfe;
}

.month-key-logic--barking_high {
  background: #fffbeb;
  border: 1px solid #fcd34d;
}

.month-key-logic--balanced {
  background: var(--bg-body);
  border: 1px solid #cbd5e1;
}

.month-key-chip {
  font-size: 0.875rem;
  font-weight: 700;
  color: #0f172a;
}

.month-key-reason {
  font-size: 0.8125rem;
  color: #475569;
}

.merged-behavior-summary {
  background: #ffffff;
  border: 1px solid var(--accent-light);
  border-radius: var(--radius-lg);
  padding: 1rem 1.25rem;
  margin: 0 0 1.5rem 0;
}

.merged-behavior-summary h3 {
  margin: 0 0 0.375rem 0;
  font-size: 1rem;
  font-weight: 700;
  color: var(--accent-dark);
}

.merged-behavior-summary-caption {
  margin: 0 0 0.875rem 0;
  font-size: 0.8125rem;
  color: #475569;
  line-height: 1.5;
}

.merged-behavior-list {
  display: grid;
  gap: 0.625rem;
}

.merged-behavior-row {
  display: grid;
  grid-template-columns: minmax(180px, 1.1fr) minmax(0, 2fr);
  gap: 0.75rem;
  border: 1px solid #e2e8f0;
  border-radius: 10px;
  padding: 0.625rem 0.75rem;
  background: var(--bg-body);
}

.merged-behavior-row-main {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
}

.merged-age-label {
  font-size: 0.875rem;
  font-weight: 700;
  color: #0f172a;
  line-height: 1.3;
}

.merged-age-days {
  font-size: 0.75rem;
  color: #64748b;
  font-weight: 600;
}

.merged-behavior-row-metrics {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.5rem;
}

.merged-metric-chip {
  display: flex;
  flex-direction: column;
  gap: 0.125rem;
  border-radius: var(--radius-md);
  background: #ffffff;
  border: 1px solid var(--accent-light);
  padding: 0.375rem 0.5rem;
  font-size: 0.75rem;
  color: var(--accent-dark);
  font-weight: 700;
  line-height: 1.35;
}

.merged-metric-chip strong {
  font-size: 0.6875rem;
  font-weight: 700;
  color: #475569;
}

.month-age-bridge {
  grid-column: 1 / -1;
  border-radius: 10px;
  border: 1px solid var(--accent-light);
  background: var(--accent-lightest);
  padding: 0.625rem 0.75rem;
  margin-bottom: 0.5rem;
}

.month-age-bridge-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
}

.month-age-stage {
  font-size: 0.8125rem;
  font-weight: 700;
  color: var(--accent-dark);
}

.month-age-days {
  font-size: 0.75rem;
  font-weight: 600;
  color: #64748b;
}

.month-age-compact-text {
  margin: 0.5rem 0 0;
  font-size: 0.75rem;
  line-height: 1.5;
  color: var(--accent-dark);
  font-weight: 600;
}

.first-100-timeline {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0;
  margin-top: 1.5rem;
}

@media (min-width: 900px) {
  .first-100-timeline {
    grid-template-columns: repeat(2, 1fr);
  }
}

.timeline-week {
  background: #ffffff;
  border-radius: 0;
  padding: 1rem 0.75rem;
  box-shadow: none;
  border: none;
  border-bottom: 1px solid #e2e8f0;
}

.timeline-week:last-child {
  border-bottom: none;
}

.timeline-week:hover {
  transform: none;
  box-shadow: none;
  border-color: inherit;
}

.week-header h3 {
  font-size: 1.25rem;
  font-weight: 600;
  color: #1e293b;
  margin: 0 0 1rem 0;
  padding-bottom: 0.75rem;
  border-bottom: 2px solid #e2e8f0;
}

.week-stats {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 0.75rem;
  margin-bottom: 1rem;
}

.stat-item {
  display: flex;
  flex-direction: column;
  padding: 0.75rem;
  background: var(--bg-body);
  border-radius: var(--radius-md);
  transition: background 0.2s ease;
}

.stat-item:hover {
  background: #f1f5f9;
}

.stat-label {
  font-size: 0.75rem;
  font-weight: 600;
  color: #64748b;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 0.25rem;
}

.stat-value {
  font-size: 1.5rem;
  font-weight: 600;
  color: #0f172a;
  font-feature-settings: "tnum";
}

.week-milestones {
  margin-top: 1rem;
  padding-top: 1rem;
  border-top: 1px solid #e2e8f0;
}

.milestone-label {
  font-size: 0.75rem;
  font-weight: 600;
  color: #64748b;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin: 0 0 0.5rem 0;
}

.milestone-text {
  font-size: 0.875rem;
  color: #334155;
  line-height: 1.5;
  margin: 0;
}

/* ==========================================================================
   Behavior Analysis by Age
   ========================================================================== */

.stats-behavior-age {
  padding: 2.5rem 0;
  background: #ffffff;
}

.stats-behavior-age .section-description {
  text-align: left;
  font-size: 1rem;
  color: var(--text-secondary, #4b5563);
  max-width: none;
  margin: 0.75rem 0 1.5rem;
  line-height: 1.6;
}

.behavior-age-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0;
  margin-top: 1.5rem;
}

.age-group-card {
  background: transparent;
  border-radius: 0;
  padding: 1.5rem 0.75rem;
  box-shadow: none;
  border: none;
  border-bottom: 1px solid #e2e8f0;
}

.age-group-card:last-child {
  border-bottom: none;
}

.age-group-card:hover {
  transform: none;
  box-shadow: none;
}

.age-group-card h3 {
  font-size: 1.5rem;
  font-weight: 600;
  color: #0f172a;
  margin: 0 0 0.5rem 0;
}

.age-days {
  font-size: 0.875rem;
  color: #64748b;
  font-weight: 600;
  margin: 0 0 1.5rem 0;
}

.behavior-metrics {
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

.metric-bar {
  display: grid;
  grid-template-columns: 1fr 3fr auto;
  align-items: center;
  gap: 1rem;
}

.metric-label {
  font-size: 0.875rem;
  font-weight: 600;
  color: #334155;
  display: flex;
  align-items: center;
  gap: 0.25rem;
}

.metric-bar-container {
  height: 24px;
  background: #e2e8f0;
  border-radius: var(--radius-lg);
  overflow: hidden;
  position: relative;
}

.metric-bar-fill {
  height: 100%;
  background: linear-gradient(90deg, #3b82f6 0%, #2563eb 100%);
  border-radius: var(--radius-lg);
  transition: width 0.6s cubic-bezier(0.4, 0, 0.2, 1);
  position: relative;
}

.metric-bar-fill::after {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: linear-gradient(
    90deg,
    transparent 0%,
    rgba(255, 255, 255, 0.3) 50%,
    transparent 100%
  );
  animation: shimmer 2s infinite;
}

@keyframes shimmer {
  0% {
    transform: translateX(-100%);
  }
  100% {
    transform: translateX(100%);
  }
}

.metric-bar-fill.socialization {
  background: linear-gradient(90deg, #10b981 0%, #059669 100%);
}

.metric-bar-fill.dog-run {
  background: linear-gradient(90deg, #f59e0b 0%, #d97706 100%);
}

.metric-value {
  font-size: 1rem;
  font-weight: 600;
  color: #0f172a;
  min-width: 50px;
  text-align: right;
  font-feature-settings: "tnum";
}

.behavior-compare-guide {
  background: var(--bg-body);
  border: 1px solid var(--accent-light);
  border-radius: var(--radius-lg);
  padding: 1rem 1.25rem;
  margin-bottom: 1.5rem;
}

.behavior-compare-guide h4 {
  margin: 0 0 0.5rem 0;
  font-size: 1rem;
  font-weight: 700;
  color: var(--accent-dark);
}

.behavior-compare-guide p {
  margin: 0 0 0.75rem 0;
  font-size: 0.875rem;
  color: #475569;
  line-height: 1.6;
}

.behavior-compare-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.behavior-compare-tag {
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  padding: 0.375rem 0.75rem;
  font-size: 0.75rem;
  font-weight: 600;
  line-height: 1.3;
}

.behavior-compare-tag.is-positive {
  background: #dcfce7;
  color: #166534;
}

.age-delta-summary {
  margin-top: 1rem;
  padding-top: 0.875rem;
  border-top: 1px solid #e2e8f0;
}

.age-delta-summary h4 {
  margin: 0 0 0.625rem 0;
  font-size: 0.8125rem;
  font-weight: 700;
  color: #475569;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.age-delta-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 0.375rem;
}

.age-delta-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-radius: var(--radius-md);
  padding: 0.375rem 0.5rem;
  font-size: 0.8125rem;
}

.age-delta-item.is-positive {
  background: #ecfdf5;
  color: #065f46;
}

.age-delta-item.is-caution {
  background: #fff7ed;
  color: #9a3412;
}

.delta-label {
  font-weight: 600;
}

.delta-value {
  font-weight: 700;
  font-feature-settings: "tnum";
}

.age-baseline-note {
  margin: 1rem 0 0;
  font-size: 0.8125rem;
  color: #64748b;
  font-weight: 600;
}

/* ==========================================================================
   Insights Section Enhancement
   ========================================================================== */

.stats-insights {
  padding: 2.5rem 0;
  background: #fff7ed;
}

.insights-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0;
  margin-top: 1.5rem;
}

.insight-card {
  background: transparent;
  padding: 1.25rem 0.75rem;
  border-radius: 0;
  box-shadow: none;
  border: none;
  border-bottom: 1px solid #fed7aa;
  border-left: 3px solid #f59e0b;
  padding-left: 1rem;
}

.insight-card:last-child {
  border-bottom: none;
}

.insight-card:hover {
  transform: none;
  box-shadow: none;
}

/* ==========================================================================
   Personalized Insights Section (New)
   ========================================================================== */

.stats-personalized {
  padding: 2.5rem 0;
  background: #ffffff;
}

.stats-personalized .section-description {
  font-size: 0.9375rem;
  color: #64748b;
  margin: 0.75rem 0 1.5rem;
  line-height: 1.6;
}

.personalized-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0;
}

@media (min-width: 900px) {
  .personalized-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 2rem;
  }
}

.insights-chart-block {
  padding: 1.25rem 0.75rem;
  border-bottom: 1px solid #e2e8f0;
}

.insights-chart-block:last-child {
  border-bottom: none;
}

@media (min-width: 900px) {
  .insights-chart-block {
    border-bottom: none;
    padding: 1rem 0;
  }
}

.insights-chart-block h3 {
  font-size: 1.125rem;
  font-weight: 700;
  color: #0f172a;
  margin: 0 0 0.5rem 0;
  padding-bottom: 0.5rem;
  border-bottom: 2px solid #e2e8f0;
}

.insights-chart-block .chart-description {
  font-size: 0.875rem;
  color: #64748b;
  margin-bottom: 1rem;
  line-height: 1.6;
}

.insight-card h4 {
  font-size: 1.125rem;
  font-weight: 600;
  color: #0f172a;
  margin: 0 0 0.75rem 0;
  line-height: 1.3;
}

.insight-card p {
  font-size: 0.9375rem;
  color: #475569;
  line-height: 1.6;
  margin: 0;
}

/* ==========================================================================
   Stats Summary Cards Enhancement
   ========================================================================== */

.stats-summary {
  padding: 2rem 0;
  background: white;
}

.stats-header-actions {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 2rem;
  flex-wrap: wrap;
  gap: 1rem;
}

.btn-view-raw-data {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.75rem 1.5rem;
  background: linear-gradient(135deg, #3b82f6 0%, #2563eb 100%);
  color: white;
  text-decoration: none;
  border-radius: var(--radius-md);
  font-weight: 600;
  font-size: 0.9375rem;
  transition: all 0.3s ease;
  box-shadow: 0 4px 6px -1px rgba(59, 130, 246, 0.3);
}

.btn-view-raw-data:hover {
  background: linear-gradient(135deg, #2563eb 0%, #1d4ed8 100%);
  transform: translateY(-2px);
  box-shadow: 0 10px 15px -3px rgba(59, 130, 246, 0.4);
  color: white;
}

.summary-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 200px), 1fr));
  gap: 1.5rem;
}

.summary-card {
  background: var(--bg-body);
  padding: 1.25rem 0.75rem;
  border-radius: 0;
  box-shadow: none;
  border: none;
  border-bottom: 1px solid #e2e8f0;
  transition: background 0.2s ease;
  display: flex;
  align-items: center;
  gap: 1.25rem;
}

.summary-card:hover {
  transform: none;
  box-shadow: none;
  background: #f1f5f9;
}

.card-icon {
  font-size: 2.5rem;
  line-height: 1;
  flex-shrink: 0;
}

.card-content {
  flex: 1;
}

.card-value {
  font-size: 2rem;
  font-weight: 600;
  color: #0f172a;
  line-height: 1.2;
  margin-bottom: 0.25rem;
  font-feature-settings: "tnum";
}

.card-label {
  font-size: 0.875rem;
  font-weight: 600;
  color: #64748b;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

/* ==========================================================================
   Charts Section
   ========================================================================== */

.stats-charts {
  padding: 2.5rem 0;
  background: var(--bg-body);
}

.charts-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0;
  margin-top: 1.5rem;
}

@media (min-width: 1025px) {
  .charts-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

.chart-container {
  background: transparent;
  padding: 1.25rem 0.75rem;
  border-radius: 0;
  box-shadow: none;
  min-height: 300px;
  height: 100%;
  display: flex;
  flex-direction: column;
  border-bottom: 1px solid #e2e8f0;
}

.chart-container:last-child {
  border-bottom: none;
}

.chart-container h3 {
  margin-bottom: 0.5rem;
  flex-shrink: 0;
}

.chart-container .chart-description {
  margin-bottom: 1.5rem;
  flex-shrink: 0;
}

.chart-container canvas {
  height: 220px !important;
  max-height: 220px;
  flex-shrink: 0;
}

/* Specific height for charts with custom content */
.chart-container:has(.hourly-bars),
.chart-container:has(.yearly-bars) {
  min-height: 380px;
}

.chart-container > .hourly-bars,
.chart-container > .yearly-bars {
  flex: 0 0 auto;
  height: 220px;
}

.chart-container.full-width {
  grid-column: 1 / -1;
}

.chart-container h3 {
  font-size: 1.25rem;
  font-weight: 600;
  color: #0f172a;
  margin: 0 0 1.5rem 0;
  padding-bottom: 0.75rem;
  border-bottom: 2px solid #e2e8f0;
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.5rem;
}

/* ==========================================================================
   FAQ Section
   ========================================================================== */

.stats-faq {
  padding: 2.5rem 0;
  background: var(--bg-body);
}

.faq-list {
  max-width: 100%;
  margin: 1.5rem 0 0;
}

.faq-item {
  background: transparent;
  padding: 1.25rem 0.75rem;
  border-radius: 0;
  margin-bottom: 0;
  border: none;
  border-bottom: 1px solid #e2e8f0;
  border-left: 3px solid #3b82f6;
  padding-left: 1rem;
  transition: background 0.2s ease;
}

.faq-item:last-child {
  border-bottom: none;
}

.faq-item:hover {
  background: rgba(59, 130, 246, 0.03);
  transform: none;
}

.faq-question {
  font-size: 1.125rem;
  font-weight: 600;
  color: #0f172a;
  margin: 0 0 0.75rem 0;
  line-height: 1.4;
}

.faq-answer {
  font-size: 0.9375rem;
  color: #475569;
  line-height: 1.7;
}

/* ==========================================================================
   Responsive Design
   ========================================================================== */

@media (max-width: 768px) {
  .first-100-timeline,
  .behavior-age-grid {
    grid-template-columns: 1fr;
  }

  .charts-grid {
    grid-template-columns: 1fr;
  }

  .week-stats {
    grid-template-columns: 1fr;
  }

  .summary-grid {
    grid-template-columns: 1fr;
  }

  .matrix-reading-items {
    grid-template-columns: 1fr;
  }

  .stat-value {
    font-size: 1.25rem;
  }

  .card-value {
    font-size: 1.75rem;
  }

  .stats-header-actions {
    flex-direction: column;
    align-items: flex-start;
  }

  .metric-bar {
    grid-template-columns: 1fr;
    gap: 0.5rem;
  }

  .metric-bar-container {
    grid-column: 1 / -1;
  }

  .metric-value {
    text-align: left;
  }

  .metric-label {
    flex-wrap: nowrap;
  }

  .month-key-logic {
    text-align: center;
  }

  .merged-behavior-row {
    grid-template-columns: 1fr;
  }

  .merged-behavior-row-metrics {
    grid-template-columns: 1fr;
  }

  .month-age-bridge-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.25rem;
  }

  /* Remove double horizontal padding: container(0.75rem) already provides edge spacing */
  .chart-container,
  .insights-chart-block {
    padding-left: 0;
    padding-right: 0;
  }
}

@media (max-width: 480px) {
  .timeline-week,
  .age-group-card,
  .insight-card,
  .chart-container,
  .insights-chart-block {
    padding: 1rem 0.5rem;
  }

  .stats-first-100-days,
  .stats-behavior-age,
  .stats-insights,
  .stats-charts,
  .stats-faq,
  .stats-personalized {
    padding: 1.5rem 0;
  }
}

/* ==========================================================================
   Section Container Padding (Edge-to-Edge)
   ========================================================================== */

.page-hero .container,
.stats-charts .container,
.stats-personalized .container,
.stats-first-100-days .container,
.stats-behavior-age .container,
.stats-insights .container,
.stats-faq .container,
.stats-summary .container {
  padding-left: var(--mobile-content-gutter, 0.875rem);
  padding-right: var(--mobile-content-gutter, 0.875rem);
}

@media (min-width: 768px) {
  .page-hero .container,
  .stats-charts .container,
  .stats-personalized .container,
  .stats-first-100-days .container,
  .stats-behavior-age .container,
  .stats-insights .container,
  .stats-faq .container,
  .stats-summary .container {
    padding-left: var(--space-6);
    padding-right: var(--space-6);
  }
}

/* ==========================================================================
   Loading and Error States
   ========================================================================== */

.stats-loading,
.stats-error {
  text-align: center;
  padding: 3rem;
  font-size: 1rem;
  color: #64748b;
}

.stats-error {
  color: #dc2626;
  background: #fef2f2;
  border: 1px solid #fecaca;
  border-radius: var(--radius-lg);
}

/* ==========================================================================
   Section Heading Alignment (override any theme-level centering)
   ========================================================================== */

.stats-charts h2,
.stats-personalized h2,
.stats-first-100-days h2,
.stats-behavior-age h2,
.stats-faq h2,
.stats-summary h2,
.stats-insights h2 {
  text-align: left;
}

.dory-stats-page .page-hero--unified .page-hero__title,
.dory-stats-page .page-hero--unified .page-hero__subtitle,
.dory-stats-page .page-hero--unified .page-hero__meta {
  text-align: center;
}

.dory-stats-page .page-hero--unified .page-hero__media {
  margin-top: 1rem;
}

.dory-stats-page .page-hero--unified .dory-image-placeholder {
  width: min(100%, 680px);
  min-height: clamp(170px, 24vw, 240px);
}

.dory-stats-page.tw-readable-page {
  --tw-readable-inline: clamp(0.82rem, 3.6vw, 1rem);
  --tw-readable-section-space: clamp(1.5rem, 5.6vw, 2.15rem);
  --dory-stats-mobile-edge: clamp(0.75rem, 3.2vw, 0.95rem);
  --dory-stats-surface: var(--bg-surface);
  --dory-stats-surface-alt: color-mix(in srgb, var(--accent) 3%, var(--bg-body));
  --dory-stats-border: color-mix(in srgb, var(--accent) 16%, var(--border));
  --dory-stats-border-soft: color-mix(in srgb, var(--border) 78%, var(--bg-surface));
  --dory-stats-shadow: var(--shadow-md);
  --dory-stats-card-shadow: var(--shadow-sm);
  --dory-stats-radius: var(--radius-2xl);
  --dory-stats-card-radius: var(--radius-xl);
  --dory-stats-text-soft: color-mix(in srgb, var(--text-secondary) 90%, var(--text-tertiary));
  --dory-stats-accent-text: color-mix(in srgb, var(--accent) 76%, var(--accent-strong));
}

.dory-stats-page .tw-readable-hero.tw-readable-section {
  padding-top: clamp(0.7rem, 3vw, 1rem);
  padding-bottom: clamp(1rem, 3.8vw, 1.45rem);
  background: transparent;
}

.dory-stats-page .tw-readable-hero .fixed-page-hero__surface {
  padding:
    clamp(1.15rem, 4vw, 1.6rem)
    clamp(0.95rem, 3.8vw, 1.35rem)
    clamp(1rem, 3.8vw, 1.35rem);
  border-radius: var(--dory-stats-radius);
  border-color: var(--dory-stats-border);
  background:
    radial-gradient(
      700px 240px at 50% -8%,
      color-mix(in srgb, var(--accent) 14%, transparent) 0%,
      transparent 72%
    ),
    linear-gradient(
      180deg,
      color-mix(in srgb, var(--accent) 3%, var(--dory-stats-surface)) 0%,
      var(--dory-stats-surface) 100%
    );
  box-shadow: var(--dory-stats-shadow);
}

.dory-stats-page .tw-readable-hero .page-hero__title {
  font-size: clamp(2.2rem, 8.8vw, 3.35rem);
  margin-bottom: 0.55rem;
}

.dory-stats-page .tw-readable-hero .page-hero__subtitle {
  max-width: 32rem;
  margin-top: 0.4rem;
  line-height: 1.68;
}

.dory-stats-hero__kicker {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.38rem 0.76rem;
  border-radius: var(--radius-full);
  border: 1px solid var(--dory-stats-border);
  background: color-mix(in srgb, var(--dory-stats-surface) 84%, transparent);
  color: var(--dory-stats-accent-text);
  font-size: 0.74rem;
  font-weight: 800;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.dory-stats-hero__stats {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.6rem;
  width: min(100%, 38rem);
  margin: 1rem auto 0;
}

.dory-stats-hero__stat {
  min-width: 0;
  padding: 0.72rem 0.6rem;
  border-radius: var(--dory-stats-card-radius);
  border: 1px solid var(--dory-stats-border);
  background: color-mix(in srgb, var(--dory-stats-surface) 88%, transparent);
  box-shadow: inset 0 1px 0 color-mix(in srgb, var(--dory-stats-surface) 72%, transparent);
  text-align: center;
}

.dory-stats-hero__stat-value {
  display: block;
  font-size: clamp(0.88rem, 2.8vw, 1.05rem);
  font-weight: 800;
  line-height: 1.22;
  color: var(--text-primary);
  font-feature-settings: "tnum";
  overflow-wrap: anywhere;
}

.dory-stats-hero__stat-label {
  display: block;
  margin-top: 0.18rem;
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  color: var(--text-tertiary);
}

.dory-stats-hero__meta {
  margin-top: 0.85rem;
  color: var(--dory-stats-text-soft);
}

.dory-stats-page .tw-readable-hero + .key-insights-section {
  padding-top: clamp(1rem, 4vw, 1.45rem);
}

.stats-personalized .section-description {
  text-align: left;
}

/* ==========================================================================
   Print Styles
   ========================================================================== */

@media print {
  .stats-header-actions,
  .btn-view-raw-data {
    display: none;
  }

  .timeline-week,
  .age-group-card,
  .insight-card,
  .summary-card {
    box-shadow: none;
    border: 1px solid #e2e8f0;
    page-break-inside: avoid;
  }
}

@media (min-width: 768px) {
  .dory-stats-page.tw-readable-page {
    --tw-readable-inline: clamp(1.15rem, 2.5vw, 1.7rem);
    --tw-readable-section-space: clamp(2rem, 4vw, 2.75rem);
  }
}

/* ==========================================================================
   Activity Rhythm - Simplified Two-Column Layout
   ========================================================================== */

.activity-heatmap-container {
  padding: 1.5rem;
  background: #ffffff;
  border-radius: var(--radius-lg);
  min-height: auto;
  overflow: visible;
}

/* Two-column Grid Layout */
.rhythm-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 2rem;
  margin-bottom: 2rem;
}

.rhythm-section {
  background: var(--bg-body);
  padding: 1.5rem;
  border-radius: var(--radius-lg);
  border: 2px solid #e2e8f0;
  transition: all 0.3s ease;
}

.rhythm-section:hover {
  border-color: #3b82f6;
  box-shadow: 0 4px 12px rgba(59, 130, 246, 0.1);
}

.rhythm-section h4 {
  font-size: 1.125rem;
  font-weight: 600;
  color: #1e293b;
  margin: 0 0 0.75rem 0;
  padding-bottom: 0.5rem;
  border-bottom: 2px solid #e2e8f0;
}

.section-description {
  font-size: 0.875rem;
  color: #64748b;
  line-height: 1.6;
  margin: 0 0 1.5rem 0;
}

/* Hourly Toilet Frequency Bars */
.chart-container .hourly-bars {
  display: flex;
  gap: 2px;
  align-items: flex-end;
  height: 220px !important;
  max-height: 220px;
  padding: 0 0.5rem;
  margin: 0;
  position: relative;
}

.hour-bar {
  flex: 1;
  background: linear-gradient(180deg, #3b82f6 0%, #2563eb 100%);
  border-radius: 3px 3px 0 0;
  position: relative;
  min-height: 4px;
  transition: all 0.2s ease;
  cursor: pointer;
}

.hour-bar:hover {
  background: linear-gradient(180deg, #2563eb 0%, #1d4ed8 100%);
  transform: translateY(-2px);
  box-shadow: 0 4px 8px rgba(59, 130, 246, 0.3);
}

.hour-label {
  position: absolute;
  bottom: -22px;
  left: 50%;
  transform: translateX(-50%);
  font-size: 0.625rem;
  color: #94a3b8;
  white-space: nowrap;
  font-weight: 500;
}

.hour-bar:nth-child(4n) .hour-label {
  font-weight: 600;
  color: #64748b;
}

/* Yearly Activity Summary Bars */
.chart-container .yearly-bars {
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
  height: 220px !important;
  max-height: 220px;
  justify-content: space-evenly;
  overflow: visible;
  padding: 0.5rem 0;
}

.year-bar-item {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 0.5rem 0.75rem;
  background: #ffffff;
  border-radius: var(--radius-md);
  border: 1px solid #e2e8f0;
  transition: all 0.2s ease;
  min-height: 40px;
}

.year-bar-item:hover {
  border-color: #3b82f6;
  box-shadow: 0 2px 8px rgba(59, 130, 246, 0.1);
}

.year-label-column {
  min-width: 80px;
  flex-shrink: 0;
}

.year-bar-year {
  font-size: 1rem;
  font-weight: 600;
  color: #1e293b;
  margin: 0;
}

.year-bar-age {
  font-size: 0.75rem;
  color: #64748b;
  margin: 0.125rem 0 0 0;
}

.year-bar-container {
  flex: 1;
  height: 28px;
  background: #e2e8f0;
  border-radius: 6px;
  overflow: hidden;
  position: relative;
}

.year-bar-fill {
  height: 100%;
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  padding-right: 0.5rem;
  font-size: 0.75rem;
  font-weight: 600;
  color: #ffffff;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.2);
  transition: width 0.6s cubic-bezier(0.4, 0, 0.2, 1);
}

.year-bar-fill.activity-low {
  background: linear-gradient(90deg, #94a3b8 0%, #64748b 100%);
}

.year-bar-fill.activity-medium {
  background: linear-gradient(90deg, #f59e0b 0%, #d97706 100%);
}

.year-bar-fill.activity-high {
  background: linear-gradient(90deg, #10b981 0%, #059669 100%);
}

/* Insights Section */
.rhythm-insights {
  grid-column: 1 / -1;
  background: linear-gradient(135deg, #fef3c7 0%, #fde68a 100%);
  padding: 1.75rem;
  border-radius: var(--radius-lg);
  border: 2px solid #fbbf24;
  margin-top: 1rem;
}

.rhythm-insights h4 {
  font-size: 1.125rem;
  font-weight: 600;
  color: #92400e;
  margin: 0 0 1rem 0;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.rhythm-insights ul {
  list-style: none;
  padding: 0;
  margin: 0;
  display: grid;
  gap: 0.75rem;
}

.rhythm-insights li {
  font-size: 0.9375rem;
  color: #78350f;
  line-height: 1.6;
  padding-left: 1.5rem;
  position: relative;
}

.rhythm-insights li::before {
  content: "✓";
  position: absolute;
  left: 0;
  color: #f59e0b;
  font-weight: 600;
  font-size: 1.125rem;
}

/* Responsive */
@media (max-width: 968px) {
  .rhythm-grid {
    grid-template-columns: 1fr;
    gap: 1.5rem;
  }
}

@media (max-width: 768px) {
  .hourly-bars {
    height: 140px;
  }

  .hour-label {
    font-size: 0.5rem;
  }

  .year-bar-item {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.5rem;
  }

  .year-label-column {
    width: 100%;
  }

  .year-bar-container {
    width: 100%;
  }

  .rhythm-section {
    padding: 1rem;
  }

  .rhythm-insights {
    padding: 1.25rem;
  }
}

@media (max-width: 480px) {
  .hourly-bars {
    height: 60px;
    padding: 0 0.25rem;
    gap: 1px;
  }

  .hour-label {
    font-size: 0.4rem;
    bottom: -18px;
  }

  .rhythm-section h4 {
    font-size: 1rem;
  }

  .section-description {
    font-size: 0.8125rem;
  }

  .year-bar-year {
    font-size: 0.9375rem;
  }
}

/* ==========================================================================
   Info Tooltips
   ========================================================================== */

.info-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 18px;
  height: 18px;
  min-width: 18px;
  min-height: 18px;
  margin: 0;
  padding: 0;
  background: transparent;
  border: none;
  color: #94a3b8;
  cursor: help;
  transition: color 0.2s ease, transform 0.2s ease;
  vertical-align: middle;
  position: relative;
  z-index: 10;
  flex-shrink: 0;
}

.info-icon:hover {
  color: #3b82f6;
  transform: scale(1.1);
}

.info-icon:focus {
  outline: 2px solid #3b82f6;
  outline-offset: 2px;
  border-radius: 50%;
}

.info-icon svg {
  display: block;
  width: 100%;
  height: 100%;
}

.info-tooltip {
  position: fixed;
  z-index: 9999;
  max-width: 320px;
  padding: 0.875rem 1rem;
  background: #1e293b;
  color: white;
  border-radius: var(--radius-md);
  font-size: 0.875rem;
  line-height: 1.5;
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.25);
  pointer-events: none;
  opacity: 0;
  transform: translateY(8px);
  transition: opacity 0.2s ease, transform 0.2s ease;
}

.info-tooltip[aria-hidden="false"] {
  opacity: 1;
  transform: translateY(0);
  pointer-events: auto;
}

.info-tooltip::before {
  content: '';
  position: absolute;
  top: -6px;
  left: 20px;
  width: 12px;
  height: 12px;
  background: #1e293b;
  transform: rotate(45deg);
}

.tooltip-content strong {
  display: block;
  margin-bottom: 0.5rem;
  font-size: 0.9375rem;
  color: #60a5fa;
}

.tooltip-content p {
  margin: 0;
  color: #e2e8f0;
}

@media (max-width: 768px) {
  .info-tooltip {
    max-width: calc(100vw - 3rem);
    font-size: 0.8125rem;
  }
}

/* ==========================================================================
   Context Notes
   ========================================================================== */

.context-note {
  display: flex;
  gap: 0.875rem;
  margin-top: 1.25rem;
  padding: 0.875rem 1rem;
  background: linear-gradient(135deg, #fef3c7 0%, #fde68a 100%);
  border-radius: var(--radius-md);
  border-left: 3px solid #f59e0b;
  font-size: 0.875rem;
  line-height: 1.6;
  color: #78350f;
}

.context-note-icon {
  font-size: 1.25rem;
  flex-shrink: 0;
  line-height: 1;
}

.context-note-content {
  flex: 1;
}

.context-note-content strong {
  color: #92400e;
  font-weight: 600;
}

@media (max-width: 768px) {
  .context-note {
    font-size: 0.8125rem;
    padding: 0.75rem 0.875rem;
  }

  .stats-focus-note {
    padding: 0.9rem;
  }

  .stats-focus-note__links {
    flex-direction: column;
  }
}

/* ==========================================================================
   Event Legend
   ========================================================================== */

.event-legend {
  margin: 2rem 0 1.5rem 0;
  padding: 1rem 1.25rem;
  background: var(--bg-body);
  border-radius: var(--radius-lg);
  border: 2px solid #e2e8f0;
}

.event-legend h4 {
  margin: 0 0 0.75rem 0;
  font-size: 1rem;
  font-weight: 700;
  color: #1e293b;
}

.chart-reading-guide-description {
  margin: 0 0 0.875rem 0;
  font-size: 0.875rem;
  color: #475569;
  line-height: 1.6;
}

.event-marker-note {
  margin: 0 0 0.875rem 0;
  padding: 0.5rem 0.625rem;
  border-radius: var(--radius-md);
  border: 1px solid var(--accent-light);
  background: var(--accent-lightest);
  color: var(--accent-dark);
  font-size: 0.8125rem;
  line-height: 1.5;
  font-weight: 600;
}

.chart-reading-guide-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 280px), 1fr));
  gap: 0.875rem;
  margin-bottom: 0.875rem;
}

.chart-reading-guide-block {
  border: 1px solid var(--accent-light);
  border-radius: 10px;
  background: #ffffff;
  padding: 0.875rem;
}

.chart-reading-guide-block h5 {
  margin: 0 0 0.625rem 0;
  font-size: 0.8125rem;
  font-weight: 700;
  color: var(--accent-dark);
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.series-legend {
  display: grid;
  gap: 0.5rem;
}

.series-item {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.875rem;
  color: #334155;
}

.series-swatch {
  display: inline-block;
  width: 22px;
  height: 0;
  border-top-width: 3px;
  border-top-style: solid;
}

.series-swatch--toilet {
  border-top-color: #10b981;
}

.series-swatch--weight {
  border-top-color: #667eea;
}

.legend-items {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
}

.legend-item {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.875rem;
  color: #334155;
}

.legend-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 26px;
  height: 26px;
  border-radius: 4px;
  font-size: 0.8125rem;
}

.event-highlight-list {
  border-top: 1px solid var(--accent-light);
  margin-top: 0.75rem;
  padding-top: 0.75rem;
}

.event-highlight-list h5 {
  margin: 0 0 0.5rem 0;
  font-size: 0.8125rem;
  font-weight: 700;
  color: var(--accent-dark);
}

.event-highlight-list ul {
  margin: 0;
  padding: 0;
  list-style: none;
  display: grid;
  gap: 0.375rem;
}

.event-highlight-list li {
  display: flex;
  gap: 0.5rem;
  align-items: baseline;
}

.event-highlight-month {
  display: inline-block;
  min-width: 70px;
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--accent-dark);
}

.event-highlight-detail {
  font-size: 0.8125rem;
  color: #475569;
  overflow-wrap: anywhere;
  word-break: normal;
}

@media (max-width: 768px) {
  .legend-items {
    gap: 0.75rem;
  }

  .legend-item {
    font-size: 0.8125rem;
  }

  .event-highlight-month {
    min-width: 0;
  }

  .event-highlight-list li {
    flex-direction: column;
    gap: 0.125rem;
  }
}

/* ==========================================================================
   CTA Section
   ========================================================================== */

.stats-cta {
  padding: 4rem 0;
  background: linear-gradient(135deg, #eff6ff 0%, #dbeafe 100%);
  position: relative;
  overflow: hidden;
}

.stats-cta::before {
  content: '';
  position: absolute;
  top: -50%;
  right: -10%;
  width: 500px;
  height: 500px;
  background: radial-gradient(circle, rgba(37, 99, 235, 0.16) 0%, transparent 70%);
  border-radius: 50%;
}

.cta-content {
  position: relative;
  z-index: 1;
  text-align: center;
}

.stats-next-read {
  max-width: 760px;
  margin: 0 auto;
}

.stats-next-read__eyebrow {
  margin: 0 0 0.75rem;
  font-size: 0.75rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  color: var(--accent);
}

.stats-next-read__title {
  margin: 0 0 1rem;
  font-size: clamp(1.5rem, 3.5vw, 2rem);
  line-height: 1.35;
  color: #0f172a;
}

.stats-next-read__description {
  margin: 0 auto 2rem;
  max-width: 620px;
  font-size: 1rem;
  line-height: 1.75;
  color: #334155;
}

.stats-next-read__button {
  align-self: center;
}

.cta-title {
  font-size: 2rem;
  font-weight: 700;
  color: #1e293b;
  text-align: center;
  margin: 0 0 1rem 0;
}

.cta-subtitle {
  font-size: 1.125rem;
  color: #475569;
  text-align: center;
  max-width: 600px;
  margin: 0 auto 3rem;
  line-height: 1.6;
}

.cta-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 300px), 1fr));
  gap: 2rem;
  margin-bottom: 2rem;
}

.cta-card {
  background: white;
  padding: 2rem;
  border-radius: 16px;
  box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
  border: 2px solid transparent;
  transition: all 0.3s ease;
  display: flex;
  flex-direction: column;
}

.cta-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.15);
  border-color: #8b5cf6;
}

.cta-card--highlight {
  background: linear-gradient(135deg, #fef3c7 0%, #fde68a 100%);
  border-color: #f59e0b;
}

.cta-card--highlight:hover {
  border-color: #d97706;
}

.cta-card-icon {
  font-size: 2.5rem;
  margin-bottom: 1rem;
  line-height: 1;
}

.cta-card h3 {
  font-size: 1.25rem;
  font-weight: 600;
  color: #0f172a;
  margin: 0 0 0.75rem 0;
}

.cta-card p {
  font-size: 0.9375rem;
  color: #475569;
  line-height: 1.6;
  margin: 0 0 1.5rem 0;
  flex: 1;
}

.cta-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.875rem 1.5rem;
  border-radius: 8px;
  font-weight: 600;
  font-size: 0.9375rem;
  text-decoration: none;
  transition: all 0.3s ease;
  align-self: flex-start;
}

.cta-button--primary {
  background: linear-gradient(135deg, #3b82f6 0%, #2563eb 100%);
  color: white;
  box-shadow: 0 4px 6px -1px rgba(59, 130, 246, 0.3);
}

.cta-button--primary:hover {
  background: linear-gradient(135deg, #2563eb 0%, #1d4ed8 100%);
  box-shadow: 0 10px 15px -3px rgba(59, 130, 246, 0.4);
  transform: translateY(-2px);
  color: white;
}

.cta-button--secondary {
  background: linear-gradient(135deg, #f59e0b 0%, #d97706 100%);
  color: white;
  box-shadow: 0 4px 6px -1px rgba(245, 158, 11, 0.3);
}

.cta-button--secondary:hover {
  background: linear-gradient(135deg, #d97706 0%, #b45309 100%);
  box-shadow: 0 10px 15px -3px rgba(245, 158, 11, 0.4);
  transform: translateY(-2px);
  color: white;
}

.cta-button svg {
  transition: transform 0.3s ease;
}

.cta-button:hover svg {
  transform: translateX(4px);
}

.cta-links {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.cta-links a {
  color: #3b82f6;
  text-decoration: none;
  font-size: 0.9375rem;
  transition: color 0.2s ease;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.cta-links a::before {
  content: '→';
  color: #3b82f6;
}

.cta-links a:hover {
  color: #2563eb;
  text-decoration: underline;
}

.cta-note {
  margin-top: 2rem;
  padding: 1.25rem 1.5rem;
  background: white;
  border-radius: var(--radius-lg);
  border-left: 4px solid #8b5cf6;
  box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
}

.cta-note p {
  margin: 0;
  font-size: 0.9375rem;
  color: #475569;
  line-height: 1.7;
}

.cta-note strong {
  color: #1e293b;
  font-weight: 600;
}

@media (max-width: 768px) {
  .stats-cta {
    padding: 3rem 0;
  }

  .cta-title {
    font-size: 1.5rem;
  }

  .stats-next-read__title {
    font-size: 1.375rem;
  }

  .stats-next-read__description {
    font-size: 0.95rem;
    margin-bottom: 1.5rem;
  }

  .cta-subtitle {
    font-size: 1rem;
    margin-bottom: 2rem;
  }

  .cta-grid {
    grid-template-columns: 1fr;
    gap: 1.5rem;
  }

  .cta-card {
    padding: 1.5rem;
  }

  .cta-button {
    width: 100%;
  }
}

/* Cache update: Sat Feb 21 01:58:30 JST 2026 */

/* ==========================================================================
   Dory Stats 2026: Hero / Key Insights / Chart Sections / Achievements
   ========================================================================== */

/* --- Hero (uses global .page-hero styles) --- */

/* --- Key Insights Grid --- */
.key-insights-section {
  padding: 2.5rem 0;
  background: var(--bg-body);
}

.key-insights-section h2 {
  font-size: 1.375rem;
  font-weight: 700;
  color: #0f172a;
  margin: 0 0 1.5rem;
  text-align: left;
}

.key-insights-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 260px), 1fr));
  gap: 1rem;
}

.insight-card {
  background: #fff;
  border-radius: var(--radius-lg);
  padding: 1.25rem;
  border: 1px solid #e2e8f0;
  box-shadow: 0 1px 3px rgba(0,0,0,0.06);
  cursor: pointer;
  transition: box-shadow 0.2s ease, transform 0.15s ease;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.insight-card:hover {
  box-shadow: 0 6px 20px rgba(0,0,0,0.1);
  transform: translateY(-2px);
}

.insight-card--success {
  border-left: 4px solid #10b981;
}

.insight-card--warning {
  border-left: 4px solid #f59e0b;
}

.insight-card--info {
  border-left: 4px solid #3b82f6;
}

.insight-header {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.insight-label {
  font-size: 0.6875rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  color: #64748b;
  text-transform: uppercase;
}

.insight-title {
  font-size: 1.25rem;
  font-weight: 700;
  color: #0f172a;
  margin: 0;
  line-height: 1.3;
}

.insight-message {
  font-size: 0.875rem;
  color: #475569;
  line-height: 1.6;
  margin: 0;
  flex: 1;
}

.insight-evidence {
  margin: 0.125rem 0 0;
  padding: 0.625rem 0.75rem;
  list-style: none;
  background: var(--bg-body);
  border: 1px solid #e2e8f0;
  border-radius: var(--radius-md);
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
}

.insight-evidence li {
  margin: 0;
  font-size: 0.75rem;
  line-height: 1.45;
  color: #475569;
}

.insight-link {
  display: inline-flex;
  align-items: center;
  gap: 0.375rem;
  font-size: 0.8125rem;
  font-weight: 600;
  color: #3b82f6;
  text-decoration: none;
  margin-top: auto;
  transition: color 0.15s ease;
}

.insight-link:hover {
  color: #1d4ed8;
}

/* --- Chart Section --- */
.chart-section {
  padding: 2.5rem 0;
  background: #fff;
}

.chart-section:nth-child(even) {
  background: var(--bg-body);
}

.chart-section h2 {
  font-size: 1.25rem;
  font-weight: 700;
  color: #0f172a;
  margin: 0 0 0.5rem;
  text-align: left;
}

.chart-section-desc {
  font-size: 0.9375rem;
  color: #64748b;
  margin: 0 0 1.5rem;
  line-height: 1.6;
}

.chart-section-note {
  font-size: 0.8125rem;
  color: #475569;
  margin: -0.75rem 0 1rem;
  line-height: 1.55;
}

.stats-focus-note {
  display: grid;
  gap: 0.75rem;
  margin: 0 0 1rem;
  padding: 1rem 1.1rem;
  border-radius: 16px;
  border: 1px solid #bfdbfe;
  background: linear-gradient(180deg, #eff6ff 0%, #ffffff 100%);
}

.stats-focus-note__eyebrow {
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  color: #1d4ed8;
}

.stats-focus-note__body strong {
  display: block;
  margin-bottom: 0.3rem;
  font-size: 1rem;
  line-height: 1.45;
  color: #0f172a;
}

.stats-focus-note__body p {
  margin: 0;
  font-size: 0.875rem;
  line-height: 1.6;
  color: #475569;
}

.stats-focus-note__links {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
}

.stats-focus-note__link {
  display: inline-flex;
  flex-direction: column;
  gap: 0.18rem;
  padding: 0.65rem 0.8rem;
  border-radius: 12px;
  background: #ffffff;
  border: 1px solid #cbd5e1;
  font-size: 0.82rem;
  font-weight: 700;
  color: #1d4ed8;
  text-decoration: none;
}

.stats-focus-note__link span {
  font-size: 0.78rem;
  font-weight: 600;
  line-height: 1.45;
  color: #475569;
}

.stats-focus-note__link--secondary {
  color: #0f172a;
}

.stats-chart-wrapper {
  position: relative;
  width: 100%;
  max-width: 100%;
  min-width: 0;
  aspect-ratio: 16 / 6;
  min-height: 220px;
  max-height: 360px;
  overflow-x: clip;
}

.stats-chart-wrapper.is-focused {
  outline: 2px solid color-mix(in srgb, var(--accent) 28%, transparent);
  outline-offset: 6px;
  border-radius: var(--dory-stats-card-radius);
}

.stats-chart-wrapper canvas.stats-chart-canvas {
  display: block;
  width: 100% !important;
  height: 100% !important;
  max-width: 100% !important;
}

/* Interactive event chips below chart */
.chart-event-list {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-top: 1rem;
}

.chart-event-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.375rem;
  padding: 0.3125rem 0.75rem;
  border-radius: var(--radius-full);
  font-size: 0.8125rem;
  font-weight: 500;
  color: var(--text-tertiary);
  background: color-mix(in srgb, var(--accent) 4%, var(--bg-body));
  border: 1.5px solid var(--dory-stats-border-soft);
  cursor: pointer;
  transition:
    background var(--transition-base),
    border-color var(--transition-base),
    color var(--transition-base);
  user-select: none;
}

.chart-event-chip:hover {
  background: color-mix(in srgb, var(--accent) 8%, var(--bg-body));
  border-color: var(--dory-stats-border);
}

.chart-event-chip.active {
  background: var(--accent-lightest);
  border-color: color-mix(in srgb, var(--accent) 34%, var(--border));
  color: var(--dory-stats-accent-text);
}

.chart-event-chip[data-event-type="vaccination"].active {
  background: color-mix(in srgb, var(--error) 8%, var(--bg-surface));
  border-color: color-mix(in srgb, var(--error) 28%, var(--border));
  color: color-mix(in srgb, var(--error) 78%, var(--text-primary));
}

.chart-event-chip--static {
  cursor: default;
  background: var(--bg-body);
  border-color: var(--dory-stats-border-soft);
  color: var(--text-secondary);
}

.chart-event-chip--static:hover {
  background: var(--bg-body);
  border-color: #dbe7f4;
}

.learning-breakdown {
  margin-top: 1.25rem;
  border: 1px solid #e2e8f0;
  border-radius: var(--radius-lg);
  background: #fff;
  padding: 1rem;
}

.learning-breakdown__title {
  margin: 0;
  font-size: 1rem;
  font-weight: 700;
  color: #0f172a;
}

.learning-breakdown__desc {
  margin: 0.5rem 0 0.75rem;
  font-size: 0.8125rem;
  color: #475569;
  line-height: 1.5;
}

.learning-breakdown__table-wrap {
  overflow-x: auto;
}

.learning-breakdown__table {
  width: 100%;
  border-collapse: collapse;
  min-width: 680px;
}

.learning-breakdown__table th,
.learning-breakdown__table td {
  border-top: 1px solid #e2e8f0;
  padding: 0.625rem 0.5rem;
  text-align: left;
  vertical-align: top;
  font-size: 0.8125rem;
  color: #334155;
  line-height: 1.45;
}

.learning-breakdown__table th {
  color: #0f172a;
  font-weight: 700;
  background: var(--bg-body);
}

.learning-breakdown__table td strong {
  color: #0f172a;
}

.learning-breakdown__rate {
  display: block;
  font-size: 1.125rem;
  line-height: 1.1;
}

.learning-breakdown__outcome-meta {
  display: block;
  margin-top: 0.25rem;
  color: #475569;
}

.learning-breakdown__list {
  display: grid;
  gap: 0.375rem;
  margin: 0;
  padding: 0;
  list-style: none;
}

.learning-breakdown__list-item {
  padding: 0.375rem 0.5rem;
  border-radius: 10px;
  background: var(--bg-body);
  color: #1e293b;
  line-height: 1.55;
  overflow-wrap: break-word;
}

.learning-breakdown__list-item--alert {
  background: #fff1f2;
  color: #9f1239;
  font-weight: 700;
}

.learning-breakdown__empty {
  display: block;
  color: #64748b;
  line-height: 1.6;
}

.learning-breakdown__cell--learn,
.learning-breakdown__cell--fail {
  overflow-wrap: break-word;
  word-break: normal;
  line-break: auto;
}

.learning-breakdown__row {
  cursor: pointer;
}

.learning-breakdown__row td {
  transition: background-color 0.15s ease;
}

.learning-breakdown__row:hover td {
  background: var(--bg-body);
}

.learning-breakdown__row.is-active td {
  background: #ecfeff;
}

.learning-breakdown__row:focus-visible td {
  outline: 2px solid #10b981;
  outline-offset: -2px;
}

.learning-breakdown__cards {
  display: none;
}

.learning-breakdown__card {
  display: grid;
  gap: 0;
  border: 1px solid #e2e8f0;
  border-radius: 16px;
  overflow: hidden;
  background: #ffffff;
  box-shadow: 0 8px 24px rgba(15, 23, 42, 0.04);
  transition: border-color 0.15s ease, box-shadow 0.15s ease, transform 0.15s ease;
}

.learning-breakdown__card:hover {
  border-color: #cbd5e1;
  box-shadow: 0 10px 28px rgba(15, 23, 42, 0.08);
}

.learning-breakdown__card.is-active {
  border-color: #67e8f9;
  box-shadow: 0 0 0 1px rgba(103, 232, 249, 0.5), 0 10px 28px rgba(6, 182, 212, 0.12);
}

.learning-breakdown__card:focus-visible {
  outline: 2px solid #10b981;
  outline-offset: 2px;
}

.learning-breakdown__card-week {
  padding: 0.875rem 1rem;
  background: var(--bg-body);
  font-size: 0.95rem;
  font-weight: 700;
  color: #0f172a;
}

.learning-breakdown__card-section {
  display: grid;
  gap: 0.45rem;
  padding: 0.875rem 1rem;
  align-items: start;
}

.learning-breakdown__card-section + .learning-breakdown__card-section {
  border-top: 1px solid #eef2f7;
}

.learning-breakdown__card-label {
  display: block;
  font-size: 0.6875rem;
  font-weight: 700;
  color: #64748b;
  letter-spacing: 0.05em;
}

.learning-breakdown__card .learning-breakdown__rate {
  font-size: 1.35rem;
}

.learning-breakdown__card .learning-breakdown__outcome-meta {
  font-size: 0.8125rem;
  line-height: 1.5;
}

.learning-breakdown__card .learning-breakdown__list {
  gap: 0.5rem;
}

.learning-breakdown__card .learning-breakdown__list-item {
  padding: 0.5rem 0.625rem;
  border-radius: 12px;
  font-size: 0.8125rem;
  line-height: 1.65;
}

.learning-breakdown__card .learning-breakdown__empty {
  font-size: 0.8125rem;
  line-height: 1.65;
}

.learning-breakdown--compact {
  padding: 0.875rem;
}

.learning-breakdown--compact .learning-breakdown__table-wrap {
  display: none;
}

.learning-breakdown--compact .learning-breakdown__cards {
  display: grid;
  gap: 0.75rem;
}

@media (max-width: 900px) {
  .learning-breakdown {
    padding: 1rem;
    border-radius: 18px;
  }

  .learning-breakdown__desc {
    margin-bottom: 1rem;
  }

  .learning-breakdown__table-wrap {
    display: none;
  }

  .learning-breakdown__cards {
    display: grid;
    gap: var(--space-3);
  }

  .learning-breakdown__card {
    border-radius: var(--dory-stats-card-radius);
    border-color: var(--dory-stats-border-soft);
    box-shadow: var(--dory-stats-card-shadow);
  }

  .learning-breakdown__card-week {
    padding: var(--space-3) var(--space-4);
    background: var(--dory-stats-surface-alt);
    border-bottom: 1px solid var(--dory-stats-border-soft);
  }

  .learning-breakdown__card-section {
    gap: 0.625rem;
    padding: var(--space-3) var(--space-4);
  }

  .learning-breakdown__card-section--outcome {
    background: linear-gradient(180deg, color-mix(in srgb, var(--accent) 3%, var(--bg-body)) 0%, var(--dory-stats-surface) 100%);
  }

  .learning-breakdown__card-label {
    font-size: 0.75rem;
    letter-spacing: 0.08em;
  }

  .learning-breakdown__card .learning-breakdown__rate {
    font-size: 1.5rem;
  }

  .learning-breakdown__card .learning-breakdown__outcome-meta,
  .learning-breakdown__card .learning-breakdown__empty,
  .learning-breakdown__card .learning-breakdown__list-item {
    font-size: 0.875rem;
    line-height: 1.7;
    word-break: keep-all;
    overflow-wrap: anywhere;
  }

  .learning-breakdown__card .learning-breakdown__list {
    gap: 0.625rem;
  }

  .learning-breakdown__card .learning-breakdown__list-item {
    padding: 0.625rem 0.75rem;
    border-radius: 14px;
  }

  .learning-breakdown__card .learning-breakdown__list-item--alert {
    border: 1px solid #fecdd3;
  }
}

@media (max-width: 520px) {
  .learning-breakdown__card-week,
  .learning-breakdown__card-section {
    padding-left: 0.875rem;
    padding-right: 0.875rem;
  }

  .learning-breakdown__card .learning-breakdown__rate {
    font-size: 1.4rem;
  }
}

.chart-event-icon {
  font-size: 0.875rem;
  line-height: 1;
}

/* --- Achievements Section --- */
.achievements-section {
  padding: 2.5rem 0;
  background: var(--bg-body);
}

.achievements-section h2 {
  font-size: 1.375rem;
  font-weight: 700;
  color: #0f172a;
  margin: 0 0 1.5rem;
  text-align: left;
}

.achievements-section__desc {
  margin: -0.75rem 0 1.25rem;
  color: #475569;
  font-size: 0.95rem;
  line-height: 1.55;
}

.achievements-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 240px), 1fr));
  gap: 1rem;
  margin-bottom: 2rem;
}

.achievement-card {
  background: #fff;
  border-radius: var(--radius-lg);
  padding: 1.25rem;
  border: 1px solid #e2e8f0;
  display: flex;
  align-items: flex-start;
  gap: 1rem;
  box-shadow: 0 1px 3px rgba(0,0,0,0.06);
}

.achievement-card--major {
  border-top: 3px solid #f59e0b;
}

.achievement-icon {
  font-size: 2rem;
  line-height: 1;
  flex-shrink: 0;
}

.achievement-content {
  flex: 1;
  min-width: 0;
}

.achievement-date {
  font-size: 0.75rem;
  font-weight: 600;
  color: #94a3b8;
  margin-bottom: 0.25rem;
}

.achievement-title {
  font-size: 1rem;
  font-weight: 700;
  color: #0f172a;
  margin: 0 0 0.25rem;
  line-height: 1.3;
}

.achievement-metrics {
  list-style: none;
  margin: 0.6rem 0 0;
  padding: 0;
  display: grid;
  gap: 0.2rem;
}

.achievement-metrics li {
  margin: 0;
  color: #334155;
  font-size: 0.83rem;
  line-height: 1.45;
}

/* Achievement history list */
.achievements-history {
  border-top: 1px solid #e2e8f0;
  padding-top: 1.5rem;
}

.achievements-history h3 {
  font-size: 1rem;
  font-weight: 700;
  color: #0f172a;
  margin: 0 0 1rem;
}

.history-list {
  display: flex;
  flex-wrap: wrap;
  gap: 0.625rem;
}

.history-item {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  background: #fff;
  border: 1px solid #e2e8f0;
  border-radius: var(--radius-md);
  padding: 0.375rem 0.75rem;
  font-size: 0.875rem;
  color: #334155;
}

/* Container spacing for new sections */
.key-insights-section .container,
.chart-section .container,
.achievements-section .container {
  padding-left: var(--mobile-content-gutter, 0.875rem);
  padding-right: var(--mobile-content-gutter, 0.875rem);
}

@media (min-width: 768px) {
  .key-insights-section .container,
  .chart-section .container,
  .achievements-section .container {
    padding-left: var(--space-6);
    padding-right: var(--space-6);
  }
}

@media (max-width: 600px) {
  .key-insights-grid {
    grid-template-columns: 1fr;
  }

  .achievements-grid {
    grid-template-columns: 1fr;
  }

  .stats-chart-wrapper {
    aspect-ratio: 4 / 3;
    min-height: 180px;
  }
}

/* ==========================================================================
   Mobile Section Tone Layout (No Card UI)
   ========================================================================== */
@media (max-width: 768px) {
  .dory-stats-page.tw-readable-page {
    padding-left: 0;
    padding-right: 0;
  }

  .layout-container.layout-container--with-vertical.fixed-page-shell.dory-stats-container {
    padding-left: 0;
    padding-right: 0;
  }

  .dory-stats-page > section {
    padding: clamp(1.6rem, 6vw, 2.25rem) 0;
  }

  .dory-stats-page .container.tw-readable-container {
    padding-left: var(--dory-stats-mobile-edge);
    padding-right: var(--dory-stats-mobile-edge);
  }

  .dory-stats-page .tw-readable-hero.tw-readable-section {
    padding-top: 0.45rem;
    padding-bottom: 0.7rem;
  }

  .dory-stats-page .tw-readable-hero .fixed-page-hero__surface {
    width: calc(100% - (var(--dory-stats-mobile-edge) * 2));
    padding:
      clamp(1.05rem, 4.8vw, 1.3rem)
      clamp(0.82rem, 3.6vw, 1rem)
      clamp(0.92rem, 3.8vw, 1.12rem);
  }

  .dory-stats-page .tw-readable-hero .page-hero__title {
    max-width: 10ch;
    font-size: clamp(2rem, 12vw, 2.95rem);
  }

  .dory-stats-page .tw-readable-hero .page-hero__subtitle {
    max-width: 18.5rem;
  }

  .dory-stats-hero__stats {
    gap: 0.45rem;
    margin-top: 0.9rem;
  }

  .dory-stats-hero__stat {
    padding: 0.62rem 0.45rem;
  }

  .dory-stats-hero__stat-label {
    font-size: 0.64rem;
  }

  .dory-stats-page .tw-readable-hero + .key-insights-section {
    padding-top: 0.7rem;
  }

  .dory-stats-page > section:not(.page-hero) {
    background: var(--dory-stats-surface);
  }

  .dory-stats-page > section:nth-of-type(even):not(.page-hero) {
    background: var(--dory-stats-surface-alt);
  }

  .dory-stats-page .stats-cta::before {
    display: none;
  }

  .dory-stats-page .stats-cta {
    background: var(--dory-stats-surface-alt);
    border-top: 1px solid var(--dory-stats-border-soft);
    border-bottom: 1px solid var(--dory-stats-border-soft);
  }

  .dory-stats-page .container:not(.tw-readable-container) {
    width: 100%;
    max-width: none;
    padding-left: clamp(0.875rem, 4vw, 1.125rem);
    padding-right: clamp(0.875rem, 4vw, 1.125rem);
  }

  .dory-stats-page .key-insights-grid,
  .dory-stats-page .achievements-grid {
    grid-template-columns: 1fr;
    gap: 0;
  }

  .dory-stats-page.tw-readable-page .tw-readable-card.insight-card,
  .dory-stats-page.tw-readable-page .tw-readable-card.achievement-card,
  .dory-stats-page .history-item {
    background: transparent;
    border: 0;
    border-radius: 0;
    box-shadow: none;
    margin: 0;
    padding: 1rem 0;
    transform: none;
  }

  .dory-stats-page.tw-readable-page .tw-readable-card.insight-card::before {
    display: none;
  }

  .dory-stats-page .key-insights-grid > *:not(:last-child),
  .dory-stats-page .achievements-grid > *:not(:last-child),
  .dory-stats-page .history-list > *:not(:last-child) {
    border-bottom: 1px solid var(--dory-stats-border-soft);
  }

  .dory-stats-page.tw-readable-page .tw-readable-card.insight-card:hover,
  .dory-stats-page.tw-readable-page .tw-readable-card.achievement-card:hover {
    box-shadow: none;
    transform: none;
  }

  .dory-stats-page .stats-cta .cta-title,
  .dory-stats-page .stats-cta h2,
  .dory-stats-page .stats-cta p {
    color: var(--text-primary) !important;
  }

  .dory-stats-page .stats-cta .cta-button--primary,
  .dory-stats-page .stats-cta .cta-button--secondary {
    background: color-mix(in srgb, var(--accent) 5%, var(--dory-stats-surface));
    color: var(--text-primary);
    border: 1px solid var(--dory-stats-border-soft);
    box-shadow: none;
  }

  .dory-stats-page .stats-cta .cta-button--primary:hover,
  .dory-stats-page .stats-cta .cta-button--secondary:hover {
    background: color-mix(in srgb, var(--accent) 8%, var(--dory-stats-surface));
    color: var(--text-primary);
    box-shadow: none;
    transform: none;
  }

  .dory-stats-page .stats-cta .stats-next-read__button,
  .dory-stats-page .stats-cta .stats-next-read__button:hover {
    background: linear-gradient(135deg, var(--border-focus) 0%, var(--accent) 100%);
    color: var(--text-inverse);
    border-color: var(--accent);
  }
}
