/* Ant farm: the replay page. The canvas draws the world in the style of the
 * willperlak.com network diagrams (pink canvas, coral fills, navy outlines,
 * stippled shadows, Outfit); this sheet is only the HUD laid over it. */
@font-face {
  font-family: "Outfit";
  src: url("Outfit.woff2") format("woff2");
  font-weight: 100 900;
  font-display: swap;
}

:root {
  --navy: #050038;
  --pink: #ffc4c4;
  --coral: #ff6b75;
  --blue: #4262ff;
  --lblue: #dce2ff;
  --yellow: #ffd02f;
  --grey: #8a86a8;
  --hud-font: "Outfit", "Avenir Next", "Segoe UI", system-ui, sans-serif;
}

html, body { margin: 0; background: var(--pink); color: var(--navy); }
body { font-family: var(--hud-font); overscroll-behavior: none; }

#farm {
  position: relative;
  height: calc(100dvh - var(--wp-site-nav-h, 0px));
  min-height: 420px;
  overflow: hidden;
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
}
#world { position: absolute; inset: 0; width: 100%; height: 100%; display: block; cursor: grab; }
#world:active { cursor: grabbing; }

/* ---------- top bar ---------- */
.hud-top {
  position: absolute; left: 0; right: 0; top: 0;
  display: flex; justify-content: space-between; align-items: flex-start;
  padding: 12px 16px; pointer-events: none; gap: 12px;
}
.title h1 { margin: 0; font-size: clamp(22px, 3.2vw, 38px); font-weight: 700; letter-spacing: -0.01em; line-height: 1; }
.title p { margin: 4px 0 0; font-size: clamp(12px, 1.4vw, 16px); }
.clock {
  background: #fff; border: 3px solid var(--navy); border-radius: 10px;
  box-shadow: 6px 6px 0 rgba(5, 0, 56, 0.18);
  padding: 6px 14px 7px; text-align: right; min-width: 170px;
}
#clock-day { font-size: 13px; font-weight: 500; }
#clock-time { font-size: clamp(22px, 2.8vw, 32px); font-weight: 700; font-variant-numeric: tabular-nums; line-height: 1.05; }
#clock-meta { font-size: 13px; font-weight: 500; white-space: nowrap; }
#speed { font-variant-numeric: tabular-nums; color: var(--coral); font-weight: 700; }

/* ---------- meters ---------- */
.meters {
  position: absolute; left: 16px; top: 84px; display: flex; gap: 8px; pointer-events: none; flex-wrap: wrap;
  max-width: 60%;
}
.meter {
  background: #fff; border: 3px solid var(--navy); border-radius: 999px; padding: 3px 12px 4px;
  display: flex; gap: 6px; align-items: baseline; font-size: 12px;
}
.meter b { font-size: 16px; font-variant-numeric: tabular-nums; }

