:root {
  --ink: #10121a;
  --panel: #1a2232ee;
  --line: #3d82b0;
  --text: #e8eef4;
  --muted: #98a6b2;
  --gold: #fcbc4a;
  --red: #e23a30;
  --green: #74a644;
  font: 600 14px/1.35 ui-monospace, "Cascadia Mono", Menlo, Consolas, monospace;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; background: #0b1420; color: var(--text); }
#app { display: flex; flex-direction: column; align-items: center; height: 100%; }

#hud {
  display: flex; flex-wrap: wrap; align-items: center; gap: 6px 18px;
  padding: 8px 14px; width: 100%; justify-content: center;
  background: var(--ink); border-bottom: 2px solid #22263a;
}
#hud .title { color: var(--gold); letter-spacing: 1px; text-transform: uppercase; }
#hud .stat { color: var(--muted); }
#hud .stat b { color: var(--text); }
button {
  font: inherit; color: var(--text); background: #283a68; border: 2px solid #5470b4;
  padding: 3px 10px; cursor: pointer;
}
button:hover { background: #3a5292; }
kbd {
  font: inherit; font-size: 0.85em; padding: 0 4px; border: 1px solid var(--muted);
  border-bottom-width: 2px; border-radius: 3px; color: var(--text);
}

#stage { position: relative; margin: auto; user-select: none; }
#game {
  display: block; width: 100%; height: 100%;
  image-rendering: pixelated; image-rendering: crisp-edges; cursor: crosshair;
}

#toast {
  position: absolute; left: 50%; top: 12%; transform: translateX(-50%);
  font-size: 22px; color: #fff; text-shadow: 2px 2px 0 var(--ink), -2px 2px 0 var(--ink), 2px -2px 0 var(--ink), -2px -2px 0 var(--ink);
  opacity: 0; pointer-events: none; white-space: nowrap;
}
#toast.show { animation: toast 1.8s ease-out forwards; }
#toast.good { color: var(--gold); }
#toast.bad { color: #ff7a66; }
@keyframes toast {
  0% { opacity: 0; transform: translate(-50%, 8px); }
  12% { opacity: 1; transform: translate(-50%, 0); }
  75% { opacity: 1; }
  100% { opacity: 0; transform: translate(-50%, -6px); }
}

#hint {
  position: absolute; left: 0; right: 0; bottom: 8px; text-align: center; pointer-events: none;
  text-shadow: 1px 1px 0 var(--ink), -1px 1px 0 var(--ink), 1px -1px 0 var(--ink), -1px -1px 0 var(--ink);
}
#hint.urgent { color: var(--gold); font-size: 20px; }

#reel {
  position: absolute; right: 14px; top: 14px; width: 220px; padding: 8px 10px;
  background: var(--panel); border: 2px solid var(--line);
}
#reel .label { color: var(--muted); font-size: 12px; }
#reel .bar { position: relative; height: 14px; margin: 4px 0; background: #10304c; border: 1px solid #000; }
#tension { height: 100%; width: 0; background: var(--green); }
#tension.warn { background: var(--gold); }
#tension.danger { background: var(--red); }
#reel .redline { position: absolute; top: 0; bottom: 0; left: 80%; right: 0; border-left: 2px dashed #ff7a66; background: #e23a3022; }

.card {
  position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%);
  width: min(560px, 92%); max-height: 94%; overflow: auto; padding: 16px 22px; text-align: center;
  background: var(--panel); border: 3px solid var(--line); box-shadow: 0 0 0 3px var(--ink);
}
.card h1 { margin: 0 0 6px; color: var(--gold); font-size: 26px; text-transform: uppercase; letter-spacing: 2px; }
.card h2 { margin: 6px 0 2px; font-size: 22px; }
.card p { margin: 6px 0; }
.card .go { margin-top: 12px; color: var(--muted); }
.card .byline { margin-top: -2px; color: var(--muted); font-size: 13px; }
.card .byline b { color: var(--gold); }
.controls { text-align: left; margin: 10px auto; padding-left: 20px; max-width: 470px; }
.controls li { margin: 3px 0; }
#catch-sprite { image-rendering: pixelated; margin: 8px auto 0; display: block; }
#catch-card .size { color: var(--muted); }
#catch-card .points { color: var(--gold); font-size: 16px; }
#share { margin: 10px auto 0; padding-top: 10px; border-top: 1px dashed var(--line); }
#share[hidden] { display: none; }
.share-buttons { display: flex; gap: 8px; justify-content: center; }
.share-note { color: var(--muted); font-size: 12px; }
.badges { display: flex; gap: 8px; justify-content: center; min-height: 22px; }
.badge { padding: 1px 8px; background: var(--gold); color: var(--ink); font-size: 12px; text-transform: uppercase; }
.badge.trophy { background: #f4b4d4; }
.badge.first { background: #9ccaea; }
.badge.junk { background: var(--muted); }

table.scores { margin: 8px auto; border-collapse: collapse; min-width: 70%; }
table.scores th, table.scores td { padding: 2px 10px; text-align: left; }
table.scores th { color: var(--muted); font-weight: 600; border-bottom: 1px solid var(--line); }
table.scores td.num, table.scores th.num { text-align: right; }
table.scores tr.new td { color: var(--gold); }

#log {
  position: absolute; inset: 4%; display: flex; flex-direction: column;
  background: var(--panel); border: 3px solid var(--line); box-shadow: 0 0 0 3px var(--ink);
}
#log[hidden] { display: none; }
.log-head { display: flex; align-items: center; gap: 12px; padding: 8px 12px; border-bottom: 2px solid var(--line); }
.log-head h2 { margin: 0; font-size: 18px; color: var(--gold); }
.log-head nav { display: flex; gap: 6px; flex: 1; }
.log-head nav button.active { background: var(--line); border-color: #9ccaea; }
.log-body { overflow: auto; padding: 8px 14px; flex: 1; }
.log-body .empty { color: var(--muted); text-align: center; margin-top: 30px; }
.log-day { margin: 10px 0 4px; color: var(--gold); border-bottom: 1px dashed #3d82b0; }
.entry { display: grid; grid-template-columns: 96px 1fr auto; align-items: center; gap: 4px 12px; padding: 4px 0; }
.entry img { image-rendering: pixelated; justify-self: center; }
.entry .what { font-size: 15px; }
.entry .meta { color: var(--muted); font-size: 12px; }
.entry .pts { color: var(--gold); text-align: right; }
.entry .badge { font-size: 10px; margin-left: 4px; }
.species { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 10px; }
.species .cell { border: 2px solid #283a68; padding: 8px; text-align: center; }
.species .cell img { image-rendering: pixelated; height: 48px; width: 100%; object-fit: contain; }
.species .cell.unknown img { filter: brightness(0); opacity: 0.45; }
.species .cell .name { margin-top: 4px; }
.species .cell .meta { color: var(--muted); font-size: 12px; }
