:root {
  --paper: #f4efe4;
  --card: #fffdf7;
  --ink: #111111;
  --muted: #6b665c;
  --blue: #2f3fd1;
  --orange: #ff5a1f;
  --yellow: #ffcf26;
  --green: #1f9d55;
  --red: #d7263d;
  --line: 2.5px solid var(--ink);
  --shadow: 6px 6px 0 var(--ink);
  --display: 'Archivo', system-ui, sans-serif;
  --mono: 'Space Mono', ui-monospace, monospace;
  color-scheme: light;
}
[data-theme="dark"] {
  --paper: #121212;
  --card: #1c1c1c;
  --ink: #f4efe4;
  --muted: #a39e93;
  --blue: #6f7dff;
  --orange: #ff6d35;
  --yellow: #ffcf26;
  --green: #3ccf7e;
  --red: #ff6b7d;
  color-scheme: dark;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }

html, body { margin: 0; }
body {
  transition: background .25s, color .25s;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--display);
  font-size: 16px;
  -webkit-font-smoothing: antialiased;
}

/* ---------- Top bar ---------- */
.topbar {
  display: flex; align-items: center; justify-content: space-between;
  padding: 18px clamp(20px, 5vw, 56px);
  border-bottom: var(--line);
}
.brand {
  display: inline-flex; align-items: center; gap: 10px;
  color: var(--ink); text-decoration: none;
  font-weight: 900; font-stretch: 125%; text-transform: uppercase; letter-spacing: .02em; font-size: 15px;
}
.brand-bar { opacity: .45; margin: 0 .15em; }
.brand svg { flex: none; }
@media (max-width: 640px) {
  .topbar { gap: 12px; }
  .brand { font-size: 11px; line-height: 1.25; gap: 8px; min-width: 0; }
  .top-right { gap: 12px; flex: none; }
  .brand-bar { display: none; }
  .brand-text { display: flex; flex-direction: column; }
  .topbar { padding-left: 16px; padding-right: 16px; }
  .brand { font-size: 10.5px; }
  .user { flex-direction: column; align-items: flex-end; gap: 2px; font-size: 12px; }
  .user .link { font-size: 12px; }
  .theme-toggle { width: 34px; height: 34px; }
  .theme-toggle svg { width: 17px; height: 17px; }
}
.top-right { display: flex; align-items: center; gap: 18px; }
.theme-toggle {
  display: grid; place-items: center; width: 40px; height: 40px; padding: 0;
  border: var(--line); border-radius: 50%; background: var(--card);
  box-shadow: 3px 3px 0 var(--ink);
}
.theme-toggle:hover { transform: translate(-1px, -1px); box-shadow: 4px 4px 0 var(--ink); }
.theme-toggle:active { transform: translate(3px, 3px); box-shadow: 0 0 0 var(--ink); }
.theme-toggle svg { width: 20px; height: 20px; fill: none; stroke: var(--ink); stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round; }
.theme-toggle .i-moon { fill: var(--ink); }
.theme-toggle .i-sun { display: none; }
[data-theme="dark"] .theme-toggle .i-sun { display: block; }
[data-theme="dark"] .theme-toggle .i-moon { display: none; }
.user { display: flex; align-items: center; gap: 18px; font-size: 14px; font-weight: 600; }

main {
  flex: 1;
  width: 100%;
  max-width: 980px;
  margin: 0 auto;
  padding: clamp(28px, 7vh, 80px) clamp(20px, 5vw, 40px);
}

/* ---------- Type ---------- */
.eyebrow {
  margin: 0 0 18px;
  font-family: var(--mono); font-size: 12px; letter-spacing: .08em; text-transform: uppercase;
}
h1 {
  margin: 0 0 24px;
  font-weight: 900; font-stretch: 125%;
  font-size: clamp(64px, 13vw, 148px);
  line-height: .86; letter-spacing: -.03em; text-transform: uppercase;
}
.q { color: var(--orange); }
.lede { font-size: 18px; line-height: 1.55; max-width: 520px; margin: 0 0 32px; }
.fine { font-size: 13px; line-height: 1.55; color: var(--muted); margin: 18px 0 0; }
code { white-space: nowrap; font-family: var(--mono); font-size: .9em; background: var(--paper); border: 1.5px solid var(--ink); padding: 1px 6px; border-radius: 4px; color: var(--ink); }
.error { color: var(--red); font-weight: 600; font-size: 14px; margin: 16px 0 0; }

