/*
 * GPGenie page design, October 2026 (owner approved the mockup on 9 Oct 2026).
 * Tool first: the essay form is the first thing on the page; Free and Premium sit
 * beside it on wide screens and below it on phones. Waiting and the finished report
 * replace the form in place. Colours come from the logo's teal; one highlighter and
 * an answer-booklet margin rule are the only flourishes. Light and dark themes.
 * The handwriting upload keeps its own css/ocr-styles.css.
 */
:root {
  --paper: #F3F6F5;
  --surface: #FFFFFF;
  --sunk: #EBF1EF;
  --ink: #102A2B;
  --muted: #4D6362;
  --faint: #6F8381;
  --rule: #D3DEDB;
  --ruling: #E7EEEC;
  --accent: #1E5153;
  --accent-hover: #163E40;
  --accent-ink: #FFFFFF;
  --accent-soft: #E0EDEB;
  --marker: #FFE45C;
  --marker-ink: #102A2B;
  --margin-rule: #EBA9A6;
  --ok: #23774A;
  --ok-soft: #E3F3EA;
  --warn: #8A5A00;
  --warn-soft: #FFF3D1;
  --bad: #B42318;
  --bad-soft: #FDECEA;
  --logo-filter: none;
  --shadow: rgba(16, 42, 43, 0.28);

  --display: "Newsreader", "Iowan Old Style", Georgia, serif;
  --body: "Atkinson Hyperlegible Next", "Atkinson Hyperlegible", system-ui, -apple-system, "Segoe UI", sans-serif;
  --mono: "IBM Plex Mono", ui-monospace, "SFMono-Regular", Menlo, monospace;

  --t-xs: 0.8125rem;
  --t-sm: 0.9375rem;
  --t-md: 1.0625rem;
  --t-lg: 1.25rem;
  --t-xl: 1.75rem;
  --t-2xl: clamp(2rem, 5vw, 3rem);
  --radius: 10px;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --paper: #0D1615; --surface: #13201F; --sunk: #182826; --ink: #E2ECEA; --muted: #A2B5B2; --faint: #869D9A;
    --rule: #284240; --ruling: #1E302E; --accent: #79C9BE; --accent-hover: #93D6CC; --accent-ink: #052220;
    --accent-soft: #173734; --marker: #E8CE4A; --marker-ink: #15140A; --margin-rule: #6A3B3A;
    --ok: #63C994; --ok-soft: #12301F; --warn: #E3B552; --warn-soft: #2C2410; --bad: #F2867A; --bad-soft: #3A1D1A;
    --logo-filter: invert(1) hue-rotate(180deg) brightness(1.15);
    --shadow: rgba(0, 0, 0, 0.6);
    color-scheme: dark;
  }
}

/* ---------- base ---------- */
*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body { margin: 0; background: var(--paper); color: var(--ink); font-family: var(--body); font-size: 16px; line-height: 1.55; }
body.tier-dialog-open { overflow: hidden; }
h1, h2, h3 { text-wrap: balance; margin: 0; }
p { margin: 0; }
a { color: var(--accent); }
button, input, textarea, select { font: inherit; color: inherit; }
img { max-width: 100%; }
:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; border-radius: 4px; }
.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* ---------- header ---------- */
.gp-header { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 12px max(16px, calc((100% - 1120px) / 2)); border-bottom: 1px solid var(--rule); background: var(--surface); }
.gp-brand { display: flex; align-items: center; gap: 10px; text-decoration: none; color: var(--ink); }
.gp-brand img { height: 38px; width: auto; filter: var(--logo-filter); }
.gp-beta { font-family: var(--mono); font-size: 0.6875rem; letter-spacing: 0.06em; text-transform: uppercase; color: var(--muted); border: 1px solid var(--rule); border-radius: 4px; padding: 1px 5px; }
.gp-nav { display: flex; gap: 18px; font-size: var(--t-sm); }
.gp-nav a { color: var(--muted); text-decoration: none; }
.gp-nav a:hover { color: var(--ink); text-decoration: underline; }

/* ---------- page ---------- */
.gp-wrap { max-width: 1120px; margin-inline: auto; padding-inline: 20px; padding-block: 28px 48px; display: grid; gap: 32px; }
@media (max-width: 480px) { .gp-wrap { padding-inline: 14px; padding-block: 20px 40px; gap: 26px; } .gp-header { padding-inline: 14px; } .gp-nav { gap: 12px; } }
.gp-intro { display: grid; gap: 10px; max-width: 46rem; }
.gp-eyebrow { font-family: var(--mono); font-size: var(--t-xs); letter-spacing: 0.06em; text-transform: uppercase; color: var(--muted); }
.gp-intro h1 { font-family: var(--display); font-weight: 500; font-size: var(--t-2xl); line-height: 1.08; letter-spacing: -0.01em; }
mark.gp-hl { background: linear-gradient(transparent 12%, var(--marker) 12%, var(--marker) 88%, transparent 88%); color: var(--marker-ink); padding-inline: 0.12em; border-radius: 2px; }
.gp-intro p { color: var(--muted); font-size: var(--t-md); max-width: 40rem; }

