:root {
  --ink: #1d1b18;
  --paper: #f3efe7;
  --card: rgba(255, 253, 249, 0.92);
  --line: rgba(29, 27, 24, 0.12);
  --accent: #c8643c;
  --safe-b: env(safe-area-inset-bottom, 0px);
  --safe-t: env(safe-area-inset-top, 0px);
  font-family: -apple-system, "Segoe UI", Tahoma, "Noto Sans Arabic", Arial, sans-serif;
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; height: 100%; overflow: hidden; background: var(--paper); color: var(--ink); }
body { overscroll-behavior: none; touch-action: none; user-select: none; -webkit-user-select: none; }
#view { position: fixed; inset: 0; width: 100%; height: 100%; display: block; }

.top {
  position: fixed; top: calc(10px + var(--safe-t)); left: 10px; right: 10px;
  display: flex; justify-content: space-between; align-items: flex-start; pointer-events: none;
}
.title {
  background: var(--card); border: 1px solid var(--line); border-radius: 14px;
  padding: 8px 12px; display: flex; flex-direction: column; gap: 1px; pointer-events: auto;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.08);
}
.title strong { font-size: 14px; }
.title span { font-size: 11px; opacity: 0.6; }
.tools { display: flex; gap: 8px; pointer-events: auto; }
.icon {
  width: 42px; height: 42px; border-radius: 12px; border: 1px solid var(--line);
  background: var(--card); display: grid; place-items: center; cursor: pointer;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.08); transition: transform 0.15s ease;
}
.icon:active { transform: scale(0.94); }
.icon svg { width: 22px; height: 22px; fill: none; stroke: var(--ink); stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.icon.on { background: var(--ink); }
.icon.on svg { stroke: #fff; }

#minimap {
  position: fixed; top: calc(68px + var(--safe-t)); right: 10px; width: 150px; height: 120px;
  border-radius: 12px; background: var(--card); border: 1px solid var(--line);
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.08);
}

.rooms {
  position: fixed; left: 0; right: 0; bottom: calc(12px + var(--safe-b));
  display: flex; gap: 8px; padding: 0 12px; overflow-x: auto; scrollbar-width: none;
  justify-content: safe center;
}
.rooms::-webkit-scrollbar { display: none; }
.room {
  flex: 0 0 auto; border: 1px solid var(--line); background: var(--card); color: var(--ink);
  border-radius: 999px; padding: 8px 14px; font: inherit; font-size: 13px; cursor: pointer;
  display: flex; align-items: center; gap: 6px; box-shadow: 0 4px 14px rgba(0, 0, 0, 0.08);
  transition: background 0.2s, transform 0.15s;
}
.room:active { transform: scale(0.96); }
.room small { font-size: 10px; opacity: 0.55; }
.room .tick { width: 16px; height: 16px; border-radius: 50%; border: 1.5px solid var(--line); display: grid; place-items: center; font-size: 10px; color: transparent; }
.room.seen .tick { background: var(--accent); border-color: var(--accent); color: #fff; }
.room.here { background: var(--ink); color: #fff; }
.room.here small { opacity: 0.7; }

.joy {
  position: fixed; left: 18px; bottom: calc(70px + var(--safe-b)); width: 112px; height: 112px;
  border-radius: 50%; background: rgba(255, 253, 249, 0.35); border: 1.5px solid rgba(255, 255, 255, 0.75);
  backdrop-filter: blur(4px); -webkit-backdrop-filter: blur(4px); display: none; touch-action: none;
}
.joy .knob {
  position: absolute; left: 50%; top: 50%; width: 46px; height: 46px; margin: -23px 0 0 -23px;
  border-radius: 50%; background: rgba(255, 255, 255, 0.92); box-shadow: 0 3px 10px rgba(0, 0, 0, 0.2);
}
body.walk.touch .joy { display: block; }

.hint {
  position: fixed; left: 50%; bottom: calc(66px + var(--safe-b)); transform: translateX(-50%);
  background: rgba(29, 27, 24, 0.82); color: #fff; font-size: 12.5px; padding: 7px 12px;
  border-radius: 10px; white-space: nowrap; opacity: 0; transition: opacity 0.4s; pointer-events: none;
  text-align: center;
}
.hint.show { opacity: 1; }
body.walk.touch .hint { bottom: calc(196px + var(--safe-b)); }
.toast {
  position: fixed; left: 50%; top: 45%; transform: translate(-50%, -50%); background: var(--ink); color: #fff;
  padding: 10px 16px; border-radius: 12px; font-size: 13px; opacity: 0; transition: opacity 0.3s; pointer-events: none;
}
.toast.show { opacity: 1; }

.loading {
  position: fixed; inset: 0; display: grid; place-content: center; gap: 12px; background: var(--paper);
  transition: opacity 0.6s; z-index: 10; text-align: center; font-size: 13px;
}
.loading .bar { width: 180px; height: 4px; border-radius: 4px; background: var(--line); overflow: hidden; margin: auto; }
.loading .bar i { display: block; height: 100%; width: 0%; background: var(--accent); transition: width 0.2s; }
.loading.done { opacity: 0; pointer-events: none; }

.marker { display: none; }

.clean .hint, .clean .toast { display: none; }