/* ---------- Hero, question, sign-in ---------- */
.hero { position: relative; }
.hero h1 { margin-bottom: 32px; }
.question { margin: 0 0 24px; }
.question p { margin: 0; font-size: clamp(19px, 2.4vw, 24px); line-height: 1.45; font-weight: 600; }
.signin { margin-top: 24px; }
.signin-text { margin: 0 0 22px; font-size: 17px; line-height: 1.5; }
.signin-row { display: flex; align-items: center; gap: 28px; flex-wrap: wrap; }
.gsi { min-height: 44px; }

/* Comic speech bubble pointing left at the button */
.bubble {
  position: relative;
  max-width: 300px;
  padding: 12px 16px;
  background: var(--yellow);
  color: #111;
  border: var(--line);
  border-radius: 18px;
  box-shadow: 4px 4px 0 var(--ink);
  font-size: 14px; line-height: 1.4;
  transform: rotate(-2deg);
  animation: wiggle 4s ease-in-out infinite;
}
.bubble strong { font-weight: 900; font-stretch: 125%; text-transform: uppercase; margin-right: 4px; }
.bubble::before, .bubble::after {
  content: ''; position: absolute; top: 50%; width: 0; height: 0;
  border-style: solid; transform: translateY(-50%);
}
.bubble::before { left: -16px; border-width: 10px 16px 10px 0; border-color: transparent var(--ink) transparent transparent; }
.bubble::after  { left: -11px; border-width: 7px 12px 7px 0;  border-color: transparent var(--yellow) transparent transparent; }
@keyframes wiggle { 0%, 88%, 100% { transform: rotate(-2deg); } 92% { transform: rotate(1deg); } 96% { transform: rotate(-3deg); } }
@media (max-width: 640px) {
  .signin-row { flex-direction: column-reverse; align-items: flex-start; gap: 22px; }
  .bubble::before { left: 28px; top: auto; bottom: -16px; transform: none; border-width: 16px 10px 0 10px; border-color: var(--ink) transparent transparent transparent; }
  .bubble::after  { left: 31px; top: auto; bottom: -11px; transform: none; border-width: 12px 7px 0 7px;  border-color: var(--yellow) transparent transparent transparent; }
}

.shapes { position: absolute; inset: 0; pointer-events: none; }
.s { position: absolute; }
.s-circle { width: clamp(80px, 12vw, 130px); top: -10px; right: 0; animation: bob 6s ease-in-out infinite; }
.s-half   { width: clamp(70px, 9vw, 100px); top: 58%; right: 18%; animation: rock 7s ease-in-out infinite; transform-origin: 50% 100%; }
.s-zig    { width: clamp(120px, 18vw, 200px); bottom: -40px; right: 18%; animation: slide 5s ease-in-out infinite alternate; }
@keyframes bob   { 50% { transform: translateY(-14px); } }
@keyframes rock  { 50% { transform: rotate(-12deg); } }
@keyframes slide { to { transform: translateX(-24px); } }
@media (max-width: 720px) { .s-half { display: none; } .s-circle { width: 70px; top: -20px; } }

/* ---------- Boxes ---------- */
.box {
  position: relative;
  background: var(--card);
  border: var(--line);
  border-radius: 14px;
  box-shadow: var(--shadow);
  padding: clamp(20px, 3.4vw, 32px);
}
.box-head {
  display: flex; justify-content: space-between; align-items: center; gap: 12px;
  font-family: var(--mono); font-size: 12px; text-transform: uppercase; letter-spacing: .08em;
  padding-bottom: 14px; margin-bottom: 18px;
  border-bottom: 1.5px dashed var(--ink);
}
.box-foot { font-family: var(--mono); font-size: 12px; color: var(--muted); margin-top: 10px; }

.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 24px; margin-top: 24px; }
.grid2[hidden] { display: none !important; }
@media (max-width: 720px) { .grid2 { grid-template-columns: 1fr; } }