.gp-layout { display: grid; gap: 20px; align-items: start; }
@media (min-width: 860px) { .gp-layout { grid-template-columns: minmax(0, 1.6fr) minmax(0, 1fr); } }
.gp-main { display: grid; gap: 16px; min-width: 0; }
.gp-card { background: var(--surface); border: 1px solid var(--rule); border-radius: var(--radius); padding: 22px; display: grid; gap: 20px; min-width: 0; }
@media (max-width: 480px) { .gp-card { padding: 16px; } }

/* ---------- form ---------- */
.essay-form { display: grid; gap: 24px; }
.gp-step { display: grid; gap: 8px; min-width: 0; }
.gp-step-head { display: flex; align-items: baseline; gap: 10px; }
.gp-step-no { font-family: var(--mono); font-size: var(--t-xs); color: var(--accent); border: 1px solid var(--accent); border-radius: 50%; width: 1.6rem; height: 1.6rem; display: inline-grid; place-items: center; flex: none; }
.gp-step-head label, .gp-step-head h2 { font-size: var(--t-md); font-weight: 700; }
.gp-hint { font-size: var(--t-sm); color: var(--muted); }
.gp-field, #essayQuestion { width: 100%; border: 1px solid var(--rule); border-radius: 8px; background: var(--surface); padding: 11px 13px; font-size: var(--t-md); }
.gp-field:focus, #essayQuestion:focus { border-color: var(--accent); outline: none; box-shadow: 0 0 0 3px var(--accent-soft); }
.gp-field::placeholder, #essayQuestion::placeholder { color: var(--faint); }

.ocr-button-container.gp-upload { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 14px; padding: 12px 14px; border: 1px dashed var(--rule); border-radius: 8px; background: var(--sunk); margin: 0; }
.gp-upload p { font-size: var(--t-sm); color: var(--muted); flex: 1 1 14rem; min-width: 0; }
.gp-upload .mobile-hint { display: none; }
#ocrButton.ocr-button, #ocrCameraButton.ocr-button { appearance: none; border: 1px solid var(--rule); background: var(--surface); color: var(--ink); border-radius: 8px; padding: 8px 14px; font-weight: 500; font-size: var(--t-sm); cursor: pointer; width: auto; box-shadow: none; display: inline-flex; align-items: center; gap: 8px; }
#ocrButton.ocr-button:hover, #ocrCameraButton.ocr-button:hover { border-color: var(--accent); transform: none; }
#ocrCameraButton.ocr-button[hidden] { display: none; }
.gp-upload-buttons { display: flex; flex-wrap: wrap; gap: 8px; }
#ocrButton.ocr-button:disabled { opacity: 0.7; cursor: progress; }

.editor-wrapper { display: grid; gap: 8px; min-width: 0; }
/* GPGenie's own essay box, styled like an answer booklet: faint ruling and a margin rule
   (js/essaySubmission.js grows it with the essay). Lines scroll with the text. */
.gp-booklet { --lh: 1.9rem; --margin: 2.6rem; display: block; width: 100%; min-height: calc(var(--lh) * 9); resize: vertical; border: 1px solid var(--rule); border-radius: 8px;
  font-family: var(--body); font-size: var(--t-md); color: var(--ink); line-height: var(--lh); padding: var(--lh) 16px var(--lh) calc(var(--margin) + 14px);
  background-color: var(--surface);
  background-image:
    linear-gradient(to right, transparent calc(var(--margin) - 1px), var(--margin-rule) calc(var(--margin) - 1px), var(--margin-rule) var(--margin), transparent var(--margin)),
    repeating-linear-gradient(to bottom, transparent 0, transparent calc(var(--lh) - 1px), var(--ruling) calc(var(--lh) - 1px), var(--ruling) var(--lh));
  background-attachment: local; overflow-y: hidden; }
.gp-booklet:focus { border-color: var(--accent); outline: none; box-shadow: 0 0 0 3px var(--accent-soft); }
.gp-booklet::placeholder { color: var(--faint); }
@media (max-width: 480px) { .gp-booklet { --margin: 1.6rem; padding-right: 12px; } }

