:root {
    --bg: #f5f0e6;
    --bg-2: #efe9dd;
    --paper: #ffffff;
    --ink: #1a1815;
    --ink-2: #5a554c;
    --ink-3: #8a8478;
    --line: #e3dccd;
    --line-2: #d7cfbc;
    --red: oklch(0.55 0.18 25);
    --red-soft: oklch(0.92 0.05 25);
    --red-deep: oklch(0.42 0.18 25);
    --green: oklch(0.62 0.15 145);
    --shadow: 0 1px 0 rgba(0,0,0,0.04), 0 18px 40px -22px rgba(20,15,5,0.25);
  }

  * { box-sizing: border-box; }
  html, body { height: 100%; }
  body {
    margin: 0;
    font-family: "Helvetica Neue", Helvetica, Arial, sans-serif;
    color: var(--ink);
    background:
      radial-gradient(1200px 600px at 50% -10%, #fbf4e3 0%, transparent 60%),
      radial-gradient(900px 500px at 100% 110%, #f1e6d2 0%, transparent 55%),
      var(--bg);
    -webkit-font-smoothing: antialiased;
    text-rendering: optimizeLegibility;
    overflow-x: hidden;
  }

  /* very subtle paper grain */
  body::before {
    content: "";
    position: fixed; inset: 0;
    pointer-events: none;
    opacity: 0.5;
    mix-blend-mode: multiply;
    background-image:
      radial-gradient(circle at 1px 1px, rgba(80,60,40,0.06) 1px, transparent 0);
    background-size: 4px 4px;
    z-index: 0;
  }

  #root { position: relative; z-index: 1; min-height: 100vh; display: grid; place-items: center; padding: 32px 16px; }

  /* ---------- Envelope / stage ---------- */
  .stage {
    width: min(520px, 100%);
    position: relative;
  }

  .meta-row {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    font-family: "JetBrains Mono", ui-monospace, monospace;
    font-size: 11px;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--ink-3);
    margin-bottom: 14px;
    padding: 0 4px;
  }
  .meta-row .dot {
    display: inline-block; width: 6px; height: 6px; border-radius: 50%;
    background: var(--red); margin-right: 8px; vertical-align: middle;
    animation: pulse 1.8s ease-in-out infinite;
  }
  @keyframes pulse {
    0%, 100% { opacity: 1; transform: scale(1); }
    50% { opacity: 0.4; transform: scale(0.7); }
  }

  .card {
    background: var(--paper);
    border: 1px solid var(--line);
    border-radius: 14px;
    padding: 36px 32px 28px;
    box-shadow: var(--shadow);
    position: relative;
    overflow: hidden;
  }

  .stamp {
    position: absolute;
    top: -10px;
    right: 22px;
    transform: rotate(7deg);
    background: var(--red);
    color: #fff;
    font-family: "JetBrains Mono", monospace;
    font-size: 9px;
    letter-spacing: 0.15em;
    padding: 6px 10px;
    border-radius: 2px;
    text-transform: uppercase;
    box-shadow: 0 8px 16px -8px rgba(180,40,30,0.5);
  }

  h1.eyebrow {
    font-family: "JetBrains Mono", monospace;
    font-size: 11px;
    letter-spacing: 0.18em;
    text-transform: uppercase;
    color: var(--ink-3);
    margin: 0 0 14px;
    font-weight: 500;
  }

  .title {
    font-family: "Instrument Serif", "Times New Roman", serif;
    font-weight: 400;
    font-size: 44px;
    line-height: 1.02;
    letter-spacing: -0.01em;
    margin: 0 0 8px;
    text-wrap: balance;
  }
  .title em {
    font-style: italic;
    color: var(--red-deep);
  }

  .subtitle {
    color: var(--ink-2);
    font-size: 14.5px;
    line-height: 1.5;
    margin: 0 0 22px;
    text-wrap: pretty;
  }

  /* ---------- reCAPTCHA-style widget ---------- */
  .captcha-widget {
    border: 1px solid #d4d4d4;
    background: #f9f9f9;
    border-radius: 6px;
    padding: 12px 14px;
    display: flex;
    align-items: center;
    gap: 14px;
    margin-bottom: 18px;
    font-family: Roboto, "Helvetica Neue", Arial, sans-serif;
    font-size: 14px;
    color: #555;
    user-select: none;
  }
  .captcha-checkbox {
    width: 26px; height: 26px;
    border: 2px solid #c1c1c1;
    background: #fcfcfc;
    border-radius: 2px;
    cursor: pointer;
    position: relative;
    flex-shrink: 0;
    transition: border-color 0.15s;
  }
  .captcha-checkbox:hover { border-color: #999; }
  .captcha-checkbox.loading {
    border: 3px solid #c1c1c1;
    border-top-color: #4a90e2;
    border-radius: 50%;
    animation: spin 0.9s linear infinite;
    cursor: wait;
  }
  .captcha-checkbox.done {
    border-color: #4caf50;
    background: #fff;
  }
  .captcha-checkbox.done::after {
    content: "";
    position: absolute;
    left: 5px; top: 1px;
    width: 8px; height: 14px;
    border: solid #4caf50;
    border-width: 0 3px 3px 0;
    transform: rotate(45deg);
  }
  @keyframes spin { to { transform: rotate(360deg); } }

  .captcha-label { flex: 1; }
  .captcha-brand {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
    color: #9a9a9a;
    font-size: 8px;
    line-height: 1;
    text-transform: uppercase;
    letter-spacing: 0.05em;
  }
  .captcha-brand .logo {
    font-size: 11px;
    font-weight: 600;
    color: #6a6a6a;
    letter-spacing: 0;
    text-transform: none;
    font-family: "Instrument Serif", serif;
    font-style: italic;
  }
  .captcha-brand .heart {
    width: 18px; height: 18px;
    color: var(--red);
  }
  .captcha-brand .terms { font-size: 8px; color: #b0b0b0; }

  /* status messages cycling under the checkbox */
  .status-line {
    font-family: "JetBrains Mono", monospace;
    font-size: 11px;
    color: var(--ink-3);
    margin: -8px 0 18px;
    min-height: 16px;
    padding-left: 4px;
  }
  .status-line .blink::after {
    content: "_";
    animation: blink 1s steps(2) infinite;
  }
  @keyframes blink { 50% { opacity: 0; } }

  /* ---------- Image grid challenge ---------- */
  .challenge {
    border: 1px solid var(--line-2);
    border-radius: 10px;
    background: #fff;
    overflow: hidden;
    margin-bottom: 18px;
    box-shadow: 0 10px 30px -18px rgba(0,0,0,0.15);
  }
  .challenge-header {
    background: var(--red-deep);
    color: #fff;
    padding: 14px 16px;
    font-size: 14px;
    line-height: 1.35;
  }
  .challenge-header strong { font-weight: 600; font-size: 16px; display: block; margin-bottom: 2px; }
  .challenge-header .hint { opacity: 0.85; font-size: 12.5px; }
  .grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 2px;
    background: #ddd;
    border-bottom: 1px solid var(--line-2);
  }
  .cell {
    aspect-ratio: 1 / 1;
    background: #fff;
    position: relative;
    cursor: pointer;
    overflow: hidden;
    transition: transform 0.15s;
  }
  .cell:hover { transform: scale(0.98); }
  .cell.selected {
    outline: 3px solid #4a90e2;
    outline-offset: -3px;
  }
  .cell.selected::before {
    content: "";
    position: absolute;
    inset: 0;
    background: rgba(74,144,226,0.12);
    z-index: 2;
  }
  .cell.selected::after {
    content: "✓";
    position: absolute;
    top: 6px; left: 6px;
    width: 20px; height: 20px;
    background: #4a90e2;
    color: #fff;
    display: grid; place-items: center;
    border-radius: 50%;
    font-size: 13px;
    z-index: 3;
  }
  .cell svg { display: block; width: 100%; height: 100%; }
  .cell .caption {
    position: absolute;
    bottom: 0; left: 0; right: 0;
    background: rgba(0,0,0,0.55);
    color: #fff;
    font-size: 9px;
    padding: 3px 5px;
    font-family: "JetBrains Mono", monospace;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    text-align: center;
    z-index: 1;
  }

  .challenge-foot {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 12px;
    background: #fafafa;
  }
  .icon-btn {
    background: none;
    border: none;
    padding: 6px;
    cursor: pointer;
    color: #777;
    font-size: 14px;
    border-radius: 4px;
  }
  .icon-btn:hover { background: #ececec; color: #222; }

  .verify-btn {
    background: #4a90e2;
    color: #fff;
    border: none;
    padding: 9px 18px;
    font-size: 13px;
    font-weight: 500;
    border-radius: 3px;
    cursor: pointer;
    letter-spacing: 0.02em;
    transition: background 0.15s;
  }
  .verify-btn:hover { background: #3a7fcc; }
  .verify-btn:disabled { background: #b8d2ee; cursor: not-allowed; }

  /* ---------- Slider challenge ---------- */
  .slider-challenge {
    border: 1px solid var(--line-2);
    border-radius: 10px;
    background: #fff;
    padding: 22px 22px 18px;
    margin-bottom: 18px;
  }
  .slider-q {
    font-size: 15px;
    color: var(--ink);
    margin: 0 0 18px;
  }
  .slider-track-wrap {
    position: relative;
    padding: 8px 0 38px;
  }
  .slider-track {
    height: 6px;
    background: var(--line);
    border-radius: 999px;
    position: relative;
    overflow: hidden;
  }
  .slider-fill {
    position: absolute; left: 0; top: 0; bottom: 0;
    background: linear-gradient(90deg, #f3a8a0, var(--red));
    border-radius: 999px;
    pointer-events: none;
    transition: width 0.05s linear;
  }
  .slider-input {
    position: absolute;
    left: 0; right: 0; top: 0;
    height: 32px;
    width: 100%;
    -webkit-appearance: none;
    appearance: none;
    background: transparent;
    margin: 0;
    cursor: grab;
  }
  .slider-input:active { cursor: grabbing; }
  .slider-input::-webkit-slider-thumb {
    -webkit-appearance: none; appearance: none;
    width: 28px; height: 28px;
    border-radius: 50%;
    background: #fff;
    border: 2px solid var(--red);
    box-shadow: 0 4px 10px -2px rgba(180,40,30,0.4);
    cursor: grab;
  }
  .slider-input::-moz-range-thumb {
    width: 28px; height: 28px;
    border-radius: 50%;
    background: #fff;
    border: 2px solid var(--red);
    cursor: grab;
  }
  .slider-labels {
    position: absolute;
    left: 0; right: 0;
    bottom: 6px;
    display: flex;
    justify-content: space-between;
    font-family: "JetBrains Mono", monospace;
    font-size: 10px;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--ink-3);
  }
  .slider-readout {
    font-family: "Instrument Serif", serif;
    font-style: italic;
    font-size: 22px;
    color: var(--red-deep);
    text-align: center;
    margin-top: 10px;
    min-height: 30px;
    transition: color 0.2s;
  }

  /* ---------- Reveal ---------- */
  .reveal-card {
    text-align: center;
    padding: 56px 32px 40px;
    position: relative;
  }
  .reveal-card .seal {
    width: 64px; height: 64px;
    margin: 0 auto 22px;
    color: var(--red);
    animation: thump 1.4s ease-in-out infinite;
  }
  @keyframes thump {
    0%, 30%, 60%, 100% { transform: scale(1); }
    15%, 45% { transform: scale(1.08); }
  }
  .reveal-eyebrow {
    font-family: "JetBrains Mono", monospace;
    font-size: 11px;
    letter-spacing: 0.2em;
    text-transform: uppercase;
    color: var(--ink-3);
    margin: 0 0 16px;
  }
  .reveal-title {
    font-family: "Instrument Serif", serif;
    font-size: 56px;
    line-height: 1.04;
    margin: 0 0 14px;
    letter-spacing: -0.015em;
  }
  .reveal-title .name {
    color: var(--red-deep);
    font-style: italic;
  }
  .reveal-sub {
    color: var(--ink-2);
    font-size: 15px;
    line-height: 1.5;
    max-width: 360px;
    margin: 0 auto 22px;
  }
  .signature {
    font-family: "Instrument Serif", serif;
    font-style: italic;
    font-size: 22px;
    color: var(--ink);
    margin-top: 32px;
    padding-top: 18px;
    border-top: 1px dashed var(--line-2);
    display: inline-block;
    min-width: 200px;
  }
  .signature small {
    display: block;
    font-family: "JetBrains Mono", monospace;
    font-style: normal;
    font-size: 10px;
    color: var(--ink-3);
    letter-spacing: 0.1em;
    text-transform: uppercase;
    margin-top: 4px;
  }

  /* confetti hearts */
  .confetti {
    position: fixed; inset: 0;
    pointer-events: none;
    overflow: hidden;
    z-index: 5;
  }
  .confetti .h {
    position: absolute;
    color: var(--red);
    opacity: 0;
    animation: fall 4s ease-in forwards;
  }
  @keyframes fall {
    0% { transform: translateY(-40px) rotate(0deg); opacity: 0; }
    10% { opacity: 1; }
    100% { transform: translateY(110vh) rotate(540deg); opacity: 0.5; }
  }

  /* ---------- Decline button ---------- */
  .actions {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 4px;
  }
  .decline {
    background: none;
    border: none;
    color: var(--ink-3);
    font-size: 12px;
    cursor: pointer;
    padding: 8px 10px;
    text-decoration: underline;
    text-underline-offset: 3px;
    transition: transform 0.35s cubic-bezier(.5,-0.3,.4,1.4);
    font-family: inherit;
  }
  .decline:hover { color: var(--ink-2); }
  .footnote {
    margin-top: 14px;
    text-align: center;
    font-family: "JetBrains Mono", monospace;
    font-size: 10px;
    color: var(--ink-3);
    letter-spacing: 0.08em;
    text-transform: uppercase;
  }

  /* error toast */
  .toast {
    background: #fdecec;
    border: 1px solid #f5c2c2;
    color: #8b2020;
    padding: 8px 12px;
    border-radius: 6px;
    font-size: 12.5px;
    margin-bottom: 14px;
    display: flex;
    gap: 8px;
    align-items: flex-start;
  }
  .toast .x { font-weight: 600; }

  /* anim entry for cards */
  .fade-in { animation: fadeIn 0.45s ease both; }
  @keyframes fadeIn {
    from { opacity: 0; transform: translateY(6px); }
    to { opacity: 1; transform: none; }
  }

  /* subtle "powered by" footer (links only to the main site d-solve.de) */
  .site-footer {
    width: 100%;
    text-align: center;
    padding: 22px 16px 28px;
    font-family: "JetBrains Mono", monospace;
    font-size: 11px;
    letter-spacing: 0.06em;
    color: var(--ink-3);
  }
  .site-footer a {
    color: var(--ink-3);
    text-decoration: none;
    border-bottom: 1px dotted var(--line-2);
    transition: color 0.2s ease;
  }
  .site-footer a:hover { color: var(--ink-2); }