html, body {
  height: 100%;
  min-height: 100%;
  margin: 0;
  padding: 0;
}

body {
  background: #18181b;
  color: white;
}

/* Viewport */
#viewport {
  max-width: min(92vw, 640px);
  margin: 0 auto;
  border: 4px solid #27272a;
  background: #052e16;
  border-radius: 1.5rem;
  overflow: hidden;
  box-shadow: 0 25px 50px -12px rgb(0 0 0 / 0.4);
}

/* Scroll container - allows dragging to scroll */
#map-container {
  width: 100%;
  height: 100%;
  overflow: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: thin;
  scrollbar-color: #4b5563 #1f2937;
  touch-action: pan-x pan-y;
}

/* World grid */
#world {
  origin-top-left: top left;
  transition: transform 75ms ease-out;
  will-change: transform;
  contain: layout paint style;
  transform-origin: top left;
}

/* Tokens and ghost */
.character-token {
  user-select: none;
  touch-action: none;
  cursor: grab;
  min-width: 40px;
  min-height: 40px;
}

.drag-ghost {
  position: fixed;
  pointer-events: none;
  z-index: 9999;
  opacity: 0.8;
  transform: translate(-50%, -50%);
  box-shadow: 0 10px 15px -3px rgb(0 0 0 / 0.3);
}

.grid-cell {
  width: 50px;
  height: 50px;
  outline: 1px solid #27272a;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 6px;
  box-sizing: border-box;
  contain: strict;
}

/* Prevent double-tap zoom on buttons */
button, .control-btn {
  touch-action: manipulation;
}

button {
  cursor: pointer;
}