.gp-wordbar { display: grid; gap: 6px; }
.gp-wordbar-top { display: flex; justify-content: space-between; gap: 10px; font-size: var(--t-sm); color: var(--muted); font-variant-numeric: tabular-nums; flex-wrap: wrap; }
#wordCount { color: var(--ink); font-weight: 700; }
.gp-meter { position: relative; height: 6px; background: var(--sunk); border-radius: 3px; }
.gp-meter-range { position: absolute; top: 0; bottom: 0; left: 50%; width: 30%; background: var(--accent-soft); border-left: 1px solid var(--accent); border-right: 1px solid var(--accent); }
.gp-meter-dot { position: absolute; top: 50%; left: 0; width: 12px; height: 12px; border-radius: 50%; background: var(--accent); transform: translate(-50%, -50%); transition: left 0.2s ease; }
.gp-meter-ticks { position: relative; height: 1rem; font-family: var(--mono); font-size: 0.6875rem; color: var(--faint); }
.gp-meter-ticks span { position: absolute; transform: translateX(-50%); }
.gp-meter-ticks span:first-child { transform: none; }
.gp-meter-ticks span:last-child { transform: translateX(-100%); }

.gp-submit-row { display: flex; flex-wrap: wrap; align-items: center; gap: 12px 16px; }
.gp-btn, .primary-button, #submitEssayBtn { appearance: none; border: 1px solid transparent; border-radius: 8px; padding: 12px 20px; font-weight: 700; font-size: var(--t-md); cursor: pointer; text-decoration: none; display: inline-flex; align-items: center; justify-content: center; gap: 8px; line-height: 1.2; }
.gp-btn-primary, #submitEssayBtn { background: var(--accent); color: var(--accent-ink); }
.gp-btn-primary:hover, #submitEssayBtn:hover { background: var(--accent-hover); }
#submitEssayBtn:disabled { opacity: 0.65; cursor: progress; }
.gp-btn-secondary { background: var(--surface); color: var(--ink); border-color: var(--rule); }
.gp-btn-secondary:hover { border-color: var(--accent); }
.gp-btn-small { padding: 7px 12px; font-size: var(--t-sm); font-weight: 500; }
.gp-btn-inline { padding: 3px 9px; font-size: var(--t-xs); font-weight: 500; vertical-align: baseline; margin-left: 4px; }
.gp-btn:disabled { opacity: 0.6; cursor: not-allowed; }

.error-message, #essayError { display: none; color: var(--bad); background: var(--bad-soft); border: 1px solid var(--bad); border-radius: 8px; padding: 12px 14px; font-size: var(--t-sm); white-space: pre-line; }
.success-message, #essaySuccess { display: none; color: var(--ok); background: var(--ok-soft); border: 1px solid var(--ok); border-radius: 8px; padding: 12px 14px; font-size: var(--t-sm); }

