:root {
  color-scheme: light;
  --violet: #5b43df;
  --violet-dark: #4430bb;
  --violet-soft: #f0edff;
  --ink: #1d2433;
  --muted: #6e778d;
  --line: #e5e8f0;
  --paper: #fff;
  --green: #16815e;
  --green-soft: #e9f8f2;
  --red: #d22b3a;
  --red-soft: #fff0f2;
  --amber: #a85d10;
  --amber-soft: #fff5df;
  font-family: Inter, "PingFang SC", "Microsoft YaHei", system-ui, sans-serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; max-width: 100%; overflow-x: hidden; background: #f4f6fb; color: var(--ink); }
button, input { font: inherit; }
button { cursor: pointer; }
.camera-card svg, .btn svg, .privacy-note svg, .ai-orbit svg, .error-icon svg {
  fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round;
}

.parent-header {
  position: sticky; top: 0; z-index: 20; height: 60px; padding: env(safe-area-inset-top) 16px 0;
  display: flex; align-items: center; justify-content: space-between; background: #ffffffed;
  border-bottom: 1px solid #e7e9f1; backdrop-filter: blur(14px);
}
.parent-brand { display: flex; align-items: center; gap: 9px; color: inherit; text-decoration: none; }
.parent-brand > span:last-child { display: grid; line-height: 1.05; }
.parent-brand strong { font-size: 18px; letter-spacing: -.03em; }
.parent-brand small { margin-top: 4px; color: var(--muted); font-size: 10px; }
.brand-symbol { width: 34px; height: 34px; display: grid; place-items: center; border-radius: 11px; background: linear-gradient(145deg, #735cf1, #4b35ca); color: white; font-size: 21px; font-weight: 850; box-shadow: 0 7px 18px #5b43df32; transform: rotate(-4deg); }
.private-badge { padding: 6px 9px; border-radius: 999px; background: #eef7f3; color: #30725e; font-size: 11px; font-weight: 700; }

#parent-app { width: min(100%, 560px); min-width: 0; min-height: calc(100dvh - 60px); margin: 0 auto; padding: 14px 14px calc(98px + env(safe-area-inset-bottom)); overflow-x: hidden; }
.screen-title { margin: 4px 2px 14px; }
.screen-title h1 { margin: 0; font-size: 24px; line-height: 1.25; letter-spacing: -.04em; }
.screen-title p { margin: 7px 0 0; color: var(--muted); font-size: 13px; line-height: 1.55; }

.mobile-card { overflow: hidden; border: 1px solid var(--line); border-radius: 18px; background: var(--paper); box-shadow: 0 10px 34px #33406a0c; }
.camera-card { position: relative; min-height: 64dvh; background: #111522; border: 0; }
.camera-stage { position: relative; min-height: 64dvh; display: grid; place-items: center; overflow: hidden; }
.camera-stage video { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.camera-guide { position: absolute; inset: 7%; border: 1.5px solid #ffffffd4; border-radius: 12px; box-shadow: 0 0 0 999px #080b126b; pointer-events: none; }
.camera-guide::before, .camera-guide::after { content: ""; position: absolute; width: 32px; height: 32px; border-color: #fff; }
.camera-guide::before { left: -2px; top: -2px; border-left: 4px solid; border-top: 4px solid; border-radius: 9px 0 0; }
.camera-guide::after { right: -2px; bottom: -2px; border-right: 4px solid; border-bottom: 4px solid; border-radius: 0 0 9px; }
.camera-hint { position: absolute; left: 50%; bottom: 88px; transform: translateX(-50%); width: max-content; max-width: 86%; padding: 8px 11px; border-radius: 999px; background: #0a0d16a8; color: white; font-size: 12px; text-align: center; }
.camera-actions { position: absolute; inset: auto 0 0; min-height: 77px; padding: 12px 18px calc(12px + env(safe-area-inset-bottom)); display: flex; align-items: center; justify-content: space-between; background: linear-gradient(transparent, #090c14db 38%); }
.round-action { width: 44px; height: 44px; display: grid; place-items: center; border: 0; border-radius: 50%; background: #ffffff1f; color: white; }
.round-action svg { width: 21px; height: 21px; }
.shutter { width: 62px; height: 62px; padding: 5px; border: 3px solid white; border-radius: 50%; background: transparent; }
.shutter::after { content: ""; display: block; width: 100%; height: 100%; border-radius: 50%; background: white; transition: transform .12s; }
.shutter:active::after { transform: scale(.82); }
.camera-empty { padding: 34px 28px; color: white; text-align: center; }
.camera-empty .empty-icon { width: 62px; height: 62px; display: grid; place-items: center; margin: 0 auto 17px; border-radius: 20px; background: #ffffff14; }
.camera-empty svg { width: 29px; height: 29px; }
.camera-empty strong { display: block; font-size: 18px; }
.camera-empty p { margin: 9px auto 19px; max-width: 270px; color: #bfc5d6; font-size: 13px; line-height: 1.6; }
.privacy-note { display: flex; align-items: flex-start; gap: 8px; margin: 12px 5px 0; color: #697389; font-size: 11px; line-height: 1.5; }
.privacy-note svg { flex: none; width: 15px; height: 15px; margin-top: 1px; color: var(--green); }

.photo-preview { position: relative; background: #e8ebf2; }
.photo-preview img { display: block; width: 100%; max-height: 65dvh; object-fit: contain; }
.page-pill { position: absolute; right: 10px; top: 10px; padding: 5px 9px; border-radius: 999px; background: #111521c7; color: white; font-size: 11px; font-weight: 700; }
.photo-strip { display: grid; grid-auto-flow: column; grid-auto-columns: 68px; gap: 9px; overflow-x: auto; padding: 12px; }
.photo-thumb { position: relative; width: 68px; height: 84px; padding: 0; overflow: hidden; border: 2px solid transparent; border-radius: 10px; background: #e7eaf1; }
.photo-thumb.active { border-color: var(--violet); }
.photo-thumb img { width: 100%; height: 100%; object-fit: cover; }
.photo-thumb span { position: absolute; right: 3px; bottom: 3px; padding: 2px 5px; border-radius: 999px; background: #171a24c9; color: white; font-size: 9px; }
.preview-tools { display: flex; gap: 8px; padding: 0 12px 12px; }

.fixed-actions { position: fixed; z-index: 18; left: 50%; bottom: 0; width: min(100%, 560px); transform: translateX(-50%); display: grid; grid-template-columns: .8fr 1.35fr; gap: 9px; padding: 11px 14px calc(11px + env(safe-area-inset-bottom)); background: #f7f8fce8; border-top: 1px solid #e3e6ef; backdrop-filter: blur(16px); }
.fixed-actions.single { grid-template-columns: 1fr; }
.btn { min-height: 47px; display: inline-flex; align-items: center; justify-content: center; gap: 7px; border: 1px solid #dfe3ec; border-radius: 13px; background: white; color: #414a60; font-weight: 750; }
.btn.primary { border-color: var(--violet); background: linear-gradient(135deg, #674ee8, #5139d0); color: white; box-shadow: 0 8px 20px #5139d02c; }
.btn.subtle { background: #f6f5ff; color: var(--violet-dark); }
.btn:disabled { opacity: .55; cursor: not-allowed; }
.btn svg { width: 17px; height: 17px; }

.grading-card { padding: 12px 12px 24px; text-align: center; }
.grading-preview { position: relative; isolation: isolate; height: 330px; overflow: hidden; border: 1px solid #dedbf3; border-radius: 12px; background: #eeedf7; }
.grading-photos { position: absolute; inset: 0; }
.grading-photo { position: absolute; inset: 0; display: block; width: 100%; height: 100%; object-fit: contain; opacity: 0; transition: opacity .6s ease; }
.grading-photo.active { opacity: 1; }
.grading-scan { position: absolute; inset: 36px 0 12px; pointer-events: none; }
.grading-scan span { position: absolute; inset: 0 0 auto; height: 64px; background: linear-gradient(transparent, #8064ff16 50%, #7958ff44); border-bottom: 2px solid #9f8aff; box-shadow: 0 5px 15px -6px #6238ff; animation: grading-scan 3.4s ease-in-out infinite alternate; }
.grading-viewfinder { position: absolute; inset: 42px 14px 14px; pointer-events: none; }
.grading-viewfinder i { position: absolute; width: 18px; height: 18px; border-color: #8b70ed; border-style: solid; }
.grading-viewfinder i:nth-child(1) { top: 0; left: 0; border-width: 2px 0 0 2px; border-radius: 5px 0 0; }
.grading-viewfinder i:nth-child(2) { top: 0; right: 0; border-width: 2px 2px 0 0; border-radius: 0 5px 0 0; }
.grading-viewfinder i:nth-child(3) { bottom: 0; left: 0; border-width: 0 0 2px 2px; border-radius: 0 0 0 5px; }
.grading-viewfinder i:nth-child(4) { bottom: 0; right: 0; border-width: 0 2px 2px 0; border-radius: 0 0 5px; }
.grading-preview-top { position: absolute; inset: 10px 10px auto; display: flex; align-items: center; justify-content: space-between; gap: 6px; }
.grading-live, .grading-page { display: inline-flex; align-items: center; gap: 6px; padding: 6px 9px; border: 1px solid #ffffffb3; border-radius: 999px; background: #ffffffed; color: #5944b0; box-shadow: 0 2px 10px #3220640b; font-size: 10px; font-weight: 700; }
.grading-live i { flex: none; width: 6px; height: 6px; border-radius: 50%; background: #7955ef; animation: grading-pulse 1.6s ease-in-out infinite; }
.grading-page { color: #606678; font-variant-numeric: tabular-nums; }
.grading-preview-status { position: absolute; left: 50%; bottom: 16px; transform: translateX(-50%); display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 8px 12px; width: max-content; max-width: calc(100% - 28px); padding: 10px 12px; border: 1px solid #ffffffd9; border-radius: 16px; background: #ffffffe0; box-shadow: 0 6px 24px #30235e26; backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px); }
.grading-heading { display: flex; align-items: center; justify-content: center; gap: 8px; }
.grading-spark { flex: none; display: grid; place-items: center; width: 24px; height: 24px; border-radius: 8px; background: var(--violet-soft); color: var(--violet); }
.grading-spark svg { width: 21px; height: 21px; }
.grading-card h1 { margin: 0; font-size: 16px; white-space: nowrap; }
.grading-dots { display: inline-flex; gap: 3px; margin-left: 5px; vertical-align: middle; }
.grading-dots i { width: 4px; height: 4px; border-radius: 50%; background: var(--violet); animation: grading-pulse 1.2s ease-in-out infinite; }
.grading-dots i:nth-child(2) { animation-delay: .2s; }
.grading-dots i:nth-child(3) { animation-delay: .4s; }
.grading-timer { flex: none; display: grid; gap: 1px; padding-left: 12px; border-left: 1px solid #dad4ef; color: var(--violet-dark); text-align: left; white-space: nowrap; }
.grading-timer small { color: #616979; font-size: 10px; }
.grading-timer strong { font-size: 14px; font-variant-numeric: tabular-nums; letter-spacing: -.02em; }
.grading-hint { margin: 10px 0 16px; color: var(--muted); font-size: 12px; line-height: 1.55; }
.live-results .question-result { animation: result-arrive .25s ease-out; }
.error-card .btn + .btn { margin-top: 10px; }
@keyframes result-arrive { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: translateY(0); } }
@keyframes grading-scan { from { top: 0; transform: translateY(0); } to { top: 100%; transform: translateY(-100%); } }
@keyframes grading-pulse { 0%, 100% { opacity: .4; } 50% { opacity: 1; } }
@media (prefers-reduced-motion: reduce) {
  .grading-scan span, .grading-live i, .grading-dots i { animation: none; }
  .grading-scan span { top: 50%; transform: translateY(-50%); }
  .grading-photo { transition: none; }
  .live-results .question-result { animation: none; }
}
.grading-stop { margin: 24px auto 0; min-width: 132px; }
.progress-list { display: grid; gap: 9px; text-align: left; }
.progress-step { display: flex; align-items: center; gap: 10px; padding: 12px; border-radius: 12px; background: #f5f6fa; color: #7a8295; font-size: 13px; }
.progress-step b { width: 23px; height: 23px; display: grid; place-items: center; border-radius: 50%; background: #e4e7ee; font-size: 11px; }
.progress-step.active { background: var(--violet-soft); color: var(--violet-dark); font-weight: 700; }
.progress-step.active b { background: var(--violet); color: white; }
.progress-step.done { background: var(--green-soft); color: var(--green); }
.progress-step.done b { background: var(--green); color: white; }

.result-hero { padding: 18px; background: linear-gradient(140deg, #6048df, #4431bd); color: white; }
.result-hero-top { display: flex; align-items: flex-start; justify-content: space-between; gap: 15px; }
.result-hero small { color: #dcd6ff; font-size: 11px; }
.result-score { margin-top: 5px; font-size: 43px; font-weight: 850; line-height: 1; letter-spacing: -.06em; }
.result-score span { margin-left: 5px; font-size: 14px; font-weight: 600; letter-spacing: 0; color: #dcd6ff; }
.result-status { padding: 7px 10px; border-radius: 999px; background: #ffffff1b; font-size: 11px; font-weight: 750; }
.result-meta { display: grid; justify-items: end; gap: 8px; }
.result-time { color: #e5e0ff; font-size: 11px; font-variant-numeric: tabular-nums; white-space: nowrap; }
.result-hero p { margin: 15px 0 0; color: #f2efff; font-size: 13px; line-height: 1.6; }
.review-alert { margin-top: 11px; padding: 11px 12px; border: 1px solid #f3dbad; border-radius: 12px; background: var(--amber-soft); color: #875019; font-size: 12px; line-height: 1.55; }

.section-heading { display: flex; align-items: center; justify-content: space-between; margin: 21px 2px 10px; }
.section-heading h2 { margin: 0; font-size: 17px; letter-spacing: -.02em; }
.section-heading small { color: var(--muted); font-size: 11px; }
.marked-paper { position: relative; overflow: hidden; background: #e7eaf1; }
.marked-paper img { display: block; width: 100%; height: auto; }
.paper-marks { position: absolute; inset: 0; pointer-events: none; }
.paper-mark { position: absolute; left: var(--x); top: var(--y); color: var(--red); transform: translate(-50%, -50%) rotate(-7deg); filter: drop-shadow(0 1px 0 #8c111936); }
.paper-mark.check { width: 34px; height: 34px; }
.paper-mark.circle { width: var(--w); height: var(--h); min-width: 20px; min-height: 16px; }
.paper-mark.pending { font: 800 30px/1 "Segoe Print", cursive; }
.paper-mark svg { width: 100%; height: 100%; overflow: visible; }
.paper-mark path, .paper-mark ellipse { fill: none; stroke: currentColor; stroke-width: 3; stroke-linecap: round; stroke-linejoin: round; vector-effect: non-scaling-stroke; }
.paper-page-tabs { display: flex; gap: 7px; overflow-x: auto; padding: 11px; border-top: 1px solid var(--line); }
.paper-page-tabs button { flex: none; min-width: 55px; padding: 7px 10px; border: 1px solid var(--line); border-radius: 999px; background: white; color: var(--muted); font-size: 11px; }
.paper-page-tabs button.active { border-color: #cfc6ff; background: var(--violet-soft); color: var(--violet-dark); font-weight: 750; }

.advice-card { padding: 15px; }
.advice-card strong { display: block; margin-bottom: 7px; font-size: 14px; }
.advice-card p { margin: 0; color: #59647b; font-size: 13px; line-height: 1.7; overflow-wrap: anywhere; }
.question-results { display: grid; width: 100%; min-width: 0; gap: 10px; }
.question-result { width: 100%; min-width: 0; max-width: 100%; overflow: hidden; padding: 14px; border: 1px solid var(--line); border-radius: 15px; background: white; }
.question-result.wrong { border-color: #f0cbd0; background: #fffafb; }
.question-result.review { border-color: #eedbb8; background: #fffdf8; }
.question-head { display: flex; min-width: 0; align-items: center; gap: 9px; }
.question-number { width: 28px; height: 28px; display: grid; place-items: center; border-radius: 8px; background: #eff1f6; color: #596279; font-size: 11px; font-weight: 800; }
.question-head > div { min-width: 0; flex: 1; }
.question-head strong, .question-head small { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.question-head strong { font-size: 14px; }
.question-head small { margin-top: 3px; color: var(--muted); font-size: 11px; }
.score-tag { flex: none; white-space: nowrap; font-size: 12px; font-weight: 850; color: var(--green); }
.wrong .score-tag { color: var(--red); }
.review .score-tag { color: var(--amber); }
.answer-grid { display: grid; min-width: 0; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 7px; margin-top: 12px; }
.answer-box { min-width: 0; padding: 9px; border-radius: 10px; background: #f5f6f9; }
.answer-box span { display: block; margin-bottom: 5px; color: var(--muted); font-size: 10px; }
.answer-box b { display: block; min-width: 0; max-width: 100%; overflow-wrap: anywhere; word-break: break-word; font-size: 13px; line-height: 1.5; }
mark.wrong-fragment { padding: 1px 2px; border-radius: 3px; background: var(--red-soft); color: var(--red); font-weight: 850; overflow-wrap: anywhere; word-break: break-word; }
.question-reason { margin: 10px 0 0; color: #5c667b; font-size: 12px; line-height: 1.6; overflow-wrap: anywhere; }
.disclaimer { margin: 18px 6px 0; color: #8a92a3; font-size: 10px; line-height: 1.6; text-align: center; }

.error-card { padding: 32px 22px; text-align: center; }
.error-icon { width: 58px; height: 58px; display: grid; place-items: center; margin: 0 auto 17px; border-radius: 18px; background: var(--red-soft); color: var(--red); }
.error-icon svg { width: 27px; height: 27px; }
.error-card h1 { margin: 0; font-size: 21px; }
.error-card p { margin: 9px 0 20px; color: var(--muted); font-size: 13px; line-height: 1.65; }
.parent-toast { position: fixed; z-index: 50; left: 50%; bottom: calc(88px + env(safe-area-inset-bottom)); transform: translateX(-50%); width: max-content; max-width: calc(100% - 32px); padding: 10px 14px; border-radius: 999px; background: #1b2030e8; color: white; font-size: 12px; box-shadow: 0 8px 25px #1b20303a; }

@media (min-width: 700px) {
  body { background: linear-gradient(135deg, #f1f2fb, #f8f9fc); }
  .parent-header { width: 560px; margin: 0 auto; border-left: 1px solid #e7e9f1; border-right: 1px solid #e7e9f1; }
  #parent-app { background: #f7f8fc; border-left: 1px solid #e4e7ef; border-right: 1px solid #e4e7ef; }
}

@media (max-width: 370px) {
  #parent-app { padding-left: 10px; padding-right: 10px; }
  .screen-title h1 { font-size: 21px; }
  .answer-grid { grid-template-columns: 1fr; }
}