/* ---------- Counter ---------- */
.counter { overflow: hidden; }
.count-line { position: relative; z-index: 1; margin: 0; display: flex; align-items: baseline; flex-wrap: wrap; gap: 6px 22px; }
.count-label { font-size: clamp(20px, 2.8vw, 30px); font-weight: 800; font-stretch: 112%; line-height: 1.15; max-width: 440px; }
.count {
  font-weight: 900; font-stretch: 125%;
  font-size: clamp(88px, 18vw, 180px);
  line-height: .9; letter-spacing: -.04em;
  font-variant-numeric: tabular-nums;
  color: var(--blue);
}
.count.bump { animation: bump .4s ease; }
@keyframes bump { 40% { transform: translateY(-6px); } }
.deco {
  position: absolute; width: clamp(110px, 18vw, 180px);
  right: -36px; bottom: -36px;
  animation: spin 24s linear infinite;
}
@keyframes spin { 50% { transform: translateY(-10px) scale(1.04); } }

.live { display: inline-flex; align-items: center; gap: 8px; color: var(--green); font-weight: 700; }
.live i { width: 9px; height: 9px; border-radius: 50%; background: var(--green); border: 1.5px solid var(--ink); animation: blink 1.4s steps(2, start) infinite; }
@keyframes blink { to { visibility: hidden; } }

