:root {
  --ink: #162b3a;
  --muted: #6d7e86;
  --paper: #f7f9f5;
  --white: #ffffff;
  --line: #dfe8e5;
  --teal: #0d8274;
  --teal-dark: #08665e;
  --teal-soft: #dff2ee;
  --coral: #ef765d;
  --yellow: #f4c95d;
  --shadow: 0 18px 48px rgba(30, 72, 72, 0.08);
}

* { box-sizing: border-box; }
html { min-width: 320px; }
body { margin: 0; color: var(--ink); background: var(--paper); font-family: "DM Sans", sans-serif; }
button, input { font: inherit; }
button { cursor: pointer; }
.app-shell { min-height: 100vh; overflow: clip; }

.page { min-height: 100vh; position: relative; padding: 28px clamp(20px, 4vw, 48px) 44px; overflow: clip; }
.page::before { content: ""; position: absolute; width: 390px; height: 390px; border-radius: 50%; background: rgba(223, 242, 238, 0.75); top: -180px; right: -120px; z-index: -1; }
.page::after { content: ""; position: absolute; width: 230px; height: 230px; border-radius: 50%; border: 1px solid rgba(13, 130, 116, 0.13); bottom: -90px; left: -80px; z-index: -1; }
.container { max-width: 1180px; margin: 0 auto; }
.topbar { display: flex; justify-content: space-between; align-items: center; }
.brand { display: inline-flex; align-items: center; color: var(--ink); text-decoration: none; }
.brand-logo { display: block; width: 88px; max-width: 100%; height: auto; object-fit: contain; object-position: left center; }
.top-note { color: var(--muted); font-size: 13px; }

.hero { display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(360px, .9fr); align-items: center; gap: clamp(48px, 6vw, 88px); min-height: calc(100vh - 115px); padding: 48px 0 60px; }
.eyebrow { display: inline-flex; align-items: center; gap: 8px; color: var(--teal); font-weight: 700; font-size: 13px; letter-spacing: .04em; text-transform: uppercase; }
.eyebrow::before { content: ""; width: 27px; height: 3px; background: var(--coral); border-radius: 99px; }
h1, h2, h3 { font-family: Manrope, sans-serif; letter-spacing: -0.055em; margin: 0; }
.hero h1 { max-width: 650px; margin: 20px 0 18px; font-size: clamp(42px, 6vw, 76px); line-height: 1.04; }
.hero h1 em { color: var(--teal); font-style: normal; }
.lead { max-width: 520px; color: var(--muted); font-size: clamp(17px, 2vw, 20px); line-height: 1.55; margin: 0 0 31px; }
.primary-btn { border: 0; border-radius: 13px; padding: 17px 22px; color: var(--white); background: var(--teal); font-weight: 700; letter-spacing: .02em; transition: transform .2s, background .2s, box-shadow .2s; box-shadow: 0 10px 20px rgba(13, 130, 116, .18); }
.primary-btn:hover { transform: translateY(-2px); background: var(--teal-dark); box-shadow: 0 14px 24px rgba(13, 130, 116, .23); }
.primary-btn:focus-visible, .option:focus-visible, .text-input:focus-visible { outline: 3px solid rgba(239, 118, 93, .5); outline-offset: 3px; }
.hero-actions { display: flex; align-items: center; gap: 18px; flex-wrap: wrap; }
.free-note { color: var(--muted); font-size: 13px; }
.home-actions { align-items: stretch; gap: 14px; flex-direction: column; max-width: 500px; }
.home-action { display: flex; align-items: flex-start; flex-direction: column; gap: 8px; }
.action-description { color: var(--muted); font-size: 12px; line-height: 1.4; }
.secondary-btn { border: 1px solid var(--teal); border-radius: 13px; padding: 15px 20px; color: var(--teal-dark); background: transparent; font-weight: 700; letter-spacing: .02em; transition: background .2s, transform .2s; }
.secondary-btn:hover { transform: translateY(-2px); background: var(--teal-soft); }

