/* A single flow layout owns the header, QA notice and action dock. Native
   runtime styles can load later; scoped overrides keep their old coordinates
   from separating controls into overlapping fixed layers. */
#tvdb-hud-layout-r1 {
  position: absolute;
  top: max(12px, env(safe-area-inset-top));
  left: max(12px, env(safe-area-inset-left));
  right: max(12px, env(safe-area-inset-right));
  z-index: 1210;
  display: grid;
  gap: 7px;
  pointer-events: none;
}
#tvdb-hud-layout-r1 [hidden] {display: none !important;}
/* The station owner mounts its optional CSS after the farm can be ready.
   Suppress its camera fallbacks as soon as their native primary exists, even
   during that request. An absent primary keeps the fallback action visible. */
#aquaculture-station-hud:has(> #aquaculture-station-open:not([hidden])) #fish-pond-go,
#aquaculture-station-hud.aq-station-has-livestock:has(> #livestock-shop-open:not([hidden])) #livestock-go,
#aquaculture-station-hud:not(.aq-station-has-livestock) #livestock-shop-open {display: none !important;}
#aquaculture-station-hud:not(:has(> #aquaculture-station-open:not([hidden]))) #fish-pond-go:not([hidden]),
#aquaculture-station-hud:not(:has(> #livestock-shop-open:not([hidden]))) #livestock-go:not([hidden]) {display: inline-flex !important;}
/* Before the dock exists, the native zone control already handles locked
   entrances and delegates owned areas to the shop. Keep that one action until
   the dock adopts its owners; a hidden/missing fallback leaves the shop alone. */
body:not(:has(#aquaculture-station-hud)):has(#app:not([hidden]) > #ui:not([hidden]) > .livestock-nav:not([hidden]) > #livestock-go:not([hidden])) > #livestock-shop-open:not([hidden]) {display: none !important;}
#tvdb-hud-layout-r1 .topbar {
  position: static !important;
  inset: auto !important;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  min-width: 0;
}
#tvdb-hud-layout-r1 .brand {flex: none;}
#tvdb-hud-layout-r1 .top-actions {
  min-width: 0;
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 7px;
  align-items: center;
}
#tvdb-hud-layout-r1 .account-top-button,
#tvdb-hud-layout-r1 .shop-button {
  position: static !important;
  inset: auto !important;
  min-height: 44px;
  height: 44px;
  flex: none;
}
#tvdb-hud-layout-r1 .wallet {flex: none; height: 44px;}
#tvdb-hud-layout-r1 .level-chip {min-height: 44px; flex: none;}
#tvdb-hud-layout-r1 .tvdb-hud-meta-r1 {
  display: flex;
  justify-content: flex-end;
  align-items: flex-start;
  gap: 8px;
  min-width: 0;
}
#tvdb-hud-layout-r1 .guide {
  position: static !important;
  inset: auto !important;
  max-width: min(430px, 100%);
  margin: 0 auto 0 0;
  min-height: 0;
}
#tvdb-hud-layout-r1 .qa-mode-badge {
  position: static !important;
  inset: auto !important;
  flex: none;
  min-height: 25px;
  justify-content: center;
  padding: 5px 9px;
}
#tvdb-hud-layout-r1 .tvdb-hud-meta-r1:empty {display: none;}
#tvdb-hud-layout-r1 #aquaculture-station-hud {
  position: static !important;
  inset: auto !important;
  width: auto !important;
  max-width: none !important;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-end;
  gap: 6px;
  grid-template-columns: none;
}
#tvdb-hud-layout-r1 .tvdb-hud-robots-r1 {
  order: 0;
  display: flex;
  justify-content: flex-end;
  align-items: stretch;
  gap: 6px;
  min-width: 0;
}
#tvdb-hud-layout-r1 .robot-hud-r22,
#tvdb-hud-layout-r1 .aq-robot-hud,
#tvdb-hud-layout-r1 .lv-robot-hud {
  position: static !important;
  inset: auto !important;
  display: flex;
  align-items: center;
  gap: 7px;
  min-height: 44px;
  min-width: 0;
  max-width: 210px;
  padding: 5px 10px;
  border: 1px solid #bdd0b9;
  border-radius: 13px;
  color: #30523e;
  background: #f7faf0f5;
  font: 750 13px/1.2 system-ui,sans-serif;
  text-align: left;
  cursor: pointer;
  pointer-events: auto;
}
#tvdb-hud-layout-r1 .robot-hud-r22 img,
#tvdb-hud-layout-r1 .aq-robot-hud img,
#tvdb-hud-layout-r1 .lv-robot-hud img {width: 32px; height: 34px; object-fit: contain; flex: none;}
#tvdb-hud-layout-r1 .robot-hud-r22 span,
#tvdb-hud-layout-r1 .aq-robot-hud span,
#tvdb-hud-layout-r1 .lv-robot-hud span {display: grid; gap: 2px; min-width: 0;}
#tvdb-hud-layout-r1 .robot-hud-r22 small,
#tvdb-hud-layout-r1 .aq-robot-hud small,
#tvdb-hud-layout-r1 .lv-robot-hud small {display: block; font-size: 10px; font-weight: 500; white-space: normal; overflow-wrap: anywhere;}
#tvdb-hud-layout-r1 .tool-shop-open-r20 {
  position: static !important;
  inset: auto !important;
  order: 3;
  min-height: 44px;
  height: 44px;
  pointer-events: auto;
}
#tvdb-hud-layout-r1 #aquaculture-station-hud .aq-game-navigation {
  position: static !important;
  inset: auto !important;
  order: 4;
  width: auto;
  display: flex;
  gap: 6px;
  margin: 0;
  max-width: none;
}
#tvdb-hud-layout-r1 #aquaculture-station-hud button {
  min-width: 44px;
  min-height: 44px;
  touch-action: manipulation;
}
#tvdb-hud-layout-r1 button:focus-visible {outline: 3px solid #328775; outline-offset: 2px;}

