// SS2 — Measurement Result (Exam Mode), Light Mode

function ChevronLeft({ size = 44, color = '#15803D' }) {
  return (
    <svg width={size} height={size} viewBox="0 0 24 24" fill="none">
      <path d="M15 5 L8 12 L15 19" stroke={color} strokeWidth="2.2"
        strokeLinecap="round" strokeLinejoin="round" />
    </svg>
  );
}

function ArrowUp({ size = 32, color = '#059669' }) {
  return (
    <svg width={size} height={size} viewBox="0 0 24 24" fill="none">
      <path d="M12 19 L12 5 M5 12 L12 5 L19 12" stroke={color} strokeWidth="2.4"
        strokeLinecap="round" strokeLinejoin="round" />
    </svg>
  );
}

function HeartSquare({ size = 40, color = '#15803D' }) {
  return (
    <svg width={size} height={size} viewBox="0 0 24 24" fill="none">
      <rect x="3" y="3" width="18" height="18" rx="4" stroke={color} strokeWidth="1.8" fill="none"/>
      <path d="M12 17 C9 15 6.5 13 6.5 10.5 C6.5 9 7.7 7.8 9.2 7.8 C10.4 7.8 11.4 8.5 12 9.5 C12.6 8.5 13.6 7.8 14.8 7.8 C16.3 7.8 17.5 9 17.5 10.5 C17.5 13 15 15 12 17 Z"
        fill={color}/>
    </svg>
  );
}

function StatTile({ value, label, mono = true }) {
  return (
    <div style={{ flex: 1, textAlign: 'center' }}>
      <div style={{
        fontSize: 52, fontWeight: 600, color: RC.textPrimaryLight,
        fontFamily: mono ? RC.fontMono : RC.fontSans,
        fontVariantNumeric: 'tabular-nums',
        letterSpacing: -1,
      }}>{value}</div>
      <div style={{
        marginTop: 8,
        fontSize: 30, color: RC.textSecondaryLight, fontWeight: 400,
      }}>{label}</div>
    </div>
  );
}

