:root {
  --font-sans: "Segoe UI Variable", "Segoe UI", Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, Arial, sans-serif;
  --bg: #f6f8f6;
  --bg-soft: #edf5f1;
  --card: #ffffff;
  --card-soft: #fbfcfb;
  --text: #25302f;
  --text-strong: #101817;
  --muted: #667574;
  --muted-2: #87918f;
  --line: #dfe7e3;
  --line-strong: #cbd7d2;
  --primary: #2f6f6a;
  --primary-dark: #1f524d;
  --primary-soft: rgba(47, 111, 106, .1);
  --accent: #7c5cff;
  --accent-soft: rgba(124, 92, 255, .09);
  --warm: #b96b4c;
  --warm-soft: rgba(185, 107, 76, .1);
  --ok: #26785f;
  --ok-soft: rgba(38, 120, 95, .1);
  --warn: #a7642b;
  --warn-soft: rgba(167, 100, 43, .12);
  --bad: #b94d55;
  --bad-soft: rgba(185, 77, 85, .1);
  --shadow: 0 16px 36px rgba(32, 47, 43, .08);
  --shadow-soft: 0 8px 20px rgba(32, 47, 43, .055);
  --radius: 8px;
  --radius-sm: 8px;
  --focus: 0 0 0 4px rgba(47, 111, 106, .18);
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  min-height: 100vh;
  font-family: var(--font-sans);
  background: linear-gradient(180deg, #fbfcfb 0%, var(--bg) 42%, #f1f6f3 100%);
  color: var(--text);
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
}

button,
input,
textarea,
select { font: inherit; }

button { cursor: pointer; }
button:disabled { cursor: not-allowed; opacity: .58; }

a { color: inherit; }

p { color: var(--muted); line-height: 1.58; }

h1,
h2,
h3 {
  color: var(--text-strong);
  letter-spacing: 0;
}

h1 {
  margin: 0;
  font-size: 2.25rem;
  line-height: 1.02;
}

h2 { margin: 0; font-size: 1.28rem; line-height: 1.18; }
h3 { margin: 0; font-size: 1.05rem; line-height: 1.35; }

input,
textarea,
select {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: .9rem 1rem;
  color: var(--text);
  background: #fff;
  box-shadow: 0 1px 0 rgba(16, 24, 23, .02);
}

textarea { min-height: 112px; resize: vertical; }

input:focus,
textarea:focus,
select:focus,
button:focus-visible,
a:focus-visible,
.choice:focus-within .choice-card,
.drop:focus-within {
  outline: none;
  box-shadow: var(--focus);
  border-color: rgba(47, 111, 106, .55);
}

.skip-link {
  position: absolute;
  left: 1rem;
  top: .8rem;
  z-index: 100;
  transform: translateY(-160%);
  padding: .75rem 1rem;
  border-radius: 999px;
  background: var(--text-strong);
  color: #fff;
  font-weight: 800;
  text-decoration: none;
}

.skip-link:focus { transform: translateY(0); }

.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  padding: .85rem max(1rem, calc((100vw - 1180px) / 2));
  background: rgba(251, 252, 251, .9);
  backdrop-filter: blur(16px);
  border-bottom: 1px solid rgba(223, 231, 227, .9);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: .75rem;
  text-decoration: none;
  min-width: 0;
}

.brand-mark {
  width: 42px;
  height: 42px;
  border-radius: 8px;
  display: grid;
  place-items: center;
  background: linear-gradient(135deg, var(--primary), #698a6f);
  color: #fff;
  font-weight: 950;
  font-size: 1.35rem;
  box-shadow: 0 10px 24px rgba(47, 111, 106, .2);
}

.brand-copy { display: grid; line-height: 1.1; }
.brand-copy small { color: var(--muted); margin-top: .2rem; }

.topbar-nav,
.badges,
.inline-pills {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: .5rem;
}

.topbar-nav span,
.pill,
.step-pill,
.badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: .35rem;
  min-height: 30px;
  padding: .36rem .72rem;
  border-radius: 999px;
  background: var(--primary-soft);
  color: var(--primary-dark);
  font-size: .82rem;
  font-weight: 850;
  white-space: nowrap;
}

