  /* TAY fonts load from /assets when present; Google fallbacks otherwise */
  @font-face {
    font-family: "TAY Dumpling";
    src: url("/conundrum/fonts/TAYDumpling.otf") format("opentype");
    font-display: swap;
  }
  @font-face {
    font-family: "TAY Birdie";
    src: url("/conundrum/fonts/TAYBirdie.otf") format("opentype");
    font-display: swap;
  }

  :root {
    --cream: #F5EFDC;
    --red: #E52E12;
    --green: #3D5B33;
    --display: "TAY Dumpling", "Oswald", "Arial Narrow", sans-serif;
    --cap-nudge: 0.137em;  /* TAY Dumpling capitals sit this far above centre; used to recentre them */
    --body: "TAY Birdie", "Space Mono", "Courier New", monospace;
  }

  * { margin: 0; padding: 0; box-sizing: border-box; }

  html { background: var(--cream); }
  body {
    background: var(--cream);
    color: var(--red);
    font-family: var(--body);
    -webkit-font-smoothing: antialiased;
    overflow-x: hidden;
  }

  /* ---------- Decorative stamps ---------- */
  .stamp {
    position: absolute;
    z-index: 1;
    pointer-events: none;
    user-select: none;
  }
  .stamp img { display: block; width: 100%; height: auto; }
  /* Stamp tops are % of the cream area, taken from the Figma frame, so they never drift onto the red panel */
  .stage { position: relative; overflow-x: clip; }
  .stamp-tree     { left: 2.1vw;  top: 22.4%; width: clamp(90px, 11.9vw, 204px); transform: rotate(-14.2deg); }
  .stamp-present  { right: 3.6vw; top: 6%;    width: clamp(88px, 11vw, 197px); }
  .stamp-wreath   { right: 5.5vw; top: 58.9%; width: clamp(80px, 10.4vw, 180px); transform: rotate(6.33deg); }
  .stamp-santa-hat{ right: -1.6vw; top: 69%;  width: clamp(90px, 11vw, 190px); transform: rotate(-11.22deg); }
  .stamp-holly    { left: 4.3vw;  top: 72.4%; width: clamp(95px, 12.3vw, 210px); transform: rotate(12.42deg); }

  /* ---------- Hero / title ---------- */
  .hero {
    position: relative;
    z-index: 2;
    display: flex;
    flex-direction: column;
    align-items: center;
    padding-top: clamp(30px, 4.5vw, 64px);
  }
  .hero img { display: block; height: auto; }
  .title-the        { width: clamp(48px, 6.2vw, 107px); }
  .title-christmas  { width: clamp(140px, 18.1vw, 311px); margin-top: clamp(10px, 1.4vw, 24px); }
  .title-conundrum  { width: clamp(155px, 19.9vw, 342px); margin-top: clamp(8px, 1.1vw, 19px); }

  /* ---------- Jumble ---------- */
  .jumble {
    position: relative;
    z-index: 2;
    margin: clamp(40px, 6vw, 104px) auto 0;
    display: flex;
    flex-direction: column;
    gap: clamp(4px, 0.35vw, 6px);
    align-items: center;
  }
  .jumble-row { display: flex; gap: clamp(4px, 0.35vw, 6px); }
  .tile {
    padding-top: calc(var(--cap-nudge) * 2);
    width: clamp(40px, 7.4vw, 127px);
    height: clamp(40px, 7.4vw, 127px);
    background: var(--red);
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: var(--display);
    font-size: clamp(26px, 4.6vw, 79px);
    line-height: 1;
    text-transform: uppercase;
    color: var(--cream);
    user-select: none;
    opacity: 0;
    animation: deal 0.45s ease forwards;
  }
  @keyframes deal {
    0% { opacity: 0; transform: rotateX(90deg); }
    100% { opacity: 1; transform: rotateX(0); }
  }

  .shuffle-line { position: relative; z-index: 2; text-align: center; margin-top: clamp(18px, 2vw, 34px); }
  .shuffle-line button {
    background: var(--red);
    border: none;
    color: var(--cream);
    font-family: var(--display);
    font-size: clamp(14px, 1.35vw, 23px);
    letter-spacing: 0.11em;
    text-transform: uppercase;
    cursor: pointer;
    padding: calc(clamp(8px, 0.8vw, 14px) + var(--cap-nudge)) clamp(28px, 3.2vw, 56px) calc(clamp(8px, 0.8vw, 14px) - var(--cap-nudge));
    transition: opacity 0.25s;
  }
  .shuffle-line button:hover { opacity: 0.85; }

  /* ---------- Tease copy ---------- */
  .tease {
    position: relative;
    z-index: 2;
    font-family: var(--display);
    font-size: clamp(18px, 1.85vw, 31px);
    line-height: 1.19;
    text-transform: uppercase;
    text-align: center;
    color: var(--red);
    max-width: clamp(300px, 40vw, 683px);
    margin: clamp(60px, 8.5vw, 146px) auto clamp(60px, 8vw, 138px);
    text-wrap: balance;
  }

  /* ---------- Red panel ---------- */
  .panel {
    position: relative;
    z-index: 2;
    background: var(--red);
    color: var(--cream);
    padding: clamp(40px, 5.5vw, 95px) clamp(24px, 7vw, 120px) clamp(28px, 3vw, 52px);
  }
  .panel-cols {
    display: grid;
    grid-template-columns: 1fr 1px 1fr;
    gap: clamp(28px, 4.4vw, 76px);
    max-width: 1480px;
    margin: 0 auto;
  }
  .panel-copy h2 {
    font-family: var(--display);
    font-weight: 400;
    font-size: clamp(20px, 1.85vw, 31px);
    line-height: 1.21;
    text-transform: uppercase;
    max-width: 12ch;
  }
  .panel-copy p {
    margin-top: clamp(24px, 3.5vw, 62px);
    font-size: clamp(13px, 1.05vw, 18px);
    line-height: 1.43;
    letter-spacing: -0.03em;
    text-transform: uppercase;
    max-width: 62ch;
  }
  .panel-divider { background: var(--cream); width: 1.5px; }

  /* ---------- Form ---------- */
  .field { margin-bottom: clamp(24px, 2.6vw, 45px); }
  .field label {
    display: block;
    font-size: clamp(13px, 1.05vw, 18px);
    letter-spacing: 0.04em;
    text-transform: uppercase;
    margin-bottom: clamp(12px, 1.2vw, 22px);
  }
  .field input {
    width: 100%;
    background: transparent;
    border: none;
    border-bottom: 1.5px solid var(--cream);
    border-radius: 0;
    color: var(--cream);
    font-family: var(--body);
    font-size: clamp(16px, 1.15vw, 20px);
    text-transform: uppercase;
    padding: 2px 0 10px;
    outline: none;
  }
  .field.error input { border-bottom-color: #7e1204; border-bottom-width: 3px; }
  .form-footer { display: flex; justify-content: flex-end; margin-top: clamp(20px, 2vw, 35px); }
  .submit-btn {
    background: var(--cream);
    border: none;
    color: var(--red);
    font-family: var(--display);
    font-size: clamp(14px, 1.05vw, 18px);
    letter-spacing: 0.11em;
    text-transform: uppercase;
    padding: calc(clamp(7px, 0.5vw, 9px) + var(--cap-nudge)) clamp(36px, 3.4vw, 58px) calc(clamp(7px, 0.5vw, 9px) - var(--cap-nudge));
    cursor: pointer;
    transition: opacity 0.25s;
  }
  .submit-btn:hover { opacity: 0.85; }
  .submit-btn:disabled { opacity: 0.6; cursor: wait; }
  .hp { position: absolute; left: -9999px; width: 1px; height: 1px; overflow: hidden; }

  [x-cloak] { display: none !important; }
  .is-busy { opacity: 0.6; }
  #entry-thanks h2 {
    font-family: var(--display);
    font-weight: 400;
    font-size: clamp(22px, 1.85vw, 31px);
    text-transform: uppercase;
  }
  #entry-thanks p {
    margin-top: 18px;
    font-size: clamp(13px, 1.05vw, 18px);
    line-height: 1.43;
    text-transform: uppercase;
    max-width: 52ch;
  }

  .panel-wordmark {
    display: block;
    margin: clamp(44px, 6vw, 104px) auto 0;
    width: clamp(200px, 17.8vw, 305px);
    height: auto;
  }

  /* ---------- Toast ---------- */
  .toast {
    position: fixed;
    top: 24px;
    left: 50%;
    transform: translateX(-50%);
    background: var(--green);
    color: var(--cream);
    font-family: var(--display);
    font-size: 14px;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    padding: 12px 24px;
    z-index: 50;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s;
    white-space: nowrap;
  }
  .toast.show { opacity: 1; }

  /* ---------- Responsive ---------- */
  @media (max-width: 900px) {
    .panel-cols { grid-template-columns: 1fr; }
    .panel-divider { width: 100%; height: 1.5px; }
    .stamp-santa-hat, .stamp-wreath, .stamp-holly { display: none; }
  }
  @media (max-width: 540px) {
    /* 7 tiles + 6 gaps of 4px + 16px side margins fill the phone width */
    .tile {
      width: min(56px, calc((100vw - 56px) / 7));
      height: min(56px, calc((100vw - 56px) / 7));
      font-size: min(35px, calc((100vw - 56px) / 7 * 0.62));
    }
    .stamp-tree { left: 3vw; top: 58px; width: 62px; }
    .stamp-present { right: 3vw; top: 14px; width: 58px; }
    .tease { max-width: 86vw; margin: 44px auto 48px; }
    .shuffle-line button { min-height: 44px; }
    .submit-btn { width: 100%; min-height: 48px; }
  }
  @media (prefers-reduced-motion: reduce) {
    .tile { animation: none; opacity: 1; }
  }

  /* ---------- Consent checkbox ---------- */
  .consent {
    display: flex;
    align-items: flex-start;
    gap: 14px;
    margin-bottom: clamp(8px, 1vw, 16px);
    font-size: clamp(13px, 1.05vw, 18px);
    letter-spacing: 0.04em;
    text-transform: uppercase;
    cursor: pointer;
  }
  .consent input {
    appearance: none;
    flex: none;
    width: 22px;
    height: 22px;
    border: 1.5px solid var(--cream);
    background: transparent;
    cursor: pointer;
  }
  /* Line height matches the box, so the first line centres on it; TAY Birdie's capitals sit high, so nudge them down */
  .consent span { line-height: 22px; position: relative; top: 0.05em; }
  .consent input:checked { background: var(--cream); box-shadow: inset 0 0 0 4px var(--red); }
  .consent input:focus-visible { outline: 2px solid var(--cream); outline-offset: 3px; }

