/* Keep the note field in view while the introduction and destinations scroll. */
@media (min-width: 1200px) {
  body .audit-notes-sidebar {
    display: flex !important;
    flex-direction: column;
    overflow: hidden !important;
    min-height: 0;
  }
  body .audit-notes-sidebar .audit-intro-scroll {
    flex: 1 1 auto;
    min-height: 0;
    overflow: auto;
    scrollbar-width: thin;
    padding-inline-end: .25rem;
  }
  body .audit-notes-sidebar .audit-notepad {
    flex: 0 0 auto;
    margin-top: .65rem;
    padding-top: .55rem;
  }
  .audit-notepad textarea {
    display: block;
    height: 4.5rem;
    min-height: 3rem;
    max-height: 7rem;
    resize: vertical;
  }
}
@media (max-width: 1199px) {
  .audit-intro-scroll { display: contents; }
}
.audit-arrival[hidden], .audit-arrival-controls[hidden] { display: none !important; }
body.audit-at-arrival :is(.atlas-centre, .atlas-right):not(.audit-arrival, .audit-arrival-controls) {
  display: none !important;
}
body .audit-arrival {
  border: 1px solid var(--atlas-border, #92b4cb);
  border-radius: 12px;
  background: var(--atlas-ground, #e5eee9);
  overflow: hidden !important;
}
.audit-arrival img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}
body .audit-arrival-controls button,
body .audit-back,
body .audit-arrival-controls a {
  display: block;
  width: 100%;
  margin: 0 0 .65rem;
  padding: .55rem .65rem;
  font: 600 .95rem/1.4 system-ui, sans-serif;
}
.audit-arrival-controls h2 { margin-block: .8rem .45rem; }
.audit-arrival-controls a { text-align: center; }
@media (max-width: 1199px) {
  body .audit-arrival { min-height: 0 !important; aspect-ratio: 3 / 2; }
}
body[data-place="binary-boulevard"] .boulevard-stage > img { object-fit: fill; }
body[data-place="binary-boulevard"] #binary-readout { white-space: normal; }
body[data-place="clock-tower"] #clock-face[data-positions] button {
  width: var(--dial-button-size, 44px);
  height: var(--dial-button-size, 44px);
  min-height: 0;
  font-size: clamp(.7rem, 2.5cqw, 1.05rem);
}
body[data-place="clock-tower"] .clock-face { container-type: inline-size; }
body[data-place="clock-tower"] .clock-controls details { margin-block: .85rem 0; }

body .audit-arrival { position: relative; }
.audit-arrival .audit-arrival-resident {
  position: absolute;
  inset: auto auto 11% 28%;
  width: 14%;
  height: 19%;
  object-fit: contain;
  object-position: bottom;
}
.audit-crossing-log {
  display: flex;
  align-items: center;
  gap: .8rem;
  max-height: 8rem;
  flex: 0 0 auto;
}
.audit-crossing-log .crossing-count { margin: 0; flex: 0 0 auto; font-size: 1rem; }
.audit-crossing-log #log { flex: 1; max-height: 4.3rem; overflow: auto; margin: 0; padding-left: 1.6rem; }
.audit-crossing-log #log:empty::before { content: "Completed crossings will appear here."; }
body[data-place="the-rocky-ascent"] .rocky-stage #mode-switch[hidden] {
  display: none !important;
}
body[data-place="the-rocky-ascent"] .rocky-stage .audit-climb-bar {
  position: absolute;
  z-index: 3;
  inset: auto .85rem .85rem;
  display: flex !important;
  flex-wrap: wrap;
  align-items: start;
  justify-content: space-evenly;
  gap: .65rem clamp(1rem, 4cqw, 3rem) !important;
  background: var(--atlas-paper, #eff5ed);
}
.audit-climb-bar > div { flex: 1 1 15rem; min-width: 0; }
.audit-climb-bar .score,
.audit-climb-bar .meter,
.audit-climb-bar #remaining,
.audit-climb-bar #challenge-note { margin: 0; }
.audit-climb-fatigue, .audit-climb-actions {
  display: grid;
  align-content: center;
  gap: .25rem;
  text-align: center;
}
.audit-climb-bar .score { justify-content: center; }
.audit-fatigue-panel {
  box-sizing: border-box;
  min-height: 42px;
  display: grid;
  align-content: center;
  gap: .2rem;
  padding: .2rem .65rem;
  border: 1px solid var(--atlas-accent, #405f3a);
  border-radius: 7px;
  background: var(--atlas-paper, #eff5ed);
}
.audit-fatigue-panel .meter { height: .55rem; }
body[data-place="the-rocky-ascent"] .audit-climb-bar .climb-controls {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: .45rem;
  margin: 0;
}
body[data-pattern-place="pattern-archive"] .archive-calculator {
  max-height: calc(100% - 2rem);
  display: flex;
  flex-direction: column;
  gap: .5rem;
  overflow: auto;
}
body[data-pattern-place="pattern-archive"] .archive-tool-bar {
  margin: .25rem 0 0;
  padding: .5rem .7rem;
  flex: 0 0 auto;
}
body[data-pattern-place="pattern-archive"] #result {
  max-height: clamp(5rem, 25vh, 14rem);
}
body[data-pattern-place="pattern-archive"] .archive-tool-bar .actions { gap: .35rem; }
body[data-pattern-place="pattern-archive"] .archive-tool-bar label { margin-top: 0; }

body[data-place="konigsberger-brucke"] .bridge-puzzle:not([hidden]) {
  display: flex;
  flex-direction: column;
}
body[data-place="konigsberger-brucke"] .bridge-puzzle #walking-map {
  flex: 1 1 0;
  min-height: 0;
  height: auto;
}
.audit-bridge-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  flex: 0 0 auto;
  gap: .35rem .8rem;
  margin: .3rem;
  padding: .35rem .65rem !important;
}
.audit-bridge-bar .walk-score,
.audit-bridge-bar .walk-buttons { margin: 0; }

