:root {
    --ink: #1a1a1a;
    --butter: #FFEFA8;
    --butter-dot: #F4D96A;
    --fawn: #D9B88C;
    --fawn-deep: #B89260;
    --muzzle: #F5E2C4;
    --ear-pink: #FFC2D1;
    --pink: #FF6FA8;
    --pink-deep: #E34D88;
    --sky: #8ECFF5;
    --lav: #C9B6FF;
    --coral: #FF9774;
    --yellow: #FFD93D;
    --cream: #FFF9E3;
  }

  * { box-sizing: border-box; }

  html, body {
    margin: 0;
    padding: 0;
    min-height: 100vh;
    font-family: 'Nunito', system-ui, sans-serif;
    color: var(--ink);
    background: var(--butter);
    background-image: radial-gradient(circle, var(--butter-dot) 1.6px, transparent 1.8px);
    background-size: 26px 26px;
    overflow-x: hidden;
  }

  body {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2rem 1rem 3rem;
  }

  .scene {
    position: relative;
    width: 100%;
    max-width: 600px;
    padding: 1rem 0.5rem;
    text-align: center;
  }

  /* ---------- floating doodles ---------- */
  .doodle {
    position: absolute;
    font-family: 'Lilita One', sans-serif;
    pointer-events: none;
    user-select: none;
  }
  .doodle.star { color: var(--pink); }
  .doodle.heart { color: var(--coral); }
  .doodle.plus { color: var(--sky); }
  .doodle.dot  { color: var(--lav); }

  .d1 { top: 2%;  left: -2%;  font-size: 32px; animation: float 4s ease-in-out infinite; }
  .d2 { top: 6%;  right: 3%;  font-size: 28px; animation: float 5s ease-in-out infinite 0.6s; }
  .d3 { top: 42%; left: -4%;  font-size: 36px; animation: spin 9s linear infinite; }
  .d4 { top: 48%; right: -2%; font-size: 26px; animation: float 4.5s ease-in-out infinite 1s; }
  .d5 { bottom: 16%; left: 6%; font-size: 22px; animation: float 3.5s ease-in-out infinite 0.3s; }
  .d6 { bottom: 6%; right: 8%; font-size: 30px; animation: spin 7s linear infinite reverse; }
  .d7 { top: 28%; left: 4%;  font-size: 20px; animation: float 4s ease-in-out infinite 0.9s; }
  .d8 { top: 32%; right: 6%; font-size: 18px; animation: float 4.8s ease-in-out infinite 0.2s; }

  @keyframes float {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-8px); }
  }
  @keyframes spin {
    from { transform: rotate(0deg); }
    to   { transform: rotate(360deg); }
  }

  /* ---------- title ---------- */
  .title {
    margin-bottom: 1.25rem;
    position: relative;
    z-index: 3;
  }
  .title .display {
    font-family: 'Lilita One', sans-serif;
    font-size: clamp(36px, 8vw, 58px);
    line-height: 0.95;
    color: var(--pink);
    -webkit-text-stroke: 3px var(--ink);
    paint-order: stroke fill;
    text-shadow: 5px 5px 0 var(--ink);
    transform: rotate(-2deg);
    display: inline-block;
    letter-spacing: 0.5px;
  }
  .title .bang {
    color: var(--yellow);
    display: inline-block;
    transform: rotate(8deg) translateY(-4px);
  }
  .title .sub {
    font-family: 'Patrick Hand', cursive;
    font-size: clamp(17px, 3.5vw, 22px);
    color: var(--ink);
    margin-top: 0.85rem;
    transform: rotate(1.5deg);
    display: inline-block;
    background: var(--cream);
    padding: 4px 14px;
    border: 2.5px solid var(--ink);
    border-radius: 999px;
    box-shadow: 3px 3px 0 var(--ink);
  }

  /* ---------- speech bubble ---------- */
  .bubble-wrap {
    position: relative;
    margin: 1rem auto 1.5rem;
    max-width: 460px;
  }
  .bubble {
    background: #fff;
    border: 3.5px solid var(--ink);
    border-radius: 26px;
    padding: 1.4rem 1.6rem;
    min-height: 110px;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 7px 7px 0 var(--ink);
    position: relative;
    text-align: left;
  }
  .bubble::after {
    content: '';
    position: absolute;
    bottom: -20px;
    left: 50%;
    width: 28px;
    height: 28px;
    background: #fff;
    border-right: 3.5px solid var(--ink);
    border-bottom: 3.5px solid var(--ink);
    transform: translateX(-50%) rotate(45deg);
    box-shadow: 4px 4px 0 var(--ink);
  }
  .bubble::before {
    content: '';
    position: absolute;
    bottom: -3.5px;
    left: 50%;
    width: 30px;
    height: 6px;
    background: #fff;
    transform: translateX(-50%);
    z-index: 1;
  }

  .compliment-text {
    font-family: 'Patrick Hand', cursive;
    font-size: 22px;
    line-height: 1.35;
    color: var(--ink);
    width: 100%;
    min-height: 1.35em;
  }
  .compliment-text.placeholder {
    text-align: center;
    color: #5a5a5a;
  }
  .caret {
    display: inline-block;
    width: 3px;
    height: 1em;
    background: var(--pink-deep);
    vertical-align: -3px;
    margin-left: 2px;
    animation: blink 0.85s step-end infinite;
  }
  .caret.hidden { display: none; }
  @keyframes blink { 50% { opacity: 0; } }

  /* ---------- frenchie character ---------- */
  .char-row {
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0.5rem 0 1.75rem;
    position: relative;
  }
  .frenchie {
    position: relative;
    width: 190px;
    height: 215px;
    animation: bob 3.2s ease-in-out infinite;
  }
  .frenchie.thinking { animation: wobble 0.55s ease-in-out infinite; }

  @keyframes bob {
    0%, 100% { transform: translateY(0) rotate(-1deg); }
    50%      { transform: translateY(-6px) rotate(1deg); }
  }
  @keyframes wobble {
    0%, 100% { transform: rotate(-4deg); }
    50%      { transform: rotate(4deg); }
  }

  /* ears — frenchie "bat ears" */
  .ear {
    position: absolute;
    top: -8px;
    width: 50px;
    height: 72px;
    background: var(--fawn);
    border: 3.5px solid var(--ink);
    border-radius: 50% 50% 30% 30% / 65% 65% 30% 30%;
    box-shadow: 5px 5px 0 var(--ink);
    z-index: 1;
    overflow: hidden;
  }
  .ear.left  { left: 14px;  transform: rotate(-16deg); }
  .ear.right { right: 14px; transform: rotate(16deg); }

  .ear-inner {
    position: absolute;
    inset: 10px 9px 18px 9px;
    background: var(--ear-pink);
    border-radius: 50% 50% 25% 25% / 65% 65% 25% 25%;
  }

  /* head — wide, flat-faced */
  .head {
    position: absolute;
    top: 48px;
    left: 0;
    width: 190px;
    height: 160px;
    background: var(--fawn);
    border: 3.5px solid var(--ink);
    border-radius: 42% 42% 46% 46% / 40% 40% 44% 44%;
    box-shadow: 7px 7px 0 var(--ink);
    z-index: 2;
  }

  /* forehead wrinkle */
  .wrinkle {
    position: absolute;
    top: 22px;
    left: 50%;
    transform: translateX(-50%);
    width: 26px;
    height: 10px;
    border-top: 2.5px solid var(--fawn-deep);
    border-radius: 50%;
    opacity: 0.85;
  }

  /* googly eyes */
  .eye {
    position: absolute;
    top: 38px;
    width: 46px;
    height: 50px;
    background: #fff;
    border: 3px solid var(--ink);
    border-radius: 50%;
    overflow: hidden;
    z-index: 3;
  }
  .eye.left  { left: 22px; }
  .eye.right { right: 22px; }

  .pupil-holder {
    position: absolute;
    top: 11px;
    left: 11px;
    width: 22px;
    height: 22px;
    transition: transform 0.25s ease;
  }
  .pupil {
    width: 100%;
    height: 100%;
    background: var(--ink);
    border-radius: 50%;
    animation: googly 3.4s ease-in-out infinite;
  }
  @keyframes googly {
    0%, 100% { transform: translate(0, 0); }
    20%      { transform: translate(2px, -1px); }
    45%      { transform: translate(-2px, 1px); }
    70%      { transform: translate(1px, 2px); }
  }

  .frenchie.blink .eye::after {
    content: '';
    position: absolute;
    inset: 0;
    background: var(--fawn);
    animation: blinkLid 0.2s ease;
    z-index: 4;
  }
  @keyframes blinkLid {
    0%   { transform: scaleY(0); }
    50%  { transform: scaleY(1); }
    100% { transform: scaleY(0); }
  }

  .cheek {
    position: absolute;
    top: 94px;
    width: 18px;
    height: 11px;
    background: var(--coral);
    border-radius: 50%;
    opacity: 0.75;
    z-index: 3;
  }
  .cheek.left  { left: 6px; }
  .cheek.right { right: 6px; }

  /* muzzle — lighter oval covering the lower face */
  .muzzle {
    position: absolute;
    bottom: 6px;
    left: 50%;
    transform: translateX(-50%);
    width: 120px;
    height: 68px;
    background: var(--muzzle);
    border: 3px solid var(--ink);
    border-radius: 50%;
    z-index: 3;
  }

  .nose {
    position: absolute;
    top: 4px;
    left: 50%;
    transform: translateX(-50%);
    width: 30px;
    height: 20px;
    background: var(--ink);
    border-radius: 50% 50% 45% 45%;
  }
  .nose::after {
    /* little nose highlight */
    content: '';
    position: absolute;
    top: 3px;
    left: 6px;
    width: 5px;
    height: 4px;
    background: #fff;
    border-radius: 50%;
    opacity: 0.55;
  }

  .smile {
    position: absolute;
    top: 22px;
    left: 50%;
    transform: translateX(-50%);
    width: 82px;
    height: 26px;
    pointer-events: none;
    overflow: visible;
    z-index: 3;
  }
  .smile path {
    stroke: var(--ink);
    stroke-width: 3;
    fill: none;
    stroke-linecap: round;
    stroke-linejoin: round;
    transition: d 0.25s ease;
  }

  .tongue {
    position: absolute;
    top: 34px;
    left: 50%;
    transform: translateX(-50%);
    width: 18px;
    height: 20px;
    background: var(--pink-deep);
    border: 3px solid var(--ink);
    border-radius: 50% 50% 45% 45%;
    transition: all 0.25s ease;
    z-index: 4;
  }
  .tongue::after {
    /* center crease */
    content: '';
    position: absolute;
    top: 2px;
    left: 50%;
    transform: translateX(-50%);
    width: 2px;
    height: 8px;
    background: rgba(0,0,0,0.25);
    border-radius: 1px;
  }
  .frenchie.thinking .tongue {
    height: 26px;
    top: 36px;
  }

  .counter-badge {
    position: absolute;
    top: 44px;
    right: -30px;
    background: var(--sky);
    color: var(--ink);
    font-family: 'Lilita One', sans-serif;
    font-size: 12px;
    padding: 7px 11px;
    border: 3px solid var(--ink);
    border-radius: 14px;
    box-shadow: 4px 4px 0 var(--ink);
    transform: rotate(8deg);
    letter-spacing: 0.04em;
    line-height: 1;
    z-index: 5;
  }
  .counter-badge .big {
    font-size: 20px;
    display: block;
    line-height: 1;
    margin-top: 3px;
  }

  /* ---------- button ---------- */
  .controls {
    display: flex;
    justify-content: center;
    margin-top: 0.5rem;
  }
  button.big {
    font-family: 'Lilita One', sans-serif;
    background: var(--pink);
    color: #fff;
    border: 3.5px solid var(--ink);
    padding: 16px 32px;
    font-size: 20px;
    letter-spacing: 0.04em;
    cursor: pointer;
    border-radius: 18px;
    box-shadow: 6px 6px 0 var(--ink);
    transition: transform 90ms ease, box-shadow 90ms ease, background 150ms;
    text-transform: uppercase;
    -webkit-text-stroke: 1.5px var(--ink);
    paint-order: stroke fill;
  }
  button.big:hover {
    background: var(--yellow);
    color: var(--ink);
    transform: translate(-2px, -2px);
    box-shadow: 8px 8px 0 var(--ink);
  }
  button.big:active {
    transform: translate(6px, 6px);
    box-shadow: 0 0 0 var(--ink);
  }
  button.big:disabled {
    cursor: wait;
    opacity: 0.85;
    transform: translate(2px, 2px);
    box-shadow: 4px 4px 0 var(--ink);
  }

  /* ---------- footer ---------- */
  .footer {
    margin-top: 2rem;
    font-family: 'Patrick Hand', cursive;
    font-size: 16px;
    color: var(--ink);
    opacity: 0.75;
  }
  .footer .dot { color: var(--pink); padding: 0 8px; font-weight: 700; }

  .sr-only {
    position: absolute;
    width: 1px; height: 1px;
    padding: 0; margin: -1px;
    overflow: hidden;
    clip: rect(0,0,0,0);
    white-space: nowrap;
    border: 0;
  }

  @media (max-width: 480px) {
    .bubble { padding: 1.1rem 1.2rem; min-height: 100px; }
    .compliment-text { font-size: 19px; }
    .frenchie { width: 160px; height: 185px; }
    .head { width: 160px; height: 140px; top: 42px; }
    .ear { width: 44px; height: 62px; }
    .ear.left { left: 10px; } .ear.right { right: 10px; }
    .eye { top: 32px; width: 40px; height: 44px; }
    .eye.left { left: 18px; } .eye.right { right: 18px; }
    .pupil-holder { top: 10px; left: 10px; width: 20px; height: 20px; }
    .cheek { top: 82px; }
    .cheek.left { left: 4px; } .cheek.right { right: 4px; }
    .muzzle { width: 105px; height: 60px; }
    .nose { width: 26px; height: 17px; }
    .smile { top: 18px; width: 72px; height: 22px; }
    .tongue { top: 30px; width: 16px; height: 18px; }
    .counter-badge { right: -12px; font-size: 11px; top: 38px; }
    .counter-badge .big { font-size: 17px; }
    button.big { padding: 14px 24px; font-size: 17px; }
    .d1, .d2 { display: none; }
  }

  @media (prefers-reduced-motion: reduce) {
    .frenchie, .doodle, .caret, .pupil { animation: none !important; }
  }