@media (max-width: 1050px) {
  #tvdb-hud-layout-r1 .brand {max-width: 260px;}
  #tvdb-hud-layout-r1 .brand h1 {font-size: 17px;}
  #tvdb-hud-layout-r1 .wallet strong {font-size: 18px;}
}
@media (max-width: 800px) {
  #tvdb-hud-layout-r1 .brand {display: none;}
  #tvdb-hud-layout-r1 .top-actions {width: 100%;}
}
@media (max-width: 700px), (max-height: 500px) {
  #tvdb-hud-layout-r1 {gap: 5px;}
  #tvdb-hud-layout-r1 .brand {display: none;}
  #tvdb-hud-layout-r1 .top-actions {width: 100%; flex-wrap: nowrap;}
  #tvdb-hud-layout-r1 .account-top-button,
  #tvdb-hud-layout-r1 .shop-button {width: 44px; padding: 0; border-radius: 13px;}
  #tvdb-hud-layout-r1 .account-top-button {font-size: 0;}
  #tvdb-hud-layout-r1 .account-top-button::before {
    content: '';
    display: block;
    width: 23px;
    height: 23px;
    background: currentColor;
    -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M12 2a5 5 0 1 0 0 10 5 5 0 0 0 0-10ZM4 22v-3a8 8 0 0 1 16 0v3h-2v-3a6 6 0 0 0-12 0v3Z'/%3E%3C/svg%3E") center/contain no-repeat;
    mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M12 2a5 5 0 1 0 0 10 5 5 0 0 0 0-10ZM4 22v-3a8 8 0 0 1 16 0v3h-2v-3a6 6 0 0 0-12 0v3Z'/%3E%3C/svg%3E") center/contain no-repeat;
  }
  #tvdb-hud-layout-r1 .wallet {padding: 7px 10px; flex: 1 1 auto; min-width: 0; height: auto; min-height: 44px; justify-content: center; overflow: visible;}
  #tvdb-hud-layout-r1 .wallet > span {display: none;}
  #tvdb-hud-layout-r1 .wallet strong {min-width: 0; font-size: 18px; line-height: 1.15; white-space: normal; overflow-wrap: anywhere; text-align: center;}
  #tvdb-hud-layout-r1 .wallet svg {width: 19px; height: 19px;}
  #tvdb-hud-layout-r1 .level-chip {min-width: 74px; max-width: 110px; padding: 6px 9px;}
  #tvdb-hud-layout-r1 .level-chip strong {font-size: 13px;}
  #tvdb-hud-layout-r1 .level-chip span {font-size: 10px;}
  #tvdb-hud-layout-r1 .guide {max-width: none; width: 100%; padding: 9px 10px;}
  #tvdb-hud-layout-r1 .tvdb-hud-meta-r1 {flex-wrap: wrap; gap: 5px;}
  #tvdb-hud-layout-r1 .qa-mode-badge {margin-left: auto;}
  #tvdb-hud-layout-r1 #aquaculture-station-hud {gap: 6px;}
  #tvdb-hud-layout-r1 #aquaculture-station-hud .aq-game-navigation {display: contents;}
  #tvdb-hud-layout-r1 #aquaculture-station-open,
  #tvdb-hud-layout-r1 #livestock-shop-open,
  #tvdb-hud-layout-r1 #livestock-go,
  #tvdb-hud-layout-r1 #livestock-overview {
    width: 44px;
    height: 44px;
    padding: 0;
    font-size: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
  }
  #tvdb-hud-layout-r1 #aquaculture-station-open::before {content: '🐟'; font-size: 23px;}
  #tvdb-hud-layout-r1 #livestock-shop-open::before,
  #tvdb-hud-layout-r1 #livestock-go::before {content: '🐮'; font-size: 23px;}
  #tvdb-hud-layout-r1 #livestock-overview::before {content: '⌖'; font: 28px/1 system-ui,sans-serif;}
  #tvdb-hud-layout-r1 .tool-shop-open-r20 {width: 44px; padding: 0;}
  #tvdb-hud-layout-r1 .tool-shop-open-r20 span {display: none;}
  #tvdb-hud-layout-r1 .tool-shop-open-r20 img {display: block; width: 28px; height: 28px;}
  #tvdb-hud-layout-r1 #aquaculture-station-hud #pet-open {width: 44px; height: 44px; padding: 0;}
  #tvdb-hud-layout-r1 #aquaculture-station-hud #pet-open .pet-quick-label {display: none !important;}
  #tvdb-hud-layout-r1 #aquaculture-station-hud #pet-open .pet-paw {font-size: 22px;}
}
@media (max-width: 700px) and (min-height: 501px) {
  #tvdb-hud-layout-r1 .tvdb-hud-robots-r1 {flex: 0 0 100%;}
  #tvdb-hud-layout-r1 .robot-hud-r22,
  #tvdb-hud-layout-r1 .aq-robot-hud,
#tvdb-hud-layout-r1 .lv-robot-hud {flex: 1 1 0; max-width: 210px; font-size: 12px; padding: 5px 8px;}
}
@media (max-width: 360px) {
  #tvdb-hud-layout-r1 {left: max(8px, env(safe-area-inset-left)); right: max(8px, env(safe-area-inset-right));}
  #tvdb-hud-layout-r1 .top-actions {gap: 5px;}
  #tvdb-hud-layout-r1 .level-chip {max-width: 82px; padding: 5px 7px;}
  #tvdb-hud-layout-r1 .wallet {padding: 7px 6px; gap: 4px;}
  #tvdb-hud-layout-r1 .wallet strong {font-size: 16px;}
  #tvdb-hud-layout-r1 .robot-hud-r22 img,
  #tvdb-hud-layout-r1 .aq-robot-hud img,
#tvdb-hud-layout-r1 .lv-robot-hud img {width: 27px; height: 31px;}
  #tvdb-hud-layout-r1 .robot-hud-r22,
  #tvdb-hud-layout-r1 .aq-robot-hud,
#tvdb-hud-layout-r1 .lv-robot-hud {gap: 4px; padding: 5px 6px; font-size: 11px;}
  #tvdb-hud-layout-r1 .robot-hud-r22 small,
  #tvdb-hud-layout-r1 .aq-robot-hud small,
#tvdb-hud-layout-r1 .lv-robot-hud small {font-size: 9px;}
}
@media (max-width: 370px) {
  /* Full balances share their own row at the narrowest sizes. The native
     formatted value is never replaced, compacted or clipped by this patch. */
  #tvdb-hud-layout-r1 .top-actions {display: grid; grid-template-columns: minmax(0, 1fr) 44px 44px; align-items: center;}
  #tvdb-hud-layout-r1 .level-chip {grid-column: 1; grid-row: 1; max-width: none; justify-self: stretch;}
  #tvdb-hud-layout-r1 .account-top-button {grid-column: 2; grid-row: 1;}
  #tvdb-hud-layout-r1 .shop-button {grid-column: 3; grid-row: 1;}
  #tvdb-hud-layout-r1 .wallet {grid-column: 1 / -1; grid-row: 2; width: 100%;}
}

