/* The habitat fills the page; the address and creature remain the experience. */
body:not(.fallback) {
  background: #080b14;
}
#habitat {
  position: fixed;
  inset: 0;
  background: radial-gradient(
    ellipse at 50% 48%,
    #193d40 0%,
    #132735 36%,
    #080f20 70%,
    #070b14 100%
  );
  overflow: hidden;
}
#habitat canvas {
  display: block;
  width: 100%;
  height: 100%;
  touch-action: none;
  cursor: grab;
}
#habitat canvas:active {
  cursor: grabbing;
}
body.habitat-ready #playground {
  display: none;
}
body:not(.fallback) .topbar {
  padding: 26px 34px;
}
body:not(.fallback) .scene-heading {
  top: 103px;
  left: 35px;
  transform: none;
  gap: 12px;
}
body:not(.fallback) .side-note {
  left: auto;
  right: 34px;
  top: 43%;
  transform: none;
  color: #8590a466;
  font-size: 8px;
}
body:not(.fallback) .intro {
  top: auto;
  bottom: 64px;
  left: 35px;
  right: 35px;
  text-align: left;
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: end;
  column-gap: 30px;
  row-gap: 12px;
  pointer-events: none;
}
body:not(.fallback) .intro > h2 {
  grid-column: 1;
  grid-row: 1 / 3;
  margin: 0;
  font-size: clamp(23px, 2.65vw, 37px);
  line-height: 1.13;
  font-weight: 500;
  letter-spacing: -1.15px;
}
body:not(.fallback) .intro > h2 em {
  display: block;
  color: #8793a9;
}
body:not(.fallback) .intro > .word-hint,
body:not(.fallback) .intro > .bug-hint {
  grid-column: 1;
  grid-row: 3;
  font-size: 11px;
  color: #8591a4;
}
body:not(.fallback) .controls {
  grid-column: 2;
  grid-row: 3;
  justify-content: flex-end;
  gap: 7px;
  margin: 0;
  width: auto;
}
body:not(.fallback) .controls button {
  height: 44px;
  border-radius: 7px;
  font-size: 11px;
}
body:not(.fallback) .controls .primary {
  padding: 0 16px;
}
body:not(.fallback) .controls .secondary {
  background: #162035c9;
  border-color: #35415866;
  padding: 0 13px;
}
body:not(.fallback) .controls .secondary[aria-pressed='true'] {
  color: var(--a);
  border-color: color-mix(in srgb, var(--a) 50%, transparent);
}
body:not(.fallback) #summon {
  display: none !important;
}
body:not(.fallback) .camera-reset {
  width: 44px;
  padding: 0 !important;
}
body:not(.fallback) .state-line {
  grid-column: 2;
  grid-row: 1;
  justify-content: flex-end;
  font-size: 8px;
  letter-spacing: 0.65px;
  color: #aab3c4;
}
body:not(.fallback) .instinct-line {
  grid-column: 2;
  grid-row: 2;
  justify-content: flex-end;
  font-size: 8px;
  margin: 0;
  gap: 16px;
  color: #8591a6;
}
body:not(.fallback) .sense-track {
  width: 40px;
  background: #35405a;
}
body:not(.fallback) .memory-note {
  position: absolute;
  right: 0;
  bottom: -23px;
  font:
    7px 'Space Mono',
    monospace;
  letter-spacing: 0.8px;
  color: #68798e;
  margin: 0;
  max-width: 400px;
}
body:not(.fallback) .footer {
  left: 35px;
  right: 35px;
  bottom: 21px;
  color: #536079;
}
body:not(.fallback) .footer-center {
  color: #4d5a70;
}
.habitat-landmarks {
  position: fixed;
  left: 35px;
  top: 145px;
  z-index: 11;
  display: flex;
  flex-direction: column;
  gap: 7px;
  align-items: flex-start;
  font:
    10px 'Space Mono',
    monospace;
}
.landmark-caption {
  font-size: 7px;
  letter-spacing: 1.3px;
  color: #58667e;
  margin-bottom: 7px;
}
.habitat-landmarks button {
  display: flex;
  align-items: center;
  gap: 9px;
  color: #aab8cb;
  background: #0d162378;
  border: 1px solid #45577233;
  border-radius: 5px;
  padding: 9px 10px;
  cursor: pointer;
  font:
    9px 'Space Mono',
    monospace;
  min-width: 148px;
  min-height: 35px;
  transition:
    color 0.2s,
    border-color 0.2s;
}
.habitat-landmarks button:hover,
.habitat-landmarks button[aria-pressed='true'] {
  color: #fff;
  border-color: #6e81a366;
}
.landmark-dot {
  width: 4px;
  height: 4px;
  border-radius: 50%;
  border: 1px solid var(--a);
}
.habitat-landmarks button[data-place='arches'] .landmark-dot {
  border-color: var(--d);
}
.habitat-landmarks button[data-place='pool'] .landmark-dot {
  border-color: var(--b);
}
.habitat-landmarks button[data-visited='true'] .landmark-dot {
  background: var(--a);
  box-shadow: 0 0 8px var(--a);
}
.habitat-landmarks button[data-visited='true'][data-place='arches'] .landmark-dot {
  background: var(--d);
  box-shadow: 0 0 8px var(--d);
}
.habitat-landmarks button[data-visited='true'][data-place='pool'] .landmark-dot {
  background: var(--b);
  box-shadow: 0 0 8px var(--b);
}
.landmark-symbol {
  margin-left: auto;
  color: var(--a);
  font:
    700 12px Arial,
    sans-serif;
  line-height: 1;
}
button[data-place='arches'] .landmark-symbol {
  color: var(--d);
}
button[data-place='pool'] .landmark-symbol {
  color: var(--b);
}
button:disabled {
  opacity: 0.5;
  cursor: wait;
}
.simple-link {
  font-size: 10px;
  pointer-events: auto;
  color: var(--b);
}
.bug-energy {
  position: absolute;
  left: 0;
  top: 0;
  z-index: 7;
  width: 76px;
  padding: 5px 6px 6px;
  border: 1px solid #9deccc65;
  border-radius: 5px;
  background: #071d24df;
  box-shadow: 0 3px 14px #0005;
  pointer-events: none;
  color: #d1fff1;
  backdrop-filter: blur(5px);
}
.bug-energy[hidden] {
  display: none !important;
}
.bug-energy-label {
  display: flex;
  justify-content: space-between;
  font:
    6px 'Space Mono',
    monospace;
  letter-spacing: 0.45px;
  margin-bottom: 4px;
}
.bug-energy-label b {
  font-weight: 400;
  color: var(--a);
  letter-spacing: 0;
}
.bug-energy-track {
  display: block;
  height: 3px;
  background: #375044;
  border-radius: 1px;
  overflow: hidden;
}
.bug-energy-track > span {
  display: block;
  height: 100%;
  background: var(--a);
  box-shadow: 0 0 6px var(--a);
}
.bug-energy[data-low='true'] .bug-energy-track > span {
  background: #ff955b;
}
.bug-energy[data-low='true'] b {
  color: #ff955b;
}
button[data-place='river'] .landmark-symbol,
button[data-place='falls'] .landmark-symbol {
  color: var(--b);
}
.fallback #habitat,
.fallback .habitat-landmarks,
.fallback .habitat-control,
.fallback .memory-note {
  display: none !important;
}
@media (max-width: 900px) and (min-width: 701px) {
  body:not(.fallback) .intro {
    left: 25px;
    right: 25px;
    column-gap: 16px;
  }
  body:not(.fallback) .controls {
    gap: 5px;
  }
  body:not(.fallback) .controls button {
    font-size: 10px;
  }
  body:not(.fallback) .controls .secondary {
    padding: 0 10px;
  }
  body:not(.fallback) .intro > h2 {
    font-size: 25px;
  }
}
@media (max-width: 700px) {
  body:not(.fallback) .topbar {
    padding: 20px;
  }
  body:not(.fallback) .live-label {
    font-size: 7px;
    letter-spacing: 0.7px;
  }
  body:not(.fallback) .scene-heading {
    top: 82px;
    left: 20px;
    gap: 10px;
  }
  body:not(.fallback) h1 {
    font-size: 8px;
    letter-spacing: 1.4px;
  }
  .habitat-landmarks {
    left: 20px;
    right: 20px;
    top: 111px;
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 6px;
  }
  .landmark-caption {
    display: none;
  }
  .habitat-landmarks button {
    min-width: 0;
    min-height: 36px;
    padding: 8px 9px;
    font-size: 8px;
    gap: 6px;
    white-space: nowrap;
  }
  .landmark-symbol {
    font-size: 11px;
    margin-left: 3px;
  }
  body:not(.fallback) .intro {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
    left: 20px;
    right: 20px;
    bottom: 56px;
    text-align: center;
  }
  body:not(.fallback) .intro > h2 {
    font-size: 23px;
    letter-spacing: -0.6px;
    line-height: 1.1;
    margin: 0;
  }
  body:not(.fallback) .intro > h2 em {
    display: inline;
  }
  body:not(.fallback) .intro > .word-hint,
  body:not(.fallback) .intro > .bug-hint {
    font-size: 10px;
    line-height: 1.6;
    max-width: 300px;
    margin: 0;
  }
  body:not(.fallback) .controls {
    order: 3;
    flex-wrap: wrap;
    justify-content: center;
    width: 100%;
    gap: 6px;
    max-width: 350px;
    margin: 2px 0;
  }
  body:not(.fallback) .controls button {
    height: 42px;
    font-size: 10px;
    gap: 7px;
  }
  body:not(.fallback) .controls .primary {
    flex-basis: auto;
    max-width: none;
    margin: 0;
    padding: 0 12px;
  }
  body:not(.fallback) .controls .secondary {
    padding: 0 11px;
  }
  body:not(.fallback) .camera-reset {
    width: 42px;
  }
  body:not(.fallback) .state-line {
    order: 4;
    justify-content: center;
    font-size: 7px;
    letter-spacing: 0.3px;
    gap: 6px;
  }
  body:not(.fallback) .instinct-line {
    order: 5;
    justify-content: center;
    font-size: 7px;
    gap: 12px;
    margin: 0;
  }
  body:not(.fallback) .sense-track {
    width: 26px;
  }
  body:not(.fallback) .memory-note {
    bottom: -20px;
    left: 0;
    right: 0;
    font-size: 6px;
    max-width: none;
    white-space: nowrap;
  }
  body:not(.fallback) .footer {
    left: 20px;
    right: 20px;
    bottom: 17px;
    font-size: 7px;
  }
}
@media (max-height: 500px) {
  body:not(.fallback) .topbar {
    padding: 14px 22px;
  }
  body:not(.fallback) .scene-heading {
    top: 67px;
    left: 22px;
  }
  .habitat-landmarks {
    left: 22px;
    top: 98px;
    gap: 4px;
    right: auto;
    display: flex;
    flex-direction: column;
  }
  .habitat-landmarks button {
    min-width: 135px;
    min-height: 27px;
    padding: 6px 9px;
    flex: none;
  }
  .landmark-caption {
    display: none;
  }
  body:not(.fallback) .intro {
    left: 22px;
    right: 22px;
    bottom: 32px;
    display: grid;
    grid-template-columns: 1fr auto;
    column-gap: 10px;
    row-gap: 7px;
    text-align: left;
  }
  body:not(.fallback) .intro > h2 {
    font-size: 20px;
    max-width: 210px;
    grid-row: 1 / 3;
  }
  body:not(.fallback) .intro > h2 em {
    display: block;
  }
  body:not(.fallback) .intro > .word-hint,
  body:not(.fallback) .intro > .bug-hint {
    display: none !important;
  }
  body:not(.fallback) .controls {
    grid-column: 2;
    grid-row: 3;
    flex-wrap: nowrap;
    max-width: none;
    width: auto;
    gap: 5px;
  }
  body:not(.fallback) .controls button {
    height: 35px;
    font-size: 9px;
    padding: 0 10px;
  }
  body:not(.fallback) .state-line {
    grid-column: 2;
    grid-row: 1;
    justify-content: flex-end;
  }
  body:not(.fallback) .instinct-line {
    grid-column: 2;
    grid-row: 2;
    justify-content: flex-end;
    font-size: 7px;
    gap: 10px;
  }
  body:not(.fallback) .memory-note {
    display: none;
  }
  body:not(.fallback) .footer {
    bottom: 10px;
    left: 22px;
    right: 22px;
  }
  body:not(.fallback) .camera-reset {
    width: 35px;
  }
}
@media (prefers-reduced-motion: reduce) {
  .habitat-landmarks button {
    transition: none;
  }
}
/* Colony edition: the habitat stays central while creature controls stay together. */
body:not(.fallback) {
  background: #162626;
}
#habitat {
  background: radial-gradient(
    ellipse at 48% 32%,
    #668580 0%,
    #3c5e60 33%,
    #203b43 64%,
    #10232e 100%
  );
}
body:not(.fallback) .intro {
  grid-template-columns: 1fr auto;
  row-gap: 10px;
  bottom: 67px;
}
body:not(.fallback) .intro > h2 {
  grid-row: 1 / 4;
  font-size: clamp(24px, 2.3vw, 33px);
  max-width: 350px;
  text-shadow: 0 2px 15px #0a1d26;
}
body:not(.fallback) .intro > h2 em {
  color: #b0c9c3;
}
body:not(.fallback) .intro > .word-hint,
body:not(.fallback) .intro > .bug-hint {
  grid-row: 4;
  color: #b0c0ba;
}
.colony-picker {
  grid-column: 2;
  grid-row: 1;
  display: flex;
  gap: 6px;
  justify-content: flex-end;
  pointer-events: auto;
}
.colony-picker button {
  font:
    9px 'Space Mono',
    monospace;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: 34px;
  padding: 7px 10px;
  background: #102b2acf;
  border: 1px solid #abc1ac40;
  border-radius: 5px;
  color: #c4d7cb;
  cursor: pointer;
}
.colony-picker b {
  font:
    700 15px Arial,
    sans-serif;
  color: #cfff68;
}
.colony-picker button:nth-child(2) b {
  color: #6de5ed;
}
.colony-picker button:nth-child(3) b {
  color: #b2a3ff;
}
.colony-picker button:nth-child(4) b {
  color: #ffbf72;
}
.colony-picker button:nth-child(5) b {
  color: #ff91bc;
}
.colony-picker button[aria-pressed='true'] {
  border-color: #c9efb9;
  background: #31523eef;
  color: #fff;
}
body:not(.fallback) .controls {
  grid-row: 2;
}
body:not(.fallback) .state-line {
  grid-row: 3;
  color: #d1dfd6;
  min-height: 12px;
}
body:not(.fallback) .instinct-line {
  grid-row: 4;
  color: #c2d0c3;
}
body:not(.fallback) .controls .secondary {
  background: #183332e3;
  border-color: #aac4ac40;
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
}
body:not(.fallback) #morph-toggle {
  padding: 0 10px;
}
body:not(.fallback) #morph-toggle svg {
  display: none;
}
body:not(.fallback) .memory-note {
  color: #bbd0c2;
  bottom: -22px;
  font-size: 7px;
}
.feed-note {
  grid-column: 1;
  grid-row: 5;
  font:
    7px 'Space Mono',
    monospace;
  letter-spacing: 1px;
  color: #c8e2ad;
  margin-top: 3px;
}
body:not(.fallback) .controls #feed-toggle {
  background: #d6eda3;
  color: #183225;
  border-color: #e2f4c0;
  box-shadow: 0 3px 20px #bee37620;
  font-weight: 700;
  min-width: 116px;
}
body:not(.fallback) .controls #feed-toggle:disabled {
  opacity: 0.75;
  cursor: default;
  background: #2a413c;
  color: #c4d2b9;
  border-color: #7e938a55;
  box-shadow: none;
}
.bug-energy {
  width: 62px;
  padding: 4px 5px;
  border-color: #cbe9b450;
  background: #10291dea;
  color: #edfff3;
  backdrop-filter: none;
}
.bug-energy-label {
  font-size: 7px;
  margin-bottom: 3px;
  letter-spacing: 0.2px;
}
.bug-energy-label b {
  color: var(--bug-color);
}
.bug-energy-track > span {
  background: var(--bug-color);
  box-shadow: none;
}
.bug-energy[data-selected='true'] {
  border-color: #efffc8cc;
  box-shadow: 0 0 0 1px #bddb6850;
}
.bug-energy[data-low='true'] .bug-energy-track > span {
  background: #ff955b;
}
body:not(.fallback) .footer {
  color: #91b0ad;
}
body:not(.fallback) .footer-center {
  color: #92aba2;
}
body:not(.fallback) .side-note {
  color: #aec8b944;
}
@media (max-width: 1100px) and (min-width: 701px) {
  body:not(.fallback) .intro {
    grid-template-columns: 1fr;
    left: 25px;
    right: 25px;
  }
  body:not(.fallback) .intro > h2 {
    font-size: 23px;
    grid-row: 1 / 3;
    max-width: 230px;
  }
  body:not(.fallback) .controls {
    flex-wrap: wrap;
    max-width: 540px;
  }
  body:not(.fallback) .intro > .bug-hint,
  body:not(.fallback) .intro > .word-hint {
    display: none !important;
  }
}
@media (max-width: 700px) {
  body:not(.fallback) .intro {
    display: flex;
    gap: 8px;
    bottom: 52px;
    left: 16px;
    right: 16px;
  }
  body:not(.fallback) .intro > h2 {
    font-size: 20px;
    max-width: none;
  }
  body[data-mode='bug']:not(.fallback) .intro > h2,
  body[data-mode='bug']:not(.fallback) .intro > .bug-hint {
    display: none;
  }
  .colony-picker {
    order: 1;
    gap: 5px;
    width: 100%;
    justify-content: center;
  }
  .colony-picker button {
    min-height: 34px;
    padding: 5px 7px;
    font-size: 8px;
    gap: 4px;
    flex: 1;
    max-width: 70px;
  }
  body:not(.fallback) .controls {
    order: 2;
    max-width: 440px;
    gap: 5px;
    row-gap: 6px;
  }
  body:not(.fallback) .controls button {
    height: 37px;
    font-size: 9px;
    padding: 0 10px;
  }
  body:not(.fallback) .controls #feed-toggle {
    min-width: 110px;
  }
  body:not(.fallback) .state-line {
    order: 3;
    font-size: 7px;
    min-height: 10px;
  }
  body:not(.fallback) .instinct-line {
    order: 4;
    font-size: 7px;
  }
  .feed-note {
    order: 5;
    margin: 0;
    font-size: 7px;
    letter-spacing: 0.6px;
  }
  body:not(.fallback) .memory-note {
    bottom: -17px;
    font-size: 6px;
  }
  .bug-energy {
    width: 54px;
  }
  .bug-energy-label {
    font-size: 6px;
  }
}
@media (max-height: 500px) {
  body:not(.fallback) .intro {
    display: grid;
    grid-template-columns: 1fr auto;
    left: 22px;
    right: 22px;
    bottom: 30px;
    gap: 6px;
  }
  body:not(.fallback) .intro > h2 {
    display: none !important;
  }
  .colony-picker {
    grid-column: 2;
    grid-row: 1;
    gap: 5px;
    justify-content: flex-end;
  }
  .colony-picker button {
    min-height: 28px;
    font-size: 8px;
    padding: 4px 8px;
    flex: none;
    max-width: none;
  }
  body:not(.fallback) .controls {
    grid-column: 2;
    grid-row: 2;
    max-width: none;
    flex-wrap: nowrap;
    width: auto;
  }
  body:not(.fallback) .controls button {
    height: 32px;
    font-size: 9px;
    padding: 0 8px;
  }
  body:not(.fallback) .controls #feed-toggle {
    min-width: 100px;
  }
  body:not(.fallback) .state-line {
    grid-column: 2;
    grid-row: 3;
    justify-content: flex-end;
  }
  body:not(.fallback) .instinct-line {
    display: none;
  }
  .feed-note {
    grid-column: 1;
    grid-row: 3;
    font-size: 6px;
  }
  body:not(.fallback) .memory-note {
    display: none;
  }
}
.bug-energy[data-compact='true'] {
  width: 42px;
  padding: 3px 4px;
}
.bug-energy[data-compact='true'] .bug-energy-label {
  font-size: 6px;
  margin-bottom: 2px;
}
.bug-energy[data-compact='true'] .bug-energy-track {
  height: 2px;
}