/* These pages use the full desktop viewport for their three panels. */
@media (min-width: 1200px) {
  body.atlas-location[data-atlas-full-height] .atlas-workspace { padding-block-end: 0 !important; }
  body[data-atlas-full-height] > footer { display: none; }
}
body[data-place="binary-boulevard"] .boulevard-stage .binary-house[aria-pressed="true"] .house-windows span:nth-child(-n+2) {
  background: radial-gradient(ellipse at center, #fff0a8 0%, #ffdf82de 46%, #ffcf6f91 69%, #ffcc670a 100%) !important;
  box-shadow: none !important;
}
body[data-place="clock-tower"] .clock-stage { gap: .15rem; padding: .5rem .65rem; }
body[data-place="clock-tower"] .clock-stage .clock-face {
  width: min(480px, 100%, 46dvh);
  margin: .35rem auto;
}
body[data-place="clock-tower"] .clock-stage #clock-readout {
  min-height: 0;
  margin: .2rem 0;
  padding: .35rem .55rem;
}
body[data-place="clock-tower"] .clock-stage #clock-readout[hidden] { display: none !important; }
body[data-place="clock-tower"] .clock-bottom-bar {
  width: 100%;
  margin-top: auto;
  padding: .4rem .6rem;
}
.clock-control-row,
.clock-bottom-bar #custom-clock-controls:not([hidden]) {
  display: flex;
  flex-wrap: wrap;
  align-items: end;
  justify-content: center;
  gap: .35rem .55rem;
}
body[data-place="clock-tower"] .clock-control-row {
  column-gap: clamp(.35rem, calc((100cqw - 42rem) * .025), 1rem);
}
.clock-control-row #clock-back {
  margin-inline-start: clamp(0rem, calc((100cqw - 44rem) * .16), 5rem);
}
.clock-control-row label { font-size: .85rem; }
.clock-control-row :is(select, input) { display: block; width: 100%; }
.clock-control-row select { max-width: 7rem; }
.clock-control-row input { max-width: 3.75rem; }
.clock-bottom-bar :is(select, input, button) {
  min-height: 36px;
  padding: .3rem .55rem;
  font-size: .875rem;
}
body[data-place="clock-tower"] .clock-control-row button {
  white-space: nowrap;
  font-size: .82rem;
  padding-inline: .45rem;
}
.clock-take-steps { display: flex; flex-wrap: wrap; gap: .35rem; margin-inline-start: .35rem; }
.clock-bottom-bar #custom-clock-controls:not([hidden]) { margin-bottom: .5rem; }
.clock-bottom-bar #clock-custom-feedback { margin: 0; font-size: .8rem; }
.clock-bottom-bar #clock-custom-feedback:empty { display: none; }
body[data-pattern-place="pattern-archive"] .archive-calculator {
  width: min(calc(100% - 2rem), 64rem);
  justify-self: center;
  background: color-mix(in srgb, var(--atlas-paper, #f6fcff) 91%, transparent) !important;
}
body[data-pattern-place="pattern-archive"] .archive-results #history {
  height: clamp(5rem, 16dvh, 10rem);
  overflow-y: auto;
  margin: .35rem 0 .65rem;
}
body[data-pattern-place="pattern-archive"] .archive-results #history:empty { display: none; }
body[data-place="konigsberger-brucke"] #bridge-choices {
  display: flex;
  flex-wrap: wrap;
  gap: .25rem;
  margin-block: .4rem;
}
body[data-place="konigsberger-brucke"] #bridge-choices button {
  flex: 0 1 auto;
  min-height: 32px;
  font-size: .82rem;
  padding: .2rem .4rem;
}
body[data-place="konigsberger-brucke"] #walk-log { max-height: 9rem; overflow-y: auto; }
body[data-place="konigsberger-brucke"] .land-area.is-reachable { cursor: pointer; }
body[data-place="konigsberger-brucke"] .land-area.is-reachable:hover > text:not(.you-marker) { stroke: #ffe3a0; }

.audit-sidebar-art {
  display: block;
  width: min(100%, 15rem);
  max-height: 38dvh;
  object-fit: contain;
  margin: 1rem auto 0;
}
.audit-arrival .square-policeman { inset: auto auto 13% 18%; height: 23%; }
.audit-arrival .square-warehouseman { inset: auto 15% 18% auto; height: 20%; }
.clearing-objects svg { display: block; width: 100%; height: 100%; pointer-events: none; }
.clearing-stone { pointer-events: all; }
.clearing-stone path { fill: transparent; stroke: transparent; stroke-width: 3; }
.clearing-stone:hover path, .clearing-stone:focus-visible path {
  fill: #ffdd8355;
  stroke: #fff4bb;
}
@media (max-width: 1199px) {
  body[data-place="the-clearing"] .clearing-stage { aspect-ratio: auto !important; }
}

@media (min-width: 1200px) and (max-height: 800px) {
  body[data-place="clock-tower"] .clock-stage .clock-face { width: min(480px, 100%, 38dvh); }
  body[data-place="clock-tower"] .clock-stage :is(.clock-caption, .small) {
    margin-block: .2rem;
    padding-block: .3rem;
  }
}

body[data-pattern-place="pattern-archive"] #result {
  background: transparent;
  text-align: center;
  font-size: clamp(1.15rem, 2.1vw, 1.8rem);
  line-height: 1.35;
}
body[data-pattern-place="pattern-archive"] .archive-calculator > section {
  text-align: center;
}

