/* ========================================
   SCORING
   ======================================== */
.scoring {
  padding: var(--section-padding);
  background: transparent;
}

.scoring h2 {
  text-align: center;
  font-size: 2.2rem;
  margin-bottom: 16px;
}

.scoring .section-subtitle {
  max-width: 900px;
  margin-left: auto;
  margin-right: auto;
}

.scoring-view-toggle {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  width: fit-content;
  gap: 0;
  margin: 0 auto 28px;
  padding: 4px;
  border-radius: 9999px;
  background: rgb(255, 255, 255, 0.7);
  box-shadow: 0 12px 28px rgb(10, 17, 40, 0.08);
}

.scoring-view-btn {
  min-width: 120px;
  min-height: 42px;
  padding: 0 18px;
  border-radius: 9999px;
  color: rgb(28, 31, 53, 0.62);
  font-size: 0.88rem;
  font-weight: 700;
  text-align: center;
  transition:
    background 0.2s,
    color 0.2s,
    box-shadow 0.2s;
}

.scoring-view-btn.is-active {
  background: var(--primary-blue);
  color: var(--white);
  box-shadow: 0 8px 18px rgb(22, 93, 252, 0.28);
}

[data-scoring-panel][hidden] {
  display: none !important;
}

.score-cards {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 28px;
}

.score-card {
  background: var(--white);
  border-radius: var(--radius-md);
  box-shadow: 0 2px 16px rgb(0, 0, 0, 0.06);
  padding: 32px 28px;
  text-align: center;
}

.score-history-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 28px;
}

.score-history-card {
  background: var(--white);
  border-radius: var(--radius-md);
  box-shadow: 0 2px 16px rgb(0, 0, 0, 0.06);
  padding: 24px 24px 20px;
}

.score-history-head {
  margin-bottom: 16px;
}

.score-history-head h3 {
  font-size: 1.4rem;
  line-height: 1.15;
}

.score-history-chart svg {
  width: 100%;
  height: auto;
  display: block;
}

.score-history-grid-lines line {
  stroke: rgb(28, 31, 53, 0.14);
  stroke-width: 1;
}

.score-history-axis-labels text {
  fill: rgb(28, 31, 53, 0.62);
  font-size: 11px;
  font-weight: 500;
}

.score-history-axis-x text {
  font-size: 10px;
}

.score-history-line {
  fill: none;
  stroke: #b266e4;
  stroke-width: 3;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-dasharray: 1;
  stroke-dashoffset: 1;
}

.score-history-card-breathwork .score-history-line {
  stroke: #165dfc;
}

.score-history-card-brain .score-history-line {
  stroke: #0bb980;
}

.score-history-point {
  fill: #b266e4;
  stroke: var(--white);
  stroke-width: 3;
  opacity: 0;
  transform-box: fill-box;
  transform-origin: center;
  transform: scale(0.3);
}

.score-history-card-breathwork .score-history-point {
  fill: #165dfc;
}

.score-history-card-brain .score-history-point {
  fill: #0bb980;
}

.score-history-guide {
  stroke: rgb(178, 102, 228, 0.35);
  stroke-width: 1.5;
  stroke-dasharray: 4 4;
  opacity: 0;
}

.score-history-card-breathwork .score-history-guide {
  stroke: rgb(92, 146, 229, 0.35);
}

.score-history-tooltip {
  opacity: 0;
}

.score-history-tooltip rect {
  fill: rgb(255, 255, 255, 0.94);
  stroke: rgb(28, 31, 53, 0.12);
  stroke-width: 1;
}

.score-history-tooltip text {
  fill: var(--text-heading);
  font-size: 10px;
  font-weight: 500;
}

.score-ring-wrap {
  position: relative;
  width: 140px;
  height: 140px;
  margin: 0 auto 24px;
}

.score-ring {
  width: 100%;
  height: 100%;
  transform: rotate(-90deg);
}

.ring-bg {
  fill: none;
  stroke: #eef0f5;
  stroke-width: 10;
}

.ring-progress {
  fill: none;
  stroke-width: 10;
  stroke-linecap: round;
  stroke-dasharray: 326.73;
  stroke-dashoffset: 326.73;
  transition: stroke-dashoffset 1.5s ease-out;
}

.score-value {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}

.score-number {
  font-size: 2.4rem;
  font-weight: 700;
  color: var(--text-heading);
  line-height: 1;
}

.score-label {
  font-size: 0.78rem;
  color: var(--text-body);
  margin-top: 4px;
}

.score-metrics {
  text-align: left;
  border-top: 1px solid #eef0f5;
  padding-top: 20px;
  margin-top: 8px;
}

.metric {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 24px;
  padding-bottom: 24px;
  border-bottom: 1px solid #eef0f5;
  position: relative;
  outline: none;
}

.metric:last-child {
  margin-bottom: 0;
  padding-bottom: 0;
  border-bottom: none;
}

.metric-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.metric-name {
  font-size: 0.88rem;
  font-weight: 500;
  color: var(--text-heading);
}

.metric-right {
  display: flex;
  align-items: center;
  gap: 8px;
}

.metric-info {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  border: 1.5px solid #c0c5d0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 0.7rem;
  font-weight: 500;
  color: #9098a8;
  cursor: help;
  flex-shrink: 0;
  transition:
    border-color 0.2s,
    color 0.2s,
    background 0.2s;
}

