#studio[data-neighborhood] > :not(#neighborhood) { visibility: hidden; }
#studio[data-public-plot] #together-open { display: none; }
#public-plot-keep, #public-plot-reload { pointer-events: auto; }

#neighborhood {
  --street-paper: var(--surface);
  --street-ink: var(--ink);
  --street-edge: var(--line);
  --street-status-offset: 53px;
  position: fixed;
  inset: 0;
  z-index: 5;
  isolation: isolate;
  overflow: hidden;
  background: #92818d;
  color: var(--street-ink);
}
#street-view, #street-signs { position: absolute; inset: 0; }
#street-view { cursor: grab; touch-action: none; }
#street-view:active { cursor: grabbing; }
#street-view:focus-visible { outline-offset: -4px; }
#street-view canvas { display: block; width: 100%; height: 100%; }
#street-signs { pointer-events: none; }
.street-sign {
  position: absolute;
  left: 0;
  top: 0;
  max-width: 155px;
  min-height: 44px;
  padding: 5px 11px;
  overflow: hidden;
  text-overflow: ellipsis;
  background: var(--street-paper);
  border-color: var(--street-edge);
  border-radius: var(--radius-control);
  box-shadow: var(--shadow-control);
  font-size: .8125rem;
  font-weight: 660;
  pointer-events: auto;
}

.street-header, .street-footer {
  position: absolute;
  left: max(20px,env(safe-area-inset-left));
  right: max(20px,env(safe-area-inset-right));
  display: flex;
  pointer-events: none;
}
.street-header {
  top: max(16px,env(safe-area-inset-top));
  align-items: flex-start;
  justify-content: space-between;
  gap: 9px;
}
.street-header h1 {
  display: flex;
  align-items: center;
  gap: 9px;
  margin: 0;
  min-height: 44px;
  padding: 6px 13px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: var(--surface);
  color: var(--ink);
  box-shadow: var(--shadow-float);
  white-space: nowrap;
  font-size: 1.05rem;
  font-weight: 680;
  letter-spacing: -.03em;
}
.street-nav { display: flex; align-items: center; gap: 7px; pointer-events: auto; }
.street-nav button { box-shadow: var(--shadow-control); }
.street-footer {
  bottom: max(16px,env(safe-area-inset-bottom));
  align-items: flex-end;
  justify-content: space-between;
  gap: 8px;
}
#street-directory {
  flex: none;
  margin-inline-start: auto;
  pointer-events: auto;
  box-shadow: var(--shadow-control);
}
.street-touch-hint, #street-stick { display: none; }
@media (pointer: coarse) {
  .street-touch-hint { display: inline; }
  .street-key-hint { display: none; }
}