/* The nest camera observes work without changing a creature's destination. */
#nest-view {
  border-color: #c4d59b77;
  color: #e1ecc9;
}
.nest-count {
  margin-left: auto;
  font-size: 8px;
  color: #cce593;
  white-space: nowrap;
}
body:not(.fallback) .state-line {
  max-width: 100%;
  min-width: 0;
}
#scene-status {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 420px;
}
@media (max-width: 700px) {
  #scene-status {
    max-width: 240px;
  }
  .habitat-landmarks #nest-view {
    min-width: 144px;
  }
}

.weather-badge {
  position: fixed;
  right: 34px;
  top: 99px;
  z-index: 12;
  display: flex;
  align-items: center;
  gap: 10px;
  text-align: left;
  padding: 10px 14px;
  border: 1px solid #c5dfbc55;
  border-radius: 7px;
  background: #163431d9;
  color: #e1ecd7;
  cursor: pointer;
  font:
    9px 'Space Mono',
    monospace;
  min-height: 44px;
}
.weather-badge strong {
  display: block;
  font-size: 8px;
  letter-spacing: 1.1px;
  font-weight: 400;
  margin-bottom: 5px;
}
.weather-badge #weather-detail {
  font-size: 8px;
  color: #b8d1c9;
}
.weather-symbol {
  font:
    22px Georgia,
    serif;
  color: #cceaaf;
}
.weather-badge[aria-pressed='true'] {
  border-color: #d2eaaa;
}
body[data-weather='rain'] .weather-badge {
  background: #29434be8;
  border-color: #b7d7e0aa;
}
body[data-weather='rain'] .weather-symbol {
  color: #bfe7f2;
}
@media (max-width: 700px) {
  .weather-badge {
    top: 73px;
    right: 20px;
    padding: 6px 8px;
    gap: 7px;
    min-height: 32px;
  }
  .weather-badge strong {
    font-size: 6px;
    margin-bottom: 3px;
    letter-spacing: 0.5px;
  }
  .weather-badge #weather-detail {
    font-size: 6px;
  }
  .weather-symbol {
    font-size: 16px;
  }
  .habitat-landmarks {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
  .habitat-landmarks #nest-view {
    min-width: 0;
  }
  .habitat-landmarks button {
    font-size: 7px;
    padding: 7px 6px;
    gap: 4px;
  }
  .nest-count {
    font-size: 6px;
  }
}
@media (max-height: 500px) {
  .weather-badge {
    top: 53px;
    right: 22px;
    padding: 6px 9px;
    min-height: 32px;
  }
  .habitat-landmarks {
    display: grid;
    grid-template-columns: repeat(2, 130px);
    top: 96px;
    gap: 4px;
  }
  .habitat-landmarks button {
    min-width: 0;
    min-height: 25px;
    padding: 5px 7px;
    font-size: 7px;
  }
  .habitat-landmarks #nest-view {
    min-width: 0;
  }
  .nest-count {
    font-size: 6px;
  }
}
@media (min-width: 701px) and (min-height: 501px) and (max-height: 800px) {
  .habitat-landmarks {
    display: grid;
    grid-template-columns: repeat(2, 148px);
  }
  .landmark-caption {
    grid-column: 1/-1;
  }
  .habitat-landmarks #nest-view {
    min-width: 0;
  }
}