/* ---------- Status ---------- */
.status-text { font-size: 26px; font-weight: 800; font-stretch: 112%; letter-spacing: -.01em; margin: 0 0 20px; }
.ok { display: inline-grid; place-items: center; width: 30px; height: 30px; margin-right: 8px; border-radius: 50%; background: var(--green); color: #fff; border: 2px solid var(--ink); font-size: 16px; vertical-align: 3px; }

button {
  font: inherit; font-weight: 800; font-size: 15px; letter-spacing: .01em;
  cursor: pointer; color: var(--ink);
  transition: transform .12s ease, box-shadow .12s ease, background .15s;
}
button:disabled { opacity: .45; cursor: not-allowed; }
button:focus-visible { outline: 3px solid var(--blue); outline-offset: 3px; }
.primary, .ghost {
  padding: 13px 22px;
  border: var(--line); border-radius: 999px;
  box-shadow: 4px 4px 0 var(--ink);
}
.primary { background: var(--orange); color: #111; }
.ghost { background: var(--card); }
.primary:not(:disabled):hover, .ghost:not(:disabled):hover { transform: translate(-1px, -1px); box-shadow: 5px 5px 0 var(--ink); }
.primary:not(:disabled):active, .ghost:not(:disabled):active { transform: translate(4px, 4px); box-shadow: 0 0 0 var(--ink); }
.link { background: none; border: 0; padding: 0; text-decoration: underline; text-underline-offset: 3px; font-weight: 700; }

/* ---------- Countdown ---------- */
.clock { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; }
.clock div { border: var(--line); border-radius: 10px; padding: 12px 4px 10px; text-align: center; background: var(--paper); }
.clock div:first-child { background: var(--yellow); }
.clock span { display: block; font-weight: 900; font-stretch: 125%; font-size: clamp(26px, 4vw, 36px); line-height: 1; font-variant-numeric: tabular-nums; }
.clock small { font-family: var(--mono); font-size: 11px; text-transform: uppercase; }

/* ---------- Banner + footer ---------- */
.banner {
  border-top: var(--line); border-bottom: var(--line);
  background: var(--ink); color: var(--paper);
  text-align: center; padding: 12px 16px;
  font-weight: 800; font-stretch: 125%; text-transform: uppercase; font-size: 14px; letter-spacing: .04em;
}
footer { text-align: center; font-family: var(--mono); color: var(--muted); font-size: 11px; padding: 18px 16px 24px; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; }
}
footer a { color: inherit; }
.box p { line-height: 1.6; }
.clock div:first-child { color: #111; }
@media (max-width: 640px) { .question .box-head { flex-direction: column; align-items: flex-start; gap: 4px; } }

/* ---------- Warning under the counter ---------- */
.warning {
  display: flex; gap: 14px; align-items: flex-start;
  margin-top: 16px; padding: 16px 20px;
  background: var(--orange); color: #111;
  border: var(--line); border-radius: 14px; box-shadow: 4px 4px 0 var(--ink);
}
.warning p { margin: 0; font-size: 15px; line-height: 1.5; }
.warning strong { font-weight: 900; }
.warning-icon {
  flex: none; display: grid; place-items: center;
  width: 28px; height: 28px; border-radius: 50%;
  background: #111; color: var(--orange);
  font-weight: 900; font-size: 17px; line-height: 1;
}

/* ---------- Telegram links ---------- */
.bot-link {
  display: inline-flex; align-items: center; gap: 8px;
  margin-top: 18px; color: var(--blue); font-weight: 800; text-decoration: none;
  border-bottom: 2px solid currentColor; padding-bottom: 2px;
}
.bot-link:hover { color: var(--orange); }
.bot-link svg, .bot-btn svg { width: 18px; height: 18px; fill: currentColor; }
.bubble a { color: inherit; font-weight: 700; }

/* ---------- Tracking stopped ---------- */
.stopped { margin-top: 24px; }
.stopped-title { font-size: clamp(22px, 3vw, 28px); font-weight: 900; font-stretch: 112%; margin: 0 0 12px; }
.stopped p { margin: 0 0 12px; font-size: 16px; }
.bot-btn {
  display: inline-flex; align-items: center; gap: 10px; margin-top: 8px;
  text-decoration: none; font-weight: 800; font-size: 15px;
}

/* ---------- Disclaimer footer ---------- */
footer { max-width: 760px; margin: 0 auto; line-height: 1.6; }
footer p { margin: 0 0 8px; }
footer strong { color: var(--ink); }

/* ---------- Hero illustration: people building it together ---------- */
:root { --grid: #e6dfd1; }
[data-theme="dark"] { --grid: #2f2f2f; }
.hero { display: grid; grid-template-columns: 1fr minmax(240px, 430px); column-gap: 16px; align-items: end; }
.hero > .eyebrow, .hero > h1 { grid-column: 1; }
.hero-art { grid-column: 2; grid-row: 1 / span 2; align-self: end; margin-bottom: 30px; margin-right: -20px; }
.crew { width: 100%; height: auto; display: block; overflow: visible; }
.crew .wave { transform-origin: 312px 158px; animation: wave 2.6s ease-in-out infinite; }
.crew .bob { animation: bobsm 3.2s ease-in-out infinite; }
.crew .twinkle { transform-box: fill-box; transform-origin: center; animation: twinkle 2.4s ease-in-out infinite; }
.crew .t2 { animation-delay: .8s; } .crew .t3 { animation-delay: 1.5s; }
@keyframes wave { 0%, 60%, 100% { transform: rotate(0); } 70% { transform: rotate(14deg); } 80% { transform: rotate(-6deg); } 90% { transform: rotate(10deg); } }
@keyframes bobsm { 50% { transform: translateY(-4px); } }
@keyframes twinkle { 50% { transform: scale(.6) rotate(20deg); opacity: .6; } }
@media (max-width: 720px) {
  .hero { grid-template-columns: 1fr; }
  .hero-art { grid-column: 1; grid-row: auto; max-width: 300px; margin: 0 0 18px; }
}

/* Cheering person peeking into the counter */
.deco.cheer { width: clamp(90px, 13vw, 120px); right: 12px; bottom: -14px; animation: none; }
.cheer .cheer-arms { transform-origin: 60px 90px; animation: cheer 1.8s ease-in-out infinite; }
@keyframes cheer { 50% { transform: translateY(-5px) scaleY(1.04); } }
.count-line { padding-right: 110px; }
@media (max-width: 640px) { .count-line { padding-right: 70px; } }

/* ---------- Spread the word ---------- */
.share, .chart-box { margin-top: 24px; }
.section-title { margin: 0 0 12px; font-size: clamp(26px, 4vw, 38px); font-weight: 900; font-stretch: 125%; letter-spacing: -.02em; text-transform: uppercase; line-height: 1; }
.share p { margin: 0 0 10px; font-size: 16px; line-height: 1.55; max-width: 640px; }
.share-row { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 18px; }
.share-btn { display: inline-flex; align-items: center; text-decoration: none; color: var(--ink); font-weight: 800; font-size: 15px; }
.share-status { min-height: 1.5em; margin-top: 12px; color: var(--green); font-weight: 700; }

/* ---------- Count-over-time chart ---------- */
.chart-summary { margin: 0 0 16px; font-size: 16px; line-height: 1.5; }
.chart { position: relative; width: 100%; outline: none; border-radius: 8px; touch-action: pan-y; }
.chart:focus-visible { outline: 3px solid var(--blue); outline-offset: 4px; }
.chart svg { display: block; width: 100%; height: auto; }
.c-grid { stroke: var(--grid); stroke-width: 1; }
.c-base { stroke: var(--muted); stroke-width: 1; }
.c-label { fill: var(--muted); font-family: var(--mono); font-size: 11px; }
.c-bar { fill: var(--blue); }
.c-hatch-bg { fill: var(--card); }
.c-hatch-line { stroke: var(--blue); stroke-width: 3; }
.c-bar.c-bar-now { fill: url(#c-hatch); stroke: var(--blue); stroke-width: 1.5; }
.c-day { stroke: var(--grid); stroke-width: 1; stroke-dasharray: 3 3; }
.c-hl { fill: var(--ink); opacity: .06; }
.c-area { fill: var(--blue); opacity: .12; }
.c-line { fill: none; stroke: var(--blue); stroke-width: 2.5; stroke-linejoin: round; stroke-linecap: round; }
.c-dot { fill: var(--blue); stroke: var(--card); stroke-width: 2; }
.c-end { fill: var(--ink); font-weight: 900; font-stretch: 125%; font-size: 16px; }
.c-hair { stroke: var(--ink); stroke-width: 1; opacity: .5; }
.c-tip {
  position: absolute; pointer-events: none; z-index: 2;
  background: var(--card); color: var(--ink);
  border: var(--line); border-radius: 10px; box-shadow: 3px 3px 0 var(--ink);
  padding: 8px 12px; white-space: nowrap; font-size: 13px; line-height: 1.35;
}
.c-tip strong { display: block; font-size: 15px; font-weight: 900; }
.c-tip span { font-family: var(--mono); font-size: 11px; color: var(--muted); }
.tod-title { margin: 22px 0 10px; font-size: 15px; font-weight: 900; font-stretch: 112%; }
.tod-title:has(+ .tod[hidden]) { display: none; }
.tod { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.tod li { display: grid; grid-template-columns: 7.5em 10em 1fr 10em; align-items: center; gap: 12px; font-size: 14px; }
.tod-name { font-weight: 800; }
.tod-range { font-family: var(--mono); font-size: 12px; color: var(--muted); }
.tod-bar { height: 10px; border-radius: 6px; background: var(--grid); overflow: hidden; }
.tod-bar span { display: block; height: 100%; background: var(--blue); border-radius: 6px; }
.tod-val { text-align: right; font-variant-numeric: tabular-nums; color: var(--muted); }
.tod-val strong { color: var(--ink); }
.tod li.top .tod-name::after { content: ' ★'; color: var(--orange); }
@media (max-width: 640px) {
  .tod li { grid-template-columns: 1fr auto; row-gap: 4px; }
  .tod-range { grid-column: 1; grid-row: 2; }
  .tod-bar { grid-column: 1 / -1; grid-row: 3; }
  .tod-val { grid-column: 2; grid-row: 1; }
}
.chart-table { margin-top: 18px; font-size: 14px; }
.chart-table summary { cursor: pointer; font-weight: 700; text-decoration: underline; text-underline-offset: 3px; }
.chart-table table { margin-top: 12px; border-collapse: collapse; width: 100%; max-width: 420px; }
.chart-table th, .chart-table td { text-align: left; padding: 6px 10px; border-bottom: 1px solid var(--grid); }
.chart-table td:last-child, .chart-table th:last-child { text-align: right; font-variant-numeric: tabular-nums; }
.chart-table tbody { display: block; max-height: 260px; overflow-y: auto; }
.chart-table thead, .chart-table tbody tr { display: table; width: 100%; table-layout: fixed; }
.chart svg { overflow: visible; }

/* Detailed illustrations */
.crew .bolt { transform-box: fill-box; transform-origin: center; animation: zap 3s ease-in-out infinite; }
.crew .squig { animation: squig 2.8s ease-in-out infinite alternate; }
.crew .piece { transform-box: fill-box; transform-origin: center; animation: nudge 4s ease-in-out infinite; }
@keyframes zap { 0%, 80%, 100% { transform: rotate(0); } 85% { transform: rotate(-8deg) scale(1.06); } 92% { transform: rotate(5deg); } }
@keyframes squig { to { transform: translateX(-10px); } }
@keyframes nudge { 0%, 100% { transform: rotate(0); } 50% { transform: rotate(-1.5deg); } }
.cheer .cheer-arms { transform-origin: 70px 98px; }
.cheer .confetti { animation: bobsm 2.2s ease-in-out infinite; }
.deco.cheer { width: clamp(100px, 14vw, 132px); bottom: -22px; right: 8px; }
@media (max-width: 720px) { .hero-art { max-width: 360px; } }
@media (min-width: 721px) {
  .hero { grid-template-columns: auto minmax(280px, 1fr); column-gap: 8px; }
  .hero h1 { font-size: clamp(64px, 10vw, 122px); }
  .hero-art { margin-right: -36px; margin-bottom: 26px; }
}
.hero > .eyebrow { align-self: end; }

/* ---------- Headline wordplay ---------- */
.w-guess { color: var(--orange); }
.w-guessers { color: var(--blue); }
.hero h1 { margin-bottom: 18px; }
@media (min-width: 721px) { .hero h1 { font-size: clamp(56px, 8.6vw, 104px); } }
@media (max-width: 720px) { .hero h1 { font-size: clamp(40px, 11.5vw, 72px); } }
.hero > .wordplay { grid-column: 1; }
.wordplay { display: flex; flex-wrap: wrap; gap: 10px 22px; margin: 0 0 32px; font-size: 15px; font-weight: 600; }
.key { display: inline-flex; align-items: center; gap: 8px; }
.tag {
  display: inline-block; padding: 3px 10px; border: var(--line); border-radius: 999px;
  box-shadow: 2px 2px 0 var(--ink);
  font-weight: 900; font-stretch: 125%; text-transform: uppercase; font-size: 13px; letter-spacing: .02em; color: #111;
}
.tag-guess { background: var(--orange); }
.tag-guessers { background: var(--blue); color: #fff; }
.hero-art { grid-row: 1 / span 3; }
.tag-split { background: var(--card); }
.tag-split .w-guess { color: var(--orange); }
.tag-split .w-guessers { color: var(--blue); }
.c-pt { fill: var(--blue); stroke: var(--card); stroke-width: 2; }

/* ---------- Carlos the site doggo ---------- */
.doggo-backdrop {
  position: fixed; inset: 0; z-index: 50;
  display: grid; place-items: center; padding: 20px;
  background: rgba(17, 17, 17, .45);
  animation: fadein .2s ease;
}
.doggo-backdrop[hidden] { display: none !important; }
.doggo-backdrop { grid-template-columns: minmax(0, 1fr); overflow-y: auto; }
.doggo-card { width: min(440px, 100%); min-width: 0; justify-self: center; text-align: center; animation: popin .35s cubic-bezier(.2, 1.4, .4, 1); }
.doggo-stage { position: relative; cursor: pointer; padding-top: 34px; }
.carlos { width: 100%; max-width: 340px; height: auto; overflow: visible; }
.doggo-text { overflow-wrap: break-word; font-size: 19px; line-height: 1.45; margin: 10px 0 20px; }
.doggo-text strong { font-weight: 900; font-stretch: 112%; }

.yip {
  position: absolute; top: 0; right: 6%;
  padding: 6px 14px; border: var(--line); border-radius: 16px; box-shadow: 3px 3px 0 var(--ink);
  background: var(--yellow); color: #111;
  font-weight: 900; font-stretch: 125%; text-transform: uppercase; font-size: 18px;
  opacity: 0; transform: scale(.3) rotate(-10deg); transform-origin: bottom left;
}
.yip::after {
  content: ''; position: absolute; left: 14px; bottom: -12px;
  border-width: 12px 10px 0 0; border-style: solid; border-color: var(--ink) transparent transparent transparent;
}

.carlos .mouth-open { opacity: 0; }
.carlos .dog-tail { transform-box: view-box; transform-origin: 46px 70px; animation: wag .35s ease-in-out infinite alternate; }
.carlos .dog, .carlos .dog-head, .carlos .dog-ear { transform-box: view-box; }
.carlos .dog-head { transform-origin: 186px 60px; }
.carlos .dog-ear { transform-origin: 178px 32px; }
.carlos .dog { transform-origin: 120px 116px; }

/* The yip: hop twice, head tilts up, ear flops, mouth opens, bubble pops */
.doggo-backdrop.play .carlos .dog { animation: hop .9s ease-out 1; }
.doggo-backdrop.play .carlos .dog-head { animation: yiphead .9s ease-out 1; }
.doggo-backdrop.play .carlos .dog-ear { animation: flop .9s ease-out 1; }
.doggo-backdrop.play .carlos .mouth-open { animation: mouth .9s steps(1) 1; }
.doggo-backdrop.play .carlos .mouth-closed { animation: mouthc .9s steps(1) 1; }
.doggo-backdrop.play .carlos .dog-shadow { animation: shadow .9s ease-out 1; transform-box: fill-box; transform-origin: center; }
.doggo-backdrop.play .yip { animation: yip 1.6s ease-out 1 forwards; }

@keyframes wag { from { transform: rotate(-14deg); } to { transform: rotate(16deg); } }
@keyframes hop {
  0% { transform: translateY(0) scaleY(1); }
  10% { transform: translateY(0) scaleY(.92) scaleX(1.03); }
  25% { transform: translateY(-22px) scaleY(1.04); }
  40% { transform: translateY(0) scaleY(.95); }
  55% { transform: translateY(-12px); }
  70%, 100% { transform: translateY(0) scaleY(1); }
}
@keyframes yiphead { 0%, 100% { transform: rotate(0); } 20%, 60% { transform: rotate(-12deg); } }
@keyframes flop { 0%, 100% { transform: rotate(0); } 25% { transform: rotate(-38deg); } 45% { transform: rotate(10deg); } 60% { transform: rotate(-22deg); } }
@keyframes mouth { 0% { opacity: 0; } 15% { opacity: 1; } 45% { opacity: 0; } 55% { opacity: 1; } 75% { opacity: 0; } }
@keyframes mouthc { 0% { opacity: 1; } 15% { opacity: 0; } 45% { opacity: 1; } 55% { opacity: 0; } 75% { opacity: 1; } }
@keyframes shadow { 25% { transform: scaleX(.75); opacity: .08; } 55% { transform: scaleX(.88); } }
@keyframes yip {
  0% { opacity: 0; transform: scale(.3) rotate(-10deg); }
  12% { opacity: 1; transform: scale(1.15) rotate(4deg); }
  22% { transform: scale(1) rotate(-2deg); }
  80% { opacity: 1; transform: scale(1) rotate(-2deg); }
  100% { opacity: 0; transform: scale(.9) translateY(-6px); }
}
@keyframes fadein { from { opacity: 0; } }
@keyframes popin { from { opacity: 0; transform: scale(.85) translateY(10px); } }
@media (max-width: 400px) {
  .doggo-card { padding: 20px 16px; }
  .doggo-text { font-size: 17px; }
  .yip { font-size: 15px; padding: 5px 11px; }
}
@media (prefers-reduced-motion: reduce) { .yip { opacity: 1; transform: none; } }

/* ---------- Pettable Carlos in the counter ---------- */
.pat-wrap { position: absolute; right: 10px; bottom: 6px; z-index: 2; width: clamp(170px, 22vw, 230px); }
.count-line { padding-right: clamp(180px, 24vw, 250px); }
.pat-carlos { display: block; width: 100%; padding: 0; border: 0; background: none; cursor: pointer; border-radius: 16px; }
.pat-carlos:focus-visible { outline: 3px solid var(--blue); outline-offset: 2px; }
.carlos-mini { display: block; width: 100%; height: auto; overflow: visible; }
.carlos-mini .eye-happy, .carlos-mini .happy-mouth { opacity: 0; }
.carlos-mini .hearts path { opacity: 0; transform-box: fill-box; transform-origin: center; }
.carlos-mini .dog-tail { animation-duration: .5s; }

.pat-tip {
  position: absolute; right: 0; bottom: 100%; margin-bottom: 6px; width: 230px;
  padding: 10px 14px; background: var(--yellow); color: #111;
  border: var(--line); border-radius: 14px; box-shadow: 3px 3px 0 var(--ink);
  font-size: 14px; font-weight: 700; line-height: 1.35; text-align: left;
  opacity: 0; transform: translateY(8px) scale(.9); transform-origin: bottom right;
  transition: opacity .18s ease, transform .18s ease; pointer-events: none;
}
.pat-tip::after {
  content: ''; position: absolute; right: 60px; bottom: -12px;
  border-width: 12px 10px 0 0; border-style: solid; border-color: var(--ink) transparent transparent transparent;
}
.pat-wrap.patted .pat-tip, .pat-wrap:hover .pat-tip, .pat-carlos:focus-visible ~ .pat-tip { opacity: 1; transform: none; }
.pat-wrap .pat-tip { order: -1; }

/* Happy Carlos: squinty eyes, open smile with tongue, fast wag, head nuzzle, wiggle, hearts */
.pat-wrap.patted .eye-open, .pat-wrap:hover .eye-open { opacity: 0; }
.pat-wrap.patted .eye-happy, .pat-wrap:hover .eye-happy,
.pat-wrap.patted .happy-mouth, .pat-wrap:hover .happy-mouth { opacity: 1; }
.pat-wrap.patted .mouth-closed, .pat-wrap:hover .mouth-closed { opacity: 0; }
.pat-wrap.patted .dog-tail, .pat-wrap:hover .dog-tail { animation-duration: .14s; }
.pat-wrap.patted .dog-head, .pat-wrap:hover .dog-head { animation: nuzzle .5s ease-in-out infinite alternate; }
.pat-wrap.patted .dog-ear, .pat-wrap:hover .dog-ear { animation: earwiggle .5s ease-in-out infinite alternate; }
.pat-wrap.patted .dog, .pat-wrap:hover .dog { animation: wiggle .35s ease-in-out infinite alternate; }
.pat-wrap.patted .blush, .pat-wrap:hover .blush { opacity: .9; }
.pat-wrap.patted .hearts .h1, .pat-wrap:hover .hearts .h1 { animation: heart 1.4s ease-out infinite; }
.pat-wrap.patted .hearts .h2, .pat-wrap:hover .hearts .h2 { animation: heart 1.4s ease-out .35s infinite; }
.pat-wrap.patted .hearts .h3, .pat-wrap:hover .hearts .h3 { animation: heart 1.4s ease-out .7s infinite; }
@keyframes nuzzle { from { transform: rotate(-6deg); } to { transform: rotate(4deg); } }
@keyframes earwiggle { from { transform: rotate(-16deg); } to { transform: rotate(6deg); } }
@keyframes wiggle { from { transform: translate(0, 10px) rotate(-1deg); } to { transform: translate(0, 8px) rotate(1deg); } }
@keyframes heart { 0% { opacity: 0; transform: translateY(10px) scale(.5); } 25% { opacity: 1; transform: translateY(0) scale(1); } 100% { opacity: 0; transform: translateY(-22px) scale(.9); } }

@media (max-width: 640px) {
  .count-line { padding-right: 0; }
  /* On phones Carlos and his bubble share a row inside the card, so the bubble
     never covers the count text and never runs off the screen edge. */
  .pat-wrap {
    position: relative; right: auto; bottom: auto; width: 100%; margin: 18px 0 -8px;
    display: flex; align-items: flex-end; justify-content: flex-end; gap: 14px;
  }
  .pat-carlos { flex: none; width: clamp(130px, 48%, 180px); }
  .pat-tip {
    position: relative; right: auto; bottom: auto; margin: 0 0 16px; width: auto; max-width: 190px;
    flex: 0 1 auto; min-width: 0; font-size: 13px; padding: 8px 10px; transform-origin: bottom right;
  }
  .pat-tip::after {
    right: -12px; bottom: 14px; border-width: 0 0 10px 12px;
    border-color: transparent transparent transparent var(--ink);
  }
}
@media (max-width: 360px) { .pat-tip { font-size: 12px; padding: 7px 8px; } }

/* ---------- Hidden napping Carlos in the footer ---------- */
.nap-wrap { margin: 14px 0 0; }
.nap { position: relative; display: inline-block; color: var(--muted); opacity: .35; cursor: default; transition: opacity .2s; outline: none; }
.nap svg { width: 64px; height: auto; display: block; }
.nap:hover, .nap:focus-visible { opacity: 1; color: var(--ink); }
.nap .zzz text { animation: zz 2.4s ease-in-out infinite; }
.nap .zzz text:last-child { animation-delay: .6s; }
@keyframes zz { 0%, 100% { opacity: .2; transform: translateY(0); } 50% { opacity: 1; transform: translateY(-2px); } }
.nap-tip {
  position: absolute; left: calc(100% + 8px); top: 50%; transform: translate(-4px, -50%);
  white-space: nowrap; font-family: var(--mono); font-size: 11px; color: var(--ink);
  background: var(--card); border: 1.5px solid var(--ink); border-radius: 8px; padding: 3px 8px;
  opacity: 0; transition: opacity .2s, transform .2s; pointer-events: none;
}
.nap:hover .nap-tip, .nap:focus-visible .nap-tip { opacity: 1; transform: translate(0, -50%); }
@media (max-width: 640px) {
  /* On phones the nap tooltip sits above Carlos so it can't widen the page */
  .nap-tip { left: 50%; top: auto; bottom: calc(100% + 6px); transform: translate(-50%, 4px); }
  .nap:hover .nap-tip, .nap:focus-visible .nap-tip { transform: translate(-50%, 0); }
}
