:root {
  --stripe: rgba(23, 35, 31, .042);
}

html { min-width: 320px; }

body {
  min-height: 100vh;
  margin: 0;
  color: var(--ink);
  background:
    linear-gradient(135deg, transparent 48%, var(--stripe) 48% 52%, transparent 52%) 0 0 / 44px 44px,
    var(--canvas);
  overflow-x: hidden;
}

a, button { -webkit-tap-highlight-color: transparent; }
a:focus-visible, button:focus-visible { outline: 3px solid var(--blue); outline-offset: 4px; }

.orb-field { position: fixed; inset: 0; z-index: 5; overflow: hidden; pointer-events: none; }
.game-vignette {
  --miss-x: 50vw;
  --miss-y: 50vh;
  position: fixed;
  inset: 0;
  z-index: 10;
  background: rgba(0, 0, 0, .1);
  opacity: 0;
  pointer-events: none;
  transition: opacity .35s ease;
}
.target-layer { position: fixed; inset: 0; z-index: 40; overflow: hidden; pointer-events: none; }
.target-layer .orb { pointer-events: auto; }
body.game-is-active .game-vignette { opacity: 1; }
body.game-missed-reveal .game-vignette {
  background: radial-gradient(circle at var(--miss-x) var(--miss-y), transparent 0 70px, rgba(0, 0, 0, .24) 210px, rgba(0, 0, 0, .76) 760px, rgba(0, 0, 0, .9) 1200px);
}

@media (max-width: 700px) {
  .orb-field, .target-layer, .game-panel, .chase-panel, .game-vignette, .site-hop-zone { display: none; }
}