body[data-place="the-crossing"] .crossing-back-button {
  min-height: 44px;
  border: 1px solid var(--atlas-accent, #405f3a);
  border-radius: 8px;
  background: var(--atlas-paper, #eff5ed);
  color: var(--atlas-accent, #405f3a);
  text-align: center;
  text-decoration: none;
}
body[data-place="the-crossing"] .crossing-back-button:hover {
  background: var(--atlas-accent, #405f3a);
  color: var(--atlas-paper, #eff5ed);
}

body[data-place="konigsberger-brucke"] .land-area[aria-disabled="false"] .land-hit {
  pointer-events: fill;
  cursor: pointer;
}

/* Keep arrival sprites aligned with the scenery. */
.boulevard-arrival-art, .clock-arrival-art, .lookout-arrival-art {
  display: block;
  width: 100%;
  height: 100%;
}
.boulevard-lamplighter, .clock-arrival-cuckoo, .lookout-telescope {
  display: block;
  width: min(100%, 14rem);
  height: auto;
  max-height: 48dvh;
  object-fit: contain;
  margin: 1rem auto 0;
}
@media (min-width: 1200px) {
  body:is([data-place="binary-boulevard"], [data-place="clock-tower"], [data-place="zero-point"]) .audit-arrival-controls {
    display: flex;
    flex-direction: column;
  }
  body:is([data-place="binary-boulevard"], [data-place="clock-tower"], [data-place="zero-point"]) .audit-arrival-controls > * { flex-shrink: 0; }
  .boulevard-lamplighter, .clock-arrival-cuckoo, .lookout-telescope { margin-block: auto; }
}
.lookout-telescope { transform: scaleX(-1); }

@media (min-width: 1200px) {
  body[data-place="numberland-map"] .map-frame {
    height: 100%;
    max-height: none;
  }
  body[data-place="numberland-map"] .painted-map {
    width: 100%;
    height: 100%;
    aspect-ratio: auto;
  }
  body[data-place="numberland-map"] .painted-map > img {
    width: 100%;
    height: 100%;
    object-fit: fill;
  }
  body[data-pattern-place="patternlands"] .ice-instructions {
    display: flex;
    flex-direction: column;
  }
  body[data-pattern-place="patternlands"] .ice-instructions .audit-sidebar-art {
    margin-block: auto;
    flex-shrink: 1;
    min-height: 0;
  }
}
