:root {
  --bg: #faf8f4;
  --ink: #2b2925;
  --muted: #7a746b;
  --line: #e4dfd5;
  --gold: #e8b04b;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; overflow: hidden; background: #e9edf0; color: var(--ink);
  font: 14px/1.45 Inter, system-ui, sans-serif; touch-action: none; }
#scene { position: fixed; inset: 0; width: 100%; height: 100%; display: block; cursor: grab; }
#scene:active { cursor: grabbing; }
button { font: inherit; cursor: pointer; }
.muted { color: var(--muted); }

#bar { position: fixed; top: 12px; left: 12px; right: 12px; display: flex; align-items: center; gap: 14px;
  background: rgba(250,248,244,.95); border-radius: 14px; padding: 8px 12px; box-shadow: 0 4px 20px rgba(0,0,0,.15); z-index: 5; }
.back { color: var(--ink); text-decoration: none; font-size: 13px; padding: 6px 10px; border-radius: 8px; border: 1px solid var(--line); background: #fff; white-space: nowrap; }
.title { flex: 1; min-width: 0; }
.title h1 { margin: 0; font: 600 22px/1.1 "Cormorant Garamond", serif; }
.title p { margin: 0; font-size: 12px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.modes { display: flex; background: #efebe3; border-radius: 9px; padding: 3px; }
.modes button { border: 0; background: none; padding: 6px 12px; border-radius: 7px; color: var(--muted); }
.modes button.on { background: #fff; color: var(--ink); box-shadow: 0 1px 3px rgba(0,0,0,.12); }

#types { position: fixed; top: 96px; left: 12px; right: 12px; display: flex; gap: 6px; overflow-x: auto; z-index: 5; padding-bottom: 4px; scrollbar-width: none; }
#types button { flex: none; border: 0; border-radius: 99px; padding: 6px 12px; background: var(--c); color: #1f1d1a; font-size: 12px;
  box-shadow: 0 2px 8px rgba(0,0,0,.12); outline: 2px solid transparent; outline-offset: 1px; }
#types button.dark { color: #fff; }
#types button.on { outline-color: var(--ink); }
#types button small { opacity: .75; margin-left: 4px; }

#mini { position: fixed; right: 12px; bottom: 12px; width: 190px; background: rgba(250,248,244,.95); border-radius: 12px; padding: 8px;
  box-shadow: 0 4px 20px rgba(0,0,0,.15); z-index: 5; }
#mini-map { position: relative; width: 100%; aspect-ratio: 1; overflow: hidden; border-radius: 8px; background: #fff; }
#mini-img { position: absolute; transform-origin: 0 0; }
#mini-dot { position: absolute; width: 16px; height: 16px; margin: -8px 0 0 -8px; border-radius: 50%; background: var(--gold);
  border: 2px solid #fff; box-shadow: 0 1px 4px rgba(0,0,0,.4); }
#mini-dot::after { content: ""; position: absolute; left: 50%; top: -11px; margin-left: -5px; border: 5px solid transparent; border-bottom: 9px solid var(--gold); }
#mini-level { margin: 4px 0 0; font-size: 11px; text-align: center; }

#hud { position: fixed; left: 50%; bottom: 14px; transform: translateX(-50%); text-align: center; z-index: 5; }
#level-btns { display: flex; gap: 8px; justify-content: center; margin-bottom: 6px; }
#level-btns[hidden] { display: none; }
#level-btns button { border: 0; border-radius: 10px; padding: 9px 14px; background: var(--ink); color: #fff; box-shadow: 0 4px 14px rgba(0,0,0,.25); }
#level-btns button:disabled { opacity: .35; cursor: default; }
#hint { margin: 0; background: rgba(250,248,244,.9); padding: 5px 10px; border-radius: 99px; font-size: 12px; }

#joystick { position: fixed; left: 24px; bottom: 24px; width: 110px; height: 110px; border-radius: 50%; background: rgba(255,255,255,.35);
  border: 2px solid rgba(255,255,255,.8); z-index: 6; display: none; }
#joystick span { position: absolute; left: 50%; top: 50%; width: 46px; height: 46px; margin: -23px 0 0 -23px; border-radius: 50%; background: rgba(43,41,37,.75); }
body.touch.walk #joystick { display: block; }

#note { position: fixed; left: 12px; bottom: 12px; max-width: 300px; font-size: 11px; color: var(--muted);
  background: rgba(250,248,244,.85); padding: 6px 9px; border-radius: 8px; z-index: 4; }
.agents-only { margin: 2px 0 0; font-size: 11px; font-weight: 600; color: #e07f00; }
#note summary { cursor: pointer; font-weight: 500; color: var(--ink); }
#note details[open] { max-height: 50vh; overflow-y: auto; }
#note p { margin: 6px 0 0; }
/* Phones: the joystick sits bottom-left, so the disclaimer moves to the top under the unit-type chips. */
body.touch #note { left: 8px; right: 140px; bottom: auto; top: 108px; max-width: none; }

@media (max-width: 720px) {
  .title .agents-only { display: none; } /* shown in the disclaimer note below instead */
  #bar { top: 8px; left: 8px; right: 8px; gap: 8px; padding: 6px 8px; }
  .title h1 { font-size: 18px; }
  .modes button { padding: 5px 8px; font-size: 12px; }
  #types { top: 64px; left: 8px; right: 8px; }
  #mini { width: 120px; right: 8px; bottom: auto; top: 108px; padding: 5px; }
  #hud { bottom: 150px; }
  body:not(.touch) #hud { bottom: 14px; }
}