#visitor-view .visitor-dot {
  border-color: #dfbd78;
  background: #9a713e;
}
#visitor-view[aria-pressed='true'] {
  border-color: #cfb173;
  color: #ffe1a9;
}

.bug-reaction {
  display: block;
  margin-top: 4px;
  color: #edfff3;
  font:
    6px 'Space Mono',
    monospace;
  letter-spacing: 0;
  text-align: center;
  white-space: nowrap;
}
.bug-reaction[hidden] {
  display: none;
}
.bug-energy[data-reaction='guard'] {
  border-color: #f7c286;
}
.bug-energy[data-reaction='curious'] {
  border-color: #a9ecd9;
}

/* A small relationship note follows the selected creature between visits. */
.rumble-bond {
  grid-column: 2;
  grid-row: 5;
  justify-self: end;
  font:
    7px 'Space Mono',
    monospace;
  color: #dddfbc;
  letter-spacing: 0.4px;
  margin: 0;
  pointer-events: auto;
}
body[data-mode='word'] .rumble-bond,
.fallback .rumble-bond {
  display: none;
}
.bug-reaction {
  white-space: normal;
  line-height: 1.5;
  overflow-wrap: normal;
}
@media (max-width: 700px) {
  .rumble-bond {
    order: 5;
    align-self: center;
    font-size: 7px;
    letter-spacing: 0;
  }
  .feed-note {
    order: 6;
  }
}
@media (max-height: 500px) {
  .rumble-bond {
    grid-column: 2;
    grid-row: 4;
    justify-self: end;
    font-size: 6px;
  }
}

