/* ── Essay marker (/essay-marker) ─────────────────────────────────────────── */
.em-section { padding-top: clamp(1.5rem, 3vw, 2.5rem); }
.em-wrap { max-width: 940px; }
.em-card {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-xl);
  box-shadow: var(--shadow-md); padding: clamp(1.25rem, 3.5vw, 2.5rem);
}
.em-h3 { font-family: var(--font-head); font-weight: 600; font-size: 1.25rem; color: var(--ink); margin: 0 0 .75rem; letter-spacing: -.01em; }
.em-fine { font-size: .86rem; color: var(--ink-3); margin: .6rem 0 0; line-height: 1.55; }
.em-fine.center { text-align: center; margin-top: 1.75rem; }
.em-hint { font-size: .84rem; color: var(--ink-3); margin: .45rem 0 0; }
.em-linkbtn { background: none; border: 0; padding: 0; font: inherit; color: var(--navy); text-decoration: underline; text-underline-offset: 2px; cursor: pointer; }

/* status bar */
.em-status:empty { display: none; }
.em-status {
  display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: .5rem 1rem;
  background: var(--mist); border-radius: var(--radius); padding: .75rem 1.1rem; margin-bottom: 1.25rem;
  font-size: .92rem; color: var(--ink);
}
.em-status b { font-weight: 600; }
.em-status-actions { display: flex; gap: 1rem; flex-wrap: wrap; }