#street-plaque {
  position: absolute;
  bottom: max(74px,calc(env(safe-area-inset-bottom) + 64px));
  left: max(20px,env(safe-area-inset-left));
  max-height: calc(100% - 125px);
  overflow-y: auto;
  padding: 15px 16px;
  border: 1px solid var(--street-edge);
  border-radius: var(--radius-card);
  background: var(--street-paper);
  box-shadow: var(--shadow-float);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  width: min(395px,calc(100% - 40px));
}
#street-plaque h2, .street-dialog-head h2 {
  margin: 0;
  font-size: 1.2rem;
  font-weight: 680;
  letter-spacing: -.025em;
  overflow-wrap: anywhere;
}
#street-plot-info { margin-top: 4px; font-size: .9rem; color: var(--muted); overflow-wrap: anywhere; }
.street-actions { display: flex; gap: 6px; flex-wrap: wrap; justify-content: end; }
#street-plaque[data-open-plot] { display: grid; }
#street-plaque[data-open-plot] .street-actions { justify-content: start; }
#street-controls, #street-status:not(:empty) {
  border: 1px solid var(--street-edge);
  border-radius: 9px;
  padding: 7px 10px;
  background: var(--street-paper);
  font-size: .875rem;
  box-shadow: var(--shadow-control);
}
#street-controls { transition: opacity .24s ease; }
@media (prefers-reduced-motion: reduce) {
  #street-controls { transition: none; }
}
#street-status {
  position: absolute;
  top: max(calc(var(--street-status-offset) + 19px),calc(env(safe-area-inset-top) + var(--street-status-offset)));
  left: max(12px,env(safe-area-inset-left));
  right: auto;
  max-width: calc(100% - 24px);
  margin: 0;
  pointer-events: none;
}
#street-status:empty { display: none; }
#street-status:not(:empty) ~ #street-tip { visibility: hidden; }
#street-tip {
  top: max(calc(var(--street-status-offset) + 19px),calc(env(safe-area-inset-top) + var(--street-status-offset)));
  left: max(12px,env(safe-area-inset-left));
}
#neighborhood[data-character] :is(.street-nav,#street-signs,#street-status,#street-plaque,.street-footer,#street-tip) {
  visibility: hidden;
}
.street-dialog {
  width: min(480px,calc(100% - 24px));
  max-height: calc(100dvh - 24px);
  margin: auto;
  border-color: var(--street-edge);
  background: var(--street-paper);
  color: var(--street-ink);
}
.street-dialog[open] { display: flex; flex-direction: column; overflow: hidden; }
.street-dialog-head {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 9px;
  padding: 11px 15px;
  border-bottom: 1px solid var(--line);
}
.street-dialog-body {
  min-height: 0;
  overflow: auto;
  display: grid;
  gap: 12px;
  padding: 15px;
}
#street-character { inset: auto 0 max(22px,env(safe-area-inset-bottom)); width: min(390px,calc(100% - 24px)); }
#street-character::backdrop { background: transparent; }
.character-card { display: grid; justify-items: center; gap: 9px; padding: 16px 18px; text-align: center; }
.character-card h2 { margin: 0; font-size: 1.35rem; font-weight: 680; letter-spacing: -.025em; }
.character-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 9px; width: 100%; }
#street-character-look { font-size: .93rem; color: var(--muted); }
#street-list {
  inset: auto max(20px,env(safe-area-inset-right)) max(16px,env(safe-area-inset-bottom)) auto;
  margin: 0;
  max-height: min(690px,calc(100dvh - 28px));
}
#street-list-items { gap: 14px; }
#street-list-items section {
  display: grid;
  grid-template-columns: repeat(2,minmax(0,1fr));
  gap: 6px;
}
#street-list-items h3 { grid-column: 1 / -1; margin: 0; font-size: .875rem; }
#street-list-items button { text-align: left; white-space: normal; overflow-wrap: anywhere; }
#street-list-items small { display: block; color: var(--muted); font-size: .84rem; }
.street-list-nav { padding: 10px 14px 0; }
.street-list-nav p { margin: 0 0 6px; font-size: .875rem; color: var(--muted); }
.street-list-nav div { display: flex; flex-wrap: wrap; gap: 6px; }
.street-list-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  padding: 8px 15px;
  border-top: 1px solid var(--street-edge);
}
@media (max-width: 550px) {
  .street-header, .street-footer { left: max(8px,env(safe-area-inset-left)); right: max(8px,env(safe-area-inset-right)); }
  .street-header { top: max(8px,env(safe-area-inset-top)); gap: 5px; }
  .street-nav { gap: 5px; }
  .street-nav button { padding-inline: 7px; }
  .street-header h1 { min-height: 44px; font-size: .98rem; padding-inline: 7px; }
  .street-footer { bottom: max(8px,env(safe-area-inset-bottom)); flex-wrap: wrap; }
  #street-plaque {
    bottom: max(62px,calc(env(safe-area-inset-bottom) + 55px));
    left: max(8px,env(safe-area-inset-left));
    width: min(345px,calc(100% - 16px));
    padding: 9px 10px;
    gap: 6px;
  }
  #street-plaque h2 { font-size: 1.22rem; }
  #street-plaque button { padding-inline: 8px; }
  #street-controls { margin-left: 0; }
}
@media (orientation:landscape) and (max-height:430px) {
  #street-character { inset: auto max(12px,env(safe-area-inset-right)) max(12px,env(safe-area-inset-bottom)) auto; width: min(260px,46vw); }
  .character-card { gap: 6px; padding: 11px; }
  .character-card h2 { font-size: 1.3rem; }
  .character-actions { gap: 5px; }
  .character-actions button { padding-inline: 5px; }
  #street-plaque { max-width: min(365px,49vw); }
}
@media (orientation:landscape) and (max-height:425px) {
  #street-plaque { padding: 9px 11px; }
  #street-plaque h2 { font-size: 1.14rem; }
  .street-dialog-body { gap: 7px; padding-block: 8px; }
}
@media (pointer: coarse) {
  #neighborhood {
    --street-stick-size: 96px;
    --street-touch-bottom: max(12px,calc(env(safe-area-inset-bottom) + 8px));
    --street-touch-left: max(14px,calc(env(safe-area-inset-left) + 8px));
    --street-touch-right: max(14px,calc(env(safe-area-inset-right) + 8px));
  }
  .street-footer {
    bottom: var(--street-touch-bottom);
    left: var(--street-touch-left);
    right: var(--street-touch-right);
    flex-wrap: nowrap;
  }
  #street-stick:not([hidden]) {
    display: grid;
    place-items: center;
    flex: 0 0 var(--street-stick-size);
    height: var(--street-stick-size);
    border: 1px solid var(--primary-edge);
    border-radius: 50%;
    background:
      linear-gradient(var(--primary-edge),var(--primary-edge)) center 6px / 2px 7px no-repeat,
      linear-gradient(var(--primary-edge),var(--primary-edge)) center bottom 6px / 2px 7px no-repeat,
      linear-gradient(var(--primary-edge),var(--primary-edge)) left 6px center / 7px 2px no-repeat,
      linear-gradient(var(--primary-edge),var(--primary-edge)) right 6px center / 7px 2px no-repeat,
      #ffffffeb;
    box-shadow: 0 3px 12px #22382133;
    pointer-events: auto;
    touch-action: none;
    user-select: none;
    -webkit-user-select: none;
    -webkit-touch-callout: none;
  }
  #street-stick span {
    display: grid;
    place-items: center;
    width: 45%;
    aspect-ratio: 1;
    border: 1px solid var(--primary);
    border-radius: 50%;
    background: var(--primary);
    color: var(--surface);
    font-size: .8rem;
    font-weight: 650;
    box-shadow: 0 2px 4px #22382140;
    transform: translate(var(--walk-x,0px),var(--walk-y,0px));
    pointer-events: none;
  }
  #street-stick[data-steering] span { background: var(--primary-hover); }
  #street-controls { line-height: 1.25; }
  #neighborhood[data-navigation-learned] #street-controls { opacity: 0; }
  #neighborhood:has(#street-stick:not([hidden])) #street-plaque {
    bottom: calc(var(--street-touch-bottom) + 52px);
    left: auto;
    right: var(--street-touch-right);
    width: min(395px,calc(100% - var(--street-touch-left) - var(--street-stick-size) - 10px - var(--street-touch-right)));
  }
  #neighborhood:has(#street-stick:not([hidden])):has(#street-plaque:not([hidden])) #street-controls {
    visibility: hidden;
  }
}
@media (pointer: coarse) and (max-width: 900px) {
  #street-list {
    inset: auto 0 0;
    width: min(540px,100%);
    max-width: 100%;
    margin-inline: auto;
    padding-bottom: env(safe-area-inset-bottom);
    border-end-start-radius: 0;
    border-end-end-radius: 0;
  }
}
@media (pointer: coarse) and (max-width: 550px) {
  #neighborhood:has(#street-stick:not([hidden])) #street-plaque {
    flex-direction: column;
    align-items: flex-start;
  }
  #neighborhood:has(#street-stick:not([hidden])) #street-plaque .street-actions {
    flex-direction: row;
    justify-content: flex-start;
  }
}
@media (pointer: coarse) and (orientation: landscape) and (max-height: 460px) {
  #neighborhood { --street-stick-size: 84px; }
}

#street-signs .street-sign[data-drawing] { border-color: var(--primary-edge); background: var(--primary-wash); }
#street-signs .street-sign[data-drawing]::before {
  content: '';
  display: inline-block;
  width: .55rem;
  height: .55rem;
  margin-inline-end: .36rem;
  border-radius: 50%;
  background: #478260;
}
