@import url('https://fonts.googleapis.com/css2?family=IBM+Plex+Serif:wght@400;500;600;700&family=IBM+Plex+Mono:wght@400;500;600&display=swap');

:root {
  --ink: #12140f;
  --paper: #f7f6f1;
  --white: #fffefa;
  --muted: #62645c;
  --line: #d8d8cf;
  --acid: #a6e22e;
  --acid-dark: #548a08;
  --cyan: #0b8897;
  --orange: #ed6b2f;
  --dark: #11130f;
  --dark-soft: #1b1e17;
  --mono: "IBM Plex Mono", "SFMono-Regular", Consolas, monospace;
  --sans: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --serif: "IBM Plex Serif", Georgia, "Times New Roman", serif;
}

* { box-sizing: border-box; }

html, body {
  width: 100%;
  height: 100%;
  margin: 0;
  overflow: hidden;
  color: var(--ink);
  background: var(--paper);
  font-family: var(--sans);
}

::selection { color: var(--ink); background: var(--acid); }

.funding-ribbon {
  position: fixed;
  top: 28px;
  right: -62px;
  z-index: 100;
  width: 230px;
  padding: 9px 12px 7px;
  transform: rotate(45deg);
  color: var(--ink);
  border: 1px solid var(--ink);
  background: var(--acid);
  box-shadow: 0 2px 0 var(--ink);
  font: 600 10px/1.35 var(--mono);
  letter-spacing: .035em;
  text-align: center;
  text-decoration: none;
  text-transform: uppercase;
}
.funding-ribbon:hover { color: var(--white); background: var(--orange); }

.app-shell {
  display: grid;
  grid-template-rows: auto auto minmax(0, 1fr) auto;
  gap: 8px;
  width: min(1440px, calc(100% - 28px));
  height: 100dvh;
  margin: 0 auto;
  padding: 12px 0 8px;
}

.masthead, .panel-heading, .metrics, .footer, .stream-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.masthead {
  position: relative;
  min-height: 90px;
  overflow: hidden;
  border-bottom: 1px solid var(--ink);
}

.brand { position: relative; z-index: 2; margin-left: 104px; color: var(--ink); text-decoration: none; }
.brand:hover .eyebrow { color: var(--cyan); }

.eyebrow, .kicker, .metric-label, .panel-note, .leader-rank,
.leader-score, .event-delta, .event-detail, .bubble-rate, .footer {
  font-family: var(--mono);
}

.eyebrow, .kicker {
  display: block;
  color: var(--acid-dark);
  font-size: 10px;
  font-weight: 600;
  letter-spacing: .015em;
  text-transform: uppercase;
}

.eyebrow::before, .kicker::before { content: "// "; color: var(--orange); }

.site-title {
  display: block;
  margin: -1px 0 -2px;
  font-size: clamp(32px, 4.1vw, 53px);
  font-weight: 900;
  letter-spacing: -.065em;
  line-height: .88;
}

.dek { color: var(--muted); font: 13px/1.3 var(--serif); }

.mascot {
  position: absolute;
  top: 4px;
  left: 0;
  z-index: 0;
  width: 82px;
  height: 82px;
  object-fit: contain;
  pointer-events: none;
}

.connection-card {
  position: relative;
  z-index: 2;
  min-width: 88px;
  margin-right: 108px;
  padding: 9px 12px;
  color: var(--white);
  border: 1px solid var(--ink);
  background: var(--ink);
  text-align: center;
}

.connection-status {
  color: #ff8a55;
  font: 600 11px/1 var(--mono);
  letter-spacing: .08em;
  text-transform: uppercase;
}