.pill.ok { background: var(--ok-soft); color: var(--ok); }
.pill.warn { background: var(--warn-soft); color: var(--warn); }
.pill.bad { background: var(--bad-soft); color: var(--bad); }
.pill.muted { background: #edf2f7; color: var(--muted); }

.app {
  width: min(1180px, calc(100% - 2rem));
  margin: 1rem auto 3rem;
}

.app:focus { outline: none; }

.grid { display: grid; gap: 1rem; }
.grid.two,
.grid.three { grid-template-columns: 1fr; align-items: start; }

.hero {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1rem;
  margin-bottom: 1.1rem;
}

.card {
  background: rgba(255, 255, 255, .97);
  border: 1px solid rgba(223, 231, 227, .96);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 1rem;
}

.card.soft {
  background: var(--card-soft);
  box-shadow: var(--shadow-soft);
}

.hero-card {
  min-height: auto;
  display: grid;
  align-content: space-between;
  gap: 1.25rem;
  background: linear-gradient(145deg, #ffffff 0%, #f5faf7 64%, #f7f4ff 100%);
}

.hero-kicker,
.solve-eyebrow,
.task-kicker {
  margin: 0 0 .45rem;
  color: var(--primary-dark);
  font-size: .82rem;
  font-weight: 950;
  letter-spacing: 0;
  text-transform: uppercase;
}

.hero-copy { max-width: 760px; }
.hero-copy p { font-size: 1.08rem; max-width: 680px; }
.hero-stats { display: grid; grid-template-columns: 1fr; gap: .75rem; margin-top: 0; }

.stat-card,
.metric,
.summary-row,
.file-row,
.status-row,
.timeline-row {
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: #fbfcfb;
  padding: .88rem;
}

.stat-card strong,
.metric strong,
.summary-row strong { display: block; color: var(--text-strong); font-size: 1.1rem; }
.stat-card small,
.metric small,
.summary-row small { display: block; color: var(--muted); margin-bottom: .18rem; }

.header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1rem;
}

.header p { margin: .25rem 0 0; }

.actions,
.action-row {
  display: flex;
  flex-wrap: wrap;
  gap: .72rem;
  margin-top: 1rem;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: .45rem;
  min-height: 44px;
  border: 1px solid transparent;
  border-radius: 8px;
  padding: .78rem 1.1rem;
  font-weight: 900;
  text-decoration: none;
  transition: transform .15s ease, box-shadow .15s ease, border-color .15s ease, background-color .15s ease;
  user-select: none;
}

.btn:hover:not(:disabled) { transform: translateY(-1px); }
.btn.primary { background: linear-gradient(135deg, var(--primary), #5c7f65); color: #fff; box-shadow: 0 12px 26px rgba(47, 111, 106, .2); }
.btn.secondary { background: #fff; border-color: var(--line); color: var(--text); }
.btn.ghost { background: transparent; border-color: transparent; color: var(--primary-dark); }
.btn.danger { background: #fff; border-color: rgba(196, 61, 61, .28); color: var(--bad); }
.btn.full { width: 100%; }
.btn.small { min-height: 36px; padding: .55rem .78rem; font-size: .9rem; }

.progress-shell {
  display: grid;
  gap: .55rem;
  margin-bottom: 1.1rem;
}

.progress-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: .8rem;
  color: var(--muted);
  font-size: .92rem;
  font-weight: 750;
}

.progress-bar {
  height: 8px;
  border-radius: 999px;
  background: #e4ebe7;
  overflow: hidden;
}

.progress-bar span {
  display: block;
  width: var(--value, 0%);
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--primary), var(--accent));
  transition: width .25s ease;
}

.step-list { display: grid; gap: .65rem; }
.step-row { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: .7rem; align-items: start; }
.step-index {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  display: grid;
  place-items: center;
  background: var(--primary-soft);
  color: var(--primary-dark);
  font-weight: 950;
}
.step-row.is-done .step-index { background: var(--ok-soft); color: var(--ok); }
.step-row.is-active .step-index { background: var(--primary); color: #fff; box-shadow: 0 0 0 5px rgba(47, 111, 106, .12); }
.step-row.is-muted { opacity: .72; }
.step-row strong { display: block; color: var(--text-strong); }
.step-row span { color: var(--muted); font-size: .92rem; }

.fields { display: grid; gap: 1rem; }
.fields.two,
.fields.three { grid-template-columns: 1fr; }

.label,
label .label {
  display: block;
  margin-bottom: .45rem;
  color: var(--text-strong);
  font-weight: 850;
}

.help { color: var(--muted); font-size: .9rem; margin: .35rem 0 0; }

.choices {
  display: grid;
  grid-template-columns: 1fr;
  gap: .75rem;
}

.choice { position: relative; display: block; }
.choice input { position: absolute; opacity: 0; pointer-events: none; width: 1px; height: 1px; }
.choice-card {
  display: grid;
  gap: .25rem;
  height: 100%;
  padding: .95rem;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  transition: border-color .15s ease, box-shadow .15s ease, background-color .15s ease;
}
.choice-card strong { color: var(--text-strong); }
.choice-card span { color: var(--muted); font-size: .92rem; line-height: 1.42; }
.choice input:checked + .choice-card {
  border-color: var(--primary);
  background: linear-gradient(180deg, rgba(47, 111, 106, .055), #fff);
  box-shadow: 0 0 0 4px rgba(47, 111, 106, .12);
}

.drop {
  display: grid;
  gap: .65rem;
  place-items: center;
  text-align: center;
  border: 1.5px dashed #b9c9c2;
  border-radius: 8px;
  padding: 1.35rem;
  background: linear-gradient(180deg, rgba(47, 111, 106, .05), rgba(124, 92, 255, .035));
}
.native-file-input { position: fixed; left: -9999px; top: -9999px; width: 1px; height: 1px; opacity: 0; }
.drop strong { color: var(--text-strong); }
.drop p { margin: 0; }
.drop.is-dragover { border-color: var(--primary); background: rgba(47, 111, 106, .08); }

.files,
.summary,
.status-list,
.task-list,
.payment-actions { display: grid; gap: .75rem; }

.file-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: .75rem;
  align-items: center;
}
.file-row strong { overflow-wrap: anywhere; }
.file-row p { margin: .2rem 0 0; }

.metrics { display: grid; grid-template-columns: 1fr; gap: .75rem; margin-bottom: .9rem; }
.metric.large strong { font-size: 1.45rem; }

.notice {
  padding: .92rem 1rem;
  border-radius: 8px;
  margin-bottom: 1rem;
  border: 1px solid transparent;
  line-height: 1.48;
}
.notice.compact { margin: .75rem 0 0; padding: .68rem .85rem; font-size: .94rem; }
.notice:last-child { margin-bottom: 0; }
.notice.info { background: var(--primary-soft); color: var(--primary-dark); border-color: rgba(47, 111, 106, .14); }
.notice.ok { background: var(--ok-soft); color: var(--ok); border-color: rgba(15, 138, 95, .15); }
.notice.warn { background: var(--warn-soft); color: var(--warn); border-color: rgba(184, 109, 0, .16); }
.notice.error { background: var(--bad-soft); color: var(--bad); border-color: rgba(196, 61, 61, .16); }
.noscript { width: min(1180px, calc(100% - 2rem)); margin: 1rem auto; }

.empty {
  padding: 1rem;
  border: 1px dashed var(--line-strong);
  border-radius: 8px;
  color: var(--muted);
  background: #fbfcfb;
}

.spinner {
  display: inline-block;
  width: 1rem;
  height: 1rem;
  border: 2px solid rgba(47, 111, 106, .18);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin .8s linear infinite;
  vertical-align: -2px;
}

.status-row,
.timeline-row {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  align-items: start;
  gap: .65rem;
}

.status-dot {
  width: .9rem;
  height: .9rem;
  margin-top: .25rem;
  border-radius: 50%;
  background: #b8c4d5;
  box-shadow: 0 0 0 5px rgba(184, 196, 213, .12);
}
.status-dot.active { background: var(--warn); box-shadow: 0 0 0 6px rgba(184, 109, 0, .12); }
.status-dot.ok { background: var(--ok); box-shadow: 0 0 0 6px rgba(15, 138, 95, .12); }
.status-dot.bad { background: var(--bad); box-shadow: 0 0 0 6px rgba(196, 61, 61, .12); }

.ready-link-card,
.payment-card {
  border: 1px solid rgba(47, 111, 106, .18);
  border-radius: 8px;
  padding: 1rem;
  background: linear-gradient(180deg, rgba(47, 111, 106, .05), rgba(255, 255, 255, .96));
}

.copy-row,
.download-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: .7rem;
  align-items: center;
}

.link-input { background: #fff; overflow: hidden; text-overflow: ellipsis; }

.sticky-summary { position: sticky; top: 92px; }

.public-shell,
.solve-shell { display: grid; gap: 1.1rem; }
.public-head,
.solve-hero {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: start;
  gap: 1rem;
}

.assignment-meta,
.result-meta { display: flex; flex-wrap: wrap; gap: .5rem; margin-bottom: 1rem; }

.task-card,
.solve-task {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 1rem;
  background: #fbfcfb;
  scroll-margin: 110px;
}

.task-head,
.solve-task__head,
.solve-section-head,
.solve-result__top,
.solve-submit-bar {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  align-items: flex-start;
}

.choice-list,
.solve-choice-group { display: grid; gap: .58rem; }
.answer-choice,
.solve-choice {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: .7rem;
  align-items: start;
  padding: .85rem;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}
.answer-choice input,
.solve-choice input { width: 1.05rem; height: 1.05rem; margin: .18rem 0 0; accent-color: var(--primary); }
.answer-choice.disabled { color: var(--muted); }
.input-preview { background: #f8fafc; color: var(--muted); }

.mono { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace; }
.muted { color: var(--muted); }
.sr-only {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  padding: 0 !important;
  margin: -1px !important;
  overflow: hidden !important;
  clip: rect(0, 0, 0, 0) !important;
  white-space: nowrap !important;
  border: 0 !important;
}

.solve-hero {
  background: linear-gradient(145deg, #ffffff 0%, #f4faf6 68%, #f7f4ff 100%);
}
.solve-hero__content { min-width: 0; }
.solve-hero__content h1 { margin: .15rem 0 .65rem; overflow-wrap: anywhere; }
.solve-hero__meta { display: flex; flex-direction: column; align-items: flex-end; gap: .65rem; min-width: 220px; }
.solve-expiry { color: var(--muted); font-size: .9rem; text-align: right; }

.solve-layout { display: grid; grid-template-columns: 1fr; gap: 1.1rem; align-items: start; }
.solve-form,
.solve-result,
.solve-side { min-width: 0; }
.solve-side { position: sticky; top: 92px; }
.solve-section-head { margin-bottom: 1.1rem; }
.solve-task h3 { margin: 0; }
.solve-task.is-invalid { border-color: rgba(196, 61, 61, .45); box-shadow: 0 0 0 4px rgba(196, 61, 61, .08); }
.solve-field { display: grid; gap: .35rem; margin-top: .9rem; }
.solve-choice-group { margin: .9rem 0 0; padding: 0; border: 0; min-width: 0; }
.solve-choice { cursor: pointer; transition: border-color .15s ease, box-shadow .15s ease, background-color .15s ease; }
.solve-choice:hover { border-color: rgba(47, 111, 106, .38); background: rgba(47, 111, 106, .035); }
.solve-choice:has(input:checked) { border-color: var(--primary); box-shadow: 0 0 0 4px rgba(47, 111, 106, .12); }
.solve-choice span { min-width: 0; overflow-wrap: anywhere; }
.solve-field-error { margin-top: .65rem; color: var(--bad); font-weight: 850; font-size: .92rem; }
.solve-submit-bar { margin-top: 1.2rem; padding: 1rem; border: 1px solid rgba(47, 111, 106, .16); border-radius: 8px; background: rgba(47, 111, 106, .04); align-items: center; }
.solve-submit-bar__copy { display: grid; gap: .2rem; }
.solve-submit-bar__copy span { color: var(--muted); font-size: .94rem; }
.solve-submit { min-width: 190px; }
.solve-wait { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 1rem; align-items: center; }
.solve-wait__icon { width: 54px; height: 54px; border-radius: 8px; display: grid; place-items: center; background: var(--primary-soft); border: 1px solid rgba(47, 111, 106, .13); }
.solve-result__top { align-items: center; margin-bottom: 1.1rem; }
.solve-score { --score: 0%; width: 160px; height: 160px; flex: 0 0 auto; border-radius: 50%; display: grid; place-items: center; text-align: center; background: radial-gradient(circle closest-side, #fff 68%, transparent 70%), conic-gradient(var(--primary) var(--score), rgba(219, 228, 240, .95) 0); box-shadow: inset 0 0 0 1px var(--line), var(--shadow); }
.solve-score strong,
.solve-score span { grid-area: 1 / 1; }
.solve-score strong { display: block; margin-top: -.8rem; color: var(--text-strong); font-size: 2rem; letter-spacing: 0; }
.solve-score span { align-self: center; margin-top: 2.6rem; color: var(--muted); font-size: .86rem; font-weight: 850; }
.solve-task--result { background: #fff; }
.solve-task--correct { border-color: rgba(15, 138, 95, .24); }
.solve-task--partial { border-color: rgba(184, 109, 0, .28); }
.solve-task--incorrect { border-color: rgba(196, 61, 61, .25); }
.solve-result-badge { display: inline-flex; align-items: center; justify-content: center; padding: .4rem .7rem; border-radius: 999px; font-weight: 900; font-size: .82rem; white-space: nowrap; }
.solve-result-badge--correct { background: var(--ok-soft); color: var(--ok); }
.solve-result-badge--partial { background: var(--warn-soft); color: var(--warn); }
.solve-result-badge--incorrect { background: var(--bad-soft); color: var(--bad); }
.solve-points { margin-top: .7rem; color: var(--text-strong); }
.solve-feedback { margin: .8rem 0 0; color: var(--text); }
.solve-answer-grid { display: grid; grid-template-columns: 1fr; gap: .7rem; margin: .9rem 0 0; }
.solve-answer-grid > div { min-width: 0; padding: .8rem; border: 1px solid var(--line); border-radius: 8px; background: #fbfcfb; }
.solve-answer-grid dt { margin-bottom: .35rem; color: var(--muted); font-size: .82rem; font-weight: 900; text-transform: uppercase; letter-spacing: 0; }
.solve-answer-grid dd { margin: 0; overflow-wrap: anywhere; }
.solve-json { margin: 0; white-space: pre-wrap; overflow-wrap: anywhere; font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: .86rem; }

@keyframes spin { to { transform: rotate(360deg); } }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; scroll-behavior: auto !important; transition-duration: .01ms !important; }
}

@media (min-width: 560px) {
  h1 { font-size: 3rem; }
  .card { padding: 1.15rem; }
  .btn { width: auto; }
  .hero-stats,
  .metrics { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .fields.two,
  .choices,
  .copy-row,
  .download-row,
  .solve-answer-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .copy-row,
  .download-row { grid-template-columns: minmax(0, 1fr) auto; }
}

@media (min-width: 760px) {
  h1 { font-size: 3.65rem; }
  h2 { font-size: 1.45rem; }
  .app { margin-top: 1.25rem; }
  .card { padding: 1.25rem; }
  .grid.three,
  .fields.three { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}

@media (min-width: 981px) {
  .hero { grid-template-columns: minmax(0, 1.2fr) minmax(310px, .8fr); }
  .grid.two { grid-template-columns: minmax(0, 1.35fr) minmax(300px, .9fr); }
  .solve-layout { grid-template-columns: minmax(0, 1fr) minmax(280px, .42fr); }
  .hero-card { min-height: 350px; }
}

@media (max-width: 980px) {
  .hero,
  .grid.two,
  .solve-layout,
  .public-head,
  .solve-hero { grid-template-columns: 1fr; }
  .sticky-summary,
  .solve-side { position: static; }
  .solve-hero__meta { align-items: flex-start; min-width: 0; }
  .solve-expiry { text-align: left; }
}

@media (max-width: 760px) {
  .topbar { align-items: flex-start; flex-direction: column; }
  .topbar-nav { justify-content: flex-start; }
  .hero-stats,
  .grid.three,
  .fields.two,
  .fields.three,
  .choices,
  .metrics,
  .copy-row,
  .download-row,
  .solve-answer-grid { grid-template-columns: 1fr; }
  .header,
  .task-head,
  .solve-task__head,
  .solve-section-head,
  .solve-result__top,
  .solve-submit-bar { flex-direction: column; }
  .btn { width: 100%; }
  .file-row { grid-template-columns: 1fr; }
  .solve-submit { width: 100%; }
  .solve-score { width: 132px; height: 132px; }
  .solve-score strong { font-size: 1.7rem; }
}

@media (max-width: 520px) {
  .app { width: min(100% - 1rem, 1180px); margin-top: .75rem; }
  .card,
  .task-card,
  .solve-task,
  .solve-submit-bar { padding: .9rem; border-radius: 8px; }
  .hero-card { min-height: auto; gap: 1rem; }
  .solve-wait { grid-template-columns: 1fr; }
  .solve-wait__icon { width: 48px; height: 48px; }
}