/* steps */
.em-step { border: 0; padding: 0; margin: 0 0 1.75rem; min-width: 0; }
.em-step legend { display: flex; align-items: center; flex-wrap: wrap; gap: .3rem .6rem; font-family: var(--font-head); font-weight: 600; font-size: 1.05rem; color: var(--ink); margin-bottom: .9rem; padding: 0; }
.em-n { display: inline-grid; place-items: center; width: 26px; height: 26px; border-radius: 50%; background: var(--navy); color: #fff; font-size: .8rem; font-weight: 600; }
.em-opt { font-weight: 400; font-size: .85rem; color: var(--ink-3); }

.em-tasks { display: grid; grid-template-columns: repeat(3, 1fr); gap: .75rem; }
.em-task { position: relative; cursor: pointer; }
.em-task input { position: absolute; opacity: 0; pointer-events: none; }
.em-task-body {
  display: flex; flex-direction: column; gap: .2rem; height: 100%;
  border: 1.5px solid var(--line-2); border-radius: var(--radius); padding: .9rem 1rem; background: #fff;
  transition: border-color .2s, box-shadow .2s, background .2s;
}
.em-task-body strong { font-family: var(--font-head); font-weight: 600; color: var(--ink); font-size: .98rem; }
.em-task-body small { color: var(--ink-3); font-size: .83rem; line-height: 1.4; }
.em-task:hover .em-task-body { border-color: var(--navy); }
.em-task input:checked + .em-task-body { border-color: var(--navy); background: #F3F6FD; box-shadow: 0 0 0 3px rgba(30,58,138,.12); }
.em-task input:focus-visible + .em-task-body { outline: 2px solid var(--navy); outline-offset: 2px; }

.em-grid { display: grid; grid-template-columns: 1fr 2fr; gap: 1rem; }
.em-grid[hidden] { display: none; }
.em-span2 { grid-column: span 1; }
.em-span3 { grid-column: 1 / -1; }
.em-short { min-height: 84px; }
#em-source { min-height: 160px; }
.em-essay { min-height: 340px; font-size: 1rem; line-height: 1.7; }
.em-essay-meta { display: flex; justify-content: space-between; font-size: .82rem; color: var(--ink-3); margin-top: .4rem; font-family: var(--font-mono); }
.em-essay-meta .ok { color: #15803D; }

.em-submit { display: flex; flex-direction: column; align-items: flex-start; }
.em-submit .btn[disabled] { opacity: .6; pointer-events: none; }
.em-error { font-size: .92rem; margin-top: 1rem; }
.em-error a, .em-error button { color: inherit; font-weight: 600; }

/* loading */
.em-loading { text-align: center; padding-top: 3rem; padding-bottom: 3rem; }
.em-pulse { width: 64px; height: 64px; margin: 0 auto 1.25rem; border-radius: 50%; border: 4px solid var(--mist); border-top-color: var(--navy); animation: em-spin 1s linear infinite; }
@keyframes em-spin { to { transform: rotate(360deg); } }
.em-loading-title { font-family: var(--font-head); font-weight: 600; font-size: 1.2rem; color: var(--ink); margin: 0 0 1rem; }
.em-loading-steps { list-style: none; padding: 0; margin: 0 auto; display: inline-flex; flex-direction: column; gap: .4rem; text-align: left; }
.em-loading-steps li { color: var(--ink-3); font-size: .95rem; padding-left: 1.6rem; position: relative; transition: color .3s; }
.em-loading-steps li::before { content: ""; position: absolute; left: 0; top: .45em; width: 10px; height: 10px; border-radius: 50%; border: 2px solid var(--line-2); }
.em-loading-steps li.on { color: var(--ink); }
.em-loading-steps li.on::before { border-color: var(--navy); background: var(--navy); }
@media (prefers-reduced-motion: reduce) { .em-pulse { animation: none; } }

/* result */
.em-result-head { display: grid; grid-template-columns: auto 1fr; gap: 1.5rem 2rem; align-items: center; }
.em-dial { --p: 0; position: relative; width: 168px; height: 168px; border-radius: 50%;
  background: conic-gradient(var(--dial, var(--navy)) calc(var(--p) * 1%), var(--mist) 0);
  display: grid; place-items: center; }
.em-dial::before { content: ""; position: absolute; inset: 14px; border-radius: 50%; background: var(--surface); }
.em-dial-in { position: relative; text-align: center; line-height: 1; }
.em-dial-num { font-family: var(--font-display); font-size: 3.6rem; color: var(--ink); }
.em-dial-out { display: block; font-family: var(--font-mono); font-size: .82rem; color: var(--ink-3); margin-top: .35rem; }
.em-band { display: inline-block; font-family: var(--font-head); font-weight: 600; font-size: .8rem; letter-spacing: .08em; text-transform: uppercase; padding: .3rem .7rem; border-radius: 999px; background: var(--accent-soft); color: var(--accent-strong); }
.em-result-title { font-family: var(--font-head); font-weight: 600; font-size: 1.4rem; color: var(--ink); margin: .6rem 0 .4rem; }
.em-result-meta { font-size: .88rem; color: var(--ink-3); margin: 0; }
.em-summary { font-size: 1.02rem; color: var(--ink-2); margin: .75rem 0 0; }
.em-result-actions { display: flex; flex-wrap: wrap; gap: .75rem; margin-top: 1.75rem; }

.em-block { margin-top: 2.25rem; }
.em-crits { display: grid; gap: 1rem; }
.em-critrow { border: 1px solid var(--line); border-radius: var(--radius); padding: 1rem 1.1rem; background: #fff; }
.em-critrow-top { display: flex; justify-content: space-between; gap: 1rem; align-items: baseline; }
.em-critrow-top strong { font-family: var(--font-head); font-weight: 600; color: var(--ink); font-size: .98rem; }
.em-critrow-top span { font-family: var(--font-mono); font-size: .9rem; color: var(--navy); white-space: nowrap; }
.em-bar { height: 8px; border-radius: 99px; background: var(--mist); margin: .55rem 0 .6rem; overflow: hidden; }
.em-bar i { display: block; height: 100%; border-radius: inherit; background: var(--navy); width: 0; transition: width 1s var(--ease-out); }
.em-critrow p { margin: 0; font-size: .94rem; color: var(--ink-2); line-height: 1.6; }

.em-two { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }
.em-list { list-style: none; padding: 0; margin: 0; display: grid; gap: .6rem; }
.em-list li { position: relative; padding-left: 1.5rem; font-size: .95rem; color: var(--ink-2); line-height: 1.6; }
.em-list li::before { content: ""; position: absolute; left: 0; top: .5em; width: 9px; height: 9px; border-radius: 50%; background: #16A34A; }
.em-list.em-steps li::before { background: var(--accent); }
.em-panel { border: 1px solid var(--line); border-radius: var(--radius); padding: 1.1rem 1.2rem; background: #fff; }

.em-fix { border-left: 3px solid var(--accent); background: #fff; border-radius: 0 var(--radius) var(--radius) 0; padding: 1rem 1.2rem; box-shadow: var(--shadow-sm); }
.em-fix + .em-fix { margin-top: .9rem; }
.em-fix h4 { font-family: var(--font-head); font-weight: 600; font-size: 1rem; color: var(--ink); margin: 0 0 .35rem; }
.em-fix p { margin: .3rem 0 0; font-size: .94rem; color: var(--ink-2); line-height: 1.6; }
.em-fix blockquote { margin: .55rem 0; padding: .45rem .8rem; background: var(--paper); border-radius: 8px; font-size: .9rem; color: var(--ink-2); font-style: italic; }
.em-fix .em-howto { color: var(--ink); }
.em-fix .em-howto b { color: var(--accent-strong); }

.em-annotated { white-space: pre-wrap; font-size: .98rem; line-height: 1.85; color: var(--ink); background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: 1.25rem 1.4rem; max-height: 560px; overflow-y: auto; }
.em-annotated mark { background: rgba(224,123,57,.18); border-bottom: 2px solid var(--accent); padding: 0 1px; cursor: pointer; color: inherit; border-radius: 2px; }
.em-annotated mark.good { background: rgba(22,163,74,.13); border-bottom-color: #16A34A; }
.em-annotated mark sup { font-family: var(--font-mono); font-size: .68rem; font-weight: 600; color: var(--accent-strong); margin-left: 1px; }
.em-annotated mark.good sup { color: #15803D; }
.em-annotated mark.flash { outline: 2px solid var(--navy); }
.em-notes { list-style: none; counter-reset: n; padding: 0; margin: 1rem 0 0; display: grid; gap: .55rem; }
.em-notes li { display: grid; grid-template-columns: 26px 1fr; gap: .5rem; font-size: .93rem; color: var(--ink-2); line-height: 1.55; cursor: pointer; }
.em-notes li b { font-family: var(--font-mono); font-size: .78rem; display: grid; place-items: center; width: 22px; height: 22px; border-radius: 50%; background: var(--accent-soft); color: var(--accent-strong); }
.em-notes li.good b { background: rgba(22,163,74,.13); color: #15803D; }
.em-notes li q { font-style: italic; color: var(--ink); }

/* locked preview */
.em-locked { position: relative; margin-top: 2rem; border-radius: var(--radius-lg); overflow: hidden; border: 1px solid var(--line); }
.em-locked-fake { filter: blur(6px); opacity: .55; padding: 1.5rem; pointer-events: none; user-select: none; }
.em-locked-fake .em-critrow { margin-bottom: .8rem; }
.em-locked-over {
  position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center;
  padding: 1.5rem; background: linear-gradient(180deg, rgba(255,253,248,.55), rgba(255,253,248,.92) 40%);
}
.em-lock-ic { width: 48px; height: 48px; border-radius: 14px; background: var(--navy); color: #fff; display: grid; place-items: center; margin-bottom: .9rem; }
.em-locked-over h3 { font-family: var(--font-head); font-weight: 600; font-size: 1.25rem; color: var(--ink); margin: 0 0 .4rem; }
.em-locked-over p { margin: 0 0 1.1rem; color: var(--ink-2); max-width: 460px; font-size: .96rem; }
.em-locked-btns { display: flex; flex-wrap: wrap; justify-content: center; gap: .6rem; }
.em-invalid { margin-top: 1.25rem; padding: 1rem 1.2rem; border-radius: var(--radius); background: #FEF2F2; color: #991B1B; font-size: .95rem; }

/* history */
.em-history { margin-top: 2.5rem; }
.em-history ul { list-style: none; padding: 0; margin: 0; display: grid; gap: .5rem; }
.em-history li button {
  width: 100%; display: grid; grid-template-columns: 56px 1fr auto; gap: 1rem; align-items: center; text-align: left;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: .75rem 1rem; cursor: pointer; font: inherit; color: var(--ink);
  transition: border-color .2s, transform .2s;
}
.em-history li button:hover { border-color: var(--navy); transform: translateY(-1px); }
.em-hscore { font-family: var(--font-display); font-size: 1.7rem; color: var(--navy); line-height: 1; }
.em-hmain strong { display: block; font-family: var(--font-head); font-weight: 600; font-size: .95rem; }
.em-hmain small { color: var(--ink-3); font-size: .82rem; }
.em-htag { font-size: .76rem; font-weight: 600; letter-spacing: .04em; padding: .25rem .6rem; border-radius: 99px; background: var(--mist); color: var(--navy); white-space: nowrap; }
.em-htag.locked { background: var(--accent-soft); color: var(--accent-strong); }

/* plans */
.em-plans { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1.25rem; margin-top: 2.5rem; align-items: stretch; }
.em-plan { position: relative; display: flex; flex-direction: column; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-lg); padding: 1.75rem 1.5rem; box-shadow: var(--shadow-sm); }
.em-plan.featured { border: 2px solid var(--navy); box-shadow: var(--shadow-md); }
.em-plan-badge { position: absolute; top: -13px; left: 50%; transform: translateX(-50%); white-space: nowrap; background: var(--accent); color: #fff; font-size: .75rem; font-weight: 600; padding: .3rem .8rem; border-radius: 99px; }
.em-plan-k { font-family: var(--font-head); font-weight: 600; font-size: .82rem; letter-spacing: .1em; text-transform: uppercase; color: var(--ink-3); margin: 0; }
.em-plan-price { font-family: var(--font-display); font-size: 2.6rem; color: var(--ink); margin: .3rem 0 1rem; line-height: 1.1; }
.em-plan-price small { font-family: var(--font-body); font-size: .9rem; color: var(--ink-3); }
.em-plan-list { list-style: none; padding: 0; margin: 0 0 1.5rem; display: grid; gap: .55rem; flex: 1; }
.em-plan-list li { position: relative; padding-left: 1.6rem; font-size: .93rem; color: var(--ink-2); line-height: 1.5; }
.em-plan-list li::before { position: absolute; left: 0; top: 0; font-weight: 700; }
.em-plan-list li.yes::before { content: "✓"; color: #16A34A; }
.em-plan-list li.no { color: var(--ink-3); text-decoration: line-through; text-decoration-color: rgba(11,22,51,.25); }
.em-plan-list li.no::before { content: "–"; color: var(--ink-3); }
.em-plan-btn { width: 100%; }

.em-crit-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1rem; margin-top: 2rem; }
.em-crit { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 1.25rem; }
.em-crit-k { font-family: var(--font-head); font-weight: 600; color: var(--ink); margin: 0 0 .4rem; }
.em-crit p:not(.em-crit-k) { margin: 0; font-size: .93rem; color: var(--ink-2); line-height: 1.65; }

/* dialog */
.em-dialog { border: 0; border-radius: var(--radius-lg); padding: 1.75rem; width: min(440px, calc(100vw - 32px)); box-shadow: var(--shadow-lg); background: var(--surface); color: var(--ink); }
.em-dialog::backdrop { background: rgba(11,22,51,.45); }
.em-dialog-close { position: absolute; top: .6rem; right: .8rem; }
.em-dialog-close button { background: none; border: 0; font-size: 1.6rem; line-height: 1; color: var(--ink-3); cursor: pointer; }
.em-signin-form { display: grid; gap: .75rem; margin-top: 1rem; }

@media (max-width: 820px) {
  .em-tasks, .em-plans, .em-crit-grid, .em-two { grid-template-columns: 1fr; }
  .em-grid { grid-template-columns: 1fr; }
  .em-plans { gap: 1.75rem; }
  .em-result-head { grid-template-columns: 1fr; justify-items: center; text-align: center; }
  .em-dial { width: 148px; height: 148px; }
  .em-result-actions { justify-content: center; }
}

/* ── v2: VCAA-scale results ───────────────────────────────────────────────── */
.em-check { display: flex; gap: .55rem; align-items: flex-start; margin-top: .9rem; font-size: .9rem; color: var(--ink-2); cursor: pointer; }
.em-check input { margin-top: .25rem; accent-color: var(--navy); width: 16px; height: 16px; flex-shrink: 0; }

.em-stats { display: grid; grid-template-columns: 1fr 1fr; gap: .9rem; margin-top: 1.5rem; }
.em-stat { background: var(--paper); border-radius: var(--radius); padding: 1rem 1.15rem; display: flex; flex-direction: column; gap: .15rem; }
.em-stat-k { font-family: var(--font-head); font-weight: 600; font-size: .74rem; letter-spacing: .1em; text-transform: uppercase; color: var(--ink-3); }
.em-stat-v { font-family: var(--font-display); font-size: 2.3rem; line-height: 1.1; color: var(--ink); }
.em-stat-v small { font-family: var(--font-body); font-size: .95rem; color: var(--ink-3); }
.em-stat-s { font-size: .86rem; color: var(--ink-2); line-height: 1.45; }

.em-lead { margin: -.35rem 0 1rem; }
.em-eqn { display: inline-block; font-family: var(--font-mono); font-size: .72rem; font-weight: 500; color: var(--navy); background: var(--mist); border-radius: 6px; padding: .1rem .4rem; margin-right: .3rem; vertical-align: 1px; }
.em-critrow p.em-next { margin-top: .55rem; padding-top: .55rem; border-top: 1px dashed var(--line-2); color: var(--ink); }
.em-next b { color: var(--accent-strong); font-weight: 600; }

/* comments beside the essay */
.em-review { display: grid; grid-template-columns: minmax(0, 1.45fr) minmax(0, 1fr); gap: 1rem; align-items: start; }
.em-review .em-annotated { max-height: 620px; margin: 0; }
.em-review .em-notes { max-height: 620px; overflow-y: auto; margin: 0; padding: 0 .25rem 0 0; }
.em-notes li { background: #fff; border: 1px solid var(--line); border-left: 3px solid var(--accent); border-radius: 10px; padding: .7rem .8rem; transition: border-color .2s, box-shadow .2s, transform .2s; }
.em-notes li.good { border-left-color: #16A34A; }
.em-notes li:hover { box-shadow: var(--shadow-sm); }
.em-notes li.on { box-shadow: 0 0 0 2px var(--navy); transform: translateX(-2px); }
.em-notes li q { display: block; font-size: .84rem; color: var(--ink-3); margin-bottom: .25rem; quotes: "\201C" "\201D"; }
.em-annotated mark.on { outline: 2px solid var(--navy); outline-offset: 1px; }

/* examiner insights */
.em-insights { display: grid; gap: .8rem; }
.em-insight { border: 1px solid var(--line); border-radius: var(--radius); padding: .95rem 1.1rem; background: #fff; }
.em-insight-tag { display: inline-block; font-size: .74rem; font-weight: 600; letter-spacing: .04em; padding: .22rem .6rem; border-radius: 99px; margin-bottom: .5rem; }
.em-insight.enhanced .em-insight-tag { background: rgba(22,163,74,.12); color: #15803D; }
.em-insight.limited .em-insight-tag { background: var(--accent-soft); color: var(--accent-strong); }
.em-insight-you { margin: 0; font-size: .96rem; color: var(--ink); line-height: 1.6; }
.em-insight-report { margin: .45rem 0 0; font-size: .86rem; color: var(--ink-3); line-height: 1.55; }

/* how it marks */
.em-how { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1.25rem; margin: 2rem 0 1.25rem; }
.em-how-step { display: flex; gap: .8rem; align-items: flex-start; }
.em-how-step .em-n { flex-shrink: 0; margin-top: .15rem; }
.em-how-step p { margin: 0; font-size: .95rem; color: var(--ink-2); line-height: 1.65; }
.em-how-step strong { color: var(--ink); font-weight: 600; }

@media (max-width: 820px) {
  .em-stats, .em-review, .em-how { grid-template-columns: 1fr; }
  .em-review .em-annotated { max-height: 420px; }
  .em-review .em-notes { max-height: none; }
}

/* ── v3: repricing (packs, pass, tutor review) ─────────────────────────────── */
.em-plans { grid-template-columns: repeat(4, 1fr); }
.em-plan-alt { margin: -.6rem 0 1rem; font-size: .9rem; color: var(--ink-2); }
.em-plan-btns { display: grid; gap: .5rem; }
.em-plan-badge.alt { background: var(--navy); }
.em-review-strip { margin-top: 1.25rem; background: var(--surface); border: 1px dashed var(--line-2); border-radius: var(--radius-lg); padding: 1.25rem 1.5rem; }
.em-review-strip p { margin: 0; color: var(--ink-2); font-size: .95rem; }
.em-review-strip .em-plan-k { margin-bottom: .2rem; }
.em-review-strip-t { font-family: var(--font-head); font-weight: 600; color: var(--ink) !important; font-size: 1.1rem !important; margin-bottom: .3rem !important; }
.em-tutor-cta { display: flex; align-items: center; justify-content: space-between; gap: 1rem 1.5rem; flex-wrap: wrap; background: var(--accent-soft); border-radius: var(--radius); padding: 1.1rem 1.25rem; }
.em-tutor-cta p { margin: 0; color: var(--ink-2); font-size: .95rem; max-width: 520px; }
.em-tutor-cta .em-plan-k { color: var(--accent-strong); margin-bottom: .2rem; }
@media (max-width: 1100px) { .em-plans { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 820px) { .em-plans { grid-template-columns: 1fr; } }

/* ── v4: photos of handwritten essays ──────────────────────────────────────── */
.em-photos { border: 1.5px dashed var(--line-2); border-radius: var(--radius); padding: .9rem 1rem; margin-bottom: .9rem; background: #fff; transition: border-color .2s, background .2s; }
.em-photos.drag { border-color: var(--navy); background: #F3F6FD; }
.em-photos-head { display: flex; align-items: center; justify-content: space-between; gap: .75rem 1rem; flex-wrap: wrap; }
.em-photos-head p { margin: 0; font-size: .93rem; color: var(--ink-2); flex: 1 1 260px; }
.em-photos-head strong { color: var(--ink); font-weight: 600; }
.em-photos-head .btn { padding: .55rem 1.05rem; font-size: .9rem; }
.em-photo-list { list-style: none; padding: 0; margin: 0; display: flex; flex-wrap: wrap; gap: .6rem; }
.em-photo-list:not(:empty) { margin-top: .9rem; }
.em-photo { position: relative; width: 84px; }
.em-photo img { display: block; width: 84px; height: 112px; object-fit: cover; border-radius: 8px; border: 1px solid var(--line-2); background: var(--paper); }
.em-photo span { display: block; text-align: center; font-family: var(--font-mono); font-size: .72rem; color: var(--ink-3); margin-top: .25rem; }
.em-photo button { position: absolute; top: -7px; width: 24px; height: 24px; border-radius: 50%; border: 1px solid var(--line-2); background: #fff; color: var(--ink); font-size: .85rem; line-height: 1; cursor: pointer; display: grid; place-items: center; box-shadow: var(--shadow-sm); }
.em-photo .rm { right: -7px; }
.em-photo .mv { left: -7px; }
.em-photo button:hover { border-color: var(--navy); color: var(--navy); }
.em-photo-actions { display: flex; align-items: center; gap: .6rem 1rem; flex-wrap: wrap; margin-top: .9rem; }
.em-photo-actions[hidden] { display: none; }
.em-photo-actions .em-fine { margin: 0; }
.em-photo-actions .btn[disabled] { opacity: .6; pointer-events: none; }
.em-photo-msg { margin: .8rem 0 0; font-size: .92rem; color: var(--ink); background: var(--mist); border-radius: 10px; padding: .6rem .8rem; }
.em-photo-msg.err { background: #FEF2F2; color: #991B1B; }
.em-photo-msg a { color: inherit; font-weight: 600; }