/* ---------- ticker ---------- */
.ticker {
  position: absolute; right: 16px; top: 128px; width: min(320px, 34vw);
  display: flex; flex-direction: column; gap: 5px; pointer-events: none;
}
.tick {
  background: rgba(255, 255, 255, 0.92); border: 2.5px solid var(--navy); border-radius: 8px;
  padding: 4px 9px 5px; font-size: 12.5px; line-height: 1.25;
  transform-origin: right center;
}
.tick b { font-weight: 700; }
.tick .k { display: inline-block; min-width: 8px; height: 8px; border-radius: 3px; border: 2px solid var(--navy); margin-right: 5px; vertical-align: 0; }
.tick.say { background: var(--yellow); }
.tick.limit { background: var(--coral); color: #fff; }
@keyframes pop { from { transform: scale(0.6) translateX(30px); opacity: 0; } to { transform: none; opacity: 1; } }

/* ---------- photo ---------- */
.photo {
  position: absolute; right: 16px; bottom: 78px; margin: 0;
  background: #fff; border: 3px solid var(--navy); border-radius: 6px; padding: 8px 8px 6px;
  box-shadow: 8px 8px 0 rgba(5, 0, 56, 0.2);
  width: min(330px, 44vw); transform-origin: 80% 100%;
}
.photo[hidden] { display: none; }
.photo img { display: block; width: 100%; max-height: 38vh; object-fit: contain; background: #f4f2fb; border: 2px solid var(--navy); }
.photo figcaption { font-size: 12px; padding-top: 5px; line-height: 1.25; }
.photo figcaption i { color: var(--coral); font-style: normal; font-weight: 700; }

/* ---------- skip ---------- */
.skip { position: absolute; inset: 0; display: grid; place-items: center; pointer-events: none; background: rgba(5, 0, 56, 0.28); transition: opacity .3s; }
.skip[hidden] { display: grid; opacity: 0; }
.skip-card {
  display: flex; gap: 16px; align-items: center; background: var(--yellow); border: 4px solid var(--navy);
  padding: 16px 26px; transform: rotate(-1.5deg); box-shadow: 10px 10px 0 rgba(5, 0, 56, 0.3);
}
.skip-card b { display: block; font-size: clamp(22px, 3vw, 34px); }
.skip-card span { display: block; font-size: 16px; font-weight: 500; }
.skip-clock { width: 64px; height: 64px; }
.skip-clock circle { fill: #fff; stroke: var(--navy); stroke-width: 4; }
.skip-clock line { stroke: var(--navy); stroke-width: 4; stroke-linecap: round; }

/* ---------- intro / outro card ---------- */
.card {
  position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%) rotate(-1deg);
  background: #fff; border: 4px solid var(--navy); box-shadow: 12px 12px 0 rgba(5, 0, 56, 0.25);
  padding: 22px 28px; width: min(640px, 88vw);
}
.card[hidden] { display: none; }
.card h2 { margin: 0 0 6px; font-size: clamp(24px, 3.4vw, 40px); }
.card p { margin: 6px 0; font-size: 16px; line-height: 1.4; }
.card .stats { display: flex; flex-wrap: wrap; gap: 8px; margin: 10px 0; }
.card .stats span { border: 3px solid var(--navy); border-radius: 999px; padding: 3px 12px; font-weight: 600; background: var(--lblue); }
.card img { width: 100%; border: 3px solid var(--navy); margin-top: 8px; max-height: 34vh; object-fit: cover; object-position: top; }
.card a { color: var(--blue); font-weight: 700; }

/* ---------- controls ---------- */
.controls {
  position: absolute; left: 12px; right: 12px; bottom: 12px; display: flex; gap: 8px; align-items: center;
}
.btn {
  font: 700 16px var(--hud-font); color: var(--navy); background: #fff; border: 3px solid var(--navy);
  border-radius: 10px; height: 44px; min-width: 44px; padding: 0 12px; cursor: pointer;
  box-shadow: 4px 4px 0 rgba(5, 0, 56, 0.2);
}
.btn:active { transform: translate(2px, 2px); box-shadow: 2px 2px 0 rgba(5, 0, 56, 0.2); }
.btn.small { font-size: 14px; }
.btn.on { background: var(--navy); color: #fff; }
.btn:focus-visible { outline: 3px solid var(--blue); outline-offset: 2px; }
.scrub {
  position: relative; flex: 1; height: 44px; background: #fff; border: 3px solid var(--navy); border-radius: 10px;
  overflow: hidden; cursor: pointer; box-shadow: 4px 4px 0 rgba(5, 0, 56, 0.2);
}
#scrub-canvas { width: 100%; height: 100%; display: block; }
.scrub-head { position: absolute; top: 0; bottom: 0; width: 3px; background: var(--coral); left: 0; box-shadow: 0 0 0 1.5px var(--navy); }
.video-link { position: absolute; left: 16px; bottom: 66px; margin: 0; font-size: 12px; font-weight: 600; }
.video-link a { color: var(--navy); }

.noscript { padding: 20px; }

/* ---------- small screens ---------- */
@media (max-width: 720px) {
  .hud-top { padding: 8px 10px; }
  .title h1 { font-size: 22px; }
  .title p { display: none; }
  .clock { min-width: 0; padding: 3px 9px 4px; box-shadow: 4px 4px 0 rgba(5, 0, 56, 0.18); }
  #clock-day { font-size: 11px; }
  #clock-time { font-size: 20px; }
  #clock-meta { font-size: 10.5px; max-width: 46vw; overflow: hidden; text-overflow: ellipsis; }
  .meters { top: 40px; left: 10px; max-width: 48vw; gap: 4px; }
  .meter { font-size: 10px; padding: 1px 7px 2px; border-width: 2px; gap: 4px; }
  .meter b { font-size: 12px; }
  .ticker { top: auto; bottom: 62px; right: 8px; width: 60vw; gap: 3px; }
  .tick { font-size: 10.5px; padding: 2px 6px 3px; border-width: 2px; }
  .tick:nth-child(n+4) { display: none; }
  .photo { right: auto; left: 8px; bottom: 62px; width: 34vw; padding: 3px; border-width: 2px; box-shadow: 4px 4px 0 rgba(5, 0, 56, 0.2); }
  .photo img { max-height: 24vh; }
  .photo figcaption { font-size: 9.5px; }
  .video-link { display: none; }
  .controls { left: 8px; right: 8px; bottom: 8px; gap: 5px; }
  .btn.small { padding: 0 8px; }
  .skip-card { padding: 10px 14px; gap: 10px; }
  .skip-clock { width: 44px; height: 44px; }
  .skip-card span { font-size: 13px; }
  .card { padding: 14px 16px; }
  .card p { font-size: 14px; }
  .card .stats span { font-size: 12px; padding: 2px 8px; }
}

/* Recording mode: no controls, nothing the viewer would click. */
.recording .controls, .recording .video-link { display: none; }
@media (min-width: 721px) {
  .recording .photo { bottom: 24px; }
}

