/* Hunchy web: the app's bento cards (paper ground, even gaps, one corner radius). */
:root {
  --paper: #F1EADB;
  --ink: #161616;
  --red: #E2382B;
  --yellow: #F2B91F;
  --blue: #1F4FBF;
  --muted: #6B655A;
  --muted-dark: #4A453D;
  --on-dark: #B8B2A6;
  --on-blue: #DCE4FA;
  --line: 2.5px solid var(--ink);
  --hairline: rgba(22, 22, 22, 0.12);
  --radius: 18px;
  --inner: 10px;
  --gap: 8px;
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: "Archivo", system-ui, sans-serif;
  font-weight: 600;
  line-height: 1.35;
}

main {
  max-width: 480px;
  margin: 0 auto;
  padding: 10px 10px calc(20px + env(safe-area-inset-bottom));
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  gap: var(--gap);
}

/* Two columns of cards once there is room for them. */
.col { display: flex; flex-direction: column; gap: var(--gap); min-width: 0; }
.cols { display: flex; flex-direction: column; gap: var(--gap); }
@media (min-width: 760px) {
  main:has(> .cols) { max-width: 980px; }
  .cols { display: grid; grid-template-columns: 1fr 1fr; align-items: start; }
}

.loading { margin: 40vh auto 0; color: var(--muted); }

/* Type */
.poster {
  font-weight: 900;
  font-stretch: 62%;
  text-transform: uppercase;
  line-height: 0.9;
  letter-spacing: -0.5px;
  margin: 0;
  font-size: clamp(42px, 13vw, 60px);
}
.poster.small { font-size: clamp(30px, 9vw, 40px); }
.kicker {
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 1.8px;
  text-transform: uppercase;
  margin: 0;
}
.lead { font-size: 16px; font-weight: 700; margin: 0; }
.muted { color: var(--muted-dark); }

/* Cards */
.block { padding: 16px; position: relative; overflow: hidden; border-radius: var(--radius); }
.block.yellow { background: var(--yellow); }
.block.blue { background: var(--blue); color: var(--paper); }
.block.red { background: var(--red); color: var(--paper); }
.block.ink { background: var(--ink); color: var(--paper); }
.outlined { border: var(--line); background: var(--paper); border-radius: var(--radius); padding: 14px; }
.card-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; }
.card-disc { position: absolute; right: -44px; top: -44px; width: 130px; height: 130px; border-radius: 50%; }
.block > :not(.card-disc) { position: relative; }

/* Two small cards side by side, each holding one thing. */
.stats { display: grid; grid-template-columns: 1fr 1fr; gap: var(--gap); }
.stat { padding: 12px 14px; min-height: 76px; display: flex; flex-direction: column; justify-content: space-between; gap: 6px; }
.stat .n { font-weight: 900; font-stretch: 62%; font-size: 30px; line-height: 0.95; text-transform: uppercase; margin: 0; }

.topbar { display: flex; align-items: center; gap: 10px; justify-content: space-between; padding: 2px 4px 4px; }
.brand { color: inherit; text-decoration: none; display: flex; align-items: center; gap: 8px; font-weight: 900; font-stretch: 75%; font-size: 20px; letter-spacing: 1px; }

/* Hunchy mark (geometric dog) */
.mark { width: var(--s, 40px); height: var(--s, 40px); flex: none; display: block; overflow: visible; }
.mark .tuft { fill: var(--red); transform-box: fill-box; }
.mark .tuft.l { transform-origin: 100% 100%; }
.mark .tuft.r { transform-origin: 0 100%; }
.mark .eyes { transform-box: fill-box; transform-origin: center; }
@media (prefers-reduced-motion: no-preference) {
  .mark .owl { animation: owl-breathe 3s ease-in-out infinite; transform-origin: 60px 104px; }
  .mark .eyes { animation: owl-blink 5s infinite; }
  .mark .tuft.l { animation: owl-tuft-l 6s infinite; }
  .mark .tuft.r { animation: owl-tuft-r 6s infinite; }
}
@keyframes owl-breathe { 0%, 100% { transform: scale(1, 1); } 50% { transform: scale(1.01, 1.03); } }
@keyframes owl-blink { 0%, 16%, 20%, 100% { transform: scaleY(1); } 18% { transform: scaleY(0.1); } }
@keyframes owl-tuft-l { 0%, 43%, 52%, 100% { transform: rotate(0); } 46% { transform: rotate(-16deg); } 49% { transform: rotate(6deg); } }
@keyframes owl-tuft-r { 0%, 43%, 52%, 100% { transform: rotate(0); } 46% { transform: rotate(16deg); } 49% { transform: rotate(-6deg); } }