function SS2ResultExam() {
  return (
    <ScreenshotShell
      dark={false}
      headline="跳完即知中考分数"
      subline="距满分还差多少，数字说话"
      caption="9省市中考标准 · 精确对照你的评分"
    >
      <div style={{ position: 'absolute', inset: 0, background: RC.bgLight, overflow: 'hidden' }}>
        <StatusBar dark={false} />

        {/* Nav bar — transparent overlay */}
        <div style={{
          position: 'absolute', top: 132, left: 0, right: 0,
          height: 110,
          display: 'flex', alignItems: 'center', justifyContent: 'space-between',
          padding: '0 40px',
        }}>
          <ChevronLeft size={56} color={RC.accentLight} />
          <span style={{
            fontSize: 44, fontWeight: 600, color: RC.accentLight,
            fontFamily: RC.fontSans, paddingRight: 12,
          }}>完成</span>
        </div>

        {/* Scrollable column content */}
        <div style={{
          position: 'absolute', top: 250, left: 0, right: 0,
          padding: '0 48px',
          display: 'flex', flexDirection: 'column', alignItems: 'stretch',
        }}>
          {/* Label */}
          <div style={{
            textAlign: 'center', fontSize: 34, color: RC.textSecondaryLight,
            fontWeight: 400, letterSpacing: 1,
          }}>本次测试</div>

          {/* Hero count */}
          <div style={{
            marginTop: 18,
            textAlign: 'center',
            fontFamily: RC.fontRounded,
            fontWeight: 200,
            fontSize: 380, lineHeight: 0.95,
            color: RC.examMidLight,
            fontVariantNumeric: 'tabular-nums',
            letterSpacing: -8,
          }}>127</div>

          <div style={{
            textAlign: 'center', fontSize: 32, color: RC.textSecondaryLight,
            marginTop: 4, fontWeight: 400,
          }}>次</div>

          {/* Large ExamScoreBadge — examMid tint */}
          <div style={{
            alignSelf: 'center', marginTop: 36,
            padding: '20px 44px',
            borderRadius: 9999,
            background: 'rgba(17,94,51,0.12)',
            display: 'inline-flex', alignItems: 'center', gap: 14,
          }}>
            <span style={{
              fontFamily: RC.fontRounded, fontWeight: 500,
              fontSize: 56, color: RC.examMidLight,
              fontVariantNumeric: 'tabular-nums',
              letterSpacing: -0.5,
            }}>中考 <span style={{ fontWeight: 600 }}>17</span> 分 / 满分 20</span>
          </div>

          {/* Progress card */}
          <div style={{
            marginTop: 56,
            background: RC.surfaceLight,
            borderRadius: 28,
            padding: '40px 44px',
            boxShadow: '0 4px 18px rgba(15,23,42,0.06)',
            border: `1px solid ${RC.borderLight}`,
          }}>
            <div style={{
              fontSize: 38, fontWeight: 600, color: RC.textPrimaryLight,
              letterSpacing: -0.5,
            }}>距离满分还差 <span style={{ fontFamily: RC.fontMono, fontVariantNumeric: 'tabular-nums' }}>60</span> 个</div>
            <div style={{
              marginTop: 28,
              height: 14, borderRadius: 9999,
              background: '#F1F5F9',
              position: 'relative', overflow: 'hidden',
            }}>
              <div style={{
                width: '67.9%', height: '100%', borderRadius: 9999,
                background: RC.examMidLight,
              }} />
            </div>
            <div style={{
              marginTop: 18, display: 'flex', justifyContent: 'space-between',
              fontSize: 28, color: RC.textSecondaryLight, fontWeight: 400,
            }}>
              <span>你的位置 <span style={{ fontFamily: RC.fontMono, color: RC.textPrimaryLight, fontWeight: 600 }}>127</span></span>
              <span>满分 <span style={{ fontFamily: RC.fontMono, color: RC.textPrimaryLight, fontWeight: 600 }}>187</span></span>
            </div>
          </div>

          {/* Improvement card */}
          <div style={{
            marginTop: 22,
            background: RC.surfaceLight,
            borderRadius: 28,
            padding: '32px 44px',
            boxShadow: '0 4px 18px rgba(15,23,42,0.06)',
            border: `1px solid ${RC.borderLight}`,
          }}>
            <div style={{
              display: 'flex', alignItems: 'center', gap: 12,
              fontSize: 38, fontWeight: 600, color: RC.successLight,
              letterSpacing: -0.3,
            }}>
              <span>比上次最佳多 <span style={{ fontFamily: RC.fontMono, fontVariantNumeric: 'tabular-nums' }}>8</span> 个</span>
              <ArrowUp size={36} color={RC.successLight} />
            </div>
            <div style={{
              marginTop: 8,
              fontSize: 28, color: RC.textSecondaryLight, fontWeight: 400,
              fontVariantNumeric: 'tabular-nums',
            }}>上次 119 → 本次 127</div>
          </div>

          {/* Stats grid 3 col */}
          <div style={{
            marginTop: 22,
            background: RC.surfaceLight,
            borderRadius: 28,
            padding: '36px 28px',
            boxShadow: '0 4px 18px rgba(15,23,42,0.06)',
            border: `1px solid ${RC.borderLight}`,
            display: 'flex', alignItems: 'center',
          }}>
            <StatTile value="60s" label="时长" />
            <div style={{ width: 1, height: 76, background: RC.borderLight }} />
            <StatTile value="127" label="个/分" />
            <div style={{ width: 1, height: 76, background: RC.borderLight }} />
            <StatTile value="≈23" label="千卡" />
          </div>

          {/* Primary CTA */}
          <button style={{
            marginTop: 40,
            height: 116, borderRadius: 22,
            background: RC.accentLight, color: RC.onAccentLight,
            fontSize: 40, fontWeight: 600, letterSpacing: 1,
            border: 'none', cursor: 'pointer',
            fontFamily: RC.fontSans,
            boxShadow: '0 4px 14px rgba(21,128,61,0.25)',
          }}>再来一次</button>

          {/* Secondary CTA */}
          <button style={{
            marginTop: 16,
            height: 116, borderRadius: 22,
            background: 'transparent', color: RC.textPrimaryLight,
            fontSize: 38, fontWeight: 500,
            border: `1.5px solid ${RC.borderLight}`,
            cursor: 'pointer',
            fontFamily: RC.fontSans,
            display: 'inline-flex', alignItems: 'center', justifyContent: 'center', gap: 14,
          }}>
            <HeartSquare size={42} color={RC.accentLight} />
            <span>同步到「健康」</span>
          </button>

          {/* Footer footnote */}
          <div style={{
            marginTop: 28, textAlign: 'center',
            fontSize: 26, color: RC.textTertiaryLight, fontWeight: 400,
          }}>继续保持 · 每周 3 次稳定练习就能进步</div>
        </div>
      </div>
    </ScreenshotShell>
  );
}

window.SS2ResultExam = SS2ResultExam;