.chase-panel {
  position: fixed;
  z-index: 30;
  top: 14px;
  left: 50%;
  min-width: 260px;
  padding: 12px 22px 13px;
  border: 2px solid var(--ink);
  border-radius: 22px;
  background: #302633;
  color: #fffdf7;
  box-shadow: 5px 6px 0 var(--accent);
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 16px;
  opacity: 0;
  pointer-events: none;
  transform: translate(-50%, calc(-100% - 25px)) rotate(.7deg);
  transition: opacity .18s ease, transform .42s cubic-bezier(.2, 1.25, .35, 1), background .2s ease, backdrop-filter .2s ease;
}
.chase-panel.glassy {
  opacity: 0.12 !important;
  background: rgba(48, 38, 51, 0.2);
  backdrop-filter: blur(2px);
  -webkit-backdrop-filter: blur(2px);
}
.chase-panel.is-active { opacity: 1; transform: translate(-50%, 0) rotate(.7deg); }
.chase-panel.is-caught { background: rgba(58, 42, 36, 0.75); box-shadow: 5px 6px 0 var(--yellow); }
.chase-panel > span { color: #d1c8d5; font-size: .62rem; font-weight: 950; letter-spacing: .13em; text-transform: uppercase; }
.chase-panel strong { display: flex; align-items: baseline; justify-content: center; font-size: 1.9rem; line-height: 1; }
.chase-panel strong small { margin-left: 2px; color: #d1c8d5; font-size: .7rem; }
.chase-panel em { justify-self: end; color: #d1c8d5; font-size: .64rem; font-style: normal; font-weight: 850; }
.orb {
  position: absolute;
  width: var(--size);
  height: var(--size);
  padding: 0;
  border: 2px solid var(--ink);
  border-radius: 50%;
  background: var(--orb-color);
  box-shadow: 4px 5px 0 rgba(23, 35, 31, .92);
  pointer-events: auto;
  cursor: grab;
  touch-action: none;
  user-select: none;
  transition: background-color .22s ease, transform .12s ease, box-shadow .12s ease;
}
.orb:hover:not(.is-dragging):not(.is-angry) { transform: scale(1.04); }
.orb:active:not(.is-dragging) { transform: scale(.98); }
.orb.is-dragging { z-index: 10; cursor: grabbing; box-shadow: 8px 10px 0 rgba(23, 35, 31, .78); transition: background-color .22s ease, box-shadow .12s ease; }
.orb.is-changing { animation: orb-pop .25s cubic-bezier(.2, .9, .25, 1.25); }
@keyframes orb-pop { 50% { transform: scale(1.12) rotate(4deg); } }
.orb.is-angry { animation: orb-angry .3s ease-in forwards; }
.orb.is-arriving { animation: orb-arrive .36s cubic-bezier(.16, 1.25, .36, 1); }
@keyframes orb-angry {
  18%, 52%, 82% { transform: translateX(-6px) rotate(-5deg); }
  35%, 68% { transform: translateX(7px) rotate(6deg); }
  100% { transform: scale(0); }
}
@keyframes orb-arrive { from { transform: scale(0) rotate(-12deg); } 70% { transform: scale(1.16) rotate(3deg); } }
.orb.game-target {
  z-index: 20;
  box-shadow: 0 0 0 5px var(--paper), 0 0 0 11px var(--ink), 0 0 0 17px var(--accent), 10px 14px 0 rgba(23, 35, 31, .9);
  animation: target-pulse .5s ease-in-out infinite alternate;
}
.orb.game-decoy { box-shadow: 4px 5px 0 rgba(23, 35, 31, .92); }
.orb.missed-target {
  z-index: 20;
  background: var(--yellow);
  box-shadow: 0 0 0 7px var(--paper), 0 0 0 12px var(--ink), 8px 10px 0 rgba(23, 35, 31, .42);
  animation: missed-target-pulse .65s ease-in-out infinite alternate;
}
.missed-label {
  position: absolute;
  left: 50%;
  top: 50%;
  width: calc(100% + 120px);
  aspect-ratio: 1;
  color: var(--ink);
  pointer-events: none;
  transform: translate(-50%, -50%);
  animation: missed-label-turn 12s linear infinite;
}
.missed-label svg { display: block; width: 100%; height: 100%; overflow: visible; }
.missed-label text { fill: currentColor; font: 950 9px/1 ui-sans-serif, system-ui, sans-serif; letter-spacing: 1.25px; }
.orb.is-vanishing { pointer-events: none; animation: orb-vanish .28s ease-in forwards; }
@keyframes target-pulse { to { filter: saturate(1.22) brightness(1.05); transform: scale(1.06); } }
@keyframes missed-target-pulse { to { filter: brightness(1.08); transform: scale(1.07); } }
@keyframes missed-label-turn { to { transform: translate(-50%, -50%) rotate(360deg); } }
@keyframes orb-vanish { to { opacity: 0; transform: scale(0) rotate(12deg); } }

body.game-is-active .page-shell,
body.game-is-active .page-shell * { pointer-events: none !important; user-select: none; }

.game-panel {
  position: fixed;
  z-index: 30;
  top: 13px;
  left: 50%;
  width: fit-content;
  min-width: min(440px, calc(100% - 30px));
  min-height: 88px;
  padding: 12px 21px;
  border: 2px solid var(--ink);
  border-radius: 20px;
  background: rgba(46, 39, 53, 0.98);
  transition: background 0.2s ease, opacity .18s ease, transform .42s cubic-bezier(.2, 1.25, .35, 1);
  color: #fffdf7;
  box-shadow: 5px 6px 0 var(--accent);
  display: grid;
  grid-template-columns: 104px minmax(0, 1fr) 104px;
  align-items: center;
  gap: 13px;
  pointer-events: none;
  opacity: 0;
  transform: translate(-50%, calc(-100% - 24px)) rotate(-1deg);
}
.game-panel.glassy {
  opacity: 0.12 !important;
  background: rgba(46, 39, 53, 0.2);
  backdrop-filter: blur(2px);
  -webkit-backdrop-filter: blur(2px);
}
.game-panel.is-active { opacity: 1; transform: translate(-50%, 0) rotate(-1deg); }
.game-panel.game-over { background: rgba(51, 42, 55, 0.75); box-shadow: 5px 6px 0 var(--yellow); }
.game-stat { display: grid; justify-items: center; gap: 2px; }
.game-stat span { color: #c9c2d2; font-size: .7rem; font-weight: 950; letter-spacing: .12em; text-transform: uppercase; }
.game-stat strong { font-size: 1.88rem; line-height: 1; letter-spacing: -.04em; }
.game-center { min-width: 0; display: grid; gap: 8px; text-align: center; }
.game-center strong { overflow: hidden; font-size: .9rem; text-overflow: ellipsis; white-space: nowrap; }
.game-timer-row { display: grid; grid-template-columns: minmax(0, 1fr) 31px; align-items: center; gap: 8px; transition: opacity 0.2s ease; }
.game-timer { height: 9px; border: 1.5px solid #fffdf7; border-radius: 99px; background: #17121b; overflow: hidden; }
.game-timer span { display: block; width: 100%; height: 100%; border-radius: inherit; background: var(--yellow); }
.game-timer-row output { color: #e1dce8; font: 850 .72rem/1 ui-monospace, SFMono-Regular, Consolas, monospace; text-align: right; }
.game-over .game-timer-row { opacity: 0; pointer-events: none; }

.page-shell {
  position: relative;
  z-index: 1;
  width: min(1080px, calc(100% - 36px));
  margin: 30px auto;
  pointer-events: none;
}

.page-shell:has(.poka-theme-toggle[data-open="true"]) { z-index: 6; }

.site-header, .intro > div, .shelf-label, .tool-card, .rail-home-card, .site-footer { pointer-events: auto; }

.rail-home { display: none; }
@media (min-width: 900px) {
  html[data-rail-dock] .pokatools-home .site-header,
  html[data-rail-dock] .pokatools-home .tool-shelf { display: none; }
  html[data-rail-dock] .pokatools-home .rail-home { display: block; }
  html[data-rail-dock] body.pokatools-home { padding-left: 284px; }
  html[data-rail-dock] .pokatools-home .page-shell { margin-top: 26px; }
  html[data-rail-dock] .pokatools-home .intro { min-height: 0; padding: 6px 4px 26px; }
  html[data-rail-dock] .pokatools-home h1 { font-size: clamp(1.6rem, 3vw, 2.35rem); letter-spacing: -.045em; line-height: 1.02; white-space: normal; }
  html[data-rail-dock] .pokatools-home .lede { margin-top: 6px; font-size: .8rem; }
}
.rail-home-group + .rail-home-group { margin-top: 24px; }
.rail-home-group[hidden] { display: none; }
.rail-home-label { margin: 0 0 10px 4px; color: var(--muted); font-size: .6rem; font-weight: 900; letter-spacing: .15em; text-transform: uppercase; }
.rail-home-label[hidden] { display: none; }
.rail-home-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 14px; }
.rail-home-card {
  display: grid;
  grid-template-columns: 44px minmax(0, 1fr);
  align-items: center;
  gap: 12px;
  min-height: 76px;
  padding: 14px;
  border: 2px solid var(--ink);
  border-radius: 18px;
  background: var(--paper);
  color: var(--ink);
  text-decoration: none;
  box-shadow: 4px 5px 0 var(--ink);
  transition: transform .16s ease, box-shadow .16s ease;
}
.rail-home-card:hover { transform: translateY(-3px) rotate(-.5deg); box-shadow: 6px 8px 0 var(--ink); }
.rail-home-card:active { transform: translate(3px, 4px); box-shadow: 1px 1px 0 var(--ink); }
.rail-home-card .poka-rail-chip { width: 44px; height: 44px; border-width: 2px; border-radius: 13px; box-shadow: 2px 2px 0 var(--ink); }
.rail-home-card .poka-rail-chip svg { width: 23px; height: 23px; }
.rail-home-card:nth-child(odd) .poka-rail-chip { transform: rotate(2deg); }
.rail-home-card:nth-child(even) .poka-rail-chip { transform: rotate(-2deg); }
.rail-home-copy { min-width: 0; }
.rail-home-copy strong { display: block; font-size: .92rem; letter-spacing: -.015em; }
.rail-home-copy small { display: block; margin-top: 2px; color: var(--muted); font-size: .66rem; font-weight: 700; line-height: 1.35; }

.site-header {
  min-height: 72px;
  padding: 15px 19px;
  border: 2px solid var(--ink);
  border-radius: 22px;
  background: rgba(255, 253, 247, .94);
  box-shadow: 4px 5px 0 var(--ink);
  display: flex;
  align-items: center;
}
:root[data-theme="dark"] .site-header { background: rgba(38, 45, 39, .94); }

.home-mark { display: block; color: inherit; text-decoration: none; }
.home-logo { display: block; width: auto; height: 40px; }
.home-logo-dark { display: none; }
:root[data-theme="dark"] .home-logo-light { display: none; }
:root[data-theme="dark"] .home-logo-dark { display: block; }

.developer-note-button {
  width: 40px;
  min-height: 40px;
  margin-left: auto;
  padding: 0;
  border: 2px solid var(--ink);
  border-radius: 11px;
  background: color-mix(in srgb, var(--yellow) 24%, var(--paper));
  color: var(--ink-fixed);
  box-shadow: 2px 2px 0 var(--ink);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: transform .12s ease, box-shadow .12s ease;
}
:root[data-theme="dark"] .developer-note-button { background: var(--soft); color: var(--ink); }
.developer-note-button svg { width: 17px; height: 17px; }
.developer-note-button:hover { transform: translateY(-1px) rotate(-.5deg); box-shadow: 3px 4px 0 var(--ink); }
.developer-note-button:active { transform: translate(2px, 2px); box-shadow: none; }
.site-header[data-theme-toggle-host] > .poka-theme-toggle--hosted { margin-left: 10px; }

.developer-dialog {
  width: min(560px, calc(100% - 28px));
  max-width: none;
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--ink);
  overflow: visible;
}
.developer-dialog::backdrop { background: rgba(18, 24, 21, .62); backdrop-filter: blur(5px); }
.developer-dialog[open]:not(.is-closing)::backdrop { animation: developer-backdrop-in .3s ease-out both; }
.developer-dialog.is-closing::backdrop { animation: developer-backdrop-out .24s ease-in both; }
.developer-dialog-card {
  --note-tilt: -.35deg;
  position: relative;
  padding: clamp(28px, 6vw, 46px);
  border: 2px solid var(--ink);
  border-radius: 19px 23px 17px 22px;
  background:
    linear-gradient(135deg, transparent 48%, var(--stripe) 48% 52%, transparent 52%) 0 0 / 30px 30px,
    var(--paper);
  box-shadow: 8px 10px 0 var(--ink), 0 26px 60px rgba(0, 0, 0, .24);
  transform: rotate(var(--note-tilt));
}
.developer-dialog[open]:not(.is-closing) .developer-dialog-card { animation: developer-note-grow .32s cubic-bezier(.16,1,.3,1) both; }
.developer-dialog.is-closing .developer-dialog-card { animation: developer-note-grow-out .24s cubic-bezier(.4,0,1,1) both; }
@keyframes developer-note-grow {
  from { opacity: 0; transform: rotate(var(--note-tilt)) scale(.94); }
  to { opacity: 1; transform: rotate(var(--note-tilt)) scale(1); }
}
@keyframes developer-note-grow-out {
  from { opacity: 1; transform: rotate(var(--note-tilt)) scale(1); }
  to { opacity: 0; transform: rotate(var(--note-tilt)) scale(1.04); }
}
@keyframes developer-backdrop-in { from { opacity: 0; } to { opacity: 1; } }
@keyframes developer-backdrop-out { from { opacity: 1; } to { opacity: 0; } }
.developer-dialog-kicker { color: var(--accent-dark); font-size: .64rem; font-weight: 950; letter-spacing: .12em; text-transform: uppercase; }
.developer-dialog h2 { margin: 8px 38px 20px 0; font: 800 clamp(1.8rem, 7vw, 3rem)/.95 Georgia, serif; letter-spacing: -.04em; }
.developer-dialog p { margin: 0 0 16px; color: var(--muted); font-size: .92rem; font-weight: 650; line-height: 1.65; }
.developer-dialog p strong { color: var(--ink); }
.developer-dialog-share { padding: 15px 17px; border: 1.5px dashed var(--ink); border-radius: 11px; background: color-mix(in srgb, var(--lime) 26%, var(--paper)); color: var(--ink) !important; }
.developer-dialog-footer { display: flex; align-items: center; gap: 13px; flex-wrap: wrap; }
.developer-dialog-version { font-size: .68rem; font-weight: 950; letter-spacing: .12em; text-transform: uppercase; color: var(--muted); }
.developer-dialog-version span { display: inline-block; margin-left: 6px; padding: 2px 9px; font-size: .82rem; border: 1.5px solid var(--ink); border-radius: 999px; background: var(--soft); color: var(--ink); font-family: ui-monospace, "SF Mono", Menlo, monospace; letter-spacing: .03em; text-transform: none; transform: rotate(-.6deg); }
.developer-dialog-close {
  position: absolute;
  top: 16px;
  right: 16px;
  width: 36px;
  height: 36px;
  padding: 0;
  border: 2px solid var(--ink);
  border-radius: 50%;
  background: var(--soft);
  color: var(--ink);
  box-shadow: 2px 2px 0 var(--ink);
  font: 900 1.35rem/1 sans-serif;
  cursor: pointer;
}
.developer-dialog-done { min-height: 42px; padding: 0 17px; border: 2px solid var(--ink); border-radius: 10px; background: var(--accent); color: var(--ink-fixed); box-shadow: 3px 3px 0 var(--ink); font-size: .7rem; font-weight: 950; cursor: pointer; }
.developer-dialog-close:active, .developer-dialog-done:active { transform: translate(2px, 2px); box-shadow: none; }

.site-hop-zone {
  position: fixed;
  left: 0;
  bottom: 0;
  z-index: 35;
  width: 142px;
  height: 92px;
}

.site-hop {
  position: fixed;
  left: -30px;
  bottom: -30px;
  z-index: 1;
  width: 60px;
  height: 60px;
  border: 1.5px solid rgba(0, 0, 0, .16);
  border-radius: 50%;
  background: rgba(255, 255, 255, .5);
  color: var(--ink);
  box-shadow: 1px 1px 0 rgba(0, 0, 0, .1);
  opacity: .85;
  display: grid;
  place-items: center;
  text-decoration: none;
  overflow: visible;
  backdrop-filter: blur(5px);
  -webkit-backdrop-filter: blur(5px);
  pointer-events: auto;
  transition: left .26s cubic-bezier(.3, 1.4, .5, 1), bottom .26s cubic-bezier(.3, 1.4, .5, 1), width .22s ease, height .22s ease, border-radius .22s ease, background .22s ease, border-color .22s ease, box-shadow .22s ease, transform .18s cubic-bezier(.3, 1.4, .5, 1), opacity .16s ease;
}

:root[data-theme="dark"] .site-hop {
  background: rgba(38, 45, 39, .64);
  border-color: rgba(241, 239, 228, .34);
  box-shadow: 2px 2px 0 rgba(0, 0, 0, .34);
}

.site-hop-zone:hover .site-hop,
.site-hop:focus-visible {
  left: 18px;
  bottom: 18px;
  width: 116px;
  height: 66px;
  border-color: var(--ink);
  border-radius: 19px;
  background: var(--paper);
  box-shadow: 4px 5px 0 var(--ink);
  transform: translateY(-3px) rotate(-1deg);
}

.site-hop:active { transform: scale(.88); }
.site-hop-zone:hover .site-hop:active,
.site-hop:focus-visible:active { transform: translateY(-3px) scale(.96); }

.site-hop-art {
  position: absolute;
  inset: -34px -20px auto -10px;
  height: 58px;
  pointer-events: none;
}

.site-hop-label {
  align-self: center;
  margin-bottom: 0;
  opacity: 0;
  transform: translateY(6px);
  font-size: .8rem;
  font-weight: 800;
  letter-spacing: -.005em;
  line-height: 1;
  color: var(--muted);
  white-space: nowrap;
  transition: opacity .16s ease, transform .28s cubic-bezier(.3, 1.4, .5, 1);
}
.site-hop-label b { font-weight: 800; color: var(--ink); }
.site-hop-poka { color: #ff6553; }

.site-hop-zone:hover .site-hop-label,
.site-hop:focus-visible .site-hop-label {
  opacity: 1;
  transform: translateY(0);
  font-size: 1.3rem;
  transition-delay: .05s;
}

.thread-blip,
.tent-tree,
.turnstone-letter {
  position: absolute;
  opacity: 0;
  transform: translateY(18px) scale(.62) rotate(var(--tilt));
  transform-origin: 50% 100%;
  transition: opacity .16s ease, transform .32s cubic-bezier(.18, 1.4, .34, 1);
}

.site-hop-zone:hover .thread-blip,
.site-hop-zone:hover .tent-tree,
.site-hop-zone:hover .turnstone-letter,
.site-hop:focus-visible .thread-blip,
.site-hop:focus-visible .tent-tree,
.site-hop:focus-visible .turnstone-letter {
  opacity: 1;
  transform: translateY(0) scale(1) rotate(var(--tilt));
}

.thread-blip {
  --tilt: -8deg;
  left: 4px;
  top: 7px;
  width: 48px;
  height: 36px;
  transition-delay: .02s;
}

.thread-blip svg { position: absolute; inset: 0; width: 100%; height: 100%; overflow: visible; }
.thread-blip polyline { fill: none; stroke: var(--accent); stroke-width: 4.5; stroke-linecap: round; stroke-linejoin: round; filter: drop-shadow(1px 1px 0 var(--ink)); }

.thread-blip i {
  position: absolute;
  width: 15px;
  height: 15px;
  border: 1.5px solid var(--ink);
  box-shadow: 1.5px 1.5px 0 var(--ink);
  display: grid;
  place-items: center;
  font: 950 .4rem/1 ui-monospace, monospace;
  font-style: normal;
}
.thread-knot { border-radius: 50%; background: var(--yellow); }
.thread-knot-start { left: -2px; top: -1px; }
.thread-knot-end { right: -2px; bottom: 0; }
.thread-bead { border-radius: 4px; }
.thread-bead-turn { left: 18px; top: -1px; background: var(--lime); transform: rotate(5deg); }
.thread-bead-straight { left: 18px; bottom: 0; background: var(--blue); transform: rotate(-4deg); }

.tent-tree {
  --tilt: 8deg;
  left: 48px;
  top: 0;
  width: 37px;
  height: 47px;
  filter: drop-shadow(2px 2px 0 var(--ink));
  transition-delay: .08s;
}

.tent-tree i {
  position: absolute;
  border: 1.5px solid var(--ink);
  background: var(--lime);
  border-radius: 48% 52% 45% 55%;
}

.tent-tree i:nth-child(1) { width: 22px; height: 19px; left: 2px; top: 15px; transform: rotate(-14deg); }
.tent-tree i:nth-child(2) { width: 24px; height: 21px; right: 0; top: 9px; background: #bfe16b; transform: rotate(10deg); }
.tent-tree i:nth-child(3) { width: 25px; height: 20px; left: 7px; top: 2px; background: #d7ef8a; }
.tent-tree b { position: absolute; left: 16px; bottom: 4px; width: 7px; height: 23px; border: 1.5px solid var(--ink); border-radius: 99px; background: #875734; z-index: -1; }

.turnstone-letter {
  --tilt: -6deg;
  right: 6px;
  top: 10px;
  width: 31px;
  height: 31px;
  border: 1.5px solid var(--ink);
  border-radius: 7px 9px 6px 8px;
  background: linear-gradient(145deg, #f2eadc, #c49a6c);
  box-shadow: inset 2px 2px 0 rgba(255,255,255,.38), 2px 3px 0 var(--ink);
  display: grid;
  place-items: center;
  font: 950 1rem/1 Georgia, serif;
  transition-delay: .13s;
}

.turnstone-letter small {
  position: absolute;
  right: 3px;
  bottom: 2px;
  color: #5d5145;
  font: 800 .34rem/1 ui-monospace, monospace;
}

.site-hop-zone:hover .thread-blip svg,
.site-hop:focus-visible .thread-blip svg {
  animation: threadline-hop 1.1s ease-in-out infinite;
}

@keyframes threadline-hop {
  50% { transform: translateY(-2px) rotate(-18deg); }
}

@media (max-width: 700px) {
  .site-hop-zone { display: none; }
}
@media (max-width: 520px) {
  .developer-dialog-card { padding: 30px 22px 24px; }
}
.intro {
  min-height: 135px;
  padding: 38px 36px 30px;
  display: flex;
  align-items: flex-end;
  justify-content: flex-start;
}
h1 { margin: 0; max-width: none; font-size: clamp(.99rem, 4.4vw, 3.2rem); line-height: .95; letter-spacing: -.065em; white-space: nowrap; }
.lede { margin: 13px 0 0; color: var(--muted); font-size: clamp(.78rem, 1.5vw, .95rem); font-weight: 600; }

.shelf-group + .shelf-group { margin-top: 34px; }
.shelf-label { margin: 0 0 12px 6px; color: var(--muted); font-size: .66rem; font-weight: 900; letter-spacing: .15em; text-transform: uppercase; }
.shelf-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 18px; }
.shelf-grid + .shelf-grid { margin-top: 18px; }
.shelf-grid-flagship { grid-template-columns: repeat(3, minmax(0, 1fr)); }

.tool-card {
  position: relative;
  display: flex;
  flex-direction: column;
  min-height: 200px;
  padding: 15px 16px;
  border: 2px solid var(--ink);
  border-radius: 24px;
  background: var(--paper);
  color: var(--ink);
  text-decoration: none;
  box-shadow: 5px 6px 0 var(--ink);
  overflow: hidden;
  transition: transform .16s ease, box-shadow .16s ease;
}
.tool-card:hover { transform: translateY(-5px) rotate(-.5deg); box-shadow: 8px 11px 0 var(--ink); }
.tool-card:active { transform: translate(4px, 5px); box-shadow: 1px 1px 0 var(--ink); }
.tool-card:focus-visible { outline: 3px solid var(--blue); outline-offset: 4px; }

.tool-card::before {
  content: "";
  position: absolute;
  width: 110px;
  height: 110px;
  right: -34px;
  top: -36px;
  border: 2px solid var(--ink);
  border-radius: 50%;
  background: var(--row-color);
  opacity: .72;
  transition: opacity .16s ease, transform .16s ease;
}
.tool-card:nth-child(3n + 2)::before { width: 128px; height: 128px; right: -28px; top: -56px; }
.tool-card:nth-child(3n)::before { width: 96px; height: 96px; right: -40px; top: -24px; }
.tool-card:hover::before { opacity: .82; transform: translate(-3px, -2px) scale(1.025); }
.tool-card:active::before { opacity: .76; transform: translate(1px, 1px) scale(.99); }

.card-topline { position: relative; z-index: 1; display: flex; justify-content: space-between; align-items: center; }
.card-number { color: var(--muted); font: 850 .67rem/1 ui-monospace, SFMono-Regular, Consolas, monospace; }

.tool-icon {
  position: relative;
  z-index: 1;
  width: 56px;
  height: 56px;
  margin-top: 12px;
  border: 2px solid var(--ink);
  border-radius: 17px;
  background: var(--row-color);
  color: var(--row-fg);
  box-shadow: 3px 3px 0 var(--ink);
  display: grid;
  place-items: center;
  transform: rotate(-2deg);
}
.tool-icon svg { width: 34px; }
.tool-icon svg[fill="currentColor"] { width: 27px; }
.tool-card:nth-child(3n + 2) .tool-icon { transform: rotate(2.5deg); }
.tool-card:nth-child(3n) .tool-icon { transform: rotate(-1deg); }

.card-copy { position: relative; z-index: 1; display: grid; margin-top: auto; }
.card-copy strong { font-size: 1.28rem; letter-spacing: -.04em; }
.card-copy small { margin-top: 3px; color: var(--muted); font-size: .76rem; font-weight: 750; }

.card-detail {
  position: relative;
  z-index: 1;
  margin-top: 8px;
  padding-top: 8px;
  border-top: 1px solid var(--line);
  color: var(--ink);
  font-size: .72rem;
  font-weight: 800;
  line-height: 1.35;
}
.tool-card:not(.flagship) .card-detail { min-height: calc(2.7em + 8px); }

.tool-card.flagship { min-height: 300px; padding: 22px; }
.flagship::before { width: 156px; height: 156px; right: -48px; top: 0; }
.flagship:nth-child(3n + 2)::before { width: 140px; height: 140px; right: -40px; top: 20px; }
.flagship:nth-child(3n)::before { width: 176px; height: 176px; right: -58px; top: -22px; }
.flagship .tool-icon { width: 92px; height: 92px; margin-top: 34px; border-radius: 25px; box-shadow: 4px 4px 0 var(--ink); transform: rotate(-3deg); }
.flagship:nth-child(3n + 2) .tool-icon { transform: rotate(2.5deg); }
.flagship:nth-child(3n) .tool-icon { transform: rotate(2deg); }
.flagship .tool-icon svg { width: 52px; }
.flagship .card-copy strong { font-size: 1.65rem; }
.flagship .card-copy small { font-size: .84rem; }
.flagship .card-detail { margin-top: 15px; padding-top: 13px; font-size: .8rem; }

.site-footer { padding: 28px 7px 12px; color: var(--muted); font-size: .66rem; font-weight: 750; }
.site-footer p { margin: 0; display: flex; align-items: center; flex-wrap: wrap; gap: 8px; }
.home-copyright { margin-left: auto; white-space: nowrap; }
.tiny-orb {
  --orb-color: var(--accent);
  flex: 0 0 auto;
  width: 15px;
  height: 15px;
  padding: 0;
  border: 1.5px solid var(--ink);
  border-radius: 50%;
  background: var(--orb-color);
  box-shadow: 1px 1px 0 var(--ink);
  cursor: pointer;
  touch-action: none;
  transform-origin: center;
  transition: background-color .2s ease, transform .42s cubic-bezier(.2, 1.5, .3, 1);
}
.tiny-orb.is-pulled { cursor: grabbing; transition: background-color .2s ease; }
.tiny-orb.is-changing { animation: tiny-pop .24s cubic-bezier(.2, .9, .25, 1.3); }
@keyframes tiny-pop { 50% { transform: scale(1.45); } }

@media (max-width: 1000px) {
  .shelf-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}

@media (max-width: 820px) {
  .page-shell { width: min(680px, calc(100% - 28px)); margin-block: 18px; }
  .intro { min-height: 125px; padding: 34px 20px 26px; }
  .shelf-grid, .shelf-grid-flagship { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .shelf-grid .tool-card:last-child:nth-child(odd) { grid-column: 1 / -1; }
}

@media (max-width: 540px) {
  .page-shell { width: calc(100% - 24px); margin-block: 12px; }
  .site-header { min-height: 64px; padding: 12px 14px; border-radius: 18px; }
  .intro { min-height: 110px; padding: 30px 6px 24px; align-items: flex-start; flex-direction: column; justify-content: flex-end; }
  .shelf-grid, .shelf-grid-flagship { grid-template-columns: 1fr; gap: 15px; }
  .shelf-grid + .shelf-grid { margin-top: 15px; }
  .tool-card:not(.flagship) .card-detail { min-height: 0; }
  .site-footer { padding: 25px 5px 9px; }
  .game-panel { top: 8px; width: calc(100% - 18px); min-height: 88px; padding: 12px 13px; grid-template-columns: 70px minmax(0, 1fr) 70px; gap: 8px; border-radius: 16px; }
  .game-stat strong { font-size: 1.5rem; }
  .game-center strong { font-size: .75rem; }
  .chase-panel { top: 8px; min-width: 238px; padding: 10px 14px; gap: 10px; }
  .chase-panel strong { font-size: 1.55rem; }
}

body.page-is-leaving {
  opacity: 0;
  transform: scale(.992);
  transition: opacity 180ms ease-out, transform 180ms ease-out;
}

@media (prefers-reduced-motion: reduce) {
  body.page-is-leaving { transition: none; }
}