/* Names remain legible in both the close camera and the island overview. */
.bug-energy,
.bug-energy[data-compact='true'] {
  width: 106px;
  padding: 6px 7px;
  border-radius: 6px;
}
.bug-energy-label,
.bug-energy[data-compact='true'] .bug-energy-label {
  font:
    600 12px 'DM Sans',
    sans-serif;
  letter-spacing: 0;
  align-items: baseline;
  gap: 5px;
  margin-bottom: 3px;
}
.bug-energy-label b {
  font:
    8px 'Space Mono',
    monospace;
}
.bug-identity {
  display: block;
  font:
    8px 'DM Sans',
    sans-serif;
  color: #cfddd4;
  line-height: 1.3;
  white-space: nowrap;
  margin-bottom: 5px;
}
.bug-reaction {
  font-size: 8px;
  line-height: 1.2;
  margin-top: 5px;
}
.bug-energy[data-compact='true'] {
  width: 94px;
  padding: 5px 6px;
}
.bug-energy[data-compact='true'] .bug-energy-label {
  font-size: 10px;
}
.bug-energy[data-compact='true'] .bug-identity {
  font-size: 7px;
}
.bug-energy::after {
  content: '';
  position: absolute;
  left: 50%;
  top: 100%;
  height: var(--leader-length, 0px);
  width: 1px;
  background: var(--bug-color);
  opacity: 0.45;
  transform-origin: top;
  transform: rotate(var(--leader-angle, 0rad));
  pointer-events: none;
}
.character-note {
  grid-column: 2;
  grid-row: 2;
  justify-self: end;
  max-width: 550px;
  padding: 8px 11px;
  border-left: 2px solid #c7dc9d88;
  background: #102820d9;
  border-radius: 3px;
  line-height: 1.4;
  color: #dce7d9;
  text-align: right;
  pointer-events: none;
}
.character-note strong {
  display: block;
  font:
    500 12px 'DM Sans',
    sans-serif;
  color: #f2f5df;
  margin-bottom: 3px;
}
.character-note > span {
  display: block;
  font:
    10px/1.4 'DM Sans',
    sans-serif;
  max-width: 480px;
  color: #c6d6cb;
}
body[data-mode='word'] .character-note,
.fallback .character-note {
  display: none;
}
body:not(.fallback) .controls {
  grid-row: 3;
}
body:not(.fallback) .state-line {
  grid-row: 4;
}
body:not(.fallback) .instinct-line {
  grid-row: 5;
}
.rumble-bond {
  grid-row: 6;
}
.feed-note {
  grid-row: 6;
}
@media (max-width: 700px) {
  .bug-energy,
  .bug-energy[data-compact='true'] {
    width: 96px;
    padding: 5px 6px;
  }
  .bug-energy-label,
  .bug-energy[data-compact='true'] .bug-energy-label {
    font-size: 11px;
  }
  .bug-identity,
  .bug-energy[data-compact='true'] .bug-identity {
    font-size: 8px;
  }
  .character-note {
    order: 2;
    align-self: center;
    text-align: center;
    max-width: 358px;
    padding: 6px 9px;
  }
  .character-note strong {
    font-size: 11px;
  }
  .character-note > span {
    font-size: 10px;
  }
  body:not(.fallback) .controls {
    order: 3;
  }
  body:not(.fallback) .state-line {
    order: 4;
  }
  body:not(.fallback) .instinct-line {
    order: 5;
  }
  .rumble-bond {
    order: 6;
  }
  .feed-note {
    order: 7;
  }
}
@media (max-height: 500px) {
  .character-note {
    grid-column: 2;
    grid-row: 2;
    padding: 4px 8px;
    max-width: 460px;
  }
  .character-note strong {
    font-size: 11px;
    margin: 0;
  }
  .character-note > span {
    display: none;
  }
  body:not(.fallback) .controls {
    grid-row: 3;
  }
  body:not(.fallback) .state-line {
    grid-row: 4;
  }
  .rumble-bond {
    grid-row: 5;
  }
  .feed-note {
    grid-row: 5;
  }
}