.metric:hover .metric-info,
.metric:focus-visible .metric-info,
.metric:focus-within .metric-info,
.metric-info:hover,
.metric-info:focus-visible {
  border-color: var(--primary-blue);
  color: var(--primary-blue);
  background: rgb(22, 93, 252, 0.08);
}

.score-tooltip {
  position: fixed;
  max-width: min(260px, calc(100vw - 24px));
  padding: 10px 12px;
  border-radius: 14px;
  background: var(--white);
  color: var(--text-heading);
  border: 1px solid rgb(225, 231, 245, 0.95);
  font-size: 0.74rem;
  font-weight: 500;
  line-height: 1.45;
  text-align: left;
  box-shadow: 0 14px 30px rgb(17, 24, 39, 0.12);
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.15s ease;
  z-index: 1200;
}

.score-tooltip.is-visible {
  opacity: 1;
}

.consistency-popup {
  position: fixed;
  width: min(380px, calc(100vw - 24px));
  max-height: min(420px, calc(100vh - 32px));
  background: var(--white);
  border: 1px solid #eadcf6;
  border-radius: 24px;
  box-shadow: 0 20px 48px rgb(18, 24, 40, 0.18);
  overflow: hidden;
  z-index: 1250;
}

.consistency-popup[hidden] {
  display: none;
}

.consistency-popup.is-meditation {
  --popup-accent: #d5a7f3;
  --popup-accent-strong: #b266e4;
  --popup-row-highlight: rgb(210, 170, 244, 0.14);
}

.consistency-popup.is-breathwork {
  --popup-accent: #165dfc;
  --popup-accent-strong: #165dfc;
  --popup-row-highlight: rgb(92, 146, 229, 0.12);
}

.consistency-popup.is-brain-training {
  --popup-accent: #79d795;
  --popup-accent-strong: #0bb980;
  --popup-row-highlight: rgb(85, 198, 117, 0.12);
}

.consistency-popup-header {
  display: flex;
  align-items: center;
  padding: 14px 18px;
  background: rgb(255, 255, 255, 0.98);
  border-bottom: 1px solid #eef0f5;
}

.consistency-popup-title {
  color: var(--popup-accent-strong, #8f6ac7);
  font-size: 0.92rem;
  font-weight: 700;
}

.consistency-popup-body {
  max-height: min(360px, calc(100vh - 84px));
  overflow: auto;
  -webkit-overflow-scrolling: touch;
}

.consistency-popup-list {
  max-height: min(360px, calc(100vh - 84px));
}

.consistency-popup-row {
  display: grid;
  grid-template-columns: 64px minmax(0, 1fr) 72px;
  align-items: center;
  gap: 10px;
  padding: 10px 16px;
  border-bottom: 1px solid #eef0f5;
}

.consistency-popup-row:last-child {
  border-bottom: none;
}

.consistency-popup-row.is-current {
  background: var(--popup-row-highlight, rgb(213, 167, 243, 0.1));
}

.consistency-popup-row.is-current .consistency-popup-score,
.consistency-popup-row.is-current .consistency-popup-value {
  font-weight: 700;
  color: var(--popup-accent-strong, #b266e4);
}

.consistency-popup-row.is-current .consistency-popup-label {
  font-weight: 700;
  color: #22263a;
}

.consistency-popup-score,
.consistency-popup-value {
  color: var(--popup-accent, #d5a7f3);
  font-size: 0.96rem;
  font-weight: 700;
}

.consistency-popup-value {
  text-align: right;
}

.consistency-popup-label {
  color: #8f9096;
  font-size: 0.92rem;
  font-weight: 700;
  text-align: center;
}

.metric-bar {
  width: 100%;
  height: 14px;
  background: var(--bar-bg, #eef0f5);
  border-radius: 7px;
  overflow: hidden;
}

.metric-fill {
  height: 100%;
  width: 0%;
  border-radius: 7px;
  background: var(--bar-color);
  transition: width 1.2s ease-out;
}

.metric-val {
  font-size: 0.92rem;
  font-weight: 700;
  color: var(--text-heading);
  min-width: 24px;
  text-align: right;
}

/* ---- Score history chart animation ---- */
.score-history-grid.is-chart-animating .score-history-line {
  animation: scoreChartLineDraw 1.1s cubic-bezier(0.33, 1, 0.68, 1) 0.1s forwards;
}

.score-history-grid.is-chart-animating .score-history-area {
  animation: scoreChartFadeIn 0.55s ease 1s forwards;
}

.score-history-grid.is-chart-animating .score-history-guide {
  animation: scoreChartFadeIn 0.4s ease 1.1s forwards;
}

.score-history-grid.is-chart-animating .score-history-tooltip {
  animation: scoreChartFadeIn 0.4s ease 1.15s forwards;
}

.score-history-grid.is-chart-animating .score-history-point {
  animation: scoreChartPointIn 0.28s cubic-bezier(0.34, 1.56, 0.64, 1) 1.18s forwards;
}

.score-history-area {
  opacity: 0;
}

@keyframes scoreChartLineDraw {
  to {
    stroke-dashoffset: 0;
  }
}

@keyframes scoreChartFadeIn {
  to {
    opacity: 1;
  }
}

@keyframes scoreChartPointIn {
  to {
    opacity: 1;
    transform: scale(1);
  }
}