/* Avatar */
.avatar {
  width: 56px; height: 56px; flex: none;
  display: grid; place-items: center;
  font-weight: 900; font-size: 24px; font-stretch: 75%;
  /* The line keeps a letter avatar visible on a card of its own color. */
  border: 2.5px solid var(--ink);
}
.block.ink .avatar, .block.blue .avatar, .block.red .avatar { border-color: var(--paper); }
.avatar.tile, .avatar.triangle { border: 0; }
.avatar.tile { display: block; border-radius: 22%; overflow: hidden; }
.avatar.tile svg { display: block; width: 100%; height: 100%; }
.avatar:not(.tile):not(.circle):not(.half):not(.triangle) { border-radius: 22%; }
.avatar.circle { border-radius: 50%; }
.avatar.half { border-radius: 100px 100px 0 0; }
.avatar.triangle { position: relative; clip-path: polygon(50% 0, 100% 100%, 0 100%); background: var(--ink); }
.avatar.triangle span {
  position: absolute; inset: 7px 4px 3px; display: grid; place-items: end center; padding-bottom: 7%; line-height: 1;
  clip-path: polygon(50% 0, 100% 100%, 0 100%);
}

/* Inputs and buttons */
label.field { display: flex; flex-direction: column; gap: 6px; }
input[type="text"] {
  font: inherit; font-size: 22px; font-weight: 800;
  padding: 13px 14px; border: var(--line); background: #fff; color: var(--ink);
  border-radius: var(--inner); outline: none; width: 100%;
}
input[type="text"]:focus { border-color: var(--blue); box-shadow: 0 0 0 2px var(--blue); }
button:focus-visible, a:focus-visible { outline: 3px solid var(--blue); outline-offset: 2px; }

.btn {
  appearance: none; border: 0; cursor: pointer; width: 100%;
  font: inherit; font-weight: 900; font-stretch: 62%; text-transform: uppercase;
  font-size: 34px; letter-spacing: 0.5px; text-align: left; line-height: 1;
  padding: 14px 18px; min-height: 66px; border-radius: var(--inner);
  background: var(--red); color: var(--paper);
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  transition: transform 0.1s, background 0.2s, color 0.2s;
}
a.btn { text-decoration: none; }
.btn::after { content: "→"; font-stretch: 100%; font-size: 26px; }
.btn:active { transform: scale(0.98); }
.btn:disabled { background: var(--muted); color: var(--paper); cursor: default; }
.btn.ink { background: var(--ink); color: var(--yellow); }
.btn.ink:disabled { background: var(--muted); color: var(--paper); }
.btn.blue { background: var(--blue); }

/* Shape and color pickers */
.picks { display: flex; gap: 10px; }
.pick {
  appearance: none; cursor: pointer; padding: 6px; background: none;
  border: 2.5px solid transparent; border-radius: var(--inner); display: grid; place-items: center;
}
.pick.on { border-color: var(--ink); }
.pick.swatch { width: 52px; height: 52px; padding: 0; background: var(--c); border: 2.5px solid var(--ink); }
.pick.swatch.on { outline: 3px solid var(--ink); outline-offset: 2px; }