#tvdb-hud-layout-r1 .tvdb-hud-robots-r1{max-width:100%;flex-wrap:wrap}
#tvdb-hud-layout-r1 .lv-robot-hud{background:#fff6e7f5;border-color:#d8bd8e;color:#715631}
@media(max-width:700px),(max-height:500px){#tvdb-hud-layout-r1 .tvdb-hud-robots-r1{flex:0 0 100%;flex-wrap:nowrap}#tvdb-hud-layout-r1 .robot-hud-r22,#tvdb-hud-layout-r1 .aq-robot-hud,#tvdb-hud-layout-r1 .lv-robot-hud{flex:1 1 0;max-width:none;font-size:11px;gap:4px;padding:5px 6px}#tvdb-hud-layout-r1 .robot-hud-r22 img,#tvdb-hud-layout-r1 .aq-robot-hud img,#tvdb-hud-layout-r1 .lv-robot-hud img{width:25px;height:30px}#tvdb-hud-layout-r1 .tvdb-hud-robots-r1 b{overflow-wrap:anywhere}}

/* R14: the lazy social panel has its own always-present HUD entry. */
#social-open.social-top-button-r14 {position:static !important;inset:auto !important;min-height:44px;height:44px;flex:none;border:1px solid #b4c99a;border-radius:13px;background:#f2f8e8;color:#426331;font:700 13px system-ui,sans-serif;padding:0 12px;cursor:pointer;}
#social-open.social-top-button-r14:disabled {opacity:.6;cursor:wait;}
@media(max-width:700px),(max-height:500px){#social-open.social-top-button-r14{width:44px;padding:0;font-size:0;}#social-open.social-top-button-r14::before{content:'👥';font-size:23px;}}
@media(max-width:370px){#tvdb-hud-layout-r1 .top-actions{grid-template-columns:minmax(0,1fr) 44px 44px 44px;}#tvdb-hud-layout-r1 #social-open{grid-column:3;grid-row:1;}#tvdb-hud-layout-r1 .shop-button{grid-column:4;grid-row:1;}}
