/* Base reset the claude.ai artifact host used to supply around the page. */
:root { padding-top: env(safe-area-inset-top); padding-bottom: env(safe-area-inset-bottom); }
body { margin: 0; font: 14px system-ui; }
img { max-width: 100%; }
[hidden] { display: none !important; }

/* Layout: one full-bleed canvas stage (a 1930s cartoon countryside: machines in the sky, animals on the meadow); title card top-left, filter dock along the bottom, detail card on the right (bottom sheet on phones). Single deliberate look: aged-paper cartoon, no dark variant. */
:root {
  --paper: #f1e2bd;
  --cream: #fff4d6;
  --ink: #1d140e;
  --red: #d0402c;
  --mustard: #e5a627;
  --teal: #2e8c84;
  --plum: #7d4b7f;
  --green: #5d9a3b;
  --sky: #a8d2c8;
  --display: "Fontdiner Swanky", "Cooper Black", Georgia, serif;
  --type: "Courier Prime", "Courier New", monospace;
  color-scheme: light;
}
html { box-sizing: border-box; height: 100%; }
*, *::before, *::after { box-sizing: inherit; }
body { height: 100%; background: var(--paper); color: var(--ink); font-family: var(--type); overflow: hidden; }
.stage { position: relative; height: 100%; overflow: hidden; background: var(--sky); }
#world { position: absolute; inset: 0; width: 100%; height: 100%; display: block; touch-action: none; filter: sepia(.16) saturate(1.06) contrast(1.04); }
.fx { position: absolute; inset: 0; pointer-events: none; }
.vignette { background: radial-gradient(ellipse at center, rgba(0,0,0,0) 52%, rgba(52,28,8,.55) 100%); }
.flicker { background: #fff1c8; mix-blend-mode: soft-light; animation: flick .17s steps(2) infinite; }
@keyframes flick { 0% { opacity: .04; } 50% { opacity: .18; } 100% { opacity: .09; } }

.title-card {
  position: absolute; top: 16px; left: max(16px, env(safe-area-inset-left, 0px));
  max-width: min(400px, calc(100% - 32px));
  background: var(--cream); border: 4px solid var(--ink); border-radius: 18px;
  padding: 12px 18px 14px; box-shadow: 6px 6px 0 var(--ink); transform: rotate(-1.5deg);
}
.title-card::before { content: ""; position: absolute; inset: 5px; border: 2px dashed var(--ink); border-radius: 12px; opacity: .3; pointer-events: none; }
.eyebrow { margin: 0 0 4px; font-size: .7rem; font-weight: 700; letter-spacing: .16em; text-transform: uppercase; }
.title-card h1 {
  margin: 0; font-family: var(--display); font-weight: 400; font-size: clamp(1.55rem, 4.4vw, 2.5rem); line-height: 1;
  color: var(--red); text-shadow: 3px 3px 0 var(--ink); -webkit-text-stroke: 1.2px var(--ink); text-wrap: balance;
}
.title-card p.sub { margin: 8px 0 0; font-size: .85rem; line-height: 1.35; }

.title-card p.classic { margin: 8px 0 0; font-size: .68rem; text-align: right; }
.title-card p.classic a { color: var(--ink); text-decoration: underline; opacity: .75; }
.title-card p.classic a:hover, .title-card p.classic a:focus-visible { opacity: 1; }

.dock {
  position: absolute; bottom: 16px; left: max(16px, env(safe-area-inset-left, 0px)); right: max(16px, env(safe-area-inset-right, 0px));
  display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; pointer-events: none;
}
.chip {
  pointer-events: auto; display: inline-flex; align-items: center; gap: 7px;
  font-family: var(--display); font-size: .92rem; color: var(--ink);
  background: var(--cream); border: 3px solid var(--ink); border-radius: 999px;
  padding: 6px 13px 5px; box-shadow: 3px 3px 0 var(--ink); cursor: pointer;
  transition: transform .08s ease;
}
.chip:hover { transform: translate(-1px, -2px) rotate(-1.5deg); }
.chip:active { transform: translate(2px, 2px); box-shadow: 1px 1px 0 var(--ink); }
.chip[aria-pressed="true"] { background: var(--c, var(--ink)); color: #fff; text-shadow: 1.5px 1.5px 0 var(--ink); }
.chip:focus-visible, .close:focus-visible, .cast button:focus-visible { outline: 3px solid var(--red); outline-offset: 3px; }
.dot { width: 13px; height: 13px; border-radius: 50%; background: var(--c); border: 2px solid var(--ink); flex: none; }
.count { font-family: var(--type); font-size: .78rem; font-weight: 700; }

.card, .cast {
  position: absolute; top: 50%;
  width: min(360px, calc(100% - 32px)); max-height: calc(100% - 32px); overflow: auto;
  background: var(--cream); border: 4px solid var(--ink); border-radius: 16px; box-shadow: 7px 7px 0 var(--ink);
}
.card { right: max(16px, env(safe-area-inset-right, 0px)); transform: translateY(-50%) rotate(1deg); animation: pop .4s cubic-bezier(.3,1.6,.5,1); }
.cast { right: max(16px, env(safe-area-inset-right, 0px)); transform: translateY(-50%) rotate(-.6deg); animation: pop .4s cubic-bezier(.3,1.6,.5,1); max-height: min(78%, 640px); }
@keyframes pop { from { transform: translateY(-50%) scale(.55) rotate(-8deg); } }
.card-head {
  display: flex; justify-content: space-between; align-items: center; gap: 8px;
  background: var(--c, var(--red)); border-bottom: 4px solid var(--ink); padding: 8px 10px 8px 16px;
  color: #fff; font-family: var(--display); letter-spacing: .03em; text-shadow: 1.5px 1.5px 0 var(--ink);
  position: sticky; top: 0;
}
.close {
  width: 34px; height: 34px; flex: none; display: grid; place-items: center;
  font-family: var(--display); font-size: 1.2rem; line-height: 1; color: var(--ink);
  background: var(--cream); border: 3px solid var(--ink); border-radius: 50%; cursor: pointer; text-shadow: none;
}
.card-body { padding: 14px 18px 18px; display: grid; gap: 10px; }
.card h2 { margin: 0; font-family: var(--display); font-weight: 400; font-size: 1.75rem; line-height: 1.05; overflow-wrap: anywhere; }
.aka { margin: -4px 0 0; font-weight: 700; }
.desc { margin: 0; line-height: 1.45; max-width: 60ch; }
.species { margin: 0; padding: 7px 10px; border: 2px dashed var(--ink); border-radius: 10px; font-size: .85rem; }
.stats { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; margin: 2px 0 0; }
.stats div { border: 2px solid var(--ink); border-radius: 10px; padding: 6px 9px; background: var(--paper); min-width: 0; }
.stats .wide { grid-column: 1 / -1; }
.stats dt { font-size: .66rem; font-weight: 700; text-transform: uppercase; letter-spacing: .1em; }
.stats dd { margin: 2px 0 0; font-family: var(--display); font-size: 1.1rem; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.stats dd.mono { font-family: var(--type); font-weight: 700; font-size: .9rem; }
.fine { margin: 0; font-size: .72rem; opacity: .75; }
.legend { margin-top: 8px; font-size: .78rem; }
.legend summary { font-family: var(--display); font-size: .9rem; cursor: pointer; }
.legend summary:focus-visible { outline: 3px solid var(--red); outline-offset: 2px; }
.legend ul { list-style: none; margin: 4px 0 0; padding: 0; display: grid; gap: 2px; }
.legend b { font-family: var(--display); font-weight: 400; display: inline-block; min-width: 6.5em; }
.links { display: flex; flex-wrap: wrap; gap: 8px; }
.links a {
  font-family: var(--display); font-size: .9rem; color: var(--ink); text-decoration: none; overflow-wrap: anywhere;
  background: var(--mustard); border: 3px solid var(--ink); border-radius: 999px; padding: 5px 12px 4px; box-shadow: 3px 3px 0 var(--ink);
  transition: transform .08s ease;
}
.links a.gh { background: var(--cream); }
.links a:hover { transform: translate(-1px, -2px) rotate(-1deg); }
.links a:focus-visible { outline: 3px solid var(--red); outline-offset: 3px; }
.links .none { margin: 0; font-size: .8rem; opacity: .75; }

.cast-body { padding: 10px 14px 14px; display: grid; gap: 12px; }
.cast h2 { margin: 0; font: inherit; }
.cast h2:focus-visible { outline: 3px solid var(--cream); outline-offset: 3px; }
.cast h3 { margin: 0 0 6px; font-family: var(--display); font-weight: 400; font-size: 1.05rem; display: flex; align-items: center; gap: 7px; }
.cast ul { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.find-sum { margin: 0; font-size: .78rem; font-weight: 700; }
.row {
  width: 100%; display: flex; align-items: center; gap: 10px; text-align: left; cursor: pointer;
  font-family: var(--type); font-size: .82rem; color: var(--ink);
  background: var(--paper); border: 2px solid var(--ink); border-radius: 10px; padding: 4px 8px 4px 4px;
}
.row:hover { background: #f6d98c; }
.row.done { background: #dcebc8; }
.thumb { width: 72px; height: 52px; flex: none; border-radius: 7px; background: var(--sky); border: 2px solid var(--ink); }
.row .name { flex: 1; min-width: 0; font-weight: 700; overflow-wrap: anywhere; }
.row .mono { font-family: var(--display); font-size: .8rem; opacity: .7; }
.row .mark { width: 1.2em; text-align: center; font-weight: 700; }
.hint { margin: 4px 0 0; padding: 6px 10px; border: 2px dashed var(--ink); border-radius: 10px; font-size: .8rem; display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.hint button, .startover {
  font-family: var(--display); font-size: .85rem; color: var(--ink); cursor: pointer;
  background: var(--mustard); border: 2px solid var(--ink); border-radius: 999px; padding: 3px 11px 2px;
}
.startover { justify-self: start; background: none; border: 0; padding: 0; font-family: var(--type); font-size: .75rem; text-decoration: underline; opacity: .75; }
.startover.armed { background: var(--red); color: #fff; opacity: 1; text-decoration: none; border: 2px solid var(--ink); padding: 3px 11px 2px; }
.hint button:focus-visible, .startover:focus-visible { outline: 3px solid var(--red); outline-offset: 2px; }
.title-card p.tally { margin: 6px 0 0; font-size: .9rem; }
.title-card p.banner { margin: 6px 0 0; padding: 5px 9px; background: var(--mustard); border: 2px solid var(--ink); border-radius: 10px; font-family: var(--display); font-size: .95rem; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
.chips { display: contents; }

.about-btn { display: none; }
.about-btn, .mm-toggle {
  font-family: var(--display); color: var(--ink); background: var(--cream); cursor: pointer;
  border: 2px solid var(--ink); border-radius: 999px; box-shadow: 2px 2px 0 var(--ink);
}
.about-btn { font-size: .78rem; padding: 2px 10px 1px; margin-left: 6px; }
.about-btn[aria-expanded="true"], .mm-toggle[aria-pressed="true"] { background: var(--ink); color: var(--cream); }
.about-btn:focus-visible, .mm-toggle:focus-visible { outline: 3px solid var(--red); outline-offset: 2px; }

/* Mini-map: bottom-left, lifted above the dock by app.js (bottom is set from the dock's height; 72px is the fallback). */
.minimap { position: absolute; left: max(16px, env(safe-area-inset-left, 0px)); bottom: 72px; display: flex; flex-direction: column; align-items: flex-start; gap: 6px; }
.mm-frame { background: var(--cream); border: 3px solid var(--ink); border-radius: 8px; padding: 3px; box-shadow: 3px 3px 0 var(--ink); }
.mm-frame canvas { display: block; border-radius: 4px; cursor: crosshair; touch-action: none; }
.mm-toggle { font-size: .7rem; padding: 1px 9px 0; }

@media (max-width: 640px) {
  /* compact title card (title + tally + About), never more than ~35% of the screen */
  .title-card { padding: 7px 12px 8px; max-height: 35%; overflow: auto; }
  .title-card h1 { font-size: 1.35rem; }
  .title-card p.tally { margin-top: 4px; }
  .title-card:not(.open) :is(.eyebrow, .sub, .legend, .classic) { display: none; }
  .about-btn { display: inline-block; }
  /* card and find list become bottom sheets */
  .card, .cast { top: auto; left: 10px; right: 10px; bottom: 10px; width: auto; transform: none; max-height: 60%; animation-name: popm; }
  .dock { left: 8px; right: 8px; bottom: 10px; gap: 6px; }
  .minimap { left: 10px; }
  .chip { font-size: .8rem; padding: 5px 10px 4px; }
}
@keyframes popm { from { transform: translateY(30px) scale(.8); } }
@media (prefers-reduced-motion: reduce) {
  .flicker { animation: none; opacity: .08; }
  .card, .cast { animation: none; }
}

.load-error { position: absolute; inset: 40% 16px auto; margin: 0 auto; max-width: 420px; padding: 16px 20px; background: var(--cream); border: 3px solid var(--ink); font-family: var(--type); text-align: center; z-index: 10; }
