:root {
  --bg: #f8f7f2;
  --ink: #171717;
  --muted: #66645d;
  --line: #222222;
  --panel: #ffffff;
  --accent: #147a63;
  --accent-dark: #0e5747;
  --focus: #0c6fd6;
  --shadow: 0 20px 60px rgba(23, 23, 23, 0.08);
}

* {
  box-sizing: border-box;
}

html {
  min-width: 320px;
  background: var(--bg);
  color: var(--ink);
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
    sans-serif;
}

body {
  margin: 0;
}

button,
input {
  font: inherit;
}

button {
  cursor: pointer;
}

.page-shell {
  display: grid;
  grid-template-columns: minmax(320px, 420px) minmax(0, 1fr);
  gap: 24px;
  width: min(1680px, calc(100% - 32px));
  min-height: 100vh;
  margin: 0 auto;
  padding: 24px 0;
}

.intro {
  position: sticky;
  top: 24px;
  display: grid;
  gap: 18px;
  align-self: start;
  max-height: calc(100vh - 48px);
  overflow: auto;
  padding: 6px 2px 12px;
}

.intro-copy {
  padding-top: 0;
}

h1,
h2,
p {
  margin-top: 0;
}

h1 {
  max-width: 820px;
  margin-bottom: 16px;
  font-size: clamp(2.35rem, 4.9vw, 4.65rem);
  line-height: 0.98;
  letter-spacing: 0;
}

.lede {
  max-width: 680px;
  margin-bottom: 18px;
  color: #2f2d28;
  font-size: clamp(1.08rem, 2.4vw, 1.45rem);
  line-height: 1.42;
}

.disclaimer,
.mock-note,
.canvas-heading p {
  color: var(--muted);
  line-height: 1.5;
}

.disclaimer {
  max-width: 660px;
  margin-bottom: 0;
  font-size: clamp(1.04rem, 1.8vw, 1.18rem);
  font-weight: 650;
}

.contribution-panel {
  padding: 20px;
  border: 1px solid rgba(23, 23, 23, 0.14);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: var(--shadow);
}

.progress-group {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}

.metric-label {
  margin-bottom: 6px;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0;
  text-transform: uppercase;
}

.metric-value {
  margin-bottom: 0;
  font-size: clamp(1rem, 3vw, 1.35rem);
  font-weight: 850;
  line-height: 1.1;
}

.progress-track {
  height: 10px;
  margin: 16px 0 20px;
  overflow: hidden;
  border: 1px solid rgba(23, 23, 23, 0.18);
  border-radius: 999px;
  background: #ece9df;
}

.progress-fill {
  width: 0;
  height: 100%;
  background: var(--accent);
}

.pixel-form {
  display: grid;
  gap: 18px;
}

fieldset {
  min-width: 0;
  margin: 0;
  padding: 0;
  border: 0;
}

legend {
  margin-bottom: 10px;
  color: #312f2a;
  font-size: 0.9rem;
  font-weight: 800;
}

.palette {
  display: grid;
  grid-template-columns: repeat(8, minmax(28px, 1fr));
  gap: 7px;
}

.color-swatch {
  width: 100%;
  aspect-ratio: 1;
  border: 1px solid rgba(23, 23, 23, 0.18);
  border-radius: 6px;
  background: var(--swatch);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.22);
}

.color-swatch[aria-pressed="true"] {
  outline: 3px solid var(--line);
  outline-offset: 2px;
}

.color-swatch:focus-visible,
.pay-button:focus-visible,
input:focus-visible {
  outline: 3px solid var(--focus);
  outline-offset: 2px;
}