/* Inspect a selected bug's four bonds without covering the island by default. */
body[data-neighbor-view='true'] #friendship-details,
body[data-neighbor-view='true'] .instinct-line,
body[data-neighbor-view='true'] .rumble-bond,
body[data-neighbor-view='true'] .memory-note {
  display: none;
}
.character-note {
  position: relative;
}
#friendship-details {
  pointer-events: auto;
  margin-top: 5px;
  font:
    10px/1.4 'DM Sans',
    sans-serif;
}
#friendship-summary {
  color: #dcedb9;
  cursor: pointer;
  min-height: 24px;
  padding: 3px 0;
  list-style-position: inside;
}
#friendship-summary:focus-visible {
  outline: 2px solid #e7f8a9;
  outline-offset: 3px;
}
#friendship-panel {
  position: absolute;
  right: 0;
  bottom: 100%;
  width: min(300px, calc(100vw - 40px));
  max-height: 55vh;
  overflow: auto;
  padding: 12px;
  background: #112c27fa;
  border: 1px solid #8fa991;
  border-radius: 8px;
  box-shadow: 0 8px 30px #0007;
  text-align: left;
  color: #dcebd7;
  z-index: 30;
}
#friendship-panel p {
  font:
    10px/1.45 'DM Sans',
    sans-serif;
  margin: 0 0 9px;
  color: #b6ccbd;
}
.friend-row {
  padding: 8px 0;
  border-top: 1px solid #b5d3aa24;
}
.friend-row > span:first-child {
  display: flex;
  justify-content: space-between;
  gap: 12px;
}
.friend-row b {
  font-weight: 600;
}
.friend-row em {
  font-style: normal;
  font-size: 10px;
  color: #d8e7b6;
}
.friend-meter {
  display: block;
  height: 3px;
  background: #375248;
  margin: 5px 0;
  border-radius: 3px;
  overflow: hidden;
}
.friend-meter i {
  display: block;
  height: 100%;
  background: #d4e9a8;
}
.friend-row small {
  display: block;
  font-size: 9px;
  color: #bbcec4;
  line-height: 1.5;
}
.bug-energy[data-reaction='friend'] {
  border-color: #d3e5a8;
}
@media (max-width: 700px) {
  #friendship-summary {
    font-size: 10px;
  }
  #friendship-panel {
    right: 50%;
    transform: translateX(50%);
    max-height: max(145px, calc(100dvh - 625px));
  }
}
@media (max-height: 500px) {
  #friendship-summary {
    font-size: 9px;
    min-height: 18px;
    padding: 0;
  }
  #friendship-details {
    margin-top: 2px;
  }
  #friendship-panel {
    max-height: 48vh;
  }
}

