/* Doggie Chaos. One visual world: the backyard on a bright day.
   Layout idea: a single phone-width column; the yard and the dog on top, the note from the fridge door below. */
:root {
  color-scheme: light;
  --sky: #cfe8f5;        /* page */
  --panel: #ffffff;      /* tiles */
  --line: #a9c9da;       /* borders on the page */
  --text: #1c2b3a;       /* text on the page */
  --mute: #54697a;       /* secondary text on the page */
  --ball: #cde432;       /* tennis ball: the main button, focus */
  --collar: #d8412f;     /* the red collar: urgency, bad news */
  --grass: #2c8a4b;      /* good news */
  --amber: #e2940f;      /* running low */
  --paper: #fffdf4;      /* the note */
  --sunny: #fff0b3;      /* a good moment */
  --hush: #edf0f3;       /* the goodbye */
  --ink: #1c2b3a;        /* text on paper */
  --ink-soft: #5b6b79;
  --rule: #d9d2bd;       /* dashed rules on paper */
  --display: 'Chewy', 'Arial Rounded MT Bold', 'Trebuchet MS', system-ui, sans-serif;
  --body: 'Nunito', -apple-system, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  background: var(--sky);
  background-image: linear-gradient(180deg, #b7dcf1 0, #cfe8f5 260px, #dff0e4 100%);
  background-attachment: fixed;
  color: var(--text);
  font-family: var(--body);
  font-size: 16px;
  line-height: 1.45;
  -webkit-text-size-adjust: 100%;
  min-height: 100vh;
}
#app { max-width: 460px; margin: 0 auto; padding: 14px 16px 40px; display: flex; flex-direction: column; gap: 12px; }
h1, h2, h3, p, figure, ul, ol { margin: 0; padding: 0; }
ul, ol { list-style: none; }
button { font: inherit; color: inherit; cursor: pointer; -webkit-tap-highlight-color: transparent; }
button:focus-visible, input:focus-visible, textarea:focus-visible { outline: 3px solid var(--ink); outline-offset: 2px; }
.num { font-variant-numeric: tabular-nums; }

/* ---- the yard ---- */
.yard { border-radius: 16px; overflow: hidden; border: 2px solid var(--ink); background: #bfe3f7; }
.yard svg { display: block; width: 100%; height: auto; }
.tail { transform-box: fill-box; transform-origin: 100% 100%; animation: wag .45s ease-in-out infinite alternate; }
.tail.w3 { animation-duration: .2s; }
.tail.w1 { animation-duration: .95s; }
.tail.w0 { animation: none; transform: rotate(-78deg); }
@keyframes wag { from { transform: rotate(-16deg); } to { transform: rotate(20deg); } }

/* ---- title ---- */
.title { display: flex; flex-direction: column; gap: 4px; padding-top: 6px; }
.title h1 { font-family: var(--display); font-weight: 400; font-size: 60px; line-height: .9; letter-spacing: .01em; color: var(--ink); }
.title h1 span { color: var(--collar); display: block; }
.title p { color: var(--mute); font-weight: 600; }
.stack { display: flex; flex-direction: column; gap: 10px; }
.btn { display: block; width: 100%; min-height: 52px; padding: 12px 16px; border-radius: 14px; border: 2px solid var(--ink); background: var(--panel); font-weight: 800; text-align: center; box-shadow: 0 3px 0 var(--ink); }
.btn small { display: block; font-weight: 600; color: var(--mute); font-size: 13px; }
.btn.primary { background: var(--ball); }
.btn.primary small { color: #3d4a12; }
.btn:active { transform: translateY(3px); box-shadow: none; }
.how { background: var(--panel); border: 1px solid var(--line); border-radius: 14px; padding: 14px 16px; }
.how h2 { font-size: 13px; letter-spacing: .12em; text-transform: uppercase; color: var(--collar); margin-bottom: 8px; font-weight: 800; }
.how li { padding: 6px 0; border-top: 1px solid #dbe8ef; font-size: 15px; color: var(--mute); }
.how li:first-child { border-top: 0; }
.how b { color: var(--text); }
.how.goal { border: 2px solid var(--ink); }
.how.goal p { font-size: 16.5px; color: var(--text); }
.fine { font-size: 12.5px; color: var(--mute); }

/* ---- top bar, money and meters ---- */
.bar { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; }
.bar .time { font-family: var(--display); font-size: 34px; line-height: 1; letter-spacing: .02em; }
.bar .where { color: var(--mute); font-size: 13px; font-weight: 600; text-align: right; margin-left: auto; }
.helpbtn { flex: none; align-self: center; width: 40px; height: 40px; border-radius: 50%; border: 2px solid var(--ink); background: var(--panel); color: var(--ink); font-weight: 800; font-size: 18px; }
.money { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.meters { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; }
.tile { background: var(--panel); border: 1px solid var(--line); border-radius: 12px; padding: 8px 10px; min-width: 0; }
.tile .lab { font-size: 11px; letter-spacing: .06em; text-transform: uppercase; color: var(--mute); font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tile .val { font-size: 19px; font-weight: 800; line-height: 1.2; }
.tile .val.neg { color: var(--collar); }
.money .tile .val { font-size: 25px; }
.meters .tile { padding: 7px 8px; }
.meters .tile .lab { font-size: 10.5px; letter-spacing: 0; text-transform: none; }
.track { height: 6px; border-radius: 3px; background: #dfeaf0; margin-top: 5px; overflow: hidden; }
.track i { display: block; height: 100%; border-radius: 3px; background: var(--grass); transition: width .3s; }
.track i.warn { background: var(--amber); }
.track i.bad { background: var(--collar); }
.staff { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; }
.mgr { background: var(--panel); border: 1px solid var(--line); border-radius: 10px; padding: 6px 8px 7px; min-width: 0; }
.mgr b { display: block; font-size: 12.5px; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mgr b span { font-weight: 600; color: var(--mute); }
.mgr.gone b { text-decoration: line-through; color: var(--mute); }
.mgr .track { margin-top: 4px; height: 4px; }
.caption { font-size: 12px; color: var(--mute); }

/* ---- news that lands from earlier choices ---- */
.flash { border: 2px solid var(--collar); border-left-width: 7px; border-radius: 10px; padding: 9px 12px; background: #fff3ef; display: flex; flex-direction: column; gap: 6px; }
.flash .k { font-size: 11px; font-weight: 800; letter-spacing: .1em; text-transform: uppercase; color: var(--collar); }
.flash p { font-size: 15px; }

/* ---- the note (trouble), the sunny note (a good moment), the quiet one (goodbye) ---- */
.slip { background: var(--paper); color: var(--ink); border: 2px solid var(--ink); border-radius: 6px 6px 16px 16px; padding: 0 16px 16px; box-shadow: 0 5px 0 rgba(28, 43, 58, .18); display: flex; flex-direction: column; gap: 12px; }
.slip .head { display: flex; justify-content: space-between; gap: 10px; margin: 0 -16px; padding: 8px 16px; border-bottom: 2px solid var(--ink); border-top: 7px solid var(--collar); font-size: 12px; letter-spacing: .07em; text-transform: uppercase; font-weight: 800; }
.slip .head span + span { color: var(--ink-soft); white-space: nowrap; }
.slip h2 { font-family: var(--display); font-weight: 400; font-size: 31px; line-height: 1.04; letter-spacing: .01em; text-wrap: balance; }
.slip p { font-size: 16.5px; }
.slip .you { font-size: 14px; color: var(--ink-soft); font-weight: 600; }
.slip.moment { background: var(--sunny); }
.slip.moment .head { border-top-color: #f4b400; }
.slip.quiet { background: var(--hush); }
.slip.quiet .head { border-top-color: #8496a6; }
.twist { border-left: 4px solid var(--collar); padding-left: 10px; display: flex; flex-direction: column; gap: 6px; }
.twist p { font-size: 15.5px; }
.opts { display: flex; flex-direction: column; gap: 8px; }
.opt { text-align: left; width: 100%; min-height: 52px; padding: 10px 12px; border-radius: 10px; border: 2px solid var(--ink); background: #ffffff; color: var(--ink); display: flex; flex-direction: column; gap: 2px; }
.opt .l { font-weight: 700; font-size: 16px; line-height: 1.25; }
.opt .m { font-size: 13px; color: var(--ink-soft); }
.opt .m b { color: var(--collar); font-weight: 700; }
.opt:active { background: #eef2e0; }
.opt[disabled] { opacity: .45; cursor: not-allowed; }
.opt.del { border-style: dashed; background: transparent; }
.opt.go { background: var(--ink); color: #fff; align-items: center; justify-content: center; font-weight: 800; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip { font-size: 13px; font-weight: 700; padding: 3px 9px; border-radius: 999px; background: #dcf1e2; color: #17643a; border: 1px solid #9fd0b0; }
.chip.bad { background: #fbe1dc; color: #96261a; border-color: #eaa79d; }
.chip.flat { background: #ece8d8; color: var(--ink); border-color: #cfc8b0; }
.badge { align-self: flex-start; font-size: 12px; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; padding: 3px 9px; border-radius: 999px; background: var(--grass); color: #fff; }
.badge.lost { background: var(--collar); }
.pace { border-top: 1px dashed var(--ink-soft); padding-top: 10px; font-size: 14px; color: var(--ink-soft); }
.pace b { color: var(--ink); }
.pace .dn { color: #96261a; font-weight: 700; }
.facts li { display: flex; justify-content: space-between; gap: 14px; padding: 7px 0; border-top: 1px dashed var(--rule); font-size: 15px; }
.facts li:first-child { border-top: 0; }
.facts li span:first-child { color: var(--ink-soft); flex: none; }
.facts li span:last-child { font-weight: 700; text-align: right; }

/* ---- naming the dog ---- */
.field { display: flex; flex-direction: column; gap: 6px; }
.field label, .field .k { font-size: 12px; letter-spacing: .1em; text-transform: uppercase; font-weight: 800; color: var(--ink-soft); }
.field input { width: 100%; min-height: 52px; padding: 8px 12px; border-radius: 10px; border: 2px solid var(--ink); background: #fff; color: var(--ink); font-family: var(--display); font-size: 28px; }
.picks { display: flex; flex-wrap: wrap; gap: 6px; }
.pick { min-height: 40px; padding: 6px 13px; border-radius: 999px; border: 2px solid var(--ink); background: #fff; font-weight: 700; font-size: 15px; }
.pick.on { background: var(--ink); color: #fff; }

/* ---- the dog's report ---- */
.paper { background: var(--paper); color: var(--ink); border: 2px solid var(--ink); border-radius: 8px; padding: 16px; display: flex; flex-direction: column; gap: 12px; box-shadow: 0 5px 0 rgba(28, 43, 58, .18); }
.paper .mast { display: flex; justify-content: space-between; gap: 10px; font-size: 11px; letter-spacing: .12em; text-transform: uppercase; border-bottom: 3px double var(--ink); padding-bottom: 6px; font-weight: 800; }
.paper h2 { font-family: var(--display); font-weight: 400; font-size: 28px; line-height: 1.08; text-wrap: balance; }
.stampRow { display: flex; justify-content: center; padding: 10px 0 6px; }
.stamp { max-width: 100%; padding: 6px 18px 9px; border-radius: 14px; border: 5px solid var(--collar); outline: 2px solid var(--collar); outline-offset: 3px; color: var(--collar); text-align: center; font-family: var(--display); font-size: min(50px, calc((min(100vw, 460px) - 108px) / (var(--n, 10) * .74))); line-height: 1; letter-spacing: .03em; text-transform: uppercase; white-space: nowrap; transform: rotate(-4deg); animation: stamp .35s cubic-bezier(.2, 1.4, .4, 1) both; }
.stamp small { display: block; font-family: var(--body); font-weight: 800; font-size: 11px; letter-spacing: .14em; line-height: 1.7; }
.stamp.good { border-color: var(--grass); outline-color: var(--grass); color: var(--grass); }
@keyframes stamp { from { transform: rotate(-4deg) scale(1.6); opacity: 0; } }
.adj li { font-size: 14.5px; display: flex; justify-content: space-between; gap: 10px; padding: 3px 0; }
.adj li b { white-space: nowrap; }
.adj li b.upg { color: #17643a; } .adj li b.dng { color: #96261a; }
.stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; text-align: center; }
.stats div { background: #f0ecdc; border-radius: 8px; padding: 6px 2px; min-width: 0; }
.stats b { display: block; font-size: 16px; font-weight: 800; font-variant-numeric: tabular-nums; }
.stats span { font-size: 10.5px; letter-spacing: .04em; text-transform: uppercase; color: var(--ink-soft); font-weight: 700; }
.quote { font-size: 16.5px; border-left: 4px solid var(--ball); padding-left: 10px; font-weight: 700; }
.sect { font-size: 12px; letter-spacing: .12em; text-transform: uppercase; font-weight: 800; color: var(--ink-soft); border-top: 1px solid var(--rule); padding-top: 10px; }
.reviews li { padding: 8px 0 8px 26px; border-top: 1px dashed var(--rule); font-size: 15px; position: relative; font-style: italic; }
.reviews li:first-child { border-top: 0; }
.reviews li::before { content: ''; position: absolute; left: 2px; top: 13px; width: 13px; height: 11px; border-radius: 50% 50% 46% 46%; background: var(--ink); box-shadow: -5px -8px 0 -3px var(--ink), 0 -10px 0 -3px var(--ink), 5px -8px 0 -3px var(--ink); transform: translateX(4px); }
.log li { display: grid; grid-template-columns: 54px 1fr auto; gap: 8px; font-size: 14px; padding: 5px 0; border-top: 1px dashed var(--rule); }
.log li:first-child { border-top: 0; }
.log .t { color: var(--ink-soft); font-size: 12px; font-weight: 700; padding-top: 2px; }
.log .c { color: var(--ink-soft); display: block; font-size: 13px; }
.log .d { font-variant-numeric: tabular-nums; font-weight: 700; font-size: 13px; color: var(--ink-soft); }
.log .d.neg { color: #96261a; } .log .d.pos { color: #17643a; }
textarea.share { width: 100%; min-height: 110px; border-radius: 10px; border: 2px solid var(--ink); background: #fff; color: var(--ink); font: inherit; font-size: 14px; padding: 10px; }

@media (max-width: 400px) {
  .title h1 { font-size: 50px; }
  .money .tile .val { font-size: 22px; }
  .meters { grid-template-columns: repeat(2, 1fr); }
}
@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; }
  .tail { animation: none; }
  .stamp { animation: none; }
}

/* ---- how to play ---- */
.overlay { position: fixed; inset: 0; z-index: 10; background: rgba(20, 40, 55, .72); overflow-y: auto; padding: 16px; }
.sheet { max-width: 460px; margin: 0 auto; background: var(--paper); color: var(--ink); border: 2px solid var(--ink); border-radius: 14px; border-top: 8px solid var(--collar); padding: 14px 16px 16px; display: flex; flex-direction: column; gap: 12px; }
.sheetTop { display: flex; justify-content: space-between; align-items: flex-start; gap: 10px; }
.sheet h2 { font-family: var(--display); font-weight: 400; font-size: 30px; line-height: 1.05; text-wrap: balance; }
.sheet p { font-size: 15.5px; }
.sheet .x { flex: none; width: 40px; height: 40px; border-radius: 50%; border: 2px solid var(--ink); background: transparent; color: var(--ink); font-size: 24px; line-height: 1; }
.credits { border-top: 1px solid var(--rule); padding-top: 10px; display: flex; flex-direction: column; gap: 4px; }
.credits .k { font-size: 11px; letter-spacing: .12em; text-transform: uppercase; font-weight: 800; color: var(--ink-soft); }
.credits li { display: flex; justify-content: space-between; gap: 14px; padding: 3px 0; font-size: 15px; }
.credits li span { color: var(--ink-soft); }
.credits li b { font-weight: 700; text-align: right; }
