html, body {
  margin: 0;
  height: 100%;
  background: #6d747a;
  color: #1c1915;
  font: 16px/1.4 "Segoe UI", sans-serif;
}
#yard-view {
  display: block;
  width: 100vw;
  height: 100vh;
  height: 100dvh;
  touch-action: none;
}
#yard-loading {
  position: fixed;
  inset: 0;
  z-index: 1;
  pointer-events: none;
  opacity: 1;
}
#yard-loading img { width: 100%; height: 100%; object-fit: cover; }
html[data-yard-ready] #yard-loading { opacity: 0; transition: opacity .35s ease; }
@media (prefers-reduced-motion: reduce) {
  html[data-yard-ready] #yard-loading { transition: none; }
}
.hud, .file-fallback, .scheme {
  position: fixed;
  z-index: 2;
}
.hud-link, .hud button, .file-fallback a, .player-close, .transport-mini button, .yard-track-button {
  font: inherit;
  color: inherit;
  background: #f4efe6;
  border: 1px solid #2a2723;
  min-height: 44px;
  padding: 0 14px;
  text-decoration: none;
}
.hud-link:focus-visible, button:focus-visible, .yard-track-button:focus-visible {
  outline: 3px solid #d7ff77;
  outline-offset: 2px;
}
.yard-corner {
  position: fixed;
  top: 14px;
  right: 14px;
  z-index: 5;
  display: flex;
  align-items: center;
  gap: 16px;
}
.home-link {
  position: fixed;
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  top: 88px;
  right: 92px;
  z-index: 16;
  color: #f7f4ee;
  font-size: clamp(.85rem, 1.5vw, 1.4rem);
  font-weight: 700;
  letter-spacing: .04em;
  line-height: 1;
  text-decoration: none;
  text-shadow: 0 1px 2px rgba(0, 0, 0, .55);
}
.home-link:hover,
.home-link:focus-visible {
  color: #fff;
}
.stick {
  display: none;
  position: fixed;
  left: 18px;
  bottom: 18px;
  width: 108px;
  height: 108px;
  border-radius: 50%;
  background: rgba(244, 239, 230, 0.35);
  touch-action: none;
  z-index: 3;
}
.look-pad,
.touch-guide { display: none; }
.control-label {
  position: absolute;
  left: 50%;
  top: calc(100% + 8px);
  color: rgba(255, 255, 255, .78);
  font: 700 10px/1 "Segoe UI", sans-serif;
  letter-spacing: .16em;
  text-transform: uppercase;
  text-shadow: 0 1px 3px rgba(0, 0, 0, .7);
  transform: translateX(-50%);
}
#stick-nub {
  position: absolute;
  left: 38px;
  top: 38px;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: #f4efe6;
}
.file-fallback, #player-panel {
  background: rgba(244, 239, 230, 0.96);
}
.file-fallback {
  inset: 24px;
  padding: 24px;
}
.yard-unavailable .scheme,
.yard-unavailable .touch-guide,
.yard-unavailable .stick,
.yard-unavailable .look-pad,
.yard-unavailable .yard-player,
.yard-unavailable .yard-corner { display: none; }
#player-panel {
  position: fixed;
  top: 16px;
  right: 16px;
  width: min(420px, calc(100vw - 32px));
  max-height: calc(100vh - 32px);
  display: flex;
  flex-direction: column;
  padding: 12px;
  z-index: 6;
  overflow: auto;
}
#player-panel[hidden], [hidden] { display: none !important; }
body.is-reading .stick, body.is-reading #enter-walk, body.is-reading #listen { display: none; }
.wall-logo { background: #2a2723; display: block; }
.yard-tracks {
  list-style: none;
  margin: 8px 0;
  padding: 0;
  overflow: auto;
}
.yard-track-button {
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  text-align: left;
  margin: 0 0 6px;
}
.yard-track-title { font-size: 1.05rem; }
.yard-track-artist { color: #5c564e; font-size: 0.85rem; }
.yard-track.is-current .yard-track-button { background: #d7eead; }
#player-panel[data-state="loading"] #yard-status { color: #8a5a12; }
#player-panel[data-state="playing"] #yard-status { color: #2f6b3a; }
#player-panel[data-state="paused"] #yard-status { color: #3d4a68; }
#player-panel[data-state="error"] #yard-status { color: #8d2d24; }
.transport-mini { display: flex; gap: 8px; align-items: center; }
.yard-player {
  position: fixed;
  right: 18px;
  bottom: 16px;
  z-index: 6;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  max-width: min(46vw, 420px);
  margin: 0;
  padding: 0;
  color: #f7f4ee;
  font: 600 15px/1.2 "Segoe UI", sans-serif;
  text-shadow: 0 1px 2px rgba(0, 0, 0, .65);
}
.yard-player button {
  min-width: 36px;
  min-height: 36px;
  padding: 0;
  color: inherit;
  background: none;
  border: 0;
  font: inherit;
  cursor: pointer;
}
.yard-player p {
  margin: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.scheme {
  left: 10px;
  bottom: 10px;
  top: auto;
  z-index: 4;
  width: clamp(116px, 13vw, 180px);
  aspect-ratio: 1;
  overflow: hidden;
  border-radius: 50%;
  max-width: none;
  padding: 0;
  background: #50574c;
  border: 2px solid rgba(244, 239, 230, 0.6);
  box-shadow: 0 3px 14px rgba(0, 0, 0, .3);
  pointer-events: none;
}
#scheme-canvas {
  display: block;
  width: 100%;
  height: auto;
  aspect-ratio: 1;
  background: transparent;
}
body.is-reading .stick, body.is-reading #enter-walk, body.is-reading #listen { display: none; }
.montana {
  position: relative;
  z-index: 4;
  padding: 7px 8px 8px;
  pointer-events: none;
  background: linear-gradient(#2a2c28, #121311);
  border-radius: 8px;
  box-shadow:
    inset 0 0 0 2px #3c3f38,
    inset 0 1px 0 rgba(255, 255, 255, .12),
    0 2px 0 #070807;
}
.montana[hidden] { display: none; }
.montana-screen {
  display: grid;
  place-items: center;
  width: 78px;
  height: 28px;
  background: #c5d0b2;
  border-radius: 2px;
  box-shadow: inset 0 0 0 1px rgba(20, 24, 16, .35);
}
.montana-ghost,
.montana-face {
  grid-area: 1 / 1;
  font: 700 20px "Courier New", ui-monospace, monospace;
  letter-spacing: .06em;
  line-height: 1;
}
.montana-ghost { color: rgba(36, 44, 28, .22); }
.montana-face { color: #1c2418; }
@media (max-width: 640px), (pointer: coarse) and (max-width: 960px) {
  .home-link { top: 64px; right: 36px; font-size: .85rem; }
}
@media (pointer: coarse) {
  .stick,
  .look-pad {
    display: block;
    position: fixed;
    bottom: max(24px, calc(env(safe-area-inset-bottom) + 16px));
    z-index: 7;
    width: 112px;
    height: 112px;
    border: 1px solid rgba(255, 255, 255, .34);
    border-radius: 50%;
    background: radial-gradient(circle, rgba(244, 239, 230, .14), rgba(20, 24, 24, .18) 66%, transparent 68%);
    box-shadow: inset 0 0 28px rgba(255, 255, 255, .06), 0 8px 24px rgba(0, 0, 0, .12);
  }
  .stick { left: max(18px, env(safe-area-inset-left)); right: auto; }
  .look-pad {
    right: max(18px, env(safe-area-inset-right));
    pointer-events: none;
  }
  .look-pad::before {
    content: "";
    position: absolute;
    inset: 36px;
    border: 1px solid rgba(255, 255, 255, .52);
    border-radius: 50%;
  }
  .look-pad::after {
    content: "";
    position: absolute;
    left: 50%;
    top: 50%;
    width: 46px;
    height: 1px;
    background: rgba(255, 255, 255, .32);
    box-shadow: 0 -12px 0 rgba(255, 255, 255, .16), 0 12px 0 rgba(255, 255, 255, .16);
    transform: translate(-50%, -50%);
  }
  .touch-guide {
    position: fixed;
    top: 50%;
    left: 50%;
    z-index: 8;
    display: flex;
    gap: 14px;
    padding: 8px 12px;
    color: rgba(255, 255, 255, .88);
    border: 1px solid rgba(255, 255, 255, .2);
    border-radius: 999px;
    background: rgba(22, 27, 27, .5);
    font: 600 11px/1.2 "Segoe UI", sans-serif;
    pointer-events: none;
    white-space: nowrap;
    text-shadow: 0 1px 2px rgba(0, 0, 0, .7);
    transform: translate(-50%, -50%);
    transition: opacity .35s ease, transform .35s ease;
  }
  body.has-touch-input .touch-guide {
    opacity: 0;
    transform: translate(-50%, -60%);
    pointer-events: none;
  }
  .yard-player {
    right: max(12px, env(safe-area-inset-right));
    bottom: max(164px, calc(env(safe-area-inset-bottom) + 154px));
    max-width: calc(100vw - 24px);
  }
  .yard-player button { min-width: 44px; min-height: 44px; }
  .scheme {
    top: max(14px, env(safe-area-inset-top));
    left: max(12px, env(safe-area-inset-left));
    bottom: auto;
    width: 112px;
  }
  body.is-reading .look-pad,
  body.is-reading .touch-guide { display: none; }
}

@media (pointer: coarse) and (max-width: 380px) {
  .stick,
  .look-pad { width: 96px; height: 96px; }
  #stick-nub { left: 32px; top: 32px; }
  .touch-guide { gap: 8px; font-size: 10px; }
}

@media (max-height: 540px) {
  .touch-guide { display: none; }
}
.yard-debug { position: fixed; top: 76px; left: 12px; z-index: 60; width: min(300px, calc(100vw - 24px)); padding: 12px; box-sizing: border-box; border: 1px solid #bac48b55; border-radius: 8px; background: #101511db; color: #dce4cc; font: 12px/1.4 Consolas, monospace; }
.yard-debug strong { color: #bac48b; font-weight: 400; }
.yard-debug textarea { display: block; box-sizing: border-box; width: 100%; height: 160px; margin: 8px 0; resize: vertical; border: 0; background: transparent; color: inherit; font: inherit; }
.yard-debug button { width: 100%; padding: 8px; border: 1px solid #bac48b55; border-radius: 4px; background: #bac48b12; color: inherit; font: inherit; cursor: pointer; }
.yard-debug [role="status"] { display: block; margin-top: 4px; }
@media (max-width: 500px) { .yard-debug { top: 60px; width: 230px; padding: 8px; } .yard-debug textarea { height: 105px; } }