.friend-row[data-strained='true'] em {
  color: #f1b592;
}
.friend-row[data-strained='true'] .friend-meter i {
  background: #d9946e;
}
.bug-energy[data-reaction='wary'] {
  border-color: #efb183;
}
.bug-feeling {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 3px;
  height: 28px;
  margin: 1px 0 4px;
  pointer-events: none;
}
.bug-feeling[hidden] {
  display: none;
}
.bug-feeling > span {
  display: none;
  width: 22px;
  height: 22px;
  flex: none;
  transform-origin: center;
  will-change: transform, opacity;
}
.bug-feeling > span.feeling-small {
  width: 16px;
  height: 16px;
}
.bug-feeling svg {
  display: block;
  width: 100%;
  height: 100%;
  overflow: visible;
}
.bug-energy[data-feeling='friendly'] .feeling-heart {
  display: block;
  color: #ff91bd;
  filter: drop-shadow(0 0 2px #ef579359);
}
.bug-energy[data-feeling='annoyed'] .feeling-annoyed {
  display: block;
  color: #ffc177;
  filter: drop-shadow(0 0 1px #e7743255);
}
.bug-energy[data-feeling='friendly'] {
  border-color: #ffb3d1b5;
}
.bug-energy[data-feeling='annoyed'] {
  border-color: #ffc177cb;
}

/* New colony views observe autonomous gift picking and delivery. */
.neighbor-tag {
  border-color: #d6cba577;
  background: #273425ed;
}
.neighbor-tag .bug-identity {
  white-space: normal;
}
.neighbor-heart {
  display: none;
  text-align: center;
  color: #ff9fc7;
  font:
    23px/1.1 Georgia,
    serif;
}
.neighbor-tag[data-warm='true'] .neighbor-heart {
  display: block;
}
.neighbor-tag[data-warm='true'] {
  border-color: #f3abc7;
}
#com-view,
#spiders-view,
#gifts-view {
  border-color: #bdcb9877;
  color: #e9e7c6;
}
@media (min-height: 501px) and (min-width: 701px) {
  .habitat-landmarks {
    max-height: calc(100vh - 420px);
    overflow-y: auto;
    padding-right: 8px;
    scrollbar-width: thin;
  }
}
@media (max-width: 700px) {
  .habitat-landmarks {
    display: flex;
    flex-direction: row;
    overflow-x: auto;
    flex-wrap: nowrap;
    padding-bottom: 7px;
    scrollbar-width: thin;
    scroll-snap-type: x proximity;
  }
  .habitat-landmarks button {
    flex: 0 0 auto;
    min-width: 105px !important;
    min-height: 37px;
    scroll-snap-align: start;
  }
  .neighbor-tag {
    max-width: 100px;
  }
}
@media (max-height: 500px) {
  .habitat-landmarks {
    display: flex;
    flex-direction: row;
    left: 22px;
    right: 190px;
    top: 92px;
    flex-wrap: nowrap;
    overflow-x: auto;
    max-height: 43px;
    padding-bottom: 6px;
    scrollbar-width: thin;
  }
  .habitat-landmarks button {
    flex: 0 0 auto;
    min-width: 108px !important;
    min-height: 30px;
  }
}

/* Switch colonies without squeezing nine names into a phone toolbar. */
.colony-picker {
  flex-wrap: wrap;
  max-width: 440px;
  justify-self: end;
}
.colony-tabs {
  display: flex;
  justify-content: flex-end;
  gap: 6px;
  flex-basis: 100%;
}
.colony-tabs button {
  min-height: 27px;
  padding: 4px 10px;
  font-size: 9px;
  color: #c4d0c1;
  background: #142f2a;
  max-width: none;
}
.colony-picker button[hidden] {
  display: none !important;
}
.colony-picker [data-bug] b {
  color: var(--letter-color, #cfff68);
}
.colony-picker [data-bug='two1'] {
  --letter-color: #6de5ed;
}
.colony-picker [data-bug='v2'] {
  --letter-color: #b2a3ff;
}
.colony-picker [data-bug='two2'] {
  --letter-color: #ffbf72;
}
.colony-picker [data-bug='v3'] {
  --letter-color: #ff91bc;
}
.colony-picker [data-bug='dot'] {
  --letter-color: #f5d687;
}
.colony-picker [data-bug='curl'] {
  --letter-color: #8adfc9;
}
.colony-picker [data-bug='orbit'] {
  --letter-color: #b6c9fb;
}
.colony-picker [data-bug='mica'] {
  --letter-color: #eeab96;
}
#friendship-panel .rival-heading {
  margin: 12px 0 4px;
  color: #efce9b;
  font-weight: bold;
}
.rival-row {
  border-color: #e1bc8d33;
}
@media (max-width: 700px) {
  .colony-picker {
    max-width: none;
  }
  .colony-tabs {
    justify-content: center;
  }
  .colony-tabs button {
    flex: 0 1 160px;
    max-width: 160px;
    min-height: 28px;
  }
  .neighbor-tag {
    max-width: 114px;
  }
}
@media (max-height: 500px) {
  .colony-tabs button {
    min-height: 24px;
    padding: 2px 8px;
  }
  .colony-picker {
    gap: 3px;
  }
}

/* The meal tally lives inside the existing character note, leaving the island open. */
#feast-tally[hidden] {
  display: none;
}
#feast-tally {
  margin-top: 7px;
  min-width: 230px;
  text-align: left;
  font:
    10px/1.4 'DM Sans',
    sans-serif;
}
.feast-numbers {
  display: flex;
  justify-content: space-between;
  gap: 22px;
  color: #ceeaa5;
}
.feast-numbers > span:last-child {
  color: #f5d39b;
}
.feast-numbers b {
  font-variant-numeric: tabular-nums;
  color: #f3f3df;
}
.feast-meter {
  display: flex;
  height: 4px;
  border-radius: 4px;
  background: #6d807138;
  overflow: hidden;
  margin: 5px 0;
}
.feast-meter i {
  display: block;
  height: 100%;
  background: #c6e68c;
}
.feast-meter i:last-child {
  background: #e8bc78;
}
#feast-support {
  display: block;
  font-size: 9px;
  color: #cbdbd1;
  max-width: 420px;
  line-height: 1.4;
}
#feast-view {
  pointer-events: auto;
  display: block;
  margin: 5px 0 0 auto;
  padding: 5px 9px;
  min-height: 28px;
  background: #213f32;
  border: 1px solid #b7cd9870;
  border-radius: 4px;
  color: #e2ebc9;
  cursor: pointer;
  font:
    10px 'DM Sans',
    sans-serif;
}
body[data-feasting='true'] #friendship-details {
  display: none;
}
@media (max-width: 700px) {
  #feast-tally {
    min-width: 250px;
    max-width: 330px;
  }
  #feast-support {
    font-size: 9px;
  }
  #feast-view {
    min-height: 32px;
  }
  .feast-numbers {
    font-size: 10px;
  }
}
@media (max-height: 500px) {
  #feast-tally {
    margin-top: 4px;
    min-width: 270px;
  }
  #feast-support {
    font-size: 8px;
    max-width: 300px;
  }
  #feast-view {
    position: absolute;
    left: -100px;
    bottom: 0;
    min-height: 30px;
    margin: 0;
  }
  .feast-meter {
    margin: 3px 0;
  }
}