/* ---------- recent reports (js/report-links.js) ---------- */
.recent-reports { background: var(--surface); border: 1px solid var(--rule); border-radius: var(--radius); padding: 18px 22px; display: grid; gap: 8px; }
.recent-reports-title { font-size: var(--t-md); }
.recent-reports-list { list-style: none; margin: 0; padding: 0; display: grid; }
.recent-reports-item { display: flex; align-items: center; gap: 12px; padding: 10px 0; border-top: 1px solid var(--rule); min-width: 0; }
.recent-reports-text { flex: 1 1 auto; min-width: 0; display: grid; }
.recent-reports-question { font-size: var(--t-sm); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.recent-reports-meta { font-size: var(--t-xs); color: var(--muted); font-variant-numeric: tabular-nums; }
.recent-reports-open { font-weight: 700; font-size: var(--t-sm); }
.recent-reports-forget { background: none; border: 0; padding: 0; color: var(--muted); text-decoration: underline; font-size: var(--t-xs); cursor: pointer; justify-self: start; }

/* ---------- Free and Premium ---------- */
.gp-aside { display: grid; gap: 14px; min-width: 0; }
.gp-aside h2 { font-family: var(--display); font-weight: 500; font-size: var(--t-xl); line-height: 1.15; }
.gp-tiers { display: grid; gap: 12px; }
.gp-tier { border: 1px solid var(--rule); border-radius: var(--radius); padding: 16px; display: grid; gap: 10px; background: var(--surface); align-content: start; }
.gp-tier-premium { border-color: var(--accent); box-shadow: inset 0 0 0 1px var(--accent); }
.gp-tier-top { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; }
.gp-tier-name { font-weight: 700; font-size: var(--t-md); }
.gp-tier-price { font-family: var(--display); font-size: var(--t-lg); font-weight: 600; }
.gp-tier ul { margin: 0; padding-left: 1.1rem; display: grid; gap: 4px; font-size: var(--t-sm); }
.gp-tier-fact { font-size: var(--t-xs); color: var(--muted); }
.gp-strict { font-size: var(--t-sm); color: var(--muted); border-top: 1px solid var(--rule); padding-top: 12px; }
.gp-while { gap: 10px; }
.gp-while h2 { font-size: var(--t-lg); }
.gp-while ul { margin: 0; padding-left: 1.1rem; display: grid; gap: 6px; font-size: var(--t-sm); color: var(--muted); }

/* ---------- waiting screen (js/essaySubmission.js) ---------- */
.async-status-container { background: var(--surface); border: 1px solid var(--rule); border-radius: var(--radius); padding: 22px; min-width: 0; }
@media (max-width: 480px) { .async-status-container { padding: 16px; } }
.async-status-content { display: grid; gap: 18px; }
.gp-essay-summary { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 6px 14px; font-size: var(--t-sm); color: var(--muted); padding-bottom: 14px; border-bottom: 1px solid var(--rule); }
.gp-essay-summary span:first-child { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; flex: 1 1 14rem; }
.gp-wait-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; }
#asyncStatusHeading { font-family: var(--display); font-weight: 500; font-size: var(--t-xl); }
.gp-tier-chip { font-size: var(--t-xs); font-weight: 700; border-radius: 999px; padding: 3px 10px; border: 1px solid var(--accent); color: var(--accent); white-space: nowrap; }
.gp-stages { list-style: none; margin: 0; padding: 0; display: grid; gap: 2px; }
.gp-stage { display: grid; grid-template-columns: 1.6rem minmax(0, 1fr); gap: 10px; align-items: center; padding: 6px 0; color: var(--faint); font-size: var(--t-md); }
.gp-stage .gp-dot { width: 1.25rem; height: 1.25rem; border-radius: 50%; border: 2px solid var(--rule); display: grid; place-items: center; font-size: 0.75rem; justify-self: center; }
.gp-stage.done { color: var(--muted); }
.gp-stage.done .gp-dot { background: var(--ok); border-color: var(--ok); color: var(--surface); }
.gp-stage.done .gp-dot::after { content: "\2713"; font-weight: 700; }
.gp-stage.active { color: var(--ink); font-weight: 700; }
.gp-stage.active .gp-dot { border-color: var(--accent); }
.gp-stage.active .gp-dot::after { content: ""; width: 0.5rem; height: 0.5rem; border-radius: 50%; background: var(--accent); animation: gp-pulse 1.4s ease-in-out infinite; }
.gp-stage.failed .gp-dot { border-color: var(--bad); background: var(--bad); color: var(--surface); }
.gp-stage.failed .gp-dot::after { content: "!"; font-weight: 700; }
@keyframes gp-pulse { 0%, 100% { opacity: 1; transform: scale(1); } 50% { opacity: 0.35; transform: scale(0.75); } }
.gp-progress { display: grid; gap: 6px; }
.async-progress-container { height: 8px; background: var(--sunk); border-radius: 4px; overflow: hidden; }
.async-progress-bar { height: 100%; width: 0; background: var(--accent); border-radius: 4px; transition: width 0.8s ease-out; }
.async-progress-bar.failed { background: var(--bad); }
.gp-progress-meta { display: flex; justify-content: space-between; gap: 10px; font-size: var(--t-sm); color: var(--muted); font-variant-numeric: tabular-nums; }
#asyncTimeElapsed { font-family: var(--mono); color: var(--ink); }
.async-status-message { font-size: var(--t-md); }
.async-status-message.error { color: var(--bad); }
.async-connection-notice { font-size: var(--t-sm); color: var(--warn); background: var(--warn-soft); border: 1px solid var(--warn); border-radius: 8px; padding: 10px 12px; }
.gp-stay { display: grid; gap: 4px; padding: 14px 16px; border-radius: 8px; background: var(--accent-soft); border: 1px solid var(--accent); }
.gp-stay strong { font-size: var(--t-md); }
.gp-stay p { font-size: var(--t-sm); }

