:root {
  --pl-purple: #660066;
  --pl-deep: #3c003f;
  --pl-cream: #f5dfbd;
  --pl-paper: #fffdfa;
  --pl-ink: #231d23;
  --pl-muted: #706772;
  --pl-green: #237a57;
}

html, body, #mainpage { min-height: 100%; }
#mainpage { background: linear-gradient(145deg, var(--pl-deep), var(--pl-purple) 48%, #8b187f); color: var(--pl-ink); padding: 0 0 40px; }
.hero { color: white; text-align: center; padding: 34px 20px 27px; }
.hero h1 { font-size: clamp(35px, 5vw, 58px); font-weight: 800; letter-spacing: -1.5px; margin: 3px 0 8px; }
.hero p { font-size: 18px; max-width: 760px; margin: auto; opacity: .9; }
.hero-kicker { font-size: 12px; font-weight: 800; letter-spacing: 3px; opacity: .72; }
.app-shell { max-width: 1450px; margin: 0 auto; padding: 0 24px; display: grid; grid-template-columns: minmax(290px, 360px) minmax(0, 1fr); gap: 22px; align-items: start; }
.controls-card, .preview-card, .results-card, .outcome-cue-card, .preview-progress-card { background: var(--pl-paper); border-radius: 16px; box-shadow: 0 18px 48px rgba(20,0,20,.28); }
.controls-card { min-width: 0; padding: 24px; position: sticky; top: 16px; }
.controls-card h3 { font-size: 18px; font-weight: 750; margin: 3px 0 14px; }
.controls-card hr { border-color: #e8dfdf; margin: 20px 0; }
.controls-card .well { background: var(--pl-cream); border: 0; }
.controls-card .btn-block { width: 100%; margin: 8px 0; }
.automatic-card { display: flex; align-items: flex-start; gap: 11px; padding: 12px 13px; margin: 10px 0 12px; border: 1px solid #d8eadf; border-radius: 10px; background: #eef8f2; color: #315e49; }
.automatic-card > i { margin-top: 2px; color: var(--pl-green); }
.automatic-card strong, .automatic-card span { display: block; }
.automatic-card strong { margin-bottom: 2px; font-size: 14px; }
.automatic-card span { color: #557064; font-size: 12px; line-height: 1.4; }
.primary-option { padding: 12px 13px 11px; margin: 10px 0 12px; border: 2px solid #d9c5dc; border-radius: 10px; background: white; }
.primary-option .form-group { margin-bottom: 3px; }
.primary-option .checkbox { margin: 0; }
.primary-option .checkbox label { color: var(--pl-purple); font-size: 15px; font-weight: 750; }
.primary-option-help { padding-left: 20px; color: var(--pl-muted); font-size: 12px; line-height: 1.4; }
.advanced-fold { margin-top: 10px; border: 1px solid #e2d8e3; border-radius: 10px; background: #fbf8fb; overflow: hidden; }
.advanced-fold > summary { display: flex; align-items: center; gap: 9px; padding: 10px 12px; cursor: pointer; color: var(--pl-purple); font-weight: 700; list-style: none; user-select: none; }
.advanced-fold > summary::-webkit-details-marker { display: none; }
.advanced-fold > summary:hover, .advanced-fold > summary:focus { background: #f4edf4; outline: none; }
.advanced-fold > summary span, .advanced-fold > summary small { display: block; }
.advanced-fold > summary small { margin-top: 1px; color: var(--pl-muted); font-size: 11px; font-weight: 500; }
.advanced-chevron { transition: transform .18s ease; font-size: 12px; }
.advanced-fold[open] .advanced-chevron { transform: rotate(90deg); }
.advanced-body { border-top: 1px solid #e8dfe8; padding: 14px 14px 4px; }
.advanced-section-title { margin: 1px 0 12px; padding-bottom: 6px; border-bottom: 1px solid #eadfea; color: var(--pl-purple); font-size: 12px; font-weight: 800; letter-spacing: .04em; text-transform: uppercase; }
.advanced-section-title:not(:first-child) { margin-top: 23px; }
.advanced-control { margin-bottom: 19px; }
.advanced-control .form-group { margin-bottom: 5px; }
.reverse-ink-example { display: grid; grid-template-columns: 1fr 26px 1fr; align-items: center; gap: 7px; width: min(100%, 248px); margin: 8px auto 10px; }
.reverse-ink-page { display: block; aspect-ratio: 4 / 5; padding: 17% 13%; border: 1px solid #c9c1cb; border-radius: 7px; box-sizing: border-box; box-shadow: 0 3px 9px rgba(25,0,25,.10); }
.reverse-ink-page strong { display: block; margin-bottom: 17%; font-size: 10px; letter-spacing: .04em; }
.reverse-ink-page span { display: block; width: 100%; height: 6%; margin-bottom: 12%; border-radius: 8px; background: currentColor; }
.reverse-ink-page span:last-child { width: 61%; }
.reverse-ink-page-dark { background: #15131a; color: #fff; }
.reverse-ink-page-light { background: #fff; color: #15131a; }
.reverse-ink-arrow { color: #706772; font-size: 24px; font-weight: 800; text-align: center; }
.advanced-why { color: var(--pl-muted); font-size: 12px; line-height: 1.45; }
.advanced-why strong { color: #5c525d; }
.advanced-subfold { margin: 5px 0 12px; border: 1px solid #e8e0e8; border-radius: 8px; background: white; overflow: hidden; }
.advanced-subfold > summary { padding: 9px 11px; cursor: pointer; color: #554b56; font-size: 13px; font-weight: 700; list-style-position: inside; }
.advanced-subfold > summary:hover, .advanced-subfold > summary:focus { background: #f7f2f7; outline: none; }
.advanced-subbody { padding: 12px 12px 1px; border-top: 1px solid #eee7ee; }
.technical-note { padding: 0 12px 12px; }
.process-button { font-weight: 700; font-size: 16px; padding: 11px 14px; }
.results-column { min-width: 0; }
.preview-card, .results-card { padding: 24px; margin-bottom: 22px; }
.outcome-cue-card { padding: 34px; text-align: center; }
.outcome-cue-card h2 { margin: 12px 0 8px; color: var(--pl-purple); font-size: 26px; }
.outcome-cue-card > p { max-width: 590px; margin: 0 auto; color: #554b56; font-size: 16px; line-height: 1.55; }
.outcome-cue-icon, .preview-progress-icon { display: inline-grid; width: 48px; height: 48px; place-items: center; border-radius: 50%; background: #f4eaf4; color: var(--pl-purple); font-size: 20px; }
.outcome-cue-proof { display: flex; max-width: 620px; align-items: flex-start; justify-content: center; gap: 8px; margin: 22px auto 0; padding-top: 17px; border-top: 1px solid #eee5eb; color: var(--pl-muted); font-size: 13px; line-height: 1.45; text-align: left; }
.outcome-cue-proof i { flex: 0 0 auto; margin-top: 2px; color: var(--pl-green); }
.preview-progress-card { display: flex; align-items: flex-start; gap: 15px; padding: 25px 27px; }
.preview-progress-card h2 { margin: 1px 0 3px; color: var(--pl-purple); font-size: 22px; }
.preview-progress-card .empty-state, .preview-progress-card .inline-error { margin: 7px 0 0; }
.section-heading { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; border-bottom: 1px solid #eee5eb; margin-bottom: 16px; }
.section-heading h2 { font-size: 24px; margin: 0 0 10px; }
.section-heading span { color: var(--pl-muted); font-size: 13px; }
.preview-heading { align-items: center; }
.preview-navigation { display: flex; align-items: flex-end; justify-content: flex-end; gap: 9px; flex-wrap: wrap; }
.page-navigation { display: flex; align-items: flex-end; gap: 5px; }
.preview-navigation .form-group { margin: 0; }
.preview-navigation label { margin: 0 0 4px; color: var(--pl-muted); font-size: 12px; white-space: nowrap; }
.preview-navigation input { height: 34px; }
.preview-navigation .selectize-control { margin-bottom: 0; }
.preview-navigation .selectize-input { min-height: 34px; padding-top: 6px; padding-bottom: 6px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.preview-step-buttons { display: flex; gap: 5px; padding-bottom: 1px; }
.preview-step-buttons .btn { min-width: 38px; height: 34px; padding: 6px 10px; }
.preview-position { color: var(--pl-muted); font-size: 13px; margin: -7px 0 14px; text-align: right; }
.preview-card h4 { text-align: center; color: var(--pl-muted); font-weight: 700; text-transform: uppercase; font-size: 12px; letter-spacing: 1px; }
.preview-card img { max-width: 100%; height: auto; background: white; border: 1px solid #ddd; box-shadow: 0 5px 18px rgba(0,0,0,.09); }
.metric-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; margin-bottom: 22px; }
.metric-card { background: rgba(255,255,255,.95); border: 1px solid rgba(255,255,255,.6); border-radius: 14px; padding: 18px; box-shadow: 0 10px 28px rgba(20,0,20,.18); display: flex; flex-direction: column; }
.metric-card strong { color: var(--pl-purple); font-size: 21px; line-height: 1.1; }
.metric-card span { color: var(--pl-muted); margin-top: 7px; font-size: 13px; }
.completed-summary { margin-bottom: 22px; }
.completed-summary .metric-grid { margin-bottom: 12px; }
.completed-summary .result-explanation { margin-top: 0; box-shadow: 0 10px 28px rgba(20,0,20,.14); }
.upload-summary, .process-note, .empty-state, .inline-error, .result-explanation { border-radius: 8px; padding: 10px 12px; margin-top: 10px; }
.upload-summary { background: #f4edf4; }
.process-note, .empty-state { color: var(--pl-muted); background: #f7f4f7; font-size: 13px; }
.process-note.success { background: #e7f4ed; color: var(--pl-green); font-weight: 700; }
.inline-error { background: #fde9e8; color: #9f2c28; }
.result-explanation { background: #f4edf4; color: #554b56; }
.account-area { text-align: center; margin-top: 12px; }
#download_wrap { margin-top: 12px; }
.signup-surface { background: var(--pl-purple); min-height: 100vh; }
.table { background: white; }
.table th { color: var(--pl-purple); }
.legal-footer { color: rgba(255,255,255,.86); font-size: 13px; line-height: 1.7; max-width: 1450px; margin: 22px auto 0; padding: 0 24px; text-align: center; }
.legal-footer span { margin-right: 4px; }
.legal-footer a { color: white; text-decoration: underline; text-underline-offset: 2px; margin: 0 7px; }
.legal-footer a:hover, .legal-footer a:focus { color: var(--pl-cream); }

@media (max-width: 900px) {
  .app-shell { grid-template-columns: 1fr; padding: 0 12px; }
  .controls-card { position: static; }
  .metric-grid { grid-template-columns: 1fr; }
  .section-heading { display: block; }
  .preview-navigation { justify-content: flex-start; margin: 8px 0 12px; }
  .preview-position { text-align: left; }
  .outcome-cue-card { padding: 27px 20px; }
  .legal-footer { padding: 0 12px; }
}
