#labels .helper-label, .mv-labels .helper-label, .local-guide-label {
  background: #fff1d5;
  color: #4e250e;
  border: 2px solid #ca5b1d;
  font-weight: 800;
  box-shadow: 0 2px 8px #271a1450;
}
dialog:is(#panel, #mine-helper-dialog) {
  --reader-unit: 1rem;
  --reader-text: calc(var(--reader-unit) * 1.125);
  --reader-button: calc(var(--reader-unit) * 1.0625);
  --reader-hit: calc(var(--reader-unit) * 3);
  --reader-edge: .75rem;
  box-sizing: border-box;
  max-block-size: min(89dvh, calc(100dvh - 2 * var(--reader-edge)));
  overflow: auto;
  overscroll-behavior: contain;
  scroll-padding-block: calc(var(--reader-hit) + .4rem) .75rem;
  font-size: var(--reader-text);
  line-height: 1.5;
  overflow-wrap: anywhere;
}
dialog#panel:where(:has(.helper-chat, .helper-directory, .dodo-dialog)),
dialog#mine-helper-dialog {
  width: min(42rem, calc(100% - 2 * var(--reader-edge)));
  max-width: calc(100% - 2 * var(--reader-edge));
  padding: clamp(.9rem, 3vw, 1.65rem);
}
dialog:is(#panel, #mine-helper-dialog) h2 {
  font-size: calc(var(--reader-unit) * 1.85);
  letter-spacing: -.025em;
  line-height: 1.15;
}
#panel h3 { font-size: calc(var(--reader-unit) * 1.35); line-height: 1.25; }
:is(#panel, #mine-helper-dialog) .eyebrow {
  font-size: calc(var(--reader-unit) * .81);
  letter-spacing: .09em;
  color: #785033;
}
#panel :where(p, li, label),
#mine-helper-dialog .helper-chat p {
  font-size: var(--reader-text);
  line-height: 1.55;
  color: #385044;
}
#panel :where(.primary, .secondary, .dodo-questions button, .helper-directory button, .helper-directory a) {
  min-height: var(--reader-hit);
  font-size: var(--reader-button);
  line-height: 1.3;
}
dialog:is(#panel, #mine-helper-dialog)[open] {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
}
#panel-content, #mine-helper-dialog > div,
#panel > .close, #mine-helper-dialog > .mine-helper-close { grid-area: 1 / 1; }
#panel-content > :is(h2, .eyebrow):first-child,
#panel-content > .eyebrow:first-child + h2,
.helper-directory > :is(.eyebrow, h2),
.helper-intro, .helper-chat .eyebrow { padding-inline-end: calc(var(--reader-hit) + .4em); }
#panel > .close, #mine-helper-dialog > .mine-helper-close {
  position: sticky;
  top: 0;
  right: auto;
  z-index: 2;
  align-self: start;
  justify-self: end;
  width: var(--reader-hit);
  height: var(--reader-hit);
  min-height: var(--reader-hit);
  font-size: calc(var(--reader-unit) * 1.65);
  line-height: 1;
  color: #315a43;
  background: #e5efda;
}
.helper-chat { display: grid; gap: .68em; color: #243e35; }
:is(#panel, #mine-helper-dialog) .helper-chat :is(h2, p) { margin: 0; }
:is(#panel, #mine-helper-dialog) .helper-chat h2 { color: #1d4538; }
.helper-intro { display: flex; align-items: center; gap: .65em; }
:is(#panel, #mine-helper-dialog) .helper-area { font-weight: 750; color: #594833; }
.helper-emblem {
  display: grid; place-items: center; flex: 0 0 2.5em; height: 2.5em;
  border: 2px solid #e0a36f; border-radius: .5em; font-size: 1.25em; background: #ffe8c4;
}
.helper-questions, .helper-games, .helper-actions {
  display: flex; flex-wrap: wrap; align-items: stretch; gap: .4em;
}
.helper-questions, .helper-games {
  display: grid; grid-template-columns: repeat(2, minmax(0, 1fr));
}
.helper-questions button, .helper-games button, .helper-actions button {
  min-width: 0; min-height: var(--reader-hit); padding: .5em .63em;
  border: 1px solid #9b7b5d; border-radius: .55em; color: #3a291a; background: #fff8e7;
  font: inherit; font-size: var(--reader-button); font-weight: 750; line-height: 1.3;
  overflow-wrap: anywhere; text-align: start; cursor: pointer;
}
.helper-questions button[aria-pressed="true"], .helper-actions button:last-child {
  background: #19523f; color: white; border-color: #19523f;
}
.helper-questions button:hover:not([aria-pressed="true"]), .helper-games button:hover { background: #ffe2b7; }
.helper-chat button:focus-visible, .village-room-ui button:focus-visible, .walk-up-action:focus-visible {
  outline: 3px solid #0064a0; outline-offset: 2px;
}
.helper-answer { padding: .65em .75em; border-left: 4px solid #d66a2b; border-radius: .45em; background: #ffefd3; }
.helper-answer strong { display: block; color: #793a18; margin-bottom: .18em; }
.helper-answer strong:empty { display: none; }
.helper-chat [hidden], .village-room-ui[hidden], .walk-up-action[hidden], .local-guide-label[hidden] { display: none !important; }
.helper-directory h3 { margin-top: 1em; }
#panel .helper-directory button small { font-size: .94em; line-height: 1.3; }
.walk-up-action {
  position: fixed; z-index: 12; bottom: max(9.25rem, calc(env(safe-area-inset-bottom) + 7rem)); left: 50%;
  transform: translateX(-50%); min-height: 44px; padding: .55rem .9rem;
  border: 2px solid #cf6c25; background: #fff4db; border-radius: .75rem; color: #4e250e;
  font-weight: 800; cursor: pointer;
}
.local-guide-label {
  position: fixed; z-index: 5; transform: translate(-50%, -100%); border-radius: .85rem;
  min-height: 34px; white-space: nowrap; padding: .25rem .65rem; cursor: pointer;
}
.village-room-active #quest-card, .village-room-active #labels, .village-room-active #prompt,
.village-room-active #village-tools, .village-room-active .movement-tip, .village-room-active #walking {
  display: none !important;
}
.village-room-ui {
  position: fixed; z-index: 12; bottom: max(1rem, env(safe-area-inset-bottom)); left: 50%;
  transform: translateX(-50%); padding: .65rem .8rem; width: max-content; max-width: calc(100vw - 1.5rem);
  display: flex; align-items: center; flex-wrap: wrap; gap: .45rem; border-radius: .85rem;
  background: #fff7e4; color: #27473c; border: 2px solid #ad743a; box-shadow: 0 .3rem 1.4rem #20251f50;
}
.village-room-ui strong { margin-right: .3rem; }
.village-room-ui button {
  min-height: 44px; padding: .44rem .65rem; background: #e8f4e8; border: 1px solid #62977d;
  color: #194936; border-radius: .55rem; font-weight: 750; cursor: pointer;
}
@media(max-width:700px) {
  .walk-up-action { bottom: max(9.8rem, calc(env(safe-area-inset-bottom) + 9rem)); }
  .village-room-ui { width: min(22rem, calc(100vw - 1rem)); }
  .village-room-active .touch-pad { bottom: 6.5rem; }
}
.local-guide-label, .walk-up-action { pointer-events: auto; }
dialog#mine-helper-dialog {
  color: #243e35; border: 2px solid #b5703c; border-radius: 1rem; background: #fffbed; color-scheme: light;
}
#mine-helper-dialog::backdrop { background: #142e28aa; }
#mine-helper-dialog > .mine-helper-close {
  padding: 0; font-weight: 800; border: 1px solid #9b7b5d; border-radius: .7rem; cursor: pointer;
}
#prompt[data-kind="helper"] { z-index: 26; }
#prompt[data-kind="helper"] button { min-height: 44px; }
@media(max-width:700px) {
  #prompt[data-kind="helper"] { bottom: max(9.75rem, calc(env(safe-area-inset-bottom) + 9rem)); }
}


@media (max-width: 700px) {
  dialog:is(#panel, #mine-helper-dialog) {
    width: calc(100% - 2 * var(--reader-edge));
    max-width: calc(100% - 2 * var(--reader-edge));
    padding: .9rem;
  }
}
@media (max-width: 340px) {
  .helper-questions, .helper-games { grid-template-columns: 1fr; }
}

/* A phone can expose a 980px desktop layout even though its screen is narrow. */
@media (any-pointer: coarse) and (orientation: portrait) and (min-width: 701px) and (max-device-width: 600px),
       (any-pointer: coarse) and (orientation: portrait) and (min-width: 960px) and (max-width: 1000px) {
  dialog:is(#panel, #mine-helper-dialog) {
    --reader-unit: clamp(1rem, 4.25vw, 3.5rem);
    --reader-edge: 2.5vw;
  }
  dialog:is(#panel, #mine-helper-dialog) {
    width: calc(100% - 2 * var(--reader-edge));
    max-width: calc(100% - 2 * var(--reader-edge));
    padding: 3.5vw;
    border-radius: 3vw;
  }
}
