/* chunky, cheap, 8-bit-ish. backgrounds are tiny pixelated crops of real photos, scaled up on purpose. */
:root {
  --ink: #1d1b26; --paper: #fff8e7; --yellow: #f6d04d; --green: #5fbf3a; --red: #e0503c; --blue: #3f7fd6;
  --font: "Courier New", ui-monospace, monospace;
}
* { box-sizing: border-box; }
/* no double-tap zoom when tapping fast (pinch zoom still works) */
html, button, .tapzone { touch-action: manipulation; }
html { background: linear-gradient(rgba(20, 22, 34, .55), rgba(20, 22, 34, .7)), #2a2c38 url(art/bg-train.jpg) center / cover fixed; }
body { margin: 0; font: 16px/1.4 var(--font); color: var(--ink); }
img.spr { width: 40px; height: auto; image-rendering: pixelated; flex: none; }
img.spr.big { width: 32px; vertical-align: middle; margin-right: 8px; }
img.cur { width: 14px; image-rendering: pixelated; vertical-align: -2px; }
button { font: inherit; color: inherit; cursor: pointer; }

/* top bar */
.top {
  position: sticky; top: 0; z-index: 5; display: flex; justify-content: space-between; align-items: center; gap: 12px;
  padding: 10px 14px; background: var(--paper); border-bottom: 4px solid var(--ink);
}
.logo { font-weight: bold; font-size: 20px; letter-spacing: 1px; white-space: nowrap; }
.stats { text-align: right; font-weight: bold; }
#count { font-size: 22px; }
.rate { font-size: 13px; font-weight: normal; }
.rate.slump { color: var(--red); font-weight: bold; }

/* game area */
.game { display: grid; gap: 14px; padding: 14px; max-width: 1000px; margin: 0 auto; }
.stage { grid-area: stage; } .shop { grid-area: shop; } .world { grid-area: world; }
.game { grid-template-areas: "stage" "shop" "world"; }
@media (min-width: 760px) {
  .game { grid-template-columns: 1fr 1.1fr; grid-template-areas: "stage shop" "world shop"; align-items: start; }
}

/* matt's life: one sprite per thing you bought */
.world { background: var(--paper); border: 4px solid var(--ink); box-shadow: 6px 6px 0 var(--ink); padding: 0 0 6px; }
.world summary {
  list-style: none; cursor: pointer; padding: 8px 12px; background: var(--ink); color: var(--paper);
  font-weight: bold; font-size: 15px; display: flex; flex-wrap: wrap; align-items: center; gap: 4px 10px; user-select: none;
}
.world summary::-webkit-details-marker { display: none; }
.world summary .wtitle::before { content: "▸ "; display: inline-block; width: 1.1em; }
.world[open] summary .wtitle::before { content: "▾ "; }
.world[open] summary { margin-bottom: 4px; }
.wsummary { display: flex; flex-wrap: wrap; gap: 2px 10px; font-size: 13px; }
.world[open] .wsummary { display: none; }
.wchip { display: inline-flex; align-items: center; gap: 2px; background: var(--paper); color: var(--ink); padding: 1px 5px 1px 3px; }
.wchip img.spr { width: 18px; }
.world:not([open]) { padding-bottom: 0; }
.wrow { padding: 6px 12px; border-bottom: 2px dashed #c9bfa6; }
.wrow:last-child { border-bottom: 0; }
.wlabel { font-size: 12px; font-weight: bold; color: #5b5566; margin-bottom: 4px; }
.wsprites { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 2px 4px; }
img.wspr { width: 26px; transform: rotate(var(--tilt)); }
img.wspr.pop { animation: pop .35s ease-out; }
@keyframes pop { 0% { transform: scale(0) rotate(0); } 70% { transform: scale(1.3) rotate(var(--tilt)); } 100% { transform: rotate(var(--tilt)); } }
.more { font-weight: bold; font-size: 13px; align-self: center; margin-left: 4px; }

.stage {
  background: #24402a url(art/bg-woods.jpg) center / cover;
  border: 4px solid var(--ink); box-shadow: 6px 6px 0 var(--ink); padding: 24px 12px 8px; text-align: center;
}
.tapzone { position: relative; display: inline-block; cursor: pointer; user-select: none; -webkit-tap-highlight-color: transparent; outline: none; }
.tapzone:focus-visible .face { outline: 4px dashed var(--yellow); }
.face {
  width: min(64vw, 280px); aspect-ratio: 1; border-radius: 50%; display: block; image-rendering: auto;
  border: 6px solid var(--ink); box-shadow: 0 0 0 6px var(--yellow), 0 10px 0 6px var(--ink);
  transition: transform .08s;
}
.tapzone:hover .face { transform: scale(1.03) rotate(-1deg); }
.face.squish { animation: squish .18s ease-out; }
@keyframes squish { 40% { transform: scale(.9, .86); } 100% { transform: scale(1); } }
.floater {
  position: absolute; pointer-events: none; font-weight: bold; font-size: 20px; color: var(--yellow);
  text-shadow: 2px 2px 0 var(--ink), -1px -1px 0 var(--ink); animation: floatup .9s ease-out forwards; transform: translate(-50%, -50%);
}
@keyframes floatup { to { transform: translate(-50%, -140%); opacity: 0; } }
.hint { margin: 14px 0 4px; font-weight: bold; color: #fff; text-shadow: 2px 2px 0 var(--ink); }

/* shop */
.shop { background: var(--paper); border: 4px solid var(--ink); box-shadow: 6px 6px 0 var(--ink); }
.tabs { display: grid; grid-template-columns: repeat(4, 1fr); border-bottom: 4px solid var(--ink);
  background: url(art/bg-city.png) center / cover; image-rendering: pixelated; }
.tabs button { background: rgba(255, 248, 231, .82); border: 0; border-right: 3px solid var(--ink); padding: 10px 2px; font-size: 13px; font-weight: bold; }
.tabs button:last-child { border-right: 0; }
.tabs button.on { background: var(--yellow); }
.list { max-height: 62vh; overflow-y: auto; }
@media (max-width: 759px) { .list { max-height: none; } }
.row {
  display: flex; align-items: center; gap: 10px; width: 100%; text-align: left; padding: 10px 12px;
  background: none; border: 0; border-bottom: 2px dashed #c9bfa6;
}
button.row:hover { background: #fff1c2; }
button.row:active { transform: translateY(2px); }
.row.poor { opacity: .45; }
.row.peeve .title { color: var(--red); }
.mid { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.title { font-weight: bold; }
.sub { font-size: 12px; color: #5b5566; }
.right { text-align: right; font-weight: bold; white-space: nowrap; display: flex; flex-direction: column; align-items: flex-end; }
.owned { font-size: 18px; line-height: 1; color: var(--blue); }
.ach:not(.got) { opacity: .55; }
.empty, .warn { padding: 12px; margin: 0; font-size: 14px; }
.warn { background: #ffe0da; color: #8a1f12; font-weight: bold; }

.controls { display: flex; gap: 10px; justify-content: center; padding: 4px 14px 18px; }
.controls button { background: var(--paper); border: 3px solid var(--ink); box-shadow: 3px 3px 0 var(--ink); padding: 6px 12px; font-size: 13px; }

/* toasts */
.toasts { position: fixed; left: 50%; bottom: 14px; transform: translateX(-50%); z-index: 9; display: grid; gap: 8px; width: min(92vw, 420px); }
.toast { background: var(--paper); border: 3px solid var(--ink); box-shadow: 4px 4px 0 var(--ink); padding: 10px 12px; font-weight: bold; transition: opacity .4s, transform .4s; }
.toast.good { background: #e3f7d4; } .toast.bad { background: #ffe0da; }
.toast.bye { opacity: 0; transform: translateY(10px); }

/* the instruction booklet */
.manual {
  max-width: 760px; margin: 10px auto 60px; padding: 22px 20px 26px; background: var(--paper);
  border: 4px solid var(--ink); box-shadow: 8px 8px 0 var(--ink); font-family: Georgia, "Times New Roman", serif; font-size: 17px; line-height: 1.6;
}
@media (max-width: 799px) { .manual { margin: 10px 14px 40px; } }
.manual h1 { font-family: var(--font); text-align: center; margin: 0; letter-spacing: 3px; border-bottom: 4px double var(--ink); padding-bottom: 6px; }
.manual h2 { font-family: var(--font); font-size: 17px; margin: 26px 0 4px; background: var(--ink); color: var(--paper); display: inline-block; padding: 2px 8px; }
.manual a { color: #1a5fb4; }
.small { font-size: 13px; text-align: center; color: #6a6272; }
.shots { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; }
.shots img { width: 100%; aspect-ratio: 1; object-fit: cover; border: 3px solid var(--ink); }
@media (min-width: 600px) { .shots { grid-template-columns: repeat(4, 1fr); } }

/* fake early-2010s search ads, all about matt */
.ads { margin: 30px 0 10px; padding: 8px 12px 4px; background: #fff8dd; border: 1px solid #e8dfb8; font-family: Arial, Helvetica, sans-serif; line-height: 1.3; }
.adlabel { font-size: 12px; color: #666; margin-bottom: 8px; }
.adlabel a { color: #666; margin-left: 4px; }
.ad { margin-bottom: 12px; }
.ads a.adtitle { font-size: 16px; color: #1122cc; text-decoration: underline; }
.ads a.adtitle:visited { color: #660099; }
.adurl { font-size: 13px; color: #009933; }
.addesc { font-size: 13px; color: #222; }