/* Relation chips (play page) and pack cards (create) */
.relations { display: flex; gap: 6px; }
.relations .chip { flex: 1; padding: 10px 4px; font-size: 13px; letter-spacing: 0.3px; }
.chip.on { background: var(--ink); color: var(--paper); }
.packs { display: flex; flex-direction: column; gap: var(--gap); }
.option.pack { min-height: 0; flex-direction: row; align-items: center; justify-content: flex-start; }
.tagline { font-size: 11px; letter-spacing: 1px; color: var(--muted-dark); }

/* Share box */
.link { margin: 0; font-weight: 900; font-stretch: 75%; font-size: 19px; word-break: break-all; }
.share { display: flex; gap: 8px; flex-wrap: wrap; }
.chip {
  appearance: none; font: inherit; cursor: pointer; text-decoration: none;
  font-weight: 900; font-size: 14px; letter-spacing: 1px;
  padding: 10px 14px; min-height: 44px; border: var(--line); border-radius: var(--inner);
  background: var(--paper); color: var(--ink);
  display: inline-flex; align-items: center; justify-content: center;
}
.chip:active { transform: scale(0.97); }
.chip.green { background: #1E9E5A; color: var(--paper); }

/* Progress */
.quiz-top { display: flex; align-items: center; gap: 10px; }
.quiz-top .progress { flex: 1; min-width: 0; }
.back {
  appearance: none; flex: none; width: 44px; height: 44px; border: 0; cursor: pointer;
  border-radius: var(--inner); background: var(--ink); color: var(--paper);
  font: inherit; font-size: 22px; font-weight: 900; line-height: 1;
}
.progress { display: flex; gap: 4px; align-items: center; padding: 2px 2px 4px; }
.progress span { flex: 1; height: 12px; border: 2px solid var(--ink); border-radius: 99px; }
.progress span.done { background: var(--ink); }
.progress span.now { background: var(--red); border-color: var(--red); }
.progress em { font-style: normal; font-weight: 900; font-stretch: 75%; font-size: 18px; margin-left: 6px; }

/* Question */
.tag {
  display: inline-block; background: var(--ink); color: var(--paper);
  font-size: 11px; font-weight: 800; letter-spacing: 1.6px; text-transform: uppercase;
  padding: 4px 8px; border-radius: 5px;
}
.block.ink .tag { background: var(--yellow); color: var(--ink); }
.question { font-size: 21px; font-weight: 800; margin: 8px 0 0; line-height: 1.25; }

.options { display: grid; grid-template-columns: 1fr; gap: var(--gap); }
.option {
  appearance: none; font: inherit; text-align: left; cursor: pointer;
  border: var(--line); border-radius: var(--radius); background: var(--paper); color: var(--ink);
  padding: 12px 16px; min-height: 68px;
  display: flex; align-items: center; gap: 14px;
  font-size: 17px; font-weight: 700;
  transition: transform 0.12s, background 0.15s, color 0.15s, border-color 0.15s, opacity 0.15s;
}
.option:active { transform: scale(0.97); }
/* Picking fills the card with its shape's color, as in the app. */
.option.on { transform: scale(0.97); color: var(--paper); }
.option.on.o0 { background: var(--red); border-color: var(--red); }
.option.on.o1 { background: var(--blue); border-color: var(--blue); }
.option.on.o2 { background: var(--yellow); border-color: var(--yellow); color: var(--ink); }
.option.on.o3 { background: var(--ink); border-color: var(--ink); }
.options:has(.on) .option:not(.on) { opacity: 0.6; }
.shape { flex: none; width: 26px; height: 26px; transition: transform 0.35s cubic-bezier(0.2, 0.9, 0.3, 1.3); }
.option.on .shape { transform: rotate(90deg) scale(1.1); }
.shape.s0 { background: var(--red); border-radius: 50%; }
.shape.s1 { background: var(--blue); }
.shape.s2 { background: var(--yellow); clip-path: polygon(50% 0, 100% 100%, 0 100%); }
.shape.s3 { background: var(--ink); border-radius: 26px 26px 0 0; height: 13px; margin-top: 13px; }
.option.on .shape.s0, .option.on .shape.s1, .option.on .shape.s3 { background: var(--paper); }
.option.on .shape.s2 { background: var(--ink); }

/* Result */
.score { display: flex; align-items: flex-end; justify-content: space-between; gap: 12px; }
.score .big { font-weight: 900; font-stretch: 62%; font-size: 96px; line-height: 0.85; }
.rows { display: flex; flex-direction: column; margin-top: 8px; }
.row { display: flex; gap: 10px; padding: 10px 0; border-top: 1px solid var(--hairline); }
.row .dot { width: 20px; height: 20px; flex: none; margin-top: 2px; border-radius: 50%; background: var(--blue); }
.row.miss .dot { border-radius: 0; background: none; color: var(--red); font-weight: 900; font-size: 20px; line-height: 20px; text-align: center; }
.row.miss .dot::before { content: "✕"; }
.row p { margin: 0; }
.row .q { font-weight: 800; font-size: 15px; }
.row .d { font-size: 13px; color: var(--muted-dark); }
.row .d.truth { color: var(--ink); font-weight: 700; }

.surprise { display: flex; flex-direction: column; gap: 10px; }
.surprise .answers { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: var(--gap); }
.answer { padding: 10px; border-radius: var(--inner); color: var(--ink); overflow-wrap: anywhere; }
.answer.paper { background: var(--paper); }
.answer.yellow { background: var(--yellow); }
.answer p { margin: 0; font-size: 15px; font-weight: 800; }
.answer .kicker { font-size: 11px; color: var(--ink); margin-bottom: 4px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.board { display: flex; flex-direction: column; gap: 8px; }
.board li { display: flex; align-items: center; gap: 10px; list-style: none; font-weight: 800; }
.board ol { margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.board .bar { flex: 1; height: 8px; background: var(--hairline); position: relative; border-radius: 99px; overflow: hidden; }
.board .bar i { position: absolute; inset: 0 auto 0 0; background: var(--blue); border-radius: 99px; }
.board li.me .bar i { background: var(--red); }
.board .n { font-weight: 900; font-stretch: 75%; font-size: 20px; min-width: 40px; text-align: right; }
.board .who { min-width: 84px; max-width: 120px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.error { color: var(--red); font-weight: 800; margin: 0; }
.footer { margin: auto 0 0; padding-top: 16px; font-size: 12px; color: var(--muted); text-align: center; }

/* Motion: cards dealt onto the table, as in the app */
@keyframes deal { from { transform: translateY(70px) rotate(2deg); opacity: 0; } to { transform: none; opacity: 1; } }
@keyframes pop { 0% { transform: scale(0.6); opacity: 0; } 70% { transform: scale(1.06); } 100% { transform: none; opacity: 1; } }
.in { animation: deal 0.5s cubic-bezier(0.2, 0.9, 0.3, 1) both; }
.in.d1 { animation-delay: 0.08s; } .in.d2 { animation-delay: 0.16s; } .in.d3 { animation-delay: 0.24s; }
.pop { animation: pop 0.5s cubic-bezier(0.2, 0.9, 0.3, 1.2) both; }
@media (prefers-reduced-motion: reduce) { .in, .pop { animation: none; } }

/* Result hero and the shareable card */
.result-hero { padding-bottom: 18px; }
.result-hero .disc { position: absolute; right: -60px; top: -60px; width: 190px; height: 190px; border-radius: 50%; background: var(--red); }
.result-hero .big { margin: 2px 0 -4px; font-weight: 900; font-stretch: 62%; font-size: clamp(110px, 38vw, 170px); line-height: 0.82; letter-spacing: -2px; }
.meter { height: 14px; background: rgba(22, 22, 22, 0.14); margin-top: 14px; border-radius: 99px; overflow: hidden; }
.meter i { display: block; height: 100%; background: var(--ink); border-radius: 99px; }
.share-card { display: grid; grid-template-columns: minmax(0, 2fr) minmax(0, 3fr); gap: var(--gap); }
.share-card img { width: 100%; aspect-ratio: 9 / 16; display: block; object-fit: cover; background: var(--yellow); border-radius: var(--radius); }
.share-copy { display: flex; flex-direction: column; gap: 8px; min-width: 0; }
.share-copy .lead { font-size: 15px; }
.share-copy .btn { font-size: 28px; min-height: 56px; margin-top: auto; }
.chip:disabled { opacity: 0.4; cursor: default; }

/* Story viewer: full-screen result pages */
.story {
  position: fixed; inset: 0; z-index: 50; background: var(--ink); color: var(--paper);
  display: flex; flex-direction: column; align-items: center; gap: 10px;
  padding: max(10px, env(safe-area-inset-top)) 12px calc(14px + env(safe-area-inset-bottom));
}
.story-bars { display: flex; gap: 4px; width: 100%; max-width: 460px; }
.story-bars span { flex: 1; height: 4px; background: rgba(241, 234, 219, 0.3); border-radius: 99px; overflow: hidden; }
.story-bars i { display: block; height: 100%; width: 0; background: var(--paper); }
.story-bars span.done i { width: 100%; }
.story-bars span.now i { animation: story-bar var(--d) linear forwards; }
.story.paused .story-bars span.now i { animation-play-state: paused; }
@keyframes story-bar { to { width: 100%; } }
.story-close {
  position: absolute; z-index: 2; top: calc(max(10px, env(safe-area-inset-top)) + 14px); right: 14px;
  appearance: none; border: 0; background: none; color: var(--paper); font: inherit; font-size: 24px; font-weight: 900;
  width: 44px; height: 44px; cursor: pointer;
}
.story-stage {
  flex: 1; min-height: 0; width: 100%; max-width: 460px; display: flex; align-items: center; justify-content: center;
  user-select: none; -webkit-user-select: none; touch-action: manipulation; cursor: pointer;
}
.story-stage img { max-height: 100%; max-width: 100%; aspect-ratio: 9 / 16; object-fit: contain; pointer-events: none; border-radius: var(--radius); animation: pop 0.35s both; }
.story-page {
  height: 100%; max-width: 100%; aspect-ratio: 9 / 16; background: var(--blue); color: var(--paper);
  padding: 26px 22px; display: flex; flex-direction: column; gap: 14px; overflow: hidden; position: relative; border-radius: var(--radius); animation: pop 0.35s both;
}
.story-page .poster { font-size: clamp(40px, 11vh, 72px); }
.story-actions { width: 100%; max-width: 460px; display: flex; flex-direction: column; gap: 8px; }
.story-actions .btn { font-size: 28px; min-height: 58px; }
.story-actions .btn.ink { background: var(--yellow); color: var(--ink); }
.story-note { color: var(--on-dark); text-align: center; min-height: 1em; }
@media (prefers-reduced-motion: reduce) { .story-stage img, .story-page { animation: none; } }
.story-page .story-disc { position: absolute; right: -50px; bottom: -50px; width: 220px; height: 220px; border-radius: 50%; background: var(--yellow); }
.story-actions .chip { align-self: center; background: none; color: var(--paper); border-color: var(--paper); }
.app-note { padding: 12px 14px; border: 2.5px solid currentColor; border-radius: var(--inner); text-align: center; }
.report-link { appearance: none; border: 0; background: none; font: inherit; font-size: 12px; font-weight: 700; color: var(--muted-dark); text-decoration: underline; cursor: pointer; align-self: center; padding: 8px; }
.report-name { appearance: none; border: 0; background: none; font: inherit; font-size: 14px; color: var(--muted-dark); cursor: pointer; padding: 4px 6px; min-width: 32px; min-height: 32px; }
.report-gap { width: 32px; flex: none; }
.footer a { color: inherit; }
.footer-actions { display: flex; justify-content: center; gap: 4px; flex-wrap: wrap; }