@media (max-width: 700px) {
  body[data-feasting='true'] .bug-energy,
  body[data-feasting='true'] .bug-energy[data-compact='true'] {
    width: 76px;
    padding: 4px 5px;
  }
  body[data-feasting='true'] .bug-energy-label,
  body[data-feasting='true'] .bug-energy[data-compact='true'] .bug-energy-label {
    font-size: 10px;
  }
  body[data-feasting='true'] .bug-energy .bug-identity,
  body[data-feasting='true'] .bug-energy[role='progressbar'] .bug-reaction {
    display: none;
  }
  body[data-feasting='true'] .neighbor-tag:not([role='progressbar']) .bug-reaction {
    font-size: 7px;
  }
  body[data-feasting='true'] .bug-feeling {
    height: 17px;
    margin: 0 0 2px;
  }
  body[data-feasting='true'] .bug-feeling > span {
    width: 16px;
    height: 16px;
  }
  body[data-feasting='true'] .bug-feeling > .feeling-small {
    width: 12px;
    height: 12px;
  }
  body[data-feasting='true'] .character-note > span,
  body[data-feasting='true'] .instinct-line,
  body[data-feasting='true'] .rumble-bond,
  body[data-feasting='true'] .feed-note {
    display: none;
  }
  body[data-feasting='true'] .character-note {
    align-self: stretch;
    padding: 6px 9px;
  }
  body[data-feasting='true'] #feast-tally {
    position: relative;
    max-width: none;
    padding-bottom: 0;
    margin-top: 4px;
  }
  body[data-feasting='true'] #feast-support {
    padding-right: 84px;
    min-height: 28px;
    font-size: 8px;
  }
  body[data-feasting='true'] #feast-view {
    position: absolute;
    right: 0;
    bottom: 0;
    min-height: 30px;
    padding: 4px 6px;
    font-size: 9px;
  }
}

#feast-view[hidden] {
  display: none;
}
@media (max-width: 700px), (max-height: 500px) {
  body[data-aftermeal='true'] .bug-energy[data-feeling='friendly'],
  body[data-aftermeal='true'] .bug-energy[data-feeling='annoyed'] {
    width: 98px;
  }
  body[data-aftermeal='true'] .bug-energy[data-feeling='friendly'] .bug-reaction,
  body[data-aftermeal='true'] .bug-energy[data-feeling='annoyed'] .bug-reaction {
    display: block;
    font-size: 8px;
    line-height: 1.2;
    margin-top: 3px;
  }
}