.optional-fields {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

label {
  display: grid;
  gap: 6px;
  color: #312f2a;
  font-size: 0.84rem;
  font-weight: 800;
}

input {
  width: 100%;
  height: 42px;
  border: 1px solid rgba(23, 23, 23, 0.22);
  border-radius: 6px;
  padding: 0 11px;
  background: #fffefb;
  color: var(--ink);
}

.pay-button {
  min-height: 50px;
  border: 0;
  border-radius: 6px;
  padding: 0 18px;
  background: var(--accent);
  color: white;
  font-weight: 850;
}

.pay-button:hover {
  background: var(--accent-dark);
}

.pay-button:disabled {
  cursor: wait;
  opacity: 0.7;
}

.mock-note {
  margin: 12px 0 0;
  font-size: 0.86rem;
}

.canvas-section {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  min-width: 0;
  min-height: calc(100vh - 48px);
  padding-bottom: 0;
}

.canvas-heading {
  display: flex;
  gap: 16px;
  align-items: end;
  justify-content: space-between;
  margin-bottom: 12px;
}

h2 {
  margin-bottom: 0;
  font-size: clamp(1.45rem, 4vw, 2rem);
  letter-spacing: 0;
}

.canvas-heading p {
  margin-bottom: 2px;
  text-align: right;
}

.canvas-viewport {
  position: relative;
  min-width: 0;
  min-height: 520px;
  overflow: auto;
  border-radius: 8px;
  background: var(--bg);
  cursor: grab;
  overscroll-behavior: contain;
  user-select: none;
}

.canvas-viewport.is-panning {
  cursor: grabbing;
}

.canvas-wrap {
  position: relative;
  width: max-content;
  margin: 18px;
  border: 2px solid var(--line);
  padding: 2px;
  background:
    linear-gradient(45deg, #f1efe8 25%, transparent 25%),
    linear-gradient(-45deg, #f1efe8 25%, transparent 25%),
    linear-gradient(45deg, transparent 75%, #f1efe8 75%),
    linear-gradient(-45deg, transparent 75%, #f1efe8 75%);
  background-color: #fffefb;
  background-position:
    0 0,
    0 5px,
    5px -5px,
    -5px 0;
  background-size: 10px 10px;
  box-shadow: 0 18px 80px rgba(23, 23, 23, 0.12);
}

#pixel-canvas {
  display: block;
  width: 2000px;
  height: 2000px;
  aspect-ratio: 1;
  image-rendering: pixelated;
}

@media (max-width: 2040px) {
  .canvas-wrap {
    margin: 18px;
  }
}

@media (min-width: 861px) {
  .contribution-panel {
    box-shadow: 0 14px 44px rgba(23, 23, 23, 0.07);
  }
}

.pixel-popover {
  position: absolute;
  z-index: 4;
  max-width: min(280px, calc(100vw - 48px));
  border: 1px solid rgba(23, 23, 23, 0.18);
  border-radius: 8px;
  padding: 10px 12px;
  background: rgba(255, 255, 255, 0.96);
  box-shadow: 0 12px 40px rgba(23, 23, 23, 0.16);
  color: var(--ink);
  font-size: 0.88rem;
  line-height: 1.4;
}

.pixel-popover strong {
  display: block;
  margin-bottom: 4px;
}

.success-page {
  display: grid;
  min-height: 100vh;
  place-items: center;
  padding: 24px;
}

.success-card {
  width: min(100%, 620px);
  border: 1px solid rgba(23, 23, 23, 0.14);
  border-radius: 8px;
  padding: clamp(24px, 6vw, 48px);
  background: var(--panel);
  box-shadow: var(--shadow);
}

.success-card h1 {
  margin-bottom: 14px;
  font-size: clamp(2.5rem, 8vw, 5rem);
}

.success-card p {
  color: #2f2d28;
  font-size: clamp(1.08rem, 2.4vw, 1.3rem);
  line-height: 1.45;
}

.success-kicker {
  margin-bottom: 12px;
  color: var(--accent-dark);
  font-size: 0.84rem;
  font-weight: 850;
  text-transform: uppercase;
}

.home-link {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  margin-top: 14px;
  border-radius: 6px;
  padding: 0 16px;
  background: var(--accent);
  color: #ffffff;
  font-weight: 850;
  text-decoration: none;
}

.home-link:hover {
  background: var(--accent-dark);
}

@media (max-width: 860px) {
  .page-shell {
    display: block;
    width: min(100% - 24px, 720px);
    padding-top: 18px;
  }

  .intro {
    position: static;
    max-height: none;
    overflow: visible;
    gap: 18px;
  }

  .contribution-panel {
    padding: 16px;
  }

  .canvas-section {
    min-height: auto;
    padding-top: 22px;
  }

  .canvas-viewport {
    min-height: 68vh;
  }
}

@media (max-width: 560px) {
  .progress-group,
  .optional-fields {
    grid-template-columns: 1fr;
  }

  .palette {
    grid-template-columns: repeat(8, minmax(24px, 1fr));
    gap: 6px;
  }

  .canvas-heading {
    display: block;
  }

  .canvas-heading p {
    margin-top: 6px;
    text-align: left;
  }
}