.connection-status.is-live { color: var(--acid); }
.connection-status.is-resting { color: #ffd37a; }
.winding-status {
  display: block;
  margin-top: 5px;
  color: #c5c8be;
  font: 500 7px/1.25 var(--mono);
  text-transform: uppercase;
  white-space: nowrap;
}
.viewer-link {
  display: block;
  margin-top: 4px;
  color: #41c4d1;
  font: 500 7px/1.25 var(--mono);
  text-decoration-color: rgba(65, 196, 209, .45);
  text-underline-offset: 2px;
  white-space: nowrap;
}
.viewer-link:hover { color: var(--acid); }
.rewind-button {
  margin-top: 5px;
  padding: 3px 6px;
  color: var(--ink);
  border: 1px solid var(--acid);
  border-radius: 0;
  background: var(--acid);
  font: 700 7px/1 var(--mono);
  letter-spacing: .025em;
  text-transform: uppercase;
  cursor: pointer;
}
.rewind-button:hover { background: var(--white); }

.metrics {
  min-height: 52px;
  color: var(--white);
  background: var(--dark);
  border: 1px solid var(--dark);
}

.metric {
  display: flex;
  min-width: 0;
  height: 100%;
  flex: 1;
  align-items: baseline;
  gap: 10px;
  padding: 10px 18px;
  border-right: 1px solid #373a32;
}
.metric:last-child { border-right: 0; }
.metric-value { color: var(--acid); font: 600 22px/1 var(--mono); }
.metric:nth-child(2) .metric-value { color: #41c4d1; }
.metric:nth-child(3) .metric-value { color: #ff8a55; }
.metric-label { overflow: hidden; color: #c5c8be; font-size: 9px; text-overflow: ellipsis; text-transform: uppercase; white-space: nowrap; }

.dashboard {
  display: grid;
  min-height: 0;
  grid-template-columns: minmax(350px, .78fr) minmax(500px, 1.22fr);
  gap: 8px;
}

.panel {
  min-width: 0;
  min-height: 0;
  overflow: hidden;
  border: 1px solid var(--ink);
  background: var(--white);
}

.panel-heading {
  min-height: 62px;
  padding: 10px 15px;
  border-bottom: 1px solid var(--ink);
}
.panel-title { display: block; margin-top: 1px; font-size: 20px; font-weight: 830; letter-spacing: -.035em; }
.panel-note { color: var(--muted); font-size: 8px; }

.leaderboard-panel { display: flex; flex-direction: column; }
.leader-list {
  min-height: 0;
  flex: 1;
  overflow-x: hidden;
  overflow-y: auto;
  padding: 0 14px;
  scrollbar-color: var(--acid-dark) var(--paper);
  scrollbar-width: thin;
}
.leader-list::-webkit-scrollbar { width: 8px; }
.leader-list::-webkit-scrollbar-track { background: var(--paper); border-left: 1px solid var(--line); }
.leader-list::-webkit-scrollbar-thumb { background: var(--acid-dark); border: 2px solid var(--paper); }
.leader-row {
  display: grid;
  min-height: 38px;
  grid-template-columns: 24px minmax(0, 1fr) 67px;
  gap: 9px;
  align-items: center;
  border-bottom: 1px solid var(--line);
}
.leader-row:last-child { border-bottom: 0; }
.leader-rank, .leader-score { color: var(--muted); font-size: 9px; }
.leader-score { text-align: right; }
.leader-name { display: block; overflow: hidden; font-size: 11px; font-weight: 750; text-overflow: ellipsis; white-space: nowrap; }
.leader-track { height: 3px; margin-top: 4px; overflow: hidden; background: #e5e6de; }
.leader-bar { height: 100%; background: var(--acid-dark); transition: width .35s ease; }

.activity-panel {
  display: grid;
  grid-template-rows: 62px minmax(0, .72fr) 40px minmax(0, 1.28fr);
}

.constellation {
  position: relative;
  display: grid;
  min-height: 0;
  overflow: hidden;
  padding: 8px 14px;
  grid-template-columns: repeat(8, minmax(58px, 1fr));
  gap: 5px;
  align-items: center;
  background:
    linear-gradient(90deg, transparent 49.9%, rgba(18, 20, 15, .06) 50%, transparent 50.1%),
    linear-gradient(0deg, transparent 49.9%, rgba(18, 20, 15, .06) 50%, transparent 50.1%),
    var(--paper);
}
.wiki-bubble {
  --level: .5;
  --tilt: 0deg;
  display: flex;
  width: clamp(42px, 5.2vw, 72px);
  max-width: 100%;
  aspect-ratio: .78;
  min-width: 0;
  z-index: 1;
  transform: rotate(var(--tilt)) scale(calc(.68 + var(--level) * .32));
  flex-direction: column;
  align-items: center;
  justify-self: center;
  justify-content: center;
  border: 1px solid var(--ink);
  border-radius: 50% 50% 46% 54% / 58% 58% 42% 42%;
  background: rgba(166, 226, 46, calc(.12 + var(--level) * .52));
  cursor: pointer;
  transition: transform .35s ease, background .35s ease;
}
.wiki-bubble:hover { filter: brightness(.96); box-shadow: 0 0 0 3px rgba(166, 226, 46, .28); }
.wiki-bubble:focus-visible { outline: 3px solid var(--cyan); outline-offset: 3px; }
.wiki-bubble:nth-child(3n+2) { background-color: rgba(65, 196, 209, calc(.1 + var(--level) * .34)); }
.wiki-bubble:nth-child(4n) { background-color: rgba(237, 107, 47, calc(.08 + var(--level) * .28)); }
.wiki-bubble:nth-child(1) { --tilt: -2deg; border-radius: 47% 53% 49% 51% / 60% 57% 43% 40%; }
.wiki-bubble:nth-child(2) { --tilt: 1deg; border-radius: 52% 48% 46% 54% / 56% 61% 44% 39%; }
.wiki-bubble:nth-child(3) { --tilt: -1deg; border-radius: 49% 51% 54% 46% / 62% 56% 38% 44%; }
.wiki-bubble:nth-child(4) { --tilt: 2deg; border-radius: 54% 46% 48% 52% / 59% 63% 41% 37%; }
.wiki-bubble:nth-child(5) { --tilt: -3deg; border-radius: 46% 54% 52% 48% / 64% 57% 36% 43%; }
.wiki-bubble:nth-child(6) { --tilt: 1.5deg; border-radius: 51% 49% 45% 55% / 57% 62% 43% 38%; }
.wiki-bubble:nth-child(7) { --tilt: -.5deg; border-radius: 48% 52% 55% 45% / 61% 55% 39% 45%; }
.wiki-bubble:nth-child(8) { --tilt: 2.5deg; border-radius: 53% 47% 50% 50% / 55% 64% 45% 36%; }
.bubble-name { max-width: 84%; overflow: hidden; font-size: 9px; font-weight: 800; text-overflow: ellipsis; white-space: nowrap; }
.bubble-rate { margin-top: 1px; color: var(--muted); font-size: 7px; }

.stream-heading {
  position: relative;
  z-index: 2;
  min-height: 40px;
  padding: 7px 15px;
  border-top: 1px solid var(--ink);
  border-bottom: 1px solid var(--line);
  background: var(--white);
}
.stream-heading .kicker { font-size: 12px; }
.stream-caption { color: var(--muted); font: 11px var(--serif); }
.event-list { display: grid; min-height: 0; padding: 0 14px; grid-template-rows: repeat(5, minmax(0, 1fr)); }
.event-row {
  display: grid;
  min-height: 0;
  grid-template-columns: 54px minmax(0, 1fr);
  gap: 8px;
  align-items: center;
  border-bottom: 1px solid var(--line);
}
.event-row:last-child { border-bottom: 0; }
.event-delta { color: var(--acid-dark); font-size: 12px; font-weight: 600; }
.event-minus .event-delta { color: var(--orange); }
.event-neutral .event-delta { color: var(--muted); }
.event-copy { min-width: 0; }
.event-title { display: block; overflow: hidden; font-size: 14px; font-weight: 750; text-overflow: ellipsis; white-space: nowrap; }
.event-detail { display: block; overflow: hidden; color: var(--muted); font-size: 10px; line-height: 1.3; text-overflow: ellipsis; white-space: nowrap; }

.footer { min-height: 13px; color: var(--muted); font-size: 8px; }

.egg-details-backdrop {
  position: fixed;
  inset: 0;
  z-index: 180;
  display: grid;
  place-items: center;
  padding: 24px;
  background: rgba(18, 20, 15, .22);
}
.egg-details-window {
  width: min(560px, 100%);
  max-height: min(680px, calc(100dvh - 48px));
  overflow: auto;
  padding: 20px;
  border: 1px solid var(--ink);
  background: rgba(255, 254, 250, .97);
  box-shadow: 8px 8px 0 var(--dark);
}
.egg-details-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
  padding-bottom: 13px;
  border-bottom: 1px solid var(--ink);
}
.egg-details-title {
  display: block;
  margin-top: 3px;
  font-size: clamp(27px, 5vw, 42px);
  font-weight: 900;
  letter-spacing: -.055em;
  line-height: .95;
}
.egg-details-close {
  flex: 0 0 auto;
  padding: 8px 10px;
  color: var(--white);
  border: 1px solid var(--ink);
  border-radius: 0;
  background: var(--ink);
  font: 600 9px/1 var(--mono);
  letter-spacing: .04em;
  text-transform: uppercase;
  cursor: pointer;
}
.egg-details-close:hover { color: var(--ink); background: var(--acid); }
.egg-details-state {
  display: block;
  margin-top: 13px;
  color: var(--acid-dark);
  font: 600 10px/1.3 var(--mono);
  text-transform: uppercase;
}
.egg-details-state.is-waiting { color: var(--orange); }
.egg-details-domain {
  display: block;
  margin-top: 4px;
  color: var(--muted);
  font: 13px/1.4 var(--serif);
}
.egg-details-facts {
  display: grid;
  margin: 18px 0;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  border-top: 1px solid var(--line);
  border-left: 1px solid var(--line);
}
.egg-details-fact {
  min-width: 0;
  padding: 13px;
  border-right: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}
.egg-details-value {
  display: block;
  overflow: hidden;
  color: var(--cyan);
  font: 700 22px/1 var(--mono);
  text-overflow: ellipsis;
  white-space: nowrap;
}
.egg-details-label {
  display: block;
  margin-top: 5px;
  color: var(--muted);
  font: 8px/1.25 var(--mono);
  text-transform: uppercase;
}
.egg-details-explanation {
  display: block;
  color: var(--ink);
  font: 15px/1.55 var(--serif);
}

.tired-backdrop {
  position: fixed;
  inset: 0;
  z-index: 220;
  display: grid;
  place-items: center;
  padding: 24px;
  background: rgba(18, 20, 15, .72);
}
.tired-window {
  display: grid;
  width: min(680px, 100%);
  overflow: hidden;
  grid-template-columns: minmax(170px, .75fr) minmax(280px, 1.25fr);
  border: 1px solid var(--ink);
  background: var(--white);
  box-shadow: 9px 9px 0 var(--acid);
}
.tired-chicken {
  width: 100%;
  height: 100%;
  min-height: 290px;
  object-fit: contain;
  background: var(--paper);
}
.tired-copy { align-self: center; padding: 28px; }
.tired-title {
  display: block;
  margin: 5px 0 12px;
  font-size: clamp(30px, 5vw, 48px);
  font-weight: 900;
  letter-spacing: -.055em;
  line-height: .95;
}
.tired-message { display: block; color: var(--muted); font: 15px/1.5 var(--serif); }
.wake-button {
  margin-top: 20px;
  padding: 12px 16px;
  color: var(--ink);
  border: 1px solid var(--ink);
  border-radius: 0;
  background: var(--acid);
  box-shadow: 3px 3px 0 var(--ink);
  font: 700 11px/1 var(--mono);
  letter-spacing: .03em;
  text-transform: uppercase;
  cursor: pointer;
}
.wake-button:hover { color: var(--white); background: var(--orange); }

@media (max-height: 760px) and (min-width: 761px) {
  .app-shell { gap: 5px; padding: 7px 0 5px; }
  .masthead { min-height: 70px; }
  .site-title { font-size: 34px; }
  .dek { font-size: 11px; }
  .mascot { top: 4px; width: 62px; height: 62px; }
  .brand { margin-left: 76px; }
  .metrics { min-height: 43px; }
  .metric { padding: 7px 14px; }
  .metric-value { font-size: 18px; }
  .panel-heading { min-height: 49px; padding: 6px 12px; }
  .panel-title { font-size: 17px; }
  .activity-panel { grid-template-rows: 49px minmax(0, .72fr) 36px minmax(0, 1.28fr); }
  .stream-heading { min-height: 36px; padding-top: 5px; padding-bottom: 5px; }
}

@media (max-width: 760px) {
  html, body { height: auto; overflow: auto; }
  .app-shell { width: min(100% - 18px, 620px); height: auto; min-height: 100dvh; }
  .masthead { min-height: 82px; }
  .site-title { font-size: 35px; }
  .dek { max-width: 310px; font-size: 10px; }
  .mascot { top: 13px; width: 54px; height: 54px; }
  .brand { margin-left: 64px; }
  .connection-card { margin-right: 80px; }
  .metrics { align-items: stretch; }
  .metric { flex-direction: column; gap: 3px; padding: 8px; }
  .metric-value { font-size: 16px; }
  .dashboard { grid-template-columns: 1fr; }
  .leaderboard-panel { min-height: 470px; }
  .activity-panel {
    min-height: 680px;
    grid-template-rows: 62px 260px 40px minmax(280px, 1fr);
  }
  .constellation { grid-template-columns: repeat(4, minmax(58px, 1fr)); }
  .wiki-bubble { width: min(88px, 20vw); }
  .egg-details-backdrop { padding: 14px; }
  .egg-details-window { max-height: calc(100dvh - 28px); padding: 15px; box-shadow: 5px 5px 0 var(--dark); }
  .tired-backdrop { padding: 14px; }
  .tired-window { grid-template-columns: 1fr; }
  .tired-chicken { display: none; }
  .tired-copy { padding: 24px; }
}