/* ---------- report link box (js/report-links.js) ---------- */
.report-link-box { display: grid; gap: 10px; padding: 16px; border: 1px solid var(--rule); border-radius: 8px; background: var(--sunk); min-width: 0; }
.report-link-title { font-weight: 700; }
.report-link-help { font-size: var(--t-sm); color: var(--muted); }
.report-link-row { display: flex; flex-wrap: wrap; gap: 8px; }
.report-link-input { flex: 1 1 14rem; min-width: 0; font-family: var(--mono); font-size: var(--t-xs); padding: 9px 10px; border: 1px solid var(--rule); border-radius: 6px; background: var(--surface); color: var(--ink); }
.report-link-button { appearance: none; border: 1px solid var(--rule); background: var(--surface); color: var(--ink); border-radius: 8px; padding: 7px 12px; font-size: var(--t-sm); font-weight: 500; cursor: pointer; text-decoration: none; display: inline-flex; align-items: center; }
.report-link-button:hover { border-color: var(--accent); }
.report-link-private { font-size: var(--t-xs); color: var(--muted); }
.report-link-last-resort { border-top: 1px dashed var(--rule); padding-top: 10px; display: grid; gap: 8px; font-size: var(--t-sm); }
.report-link-id-row { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.report-link-id { font-family: var(--mono); font-size: var(--t-xs); background: var(--surface); border: 1px solid var(--rule); border-radius: 6px; padding: 6px 8px; user-select: all; overflow-wrap: anywhere; min-width: 0; }
.gp-mail { font-family: var(--mono); font-weight: 500; overflow-wrap: anywhere; user-select: all; }

/* ---------- report ready (js/essaySubmission.js) ---------- */
.report-ready-panel { background: var(--surface); border: 1px solid var(--rule); border-radius: var(--radius); padding: 22px; display: grid; gap: 16px; min-width: 0; }
@media (max-width: 480px) { .report-ready-panel { padding: 16px; } }
.report-ready-head { display: grid; gap: 4px; }
.report-ready-text { font-family: var(--display); font-weight: 500; font-size: var(--t-xl); line-height: 1.15; }
.report-ready-sub { font-size: var(--t-sm); color: var(--muted); }
.gp-notice { display: grid; gap: 4px; padding: 14px 16px; border-radius: 8px; border: 1px solid; font-size: var(--t-sm); }
.gp-notice strong { font-size: var(--t-md); }
.gp-notice-warn { background: var(--warn-soft); border-color: var(--warn); }
.gp-notice-info { background: var(--accent-soft); border-color: var(--accent); }
.gp-score { display: grid; gap: 14px; padding: 18px; border: 1px solid var(--rule); border-radius: var(--radius); background: var(--sunk); }
.gp-score-total { display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap; }
.gp-score-big { font-family: var(--display); font-size: 3rem; font-weight: 600; line-height: 1; font-variant-numeric: tabular-nums lining-nums; }
.gp-score-of { font-family: var(--display); font-size: var(--t-lg); color: var(--muted); }
.gp-score-est { font-size: var(--t-xs); color: var(--muted); }
.gp-scale { display: grid; gap: 8px; font-size: var(--t-sm); }
.gp-scale-row > span { white-space: nowrap; }
.gp-scale-row { display: grid; grid-template-columns: 8.4rem minmax(0, 1fr) 3.6rem; gap: 10px; align-items: center; font-variant-numeric: tabular-nums; }
@media (max-width: 400px) { .gp-scale-row { grid-template-columns: 7.6rem minmax(0, 1fr) 3.4rem; gap: 8px; } }
.gp-bands { display: grid; grid-template-columns: repeat(5, 1fr); gap: 2px; }
.gp-bands span { height: 22px; background: var(--surface); display: grid; place-items: center; font-family: var(--mono); font-size: 0.6875rem; color: var(--faint); }
.gp-bands span.on { background: var(--accent); color: var(--accent-ink); }
.report-ready-actions { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.report-ready-button { appearance: none; border: 1px solid transparent; border-radius: 8px; padding: 12px 20px; font-weight: 700; font-size: var(--t-md); cursor: pointer; background: var(--accent); color: var(--accent-ink); }
.report-ready-button:hover { background: var(--accent-hover); }
.report-ready-note { font-size: var(--t-sm); color: var(--bad); }
.report-ready-save { font-size: var(--t-sm); color: var(--muted); }
.gp-save-help { border: 1px solid var(--rule); border-radius: 8px; background: var(--surface); font-size: var(--t-sm); }
.gp-save-help summary { cursor: pointer; padding: 10px 14px; font-weight: 700; }
.gp-save-help ul { margin: 0; padding: 0 14px 12px 32px; display: grid; gap: 6px; color: var(--muted); }
.gp-inapp { margin-bottom: 0; }
.gp-inapp .gp-btn { justify-self: start; margin-top: 4px; }

/* ---------- share your teacher's marks ---------- */
.gp-share-open { justify-self: start; }
.gp-dialog { border: 1px solid var(--rule); border-radius: 14px; background: var(--surface); color: var(--ink); padding: 22px; width: min(620px, calc(100% - 28px)); max-height: calc(100% - 40px); overflow: auto; box-shadow: 0 24px 60px -20px var(--shadow); }
.gp-dialog::backdrop { background: rgba(10, 25, 26, 0.5); }
.gp-dialog-head { display: flex; justify-content: space-between; align-items: start; gap: 12px; }
.gp-dialog-head h2 { font-family: var(--display); font-weight: 500; font-size: var(--t-xl); line-height: 1.15; }
.gp-close { background: none; border: 1px solid var(--rule); border-radius: 8px; width: 2.2rem; height: 2.2rem; cursor: pointer; font-size: 1.2rem; line-height: 1; flex: none; }
.gp-share-form { display: grid; gap: 12px; margin-top: 12px; }
.gp-share-form label { display: grid; gap: 4px; font-size: var(--t-sm); font-weight: 700; }
.gp-share-grid { display: grid; gap: 10px; }
@media (min-width: 560px) { .gp-share-grid { grid-template-columns: minmax(0, 2fr) minmax(0, 1fr) minmax(0, 1fr); } }
.gp-unit { display: flex; align-items: center; gap: 6px; font-weight: 400; color: var(--muted); }
.gp-unit > span { white-space: nowrap; flex: none; }
.gp-unit .gp-field { min-width: 0; }
.gp-field.gp-mono { font-family: var(--mono); font-size: var(--t-xs); }
.gp-consent { display: flex !important; align-items: start; gap: 8px; font-weight: 400 !important; }
.gp-consent input { margin-top: 4px; }
.gp-honeypot { position: absolute; left: -10000px; width: 1px; height: 1px; overflow: hidden; }
.gp-share-status { font-size: var(--t-sm); }

/* ---------- "No question yet" (js/question-suggest.js) ---------- */
.gp-question-dialog { display: none; }
.gp-question-dialog[open] { display: grid; gap: 12px; }
.gp-qs-loading { display: flex; align-items: center; gap: 10px; font-size: var(--t-sm); color: var(--muted); padding: 10px 0; }
.gp-qs-spinner { width: 18px; height: 18px; flex: none; border-radius: 50%; border: 2px solid var(--rule); border-top-color: var(--accent); animation: gp-spin 0.9s linear infinite; }
@keyframes gp-spin { to { transform: rotate(360deg); } }
.gp-qs-ready { display: grid; gap: 12px; min-width: 0; }
.gp-qs-ready[hidden] { display: none; }
.gp-qs-ready label { font-size: var(--t-sm); font-weight: 700; }
.gp-qs-ready textarea { resize: vertical; line-height: 1.45; min-height: 3.4em; }
/* Both choices look the same (owner): neither is the "main" button. */
.gp-qs-actions .gp-btn { flex: 1 1 14rem; }
.gp-sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
/* The offer under an empty question box, after an essay is pasted. */
.gp-question-offer { display: grid; grid-template-columns: minmax(0, 1fr); gap: 8px; justify-items: start; margin-top: 10px; padding: 10px 12px; border: 1px solid var(--rule); border-radius: 8px; background: var(--accent-soft); font-size: var(--t-sm); }
.gp-question-offer[hidden] { display: none; }
/* "Report ready": said next to the marks when the question was GPGenie's suggestion. */
.gp-score-note { font-size: var(--t-sm); color: var(--warn); background: var(--warn-soft); border: 1px solid var(--warn); border-radius: 8px; padding: 8px 12px; }
.gp-score-note[hidden] { display: none; }
.gp-share-status.error { color: var(--bad); }
.gp-share-status.ok { color: var(--ok); }

/* ---------- "Choose your marking" popup (js/tier-choice.js) ---------- */
.tier-dialog { border: 1px solid var(--rule); border-radius: 14px; background: var(--surface); color: var(--ink); padding: 22px; width: min(760px, calc(100% - 28px)); max-height: calc(100% - 32px); overflow: auto; box-shadow: 0 24px 60px -20px var(--shadow); margin: auto; }
.tier-dialog::backdrop { background: rgba(10, 25, 26, 0.5); }
.tier-dialog.tier-dialog-fallback { position: fixed; inset: 0; z-index: 1000; }
.tier-dialog-head { display: flex; justify-content: space-between; align-items: start; gap: 12px; }
.tier-dialog-head h2 { font-family: var(--display); font-weight: 500; font-size: var(--t-xl); }
.tier-close { background: none; border: 1px solid var(--rule); border-radius: 8px; width: 2.2rem; height: 2.2rem; cursor: pointer; font-size: 1.2rem; line-height: 1; flex: none; }
.tier-intro { color: var(--muted); font-size: var(--t-sm); margin: 6px 0 16px; }
.tier-options { display: grid; gap: 12px; }
@media (min-width: 640px) { .tier-options { grid-template-columns: 1fr 1fr; } }
.tier-options .gp-btn { width: 100%; margin-top: 4px; }
.tier-note { font-size: var(--t-xs); color: var(--muted); }
.tier-fineprint { font-size: var(--t-xs); color: var(--muted); margin-top: 14px; }

/* ---------- how marking works ---------- */
.gp-how { display: grid; gap: 16px; }
.gp-how h2, .gp-faq h2 { font-family: var(--display); font-weight: 500; font-size: var(--t-xl); }
.gp-how ol { list-style: none; margin: 0; padding: 0; display: grid; gap: 14px; counter-reset: how; }
@media (min-width: 860px) { .gp-how ol { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 20px; } }
.gp-how li { counter-increment: how; display: grid; gap: 6px; padding-top: 12px; border-top: 2px solid var(--ink); align-content: start; }
.gp-how li::before { content: counter(how); font-family: var(--mono); font-size: var(--t-xs); color: var(--muted); }
.gp-how li strong { font-size: var(--t-md); }
.gp-how li p { font-size: var(--t-sm); color: var(--muted); }

/* ---------- FAQ (js/faq-accordion.js toggles aria-expanded) ---------- */
.gp-faq { display: grid; gap: 8px; }
.gp-faq-group h3 { font-family: var(--mono); font-size: var(--t-xs); text-transform: uppercase; letter-spacing: 0.06em; color: var(--muted); margin: 16px 0 6px; font-weight: 500; }
.faq-item { border-top: 1px solid var(--rule); }
.faq-question { width: 100%; text-align: left; background: none; border: 0; padding: 14px 0; display: flex; justify-content: space-between; gap: 16px; font-weight: 700; font-size: var(--t-md); cursor: pointer; color: var(--ink); }
.faq-question::after { content: "+"; font-family: var(--mono); color: var(--muted); }
.faq-question[aria-expanded="true"]::after { content: "\2013"; }
.faq-answer { display: none; padding: 0 0 16px; color: var(--muted); font-size: var(--t-sm); max-width: 44rem; gap: 8px; }
.faq-question[aria-expanded="true"] + .faq-answer { display: grid; }

/* ---------- footer ---------- */
.gp-footer { border-top: 1px solid var(--rule); background: var(--surface); padding: 20px max(16px, calc((100% - 1120px) / 2)); display: grid; gap: 6px; font-size: var(--t-sm); color: var(--muted); }
.gp-footer a { color: var(--muted); }
.gp-footer .gp-linkish { background: none; border: 0; padding: 0; color: var(--muted); text-decoration: underline; cursor: pointer; font-size: var(--t-sm); }

/* ---------- handwriting upload (js/ocr-async.js; base rules in css/ocr-styles.css, loaded first) ---------- */
.ocr-button-container.gp-upload { text-align: left; }
#ocrButton.ocr-button.success { background: var(--ok-soft); border-color: var(--ok); color: var(--ok); }
#ocrButton.ocr-button.error { background: var(--bad-soft); border-color: var(--bad); color: var(--bad); }
#ocrButton.ocr-button i { font-size: 1rem; }
.ocr-preview-container { margin: 12px 0 0; background: var(--sunk); border: 1px solid var(--rule); border-radius: 8px; padding: 14px; color: var(--ink); }
.preview-header { color: var(--muted); font-size: var(--t-sm); }
.clear-all-btn { background: var(--surface); color: var(--bad); border: 1px solid var(--rule); border-radius: 6px; padding: 5px 10px; font-size: var(--t-xs); }
.clear-all-btn:hover { background: var(--bad-soft); }
.preview-item { background: var(--surface); border: 1px solid var(--rule); border-radius: 6px; }
.preview-item.add-more { background: var(--surface); border: 2px dashed var(--rule); }
.add-photo-btn { color: var(--accent); }
.add-photo-btn:hover { background: var(--accent-soft); }
.process-all-btn { background: var(--accent); color: var(--accent-ink); border-radius: 8px; font-weight: 700; }
.process-all-btn:hover { background: var(--accent-hover); transform: none; box-shadow: none; }
/* Chosen pages (several photos at once, 10 Oct 2026): the notice and the pages take the full row;
   each page shows its number under the picture, with arrows to change the order. */
.gp-upload .ocr-preview-container, .gp-upload .ocr-upload-notice { flex: 1 1 100%; min-width: 0; }
.preview-order-hint { margin: -6px 0 12px; font-size: var(--t-sm); color: var(--muted); }
.preview-grid { grid-template-columns: repeat(auto-fill, minmax(104px, 1fr)); }
.preview-item { aspect-ratio: auto; display: flex; flex-direction: column; }
.preview-item img { width: 100%; height: auto; aspect-ratio: 3 / 4; object-fit: cover; display: block; }
.preview-item.is-pdf > i { display: flex; align-items: center; justify-content: center; aspect-ratio: 3 / 4; font-size: 2rem; color: var(--muted); }
.preview-item .page-bar { display: flex; align-items: center; justify-content: space-between; gap: 2px; min-height: 40px; border-top: 1px solid var(--rule); }
.preview-item .page-no { flex: 1 1 auto; min-width: 0; padding: 0 2px; text-align: center; font-size: var(--t-xs); font-weight: 600; color: var(--ink); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.preview-item .move-btn { flex: 0 0 30px; height: 40px; padding: 0; border: 0; background: none; color: var(--accent); font-size: 0.85rem; cursor: pointer; }
.preview-item .move-btn:hover { background: var(--accent-soft); }
.preview-item .move-btn:disabled { color: var(--rule); cursor: default; background: none; }
.preview-more { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 14px; }
.preview-more .add-photo-btn { flex: 1 1 auto; flex-direction: row; justify-content: center; gap: 6px; width: auto; height: auto; min-height: 44px; padding: 8px 6px; white-space: nowrap; border: 1px dashed var(--accent); border-radius: 8px; background: var(--surface); font-size: var(--t-sm); font-weight: 500; }
.preview-more .add-photo-btn i { font-size: 1rem; }
.ocr-upload-notice { max-width: none; margin: 10px 0 0; border: 1px solid var(--bad); border-radius: 8px; background: var(--bad-soft); color: var(--bad); font-size: var(--t-sm); }
#essayQuestion.needs-question { border-color: var(--warn); box-shadow: 0 0 0 3px var(--warn-soft); }
.question-prompt { border: 1px solid var(--warn); border-radius: 8px; background: var(--warn-soft); color: var(--ink); font-size: var(--t-sm); }
.question-prompt .question-prompt-hint { color: var(--muted); }
.transcript-check { margin: 0; border: 1px solid var(--accent); border-radius: 8px; background: var(--accent-soft); color: var(--ink); font-size: var(--t-sm); }
.transcript-check--warning { border-color: var(--warn); background: var(--warn-soft); }
.transcript-check--error { border-color: var(--bad); background: var(--bad-soft); }
.transcript-check .transcript-check-title { font-family: var(--display); font-weight: 500; font-size: var(--t-lg); color: var(--ink); }
.transcript-check--error .transcript-check-title { color: var(--bad); }
.transcript-check-detail, .transcript-check-notes ul { color: var(--muted); }
.transcript-check-notes summary { color: var(--accent); }
@media (max-width: 480px) { .gp-wide-only { display: none; } }

/* ---------- no card is ever wider than its column ----------
   Grid columns default to growing with their widest content (a long question on one
   line, the private link), which pushed card contents past the card's edge. */
.gp-main, .gp-card, .essay-form, .gp-step, .async-status-content, .report-ready-panel, .report-link-box,
.report-link-last-resort, .gp-aside, .gp-tier, .gp-share-form, .gp-notice, .gp-stay, .gp-score, .gp-scale { grid-template-columns: minmax(0, 1fr); }
.gp-wait-head, .report-link-row, .report-link-id-row, .gp-submit-row, .report-ready-actions { min-width: 0; }

/* narrow phones (about 360px and less) */
@media (max-width: 360px) {
  .gp-brand img { height: 30px; }
  .gp-nav { gap: 10px; font-size: var(--t-xs); }
  .gp-scale-row { grid-template-columns: minmax(0, 1fr) auto; row-gap: 4px; }
  .gp-scale-row .gp-bands { grid-column: 1 / -1; grid-row: 2; }
}

/* ---------- which panels show: body[data-gp-view] = form | waiting | ready (js/essaySubmission.js) ---------- */
#gpAsideWhile { display: none; }
body[data-gp-view="waiting"] #gpAsideWhile, body[data-gp-view="ready"] #gpAsideWhile { display: grid; }
body[data-gp-view="waiting"] #gpAsideCompare, body[data-gp-view="ready"] #gpAsideCompare { display: none; }
body[data-gp-view="waiting"] #essaySubmissionView, body[data-gp-view="ready"] #essaySubmissionView { display: none; }
body:not([data-gp-view="form"]) #recentReportsPanel { display: none; }
.gp-text-button { background: none; border: 0; padding: 0; color: var(--accent); text-decoration: underline; cursor: pointer; font: inherit; }
.gp-coffee-text { margin: 10px 0 14px; }

/* ---------- partial data warning (inline styles from the script; keep it readable in dark mode) ---------- */
#partialDataWarning { color: #6b4e00 !important; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; scroll-behavior: auto !important; }
}