.preview { position: relative; width: min(100%, 470px); justify-self: end; }
.preview-card { background: var(--white); border: 1px solid var(--line); border-radius: 24px; padding: 25px; box-shadow: var(--shadow); transform: rotate(2deg); }
.preview-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 30px; }
.preview-label { color: var(--muted); font-size: 12px; }
.preview-score { color: var(--teal); background: var(--teal-soft); border-radius: 9px; padding: 7px 10px; font-size: 12px; font-weight: 700; }
.preview-title { font-size: 24px; line-height: 1.15; margin-bottom: 22px; }
.subject { display: flex; align-items: center; gap: 12px; padding: 13px 0; border-top: 1px solid var(--line); }
.subject-icon { display: grid; place-items: center; width: 34px; height: 34px; border-radius: 10px; color: var(--teal-dark); background: #eef6e9; font-weight: 800; }
.subject:nth-of-type(2) .subject-icon { background: #fff1db; color: #b17416; }
.subject:nth-of-type(3) .subject-icon { background: #ffe8e2; color: #cc5a43; }
.subject-text { flex: 1; font-size: 13px; font-weight: 600; }
.mini-bar { width: 80px; height: 6px; background: var(--line); border-radius: 99px; overflow: hidden; }
.mini-bar span { display: block; height: 100%; border-radius: inherit; background: var(--teal); }
.sticker { position: absolute; right: -42px; bottom: -24px; display: grid; place-items: center; width: 104px; height: 104px; border-radius: 50%; background: var(--coral); color: var(--white); font-family: Manrope, sans-serif; font-size: 15px; line-height: 1.1; text-align: center; transform: rotate(-12deg); box-shadow: 0 11px 22px rgba(239, 118, 93, .23); }

.assessment-page { padding-top: 28px; }
.assessment-wrap { max-width: 820px; margin: 0 auto; padding: 7vh 0 56px; }
.save-later-wrap { max-width: 640px; margin: 0 auto; padding: 7vh 0 56px; }
.screen-heading { text-align: center; max-width: 600px; margin: 0 auto 34px; }
.screen-heading h2 { font-size: clamp(32px, 5vw, 53px); line-height: 1.1; margin: 15px 0 13px; }
.screen-heading p { color: var(--muted); margin: 0; font-size: 16px; line-height: 1.55; }
.grade-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; }
.grade-card { border: 1px solid var(--line); border-radius: 17px; padding: 23px 12px; color: var(--ink); background: var(--white); font-weight: 700; transition: transform .2s, border-color .2s, box-shadow .2s; }
.grade-card:hover { transform: translateY(-4px); border-color: var(--teal); box-shadow: 0 12px 28px rgba(30, 72, 72, .1); }
.grade-card strong { display: block; color: var(--teal); font-family: Manrope, sans-serif; font-size: 30px; margin-bottom: 5px; }
.grade-card span { color: var(--muted); font-size: 12px; font-weight: 500; }

.quiz-wrap { max-width: 820px; margin: 0 auto; padding: 23px 0 50px; }
.quiz-top { display: flex; justify-content: space-between; align-items: center; margin-bottom: 13px; color: var(--muted); font-size: 13px; font-weight: 700; }
.progress-track { height: 8px; border-radius: 99px; background: #dce8e5; overflow: hidden; }
.progress-value { height: 100%; border-radius: inherit; background: var(--teal); transition: width .35s ease; }
.quiz-card { margin-top: 30px; padding: clamp(28px, 4vw, 52px); background: var(--white); border: 1px solid var(--line); border-radius: 22px; box-shadow: var(--shadow); }
.question-kicker { color: var(--coral); font-size: 13px; font-weight: 700; }
.quiz-card h2 { max-width: 650px; font-size: clamp(25px, 4vw, 37px); line-height: 1.2; margin: 12px 0 27px; letter-spacing: -0.045em; overflow-wrap: anywhere; }
.quiz-card h2 mjx-container, .option mjx-container { max-width: 100%; overflow-x: auto; overflow-y: hidden; }
.math-formula { display: flex; justify-content: center; align-items: center; min-height: 64px; margin: -7px 0 25px; padding: 12px 16px; border-radius: 12px; color: var(--teal-dark); background: #f1f8f5; font-size: clamp(24px, 5vw, 34px); overflow-x: auto; }
.math-formula mjx-container { margin: 0 !important; }
.geometry-diagram { max-width: 460px; margin: -3px auto 24px; padding: 8px 8px 1px; border: 1px solid var(--line); border-radius: 14px; background: #fbfdfb; }
.geometry-diagram svg { display: block; width: 100%; height: auto; }
.triangle-line { fill: rgba(13, 130, 116, .07); stroke: var(--teal); stroke-width: 4; stroke-linejoin: round; }
.shape-line { fill: rgba(13, 130, 116, .07); stroke: var(--teal); stroke-width: 4; stroke-linejoin: round; }
.shape-fill { fill: rgba(13, 130, 116, .07); stroke: none; }
.remaining-shape { fill: rgba(13, 130, 116, .13); stroke: var(--teal); stroke-width: 4; stroke-linejoin: round; }
.cut-area { fill: rgba(239, 118, 93, .18); stroke: none; }
.cut-line { fill: none; stroke: var(--coral); stroke-width: 3; stroke-dasharray: 7 5; stroke-linejoin: round; }
.height-line { fill: none; stroke: var(--coral); stroke-width: 3; stroke-dasharray: 7 5; }
.right-angle { fill: none; stroke: var(--coral); stroke-width: 3; }
.point { fill: var(--coral); }
.geometry-diagram text { fill: var(--ink); font: 700 16px "DM Sans", sans-serif; }
.geometry-diagram .diagram-label { fill: var(--teal-dark); font-size: 14px; }
.geometry-diagram .cut-label { fill: #c75b47; font-size: 13px; }
.options { display: grid; gap: 11px; }
.option { display: flex; align-items: center; gap: 14px; width: 100%; min-height: 58px; border: 1px solid var(--line); border-radius: 12px; padding: 14px 16px; color: var(--ink); background: var(--white); text-align: left; transition: border-color .18s, background .18s; }
.option:hover { border-color: var(--teal); background: #f5fbf9; }
.option.selected { border-color: var(--teal); background: var(--teal-soft); }
.option-letter { display: grid; place-items: center; flex: 0 0 32px; height: 32px; border-radius: 9px; color: var(--teal-dark); background: #edf3f1; font-weight: 700; }
.option.selected .option-letter { color: var(--white); background: var(--teal); }
.numeric-label { display: block; margin: 0 0 8px; color: var(--muted); font-size: 13px; font-weight: 700; }
.numeric-input-wrap { display: flex; align-items: center; max-width: 300px; border: 1px solid var(--line); border-radius: 12px; background: var(--white); overflow: hidden; }
.numeric-input { width: 100%; min-width: 0; border: 0; outline: 0; padding: 14px 15px; color: var(--ink); background: transparent; font-size: 20px; font-weight: 700; }
.numeric-input-wrap span { padding: 0 15px 0 0; color: var(--muted); font-size: 13px; white-space: nowrap; }
.numeric-input-wrap:focus-within { border-color: var(--teal); box-shadow: 0 0 0 3px rgba(13, 130, 116, .12); }
.quiz-footer { display: flex; justify-content: space-between; align-items: center; gap: 14px; margin-top: 29px; }
.back-btn { border: 0; padding: 12px 0; color: var(--muted); background: transparent; font-weight: 600; }
.back-btn:hover { color: var(--ink); }
.next-btn { min-width: 140px; }

.result-wrap { max-width: 1080px; margin: 0 auto; padding: 5vh 0 55px; }
.result-heading { margin-bottom: 20px; }
.result-heading h2 { max-width: 680px; font-size: clamp(32px, 5vw, 54px); line-height: 1.06; margin: 11px 0 0; }
.score-summary { display: flex; align-items: center; gap: 20px; margin-bottom: 31px; }
.score-box { flex: 0 0 144px; min-width: 144px; padding: 18px 12px; border-radius: 16px; color: var(--white); background: var(--teal); text-align: center; }
.score-box strong { display: block; font-family: Manrope, sans-serif; font-size: 37px; line-height: 1; }
.score-box span { display: block; margin-top: 6px; font-size: 12px; opacity: .85; }
.score-summary p { max-width: 470px; color: var(--muted); font-size: 15px; line-height: 1.5; margin: 0; }
.section-label { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; margin-bottom: 12px; font-size: 16px; font-weight: 700; }
.section-note { color: var(--muted); font-size: 12px; font-weight: 500; }
.result-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 16px; }
.skill-card { min-width: 0; padding: 20px 18px 16px; border: 1px solid var(--line); border-radius: 15px; background: var(--white); }
.skill-card-top { display: flex; justify-content: space-between; align-items: start; gap: 8px; }
.skill-name { min-height: 39px; font-weight: 700; font-size: 14px; line-height: 1.35; }
.skill-card-top strong { color: var(--teal); font-family: Manrope, sans-serif; font-size: 17px; white-space: nowrap; }
.skill-progress { height: 7px; margin: 12px 0 10px; border-radius: 99px; background: #e3eeeb; overflow: hidden; }
.skill-progress span { display: block; height: 100%; border-radius: inherit; background: var(--teal); }
.skill-card.not-evaluated .skill-card-top strong { color: var(--muted); }
.skill-card.not-evaluated .skill-progress { background: #edf1ef; }
.skill-meta { display: flex; align-items: center; justify-content: space-between; gap: 6px; color: var(--muted); font-size: 11px; }
.skill-level { display: inline-block; padding: 5px 7px; border-radius: 7px; background: var(--teal-soft); color: var(--teal-dark); font-size: 11px; font-weight: 700; white-space: nowrap; }
.skill-level.level-good { color: var(--teal-dark); background: var(--teal-soft); }
.skill-level.level-fair { color: #9a6a11; background: #fff2d2; }
.skill-level.level-needs-reinforcement { color: #b64e3b; background: #ffe5df; }
.skill-level.level-not-evaluated { color: var(--muted); background: #edf1ef; }
.confidence-note { display: block; margin-top: 9px; color: var(--muted); font-size: 10px; line-height: 1.35; }
.skill-card.not-evaluated .skill-level { color: var(--muted); background: #edf1ef; }
.insight-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 13px; margin-top: 22px; }
.insight-card { padding: 19px 20px; border-left: 4px solid var(--teal); border-radius: 13px; background: var(--white); }
.insight-card.reinforce { border-left-color: var(--coral); }
.insight-label { color: var(--teal); font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; }
.reinforce .insight-label { color: #c75b47; }
.insight-card h3 { margin: 7px 0 6px; font-size: 18px; letter-spacing: -0.03em; }
.insight-card p { color: var(--muted); font-size: 13px; line-height: 1.45; margin: 0; }
.diagnostic-section { margin-top: 24px; }
.diagnostic-list { display: grid; gap: 9px; }
.diagnostic-item { padding: 15px 17px; border: 1px solid var(--line); border-radius: 13px; background: var(--white); }
.diagnostic-item > div { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; }
.diagnostic-item strong { color: var(--ink); font-size: 14px; }
.diagnostic-item span { color: var(--muted); font-size: 11px; text-align: right; }
.diagnostic-item p { margin: 7px 0 0; color: var(--muted); font-size: 13px; line-height: 1.45; }
.diagnostic-empty { margin: 0; padding: 15px 17px; border-radius: 13px; color: var(--teal-dark); background: var(--teal-soft); font-size: 13px; line-height: 1.45; }
.detail-cta { margin-top: 29px; padding: 24px; border-radius: 17px; background: #eaf5f1; }
.detail-cta h3 { font-size: clamp(22px, 3vw, 28px); line-height: 1.15; margin: 9px 0 7px; }
.detail-cta > div > p { color: var(--muted); font-size: 14px; line-height: 1.45; margin: 0; }
.detail-form { display: grid; grid-template-columns: 1fr 1fr auto; gap: 12px; align-items: end; margin-top: 20px; padding-top: 19px; border-top: 1px solid rgba(13, 130, 116, .15); }
.lead-grade { display: flex; align-items: center; justify-content: space-between; grid-column: 1 / -1; padding: 10px 12px; border-radius: 9px; color: var(--muted); background: rgba(255, 255, 255, .7); font-size: 12px; }
.lead-grade strong { color: var(--teal-dark); font-size: 13px; }
.field label { display: block; margin: 0 0 7px; color: var(--muted); font-size: 12px; font-weight: 700; }
.text-input { width: 100%; min-width: 0; border: 1px solid var(--line); border-radius: 10px; padding: 13px 14px; color: var(--ink); background: var(--white); }
.form-note { grid-column: 1 / -1; color: var(--muted); font-size: 11px; line-height: 1.4; margin: 3px 0 0; }
.success-note { display: none; grid-column: 1 / -1; padding: 12px 14px; border-radius: 10px; color: var(--teal-dark); background: var(--teal-soft); font-size: 13px; font-weight: 600; }
.success-note.visible { display: block; }
.save-later-form { display: grid; gap: 15px; margin-top: 27px; padding: clamp(20px, 5vw, 32px); border: 1px solid var(--line); border-radius: 18px; background: var(--white); box-shadow: var(--shadow); }
.save-later-form .field { display: grid; gap: 7px; }
.save-later-form .primary-btn { width: 100%; }
.resume-link { display: block; width: fit-content; margin-top: 12px; border: 0; border-radius: 9px; padding: 10px 12px; color: var(--white); background: var(--teal); font-size: 12px; font-weight: 700; cursor: pointer; }
.error-note { color: #a84535; background: #fff0ec; }
.resume-complete-note { margin: 0; padding: 13px; border-radius: 10px; color: var(--teal-dark); background: var(--teal-soft); font-size: 13px; line-height: 1.45; }
.resume-error { padding-top: 15vh; }

@media (max-width: 700px) {
  .page { padding: 16px 16px 32px; }
  .brand-logo { width: 68px; }
  .top-note { display: none; }
  .hero { grid-template-columns: 1fr; gap: 32px; min-height: auto; padding: 42px 0 58px; }
  .hero h1 { font-size: clamp(39px, 12vw, 57px); }
  .hero-actions { align-items: flex-start; flex-direction: column; gap: 12px; }
  .home-actions { align-items: stretch; gap: 14px; }
  .home-actions .primary-btn, .home-actions .secondary-btn { width: 100%; }
  .preview { width: calc(100% - 8px); margin: 0 auto; justify-self: center; }
  .sticker { right: -12px; bottom: -36px; width: 91px; height: 91px; font-size: 13px; }
  .assessment-wrap, .result-wrap { padding-top: 5vh; }
  .quiz-wrap { padding-top: 16px; }
  .quiz-card { margin-top: 22px; padding: 24px 20px; }
  .grade-grid { grid-template-columns: repeat(2, 1fr); }
  .result-heading { margin-bottom: 16px; }
  .result-heading h2 { max-width: 360px; font-size: clamp(30px, 9vw, 40px); }
  .score-summary { align-items: flex-start; gap: 14px; margin-bottom: 25px; }
  .score-box { flex-basis: 120px; min-width: 120px; padding: 15px 9px; }
  .score-box strong { font-size: 32px; }
  .score-summary p { font-size: 13px; line-height: 1.4; padding-top: 2px; }
  .section-label { align-items: flex-start; flex-direction: column; gap: 3px; margin-bottom: 10px; }
  .result-grid { grid-template-columns: 1fr; gap: 9px; }
  .skill-card { padding: 16px 15px 13px; }
  .skill-name { min-height: 0; }
  .skill-progress { margin: 8px 0 8px; }
  .insight-grid { grid-template-columns: 1fr; gap: 9px; margin-top: 17px; }
  .insight-card { padding: 15px 16px; }
  .diagnostic-section { margin-top: 19px; }
  .diagnostic-item { padding: 14px 15px; }
  .diagnostic-item > div { align-items: flex-start; flex-direction: column; gap: 3px; }
  .diagnostic-item span { text-align: left; }
  .detail-cta { margin-top: 20px; padding: 19px 16px; }
  .detail-cta h3 { font-size: 23px; }
  .detail-form { grid-template-columns: 1fr; }
  .form-note, .success-note { grid-column: auto; }
  .detail-form .primary-btn { width: 100%; }
}

@media (max-width: 390px) {
  .brand-logo { width: 68px; }
  .quiz-card { padding: 21px 16px; }
  .quiz-card h2 { font-size: 25px; margin-bottom: 20px; }
  .math-formula { min-height: 58px; margin-bottom: 20px; padding: 9px 12px; font-size: 27px; }
  .geometry-diagram { margin-bottom: 19px; padding: 5px 4px 0; }
  .geometry-diagram text { font-size: 14px; }
  .geometry-diagram .diagram-label { font-size: 12px; }
  .quiz-footer { align-items: flex-end; }
  .next-btn { min-width: 125px; padding-left: 14px; padding-right: 14px; }
}
