html, body {
  margin: 0;
  height: 100%;
  background: #cfc8bc;
  color: #241e18;
  font: 16px/1.45 system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  overflow: hidden;
  position: fixed;
  inset: 0;
  width: 100%;
  overscroll-behavior: none;
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
  -webkit-touch-callout: none;
}

#view {
  position: fixed;
  inset: 0;
  display: block;
  width: 100%;
  height: 100%;
  touch-action: none;
  cursor: grab;
}

body.locked #view { cursor: none; }

button {
  font: inherit;
  color: #241e18;
  background: #efe8dc;
  border: 1px solid #b7ab9a;
  border-radius: 8px;
  padding: 10px 14px;
  min-height: 44px;
  cursor: pointer;
}

button:hover { background: #f6f1e7; }
button:focus-visible { outline: 2px solid #241e18; outline-offset: 2px; }
button:disabled { opacity: 0.62; cursor: progress; }

#about-btn {
  position: fixed;
  z-index: 18;
  top: max(10px, env(safe-area-inset-top));
  left: max(10px, env(safe-area-inset-left));
  padding: 8px 12px;
  background: rgba(255, 252, 247, 0.9);
}

#look-hint {
  position: fixed;
  z-index: 6;
  left: 50%;
  top: max(14px, env(safe-area-inset-top));
  transform: translateX(-50%);
  margin: 0;
  padding: 6px 12px;
  border-radius: 999px;
  background: rgba(255, 252, 247, 0.82);
  color: #2c261f;
  font-size: 13px;
  pointer-events: none;
  white-space: nowrap;
}

#placard {
  position: fixed;
  z-index: 8;
  left: 50%;
  bottom: max(28px, env(safe-area-inset-bottom));
  transform: translateX(-50%);
  width: min(460px, calc(100% - 32px));
  margin: 0;
  padding: 14px 18px 15px;
  box-sizing: border-box;
  text-align: center;
  color: #2a241c;
  background: rgba(255, 252, 247, 0.94);
  border-radius: 6px;
  box-shadow: 0 10px 28px rgba(40, 30, 20, 0.16);
  pointer-events: none;
}

#placard h2 {
  margin: 0 0 4px;
  font-family: Georgia, "Iowan Old Style", Palatino, "Palatino Linotype", serif;
  font-size: 1.15rem;
  font-weight: 500;
  line-height: 1.25;
}

#placard p { margin: 0; color: #5c5348; font-size: 0.92rem; }

#stick {
  display: none;
  position: fixed;
  z-index: 12;
  left: max(16px, env(safe-area-inset-left));
  bottom: max(16px, env(safe-area-inset-bottom));
  width: 128px;
  height: 128px;
  border-radius: 50%;
  background: rgba(255, 252, 247, 0.28);
  border: 2px solid rgba(255, 252, 247, 0.72);
  box-shadow: inset 0 0 0 1px rgba(40, 30, 20, 0.08);
  touch-action: none;
}

body.touch #stick { display: block; }

#stick-knob {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 54px;
  height: 54px;
  border-radius: 50%;
  background: rgba(255, 252, 247, 0.92);
  box-shadow: 0 2px 8px rgba(40, 30, 20, 0.2);
  transform: translate(-50%, -50%);
}

body.touch #placard {
  bottom: calc(156px + env(safe-area-inset-bottom));
  width: min(460px, calc(100% - 28px));
}

#start, #about {
  position: fixed;
  inset: 0;
  z-index: 22;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: max(16px, env(safe-area-inset-top)) 16px max(16px, env(safe-area-inset-bottom));
  box-sizing: border-box;
  background: rgba(28, 24, 20, 0.42);
}

#about { z-index: 24; }

#start .card, #about .card {
  width: min(460px, 100%);
  max-height: min(86dvh, 720px);
  overflow: auto;
  -webkit-overflow-scrolling: touch;
  touch-action: pan-y;
  box-sizing: border-box;
  padding: 26px 24px 20px;
  border-radius: 8px;
  background: #f7f3ec;
  color: #241e18;
  box-shadow: 0 16px 40px rgba(20, 14, 8, 0.28);
}

#start h1, #about h2 {
  margin: 0 0 8px;
  font-family: Georgia, "Iowan Old Style", Palatino, "Palatino Linotype", serif;
  font-size: 1.7rem;
  font-weight: 500;
  line-height: 1.15;
}

#about h2 { font-size: 1.45rem; }

#start p, #about p { margin: 0 0 12px; }

#about h3 {
  margin: 16px 0 4px;
  font-size: 1rem;
  font-weight: 650;
}

#about .file {
  margin: 0 0 8px;
  font-size: 0.82rem;
  line-height: 1.35;
  overflow-wrap: anywhere;
}

#about a { color: #3a2e22; }

#enter, #credits-btn, #about-close {
  display: block;
  width: 100%;
  margin-top: 8px;
}

#enter {
  margin-top: 4px;
  background: #2c261f;
  color: #f7f3ec;
  border-color: #2c261f;
  font-weight: 600;
}

#enter:hover { background: #3d342b; }

.noscript {
  position: fixed;
  z-index: 40;
  left: 16px;
  right: 16px;
  bottom: 16px;
  margin: 0;
  padding: 12px 14px;
  background: #f7f3ec;
  border-radius: 8px;
}

[hidden] { display: none !important; }

@media (orientation: landscape) and (max-height: 500px) {
  body.touch #stick { width: 108px; height: 108px; }
  body.touch #placard {
    bottom: max(12px, env(safe-area-inset-bottom));
    left: calc(50% + 48px);
    width: min(420px, calc(100% - 180px));
  }
  #start .card, #about .card { padding: 16px 16px 12px; }
  #start h1 { font-size: 1.35rem; }
}

@media (pointer: coarse) {
  #about-btn { min-height: 44px; }
}
